Socket
Socket
Sign inDemoInstall

bestnihon-react-components

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bestnihon-react-components - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

es/LazyLoad/LazyLoad.css

27

es/LazyLoad/LazyLoad.js

@@ -10,5 +10,4 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import React, { Component } from 'react';
import Screen from '../utils/Screen';
import Screen from "../utils/Screen";
import './LazyLoad.css';
import DefaultImg from './whitebg.png';

@@ -24,2 +23,5 @@ var LazyLoad = function (_Component) {

_this.lazyLoad = _this.lazyLoad.bind(_this, props.src);
_this.state = {
isAnimate: false
};
return _this;

@@ -50,3 +52,3 @@ }

if (Screen.availHeight() + Screen.scrollTop() > this.img.offsetTop - 100) {
this.img.src = src;
!this.img.src && (this.img.src = src);
}

@@ -58,10 +60,19 @@ };

var isAnimate = this.state.isAnimate;
var props = Object.assign({}, this.props);
props.src = DefaultImg;
return React.createElement(
'div',
{ className: 'LazyLoadImg' },
React.createElement('img', _extends({}, props, { alt: '', ref: function ref(input) {
_this2.img = input;
} }))
{ className: '' + (isAnimate ? 'LazyLoadImg' : ''), style: { opacity: isAnimate ? 1 : 0 } },
React.createElement('img', _extends({}, props, {
alt: '',
ref: function ref(node) {
_this2.img = node;
},
onLoad: function onLoad() {
_this2.setState({
isAnimate: true
});
}
}))
);

@@ -68,0 +79,0 @@ };

@@ -16,3 +16,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* 定义:
NavData: 数组
navData: 数组
eg: [{name: '首页', type: 1}, {name: '购物车', type: 2}] 类似于这样的

@@ -23,3 +23,3 @@

ind: 展示第几个 navbar, 默认第一个, 从零开始
index: 展示第几个 navbar, 默认第一个, 从零开始

@@ -43,28 +43,25 @@ TODO: 完成!!!!!

var _this$props = _this.props,
NavData = _this$props.NavData,
navData = _this$props.navData,
children = _this$props.children;
var length = NavData ? NavData.length : children.length;
// console.log('ssss', s)
var length = navData ? navData.length : children.length;
var distance = s.distance,
transition = s.transition;
// 不连写的原因是 防止以后添加其他属性 会覆盖
if (_this.bar) {
// 不连写的原因是 防止以后添加其他属性 会覆盖
transition ? _this.bar.style.transition = 'all 200ms' : _this.bar.style.transition = 'none';
_this.bar.style.transform = 'translateX(' + -distance / length + 'px)';
}
transition ? _this.bar.style.transition = 'all 200ms' : _this.bar.style.transition = 'none';
_this.bar.style.transform = 'translateX(' + -distance / length + 'px)';
};
_this.sel = function (item, index) {
// 防止出现不需要 bar 的情况
_this.bar && (_this.bar.style.transition = 'all 200ms');
var ind = _this.state.ind;
// 函数节流
if (ind === index) return console.warn('函数节流,不可重复点击');
var onSel = _this.props.onSel;
onSel && onSel(item, index);
_this.setState({ ind: index });
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);
});
};

@@ -79,3 +76,2 @@

NavBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
// console.log('Nav_nextProps', nextProps)
var index = nextProps.index,

@@ -85,7 +81,5 @@ translate = nextProps.translate;

if (index >= 0 && index !== ind) {
this.setState({ ind: index });
} else {
translate && this.translateBar(translate);
}
console.log('Nav_nextProps', nextProps, this.props);
translate && this.translateBar(translate);
if (ind !== index) this.setState({ ind: index });
};

@@ -101,7 +95,7 @@

var _props = this.props,
NavData = _props.NavData,
navData = _props.navData,
children = _props.children,
style = _props.style;
var itemWidth = NavData ? window.screen.width / NavData.length : window.screen.width / children.length;
var itemWidth = navData ? window.screen.width / navData.length : window.screen.width / children.length;
// console.log('ind', ind)

@@ -113,3 +107,3 @@ return React.createElement(

} },
NavData ? NavData.map(function (item, index) {
navData ? navData.map(function (item, index) {
return React.createElement(

@@ -123,3 +117,4 @@ 'span',

return _this2.sel(item, index);
} },
}
},
item.name

@@ -126,0 +121,0 @@ );

@@ -1,5 +0,1 @@

import _regeneratorRuntime from 'babel-runtime/regenerator';
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -24,4 +20,2 @@

function ScrollView(props) {
var _this2 = this;
_classCallCheck(this, ScrollView);

@@ -43,3 +37,4 @@

isPullDownStatus = _this$state.isPullDownStatus,
isPullUpStatus = _this$state.isPullUpStatus;
isPullUpStatus = _this$state.isPullUpStatus,
isLoadOver = _this$state.isLoadOver;

@@ -60,4 +55,4 @@ var scrollTop = _this.wrap.scrollTop;

});
console.log('开启下拉刷新', distance, distance >= topDistance ? TOP : BOTTOM);
} else if (isPullUp && _this.direction === TOUCH_TOP && scrollTop >= _this.bottom && isPullUpStatus !== LOADING && !isPullDownStatus) {
console.log('开启下拉刷新');
} else if (isPullUp && !isLoadOver && _this.direction === TOUCH_TOP && scrollTop >= _this.bottom && isPullUpStatus !== LOADING && !isPullDownStatus) {
event.preventDefault();

@@ -95,3 +90,3 @@ // event.stopPropagation();

_this.translate(_this.pullDownBarHeight);
topMethod && _this.pullDown(topMethod);
topMethod && topMethod();
});

@@ -122,3 +117,3 @@ },

_this.translate(-_this.pullUpBarHeight);
bottomMethod && _this.pullUp(bottomMethod);
bottomMethod && bottomMethod();
});

@@ -131,51 +126,19 @@ }

_this.setTarget = function () {
_this.fetchData = function () {
var _this$state3 = _this.state,
itemIndex = _this$state3.itemIndex,
itemKey = _this$state3.itemKey,
scrollX = _this$state3.scrollX;
isFetch = _this$state3.isFetch,
topMethod = _this$state3.topMethod,
animateTime = _this$state3.animateTime;
var children = _this.children.children;
var index = void 0;
// 检测下标 || key 值
if (itemIndex) {
index = itemIndex;
} else if (itemKey) {
for (var i = 0; i < _this.children.length; i++) {
console.log('key 值', _this.children[i].key);
if (itemKey === _this.children[i].key) {
index = i;
break;
}
}
if (isFetch) {
_this.setState({
isPullDownStatus: LOADING,
isPullUpStatus: null
}, function () {
_this.translate(_this.pullDownBarHeight, true);
topMethod && topMethod();
});
}
var dom = scrollX ? _this.children : _this.wrap;
if (index >= 0) {
if (scrollX) {
dom.scrollLeft = children[index].offsetLeft;
} else {
console.log(children[index]);
dom.scrollTop = children[index].offsetTop;
}
}
// 等同步任务 完成后再添加 监听事件, 否则写成同步任务会触发 this.scroll
setTimeout(function () {
dom.addEventListener('scroll', _this.scroll);
}, 0);
};
_this.fill = function (once) {
var wrapHeight = _this.state.wrapHeight;
var itemHeight = parseFloat(window.getComputedStyle(_this.children).height);
_this.wrap.style.height = wrapHeight + 'px';
_this.setState({
fillAttr: itemHeight < wrapHeight ? wrapHeight - itemHeight : false
}, function () {
_this.scrollBottom();
// 如果实际子元素的高度小于 定义高度, 而使用者有需要定位到一个 item 的位置,这时候我们就需要在填充完盒子之后在设置滚动, 只对 scrollY有效
once && _this.setTarget();
});
};
_this.scroll = function () {

@@ -204,90 +167,59 @@ var _this$state4 = _this.state,

_this.pullDown = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fn) {
var animateTime, res;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
animateTime = _this.state.animateTime;
_context.next = 3;
return fn();
_this.fill = function (once) {
var wrapHeight = _this.state.wrapHeight;
case 3:
res = _context.sent;
var itemHeight = parseFloat(window.getComputedStyle(_this.children).height);
_this.wrap.style.height = wrapHeight + 'px';
_this.setState({
fillAttr: itemHeight < wrapHeight ? wrapHeight - itemHeight : false
}, function () {
_this.scrollBottom();
// 如果实际子元素的高度小于 定义高度, 而使用者有需要定位到一个 item 的位置,这时候我们就需要在填充完盒子之后在设置滚动, 只对 scrollY有效
once && _this.setTarget();
});
};
if (res) {
console.log('下拉刷新执行结束', res);
// TODO: 点1!!! 埋个坑 当用户下拉刷新结束后 再次滚动界面,我设置 loading 也会随之滚动上去, 当数据更新完后,视图也更新完,我设置不回滚到 scrolltop
// 但当用户停留在 loading 不滚动的时候 就给他来个 动效
_this.wrap.scrollTop === 0 && _this.translate();
setTimeout(function () {
_this.setState({
isPullDownStatus: null
}, function () {
return _this.fill();
});
}, animateTime);
}
_this.setTarget = function () {
var _this$state5 = _this.state,
itemIndex = _this$state5.itemIndex,
itemKey = _this$state5.itemKey,
scrollX = _this$state5.scrollX;
case 5:
case 'end':
return _context.stop();
}
var children = _this.children.children;
var index = void 0;
// 检测下标 || key 值
if (itemIndex) {
index = itemIndex;
} else if (itemKey) {
for (var i = 0; i < _this.children.length; i++) {
console.log('key 值', _this.children[i].key);
if (itemKey === _this.children[i].key) {
index = i;
break;
}
}, _callee, _this2);
}));
}
}
var dom = scrollX ? _this.children : _this.wrap;
if (index >= 0) {
if (scrollX) {
dom.scrollLeft = children[index].offsetLeft;
} else {
console.log(children[index]);
dom.scrollTop = children[index].offsetTop;
}
}
// 等同步任务 完成后再添加 监听事件, 否则写成同步任务会触发 this.scroll
setTimeout(function () {
dom.addEventListener('scroll', _this.scroll);
}, 0);
};
return function (_x) {
return _ref.apply(this, arguments);
};
}();
_this.pullUp = function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fn) {
var animateTime, res;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
animateTime = _this.state.animateTime;
_context2.next = 3;
return fn();
case 3:
res = _context2.sent;
if (res) {
console.log('上拉加载执行结束', res);
_this.translate();
setTimeout(function () {
_this.setState({
isPullUpStatus: null
}, function () {
_this.fill();
});
}, animateTime);
}
case 5:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this2);
}));
return function (_x2) {
return _ref2.apply(this, arguments);
};
}();
_this.translate = function () {
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var _this$state5 = _this.state,
pullThreshold = _this$state5.pullThreshold,
animateTime = _this$state5.animateTime;
var _this$state6 = _this.state,
pullThreshold = _this$state6.pullThreshold,
animateTime = _this$state6.animateTime;
// console.log('移动距离', distance, transition, this.content.style.transform)
console.log('移动距离', distance, transition, _this.content.style.transform);
if (Math.abs(distance) > pullThreshold) return;

@@ -298,18 +230,2 @@ transition ? _this.content.style.transition = 'all ' + animateTime + 'ms ease' : _this.content.style.transition = 'none';

_this.animate = function (target, dom) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : scrollTop;
clearInterval(_this.timer);
console.log('执行 animate');
_this.timer = setInterval(function () {
var step = (target - dom[direction]) / 5;
step = step > 0 ? Math.ceil(step) : Math.floor(step);
dom[direction] += step;
if (Math.abs(target - dom[direction]) <= Math.abs(step)) {
clearInterval(_this.timer);
dom[direction] = target;
}
}, 20);
};
_this.scrollBottom = function () {

@@ -324,6 +240,9 @@ var fillAttr = _this.state.fillAttr;

_this.limit = 4; // touch移动的距离限制 每次移动 1 / limit
_this.limit = props.limit || 4; // touch移动的距离限制 每次移动 1 / limit
_this.state = {
isFetch: props.isFetch || false, // 当页面没有数据的时候,开启 loading 效果,直接触发 topMethod 函数, 默认为 false
isLoadOver: props.isLoadOver, // 请求是否完成,可传字符串 || Boolean, Boolean 为 true 时默认展示字段'全部加载完毕', 传字符串就展示字符串
requestState: props.requestState, // 请求是否完成
isPullDown: props.isPullDown || false, // 是否开启下拉刷新, 默认为 false Boolean
isPullUp: props.isPullUp || true, // 是否开启上拉加载, 默认为 true Boolean
isPullUp: props.isPullUp || false, // 是否开启上拉加载, 默认为 false Boolean
topDistance: props.topDistance || 50, // 下拉刷新 触发 阀值, 默认为 50px Number

@@ -333,5 +252,5 @@ bottomDistance: props.bottomDistance || 50, // 上拉加载 触发 阀值, 默认为 50px Number

isPullUpStatus: null, // 上拉加载状态, 默认为 null String
topMethod: props.topMethod, // 下拉刷新执行方法 必须为 promise
bottomMethod: props.bottomMethod, // 上拉加载执行方法 必须为 promise
wrapHeight: props.wrapHeight || window.screen.height, // 用户传进来的高度, 如果没有则自动撑满全屏, 不写在 style 中的原因是因为我在某些地方需要单独引用这个值,为了我计算方便
topMethod: props.topMethod, // 下拉刷新执行方法
bottomMethod: props.bottomMethod, // 上拉加载执行方法
wrapHeight: props.wrapHeight, // 用户传进来的高度, 如果没有则自动获取 scorllview 父级的高度
pullThreshold: props.pullThreshold || 200, // 上拉和下拉 最高可拉的阀值, 默认200

@@ -342,4 +261,2 @@ scrollX: props.scrollX || false, // 允许横向滚动, 默认为 false Boolean

lowerThreshold: props.lowerThreshold || 50, // 距离底部/右边多远时, 触发 onLower 事件, 默认为 50px Number
// scrollTop: props.scrollTop || 0, // 设置竖向滚动条位置 Number
// scrollLeft: props.scrollLeft || 0, // 设置横向滚动条位置 Number
onUpper: props.onUpper, // 滚动到顶部/左边, 会触发 onUpper 事件 Function

@@ -350,3 +267,3 @@ onLower: props.onLower, // 滚动到底部/右边, 会触发 onLower 事件 Function

itemKey: props.itemKey || false, // 展示第几个内容, 默认 false, 即默认展示, String || Number, 与 itemIndex 只能存在一个
animateTime: props.animateTime || 300 // 设置缓动动画完成时间
animateTime: props.animateTime || 300 // 设置缓动动画完成时间, 默认300 Number
};

@@ -357,10 +274,65 @@ return _this;

ScrollView.prototype.componentDidMount = function componentDidMount() {
if (this.state.scrollX) {
this.setTarget();
} else {
this.wrap.addEventListener('touchstart', this.handleTouchStart);
this.wrap.addEventListener('touchmove', this.handleTouchMove);
this.wrap.addEventListener('touchend', this.handleTouchEnd);
this.fill(true);
var _this2 = this;
var _state = this.state,
wrapHeight = _state.wrapHeight,
scrollX = _state.scrollX;
this.setState({
wrapHeight: wrapHeight ? wrapHeight : parseFloat(window.getComputedStyle(this.wrap.parentNode).height)
}, function () {
if (scrollX) {
_this2.setTarget();
} else {
_this2.wrap.addEventListener('touchstart', _this2.handleTouchStart);
_this2.wrap.addEventListener('touchmove', _this2.handleTouchMove);
_this2.wrap.addEventListener('touchend', _this2.handleTouchEnd);
_this2.fetchData();
_this2.fill(true);
}
});
};
ScrollView.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this3 = this;
var requestState = nextProps.requestState,
isLoadOver = nextProps.isLoadOver;
var _state2 = this.state,
isPullUpStatus = _state2.isPullUpStatus,
isPullDownStatus = _state2.isPullDownStatus,
animateTime = _state2.animateTime;
// console.log('scrollveiw nextProps', nextProps, requestState)
var OO = {
// 上拉加载
pullUp: function pullUp() {
_this3.translate();
setTimeout(function () {
_this3.setState({
isPullUpStatus: null
}, function () {
_this3.fill();
});
}, animateTime);
},
// 下拉刷新
pullDown: function pullDown() {
// TODO: 点1!!! 埋个坑 当用户下拉刷新结束后 再次滚动界面,我设置 loading 也会随之滚动上去, 当数据更新完后,视图也更新完,我设置不回滚到 scrolltop
// 但当用户停留在 loading 不滚动的时候 就给他来个 动效
_this3.wrap.scrollTop === 0 && _this3.translate();
setTimeout(function () {
_this3.setState({
isPullDownStatus: null
}, function () {
return _this3.fill();
});
}, animateTime);
}
};
if (requestState) {
isPullUpStatus && OO.pullUp();
isPullDownStatus && OO.pullDown();
}
this.setState({ isLoadOver: isLoadOver });
};

@@ -377,5 +349,8 @@

// 设置初始目标位置
// 无数据直接触发顶部 loading, 并执行 topMethod函数
// 滚动触发函数
// 自动填充 scrollY 中缺失的部分

@@ -385,13 +360,8 @@ // 在scrollY 打开的情况下, 如果实际的子元素的总高度 小于 使用者定义的高度, 所以这时候我们就需要填充下盒子

// 滚动触发函数
// 设置初始目标位置
// 下拉刷新
// 上拉加载
/**
* 实时 touch 移动
*
*
* @param {number} [distance=0]移动距离,默认为0

@@ -409,4 +379,16 @@ * @param {boolean} [transition=true]是否开启动画效果,默认开启

*/
// animate = (target, dom, direction = scrollTop) => {
// clearInterval(this.timer)
// console.log('执行 animate')
// this.timer = setInterval(() => {
// let step = (target - dom[direction]) / 5
// step = step > 0 ? Math.ceil(step) : Math.floor(step)
// dom[direction] += step
// if (Math.abs(target - dom[direction]) <= Math.abs(step)) {
// clearInterval(this.timer)
// dom[direction] = target
// }
// }, 20)
// }
// 滚动到底部什么位置触发下拉加载

@@ -416,10 +398,11 @@

ScrollView.prototype.render = function render() {
var _this3 = this;
var _this4 = this;
var _state = this.state,
isPullDownStatus = _state.isPullDownStatus,
isPullUpStatus = _state.isPullUpStatus,
fillAttr = _state.fillAttr,
scrollX = _state.scrollX,
translate = _state.translate;
var _state3 = this.state,
isPullDownStatus = _state3.isPullDownStatus,
isPullUpStatus = _state3.isPullUpStatus,
fillAttr = _state3.fillAttr,
scrollX = _state3.scrollX,
translate = _state3.translate,
isLoadOver = _state3.isLoadOver;
var _props = this.props,

@@ -429,2 +412,11 @@ style = _props.style,

var Spinner = function Spinner() {
return React.createElement(
'div',
{ className: 'spinner' },
React.createElement('div', { className: 'bounce1' }),
React.createElement('div', { className: 'bounce2' }),
React.createElement('div', { className: 'bounce3' })
);
};

@@ -434,3 +426,3 @@ return React.createElement(

{ className: 'load-more-root', style: style, ref: function ref(node) {
return _this3.wrap = node;
return _this4.wrap = node;
} },

@@ -440,3 +432,3 @@ React.createElement(

{ className: 'load-more-content', ref: function ref(node) {
return _this3.content = node;
return _this4.content = node;
} },

@@ -446,9 +438,5 @@ !scrollX && isPullDownStatus && !isPullUpStatus && React.createElement(

{ className: 'pull-down-bar', ref: function ref(node) {
node && (_this3.pullDownBarHeight = parseFloat(window.getComputedStyle(node).height));
node && (_this4.pullDownBarHeight = parseFloat(window.getComputedStyle(node).height));
} },
isPullDownStatus === LOADING ? React.createElement(
'div',
null,
'loading'
) : React.createElement(
isPullDownStatus === LOADING ? React.createElement(Spinner, null) : React.createElement(
'span',

@@ -464,4 +452,5 @@ { className: 'is-transition ' + (isPullDownStatus === TOP ? 'is-rotate' : '') },

ref: function ref(node) {
_this3.children = node;
} },
return _this4.children = node;
}
},
children.map(function (item, index) {

@@ -478,16 +467,19 @@ return React.createElement(

),
fillAttr && React.createElement('div', { style: { backgroundColor: 'yellow', height: fillAttr + 'px' } }),
!scrollX && isPullUpStatus && !isPullDownStatus && React.createElement(
isLoadOver && (typeof isLoadOver === 'string' ? React.createElement(
'p',
{ className: 'pull-up-tip' },
isLoadOver
) : React.createElement(
'p',
{ className: 'pull-up-tip' },
'\u52A0\u8F7D\u5B8C\u6BD5'
)),
fillAttr && React.createElement('div', { style: { height: fillAttr + 'px' } }),
!scrollX && !isLoadOver && isPullUpStatus && !isPullDownStatus && React.createElement(
'div',
{ className: 'pull-up-bar', ref: function ref(node) {
if (node) {
_this3.pullUpBarHeight = parseFloat(window.getComputedStyle(node).height);
}
return node && (_this4.pullUpBarHeight = parseFloat(window.getComputedStyle(node).height));
}
},
isPullUpStatus === LOADING ? React.createElement(
'div',
null,
'loading'
) : React.createElement(
isPullUpStatus === LOADING ? React.createElement(Spinner, null) : React.createElement(
'span',

@@ -494,0 +486,0 @@ { className: 'is-transition ' + (isPullUpStatus === BOTTOM ? 'is-rotate' : '') + ' ' },

@@ -9,3 +9,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

import './TabContainer.css';
import { SSL_OP_PKCS1_CHECK_1 } from 'constants';
var LEFT = 'left';

@@ -22,3 +21,3 @@ var RIGHT = 'right';

distance: Number // 移动距离
transition: Boolean // 是否开始 transition 动画
transition: Boolean // 是否开启 transition 动画
}

@@ -45,3 +44,2 @@ */

</TabContainer>
*/

@@ -71,5 +69,5 @@

// right
// event.preventDefault();
event.preventDefault();
// event.stopPropagation();
console.log('右移');
// console.log('右移')
if (_this.index !== 0) {

@@ -81,5 +79,5 @@ _this.translate(distance);

// left
// event.preventDefault();
event.preventDefault();
// event.stopPropagation();
console.log('左移');
// console.log('左移')
if (_this.index !== _this.props.children.length - 1) {

@@ -93,3 +91,3 @@ _this.translate(distance);

_this.slideDirection = DOWN;
console.log('向下');
// console.log('向下')
} else if (Math.abs(Y) > Math.abs(X) && Y < 0) {

@@ -99,3 +97,3 @@ // up

_this.slideDirection = TOP;
console.log('向上');
// console.log('向上')
}

@@ -119,2 +117,3 @@ }

_this.isTranslate = function () {
if (_this.slideDirection === RIGHT || _this.slideDirection === LEFT) {

@@ -159,6 +158,8 @@ var onSel = _this.props.onSel;

var index = nextProps.index;
var onTranslate = this.props.onTranslate;
if (this.index !== index) {
this.index = index;
this.translate(-index * this.itemWidth, true);
onTranslate && onTranslate({ distance: -this.index * this.itemWidth });
this.container.style.transform = 'translateX(' + -index * this.itemWidth + 'px)';
}

@@ -165,0 +166,0 @@ };

@@ -13,6 +13,2 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

// static margin() {
// return this.clientWidth() < 640 ? 0 : (this.clientWidth() - 640) / 2;
// }
Screen.documentElement = function documentElement() {

@@ -143,64 +139,2 @@ 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;

/**
/**
* 选择所在地
* @param onSelected 当选中时的回调,包含两个参数,第一个参数表示选择的区域,第二个参数为向上遍历的区域父节点,举例如下:
* { id: 15, name: "杨浦区" }, [ { id: 2, name: "上海市" }, { id: 1, name: "中国" } ]
* @param onClose 当关闭时的回调,没有参数
* @param options 选项参数,包含以下可选项
* includedIds 数值数组,表示在地区选择列表中可见的地区id集合,举例如下:[ 1, 2, 3, 4, 5 ]
*/
Screen.selectDistrict = function selectDistrict(_onSelected, _onClose2) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { includedIds: undefined };
Screen.app.setState({
districtSelect: {
includedIds: options && options.includedIds && options.includedIds.length > 0 ? options.includedIds : undefined,
onSelected: function onSelected(district, parentDistricts, addressInfo) {
Screen.app.setState({
districtSelect: undefined
});
if (_onSelected) _onSelected(district, parentDistricts, addressInfo);
},
onClose: function onClose() {
Screen.app.setState({
districtSelect: undefined
});
if (_onClose2) _onClose2();
}
}
});
};
/**
* 选择日期
* @param onPicked 选中日期侦听(第一个参数为选中的日期,Date类型)
* @param options 可选参数(date: 默认选中的日期,onClose: 关闭日期选择侦听)
*/
Screen.pickDate = function pickDate(_onPicked) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { date: undefined, onClose: undefined };
Screen.app.setState({
datePick: {
date: options.date,
onPicked: function onPicked(pickedDate) {
Screen.app.setState({
datePick: undefined
});
if (_onPicked) _onPicked(pickedDate);
},
onClose: function onClose() {
Screen.app.setState({
datePick: undefined
});
if (options.onClose) options.onClose();
}
}
});
};
return Screen;

@@ -207,0 +141,0 @@ }();

@@ -17,6 +17,2 @@ 'use strict';

var _whitebg = require('./whitebg.png');
var _whitebg2 = _interopRequireDefault(_whitebg);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -39,2 +35,5 @@

_this.lazyLoad = _this.lazyLoad.bind(_this, props.src);
_this.state = {
isAnimate: false
};
return _this;

@@ -65,3 +64,3 @@ }

if (_Screen2.default.availHeight() + _Screen2.default.scrollTop() > this.img.offsetTop - 100) {
this.img.src = src;
!this.img.src && (this.img.src = src);
}

@@ -73,10 +72,19 @@ };

var isAnimate = this.state.isAnimate;
var props = Object.assign({}, this.props);
props.src = _whitebg2.default;
return _react2.default.createElement(
'div',
{ className: 'LazyLoadImg' },
_react2.default.createElement('img', _extends({}, props, { alt: '', ref: function ref(input) {
_this2.img = input;
} }))
{ className: '' + (isAnimate ? 'LazyLoadImg' : ''), style: { opacity: isAnimate ? 1 : 0 } },
_react2.default.createElement('img', _extends({}, props, {
alt: '',
ref: function ref(node) {
_this2.img = node;
},
onLoad: function onLoad() {
_this2.setState({
isAnimate: true
});
}
}))
);

@@ -83,0 +91,0 @@ };

@@ -25,3 +25,3 @@ 'use strict';

/* 定义:
NavData: 数组
navData: 数组
eg: [{name: '首页', type: 1}, {name: '购物车', type: 2}] 类似于这样的

@@ -32,3 +32,3 @@

ind: 展示第几个 navbar, 默认第一个, 从零开始
index: 展示第几个 navbar, 默认第一个, 从零开始

@@ -51,28 +51,25 @@ TODO: 完成!!!!!

var _this$props = _this.props,
NavData = _this$props.NavData,
navData = _this$props.navData,
children = _this$props.children;
var length = NavData ? NavData.length : children.length;
// console.log('ssss', s)
var length = navData ? navData.length : children.length;
var distance = s.distance,
transition = s.transition;
// 不连写的原因是 防止以后添加其他属性 会覆盖
if (_this.bar) {
// 不连写的原因是 防止以后添加其他属性 会覆盖
transition ? _this.bar.style.transition = 'all 200ms' : _this.bar.style.transition = 'none';
_this.bar.style.transform = 'translateX(' + -distance / length + 'px)';
}
transition ? _this.bar.style.transition = 'all 200ms' : _this.bar.style.transition = 'none';
_this.bar.style.transform = 'translateX(' + -distance / length + 'px)';
};
_this.sel = function (item, index) {
// 防止出现不需要 bar 的情况
_this.bar && (_this.bar.style.transition = 'all 200ms');
var ind = _this.state.ind;
// 函数节流
if (ind === index) return console.warn('函数节流,不可重复点击');
var onSel = _this.props.onSel;
onSel && onSel(item, index);
_this.setState({ ind: index });
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);
});
};

@@ -87,3 +84,2 @@

NavBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
// console.log('Nav_nextProps', nextProps)
var index = nextProps.index,

@@ -93,7 +89,5 @@ translate = nextProps.translate;

if (index >= 0 && index !== ind) {
this.setState({ ind: index });
} else {
translate && this.translateBar(translate);
}
console.log('Nav_nextProps', nextProps, this.props);
translate && this.translateBar(translate);
if (ind !== index) this.setState({ ind: index });
};

@@ -109,7 +103,7 @@

var _props = this.props,
NavData = _props.NavData,
navData = _props.navData,
children = _props.children,
style = _props.style;
var itemWidth = NavData ? window.screen.width / NavData.length : window.screen.width / children.length;
var itemWidth = navData ? window.screen.width / navData.length : window.screen.width / children.length;
// console.log('ind', ind)

@@ -121,3 +115,3 @@ return _react2.default.createElement(

} },
NavData ? NavData.map(function (item, index) {
navData ? navData.map(function (item, index) {
return _react2.default.createElement(

@@ -131,3 +125,4 @@ 'span',

return _this2.sel(item, index);
} },
}
},
item.name

@@ -134,0 +129,0 @@ );

@@ -5,6 +5,2 @@ 'use strict';

var _regenerator = require('babel-runtime/regenerator');
var _regenerator2 = _interopRequireDefault(_regenerator);
var _react = require('react');

@@ -18,4 +14,2 @@

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -38,4 +32,2 @@

function ScrollView(props) {
var _this2 = this;
_classCallCheck(this, ScrollView);

@@ -57,3 +49,4 @@

isPullDownStatus = _this$state.isPullDownStatus,
isPullUpStatus = _this$state.isPullUpStatus;
isPullUpStatus = _this$state.isPullUpStatus,
isLoadOver = _this$state.isLoadOver;

@@ -74,4 +67,4 @@ var scrollTop = _this.wrap.scrollTop;

});
console.log('开启下拉刷新', distance, distance >= topDistance ? TOP : BOTTOM);
} else if (isPullUp && _this.direction === TOUCH_TOP && scrollTop >= _this.bottom && isPullUpStatus !== LOADING && !isPullDownStatus) {
console.log('开启下拉刷新');
} else if (isPullUp && !isLoadOver && _this.direction === TOUCH_TOP && scrollTop >= _this.bottom && isPullUpStatus !== LOADING && !isPullDownStatus) {
event.preventDefault();

@@ -109,3 +102,3 @@ // event.stopPropagation();

_this.translate(_this.pullDownBarHeight);
topMethod && _this.pullDown(topMethod);
topMethod && topMethod();
});

@@ -136,3 +129,3 @@ },

_this.translate(-_this.pullUpBarHeight);
bottomMethod && _this.pullUp(bottomMethod);
bottomMethod && bottomMethod();
});

@@ -145,51 +138,19 @@ }

_this.setTarget = function () {
_this.fetchData = function () {
var _this$state3 = _this.state,
itemIndex = _this$state3.itemIndex,
itemKey = _this$state3.itemKey,
scrollX = _this$state3.scrollX;
isFetch = _this$state3.isFetch,
topMethod = _this$state3.topMethod,
animateTime = _this$state3.animateTime;
var children = _this.children.children;
var index = void 0;
// 检测下标 || key 值
if (itemIndex) {
index = itemIndex;
} else if (itemKey) {
for (var i = 0; i < _this.children.length; i++) {
console.log('key 值', _this.children[i].key);
if (itemKey === _this.children[i].key) {
index = i;
break;
}
}
if (isFetch) {
_this.setState({
isPullDownStatus: LOADING,
isPullUpStatus: null
}, function () {
_this.translate(_this.pullDownBarHeight, true);
topMethod && topMethod();
});
}
var dom = scrollX ? _this.children : _this.wrap;
if (index >= 0) {
if (scrollX) {
dom.scrollLeft = children[index].offsetLeft;
} else {
console.log(children[index]);
dom.scrollTop = children[index].offsetTop;
}
}
// 等同步任务 完成后再添加 监听事件, 否则写成同步任务会触发 this.scroll
setTimeout(function () {
dom.addEventListener('scroll', _this.scroll);
}, 0);
};
_this.fill = function (once) {
var wrapHeight = _this.state.wrapHeight;
var itemHeight = parseFloat(window.getComputedStyle(_this.children).height);
_this.wrap.style.height = wrapHeight + 'px';
_this.setState({
fillAttr: itemHeight < wrapHeight ? wrapHeight - itemHeight : false
}, function () {
_this.scrollBottom();
// 如果实际子元素的高度小于 定义高度, 而使用者有需要定位到一个 item 的位置,这时候我们就需要在填充完盒子之后在设置滚动, 只对 scrollY有效
once && _this.setTarget();
});
};
_this.scroll = function () {

@@ -218,90 +179,59 @@ var _this$state4 = _this.state,

_this.pullDown = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(fn) {
var animateTime, res;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
animateTime = _this.state.animateTime;
_context.next = 3;
return fn();
_this.fill = function (once) {
var wrapHeight = _this.state.wrapHeight;
case 3:
res = _context.sent;
var itemHeight = parseFloat(window.getComputedStyle(_this.children).height);
_this.wrap.style.height = wrapHeight + 'px';
_this.setState({
fillAttr: itemHeight < wrapHeight ? wrapHeight - itemHeight : false
}, function () {
_this.scrollBottom();
// 如果实际子元素的高度小于 定义高度, 而使用者有需要定位到一个 item 的位置,这时候我们就需要在填充完盒子之后在设置滚动, 只对 scrollY有效
once && _this.setTarget();
});
};
if (res) {
console.log('下拉刷新执行结束', res);
// TODO: 点1!!! 埋个坑 当用户下拉刷新结束后 再次滚动界面,我设置 loading 也会随之滚动上去, 当数据更新完后,视图也更新完,我设置不回滚到 scrolltop
// 但当用户停留在 loading 不滚动的时候 就给他来个 动效
_this.wrap.scrollTop === 0 && _this.translate();
setTimeout(function () {
_this.setState({
isPullDownStatus: null
}, function () {
return _this.fill();
});
}, animateTime);
}
_this.setTarget = function () {
var _this$state5 = _this.state,
itemIndex = _this$state5.itemIndex,
itemKey = _this$state5.itemKey,
scrollX = _this$state5.scrollX;
case 5:
case 'end':
return _context.stop();
}
var children = _this.children.children;
var index = void 0;
// 检测下标 || key 值
if (itemIndex) {
index = itemIndex;
} else if (itemKey) {
for (var i = 0; i < _this.children.length; i++) {
console.log('key 值', _this.children[i].key);
if (itemKey === _this.children[i].key) {
index = i;
break;
}
}, _callee, _this2);
}));
}
}
var dom = scrollX ? _this.children : _this.wrap;
if (index >= 0) {
if (scrollX) {
dom.scrollLeft = children[index].offsetLeft;
} else {
console.log(children[index]);
dom.scrollTop = children[index].offsetTop;
}
}
// 等同步任务 完成后再添加 监听事件, 否则写成同步任务会触发 this.scroll
setTimeout(function () {
dom.addEventListener('scroll', _this.scroll);
}, 0);
};
return function (_x) {
return _ref.apply(this, arguments);
};
}();
_this.pullUp = function () {
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(fn) {
var animateTime, res;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
animateTime = _this.state.animateTime;
_context2.next = 3;
return fn();
case 3:
res = _context2.sent;
if (res) {
console.log('上拉加载执行结束', res);
_this.translate();
setTimeout(function () {
_this.setState({
isPullUpStatus: null
}, function () {
_this.fill();
});
}, animateTime);
}
case 5:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this2);
}));
return function (_x2) {
return _ref2.apply(this, arguments);
};
}();
_this.translate = function () {
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var _this$state5 = _this.state,
pullThreshold = _this$state5.pullThreshold,
animateTime = _this$state5.animateTime;
var _this$state6 = _this.state,
pullThreshold = _this$state6.pullThreshold,
animateTime = _this$state6.animateTime;
// console.log('移动距离', distance, transition, this.content.style.transform)
console.log('移动距离', distance, transition, _this.content.style.transform);
if (Math.abs(distance) > pullThreshold) return;

@@ -312,18 +242,2 @@ transition ? _this.content.style.transition = 'all ' + animateTime + 'ms ease' : _this.content.style.transition = 'none';

_this.animate = function (target, dom) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : scrollTop;
clearInterval(_this.timer);
console.log('执行 animate');
_this.timer = setInterval(function () {
var step = (target - dom[direction]) / 5;
step = step > 0 ? Math.ceil(step) : Math.floor(step);
dom[direction] += step;
if (Math.abs(target - dom[direction]) <= Math.abs(step)) {
clearInterval(_this.timer);
dom[direction] = target;
}
}, 20);
};
_this.scrollBottom = function () {

@@ -338,6 +252,9 @@ var fillAttr = _this.state.fillAttr;

_this.limit = 4; // touch移动的距离限制 每次移动 1 / limit
_this.limit = props.limit || 4; // touch移动的距离限制 每次移动 1 / limit
_this.state = {
isFetch: props.isFetch || false, // 当页面没有数据的时候,开启 loading 效果,直接触发 topMethod 函数, 默认为 false
isLoadOver: props.isLoadOver, // 请求是否完成,可传字符串 || Boolean, Boolean 为 true 时默认展示字段'全部加载完毕', 传字符串就展示字符串
requestState: props.requestState, // 请求是否完成
isPullDown: props.isPullDown || false, // 是否开启下拉刷新, 默认为 false Boolean
isPullUp: props.isPullUp || true, // 是否开启上拉加载, 默认为 true Boolean
isPullUp: props.isPullUp || false, // 是否开启上拉加载, 默认为 false Boolean
topDistance: props.topDistance || 50, // 下拉刷新 触发 阀值, 默认为 50px Number

@@ -347,5 +264,5 @@ bottomDistance: props.bottomDistance || 50, // 上拉加载 触发 阀值, 默认为 50px Number

isPullUpStatus: null, // 上拉加载状态, 默认为 null String
topMethod: props.topMethod, // 下拉刷新执行方法 必须为 promise
bottomMethod: props.bottomMethod, // 上拉加载执行方法 必须为 promise
wrapHeight: props.wrapHeight || window.screen.height, // 用户传进来的高度, 如果没有则自动撑满全屏, 不写在 style 中的原因是因为我在某些地方需要单独引用这个值,为了我计算方便
topMethod: props.topMethod, // 下拉刷新执行方法
bottomMethod: props.bottomMethod, // 上拉加载执行方法
wrapHeight: props.wrapHeight, // 用户传进来的高度, 如果没有则自动获取 scorllview 父级的高度
pullThreshold: props.pullThreshold || 200, // 上拉和下拉 最高可拉的阀值, 默认200

@@ -356,4 +273,2 @@ scrollX: props.scrollX || false, // 允许横向滚动, 默认为 false Boolean

lowerThreshold: props.lowerThreshold || 50, // 距离底部/右边多远时, 触发 onLower 事件, 默认为 50px Number
// scrollTop: props.scrollTop || 0, // 设置竖向滚动条位置 Number
// scrollLeft: props.scrollLeft || 0, // 设置横向滚动条位置 Number
onUpper: props.onUpper, // 滚动到顶部/左边, 会触发 onUpper 事件 Function

@@ -364,3 +279,3 @@ onLower: props.onLower, // 滚动到底部/右边, 会触发 onLower 事件 Function

itemKey: props.itemKey || false, // 展示第几个内容, 默认 false, 即默认展示, String || Number, 与 itemIndex 只能存在一个
animateTime: props.animateTime || 300 // 设置缓动动画完成时间
animateTime: props.animateTime || 300 // 设置缓动动画完成时间, 默认300 Number
};

@@ -371,10 +286,65 @@ return _this;

ScrollView.prototype.componentDidMount = function componentDidMount() {
if (this.state.scrollX) {
this.setTarget();
} else {
this.wrap.addEventListener('touchstart', this.handleTouchStart);
this.wrap.addEventListener('touchmove', this.handleTouchMove);
this.wrap.addEventListener('touchend', this.handleTouchEnd);
this.fill(true);
var _this2 = this;
var _state = this.state,
wrapHeight = _state.wrapHeight,
scrollX = _state.scrollX;
this.setState({
wrapHeight: wrapHeight ? wrapHeight : parseFloat(window.getComputedStyle(this.wrap.parentNode).height)
}, function () {
if (scrollX) {
_this2.setTarget();
} else {
_this2.wrap.addEventListener('touchstart', _this2.handleTouchStart);
_this2.wrap.addEventListener('touchmove', _this2.handleTouchMove);
_this2.wrap.addEventListener('touchend', _this2.handleTouchEnd);
_this2.fetchData();
_this2.fill(true);
}
});
};
ScrollView.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this3 = this;
var requestState = nextProps.requestState,
isLoadOver = nextProps.isLoadOver;
var _state2 = this.state,
isPullUpStatus = _state2.isPullUpStatus,
isPullDownStatus = _state2.isPullDownStatus,
animateTime = _state2.animateTime;
// console.log('scrollveiw nextProps', nextProps, requestState)
var OO = {
// 上拉加载
pullUp: function pullUp() {
_this3.translate();
setTimeout(function () {
_this3.setState({
isPullUpStatus: null
}, function () {
_this3.fill();
});
}, animateTime);
},
// 下拉刷新
pullDown: function pullDown() {
// TODO: 点1!!! 埋个坑 当用户下拉刷新结束后 再次滚动界面,我设置 loading 也会随之滚动上去, 当数据更新完后,视图也更新完,我设置不回滚到 scrolltop
// 但当用户停留在 loading 不滚动的时候 就给他来个 动效
_this3.wrap.scrollTop === 0 && _this3.translate();
setTimeout(function () {
_this3.setState({
isPullDownStatus: null
}, function () {
return _this3.fill();
});
}, animateTime);
}
};
if (requestState) {
isPullUpStatus && OO.pullUp();
isPullDownStatus && OO.pullDown();
}
this.setState({ isLoadOver: isLoadOver });
};

@@ -391,5 +361,8 @@

// 设置初始目标位置
// 无数据直接触发顶部 loading, 并执行 topMethod函数
// 滚动触发函数
// 自动填充 scrollY 中缺失的部分

@@ -399,13 +372,8 @@ // 在scrollY 打开的情况下, 如果实际的子元素的总高度 小于 使用者定义的高度, 所以这时候我们就需要填充下盒子

// 滚动触发函数
// 设置初始目标位置
// 下拉刷新
// 上拉加载
/**
* 实时 touch 移动
*
*
* @param {number} [distance=0]移动距离,默认为0

@@ -423,4 +391,16 @@ * @param {boolean} [transition=true]是否开启动画效果,默认开启

*/
// animate = (target, dom, direction = scrollTop) => {
// clearInterval(this.timer)
// console.log('执行 animate')
// this.timer = setInterval(() => {
// let step = (target - dom[direction]) / 5
// step = step > 0 ? Math.ceil(step) : Math.floor(step)
// dom[direction] += step
// if (Math.abs(target - dom[direction]) <= Math.abs(step)) {
// clearInterval(this.timer)
// dom[direction] = target
// }
// }, 20)
// }
// 滚动到底部什么位置触发下拉加载

@@ -430,10 +410,11 @@

ScrollView.prototype.render = function render() {
var _this3 = this;
var _this4 = this;
var _state = this.state,
isPullDownStatus = _state.isPullDownStatus,
isPullUpStatus = _state.isPullUpStatus,
fillAttr = _state.fillAttr,
scrollX = _state.scrollX,
translate = _state.translate;
var _state3 = this.state,
isPullDownStatus = _state3.isPullDownStatus,
isPullUpStatus = _state3.isPullUpStatus,
fillAttr = _state3.fillAttr,
scrollX = _state3.scrollX,
translate = _state3.translate,
isLoadOver = _state3.isLoadOver;
var _props = this.props,

@@ -443,2 +424,11 @@ style = _props.style,

var Spinner = function Spinner() {
return _react2.default.createElement(
'div',
{ className: 'spinner' },
_react2.default.createElement('div', { className: 'bounce1' }),
_react2.default.createElement('div', { className: 'bounce2' }),
_react2.default.createElement('div', { className: 'bounce3' })
);
};

@@ -448,3 +438,3 @@ return _react2.default.createElement(

{ className: 'load-more-root', style: style, ref: function ref(node) {
return _this3.wrap = node;
return _this4.wrap = node;
} },

@@ -454,3 +444,3 @@ _react2.default.createElement(

{ className: 'load-more-content', ref: function ref(node) {
return _this3.content = node;
return _this4.content = node;
} },

@@ -460,9 +450,5 @@ !scrollX && isPullDownStatus && !isPullUpStatus && _react2.default.createElement(

{ className: 'pull-down-bar', ref: function ref(node) {
node && (_this3.pullDownBarHeight = parseFloat(window.getComputedStyle(node).height));
node && (_this4.pullDownBarHeight = parseFloat(window.getComputedStyle(node).height));
} },
isPullDownStatus === LOADING ? _react2.default.createElement(
'div',
null,
'loading'
) : _react2.default.createElement(
isPullDownStatus === LOADING ? _react2.default.createElement(Spinner, null) : _react2.default.createElement(
'span',

@@ -478,4 +464,5 @@ { className: 'is-transition ' + (isPullDownStatus === TOP ? 'is-rotate' : '') },

ref: function ref(node) {
_this3.children = node;
} },
return _this4.children = node;
}
},
children.map(function (item, index) {

@@ -492,16 +479,19 @@ return _react2.default.createElement(

),
fillAttr && _react2.default.createElement('div', { style: { backgroundColor: 'yellow', height: fillAttr + 'px' } }),
!scrollX && isPullUpStatus && !isPullDownStatus && _react2.default.createElement(
isLoadOver && (typeof isLoadOver === 'string' ? _react2.default.createElement(
'p',
{ className: 'pull-up-tip' },
isLoadOver
) : _react2.default.createElement(
'p',
{ className: 'pull-up-tip' },
'\u52A0\u8F7D\u5B8C\u6BD5'
)),
fillAttr && _react2.default.createElement('div', { style: { height: fillAttr + 'px' } }),
!scrollX && !isLoadOver && isPullUpStatus && !isPullDownStatus && _react2.default.createElement(
'div',
{ className: 'pull-up-bar', ref: function ref(node) {
if (node) {
_this3.pullUpBarHeight = parseFloat(window.getComputedStyle(node).height);
}
return node && (_this4.pullUpBarHeight = parseFloat(window.getComputedStyle(node).height));
}
},
isPullUpStatus === LOADING ? _react2.default.createElement(
'div',
null,
'loading'
) : _react2.default.createElement(
isPullUpStatus === LOADING ? _react2.default.createElement(Spinner, null) : _react2.default.createElement(
'span',

@@ -508,0 +498,0 @@ { className: 'is-transition ' + (isPullUpStatus === BOTTOM ? 'is-rotate' : '') + ' ' },

@@ -11,4 +11,2 @@ 'use strict';

var _constants = require('constants');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -33,3 +31,3 @@

distance: Number // 移动距离
transition: Boolean // 是否开始 transition 动画
transition: Boolean // 是否开启 transition 动画
}

@@ -56,3 +54,2 @@ */

</TabContainer>
*/

@@ -82,5 +79,5 @@

// right
// event.preventDefault();
event.preventDefault();
// event.stopPropagation();
console.log('右移');
// console.log('右移')
if (_this.index !== 0) {

@@ -92,5 +89,5 @@ _this.translate(distance);

// left
// event.preventDefault();
event.preventDefault();
// event.stopPropagation();
console.log('左移');
// console.log('左移')
if (_this.index !== _this.props.children.length - 1) {

@@ -104,3 +101,3 @@ _this.translate(distance);

_this.slideDirection = DOWN;
console.log('向下');
// console.log('向下')
} else if (Math.abs(Y) > Math.abs(X) && Y < 0) {

@@ -110,3 +107,3 @@ // up

_this.slideDirection = TOP;
console.log('向上');
// console.log('向上')
}

@@ -130,2 +127,3 @@ }

_this.isTranslate = function () {
if (_this.slideDirection === RIGHT || _this.slideDirection === LEFT) {

@@ -170,6 +168,8 @@ var onSel = _this.props.onSel;

var index = nextProps.index;
var onTranslate = this.props.onTranslate;
if (this.index !== index) {
this.index = index;
this.translate(-index * this.itemWidth, true);
onTranslate && onTranslate({ distance: -this.index * this.itemWidth });
this.container.style.transform = 'translateX(' + -index * this.itemWidth + 'px)';
}

@@ -176,0 +176,0 @@ };

@@ -17,6 +17,2 @@ 'use strict';

// static margin() {
// return this.clientWidth() < 640 ? 0 : (this.clientWidth() - 640) / 2;
// }
Screen.documentElement = function documentElement() {

@@ -147,64 +143,2 @@ 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;

/**
/**
* 选择所在地
* @param onSelected 当选中时的回调,包含两个参数,第一个参数表示选择的区域,第二个参数为向上遍历的区域父节点,举例如下:
* { id: 15, name: "杨浦区" }, [ { id: 2, name: "上海市" }, { id: 1, name: "中国" } ]
* @param onClose 当关闭时的回调,没有参数
* @param options 选项参数,包含以下可选项
* includedIds 数值数组,表示在地区选择列表中可见的地区id集合,举例如下:[ 1, 2, 3, 4, 5 ]
*/
Screen.selectDistrict = function selectDistrict(_onSelected, _onClose2) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { includedIds: undefined };
Screen.app.setState({
districtSelect: {
includedIds: options && options.includedIds && options.includedIds.length > 0 ? options.includedIds : undefined,
onSelected: function onSelected(district, parentDistricts, addressInfo) {
Screen.app.setState({
districtSelect: undefined
});
if (_onSelected) _onSelected(district, parentDistricts, addressInfo);
},
onClose: function onClose() {
Screen.app.setState({
districtSelect: undefined
});
if (_onClose2) _onClose2();
}
}
});
};
/**
* 选择日期
* @param onPicked 选中日期侦听(第一个参数为选中的日期,Date类型)
* @param options 可选参数(date: 默认选中的日期,onClose: 关闭日期选择侦听)
*/
Screen.pickDate = function pickDate(_onPicked) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { date: undefined, onClose: undefined };
Screen.app.setState({
datePick: {
date: options.date,
onPicked: function onPicked(pickedDate) {
Screen.app.setState({
datePick: undefined
});
if (_onPicked) _onPicked(pickedDate);
},
onClose: function onClose() {
Screen.app.setState({
datePick: undefined
});
if (options.onClose) options.onClose();
}
}
});
};
return Screen;

@@ -211,0 +145,0 @@ }();

{
"name": "bestnihon-react-components",
"version": "1.0.4",
"version": "1.0.5",
"description": "bestnihon-react-components React component",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

/*!
* bestnihon-react-components v1.0.3
* bestnihon-react-components v1.0.5
* MIT Licensed
*/
!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(8);n.d(e,"TabContainerItem",function(){return i.a});var a=n(10);n.d(e,"ScrollView",function(){return a.a});var l=n(15);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&&(o.bar.style.transition=l?"all 200ms":"none",o.bar.style.transform="translateX("+-a/i+"px)")},o.sel=function(t,e){if(o.bar&&(o.bar.style.transition="all 200ms"),o.state.ind===e)return console.warn("函数节流,不可重复点击");var n=o.props.onSel;n&&n(t,e),o.setState({ind: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;e>=0&&e!==o?this.setState({ind:e}):n&&this.translateBar(n)},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,c=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:c+"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:c+"px"},className:"Nav-item",onClick:function(){return t.sel(e,n)}},e)}),r.a.createElement("div",{className:"Nav-active",style:{width:c+"px",transform:"translatex("+n*c+"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),a=(n.n(i),n(7));n.n(a);var l="left",c="right",s="top",u="down",h=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,a=r-o.itemWidth*o.index;if(!o.slideDirection||o.slideDirection===c||o.slideDirection===l)if(Math.abs(r)>Math.abs(i)&&r>0)console.log("右移"),0!==o.index&&o.translate(a),o.slideDirection=c;else if(Math.abs(r)>Math.abs(i)&&r<0)console.log("左移"),o.index!==o.props.children.length-1&&o.translate(a),o.slideDirection=l;else if(Math.abs(i)>Math.abs(r)&&i>0){if(o.slideDirection)return;o.slideDirection=u,console.log("向下")}else if(Math.abs(i)>Math.abs(r)&&i<0){if(o.slideDirection)return;o.slideDirection=s,console.log("向上")}},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===c||o.slideDirection===l){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;this.index!==e&&(this.index=e,this.translate(-e*this.itemWidth,!0))},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=h},function(t,e){},function(t,e){t.exports={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:1048576,O_NOFOLLOW:256,O_SYNC:128,O_SYMLINK:2097152,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGSYS:12,SSL_OP_ALL:2147486719,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:32,SSL_OP_MICROSOFT_SESS_ID_BUG:1,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:536870912,SSL_OP_NETSCAPE_CHALLENGE_BUG:2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:1073741824,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:8,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:16777216,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:1048576,SSL_OP_SINGLE_ECDH_USE:524288,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:128,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:512,SSL_OP_TLS_D5_BUG:256,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_ECDH:16,ENGINE_METHOD_ECDSA:32,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_STORE:256,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_UDP_REUSEADDR:4}},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(9),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(11),r=n.n(o),i=n(0),a=n.n(i),l=n(14);n.n(l);function c(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){return function o(r,i){try{var a=e[r](i),l=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(l).then(function(t){o("next",t)},function(t){o("throw",t)});t(l)}("next")})}}var s="top",u="bottom",h="loading",f="touch_top",p="touch_bottom",d=function(t){function e(n){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i,a,l=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 l.handleTouchStart=function(t){console.log("触摸开始",l.wrap.scrollTop),l.startY=t.touches[0].clientY},l.handleTouchMove=function(t){var e=l.state,n=e.isPullDown,o=e.isPullUp,r=e.topDistance,i=e.bottomDistance,a=e.isPullDownStatus,c=e.isPullUpStatus,d=l.wrap.scrollTop,E=t.touches[0].clientY,S=void 0;l.direction=E-l.startY>0?p:f,console.log("滚动距离==>"+d,"上拉加载距离==>"+l.bottom),n&&l.direction===p&&0===d&&a!==h&&!c?(event.preventDefault(),l.pullDownBarStartY=l.pullDownBarStartY?l.pullDownBarStartY:t.touches[0].clientY,S=(E-l.pullDownBarStartY)/l.limit,l.translate(S,!1),l.setState({isPullDownStatus:S>=r?s:u}),console.log("开启下拉刷新",S,S>=r?s:u)):o&&l.direction===f&&d>=l.bottom&&c!==h&&!a&&(event.preventDefault(),l.pullUpBarStartY=l.pullUpBarStartY?l.pullUpBarStartY:t.touches[0].clientY,S=(E-l.pullUpBarStartY)/l.limit,l.translate(S,!1),l.setState({isPullUpStatus:Math.abs(S)>=i?u:s}),console.log("开启上拉加载"))},l.handleTouchEnd=function(t){var e=l.state,n=e.isPullDownStatus,o=e.isPullUpStatus,r=e.topMethod,i=e.bottomMethod,a=e.animateTime;l.pullDownBarStartY=null,l.pullUpBarStartY=null,console.log("触摸结束",n,o);var c={top:function(){l.translate(),setTimeout(function(){l.setState({isPullUpStatus:null})},a)},bottom:function(){l.setState({isPullUpStatus:h},function(){l.translate(-l.pullUpBarHeight),i&&l.pullUp(i)})}};n&&{top:function(){l.setState({isPullDownStatus:h},function(){l.translate(l.pullDownBarHeight),r&&l.pullDown(r)})},bottom:function(){l.translate(),setTimeout(function(){l.setState({isPullDownStatus:null})},a)}}[n](),o&&c[o]()},l.setTarget=function(){var t=l.state,e=t.itemIndex,n=t.itemKey,o=t.scrollX,r=l.children.children,i=void 0;if(e)i=e;else if(n)for(var a=0;a<l.children.length;a++)if(console.log("key 值",l.children[a].key),n===l.children[a].key){i=a;break}var c=o?l.children:l.wrap;i>=0&&(o?c.scrollLeft=r[i].offsetLeft:(console.log(r[i]),c.scrollTop=r[i].offsetTop)),setTimeout(function(){c.addEventListener("scroll",l.scroll)},0)},l.fill=function(t){var e=l.state.wrapHeight,n=parseFloat(window.getComputedStyle(l.children).height);l.wrap.style.height=e+"px",l.setState({fillAttr:n<e&&e-n},function(){l.scrollBottom(),t&&l.setTarget()})},l.scroll=function(){var t=l.state,e=t.onLower,n=t.onUpper,o=t.onScroll,r=t.scrollX,i=t.upperThreshold,a=t.lowerThreshold,c=r?"scrollLeft":"scrollTop",s=r?l.children:l.wrap,u=s[c],h=r?parseFloat(window.getComputedStyle(s,null).width):parseFloat(window.getComputedStyle(s,null).height),f=r?s.scrollWidth-h:s.scrollHeight-h;o&&o({scroll:u}),u<=i?n&&n():u>=f-a&&e&&e()},l.pullDown=(i=c(r.a.mark(function t(e){var n,i;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=l.state.animateTime,t.next=3,e();case 3:(i=t.sent)&&(console.log("下拉刷新执行结束",i),0===l.wrap.scrollTop&&l.translate(),setTimeout(function(){l.setState({isPullDownStatus:null},function(){return l.fill()})},n));case 5:case"end":return t.stop()}},t,o)})),function(t){return i.apply(this,arguments)}),l.pullUp=(a=c(r.a.mark(function t(e){var n,i;return r.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=l.state.animateTime,t.next=3,e();case 3:(i=t.sent)&&(console.log("上拉加载执行结束",i),l.translate(),setTimeout(function(){l.setState({isPullUpStatus:null},function(){l.fill()})},n));case 5:case"end":return t.stop()}},t,o)})),function(t){return a.apply(this,arguments)}),l.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=l.state,o=n.pullThreshold,r=n.animateTime;console.log("移动距离",t,e,l.content.style.transform),Math.abs(t)>o||(l.content.style.transition=e?"all "+r+"ms ease":"none",l.content.style.transform="translate3d(0, "+t+"px,0)")},l.animate=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:scrollTop;clearInterval(l.timer),console.log("执行 animate"),l.timer=setInterval(function(){var o=(t-e[n])/5;o=o>0?Math.ceil(o):Math.floor(o),e[n]+=o,Math.abs(t-e[n])<=Math.abs(o)&&(clearInterval(l.timer),e[n]=t)},20)},l.scrollBottom=function(){var t=l.state.fillAttr,e=l.children.scrollHeight,n=parseFloat(window.getComputedStyle(l.wrap).height);l.bottom=t?0:e-n},l.limit=4,l.state={isPullDown:n.isPullDown||!1,isPullUp:n.isPullUp||!0,topDistance:n.topDistance||50,bottomDistance:n.bottomDistance||50,isPullDownStatus:null,isPullUpStatus:null,topMethod:n.topMethod,bottomMethod:n.bottomMethod,wrapHeight:n.wrapHeight||window.screen.height,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},l}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.state.scrollX?this.setTarget():(this.wrap.addEventListener("touchstart",this.handleTouchStart),this.wrap.addEventListener("touchmove",this.handleTouchMove),this.wrap.addEventListener("touchend",this.handleTouchEnd),this.fill(!0))},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,i=e.scrollX,l=(e.translate,this.props),c=l.style,f=l.children;return a.a.createElement("div",{className:"load-more-root",style:c,ref:function(e){return t.wrap=e}},a.a.createElement("div",{className:"load-more-content",ref:function(e){return t.content=e}},!i&&n&&!o&&a.a.createElement("div",{className:"pull-down-bar",ref:function(e){e&&(t.pullDownBarHeight=parseFloat(window.getComputedStyle(e).height))}},n===h?a.a.createElement("div",null,"loading"):a.a.createElement("span",{className:"is-transition "+(n===s?"is-rotate":"")},"↓")),a.a.createElement("div",{className:"scroll-view-root "+(i?"scroll-view-x":"scroll-view-y")+" ",ref:function(e){t.children=e}},f.map(function(t,e){return a.a.createElement("div",{key:"children"+e,className:i?"scroll-x-item":"scroll-y-item"},t)})),r&&a.a.createElement("div",{style:{backgroundColor:"yellow",height:r+"px"}}),!i&&o&&!n&&a.a.createElement("div",{className:"pull-up-bar",ref:function(e){e&&(t.pullUpBarHeight=parseFloat(window.getComputedStyle(e).height))}},o===h?a.a.createElement("div",null,"loading"):a.a.createElement("span",{className:"is-transition "+(o===u?"is-rotate":"")+" "},"↑"))))},e}(i.Component);e.a=d},function(t,e,n){t.exports=n(12)},function(t,e,n){var o=function(){return this}()||Function("return this")(),r=o.regeneratorRuntime&&Object.getOwnPropertyNames(o).indexOf("regeneratorRuntime")>=0,i=r&&o.regeneratorRuntime;if(o.regeneratorRuntime=void 0,t.exports=n(13),r)o.regeneratorRuntime=i;else try{delete o.regeneratorRuntime}catch(t){o.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";var n,o=Object.prototype,r=o.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag",s="object"==typeof t,u=e.regeneratorRuntime;if(u)s&&(t.exports=u);else{(u=e.regeneratorRuntime=s?t.exports:{}).wrap=v;var h="suspendedStart",f="suspendedYield",p="executing",d="completed",E={},S={};S[a]=function(){return this};var m=Object.getPrototypeOf,_=m&&m(m(R([])));_&&_!==o&&r.call(_,a)&&(S=_);var O=w.prototype=T.prototype=Object.create(S);N.prototype=O.constructor=w,w.constructor=N,w[c]=N.displayName="GeneratorFunction",u.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===N||"GeneratorFunction"===(e.displayName||e.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(O),t},u.awrap=function(t){return{__await:t}},g(P.prototype),P.prototype[l]=function(){return this},u.AsyncIterator=P,u.async=function(t,e,n,o){var r=new P(v(t,e,n,o));return u.isGeneratorFunction(e)?r:r.next().then(function(t){return t.done?t.value:r.next()})},g(O),O[c]="Generator",O[a]=function(){return this},O.toString=function(){return"[object Generator]"},u.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var o=e.pop();if(o in t)return n.value=o,n.done=!1,n}return n.done=!0,n}},u.values=R,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(o,r){return l.type="throw",l.arg=t,e.next=o,r&&(e.method="next",e.arg=n),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],l=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),s=r.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),b(n),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var o=n.completion;if("throw"===o.type){var r=o.arg;b(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,o){return this.delegate={iterator:R(t),resultName:e,nextLoc:o},"next"===this.method&&(this.arg=n),E}}}function v(t,e,n,o){var r=e&&e.prototype instanceof T?e:T,i=Object.create(r.prototype),a=new D(o||[]);return i._invoke=function(t,e,n){var o=h;return function(r,i){if(o===p)throw new Error("Generator is already running");if(o===d){if("throw"===r)throw i;return C()}for(n.method=r,n.arg=i;;){var a=n.delegate;if(a){var l=I(a,n);if(l){if(l===E)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=y(t,e,n);if("normal"===c.type){if(o=n.done?d:f,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=d,n.method="throw",n.arg=c.arg)}}}(t,n,a),i}function y(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function T(){}function N(){}function w(){}function g(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function P(t){var e;this._invoke=function(n,o){function i(){return new Promise(function(e,i){!function e(n,o,i,a){var l=y(t[n],t,o);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"==typeof s&&r.call(s,"__await")?Promise.resolve(s.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(s).then(function(t){c.value=t,i(c)},a)}a(l.arg)}(n,o,e,i)})}return e=e?e.then(i,i):i()}}function I(t,e){var o=t.iterator[e.method];if(o===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,I(t,e),"throw"===e.method))return E;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return E}var r=y(o,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,E;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,E):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,E)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function R(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function e(){for(;++o<t.length;)if(r.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=n,e.done=!0,e};return i.next=i}}return{next:C}}function C(){return{value:n,done:!0}}}(function(){return this}()||Function("return this")())},function(t,e){},function(t,e,n){"use strict";var o=n(0),r=n.n(o),i=n(16),a=n(17),l=(n.n(a),n(18)),c=n.n(l),s=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 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.lazyLoad=o.lazyLoad.bind(o,n.src),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=t)},e.prototype.render=function(){var t=this,e=Object.assign({},this.props);return e.src=c.a,r.a.createElement("div",{className:"LazyLoadImg"},r.a.createElement("img",s({},e,{alt:"",ref:function(e){t.img=e}})))},e}(o.Component);e.a=u},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.selectDistrict=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{includedIds:void 0};t.app.setState({districtSelect:{includedIds:o&&o.includedIds&&o.includedIds.length>0?o.includedIds:void 0,onSelected:function(n,o,r){t.app.setState({districtSelect:void 0}),e&&e(n,o,r)},onClose:function(){t.app.setState({districtSelect:void 0}),n&&n()}}})},t.pickDate=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{date:void 0,onClose:void 0};t.app.setState({datePick:{date:n.date,onPicked:function(n){t.app.setState({datePick:void 0}),e&&e(n)},onClose:function(){t.app.setState({datePick:void 0}),n.onClose&&n.onClose()}}})},t}();e.a=o},function(t,e){},function(t,e,n){t.exports=n.p+"whitebg.61622362.png"}]).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 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});
//# sourceMappingURL=bestnihon-react-components.min.js.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc