@tarojs/components-react 4.0.1-alpha.0 → 4.0.1
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/LICENSE +8 -8
- package/dist/components/button/index.js +103 -78
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/icon/index.js +17 -26
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/image/index.js +101 -76
- package/dist/components/image/index.js.map +1 -1
- package/dist/components/input/index.js +206 -183
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/pull-down-refresh/index.js +211 -195
- package/dist/components/pull-down-refresh/index.js.map +1 -1
- package/dist/components/scroll-view/index.js +167 -137
- package/dist/components/scroll-view/index.js.map +1 -1
- package/dist/components/swiper/index.js +268 -248
- package/dist/components/swiper/index.js.map +1 -1
- package/dist/components/text/index.js +31 -22
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/view/index.js +97 -72
- package/dist/components/view/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/utils/index.js +15 -26
- package/dist/utils/index.js.map +1 -1
- package/package.json +18 -19
- package/dist/solid/components/button/index.js +0 -95
- package/dist/solid/components/button/index.js.map +0 -1
- package/dist/solid/components/button/style/index.scss.js +0 -4
- package/dist/solid/components/button/style/index.scss.js.map +0 -1
- package/dist/solid/components/icon/index.js +0 -39
- package/dist/solid/components/icon/index.js.map +0 -1
- package/dist/solid/components/icon/style/index.scss.js +0 -4
- package/dist/solid/components/icon/style/index.scss.js.map +0 -1
- package/dist/solid/components/image/index.js +0 -94
- package/dist/solid/components/image/index.js.map +0 -1
- package/dist/solid/components/input/index.js +0 -256
- package/dist/solid/components/input/index.js.map +0 -1
- package/dist/solid/components/input/style/index.scss.js +0 -4
- package/dist/solid/components/input/style/index.scss.js.map +0 -1
- package/dist/solid/components/pull-down-refresh/index.js +0 -334
- package/dist/solid/components/pull-down-refresh/index.js.map +0 -1
- package/dist/solid/components/pull-down-refresh/style/index.css.js +0 -4
- package/dist/solid/components/pull-down-refresh/style/index.css.js.map +0 -1
- package/dist/solid/components/scroll-view/index.js +0 -188
- package/dist/solid/components/scroll-view/index.js.map +0 -1
- package/dist/solid/components/scroll-view/style/index.css.js +0 -4
- package/dist/solid/components/scroll-view/style/index.css.js.map +0 -1
- package/dist/solid/components/swiper/index.js +0 -307
- package/dist/solid/components/swiper/index.js.map +0 -1
- package/dist/solid/components/swiper/style/index.css.js +0 -4
- package/dist/solid/components/swiper/style/index.css.js.map +0 -1
- package/dist/solid/components/text/index.js +0 -32
- package/dist/solid/components/text/index.js.map +0 -1
- package/dist/solid/components/text/style/index.css.js +0 -4
- package/dist/solid/components/text/style/index.css.js.map +0 -1
- package/dist/solid/components/view/index.js +0 -88
- package/dist/solid/components/view/index.js.map +0 -1
- package/dist/solid/index.css +0 -1
- package/dist/solid/index.js +0 -13
- package/dist/solid/index.js.map +0 -1
- package/dist/solid/utils/hooks.solid.js +0 -54
- package/dist/solid/utils/hooks.solid.js.map +0 -1
- package/dist/solid/utils/index.js +0 -58
- package/dist/solid/utils/index.js.map +0 -1
- package/dist/utils/hooks.react.js +0 -15
- package/dist/utils/hooks.react.js.map +0 -1
- package/types/index.d.ts +0 -17
- /package/dist/{solid/components/image → components/view}/style/index.css.js +0 -0
- /package/dist/{solid/components/image → components/view}/style/index.css.js.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/swiper/index.tsx"],"sourcesContent":["import 'swiper/swiper-bundle.min.css'\nimport './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\nimport Swipers from 'swiper/swiper-bundle.esm.js'\n\nimport { createForwardRefComponent, debounce } from '../../utils'\n\nimport type ISwiper from 'swiper'\n\nlet INSTANCE_ID = 0\n\ninterface SwiperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n itemId: string\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n}\n\ninterface SwiperProps extends React.HTMLAttributes<HTMLDivElement> {\n autoplay?: boolean\n interval?: number\n duration?: number\n current?: number\n displayMultipleItems?: number\n circular?: boolean\n vertical?: boolean\n spaceBetween?: any\n previousMargin?: string\n nextMargin?: string\n indicatorColor?: string\n indicatorActiveColor?: string\n indicatorDots?: boolean\n forwardedRef?: React.MutableRefObject<HTMLDivElement>\n onAnimationFinish?: (e: TouchEvent) => void\n}\n\nconst createEvent = (type: string) => {\n let e\n try {\n e = new TouchEvent(type)\n } catch (err) {\n e = document.createEvent('Event')\n e.initEvent(type, true, true)\n }\n return e\n}\n\nclass SwiperItemInner extends React.Component<SwiperItemProps, Record<string, unknown>> {\n render () {\n const { className, style, itemId, children, forwardedRef, ...restProps } = this.props\n const cls = classNames('swiper-slide', className)\n return (\n <div\n ref={(e) => {\n if (e && forwardedRef) {\n forwardedRef.current = e\n }\n }}\n className={cls}\n style={style}\n item-id={itemId}\n {...restProps}\n >\n {children}\n </div>\n )\n }\n}\n\nclass SwiperInner extends React.Component<SwiperProps, Record<string, unknown>> {\n _id = 1 + INSTANCE_ID++\n _$current = 0\n _$width = 0\n _$height = 0\n $el: HTMLDivElement | null\n mySwiper: ISwiper\n observer: MutationObserver\n observerFirst: MutationObserver\n observerLast: MutationObserver\n\n componentDidMount () {\n const {\n autoplay = false,\n circular = true,\n current = 0,\n displayMultipleItems = 1,\n duration = 500,\n interval = 5000,\n spaceBetween,\n vertical\n } = this.props\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n const opt: Record<string, any> = {\n // 指示器\n pagination: { el: `.taro-swiper-${this._id} > .swiper-container > .swiper-pagination` },\n direction: vertical ? 'vertical' : 'horizontal',\n loop: circular,\n slidesPerView: parseFloat(String(displayMultipleItems)),\n initialSlide: parseInt(String(current), 10),\n speed: parseInt(String(duration), 10),\n observer: true,\n observeParents: true,\n on: {\n slideChange () {\n const e = createEvent('touchend')\n try {\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n current: this.realIndex\n }\n })\n } catch (err) {} // eslint-disable-line no-empty\n that._$current = this.realIndex\n that.handleOnChange(e)\n },\n transitionEnd () {\n const e = createEvent('touchend')\n try {\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n current: this.mySwiper.realIndex\n }\n })\n if (this.mySwiper.isBeginning) {\n this.mySwiper.slideToLoop((this.props.children as any).length - 1, 0)\n } else if (this.mySwiper.isEnd) {\n this.mySwiper.slideToLoop(0, 0)\n }\n } catch (err) {} // eslint-disable-line no-empty\n that.handleOnAnimationFinish(e)\n },\n observerUpdate (_swiper: ISwiper, e) {\n const target = e.target\n const className = target && typeof target.className === 'string' ? target.className : ''\n if (className.includes('taro_page') && target.style.display !== 'none') {\n if (that.props.autoplay && target.contains(_swiper.$el[0])) {\n if (that.props.circular) {\n _swiper.slideToLoop(this.realIndex, 0) // 更新下标\n } else {\n _swiper.slideTo(this.realIndex)\n }\n }\n }\n }\n }\n }\n\n // 自动播放\n if (autoplay) {\n opt.autoplay = {\n delay: parseInt(String(interval), 10),\n disableOnInteraction: false\n }\n }\n\n // 两端距离\n if (spaceBetween) {\n opt.spaceBetween = spaceBetween\n }\n\n this.mySwiper = new Swipers(this.$el!, opt)\n setTimeout(() => {\n this.mySwiper.update()\n }, 500)\n\n if (!this.mySwiper || !this.props.circular) return\n\n const wrapper = this.mySwiper.$wrapperEl[0]\n this.observer = new MutationObserver(this.handleSwiperLoopListen)\n\n this.observer.observe(wrapper, {\n childList: true\n })\n }\n\n UNSAFE_componentWillReceiveProps (nextProps) {\n if (this.mySwiper) {\n const nextCurrent = typeof nextProps.current === 'number' ? nextProps.current : this._$current || 0\n\n this.handleSwiperLoop()\n // 是否衔接滚动模式\n if (nextProps.circular) {\n if (!this.mySwiper.isBeginning && !this.mySwiper.isEnd) {\n this.mySwiper.slideToLoop(parseInt(nextCurrent, 10)) // 更新下标\n }\n } else {\n this.mySwiper.slideTo(parseInt(nextCurrent, 10) + 1) // 更新下标\n }\n\n const autoplay = this.mySwiper.autoplay\n // 判断是否需要停止或开始自动轮播\n if (autoplay.running !== nextProps.autoplay) {\n if (nextProps.autoplay) {\n if (typeof this.mySwiper.params.autoplay === 'object') {\n this.mySwiper.params.autoplay.disableOnInteraction = false\n this.mySwiper.params.autoplay.delay = parseInt(String(this.props.interval) || '3000', 10)\n }\n autoplay.start()\n } else {\n autoplay.stop()\n }\n }\n\n this.mySwiper.update() // 更新子元素\n }\n }\n\n componentDidUpdate (preProps) {\n if (preProps.children.length === 0 && (this.props.children as any).length > 0) {\n (this.mySwiper as any).loopDestroy()\n ;(this.mySwiper as any).loopCreate()\n }\n if (!this.mySwiper) return\n if (this.props.autoplay) {\n if (this._$width !== this.mySwiper.width || this._$height !== this.mySwiper.height) {\n this.mySwiper.autoplay.start()\n }\n }\n this._$width = this.mySwiper.width\n this._$height = this.mySwiper.height\n }\n\n componentWillUnmount () {\n this.$el = null\n if (this.mySwiper) this.mySwiper.destroy()\n this.observer?.disconnect?.()\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n }\n\n handleOnChange (e: React.FormEvent<HTMLDivElement>) {\n const func = this.props.onChange\n typeof func === 'function' && func(e)\n }\n\n handleOnAnimationFinish (e: TouchEvent) {\n const func = this.props.onAnimationFinish\n typeof func === 'function' && func(e)\n }\n\n parsePX (s = '0px') {\n return parseFloat(s.replace(/r*px/i, ''))\n }\n\n handleSwiperLoopListen = () => {\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n this.observerFirst = new MutationObserver(this.handleSwiperLoop)\n this.observerLast = new MutationObserver(this.handleSwiperLoop)\n const wrapper = this.mySwiper.$wrapperEl[0]\n const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)')\n if (list.length >= 1) {\n this.observerFirst.observe(list[0], {\n characterData: true\n })\n } else if (list.length >= 2) {\n this.observerLast.observe(list[list.length - 1], {\n characterData: true\n })\n }\n }\n\n handleSwiperLoop = debounce(() => {\n if (this.mySwiper && this.mySwiper.$wrapperEl && this.props.circular) {\n // @ts-ignore\n this.mySwiper.loopDestroy()\n // @ts-ignore\n this.mySwiper.loopCreate()\n }\n }, 500)\n\n render () {\n const {\n className,\n style,\n vertical,\n previousMargin,\n nextMargin,\n indicatorColor,\n indicatorActiveColor,\n forwardedRef\n } = this.props\n const defaultIndicatorColor = indicatorColor || 'rgba(0, 0, 0, .3)'\n const defaultIndicatorActiveColor = indicatorActiveColor || '#000'\n const cls = classNames(`taro-swiper-${this._id}`, className)\n const sty = Object.assign({\n paddingTop: vertical ? this.parsePX(previousMargin) : 0,\n paddingRight: vertical ? 0 : this.parsePX(nextMargin),\n paddingBottom: vertical ? this.parsePX(nextMargin) : 0,\n paddingLeft: vertical ? 0 : this.parsePX(previousMargin),\n overflow: 'hidden'\n }, style)\n const paginationCls = classNames(\n 'swiper-pagination',\n {\n 'swiper-pagination-hidden': !this.props.indicatorDots,\n 'swiper-pagination-bullets': this.props.indicatorDots\n }\n )\n return (\n <div className={`swiper-container-wrapper ${cls}`} style={sty} ref={(e) => {\n if (forwardedRef && e) {\n forwardedRef.current = e\n }\n }}>\n <div className='swiper-container' style={{ overflow: 'visible' }} ref={(el) => { this.$el = el }}>\n <div\n dangerouslySetInnerHTML={{\n __html: `<style type='text/css'>\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${defaultIndicatorColor} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${defaultIndicatorActiveColor} }\n </style>`\n }}\n />\n <div className='swiper-wrapper'>{this.props.children}</div>\n <div className={paginationCls} />\n </div>\n </div>\n )\n }\n}\n\nexport const Swiper = createForwardRefComponent(SwiperInner)\nexport const SwiperItem = createForwardRefComponent(SwiperItemInner)\n"],"names":["INSTANCE_ID","createEvent","type","e","TouchEvent","err","document","initEvent","SwiperItemInner","React","Component","render","_a","props","className","style","itemId","children","forwardedRef","restProps","__rest","cls","classNames","_jsx","ref","current","SwiperInner","constructor","_id","_$current","_$width","_$height","handleSwiperLoopListen","_b","observerFirst","disconnect","_d","observerLast","_c","MutationObserver","handleSwiperLoop","wrapper","mySwiper","$wrapperEl","list","querySelectorAll","length","observe","characterData","debounce","circular","loopDestroy","loopCreate","componentDidMount","autoplay","displayMultipleItems","duration","interval","spaceBetween","vertical","that","opt","pagination","el","direction","loop","slidesPerView","parseFloat","String","initialSlide","parseInt","speed","observer","observeParents","on","slideChange","Object","defineProperty","enumerable","value","realIndex","handleOnChange","transitionEnd","isBeginning","slideToLoop","isEnd","handleOnAnimationFinish","observerUpdate","_swiper","target","includes","display","contains","$el","slideTo","delay","disableOnInteraction","Swipers","setTimeout","update","childList","UNSAFE_componentWillReceiveProps","nextProps","nextCurrent","running","params","start","stop","componentDidUpdate","preProps","width","height","componentWillUnmount","destroy","_f","_e","func","onChange","onAnimationFinish","parsePX","s","arguments","undefined","replace","previousMargin","nextMargin","indicatorColor","indicatorActiveColor","defaultIndicatorColor","defaultIndicatorActiveColor","sty","assign","paddingTop","paddingRight","paddingBottom","paddingLeft","overflow","paginationCls","indicatorDots","_jsxs","dangerouslySetInnerHTML","__html","Swiper","createForwardRefComponent","SwiperItem"],"mappings":";;;;;;;;;AAWA,IAAIA,WAAW,GAAG,CAAC,CAAA;AAyBnB,MAAMC,WAAW,GAAIC,IAAY,IAAI;AACnC,EAAA,IAAIC,CAAC,CAAA;EACL,IAAI;AACFA,IAAAA,CAAC,GAAG,IAAIC,UAAU,CAACF,IAAI,CAAC,CAAA;GACzB,CAAC,OAAOG,GAAG,EAAE;AACZF,IAAAA,CAAC,GAAGG,QAAQ,CAACL,WAAW,CAAC,OAAO,CAAC,CAAA;IACjCE,CAAC,CAACI,SAAS,CAACL,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AAC/B,GAAA;AACA,EAAA,OAAOC,CAAC,CAAA;AACV,CAAC,CAAA;AAED,MAAMK,eAAgB,SAAQC,cAAK,CAACC,SAAmD,CAAA;AACrFC,EAAAA,MAAMA,GAAA;AACJ,IAAA,MAAMC,EAAA,GAAqE,IAAI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":"index.js","sources":["../../../src/components/swiper/index.tsx"],"sourcesContent":["import 'swiper/swiper-bundle.min.css'\nimport './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\nimport Swipers from 'swiper/swiper-bundle.esm.js'\n\nimport { debounce } from '../../utils'\n\nimport type ISwiper from 'swiper'\n\nlet INSTANCE_ID = 0\n\ninterface SwiperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n itemId: string\n}\n\ninterface SwiperProps extends React.HTMLAttributes<HTMLDivElement> {\n autoplay?: boolean\n interval?: number\n duration?: number\n current?: number\n displayMultipleItems?: number\n circular?: boolean\n vertical?: boolean\n spaceBetween?: any\n previousMargin?: string\n nextMargin?: string\n indicatorColor?: string\n indicatorActiveColor?: string\n indicatorDots?: boolean\n onAnimationFinish?: (e: TouchEvent) => void\n}\n\nconst createEvent = (type: string) => {\n let e\n try {\n e = new TouchEvent(type)\n } catch (err) {\n e = document.createEvent('Event')\n e.initEvent(type, true, true)\n }\n return e\n}\n\nclass SwiperItem extends React.Component<SwiperItemProps, Record<string, unknown>> {\n render () {\n const { className, style, itemId, children, ...restProps } = this.props\n const cls = classNames('swiper-slide', className)\n return (\n <div\n className={cls}\n style={style}\n item-id={itemId}\n {...restProps}\n >\n {children}\n </div>\n )\n }\n}\n\nclass Swiper extends React.Component<SwiperProps, Record<string, unknown>> {\n _id = 1 + INSTANCE_ID++\n _$current = 0\n _$width = 0\n _$height = 0\n $el: HTMLDivElement | null\n mySwiper: ISwiper\n observer: MutationObserver\n observerFirst: MutationObserver\n observerLast: MutationObserver\n\n componentDidMount () {\n const {\n autoplay = false,\n circular = true,\n current = 0,\n displayMultipleItems = 1,\n duration = 500,\n interval = 5000,\n spaceBetween,\n vertical\n } = this.props\n\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const that = this\n const opt: Record<string, any> = {\n // 指示器\n pagination: { el: `.taro-swiper-${this._id} > .swiper-container > .swiper-pagination` },\n direction: vertical ? 'vertical' : 'horizontal',\n loop: circular,\n slidesPerView: parseFloat(String(displayMultipleItems)),\n initialSlide: parseInt(String(current), 10),\n speed: parseInt(String(duration), 10),\n observer: true,\n observeParents: true,\n on: {\n slideChange () {\n const e = createEvent('touchend')\n try {\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n current: this.realIndex\n }\n })\n } catch (err) {} // eslint-disable-line no-empty\n that._$current = this.realIndex\n that.handleOnChange(e)\n },\n transitionEnd () {\n const e = createEvent('touchend')\n try {\n Object.defineProperty(e, 'detail', {\n enumerable: true,\n value: {\n current: this.mySwiper.realIndex\n }\n })\n if (this.mySwiper.isBeginning) {\n this.mySwiper.slideToLoop((this.props.children as any).length - 1, 0)\n } else if (this.mySwiper.isEnd) {\n this.mySwiper.slideToLoop(0, 0)\n }\n } catch (err) {} // eslint-disable-line no-empty\n that.handleOnAnimationFinish(e)\n },\n observerUpdate (_swiper: ISwiper, e) {\n const target = e.target\n const className = target && typeof target.className === 'string' ? target.className : ''\n if (className.includes('taro_page') && target.style.display !== 'none') {\n if (that.props.autoplay && target.contains(_swiper.$el[0])) {\n if (that.props.circular) {\n _swiper.slideToLoop(this.realIndex, 0) // 更新下标\n } else {\n _swiper.slideTo(this.realIndex)\n }\n }\n }\n }\n }\n }\n\n // 自动播放\n if (autoplay) {\n opt.autoplay = {\n delay: parseInt(String(interval), 10),\n disableOnInteraction: false\n }\n }\n\n // 两端距离\n if (spaceBetween) {\n opt.spaceBetween = spaceBetween\n }\n\n this.mySwiper = new Swipers(this.$el!, opt)\n setTimeout(() => {\n this.mySwiper.update()\n }, 500)\n\n if (!this.mySwiper || !this.props.circular) return\n\n const wrapper = this.mySwiper.$wrapperEl[0]\n this.observer = new MutationObserver(this.handleSwiperLoopListen)\n\n this.observer.observe(wrapper, {\n childList: true\n })\n }\n\n UNSAFE_componentWillReceiveProps (nextProps) {\n if (this.mySwiper) {\n const nextCurrent = typeof nextProps.current === 'number' ? nextProps.current : this._$current || 0\n\n this.handleSwiperLoop()\n // 是否衔接滚动模式\n if (nextProps.circular) {\n if (!this.mySwiper.isBeginning && !this.mySwiper.isEnd) {\n this.mySwiper.slideToLoop(parseInt(nextCurrent, 10)) // 更新下标\n }\n } else {\n this.mySwiper.slideTo(parseInt(nextCurrent, 10) + 1) // 更新下标\n }\n\n const autoplay = this.mySwiper.autoplay\n // 判断是否需要停止或开始自动轮播\n if (autoplay.running !== nextProps.autoplay) {\n if (nextProps.autoplay) {\n if (typeof this.mySwiper.params.autoplay === 'object') {\n this.mySwiper.params.autoplay.disableOnInteraction = false\n this.mySwiper.params.autoplay.delay = parseInt(String(this.props.interval) || '3000', 10)\n }\n autoplay.start()\n } else {\n autoplay.stop()\n }\n }\n\n this.mySwiper.update() // 更新子元素\n }\n }\n\n componentDidUpdate (preProps) {\n if (preProps.children.length === 0 && (this.props.children as any).length > 0) {\n (this.mySwiper as any).loopDestroy()\n ;(this.mySwiper as any).loopCreate()\n }\n if (!this.mySwiper) return\n if (this.props.autoplay) {\n if (this._$width !== this.mySwiper.width || this._$height !== this.mySwiper.height) {\n this.mySwiper.autoplay.start()\n }\n }\n this._$width = this.mySwiper.width\n this._$height = this.mySwiper.height\n }\n\n componentWillUnmount () {\n this.$el = null\n if (this.mySwiper) this.mySwiper.destroy()\n this.observer?.disconnect?.()\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n }\n\n handleOnChange (e: React.FormEvent<HTMLDivElement>) {\n const func = this.props.onChange\n typeof func === 'function' && func(e)\n }\n\n handleOnAnimationFinish (e: TouchEvent) {\n const func = this.props.onAnimationFinish\n typeof func === 'function' && func(e)\n }\n\n parsePX (s = '0px') {\n return parseFloat(s.replace(/r*px/i, ''))\n }\n\n handleSwiperLoopListen = () => {\n this.observerFirst?.disconnect?.()\n this.observerLast?.disconnect?.()\n this.observerFirst = new MutationObserver(this.handleSwiperLoop)\n this.observerLast = new MutationObserver(this.handleSwiperLoop)\n const wrapper = this.mySwiper.$wrapperEl[0]\n const list = wrapper.querySelectorAll('taro-swiper-item-core:not(.swiper-slide-duplicate)')\n if (list.length >= 1) {\n this.observerFirst.observe(list[0], {\n characterData: true\n })\n } else if (list.length >= 2) {\n this.observerLast.observe(list[list.length - 1], {\n characterData: true\n })\n }\n }\n\n handleSwiperLoop = debounce(() => {\n if (this.mySwiper && this.mySwiper.$wrapperEl && this.props.circular) {\n // @ts-ignore\n this.mySwiper.loopDestroy()\n // @ts-ignore\n this.mySwiper.loopCreate()\n }\n }, 500)\n\n render () {\n const {\n className,\n style,\n vertical,\n previousMargin,\n nextMargin,\n indicatorColor,\n indicatorActiveColor\n } = this.props\n const defaultIndicatorColor = indicatorColor || 'rgba(0, 0, 0, .3)'\n const defaultIndicatorActiveColor = indicatorActiveColor || '#000'\n const cls = classNames(`taro-swiper-${this._id}`, className)\n const sty = Object.assign({\n paddingTop: vertical ? this.parsePX(previousMargin) : 0,\n paddingRight: vertical ? 0 : this.parsePX(nextMargin),\n paddingBottom: vertical ? this.parsePX(nextMargin) : 0,\n paddingLeft: vertical ? 0 : this.parsePX(previousMargin),\n overflow: 'hidden'\n }, style)\n const paginationCls = classNames(\n 'swiper-pagination',\n {\n 'swiper-pagination-hidden': !this.props.indicatorDots,\n 'swiper-pagination-bullets': this.props.indicatorDots\n }\n )\n return (\n <div className={`swiper-container-wrapper ${cls}`} style={sty}>\n <div className='swiper-container' style={{ overflow: 'visible' }} ref={(el) => { this.$el = el }}>\n <div\n dangerouslySetInnerHTML={{\n __html: `<style type='text/css'>\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet { background: ${defaultIndicatorColor} }\n .taro-swiper-${this._id} > .swiper-container > .swiper-pagination > .swiper-pagination-bullet-active { background: ${defaultIndicatorActiveColor} }\n </style>`\n }}\n />\n <div className='swiper-wrapper'>{this.props.children}</div>\n <div className={paginationCls} />\n </div>\n </div>\n )\n }\n}\n\nexport { Swiper, SwiperItem }\n"],"names":["INSTANCE_ID","createEvent","type","e","TouchEvent","err","document","initEvent","SwiperItem","_React$Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_a","props","className","style","itemId","children","restProps","__rest","cls","classNames","React","createElement","Object","assign","Component","Swiper","_React$Component2","_super2","_this","_id","_$current","_$width","_$height","handleSwiperLoopListen","_b","observerFirst","disconnect","_d","observerLast","_c","MutationObserver","handleSwiperLoop","wrapper","mySwiper","$wrapperEl","list","querySelectorAll","length","observe","characterData","debounce","circular","loopDestroy","loopCreate","componentDidMount","_this2","_this$props","_this$props$autoplay","autoplay","_this$props$circular","_this$props$current","current","_this$props$displayMu","displayMultipleItems","_this$props$duration","duration","_this$props$interval","interval","spaceBetween","vertical","that","opt","pagination","el","concat","direction","loop","slidesPerView","parseFloat","String","initialSlide","parseInt","speed","observer","observeParents","on","slideChange","defineProperty","enumerable","realIndex","handleOnChange","transitionEnd","isBeginning","slideToLoop","isEnd","handleOnAnimationFinish","observerUpdate","_swiper","target","includes","display","contains","$el","slideTo","delay","disableOnInteraction","Swipers","setTimeout","update","childList","UNSAFE_componentWillReceiveProps","nextProps","nextCurrent","running","_typeof","params","start","stop","componentDidUpdate","preProps","width","height","componentWillUnmount","destroy","_f","_e","func","onChange","onAnimationFinish","parsePX","s","undefined","replace","_this3","_this$props2","previousMargin","nextMargin","indicatorColor","indicatorActiveColor","defaultIndicatorColor","defaultIndicatorActiveColor","sty","paddingTop","paddingRight","paddingBottom","paddingLeft","overflow","paginationCls","indicatorDots","ref","dangerouslySetInnerHTML","__html"],"mappings":";;;;;;;;;;;;;AAWA,IAAIA,WAAW,GAAG,CAAC,CAAA;AAuBnB,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,IAAY,EAAI;AACnC,EAAA,IAAIC,CAAC,CAAA;EACL,IAAI;AACFA,IAAAA,CAAC,GAAG,IAAIC,UAAU,CAACF,IAAI,CAAC,CAAA;GACzB,CAAC,OAAOG,GAAG,EAAE;AACZF,IAAAA,CAAC,GAAGG,QAAQ,CAACL,WAAW,CAAC,OAAO,CAAC,CAAA;IACjCE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A,CAAAA,MAAA,CAA8BxD,GAAG,CAAE;AAAEL,QAAAA,KAAK,EAAEgI,GAAAA;AAAG,OAAA,EAC3DzH,KAAK,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAAT,QAAAA,SAAS,EAAC,kBAAkB;AAACC,QAAAA,KAAK,EAAE;AAAEqI,UAAAA,QAAQ,EAAE,SAAA;SAAW;AAAEG,QAAAA,GAAG,EAAE,SAAAA,GAAC5E,CAAAA,EAAE,EAAO;UAAA4D,MAAI,CAAC/B,GAAG,GAAG7B,EAAE,CAAA;AAAC,SAAA;AAAC,OAAA,EAC9FrD,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AACEiI,QAAAA,uBAAuB,EAAE;AACvBC,UAAAA,MAAM,yDAAA7E,MAAA,CACS,IAAI,CAAC7C,GAAG,0FAAA6C,MAAA,CAAuFiE,qBAAqB,EAAAjE,iCAAAA,CAAAA,CAAAA,MAAA,CACpH,IAAI,CAAC7C,GAAG,EAAA6C,6FAAAA,CAAAA,CAAAA,MAAA,CAA8FkE,2BAA2B,EAAA,4BAAA,CAAA;;AAGlJ,OAAA,CAAA,EACFxH,KAAK,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAAT,QAAAA,SAAS,EAAC,gBAAA;AAAgB,OAAA,EAAE,IAAI,CAACD,KAAK,CAACI,QAAQ,CAAO,EAC3DK,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKT,QAAAA,SAAS,EAAEuI,aAAAA;QAAiB,CAC7B,CACF,CAAA;AAEV,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,EAAA,OAAA1H,MAAA,CAAA;AAAA,CAzPkBL,CAAAA,KAAK,CAACI,SAA+C;;;;"}
|
|
@@ -1,28 +1,37 @@
|
|
|
1
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
+
import _inherits from '@babel/runtime/helpers/inherits';
|
|
4
|
+
import _createSuper from '@babel/runtime/helpers/createSuper';
|
|
1
5
|
import { __rest } from 'tslib';
|
|
2
6
|
import './style/index.css.js';
|
|
3
7
|
import classNames from 'classnames';
|
|
4
|
-
import 'react';
|
|
5
|
-
import { createForwardRefComponent } from '../../utils/index.js';
|
|
6
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
import React from 'react';
|
|
7
9
|
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
var Text = /*#__PURE__*/function (_React$Component) {
|
|
11
|
+
_inherits(Text, _React$Component);
|
|
12
|
+
var _super = _createSuper(Text);
|
|
13
|
+
function Text() {
|
|
14
|
+
_classCallCheck(this, Text);
|
|
15
|
+
return _super.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
_createClass(Text, [{
|
|
18
|
+
key: "render",
|
|
19
|
+
value: function render() {
|
|
20
|
+
var _a = this.props,
|
|
21
|
+
className = _a.className,
|
|
22
|
+
_a$selectable = _a.selectable,
|
|
23
|
+
selectable = _a$selectable === void 0 ? false : _a$selectable,
|
|
24
|
+
restProps = __rest(_a, ["className", "selectable"]);
|
|
25
|
+
var cls = classNames('taro-text', {
|
|
26
|
+
'taro-text__selectable': selectable
|
|
27
|
+
}, className);
|
|
28
|
+
return React.createElement("span", Object.assign({}, restProps, {
|
|
29
|
+
className: cls
|
|
30
|
+
}), this.props.children);
|
|
31
|
+
}
|
|
32
|
+
}]);
|
|
33
|
+
return Text;
|
|
34
|
+
}(React.Component);
|
|
26
35
|
|
|
27
|
-
export {
|
|
36
|
+
export { Text as default };
|
|
28
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLSpanElement> {\n selectable?: boolean\n}\n\nclass Text extends React.Component<IProps, Record<string, unknown>> {\n render () {\n const { className, selectable = false, ...restProps } = this.props\n const cls = classNames(\n 'taro-text',\n {\n 'taro-text__selectable': selectable\n },\n className\n )\n return (\n <span {...restProps} className={cls}>\n {this.props.children}\n </span>\n )\n }\n}\n\nexport default Text\n"],"names":["Text","_React$Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","render","_a","props","className","_a$selectable","selectable","restProps","__rest","cls","classNames","React","createElement","Object","assign","children","Component"],"mappings":";;;;;;;;;AASMA,IAAAA,IAAK,0BAAAC,gBAAA,EAAA;EAAAC,SAAA,CAAAF,IAAA,EAAAC,gBAAA,CAAA,CAAA;AAAA,EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,IAAA,CAAA,CAAA;AAAA,EAAA,SAAAA,IAAA,GAAA;AAAAK,IAAAA,eAAA,OAAAL,IAAA,CAAA,CAAA;AAAA,IAAA,OAAAG,MAAA,CAAAG,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,GAAA;AAAAC,EAAAA,YAAA,CAAAR,IAAA,EAAA,CAAA;IAAAS,GAAA,EAAA,QAAA;IAAAC,KAAA,EACT,SAAAC,MAAAA,GAAM;AACE,MAAA,IAAAC,KAAkD,IAAI,CAACC,KAAK;QAA1DC,SAAS,GAAiDF,EAAA,CAA1DE,SAAS;QAAAC,aAAA,GAAiDH,EAAA,CAA/CI,UAAU;AAAVA,QAAAA,UAAU,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,aAAA;QAAKE,SAAS,GAA7CC,MAAA,CAAAN,EAAA,EAAA,CAAA,WAAA,EAAA,YAAA,CAA+C,CAAa,CAAA;AAClE,MAAA,IAAMO,GAAG,GAAGC,UAAU,CACpB,WAAW,EACX;AACE,QAAA,uBAAuB,EAAEJ,UAAAA;OAC1B,EACDF,SAAS,CACV,CAAA;AACD,MAAA,OACEO,KAAA,CAAAC,aAAA,CAAA,MAAA,EAAAC,MAAA,CAAAC,MAAA,CAAA,EAAA,EAAUP,SAAS,EAAA;AAAEH,QAAAA,SAAS,EAAEK,GAAAA;AAC7B,OAAA,CAAA,EAAA,IAAI,CAACN,KAAK,CAACY,QAAQ,CACf,CAAA;AAEX,KAAA;AAAC,GAAA,CAAA,CAAA,CAAA;AAAA,EAAA,OAAAzB,IAAA,CAAA;AAAA,CAfgBqB,CAAAA,KAAK,CAACK,SAA0C;;;;"}
|
|
@@ -1,80 +1,105 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
3
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
|
+
import _inherits from '@babel/runtime/helpers/inherits';
|
|
5
|
+
import _createSuper from '@babel/runtime/helpers/createSuper';
|
|
1
6
|
import { __rest } from 'tslib';
|
|
7
|
+
import './style/index.css.js';
|
|
2
8
|
import classNames from 'classnames';
|
|
3
|
-
import
|
|
4
|
-
import { createForwardRefComponent } from '../../utils/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
9
|
+
import React from 'react';
|
|
6
10
|
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
var View = /*#__PURE__*/function (_React$Component) {
|
|
12
|
+
_inherits(View, _React$Component);
|
|
13
|
+
var _super = _createSuper(View);
|
|
14
|
+
function View() {
|
|
15
|
+
var _this;
|
|
16
|
+
_classCallCheck(this, View);
|
|
17
|
+
_this = _super.apply(this, arguments);
|
|
18
|
+
_this.state = {
|
|
19
|
+
hover: false,
|
|
20
|
+
touch: false
|
|
21
|
+
};
|
|
22
|
+
_this.startTime = 0;
|
|
23
|
+
return _this;
|
|
24
|
+
}
|
|
25
|
+
_createClass(View, [{
|
|
26
|
+
key: "render",
|
|
27
|
+
value: function render() {
|
|
28
|
+
var _this2 = this;
|
|
29
|
+
var _a = this.props,
|
|
30
|
+
className = _a.className,
|
|
31
|
+
hoverClass = _a.hoverClass,
|
|
32
|
+
onTouchStart = _a.onTouchStart,
|
|
33
|
+
onTouchEnd = _a.onTouchEnd,
|
|
34
|
+
onTouchMove = _a.onTouchMove,
|
|
35
|
+
_a$hoverStartTime = _a.hoverStartTime,
|
|
36
|
+
hoverStartTime = _a$hoverStartTime === void 0 ? 50 : _a$hoverStartTime,
|
|
37
|
+
_a$hoverStayTime = _a.hoverStayTime,
|
|
38
|
+
hoverStayTime = _a$hoverStayTime === void 0 ? 400 : _a$hoverStayTime,
|
|
39
|
+
other = __rest(_a, ["className", "hoverClass", "onTouchStart", "onTouchEnd", "onTouchMove", "hoverStartTime", "hoverStayTime"]);
|
|
40
|
+
var cls = classNames('', _defineProperty({}, "".concat(hoverClass), this.state.hover), className);
|
|
41
|
+
var _onTouchStart = function _onTouchStart(e) {
|
|
42
|
+
if (hoverClass) {
|
|
43
|
+
_this2.setState(function () {
|
|
44
|
+
return {
|
|
45
|
+
touch: true
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
if (_this2.state.touch) {
|
|
50
|
+
_this2.setState(function () {
|
|
51
|
+
return {
|
|
52
|
+
hover: true
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, hoverStartTime);
|
|
32
57
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
onTouchStart && onTouchStart(e);
|
|
59
|
+
if (_this2.props.onLongPress) {
|
|
60
|
+
_this2.timeoutEvent = setTimeout(function () {
|
|
61
|
+
_this2.props.onLongPress();
|
|
62
|
+
}, 350);
|
|
63
|
+
_this2.startTime = new Date().getTime();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var _onTouchMove = function _onTouchMove(e) {
|
|
67
|
+
clearTimeout(_this2.timeoutEvent);
|
|
68
|
+
onTouchMove && onTouchMove(e);
|
|
69
|
+
};
|
|
70
|
+
var _onTouchEnd = function _onTouchEnd(e) {
|
|
71
|
+
var spanTime = new Date().getTime() - _this2.startTime;
|
|
72
|
+
if (spanTime < 350) {
|
|
73
|
+
clearTimeout(_this2.timeoutEvent);
|
|
74
|
+
}
|
|
75
|
+
if (hoverClass) {
|
|
76
|
+
_this2.setState(function () {
|
|
77
|
+
return {
|
|
78
|
+
touch: false
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
if (!_this2.state.touch) {
|
|
83
|
+
_this2.setState(function () {
|
|
84
|
+
return {
|
|
85
|
+
hover: false
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, hoverStayTime);
|
|
57
90
|
}
|
|
58
|
-
|
|
91
|
+
onTouchEnd && onTouchEnd(e);
|
|
92
|
+
};
|
|
93
|
+
return React.createElement("div", Object.assign({
|
|
94
|
+
className: cls,
|
|
95
|
+
onTouchStart: _onTouchStart,
|
|
96
|
+
onTouchEnd: _onTouchEnd,
|
|
97
|
+
onTouchMove: _onTouchMove
|
|
98
|
+
}, other), this.props.children);
|
|
59
99
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
setCls(classNames('', {
|
|
64
|
-
[`${hoverClass}`]: "react" === 'solid' ? hover() : hover
|
|
65
|
-
}, className));
|
|
66
|
-
}, [hover, className]);
|
|
67
|
-
return /*#__PURE__*/jsx("div", {
|
|
68
|
-
ref: forwardedRef,
|
|
69
|
-
className: "react" === 'solid' ? cls() : cls,
|
|
70
|
-
onTouchStart: _onTouchStart,
|
|
71
|
-
onTouchEnd: _onTouchEnd,
|
|
72
|
-
onTouchMove: _onTouchMove,
|
|
73
|
-
...other,
|
|
74
|
-
children: other.children
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
var index = createForwardRefComponent(View);
|
|
100
|
+
}]);
|
|
101
|
+
return View;
|
|
102
|
+
}(React.Component);
|
|
78
103
|
|
|
79
|
-
export {
|
|
104
|
+
export { View as default };
|
|
80
105
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/view/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/view/index.tsx"],"sourcesContent":["import './style/index.css'\n\nimport classNames from 'classnames'\nimport React from 'react'\n\ninterface IProps extends React.HTMLAttributes<HTMLDivElement> {\n hoverClass?: string\n hoverStartTime?: number\n hoverStayTime?: number\n onTouchStart?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchEnd?(e: React.TouchEvent<HTMLDivElement>): void\n onTouchMove?(e: React.TouchEvent<HTMLDivElement>): void\n onLongPress?(): void\n}\n\ninterface IState {\n hover: boolean\n touch: boolean\n}\n\nclass View extends React.Component<IProps, IState> {\n state = {\n hover: false,\n touch: false\n }\n\n timeoutEvent: ReturnType<typeof setTimeout>\n startTime = 0\n\n render () {\n const {\n className,\n hoverClass,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n hoverStartTime = 50,\n hoverStayTime = 400,\n ...other\n } = this.props\n\n const cls = classNames(\n '',\n {\n [`${hoverClass}`]: this.state.hover\n },\n className\n )\n\n const _onTouchStart = e => {\n if (hoverClass) {\n this.setState(() => ({\n touch: true\n }))\n setTimeout(() => {\n if (this.state.touch) {\n this.setState(() => ({\n hover: true\n }))\n }\n }, hoverStartTime)\n }\n onTouchStart && onTouchStart(e)\n if (this.props.onLongPress) {\n this.timeoutEvent = setTimeout(() => {\n this.props.onLongPress!()\n }, 350)\n this.startTime = new Date().getTime()\n }\n }\n\n const _onTouchMove = e => {\n clearTimeout(this.timeoutEvent)\n onTouchMove && onTouchMove(e)\n }\n\n const _onTouchEnd = e => {\n const spanTime = new Date().getTime() - this.startTime\n if (spanTime < 350) {\n clearTimeout(this.timeoutEvent)\n }\n if (hoverClass) {\n this.setState(() => ({\n touch: false\n }))\n setTimeout(() => {\n if (!this.state.touch) {\n this.setState(() => ({\n hover: false\n }))\n }\n }, hoverStayTime)\n }\n onTouchEnd && onTouchEnd(e)\n }\n\n return (\n <div\n className={cls}\n onTouchStart={_onTouchStart}\n onTouchEnd={_onTouchEnd}\n onTouchMove={_onTouchMove}\n {...other}\n >\n {this.props.children}\n </div>\n )\n }\n}\n\nexport default View\n"],"names":["View","_React$Component","_inherits","_super","_createSuper","_this","_classCallCheck","state","hover","touch","startTime","_createClass","key","value","render","_this2","_a","props","className","hoverClass","onTouchStart","onTouchEnd","onTouchMove","_a$hoverStartTime","hoverStartTime","_a$hoverStayTime","hoverStayTime","other","__rest","cls","classNames","_defineProperty","concat","_onTouchStart","e","setState","setTimeout","onLongPress","timeoutEvent","Date","getTime","_onTouchMove","clearTimeout","_onTouchEnd","spanTime","React","createElement","Object","assign","children","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
CHANGED
|
@@ -1 +1 @@
|
|
|
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[loading]>.weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E") no-repeat;background-size:100%;display:inline-block;height:20px;vertical-align:middle;width:20px}.taro-button-core[loading]>.weui-loading.weui-btn_primary,.taro-button-core[loading]>.weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core[loading]>.weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core[loading]>.weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);appearance:none;background-color:#f8f8f8;border-radius:5px;border-width:0;box-sizing:border-box;color:#000;display:block;font-size:18px;line-height:2.55555556;margin-left:auto;margin-right:auto;outline:0;overflow:hidden;padding-left:14px;padding-right:14px;position:relative;text-align:center;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core:after{border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;content:" ";height:200%;left:0;position:absolute;top:0;transform:scale(.5);transform-origin:0 0;width:200%}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core[type=default]{background-color:#f8f8f8;color:#000}.taro-button-core[type=default]:not([disabled]):visited{color:#000}.taro-button-core[type=default]:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core[size=mini]{display:inline-block;font-size:13px;line-height:2.3;padding:0 1.32em;width:auto}.taro-button-core[plain],.taro-button-core[plain][type=default],.taro-button-core[plain][type=primary]{background-color:transparent;border-width:1px}.taro-button-core[disabled]{color:hsla(0,0%,100%,.6)}.taro-button-core[disabled][type=default]{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core[disabled][type=primary]{background-color:#9ed99d}.taro-button-core[disabled][type=warn]{background-color:#ec8b89}.taro-button-core[loading] .weui-loading{margin:-.2em .34em 0 0}.taro-button-core[loading][type=primary],.taro-button-core[loading][type=warn]{color:hsla(0,0%,100%,.6)}.taro-button-core[loading][type=primary]{background-color:#179b16}.taro-button-core[loading][type=warn]{background-color:#ce3c39}.taro-button-core[plain][type=primary]{border:1px solid #1aad19;color:#1aad19}.taro-button-core[plain][type=primary]:not([disabled]):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core[plain][type=primary]:after{border-width:0}.taro-button-core[plain][type=warn]{border:1px solid #e64340;color:#e64340}.taro-button-core[plain][type=warn]:not([disabled]):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core[plain][type=warn]:after{border-width:0}.taro-button-core[plain],.taro-button-core[plain][type=default]{border:1px solid #353535;color:#353535}.taro-button-core[plain]:not([disabled]):active,.taro-button-core[plain][type=default]:not([disabled]):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core[plain]:after,.taro-button-core[plain][type=default]:after{border-width:0}.taro-button-core[type=primary]{background-color:#1aad19;color:#fff}.taro-button-core[type=primary]:not([disabled]):visited{color:#fff}.taro-button-core[type=primary]:not([disabled]):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core[type=warn]{background-color:#e64340;color:#fff}.taro-button-core[type=warn]:not([disabled]):visited{color:#fff}.taro-button-core[type=warn]:not([disabled]):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core[plain][disabled],.taro-button-core[plain][disabled][type=primary]{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{height:100%}.taro-img__mode-aspectfit,.taro-img__mode-scaletofill{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-top,.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom{bottom:0;position:absolute;width:100%}.taro-img__mode-left{height:100%}.taro-img__mode-right{height:100%}.taro-img__mode-right,.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}.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::-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%}.swiper-pagination{font-size:0}.swiper-pagination-bullet{opacity:1}.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[loading]>.weui-loading{animation:weuiLoading 1s steps(12) infinite;background:transparent url("data:image/svg+xml;charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E9E9E9' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23989697' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%239B999A' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23A3A1A2' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23ABA9AA' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23B2B2B2' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23BAB8B9' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23C2C0C1' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23CBCBCB' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23D2D2D2' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23DADADA' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='%23E2E2E2' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E") no-repeat;background-size:100%;display:inline-block;height:20px;vertical-align:middle;width:20px}.taro-button-core[loading]>.weui-loading.weui-btn_primary,.taro-button-core[loading]>.weui-loading.weui-btn_warn{color:hsla(0,0%,100%,.6)}.taro-button-core[loading]>.weui-loading.weui-btn_primary{background-color:#179b16}.taro-button-core[loading]>.weui-loading.weui-btn_warn{background-color:#ce3c39}.taro-button-core{-webkit-tap-highlight-color:rgba(0,0,0,0);appearance:none;background-color:#f8f8f8;border-radius:5px;border-width:0;box-sizing:border-box;color:#000;display:block;font-size:18px;line-height:2.55555556;margin-left:auto;margin-right:auto;outline:0;overflow:hidden;padding-left:14px;padding-right:14px;position:relative;text-align:center;text-decoration:none;width:100%}.taro-button-core:focus{outline:0}.taro-button-core:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core:after{border:1px solid rgba(0,0,0,.2);border-radius:10px;box-sizing:border-box;content:" ";height:200%;left:0;position:absolute;top:0;transform:scale(.5);transform-origin:0 0;width:200%}.taro-button-core+.taro-button-core{margin-top:15px}.taro-button-core[type=default]{background-color:#f8f8f8;color:#000}.taro-button-core[type=default]:not([disabled]):visited{color:#000}.taro-button-core[type=default]:not([disabled]):active{background-color:#dedede;color:rgba(0,0,0,.6)}.taro-button-core[size=mini]{display:inline-block;font-size:13px;line-height:2.3;padding:0 1.32em;width:auto}.taro-button-core[plain],.taro-button-core[plain][type=default],.taro-button-core[plain][type=primary]{background-color:transparent;border-width:1px}.taro-button-core[disabled]{color:hsla(0,0%,100%,.6)}.taro-button-core[disabled][type=default]{background-color:#f7f7f7;color:rgba(0,0,0,.3)}.taro-button-core[disabled][type=primary]{background-color:#9ed99d}.taro-button-core[disabled][type=warn]{background-color:#ec8b89}.taro-button-core[loading] .weui-loading{margin:-.2em .34em 0 0}.taro-button-core[loading][type=primary],.taro-button-core[loading][type=warn]{color:hsla(0,0%,100%,.6)}.taro-button-core[loading][type=primary]{background-color:#179b16}.taro-button-core[loading][type=warn]{background-color:#ce3c39}.taro-button-core[plain][type=primary]{border:1px solid #1aad19;color:#1aad19}.taro-button-core[plain][type=primary]:not([disabled]):active{background-color:transparent;border-color:rgba(26,173,25,.6);color:rgba(26,173,25,.6)}.taro-button-core[plain][type=primary]:after{border-width:0}.taro-button-core[plain][type=warn]{border:1px solid #e64340;color:#e64340}.taro-button-core[plain][type=warn]:not([disabled]):active{background-color:transparent;border-color:rgba(230,67,64,.6);color:rgba(230,67,64,.6)}.taro-button-core[plain][type=warn]:after{border-width:0}.taro-button-core[plain],.taro-button-core[plain][type=default]{border:1px solid #353535;color:#353535}.taro-button-core[plain]:not([disabled]):active,.taro-button-core[plain][type=default]:not([disabled]):active{background-color:transparent;border-color:rgba(53,53,53,.6);color:rgba(53,53,53,.6)}.taro-button-core[plain]:after,.taro-button-core[plain][type=default]:after{border-width:0}.taro-button-core[type=primary]{background-color:#1aad19;color:#fff}.taro-button-core[type=primary]:not([disabled]):visited{color:#fff}.taro-button-core[type=primary]:not([disabled]):active{background-color:#179b16;color:hsla(0,0%,100%,.6)}.taro-button-core[type=warn]{background-color:#e64340;color:#fff}.taro-button-core[type=warn]:not([disabled]):visited{color:#fff}.taro-button-core[type=warn]:not([disabled]):active{background-color:#ce3c39;color:hsla(0,0%,100%,.6)}.taro-button-core[plain][disabled],.taro-button-core[plain][disabled][type=primary]{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{height:100%}.taro-img__mode-aspectfit,.taro-img__mode-scaletofill{height:100%;object-fit:contain;width:100%}.taro-img__mode-aspectfill{height:100%;object-fit:cover;width:100%}.taro-img__mode-top,.taro-img__mode-widthfix{width:100%}.taro-img__mode-bottom{bottom:0;position:absolute;width:100%}.taro-img__mode-left{height:100%}.taro-img__mode-right{height:100%}.taro-img__mode-right,.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,input{display:block}input{height:1.4rem;overflow:hidden;text-align:inherit;text-overflow:clip;white-space:nowrap}.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}.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::-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%}.swiper-pagination{font-size:0}.swiper-pagination-bullet{opacity:1}.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}body,html{-webkit-tap-highlight-color:rgba(0,0,0,0);user-select:none;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import { forwardRef } from './hooks.react.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
/* eslint-disable react/react-in-jsx-scope */
|
|
5
1
|
function throttle(fn) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var threshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
3
|
+
var scope = arguments.length > 2 ? arguments[2] : undefined;
|
|
4
|
+
var lastTime = 0;
|
|
5
|
+
var deferTimer;
|
|
10
6
|
return function () {
|
|
11
7
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12
8
|
args[_key] = arguments[_key];
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
var context = scope || this;
|
|
11
|
+
var now = Date.now();
|
|
16
12
|
if (now - lastTime > threshold) {
|
|
17
13
|
fn.apply(this, args);
|
|
18
14
|
lastTime = now;
|
|
19
15
|
} else {
|
|
20
16
|
clearTimeout(deferTimer);
|
|
21
|
-
deferTimer = setTimeout(()
|
|
17
|
+
deferTimer = setTimeout(function () {
|
|
22
18
|
lastTime = now;
|
|
23
19
|
fn.apply(context, args);
|
|
24
20
|
}, threshold);
|
|
@@ -26,14 +22,14 @@ function throttle(fn) {
|
|
|
26
22
|
};
|
|
27
23
|
}
|
|
28
24
|
function debounce(fn) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
26
|
+
var scope = arguments.length > 2 ? arguments[2] : undefined;
|
|
27
|
+
var timer;
|
|
32
28
|
return function () {
|
|
33
29
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
34
30
|
args[_key2] = arguments[_key2];
|
|
35
31
|
}
|
|
36
|
-
|
|
32
|
+
var context = scope || this;
|
|
37
33
|
clearTimeout(timer);
|
|
38
34
|
timer = setTimeout(function () {
|
|
39
35
|
fn.apply(context, args);
|
|
@@ -41,20 +37,13 @@ function debounce(fn) {
|
|
|
41
37
|
};
|
|
42
38
|
}
|
|
43
39
|
function omit(obj, fields) {
|
|
44
|
-
|
|
45
|
-
for (
|
|
46
|
-
|
|
40
|
+
var shallowCopy = Object.assign({}, obj);
|
|
41
|
+
for (var i = 0; i < fields.length; i += 1) {
|
|
42
|
+
var key = fields[i];
|
|
47
43
|
delete shallowCopy[key];
|
|
48
44
|
}
|
|
49
45
|
return shallowCopy;
|
|
50
46
|
}
|
|
51
|
-
const createForwardRefComponent = ReactComponent => {
|
|
52
|
-
const forwardRefComponent = (props, ref) => /*#__PURE__*/jsx(ReactComponent, {
|
|
53
|
-
...props,
|
|
54
|
-
forwardedRef: ref
|
|
55
|
-
});
|
|
56
|
-
return forwardRef(forwardRefComponent);
|
|
57
|
-
};
|
|
58
47
|
|
|
59
|
-
export {
|
|
48
|
+
export { debounce, omit, throttle };
|
|
60
49
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/index.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["export function throttle (fn, threshold = 250, scope?) {\n let lastTime = 0\n let deferTimer: ReturnType<typeof setTimeout>\n return function (...args) {\n const context = scope || this\n const now = Date.now()\n if (now - lastTime > threshold) {\n fn.apply(this, args)\n lastTime = now\n } else {\n clearTimeout(deferTimer)\n deferTimer = setTimeout(() => {\n lastTime = now\n fn.apply(context, args)\n }, threshold)\n }\n }\n}\n\nexport function debounce (fn, ms = 250, scope?) {\n let timer: ReturnType<typeof setTimeout>\n\n return function (...args) {\n const context = scope || this\n clearTimeout(timer)\n timer = setTimeout(function () {\n fn.apply(context, args)\n }, ms)\n }\n}\n\nexport function omit (obj, fields) {\n const shallowCopy = Object.assign({}, obj)\n for (let i = 0; i < fields.length; i += 1) {\n const key = fields[i]\n delete shallowCopy[key]\n }\n return shallowCopy\n}\n"],"names":["throttle","fn","threshold","arguments","length","undefined","scope","lastTime","deferTimer","_len","args","Array","_key","context","now","Date","apply","clearTimeout","setTimeout","debounce","ms","timer","_len2","_key2","omit","obj","fields","shallowCopy","Object","assign","i","key"],"mappings":"AAAM,SAAUA,QAAQA,CAAEC,EAAE,EAAyB;AAAA,EAAA,IAAvBC,SAAS,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,GAAG,CAAA;EAAA,IAAEG,KAAM,GAAAH,SAAA,CAAAC,MAAA,GAAAD,CAAAA,GAAAA,SAAA,MAAAE,SAAA,CAAA;EACnD,IAAIE,QAAQ,GAAG,CAAC,CAAA;AAChB,EAAA,IAAIC,UA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