Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuke-list-view

Package Overview
Dependencies
Maintainers
3
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-list-view - npm Package Compare versions

Comparing version 2.1.10 to 2.2.2

35

CHANGELOG.md

@@ -6,2 +6,37 @@ # Change Log

<a name="2.2.2"></a>
## [2.2.2](https://gitlab.alibaba-inc.com/nuke/list-view/compare/v2.2.1...v2.2.2) (2018-08-23)
**Note:** Version bump only for package nuke-list-view
<a name="2.2.1"></a>
## [2.2.1](https://gitlab.alibaba-inc.com/nuke/list-view/compare/v2.2.0...v2.2.1) (2018-08-23)
**Note:** Version bump only for package nuke-list-view
<a name="2.2.0"></a>
# [2.2.0](https://gitlab.alibaba-inc.com/nuke/list-view/compare/v2.1.10...v2.2.0) (2018-08-23)
### Bug Fixes
* merge conflict ([7a4e427](https://gitlab.alibaba-inc.com/nuke/list-view/commit/7a4e427))
### Features
* add jest test suite ([ebe6aba](https://gitlab.alibaba-inc.com/nuke/list-view/commit/ebe6aba))
<a name="2.1.10"></a>

@@ -8,0 +43,0 @@ ## [2.1.10](https://gitlab.alibaba-inc.com/nuke/list-view/compare/v2.1.9...v2.1.10) (2018-08-20)

248

lib/index.js

@@ -1,1 +0,247 @@

'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'),_nukeScrollView=require('nuke-scroll-view'),_nukeScrollView2=_interopRequireDefault(_nukeScrollView),_nukeRefreshControl=require('nuke-refresh-control'),_nukeRefreshControl2=_interopRequireDefault(_nukeRefreshControl),_nukeCell=require('nuke-cell'),_nukeCell2=_interopRequireDefault(_nukeCell),_nukeHeader=require('nuke-header'),_nukeHeader2=_interopRequireDefault(_nukeHeader);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _objectWithoutProperties(obj,keys){var target={};for(var i in obj)0<=keys.indexOf(i)||Object.prototype.hasOwnProperty.call(obj,i)&&(target[i]=obj[i]);return target}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 ListView=function(_Component){function ListView(){var _ref,_temp,_this,_ret;_classCallCheck(this,ListView);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _ret=(_temp=(_this=_possibleConstructorReturn(this,(_ref=ListView.__proto__||Object.getPrototypeOf(ListView)).call.apply(_ref,[this].concat(args))),_this),_this.resetLoadmore=function(){_this.refs.list.resetLoadmore&&_this.refs.list.resetLoadmore()},_this.scrollTo=function(options){var x=parseInt(options.x),y=parseInt(options.y);if(_nukeEnv.isWeex){var dom=require('@weex-module/dom'),firstCell=_this.hasHeader?(0,_rax.findDOMNode)(_this.refs.cell1):(0,_rax.findDOMNode)(_this.refs.cell0);dom.scrollToElement(firstCell.ref,{offset:x||y||0})}else _this.refs.list.scrollTo(options)},_temp),_possibleConstructorReturn(_this,_ret)}return _inherits(ListView,_Component),_createClass(ListView,[{key:'getChildContext',value:function getChildContext(){return{isInARecyclerView:!0}}},{key:'getChidren',value:function getChidren(){var _props=this.props,children=_props.children,renderHeader=_props.renderHeader,renderFooter=_props.renderFooter,renderRow=_props.renderRow,_props$dataSource=_props.dataSource,dataSource=void 0===_props$dataSource?[]:_props$dataSource;if(children)return Array.isArray(children)?children:[children];var header='function'==typeof renderHeader?renderHeader():null,footer='function'==typeof renderFooter?renderFooter():null,body=dataSource.map(function(i,index){return renderRow(i,index)});return[].concat(header,body,footer)}},{key:'render',value:function render(){var _this2=this,_props2=this.props,onEndReached=_props2.onEndReached,onEndReachedThreshold=_props2.onEndReachedThreshold,id=_props2.id,style=_props2.style,showScrollbar=_props2.showScrollbar,_keepScrollPosition=_props2._keepScrollPosition,_autoWrapCell=_props2._autoWrapCell,renderRow=_props2.renderRow,dataSource=_props2.dataSource,renderHeader=_props2.renderHeader,renderFooter=_props2.renderFooter,others=_objectWithoutProperties(_props2,['onEndReached','onEndReachedThreshold','id','style','showScrollbar','_keepScrollPosition','_autoWrapCell','renderRow','dataSource','renderHeader','renderFooter']),children=this.getChidren(),cells=children.map(function(child,index){var ref='cell'+index;return child&&child.type===_nukeRefreshControl2.default&&(_this2.hasHeader=!0),child?_autoWrapCell&&child.type!=_nukeRefreshControl2.default?child.key?(0,_rax.createElement)(_nukeCell2.default,{keepScrollPosition:_keepScrollPosition,ref:ref,key:child.key},child):(0,_rax.createElement)(_nukeCell2.default,{ref:ref},child):(0,_rax.cloneElement)(child,{ref:ref}):(0,_rax.createElement)(_nukeCell2.default,{ref:ref})});return _nukeEnv.isWeex?(0,_rax.createElement)('list',_extends({id:id,ref:'list',style:style,onLoadmore:onEndReached,loadmoreretry:!0,loadmoreoffset:onEndReachedThreshold,showScrollbar:showScrollbar},others),cells):(0,_rax.createElement)(_nukeScrollView2.default,_extends({id:id,style:style,onEndReached:onEndReached,onEndReachedThreshold:onEndReachedThreshold,showScrollbar:showScrollbar},others),cells)}}]),ListView}(_rax.Component);ListView.childContextTypes={isInARecyclerView:_rax.PropTypes.bool},ListView.propTypes={onEndReached:_rax.PropTypes.func,onEndReachedThreshold:_rax.PropTypes.num,id:_rax.PropTypes.string,style:_rax.PropTypes.any,showScrollbar:_rax.PropTypes.boolean,_keepScrollPosition:_rax.PropTypes.boolean,_autoWrapCell:_rax.PropTypes.boolean,renderRow:_rax.PropTypes.func,dataSource:_rax.PropTypes.array,renderHeader:_rax.PropTypes.func,renderFooter:_rax.PropTypes.func},ListView.defaultProps={onEndReachedThreshold:500,_keepScrollPosition:!1,_autoWrapCell:!0,showScrollbar:!1},ListView.RefreshControl=_nukeRefreshControl2.default,ListView.Cell=_nukeCell2.default,ListView.Header=_nukeHeader2.default,exports.default=ListView,module.exports=exports['default'];
/** @jsx createElement */
'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 _nukeScrollView = require('nuke-scroll-view');
var _nukeScrollView2 = _interopRequireDefault(_nukeScrollView);
var _nukeRefreshControl = require('nuke-refresh-control');
var _nukeRefreshControl2 = _interopRequireDefault(_nukeRefreshControl);
var _nukeCell = require('nuke-cell');
var _nukeCell2 = _interopRequireDefault(_nukeCell);
var _nukeHeader = require('nuke-header');
var _nukeHeader2 = _interopRequireDefault(_nukeHeader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
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; }
/**
* ListView
* @description 列表
*/
var ListView = function (_Component) {
_inherits(ListView, _Component);
function ListView() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, ListView);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ListView.__proto__ || Object.getPrototypeOf(ListView)).call.apply(_ref, [this].concat(args))), _this), _this.resetLoadmore = function () {
_this.refs.list.resetLoadmore && _this.refs.list.resetLoadmore();
}, _this.scrollTo = function (options) {
var x = parseInt(options.x);
var y = parseInt(options.y);
if (_nukeEnv.isWeex) {
var dom = require('@weex-module/dom');
var firstCell = _this.hasHeader ? (0, _rax.findDOMNode)(_this.refs.cell1) : (0, _rax.findDOMNode)(_this.refs.cell0);
dom.scrollToElement(firstCell.ref, {
offset: x || y || 0
});
} else {
_this.refs.list.scrollTo(options);
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(ListView, [{
key: 'getChildContext',
value: function getChildContext() {
return {
isInARecyclerView: true
};
}
}, {
key: 'getChidren',
value: function getChidren() {
var _props = this.props,
children = _props.children,
renderHeader = _props.renderHeader,
renderFooter = _props.renderFooter,
renderRow = _props.renderRow,
_props$dataSource = _props.dataSource,
dataSource = _props$dataSource === undefined ? [] : _props$dataSource;
if (children) {
return !Array.isArray(children) ? [children] : children;
}
var header = typeof renderHeader === 'function' ? renderHeader() : null;
var footer = typeof renderFooter === 'function' ? renderFooter() : null;
var body = dataSource.map(function (i, index) {
return renderRow(i, index);
});
return [].concat(header, body, footer);
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
var _props2 = this.props,
onEndReached = _props2.onEndReached,
onEndReachedThreshold = _props2.onEndReachedThreshold,
id = _props2.id,
style = _props2.style,
showScrollbar = _props2.showScrollbar,
_keepScrollPosition = _props2._keepScrollPosition,
_autoWrapCell = _props2._autoWrapCell,
renderRow = _props2.renderRow,
dataSource = _props2.dataSource,
renderHeader = _props2.renderHeader,
renderFooter = _props2.renderFooter,
others = _objectWithoutProperties(_props2, ['onEndReached', 'onEndReachedThreshold', 'id', 'style', 'showScrollbar', '_keepScrollPosition', '_autoWrapCell', 'renderRow', 'dataSource', 'renderHeader', 'renderFooter']);
var children = this.getChidren();
var cells = children.map(function (child, index) {
var ref = 'cell' + index;
if (child && child.type === _nukeRefreshControl2.default) {
_this2.hasHeader = true;
}
if (child) {
if (_autoWrapCell && child.type != _nukeRefreshControl2.default) {
if (child.key) {
return (0, _rax.createElement)(
_nukeCell2.default,
{
keepScrollPosition: _keepScrollPosition,
ref: ref,
key: child.key
},
child
);
}
return (0, _rax.createElement)(
_nukeCell2.default,
{ ref: ref },
child
);
}
return (0, _rax.cloneElement)(child, { ref: ref });
}
return (0, _rax.createElement)(_nukeCell2.default, { ref: ref });
});
if (_nukeEnv.isWeex) {
return (0, _rax.createElement)(
'list',
_extends({
id: id,
ref: 'list',
style: style,
onLoadmore: onEndReached,
loadmoreretry: true,
loadmoreoffset: onEndReachedThreshold,
showScrollbar: showScrollbar
}, others),
cells
);
}
return (0, _rax.createElement)(
_nukeScrollView2.default,
_extends({
id: id,
style: style,
onEndReached: onEndReached,
onEndReachedThreshold: onEndReachedThreshold,
showScrollbar: showScrollbar
}, others),
cells
);
}
}]);
return ListView;
}(_rax.Component);
ListView.childContextTypes = {
isInARecyclerView: _rax.PropTypes.bool
};
ListView.propTypes = {
/**
* 列表底部加载更多的回调函数 onEndReached callback function
*/
onEndReached: _rax.PropTypes.func,
/**
* 列表到底部触发加载更多的位移量 offset of onEndReached been triggered
*/
onEndReachedThreshold: _rax.PropTypes.num,
id: _rax.PropTypes.string,
/**
* 列表外层容器样式 style of list
*/
style: _rax.PropTypes.any,
/**
* 是否显示滚动条 show scrollbar or not when scrolling
*/
showScrollbar: _rax.PropTypes.boolean,
/**
* 是否保持上一次滚动位置 keep last scroll position
*/
_keepScrollPosition: _rax.PropTypes.boolean,
/**
* 是否自动包裹 cell 标签,仅用于非数据源模式 wrap cell tag or not
*/
_autoWrapCell: _rax.PropTypes.boolean,
/**
* 渲染数据的回调函数 render list row function
*/
renderRow: _rax.PropTypes.func,
/**
* 数据源 data souce of the list
*/
dataSource: _rax.PropTypes.array,
/**
* 渲染头部的回调函数 render list header function
*/
renderHeader: _rax.PropTypes.func,
/**
* 渲染尾的回调函数 render list footer function
*/
renderFooter: _rax.PropTypes.func
};
ListView.defaultProps = {
onEndReachedThreshold: 500,
_keepScrollPosition: false,
_autoWrapCell: true,
showScrollbar: false
};
ListView.RefreshControl = _nukeRefreshControl2.default;
ListView.Cell = _nukeCell2.default;
ListView.Header = _nukeHeader2.default;
exports.default = ListView;
module.exports = exports['default'];

38

package.json
{
"name": "nuke-list-view",
"version": "2.1.10",
"version": "2.2.2",
"description": "列表",

@@ -28,24 +28,18 @@ "main": "lib/index",

"dependencies": {
"nuke-cell": "^2.1.10",
"nuke-env": "^2.1.10",
"nuke-header": "^2.1.10",
"nuke-refresh-control": "^2.1.10",
"nuke-scroll-view": "^2.1.10"
"nuke-cell": "^2.2.2",
"nuke-env": "^2.2.2",
"nuke-header": "^2.2.2",
"nuke-refresh-control": "^2.2.2",
"nuke-scroll-view": "^2.2.2"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "3.19.0",
"eslint-config-ali": "2.0.0",
"eslint-plugin-import": "2.6.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-react": "7.1.0",
"nuke-button": "^2.1.10",
"nuke-iconfont": "^2.1.10",
"nuke-image": "^2.1.10",
"nuke-modal": "^2.1.10",
"nuke-navigator": "^2.1.10",
"nuke-page": "^2.1.10",
"nuke-text": "^2.1.10",
"nuke-touchable": "^2.1.10",
"nuke-view": "^2.1.10"
"nuke-button": "^2.2.2",
"nuke-iconfont": "^2.2.2",
"nuke-image": "^2.2.2",
"nuke-modal": "^2.2.2",
"nuke-navigator": "^2.2.2",
"nuke-page": "^2.2.2",
"nuke-text": "^2.2.2",
"nuke-touchable": "^2.2.2",
"nuke-view": "^2.2.2"
},

@@ -56,3 +50,3 @@ "publishConfig": {

"license": "Apache",
"gitHead": "3f456cd7f92241938769ceee9057f543a2034fd1"
"gitHead": "ffcb4269489cb30dfded592190c4997ff2376c18"
}
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