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

antd

Package Overview
Dependencies
Maintainers
4
Versions
850
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1-beta1

152

lib/datepicker/index.js

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

var Datepicker = _rcCalendar2['default'].Picker;
_gregorianCalendarFormatLibLocaleZhCn2['default'].shortMonths = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'];

@@ -49,78 +47,79 @@

var AntDatepicker = _react2['default'].createClass({
displayName: 'AntDatepicker',
getInitialState: function getInitialState() {
var value;
if (this.props.value) {
value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']);
value.setTime(new Date(this.props.value).valueOf());
}
return {
value: value
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.value) {
var value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']);
value.setTime(new Date(nextProps.value).valueOf());
function createPicker(Calendar) {
return _react2['default'].createClass({
getInitialState: function getInitialState() {
var value;
if (this.props.value) {
value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']);
value.setTime(new Date(this.props.value).valueOf());
}
return {
value: value
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.value) {
var value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']);
value.setTime(new Date(nextProps.value).valueOf());
this.setState({
value: value
});
}
},
getDefaultProps: function getDefaultProps() {
return {
format: 'yyyy-MM-dd',
placeholder: '请选择日期',
transitionName: 'slide-up',
onSelect: function onSelect() {}
};
},
handleChange: function handleChange(v) {
this.setState({
value: value
value: v
});
this.props.onSelect(new Date(v.getTime()));
},
render: function render() {
var calendar = _react2['default'].createElement(Calendar, {
disabledDate: this.props.disabledDate,
locale: _rcCalendarLibLocaleZhCn2['default'],
orient: ['top', 'left'],
defaultValue: defaultCalendarValue,
showTime: this.props.showTime,
prefixCls: 'ant-calendar',
showOk: this.props.showTime,
showClear: false });
var sizeClass = '';
if (this.props.size === 'large') {
sizeClass = ' ant-input-lg';
} else if (this.props.size === 'small') {
sizeClass = ' ant-input-sm';
}
return _react2['default'].createElement(
_rcCalendar.Picker,
{
transitionName: this.props.transitionName,
disabled: this.props.disabled,
trigger: _react2['default'].createElement('span', { className: 'ant-calendar-picker-icon' }),
calendar: calendar,
adjustOrientOnCalendarOverflow: { x: true, y: false },
formatter: new _gregorianCalendarFormat2['default'](this.props.format),
value: this.state.value,
defaultValue: this.props.defaultValue,
prefixCls: 'ant-calendar-picker',
style: this.props.style,
onChange: this.handleChange },
_react2['default'].createElement('input', {
placeholder: this.props.placeholder,
className: 'ant-calendar-picker-input ant-input' + sizeClass })
);
}
},
getDefaultProps: function getDefaultProps() {
return {
format: 'yyyy-MM-dd',
placeholder: '请选择日期',
transitionName: 'slide-up',
onSelect: function onSelect() {}
};
},
handleChange: function handleChange(v) {
this.setState({
value: v
});
this.props.onSelect(new Date(v.getTime()));
},
render: function render() {
var calendar = _react2['default'].createElement(_rcCalendar2['default'], {
disabledDate: this.props.disabledDate,
locale: _rcCalendarLibLocaleZhCn2['default'],
orient: ['top', 'left'],
defaultValue: defaultCalendarValue,
showTime: this.props.showTime,
prefixCls: 'ant-calendar',
showOk: this.props.showTime,
showClear: false });
var sizeClass = '';
if (this.props.size === 'large') {
sizeClass = ' ant-input-lg';
} else if (this.props.size === 'small') {
sizeClass = ' ant-input-sm';
}
return _react2['default'].createElement(
Datepicker,
{
transitionName: this.props.transitionName,
disabled: this.props.disabled,
trigger: _react2['default'].createElement('span', { className: 'ant-calendar-picker-icon' }),
calendar: calendar,
adjustOrientOnCalendarOverflow: {
x: true,
y: false
},
formatter: new _gregorianCalendarFormat2['default'](this.props.format),
value: this.state.value,
defaultValue: this.props.defaultValue,
prefixCls: 'ant-calendar-picker',
style: this.props.style,
onChange: this.handleChange },
_react2['default'].createElement('input', {
placeholder: this.props.placeholder,
className: 'ant-calendar-picker-input ant-input' + sizeClass })
);
}
});
});
}
var AntDatePicker = createPicker(_rcCalendar2['default']);
var AntMonthPicker = createPicker(_rcCalendar.MonthCalendar);
var AntCalendar = _react2['default'].createClass({

@@ -140,5 +139,6 @@ displayName: 'AntCalendar',

AntDatepicker.Calendar = AntCalendar;
AntDatePicker.Calendar = AntCalendar;
AntDatePicker.MonthPicker = AntMonthPicker;
exports['default'] = AntDatepicker;
exports['default'] = AntDatePicker;
module.exports = exports['default'];

@@ -49,2 +49,2 @@ require('./index.css');

antd.version = '0.8.0';
antd.version = '0.8.1-beta1';

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

}
var persentStyle = {
var percentStyle = {
width: props.percent + '%',

@@ -93,3 +93,3 @@ height: props.strokeWidth

{ className: prefixCls + '-line-inner' },
_react2['default'].createElement('div', { className: prefixCls + '-line-bg', style: persentStyle })
_react2['default'].createElement('div', { className: prefixCls + '-line-bg', style: percentStyle })
)

@@ -96,0 +96,0 @@ )

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

var checkedValue = null;
children.forEach(function (radio) {
_react2['default'].Children.forEach(children, function (radio) {
if (radio.props && radio.props.checked) {

@@ -56,3 +56,3 @@ checkedValue = radio.props.value;

var props = this.props;
var children = props.children.map(function (radio) {
var children = _react2['default'].Children.map(props.children, function (radio) {
if (radio.props) {

@@ -59,0 +59,0 @@ return _react2['default'].createElement(_radio2['default'], _extends({

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

return new DataSource((0, _objectAssign3['default'])(config, this.config));
return new DataSource((0, _objectAssign3['default'])({}, this.config, config));
}

@@ -95,4 +95,5 @@ }]);

data: [],
dataSource: this.props.dataSource,
filters: {},
loading: !this.isLocalDataSource(),
loading: false,
sortColumn: '',

@@ -102,3 +103,4 @@ sortOrder: '',

pagination: this.hasPagination() ? (0, _objectAssign3['default'])({
pageSize: 10
pageSize: 10,
current: 1
}, this.props.pagination) : {}

@@ -123,21 +125,18 @@ };

componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var newState = {};
if ('pagination' in nextProps && nextProps.pagination !== false) {
this.setState({
pagination: (0, _objectAssign3['default'])({}, this.state.pagination, nextProps.pagination)
});
newState.pagination = (0, _objectAssign3['default'])({}, this.state.pagination, nextProps.pagination);
}
if (!this.isLocalDataSource()) {
// 外界只有 dataSource 的变化会触发请请求
if (nextProps.dataSource !== this.props.dataSource) {
this.setState({
selectedRowKeys: [],
loading: true
}, this.fetch);
}
// 外界只有 dataSource 的变化会触发新请求
if ('dataSource' in nextProps && nextProps.dataSource !== this.props.dataSource) {
newState = {
selectedRowKeys: [],
dataSource: nextProps.dataSource,
loading: true
};
}
if (nextProps.columns !== this.props.columns) {
this.setState({
filters: {}
});
newState.filters = {};
}
this.setState(newState, this.fetch);
},

@@ -153,7 +152,7 @@

isLocalDataSource: function isLocalDataSource() {
return Array.isArray(this.props.dataSource);
return Array.isArray(this.state.dataSource);
},
getRemoteDataSource: function getRemoteDataSource() {
return this.props.dataSource;
return this.state.dataSource;
},

@@ -499,3 +498,3 @@

var state = this.state;
var data = this.props.dataSource;
var data = this.state.dataSource;
// 排序

@@ -533,3 +532,3 @@ if (state.sortOrder && state.sorter) {

var classString = '';
if (this.state.loading && this.isLocalDataSource()) {
if (this.state.loading && !this.isLocalDataSource()) {
classString += ' ant-table-loading';

@@ -536,0 +535,0 @@ }

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

function noop() {}
var AntUpload = _react2['default'].createClass({

@@ -47,3 +49,3 @@ displayName: 'AntUpload',

},
handleStart: function handleStart(file) {
onStart: function onStart(file) {
var nextDownloadList = this.state.downloadList;

@@ -54,2 +56,3 @@ nextDownloadList.push({

filename: file.name,
file: file,
status: 'downloading'

@@ -60,15 +63,40 @@ });

});
this.props.onStart(file);
},
handleSuccess: function handleSuccess(ret, file) {
_message2['default'].success(file.name + '上传完成');
var targetItem = (0, _getFileItem2['default'])(file, this.state.downloadList);
targetItem.status = 'done';
removeFile: function removeFile(file) {
var downloadList = this.state.downloadList.concat();
var targetItem = (0, _getFileItem2['default'])(file, downloadList);
var index = downloadList.indexOf(targetItem);
if (index !== -1) {
downloadList.splice(index, 1);
}
this.setState({
downloadList: this.state.downloadList
downloadList: downloadList
});
},
handleProgress: function handleProgress() {},
handleError: function handleError() {
_message2['default'].error('上传失败');
onSuccess: function onSuccess(ret, file) {
var res = this.props.onSuccess(ret, file);
if (res !== false) {
var downloadList = this.state.downloadList.concat();
_message2['default'].success(file.name + '上传完成');
var targetItem = (0, _getFileItem2['default'])(file, downloadList);
targetItem.status = 'done';
this.setState({
downloadList: this.state.downloadList
});
} else {
this.removeFile(file);
}
},
onProgress: function onProgress(e, file) {
this.props.onProgress(e, file);
},
onError: function onError(err, responce, file) {
_message2['default'].error(file.name + ' 上传失败');
this.removeFile(file);
this.props.onError(err, responce, file);
},
onRemove: function onRemove(file) {
this.props.onRemove(file);
},
getDefaultProps: function getDefaultProps() {

@@ -83,30 +111,17 @@ return {

uploadTip: '',
start: function start() {},
error: function error() {},
success: function success() {},
progress: function progress() {}
onStart: noop,
onError: noop,
onSuccess: noop,
onProgress: noop,
onRemove: noop
};
},
render: function render() {
var _this = this;
var type = this.props.type || 'select';
var props = (0, _objectAssign2['default'])({}, this.props);
props.onStart = function (file) {
_this.handleStart(file);
props.start.call(_this, file);
};
props.onSuccess = function (ret, file) {
_this.handleSuccess(ret, file);
props.success.call(_this, ret, file);
};
props.onProgress = function (step) {
_this.handleProgress(step);
props.progress.call(_this, step);
};
props.onError = function (err, responce, file) {
_this.handleError(err);
props.error.call(_this, err, responce, file);
};
var props = (0, _objectAssign2['default'])({}, this.props, {
onStart: this.onStart,
onError: this.onError,
onProgress: this.onProgress,
onSuccess: this.onSuccess
});
if (type === 'drag') {

@@ -139,3 +154,3 @@ return _react2['default'].createElement(

),
_react2['default'].createElement(_uploadList2['default'], { items: this.state.downloadList })
_react2['default'].createElement(_uploadList2['default'], { items: this.state.downloadList, onRemove: this.onRemove })
);

@@ -142,0 +157,0 @@ }

@@ -51,2 +51,3 @@ 'use strict';

});
this.props.onRemove(file.file);
},

@@ -53,0 +54,0 @@ render: function render() {

{
"name": "antd",
"version": "0.8.0",
"version": "0.8.1-beta1",
"stableVersion": "0.8.0",

@@ -41,3 +41,3 @@ "title": "Ant Design",

"rc-animate": "~1.2.0",
"rc-calendar": "~3.15.0",
"rc-calendar": "~3.16.1",
"rc-checkbox": "~1.1.1",

@@ -44,0 +44,0 @@ "rc-collapse": "~1.3.0",

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

# Ant Design [![](https://img.shields.io/travis/ant-design/ant-design.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design) [![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd) [![Dependency Status](https://david-dm.org/ant-design/ant-design.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design)
# Ant Design [![](https://img.shields.io/travis/ant-design/ant-design.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design) [![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd) [![Join the chat at https://gitter.im/ant-design/ant-design](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/ant-design/ant-design](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ant-design/ant-design?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
一套企业级的 UI 设计语言和 React 实现。

@@ -6,0 +4,0 @@

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