nuke-refresh-control
Advanced tools
Comparing version 2.0.5 to 2.1.1-3
@@ -1,61 +0,1 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _rax = require('rax'); | ||
var _nukeEnv = require('nuke-env'); | ||
var _nukeEnv2 = _interopRequireDefault(_nukeEnv); | ||
var _nukeView = require('nuke-view'); | ||
var _nukeView2 = _interopRequireDefault(_nukeView); | ||
var _web = require('./view/web'); | ||
var _web2 = _interopRequireDefault(_web); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* @jsx createElement */ | ||
var isWeex = _nukeEnv2.default.isWeex; | ||
var RefreshControl = function (_Component) { | ||
_inherits(RefreshControl, _Component); | ||
function RefreshControl() { | ||
_classCallCheck(this, RefreshControl); | ||
return _possibleConstructorReturn(this, (RefreshControl.__proto__ || Object.getPrototypeOf(RefreshControl)).apply(this, arguments)); | ||
} | ||
_createClass(RefreshControl, [{ | ||
key: 'render', | ||
value: function render() { | ||
if (isWeex) { | ||
var displayRefresh = this.props.refreshing ? 'show' : 'hide'; | ||
return (0, _rax.createElement)('refresh', _extends({}, this.props, { display: displayRefresh })); | ||
} | ||
return (0, _rax.createElement)(_web2.default, this.props); | ||
} | ||
}]); | ||
return RefreshControl; | ||
}(_rax.Component); | ||
RefreshControl.displayName = 'RefreshControl'; | ||
exports.default = RefreshControl; | ||
module.exports = exports['default']; | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _extends=Object.assign||function(target){for(var source,i=1;i<arguments.length;i++)for(var key in source=arguments[i],source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key]);return target},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_rax=require('rax'),_nukeEnv=require('nuke-env'),_nukeEnv2=_interopRequireDefault(_nukeEnv),_nukeView=require('nuke-view'),_nukeView2=_interopRequireDefault(_nukeView),_web=require('./view/web'),_web2=_interopRequireDefault(_web);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var isWeex=_nukeEnv2.default.isWeex,RefreshControl=function(_Component){function RefreshControl(){return _classCallCheck(this,RefreshControl),_possibleConstructorReturn(this,(RefreshControl.__proto__||Object.getPrototypeOf(RefreshControl)).apply(this,arguments))}return _inherits(RefreshControl,_Component),_createClass(RefreshControl,[{key:'render',value:function render(){if(isWeex){var displayRefresh=this.props.refreshing?'show':'hide';return(0,_rax.createElement)('refresh',_extends({},this.props,{display:displayRefresh}))}return(0,_rax.createElement)(_web2.default,this.props)}}]),RefreshControl}(_rax.Component);RefreshControl.displayName='RefreshControl',exports.default=RefreshControl,module.exports=exports['default']; |
@@ -1,14 +0,1 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = function (styleString) { | ||
var style = document.createElement('style'); | ||
style.type = 'text/css'; | ||
style.innerHTML = styleString; | ||
document.getElementsByTagName('head')[0].appendChild(style); | ||
}; | ||
module.exports = exports['default']; | ||
'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.default=function(styleString){var style=document.createElement('style');style.type='text/css',style.innerHTML=styleString,document.getElementsByTagName('head')[0].appendChild(style)},module.exports=exports['default']; |
{ | ||
"name": "nuke-refresh-control", | ||
"version": "2.0.5", | ||
"version": "2.1.1-3", | ||
"description": "下拉刷新组件", | ||
@@ -38,9 +38,2 @@ "main": "lib/index", | ||
}, | ||
"scripts": { | ||
"dev": "nuke-bin server", | ||
"build": "nuke-bin build", | ||
"prepublish": "nuke-bin build", | ||
"test": "nuke-bin test", | ||
"lint": "eslint '@(src|docs)/**/*.@(js|jsx|md)' || true" | ||
}, | ||
"repository": { | ||
@@ -51,8 +44,8 @@ "type": "git", | ||
"dependencies": { | ||
"nuke-view": "^2.x.x", | ||
"nuke-env": "^2.x.x" | ||
"nuke-env": "^2.1.1-3", | ||
"nuke-view": "^2.1.1-3" | ||
}, | ||
"devDependencies": { | ||
"nuke-text": "^2.x.x", | ||
"nuke-scroll-view": "^2.x.x" | ||
"nuke-scroll-view": "^2.1.1-3", | ||
"nuke-text": "^2.1.1-3" | ||
}, | ||
@@ -62,3 +55,4 @@ "publishConfig": { | ||
}, | ||
"license": "Apache" | ||
"license": "Apache", | ||
"gitHead": "1f7b1551e5d262305859ef4a185eb6d4743fa0aa" | ||
} |
@@ -8,3 +8,3 @@ /** @jsx createElement */ | ||
setNativeProps, | ||
PropTypes | ||
PropTypes, | ||
} from 'rax'; | ||
@@ -20,3 +20,3 @@ import { isWeb } from 'nuke-env'; | ||
overflow: 'hidden', | ||
height: 0 | ||
height: 0, | ||
}; | ||
@@ -38,4 +38,4 @@ const FULL_WIDTH = 750; | ||
setStyle(styleData) { | ||
var elementStyle = this.findDom().style; | ||
for (var styleName in styleData) { | ||
const elementStyle = this.findDom().style; | ||
for (const styleName in styleData) { | ||
elementStyle[styleName] = styleData[styleName]; | ||
@@ -64,3 +64,3 @@ } | ||
this.setStyle({ | ||
height: `${Math.floor(this.move / 3)}px` | ||
height: `${Math.floor(this.move / 3)}px`, | ||
}); | ||
@@ -73,3 +73,3 @@ }; | ||
this.addAnim(); | ||
let list = findDOMNode(this.props.listId); | ||
const list = findDOMNode(this.props.listId); | ||
this.props.onRefresh && this.props.onRefresh(); | ||
@@ -79,3 +79,3 @@ } else { | ||
this.setStyle({ | ||
height: '0px' | ||
height: '0px', | ||
}); | ||
@@ -92,23 +92,23 @@ } | ||
const { animationTime: animTime } = this.props; | ||
let animStr = `0% {height: ${this.height}px} 40% {height: ${ | ||
const animStr = `0% {height: ${this.height}px} 40% {height: ${ | ||
this.height | ||
}px} 100% {height: 0px}`; | ||
let strHTML = | ||
'.refreshAnim { animation:runWebRefresh ' + | ||
animTime + | ||
's; -moz-animation:runWebRefresh ' + | ||
animTime + | ||
's; -webkit-animation:runWebRefresh ' + | ||
animTime + | ||
's; -o-animation:runWebRefresh ' + | ||
animTime + | ||
's; } @keyframes runWebRefresh {' + | ||
animStr + | ||
'} @-moz-keyframes runWebRefresh {' + | ||
animStr + | ||
'} @-webkit-keyframes runWebRefresh {' + | ||
animStr + | ||
'} @-o-keyframes runWebRefresh {' + | ||
animStr + | ||
'}'; | ||
const strHTML = | ||
`.refreshAnim { animation:runWebRefresh ${ | ||
animTime | ||
}s; -moz-animation:runWebRefresh ${ | ||
animTime | ||
}s; -webkit-animation:runWebRefresh ${ | ||
animTime | ||
}s; -o-animation:runWebRefresh ${ | ||
animTime | ||
}s; } @keyframes runWebRefresh {${ | ||
animStr | ||
}} @-moz-keyframes runWebRefresh {${ | ||
animStr | ||
}} @-webkit-keyframes runWebRefresh {${ | ||
animStr | ||
}} @-o-keyframes runWebRefresh {${ | ||
animStr | ||
}}`; | ||
addStyle(strHTML); | ||
@@ -118,9 +118,9 @@ }; | ||
setListEvent = () => { | ||
let listId = this.props.listId; | ||
const listId = this.props.listId; | ||
// 绑定下拉刷新事件 | ||
setTimeout(() => { | ||
let list = findDOMNode(listId); | ||
const list = findDOMNode(listId); | ||
list.addEventListener( | ||
'touchstart', | ||
e => { | ||
(e) => { | ||
this.startY = e.changedTouches[0].pageY; | ||
@@ -132,3 +132,3 @@ }, | ||
'touchmove', | ||
e => { | ||
(e) => { | ||
this.moveY = e.changedTouches[0].pageY; | ||
@@ -147,3 +147,3 @@ if (list.scrollTop == 0) { | ||
'touchend', | ||
e => { | ||
(e) => { | ||
this.endY = e.changedTouches[0].pageY; | ||
@@ -188,3 +188,3 @@ if (list.scrollTop == 0 && this.startY < this.endY) { | ||
isRefreshing: PropTypes.boolean, | ||
onRefresh: PropTypes.func | ||
onRefresh: PropTypes.func, | ||
}; | ||
@@ -194,3 +194,3 @@ RefreshControl.defaultProps = { | ||
style: {} | ||
style: {}, | ||
}; | ||
@@ -197,0 +197,0 @@ |
/** @jsx createElement */ | ||
import {createElement, Component,render} from 'rax'; | ||
import { createElement, Component, render } from 'rax'; | ||
import Text from 'nuke-text'; | ||
let App = class NukeDemoIndex extends Component { | ||
constructor() { | ||
super(); | ||
} | ||
render() { | ||
return ( | ||
<Text>本 demo 无法独立展示,请查看 ScrollView Demo </Text> | ||
) | ||
} | ||
} | ||
const App = class NukeDemoIndex extends Component { | ||
constructor() { | ||
super(); | ||
} | ||
render() { | ||
return ( | ||
<Text>本 demo 无法独立展示,请查看 ScrollView Demo </Text> | ||
); | ||
} | ||
}; | ||
render(<App/>); | ||
render(<App />); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20492
391
3
1
Updatednuke-env@^2.1.1-3
Updatednuke-view@^2.1.1-3