bestnihon-react-components
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -56,12 +56,20 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
console.log(_this.bar); | ||
if (_this.bar) { | ||
_this.bar.style.transition = 'all 200ms'; | ||
console.log(_this.bar); | ||
} | ||
_this.setState({ ind: index }, function () { | ||
onSel && onSel(item, index); | ||
_this.setBarWidth(); | ||
}); | ||
}; | ||
_this.setBarWidth = function () { | ||
var ind = _this.state.ind; | ||
var els = _this.container.children; | ||
var el = els[ind].children.length >= 1 ? els[ind].children[0] : els[ind].children; | ||
var w = el.getBoundingClientRect().width; | ||
_this.flag.style.width = w + 'px'; | ||
}; | ||
_this.state = { | ||
@@ -73,3 +81,9 @@ ind: props.index || 0 | ||
NavBar.prototype.componentDidMount = function componentDidMount() { | ||
this.setBarWidth(); | ||
}; | ||
NavBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
var index = nextProps.index, | ||
@@ -81,7 +95,12 @@ translate = nextProps.translate; | ||
translate && this.translateBar(translate); | ||
if (ind !== index) this.setState({ ind: index }); | ||
if (ind !== index) this.setState({ ind: index }, function () { | ||
return _this2.setBarWidth(); | ||
}); | ||
}; | ||
// 设置下标的宽度 | ||
NavBar.prototype.render = function render() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -98,37 +117,47 @@ var _state = this.state, | ||
var itemWidth = navData ? window.screen.width / navData.length : window.screen.width / children.length; | ||
// console.log('ind', ind) | ||
return React.createElement( | ||
'div', | ||
{ style: style, className: 'NavBar-root', ref: function ref(node) { | ||
_this2.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return React.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return React.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}), | ||
React.createElement('div', { className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this2.bar = node; | ||
} }) | ||
{ style: style, className: 'NavBar-root' }, | ||
React.createElement( | ||
'div', | ||
{ className: 'container', ref: function ref(node) { | ||
_this3.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return React.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return React.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}) | ||
), | ||
React.createElement( | ||
'div', | ||
{ className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this3.bar = node; | ||
} }, | ||
React.createElement('div', { className: 'Nav-active-bar', ref: function ref(node) { | ||
return _this3.flag = node; | ||
} }) | ||
) | ||
); | ||
@@ -135,0 +164,0 @@ }; |
@@ -117,3 +117,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
}; | ||
isPullDownStatus && pullDownFn[isPullDownStatus](); | ||
isPullDownStatus && isPullDownStatus !== LOADING && pullDownFn[isPullDownStatus](); | ||
isPullUpStatus && pullUpFn[isPullUpStatus](); | ||
@@ -120,0 +120,0 @@ }; |
@@ -102,3 +102,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
_this.translate = function (distance, transition) { | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
_this.container.style = cssText; | ||
@@ -156,2 +156,3 @@ var onTranslate = _this.props.onTranslate; | ||
onTranslate && onTranslate({ distance: -this.index * this.itemWidth }); | ||
this.container.style.transition = null; | ||
this.container.style.transform = 'translateX(' + -index * this.itemWidth + 'px)'; | ||
@@ -158,0 +159,0 @@ } |
@@ -64,12 +64,20 @@ 'use strict'; | ||
console.log(_this.bar); | ||
if (_this.bar) { | ||
_this.bar.style.transition = 'all 200ms'; | ||
console.log(_this.bar); | ||
} | ||
_this.setState({ ind: index }, function () { | ||
onSel && onSel(item, index); | ||
_this.setBarWidth(); | ||
}); | ||
}; | ||
_this.setBarWidth = function () { | ||
var ind = _this.state.ind; | ||
var els = _this.container.children; | ||
var el = els[ind].children.length >= 1 ? els[ind].children[0] : els[ind].children; | ||
var w = el.getBoundingClientRect().width; | ||
_this.flag.style.width = w + 'px'; | ||
}; | ||
_this.state = { | ||
@@ -81,3 +89,9 @@ ind: props.index || 0 | ||
NavBar.prototype.componentDidMount = function componentDidMount() { | ||
this.setBarWidth(); | ||
}; | ||
NavBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
var index = nextProps.index, | ||
@@ -89,7 +103,12 @@ translate = nextProps.translate; | ||
translate && this.translateBar(translate); | ||
if (ind !== index) this.setState({ ind: index }); | ||
if (ind !== index) this.setState({ ind: index }, function () { | ||
return _this2.setBarWidth(); | ||
}); | ||
}; | ||
// 设置下标的宽度 | ||
NavBar.prototype.render = function render() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -106,37 +125,47 @@ var _state = this.state, | ||
var itemWidth = navData ? window.screen.width / navData.length : window.screen.width / children.length; | ||
// console.log('ind', ind) | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: style, className: 'NavBar-root', ref: function ref(node) { | ||
_this2.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return _react2.default.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return _react2.default.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}), | ||
_react2.default.createElement('div', { className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this2.bar = node; | ||
} }) | ||
{ style: style, className: 'NavBar-root' }, | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'container', ref: function ref(node) { | ||
_this3.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return _react2.default.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return _react2.default.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}) | ||
), | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this3.bar = node; | ||
} }, | ||
_react2.default.createElement('div', { className: 'Nav-active-bar', ref: function ref(node) { | ||
return _this3.flag = node; | ||
} }) | ||
) | ||
); | ||
@@ -143,0 +172,0 @@ }; |
@@ -127,3 +127,3 @@ 'use strict'; | ||
}; | ||
isPullDownStatus && pullDownFn[isPullDownStatus](); | ||
isPullDownStatus && isPullDownStatus !== LOADING && pullDownFn[isPullDownStatus](); | ||
isPullUpStatus && pullUpFn[isPullUpStatus](); | ||
@@ -130,0 +130,0 @@ }; |
@@ -112,3 +112,3 @@ 'use strict'; | ||
_this.translate = function (distance, transition) { | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
_this.container.style = cssText; | ||
@@ -166,2 +166,3 @@ var onTranslate = _this.props.onTranslate; | ||
onTranslate && onTranslate({ distance: -this.index * this.itemWidth }); | ||
this.container.style.transition = null; | ||
this.container.style.transform = 'translateX(' + -index * this.itemWidth + 'px)'; | ||
@@ -168,0 +169,0 @@ } |
{ | ||
"name": "bestnihon-react-components", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "bestnihon-react-components React component", | ||
@@ -33,3 +33,3 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"repository": "", | ||
"repository":"https://dev.best-nihon.com:8002/nexus/content/repositories/npm-internal", | ||
"keywords": [ | ||
@@ -36,0 +36,0 @@ "react-component" |
@@ -184,12 +184,20 @@ /*! | ||
console.log(_this.bar); | ||
if (_this.bar) { | ||
_this.bar.style.transition = 'all 200ms'; | ||
console.log(_this.bar); | ||
} | ||
_this.setState({ ind: index }, function () { | ||
onSel && onSel(item, index); | ||
_this.setBarWidth(); | ||
}); | ||
}; | ||
_this.setBarWidth = function () { | ||
var ind = _this.state.ind; | ||
var els = _this.container.children; | ||
var el = els[ind].children.length >= 1 ? els[ind].children[0] : els[ind].children; | ||
var w = el.getBoundingClientRect().width; | ||
_this.flag.style.width = w + 'px'; | ||
}; | ||
_this.state = { | ||
@@ -201,3 +209,9 @@ ind: props.index || 0 | ||
NavBar.prototype.componentDidMount = function componentDidMount() { | ||
this.setBarWidth(); | ||
}; | ||
NavBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
var index = nextProps.index, | ||
@@ -209,7 +223,12 @@ translate = nextProps.translate; | ||
translate && this.translateBar(translate); | ||
if (ind !== index) this.setState({ ind: index }); | ||
if (ind !== index) this.setState({ ind: index }, function () { | ||
return _this2.setBarWidth(); | ||
}); | ||
}; | ||
// 设置下标的宽度 | ||
NavBar.prototype.render = function render() { | ||
var _this2 = this; | ||
var _this3 = this; | ||
@@ -226,37 +245,47 @@ var _state = this.state, | ||
var itemWidth = navData ? window.screen.width / navData.length : window.screen.width / children.length; | ||
// console.log('ind', ind) | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'div', | ||
{ style: style, className: 'NavBar-root', ref: function ref(node) { | ||
_this2.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item', | ||
onClick: function onClick() { | ||
return _this2.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}), | ||
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', { className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this2.bar = node; | ||
} }) | ||
{ style: style, className: 'NavBar-root' }, | ||
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'div', | ||
{ className: 'container', ref: function ref(node) { | ||
_this3.container = node; | ||
} }, | ||
navData ? navData.map(function (item, index) { | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} | ||
}, | ||
item.name | ||
); | ||
}) : children.map(function (item, index) { | ||
return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'span', | ||
{ | ||
key: 'Nav' + index, | ||
style: { width: itemWidth + 'px' }, | ||
className: 'Nav-item ' + (index === ind && 'active'), | ||
onClick: function onClick() { | ||
return _this3.sel(item, index); | ||
} }, | ||
item | ||
); | ||
}) | ||
), | ||
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( | ||
'div', | ||
{ className: 'Nav-active', style: { width: itemWidth + 'px', transform: 'translatex(' + ind * itemWidth + 'px)' }, ref: function ref(node) { | ||
return _this3.bar = node; | ||
} }, | ||
__WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('div', { className: 'Nav-active-bar', ref: function ref(node) { | ||
return _this3.flag = node; | ||
} }) | ||
) | ||
); | ||
@@ -386,3 +415,3 @@ }; | ||
_this.translate = function (distance, transition) { | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
var cssText = '\n ' + (transition ? 'transition: all 200ms;' : '') + '\n transform:translateX(' + distance + 'px)\n '; | ||
_this.container.style = cssText; | ||
@@ -440,2 +469,3 @@ var onTranslate = _this.props.onTranslate; | ||
onTranslate && onTranslate({ distance: -this.index * this.itemWidth }); | ||
this.container.style.transition = null; | ||
this.container.style.transform = 'translateX(' + -index * this.itemWidth + 'px)'; | ||
@@ -693,3 +723,3 @@ } | ||
}; | ||
isPullDownStatus && pullDownFn[isPullDownStatus](); | ||
isPullDownStatus && isPullDownStatus !== LOADING && pullDownFn[isPullDownStatus](); | ||
isPullUpStatus && pullUpFn[isPullUpStatus](); | ||
@@ -696,0 +726,0 @@ }; |
@@ -5,3 +5,3 @@ /*! | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.Y=e(require("react")):t.Y=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(e,n){e.exports=t},function(t,e,n){t.exports=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3);n.d(e,"NavBar",function(){return o.a});var r=n(5);n.d(e,"TabContainer",function(){return r.a});var i=n(7);n.d(e,"TabContainerItem",function(){return i.a});var a=n(9);n.d(e,"ScrollView",function(){return a.a});var l=n(11);n.d(e,"LozyLoad",function(){return l.a})},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(4);n.n(i);var a=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.translateBar=function(t){var e=o.props,n=e.navData,r=e.children,i=n?n.length:r.length,a=t.distance,l=t.transition;o.bar.style.transition=l?"all 200ms":"none",o.bar.style.transform="translateX("+-a/i+"px)"},o.sel=function(t,e){var n=o.props.onSel;console.log(o.bar),o.bar&&(o.bar.style.transition="all 200ms",console.log(o.bar)),o.setState({ind:e},function(){n&&n(t,e)})},o.state={ind:n.index||0},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillReceiveProps=function(t){var e=t.index,n=t.translate,o=this.state.ind;console.log("Nav_nextProps",t,this.props),n&&this.translateBar(n),o!==e&&this.setState({ind:e})},e.prototype.render=function(){var t=this,e=this.state,n=e.ind,o=(e.translate,e.newInd,this.props),i=o.navData,a=o.children,l=o.style,s=i?window.screen.width/i.length:window.screen.width/a.length;return r.a.createElement("div",{style:l,className:"NavBar-root",ref:function(e){t.container=e}},i?i.map(function(e,n){return r.a.createElement("span",{key:"Nav"+n,style:{width:s+"px"},className:"Nav-item",onClick:function(){return t.sel(e,n)}},e.name)}):a.map(function(e,n){return r.a.createElement("span",{key:"Nav"+n,style:{width:s+"px"},className:"Nav-item",onClick:function(){return t.sel(e,n)}},e)}),r.a.createElement("div",{className:"Nav-active",style:{width:s+"px",transform:"translatex("+n*s+"px)"},ref:function(e){return t.bar=e}}))},e}(o.Component);e.a=a},function(t,e){},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(6);n.n(i);var a="left",l="right",s="top",c="down",u=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.slideStart=function(t){o.startX=t.changedTouches[0].pageX,o.startY=t.changedTouches[0].pageY},o.slideMove=function(t){var e=t.changedTouches[0].pageX,n=t.changedTouches[0].pageY,r=e-o.startX,i=n-o.startY,u=r-o.itemWidth*o.index;if(!o.slideDirection||o.slideDirection===l||o.slideDirection===a)if(Math.abs(r)>Math.abs(i)&&r>0)event.preventDefault(),0!==o.index&&o.translate(u),o.slideDirection=l;else if(Math.abs(r)>Math.abs(i)&&r<0)event.preventDefault(),o.index!==o.props.children.length-1&&o.translate(u),o.slideDirection=a;else if(Math.abs(i)>Math.abs(r)&&i>0){if(o.slideDirection)return;o.slideDirection=c}else if(Math.abs(i)>Math.abs(r)&&i<0){if(o.slideDirection)return;o.slideDirection=s}},o.slideEnd=function(t){o.endX=t.changedTouches[0].pageX,o.isTranslate()},o.translate=function(t,e){var n="\n "+(e?"transition: all 200ms;":"")+"\n transform:translateX("+t+"px)\n ";o.container.style=n;var r=o.props.onTranslate;r&&r({distance:t,transition:e})},o.isTranslate=function(){if(o.slideDirection===l||o.slideDirection===a){var t=o.props.onSel,e=o.endX-o.startX,n={right:function(){0!==o.index&&o.index--},left:function(){o.index!==o.props.children.length-1&&o.index++}};Math.abs(e)>=o.interval&&(console.log("上下页切换",o.index),n[o.slideDirection](),t&&t(o.index)),o.translate(-o.index*o.itemWidth,!0)}o.slideDirection=null},o.itemWidth=window.screen.width,o.interval=n.interval||parseInt(o.itemWidth/5),o.index=n.index||0,o.oldIndex=n.index||0,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillReceiveProps=function(t){console.log("tabcontainer nextProps",t);var e=t.index,n=this.props.onTranslate;this.index!==e&&(this.index=e,n&&n({distance:-this.index*this.itemWidth}),this.container.style.transform="translateX("+-e*this.itemWidth+"px)")},e.prototype.componentDidMount=function(){this.translate(-this.index*this.itemWidth),this.root.addEventListener("touchstart",this.slideStart),this.root.addEventListener("touchmove",this.slideMove),this.root.addEventListener("touchend",this.slideEnd)},e.prototype.componentWillUnmount=function(){this.root.removeEventListener("touchstart",this.slideStart),this.root.removeEventListener("touchmove",this.slideMove),this.root.removeEventListener("touchend",this.slideEnd)},e.prototype.render=function(){var t=this;return r.a.createElement("div",{className:"tab-container-root",ref:function(e){t.root=e}},r.a.createElement("ul",{className:"tab-container",ref:function(e){t.container=e}},this.props.children))},e}(o.Component);e.a=u},function(t,e){},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(8),a=(n.n(i),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t});var l=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(){var t=this,e=Object.assign({},this.props),n=e.style;return n?n.height||(n.height=window.screen.height+"px"):n={height:window.screen.height+"px"},r.a.createElement("li",a({className:"TabContainerItem"},e,{ref:function(e){return t.el=e}}),this.props.children)},e}(o.Component);e.a=l},function(t,e){},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(10);n.n(i);var a="top",l="bottom",s="loading",c="touch_top",u="touch_bottom",p=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.handleTouchStart=function(t){console.log("触摸开始",o.wrap.scrollTop),o.startY=t.touches[0].clientY},o.handleTouchMove=function(t){var e=o.state,n=e.isPullDown,r=e.isPullUp,i=e.topDistance,p=e.bottomDistance,d=e.isPullDownStatus,h=e.isPullUpStatus,f=e.isLoadOver,m=o.wrap.scrollTop,v=t.touches[0].clientY,y=void 0;o.direction=v-o.startY>0?u:c,console.log("滚动距离==>"+m,"上拉加载距离==>"+o.bottom),n&&o.direction===u&&0===m&&d!==s&&!h?(event.preventDefault(),o.pullDownBarStartY=o.pullDownBarStartY?o.pullDownBarStartY:t.touches[0].clientY,y=(v-o.pullDownBarStartY)/o.limit,o.translate(y,!1),o.setState({isPullDownStatus:y>=i?a:l}),console.log("开启下拉刷新")):r&&!f&&o.direction===c&&m>=o.bottom&&h!==s&&!d&&(event.preventDefault(),o.pullUpBarStartY=o.pullUpBarStartY?o.pullUpBarStartY:t.touches[0].clientY,y=(v-o.pullUpBarStartY)/o.limit,o.translate(y,!1),o.setState({isPullUpStatus:Math.abs(y)>=p?l:a}),console.log("开启上拉加载"))},o.handleTouchEnd=function(t){var e=o.state,n=e.isPullDownStatus,r=e.isPullUpStatus,i=e.topMethod,a=e.bottomMethod,l=e.animateTime;o.pullDownBarStartY=null,o.pullUpBarStartY=null,console.log("触摸结束",n,r);var c={top:function(){o.translate(),setTimeout(function(){o.setState({isPullUpStatus:null})},l)},bottom:function(){o.setState({isPullUpStatus:s},function(){o.translate(-o.pullUpBarHeight),a&&a()})}};n&&{top:function(){o.setState({isPullDownStatus:s},function(){o.translate(o.pullDownBarHeight),i&&i()})},bottom:function(){o.translate(),setTimeout(function(){o.setState({isPullDownStatus:null})},l)}}[n](),r&&c[r]()},o.fetchData=function(){var t=o.state,e=t.isFetch,n=t.topMethod;t.animateTime;e&&o.setState({isPullDownStatus:s,isPullUpStatus:null},function(){o.translate(o.pullDownBarHeight,!0),n&&n()})},o.scroll=function(){var t=o.state,e=t.onLower,n=t.onUpper,r=t.onScroll,i=t.scrollX,a=t.upperThreshold,l=t.lowerThreshold,s=i?"scrollLeft":"scrollTop",c=i?o.children:o.wrap,u=c[s],p=i?parseFloat(window.getComputedStyle(c,null).width):parseFloat(window.getComputedStyle(c,null).height),d=i?c.scrollWidth-p:c.scrollHeight-p;r&&r({scroll:u}),u<=a?n&&n():u>=d-l&&e&&e()},o.fill=function(t){var e=o.state.wrapHeight,n=parseFloat(window.getComputedStyle(o.children).height);o.wrap.style.height=e+"px",o.setState({fillAttr:n<e&&e-n},function(){o.scrollBottom(),t&&o.setTarget()})},o.setTarget=function(){var t=o.state,e=t.itemIndex,n=t.itemKey,r=t.scrollX,i=o.children.children,a=void 0;if(e)a=e;else if(n)for(var l=0;l<o.children.length;l++)if(console.log("key 值",o.children[l].key),n===o.children[l].key){a=l;break}var s=r?o.children:o.wrap;a>=0&&(r?s.scrollLeft=i[a].offsetLeft:(console.log(i[a]),s.scrollTop=i[a].offsetTop)),setTimeout(function(){s.addEventListener("scroll",o.scroll)},0)},o.translate=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=o.state,r=n.pullThreshold,i=n.animateTime;Math.abs(t)>r||(o.content.style.transition=e?"all "+i+"ms ease":"none",o.content.style.transform="translate3d(0, "+t+"px,0)")},o.scrollBottom=function(){var t=o.state.fillAttr,e=o.children.scrollHeight,n=parseFloat(window.getComputedStyle(o.wrap).height);o.bottom=t?0:e-n},o.limit=n.limit||4,o.state={isFetch:n.isFetch||!1,isLoadOver:n.isLoadOver,requestState:n.requestState,isPullDown:n.isPullDown||!1,isPullUp:n.isPullUp||!1,topDistance:n.topDistance||50,bottomDistance:n.bottomDistance||50,isPullDownStatus:null,isPullUpStatus:null,topMethod:n.topMethod,bottomMethod:n.bottomMethod,wrapHeight:n.wrapHeight,pullThreshold:n.pullThreshold||200,scrollX:n.scrollX||!1,scrollY:n.scrollY||!1,upperThreshold:n.upperThreshold||50,lowerThreshold:n.lowerThreshold||50,onUpper:n.onUpper,onLower:n.onLower,onScroll:n.onScroll,itemIndex:n.itemIndex||!1,itemKey:n.itemKey||!1,animateTime:n.animateTime||300},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this,e=this.state,n=e.wrapHeight,o=e.scrollX;this.setState({wrapHeight:n||parseFloat(window.getComputedStyle(this.wrap.parentNode).height)},function(){o?t.setTarget():(t.wrap.addEventListener("touchstart",t.handleTouchStart),t.wrap.addEventListener("touchmove",t.handleTouchMove),t.wrap.addEventListener("touchend",t.handleTouchEnd),t.fetchData(),t.fill(!0))})},e.prototype.componentWillReceiveProps=function(t){var e=this,n=t.requestState,o=t.isLoadOver,r=this.state,i=r.isPullUpStatus,a=r.isPullDownStatus,l=r.animateTime,s=function(){0===e.wrap.scrollTop&&e.translate(),setTimeout(function(){e.setState({isPullDownStatus:null},function(){return e.fill()})},l)};n&&(i&&function(){e.translate(),setTimeout(function(){e.setState({isPullUpStatus:null},function(){e.fill()})},l)}(),a&&s()),this.setState({isLoadOver:o})},e.prototype.componentWillUnmount=function(){this.wrap.removeEventListener("touchstart",this.handleTouchStart),this.wrap.removeEventListener("touchmove",this.handleTouchMove),this.wrap.removeEventListener("touchend",this.handleTouchEnd),(this.state.scrollX?this.children:this.wrap).removeEventListener("scroll",this.scroll),clearInterval(this.timer)},e.prototype.render=function(){var t=this,e=this.state,n=e.isPullDownStatus,o=e.isPullUpStatus,i=e.fillAttr,c=e.scrollX,u=(e.translate,e.isLoadOver),p=this.props,d=p.style,h=p.children,f=function(){return r.a.createElement("div",{className:"spinner"},r.a.createElement("div",{className:"bounce1"}),r.a.createElement("div",{className:"bounce2"}),r.a.createElement("div",{className:"bounce3"}))};return r.a.createElement("div",{className:"load-more-root",style:d,ref:function(e){return t.wrap=e}},r.a.createElement("div",{className:"load-more-content",ref:function(e){return t.content=e}},!c&&n&&!o&&r.a.createElement("div",{className:"pull-down-bar",ref:function(e){e&&(t.pullDownBarHeight=parseFloat(window.getComputedStyle(e).height))}},n===s?r.a.createElement(f,null):r.a.createElement("span",{className:"is-transition "+(n===a?"is-rotate":"")},"↓")),r.a.createElement("div",{className:"scroll-view-root "+(c?"scroll-view-x":"scroll-view-y")+" ",ref:function(e){return t.children=e}},h.map(function(t,e){return r.a.createElement("div",{key:"children"+e,className:c?"scroll-x-item":"scroll-y-item"},t)})),u&&("string"==typeof u?r.a.createElement("p",{className:"pull-up-tip"},u):r.a.createElement("p",{className:"pull-up-tip"},"加载完毕")),i&&r.a.createElement("div",{style:{height:i+"px"}}),!c&&!u&&o&&!n&&r.a.createElement("div",{className:"pull-up-bar",ref:function(e){return e&&(t.pullUpBarHeight=parseFloat(window.getComputedStyle(e).height))}},o===s?r.a.createElement(f,null):r.a.createElement("span",{className:"is-transition "+(o===l?"is-rotate":"")+" "},"↑"))))},e}(o.Component);e.a=p},function(t,e){},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(12),a=n(13),l=(n.n(a),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t});var s=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.lazyLoad=o.lazyLoad.bind(o,n.src),o.state={isAnimate:!1},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.isScroll(),window.addEventListener("scroll",this.lazyLoad),window.addEventListener("resize",this.lazyLoad)},e.prototype.componentWillUnmount=function(){window.removeEventListener("scroll",this.lazyLoad),window.removeEventListener("resize",this.lazyLoad)},e.prototype.isScroll=function(){document.body.clientHeight<=i.a.clientHeight()&&this.lazyLoad()},e.prototype.lazyLoad=function(t){i.a.availHeight()+i.a.scrollTop()>this.img.offsetTop-100&&!this.img.src&&(this.img.src=t)},e.prototype.render=function(){var t=this,e=this.state.isAnimate,n=Object.assign({},this.props);return r.a.createElement("div",{className:e?"LazyLoadImg":"",style:{opacity:e?1:0}},r.a.createElement("img",l({},n,{alt:"",ref:function(e){t.img=e},onLoad:function(){t.setState({isAnimate:!0})}})))},e}(o.Component);e.a=s},function(t,e,n){"use strict";var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.maxWidth=function(){return Math.min(640,this.clientWidth())},t.documentElement=function(){return document.body.clientWidth+document.body.clientHeight+document.body.scrollWidth+document.body.scrollHeight+document.body.scrollTop>document.documentElement.clientWidth+document.documentElement.clientHeight+document.documentElement.scrollWidth+document.documentElement.scrollHeight+document.documentElement.scrollTop?document.body:document.documentElement},t.rootElement=function(){return document.getElementById("root")},t.availWidth=function(){return window.screen.availWidth},t.availHeight=function(){return window.screen.availHeight},t.scrollHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},t.scrollWidth=function(){return Math.max(document.body.scrollWidth,document.documentElement.scrollWidth)},t.scrollTop=function(){return Math.max(document.body.scrollTop,document.documentElement.scrollTop)},t.scrollToTop=function(){window.scrollTo(0,0)},t.setScrollTop=function(t){document.body.scrollTop=t,document.documentElement.scrollTop=t},t.clientHeight=function(){return Math.max(document.body.clientHeight,document.documentElement.clientHeight)},t.clientWidth=function(){return Math.max(document.body.clientWidth,document.documentElement.clientWidth)},t.resetFontSize=function(){var e=t.maxWidth()/7.5;t.fontSize=e,document.documentElement.style.fontSize=e+"px",document.body.style.maxWidth=t.maxWidth()+"px"},t.setInstance=function(e){t.app=e},t.removeInstance=function(){t.app=void 0},t.alert=function(e,n){t.app.setState({alert:{message:e,onClose:function(){t.app.setState({alert:void 0},function(){n&&n()})}}})},t.confirm=function(e,n,o,r){t.app.setState({confirm:{title:e,message:n,onConfirm:function(){t.app.setState({confirm:void 0},function(){o&&o()})},onCancel:function(){t.app.setState({confirm:void 0},function(){r&&r()})}}})},t.loading=function(e,n){t.app.setState({loading:e},function(){n&&n()})},t.isHorizontal=function(){return t.clientWidth()>t.clientHeight()},t}();e.a=o},function(t,e){}]).default}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.Y=e(require("react")):t.Y=e(t.React)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(e,n){e.exports=t},function(t,e,n){t.exports=n(2)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3);n.d(e,"NavBar",function(){return o.a});var i=n(5);n.d(e,"TabContainer",function(){return i.a});var r=n(7);n.d(e,"TabContainerItem",function(){return r.a});var a=n(9);n.d(e,"ScrollView",function(){return a.a});var l=n(11);n.d(e,"LozyLoad",function(){return l.a})},function(t,e,n){"use strict";var o=n(0),i=n.n(o),r=n(4);n.n(r);var a=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.translateBar=function(t){var e=o.props,n=e.navData,i=e.children,r=n?n.length:i.length,a=t.distance,l=t.transition;o.bar.style.transition=l?"all 200ms":"none",o.bar.style.transform="translateX("+-a/r+"px)"},o.sel=function(t,e){var n=o.props.onSel;o.bar&&(o.bar.style.transition="all 200ms"),o.setState({ind:e},function(){n&&n(t,e),o.setBarWidth()})},o.setBarWidth=function(){var t=o.state.ind,e=o.container.children,n=(e[t].children.length>=1?e[t].children[0]:e[t].children).getBoundingClientRect().width;o.flag.style.width=n+"px"},o.state={ind:n.index||0},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.setBarWidth()},e.prototype.componentWillReceiveProps=function(t){var e=this,n=t.index,o=t.translate,i=this.state.ind;console.log("Nav_nextProps",t,this.props),o&&this.translateBar(o),i!==n&&this.setState({ind:n},function(){return e.setBarWidth()})},e.prototype.render=function(){var t=this,e=this.state,n=e.ind,o=(e.translate,e.newInd,this.props),r=o.navData,a=o.children,l=o.style,s=r?window.screen.width/r.length:window.screen.width/a.length;return i.a.createElement("div",{style:l,className:"NavBar-root"},i.a.createElement("div",{className:"container",ref:function(e){t.container=e}},r?r.map(function(e,o){return i.a.createElement("span",{key:"Nav"+o,style:{width:s+"px"},className:"Nav-item "+(o===n&&"active"),onClick:function(){return t.sel(e,o)}},e.name)}):a.map(function(e,o){return i.a.createElement("span",{key:"Nav"+o,style:{width:s+"px"},className:"Nav-item "+(o===n&&"active"),onClick:function(){return t.sel(e,o)}},e)})),i.a.createElement("div",{className:"Nav-active",style:{width:s+"px",transform:"translatex("+n*s+"px)"},ref:function(e){return t.bar=e}},i.a.createElement("div",{className:"Nav-active-bar",ref:function(e){return t.flag=e}})))},e}(o.Component);e.a=a},function(t,e){},function(t,e,n){"use strict";var o=n(0),i=n.n(o),r=n(6);n.n(r);var a="left",l="right",s="top",c="down",u=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.slideStart=function(t){o.startX=t.changedTouches[0].pageX,o.startY=t.changedTouches[0].pageY},o.slideMove=function(t){var e=t.changedTouches[0].pageX,n=t.changedTouches[0].pageY,i=e-o.startX,r=n-o.startY,u=i-o.itemWidth*o.index;if(!o.slideDirection||o.slideDirection===l||o.slideDirection===a)if(Math.abs(i)>Math.abs(r)&&i>0)event.preventDefault(),0!==o.index&&o.translate(u),o.slideDirection=l;else if(Math.abs(i)>Math.abs(r)&&i<0)event.preventDefault(),o.index!==o.props.children.length-1&&o.translate(u),o.slideDirection=a;else if(Math.abs(r)>Math.abs(i)&&r>0){if(o.slideDirection)return;o.slideDirection=c}else if(Math.abs(r)>Math.abs(i)&&r<0){if(o.slideDirection)return;o.slideDirection=s}},o.slideEnd=function(t){o.endX=t.changedTouches[0].pageX,o.isTranslate()},o.translate=function(t,e){var n="\n "+(e?"transition: all 200ms;":"")+"\n transform:translateX("+t+"px)\n ";o.container.style=n;var i=o.props.onTranslate;i&&i({distance:t,transition:e})},o.isTranslate=function(){if(o.slideDirection===l||o.slideDirection===a){var t=o.props.onSel,e=o.endX-o.startX,n={right:function(){0!==o.index&&o.index--},left:function(){o.index!==o.props.children.length-1&&o.index++}};Math.abs(e)>=o.interval&&(console.log("上下页切换",o.index),n[o.slideDirection](),t&&t(o.index)),o.translate(-o.index*o.itemWidth,!0)}o.slideDirection=null},o.itemWidth=window.screen.width,o.interval=n.interval||parseInt(o.itemWidth/5),o.index=n.index||0,o.oldIndex=n.index||0,o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentWillReceiveProps=function(t){console.log("tabcontainer nextProps",t);var e=t.index,n=this.props.onTranslate;this.index!==e&&(this.index=e,n&&n({distance:-this.index*this.itemWidth}),this.container.style.transition=null,this.container.style.transform="translateX("+-e*this.itemWidth+"px)")},e.prototype.componentDidMount=function(){this.translate(-this.index*this.itemWidth),this.root.addEventListener("touchstart",this.slideStart),this.root.addEventListener("touchmove",this.slideMove),this.root.addEventListener("touchend",this.slideEnd)},e.prototype.componentWillUnmount=function(){this.root.removeEventListener("touchstart",this.slideStart),this.root.removeEventListener("touchmove",this.slideMove),this.root.removeEventListener("touchend",this.slideEnd)},e.prototype.render=function(){var t=this;return i.a.createElement("div",{className:"tab-container-root",ref:function(e){t.root=e}},i.a.createElement("ul",{className:"tab-container",ref:function(e){t.container=e}},this.props.children))},e}(o.Component);e.a=u},function(t,e){},function(t,e,n){"use strict";var o=n(0),i=n.n(o),r=n(8),a=(n.n(r),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t});var l=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.apply(this,arguments))}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.render=function(){var t=this,e=Object.assign({},this.props),n=e.style;return n?n.height||(n.height=window.screen.height+"px"):n={height:window.screen.height+"px"},i.a.createElement("li",a({className:"TabContainerItem"},e,{ref:function(e){return t.el=e}}),this.props.children)},e}(o.Component);e.a=l},function(t,e){},function(t,e,n){"use strict";var o=n(0),i=n.n(o),r=n(10);n.n(r);var a="top",l="bottom",s="loading",c="touch_top",u="touch_bottom",p=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.handleTouchStart=function(t){console.log("触摸开始",o.wrap.scrollTop),o.startY=t.touches[0].clientY},o.handleTouchMove=function(t){var e=o.state,n=e.isPullDown,i=e.isPullUp,r=e.topDistance,p=e.bottomDistance,d=e.isPullDownStatus,h=e.isPullUpStatus,f=e.isLoadOver,m=o.wrap.scrollTop,v=t.touches[0].clientY,y=void 0;o.direction=v-o.startY>0?u:c,console.log("滚动距离==>"+m,"上拉加载距离==>"+o.bottom),n&&o.direction===u&&0===m&&d!==s&&!h?(event.preventDefault(),o.pullDownBarStartY=o.pullDownBarStartY?o.pullDownBarStartY:t.touches[0].clientY,y=(v-o.pullDownBarStartY)/o.limit,o.translate(y,!1),o.setState({isPullDownStatus:y>=r?a:l}),console.log("开启下拉刷新")):i&&!f&&o.direction===c&&m>=o.bottom&&h!==s&&!d&&(event.preventDefault(),o.pullUpBarStartY=o.pullUpBarStartY?o.pullUpBarStartY:t.touches[0].clientY,y=(v-o.pullUpBarStartY)/o.limit,o.translate(y,!1),o.setState({isPullUpStatus:Math.abs(y)>=p?l:a}),console.log("开启上拉加载"))},o.handleTouchEnd=function(t){var e=o.state,n=e.isPullDownStatus,i=e.isPullUpStatus,r=e.topMethod,a=e.bottomMethod,l=e.animateTime;o.pullDownBarStartY=null,o.pullUpBarStartY=null,console.log("触摸结束",n,i);var c={top:function(){o.translate(),setTimeout(function(){o.setState({isPullUpStatus:null})},l)},bottom:function(){o.setState({isPullUpStatus:s},function(){o.translate(-o.pullUpBarHeight),a&&a()})}};n&&n!==s&&{top:function(){o.setState({isPullDownStatus:s},function(){o.translate(o.pullDownBarHeight),r&&r()})},bottom:function(){o.translate(),setTimeout(function(){o.setState({isPullDownStatus:null})},l)}}[n](),i&&c[i]()},o.fetchData=function(){var t=o.state,e=t.isFetch,n=t.topMethod;t.animateTime;e&&o.setState({isPullDownStatus:s,isPullUpStatus:null},function(){o.translate(o.pullDownBarHeight,!0),n&&n()})},o.scroll=function(){var t=o.state,e=t.onLower,n=t.onUpper,i=t.onScroll,r=t.scrollX,a=t.upperThreshold,l=t.lowerThreshold,s=r?"scrollLeft":"scrollTop",c=r?o.children:o.wrap,u=c[s],p=r?parseFloat(window.getComputedStyle(c,null).width):parseFloat(window.getComputedStyle(c,null).height),d=r?c.scrollWidth-p:c.scrollHeight-p;i&&i({scroll:u}),u<=a?n&&n():u>=d-l&&e&&e()},o.fill=function(t){var e=o.state.wrapHeight,n=parseFloat(window.getComputedStyle(o.children).height);o.wrap.style.height=e+"px",o.setState({fillAttr:n<e&&e-n},function(){o.scrollBottom(),t&&o.setTarget()})},o.setTarget=function(){var t=o.state,e=t.itemIndex,n=t.itemKey,i=t.scrollX,r=o.children.children,a=void 0;if(e)a=e;else if(n)for(var l=0;l<o.children.length;l++)if(console.log("key 值",o.children[l].key),n===o.children[l].key){a=l;break}var s=i?o.children:o.wrap;a>=0&&(i?s.scrollLeft=r[a].offsetLeft:(console.log(r[a]),s.scrollTop=r[a].offsetTop)),setTimeout(function(){s.addEventListener("scroll",o.scroll)},0)},o.translate=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=o.state,i=n.pullThreshold,r=n.animateTime;Math.abs(t)>i||(o.content.style.transition=e?"all "+r+"ms ease":"none",o.content.style.transform="translate3d(0, "+t+"px,0)")},o.scrollBottom=function(){var t=o.state.fillAttr,e=o.children.scrollHeight,n=parseFloat(window.getComputedStyle(o.wrap).height);o.bottom=t?0:e-n},o.limit=n.limit||4,o.state={isFetch:n.isFetch||!1,isLoadOver:n.isLoadOver,requestState:n.requestState,isPullDown:n.isPullDown||!1,isPullUp:n.isPullUp||!1,topDistance:n.topDistance||50,bottomDistance:n.bottomDistance||50,isPullDownStatus:null,isPullUpStatus:null,topMethod:n.topMethod,bottomMethod:n.bottomMethod,wrapHeight:n.wrapHeight,pullThreshold:n.pullThreshold||200,scrollX:n.scrollX||!1,scrollY:n.scrollY||!1,upperThreshold:n.upperThreshold||50,lowerThreshold:n.lowerThreshold||50,onUpper:n.onUpper,onLower:n.onLower,onScroll:n.onScroll,itemIndex:n.itemIndex||!1,itemKey:n.itemKey||!1,animateTime:n.animateTime||300},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){var t=this,e=this.state,n=e.wrapHeight,o=e.scrollX;this.setState({wrapHeight:n||parseFloat(window.getComputedStyle(this.wrap.parentNode).height)},function(){o?t.setTarget():(t.wrap.addEventListener("touchstart",t.handleTouchStart),t.wrap.addEventListener("touchmove",t.handleTouchMove),t.wrap.addEventListener("touchend",t.handleTouchEnd),t.fetchData(),t.fill(!0))})},e.prototype.componentWillReceiveProps=function(t){var e=this,n=t.requestState,o=t.isLoadOver,i=this.state,r=i.isPullUpStatus,a=i.isPullDownStatus,l=i.animateTime,s=function(){0===e.wrap.scrollTop&&e.translate(),setTimeout(function(){e.setState({isPullDownStatus:null},function(){return e.fill()})},l)};n&&(r&&function(){e.translate(),setTimeout(function(){e.setState({isPullUpStatus:null},function(){e.fill()})},l)}(),a&&s()),this.setState({isLoadOver:o})},e.prototype.componentWillUnmount=function(){this.wrap.removeEventListener("touchstart",this.handleTouchStart),this.wrap.removeEventListener("touchmove",this.handleTouchMove),this.wrap.removeEventListener("touchend",this.handleTouchEnd),(this.state.scrollX?this.children:this.wrap).removeEventListener("scroll",this.scroll),clearInterval(this.timer)},e.prototype.render=function(){var t=this,e=this.state,n=e.isPullDownStatus,o=e.isPullUpStatus,r=e.fillAttr,c=e.scrollX,u=(e.translate,e.isLoadOver),p=this.props,d=p.style,h=p.children,f=function(){return i.a.createElement("div",{className:"spinner"},i.a.createElement("div",{className:"bounce1"}),i.a.createElement("div",{className:"bounce2"}),i.a.createElement("div",{className:"bounce3"}))};return i.a.createElement("div",{className:"load-more-root",style:d,ref:function(e){return t.wrap=e}},i.a.createElement("div",{className:"load-more-content",ref:function(e){return t.content=e}},!c&&n&&!o&&i.a.createElement("div",{className:"pull-down-bar",ref:function(e){e&&(t.pullDownBarHeight=parseFloat(window.getComputedStyle(e).height))}},n===s?i.a.createElement(f,null):i.a.createElement("span",{className:"is-transition "+(n===a?"is-rotate":"")},"↓")),i.a.createElement("div",{className:"scroll-view-root "+(c?"scroll-view-x":"scroll-view-y")+" ",ref:function(e){return t.children=e}},h.map(function(t,e){return i.a.createElement("div",{key:"children"+e,className:c?"scroll-x-item":"scroll-y-item"},t)})),u&&("string"==typeof u?i.a.createElement("p",{className:"pull-up-tip"},u):i.a.createElement("p",{className:"pull-up-tip"},"加载完毕")),r&&i.a.createElement("div",{style:{height:r+"px"}}),!c&&!u&&o&&!n&&i.a.createElement("div",{className:"pull-up-bar",ref:function(e){return e&&(t.pullUpBarHeight=parseFloat(window.getComputedStyle(e).height))}},o===s?i.a.createElement(f,null):i.a.createElement("span",{className:"is-transition "+(o===l?"is-rotate":"")+" "},"↑"))))},e}(o.Component);e.a=p},function(t,e){},function(t,e,n){"use strict";var o=n(0),i=n.n(o),r=n(12),a=n(13),l=(n.n(a),Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t});var s=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.lazyLoad=o.lazyLoad.bind(o,n.src),o.state={isAnimate:!1},o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.componentDidMount=function(){this.isScroll(),window.addEventListener("scroll",this.lazyLoad),window.addEventListener("resize",this.lazyLoad)},e.prototype.componentWillUnmount=function(){window.removeEventListener("scroll",this.lazyLoad),window.removeEventListener("resize",this.lazyLoad)},e.prototype.isScroll=function(){document.body.clientHeight<=r.a.clientHeight()&&this.lazyLoad()},e.prototype.lazyLoad=function(t){r.a.availHeight()+r.a.scrollTop()>this.img.offsetTop-100&&!this.img.src&&(this.img.src=t)},e.prototype.render=function(){var t=this,e=this.state.isAnimate,n=Object.assign({},this.props);return i.a.createElement("div",{className:e?"LazyLoadImg":"",style:{opacity:e?1:0}},i.a.createElement("img",l({},n,{alt:"",ref:function(e){t.img=e},onLoad:function(){t.setState({isAnimate:!0})}})))},e}(o.Component);e.a=s},function(t,e,n){"use strict";var o=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.maxWidth=function(){return Math.min(640,this.clientWidth())},t.documentElement=function(){return document.body.clientWidth+document.body.clientHeight+document.body.scrollWidth+document.body.scrollHeight+document.body.scrollTop>document.documentElement.clientWidth+document.documentElement.clientHeight+document.documentElement.scrollWidth+document.documentElement.scrollHeight+document.documentElement.scrollTop?document.body:document.documentElement},t.rootElement=function(){return document.getElementById("root")},t.availWidth=function(){return window.screen.availWidth},t.availHeight=function(){return window.screen.availHeight},t.scrollHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)},t.scrollWidth=function(){return Math.max(document.body.scrollWidth,document.documentElement.scrollWidth)},t.scrollTop=function(){return Math.max(document.body.scrollTop,document.documentElement.scrollTop)},t.scrollToTop=function(){window.scrollTo(0,0)},t.setScrollTop=function(t){document.body.scrollTop=t,document.documentElement.scrollTop=t},t.clientHeight=function(){return Math.max(document.body.clientHeight,document.documentElement.clientHeight)},t.clientWidth=function(){return Math.max(document.body.clientWidth,document.documentElement.clientWidth)},t.resetFontSize=function(){var e=t.maxWidth()/7.5;t.fontSize=e,document.documentElement.style.fontSize=e+"px",document.body.style.maxWidth=t.maxWidth()+"px"},t.setInstance=function(e){t.app=e},t.removeInstance=function(){t.app=void 0},t.alert=function(e,n){t.app.setState({alert:{message:e,onClose:function(){t.app.setState({alert:void 0},function(){n&&n()})}}})},t.confirm=function(e,n,o,i){t.app.setState({confirm:{title:e,message:n,onConfirm:function(){t.app.setState({confirm:void 0},function(){o&&o()})},onCancel:function(){t.app.setState({confirm:void 0},function(){i&&i()})}}})},t.loading=function(e,n){t.app.setState({loading:e},function(){n&&n()})},t.isHorizontal=function(){return t.clientWidth()>t.clientHeight()},t}();e.a=o},function(t,e){}]).default}); | ||
//# sourceMappingURL=bestnihon-react-components.min.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
226816
3584