Socket
Socket
Sign inDemoInstall

nuke-components

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-components - npm Package Compare versions

Comparing version 0.2.33 to 0.2.34

lib/recycler-view.js

4

HISTORY.md
# Changelog
## 0.2.34 / 2017-06-08
* [[3f8025c](http://gitlab.alibaba-inc.com/nuke/components/commit/3f8025c1349fd76e94659464a6fbc24177d7f86c)] - `feat` add recycler-view
## 0.2.33 / 2017-06-06

@@ -5,0 +9,0 @@

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

var _recyclerView = require('./recycler-view');
var _recyclerView2 = _interopRequireDefault(_recyclerView);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -55,2 +59,3 @@

RefreshControl: _refreshControl2.default,
RecyclerView: _recyclerView2.default,
TouchableHighlight: _touchableHighlight2.default,

@@ -57,0 +62,0 @@ Touchable: _touchableHighlight2.default

203

lib/text-input.js

@@ -1,207 +0,14 @@

/* @jsx createElement */
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
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 _nukeTextInput = require('nuke-text-input');
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 _nukeTextInput2 = _interopRequireDefault(_nukeTextInput);
var _rax = require('rax');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _nukeEnv = require('nuke-env');
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 typeMap = {
'default': 'text',
'ascii-capable': 'text',
'numbers-and-punctuation': 'number',
'url': 'url',
'number-pad': 'number',
'phone-pad': 'tel',
'name-phone-pad': 'text',
'email-address': 'email',
'decimal-pad': 'number',
'twitter': 'text',
'web-search': 'search',
'numeric': 'number'
};
var TextInput = function (_Component) {
_inherits(TextInput, _Component);
function TextInput() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, TextInput);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = TextInput.__proto__ || Object.getPrototypeOf(TextInput)).call.apply(_ref, [this].concat(args))), _this), _this.handleInput = function (e) {
var text = e.value;
// Shim Event
if (_nukeEnv.isWeex) {
e = {
nativeEvent: {
text: text
},
value: text
};
}
_this.props.onInput(e);
}, _this.handleChange = function (e) {
var text = e.value;
// Shim Event
if (_nukeEnv.isWeex) {
e = {
nativeEvent: {
text: text
},
value: text
};
}
_this.props.onChange && _this.props.onChange(e);
_this.props.onChangeText && _this.props.onChangeText(text);
}, _this.handleFocus = function (e) {
return _this.props.onFocus(e);
}, _this.handleBlur = function (e) {
return _this.props.onBlur(e);
}, _this.focus = function () {
_this.refs.input.focus && _this.refs.input.focus();
}, _this.blur = function () {
_this.refs.input.blur && _this.refs.input.blur();
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(TextInput, [{
key: 'render',
value: function render() {
var _props = this.props,
accessibilityLabel = _props.accessibilityLabel,
autoComplete = _props.autoComplete,
_props$autoFocus = _props.autoFocus,
autoFocus = _props$autoFocus === undefined ? false : _props$autoFocus,
editable = _props.editable,
keyboardType = _props.keyboardType,
maxLength = _props.maxLength,
maxNumberOfLines = _props.maxNumberOfLines,
numberOfLines = _props.numberOfLines,
onBlur = _props.onBlur,
onFocus = _props.onFocus,
onChange = _props.onChange,
onChangeText = _props.onChangeText,
onInput = _props.onInput,
placeholder = _props.placeholder,
password = _props.password,
secureTextEntry = _props.secureTextEntry,
style = _props.style,
value = _props.value,
id = _props.id,
others = _props.others;
var _props2 = this.props,
_props2$type = _props2.type,
type = _props2$type === undefined ? 'default' : _props2$type,
multiline = _props2.multiline,
multiple = _props2.multiple;
multiline = multiple || multiline;
var propsCommon = {
'aria-label': accessibilityLabel,
autoComplete: autoComplete && 'on',
autofocus: autoFocus,
maxlength: maxLength,
onChange: (onChange || onChangeText) && this.handleChange,
onInput: onInput && this.handleInput,
onBlur: onBlur && this.handleBlur,
onFocus: onFocus && this.handleFocus,
placeholder: placeholder,
style: _extends({}, styles.initial, style),
value: value,
id: id,
ref: 'input'
};
if (typeof editable !== 'undefined' && !editable) {
propsCommon.readOnly = true;
} else {
//由于weex input readOnly默认值恢复还成问题,此处需要强制指定false,否则如果用户设置过readonly true 就永远无法修改了。
if (_nukeEnv.isWeex) {
propsCommon.readOnly = false;
}
}
type = typeMap[keyboardType] || type;
if (password || secureTextEntry) {
type = 'password';
}
if (_nukeEnv.isWeex) {
if (multiline) {
return (0, _rax.createElement)('textarea', _extends({}, propsCommon, { rows: 20, disabled: propsCommon.readOnly }));
} else {
// https://github.com/alibaba/weex/blob/dev/doc/components/input.md
return (0, _rax.createElement)('input', _extends({}, propsCommon, { type: type, disabled: propsCommon.readOnly }));
}
} else {
// 删除autofocus
if (!propsCommon.autofocus) {
delete propsCommon.autofocus;
}
var input = void 0;
if (multiline) {
var propsMultiline = {
maxRows: maxNumberOfLines || numberOfLines,
minRows: numberOfLines
};
input = (0, _rax.createElement)(
'textarea',
_extends({}, propsCommon, propsMultiline, others),
propsCommon.value
);
} else {
input = (0, _rax.createElement)('input', _extends({}, propsCommon, others, { type: type }));
}
return input;
}
}
}]);
return TextInput;
}(_rax.Component);
var styles = {
initial: {
appearance: 'none',
backgroundColor: 'transparent',
borderColor: '#000000',
borderWidth: 0,
boxSizing: 'border-box',
color: '#000000',
padding: 0,
paddingLeft: '8rem',
// lineHeight: '24rem',
fontSize: '24rem',
minHeight: '36rem' // default height
}
};
exports.default = TextInput;
exports.default = _nukeTextInput2.default;
module.exports = exports['default'];
{
"name": "nuke-components",
"version": "0.2.33",
"version": "0.2.34",
"description": "nuke原件库",

@@ -35,11 +35,13 @@ "main": "lib/index",

"dependencies": {
"nuke-view": "^0.x.x",
"nuke-text": "^0.x.x",
"nuke-env": "^0.x.x",
"nuke-image": "^0.x.x",
"nuke-recycler-view": "^0.x.x",
"nuke-refresh-control": "^0.x.x",
"nuke-scroll-view": "^0.x.x",
"nuke-switch": "^0.x.x",
"nuke-text": "^0.x.x",
"nuke-text-input": "^0.0.1",
"nuke-touchable": "^0.x.x",
"nuke-video": "^0.x.x",
"nuke-touchable": "^0.x.x",
"nuke-env": "^0.x.x",
"nuke-refresh-control": "^0.x.x",
"nuke-scroll-view": "^0.x.x"
"nuke-view": "^0.x.x"
},

@@ -46,0 +48,0 @@ "devDependencies": {

@@ -10,2 +10,3 @@ import View from './view';

import RefreshControl from './refresh-control';
import RecyclerView from './recycler-view';
export default {

@@ -20,4 +21,5 @@ View: View,

RefreshControl: RefreshControl,
RecyclerView: RecyclerView,
TouchableHighlight: Touchable,
Touchable: Touchable
}

@@ -1,174 +0,2 @@

/* @jsx createElement */
'use strict';
import {Component, createElement} from 'rax';
import {isWeex} from 'nuke-env';
/* @jsx createElement */
const typeMap = {
'default': 'text',
'ascii-capable': 'text',
'numbers-and-punctuation': 'number',
'url': 'url',
'number-pad': 'number',
'phone-pad': 'tel',
'name-phone-pad': 'text',
'email-address': 'email',
'decimal-pad': 'number',
'twitter': 'text',
'web-search': 'search',
'numeric': 'number'
};
class TextInput extends Component {
handleInput = (e) => {
let text = e.value;
// Shim Event
if (isWeex) {
e = {
nativeEvent: {
text
},
value: text
};
}
this.props.onInput(e);
};
handleChange = (e) => {
let text = e.value;
// Shim Event
if (isWeex) {
e = {
nativeEvent: {
text
},
value: text
};
}
this.props.onChange && this.props.onChange(e);
this.props.onChangeText && this.props.onChangeText(text);
};
handleFocus = (e) => this.props.onFocus(e);
handleBlur = (e) => this.props.onBlur(e);
focus = () => {
this.refs.input.focus && this.refs.input.focus();
}
blur = () => {
this.refs.input.blur && this.refs.input.blur();
}
render() {
const {
accessibilityLabel,
autoComplete,
autoFocus = false,
editable,
keyboardType,
maxLength,
maxNumberOfLines,
numberOfLines,
onBlur,
onFocus,
onChange,
onChangeText,
onInput,
placeholder,
password,
secureTextEntry,
style,
value,
id,
others
} = this.props;
let { type ='default', multiline , multiple } = this.props;
multiline= multiple || multiline;
let propsCommon = {
'aria-label': accessibilityLabel,
autoComplete: autoComplete && 'on',
autofocus:autoFocus,
maxlength:maxLength,
onChange: (onChange || onChangeText) && this.handleChange,
onInput: onInput && this.handleInput,
onBlur: onBlur && this.handleBlur,
onFocus: onFocus && this.handleFocus,
placeholder,
style: {
...styles.initial,
...style
},
value,
id,
ref: 'input'
};
if (typeof editable !== 'undefined' && !editable) {
propsCommon.readOnly = true;
}else{
//由于weex input readOnly默认值恢复还成问题,此处需要强制指定false,否则如果用户设置过readonly true 就永远无法修改了。
if(isWeex){
propsCommon.readOnly = false;
}
}
type = typeMap[keyboardType] || type;
if (password || secureTextEntry) {
type = 'password';
}
if (isWeex) {
if (multiline) {
return <textarea {...propsCommon} rows={20} disabled={propsCommon.readOnly} />;
} else {
// https://github.com/alibaba/weex/blob/dev/doc/components/input.md
return <input {...propsCommon} type={type} disabled={propsCommon.readOnly} />;
}
} else {
// 删除autofocus
if(!propsCommon.autofocus){
delete propsCommon.autofocus;
}
let input;
if (multiline) {
const propsMultiline = {
maxRows: maxNumberOfLines || numberOfLines,
minRows: numberOfLines
};
input = <textarea {...propsCommon} {...propsMultiline} {...others}>{propsCommon.value}</textarea>;
} else {
input = <input {...propsCommon} {...others} type={type} />;
}
return input;
}
}
}
const styles = {
initial: {
appearance: 'none',
backgroundColor: 'transparent',
borderColor: '#000000',
borderWidth: 0,
boxSizing: 'border-box',
color: '#000000',
padding: 0,
paddingLeft: '8rem',
// lineHeight: '24rem',
fontSize: '24rem',
minHeight: '36rem', // default height
}
};
export default TextInput;
import NukeTextInput from 'nuke-text-input';
export default NukeTextInput;
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