Comparing version 0.9.0-beta2 to 0.9.0-beta3
@@ -44,2 +44,10 @@ # 更新日志 | ||
### Modal | ||
* 添加 [通知类型](http://ant.design/components/modal/#demo-info) 的对话框函数。 | ||
### Message | ||
* 添加 [加载中类型](http://ant.design/components/message/#demo-loading)。 | ||
### 其他 | ||
@@ -46,0 +54,0 @@ |
@@ -51,2 +51,2 @@ require('./index.css'); | ||
antd.version = '0.9.0-beta2'; | ||
antd.version = '0.9.0-beta3'; |
@@ -20,2 +20,3 @@ 'use strict'; | ||
var messageInstance = undefined; | ||
var key = 1; | ||
@@ -33,3 +34,3 @@ function getMessageInstance() { | ||
function notice(content, duration, type) { | ||
function notice(content, duration, type, onClose) { | ||
if (duration === undefined) duration = defaultDuration; | ||
@@ -40,5 +41,8 @@ | ||
'success': 'anticon-check-circle ant-message-success', | ||
'error': 'anticon-exclamation-circle ant-message-error' | ||
'error': 'anticon-exclamation-circle ant-message-error', | ||
'loading': 'anticon-loading ant-message-loading' | ||
})[type]; | ||
getMessageInstance().notice({ | ||
var instance = getMessageInstance(); | ||
instance.notice({ | ||
key: key, | ||
duration: duration, | ||
@@ -55,16 +59,26 @@ style: {}, | ||
) | ||
) | ||
), | ||
onClose: onClose | ||
}); | ||
return (function () { | ||
var target = key++; | ||
return function () { | ||
instance.removeNotice(target); | ||
}; | ||
})(); | ||
} | ||
exports['default'] = { | ||
info: function info(content, duration) { | ||
notice(content, duration, 'info'); | ||
info: function info(content, duration, onClose) { | ||
return notice(content, duration, 'info', onClose); | ||
}, | ||
success: function success(content, duration) { | ||
notice(content, duration, 'success'); | ||
success: function success(content, duration, onClose) { | ||
return notice(content, duration, 'success', onClose); | ||
}, | ||
error: function error(content, duration) { | ||
notice(content, duration, 'error'); | ||
error: function error(content, duration, onClose) { | ||
return notice(content, duration, 'error', onClose); | ||
}, | ||
loading: function loading(content, duration, onClose) { | ||
return notice(content, duration, 'loading', onClose); | ||
}, | ||
config: function config(options) { | ||
@@ -71,0 +85,0 @@ if (options.top) { |
@@ -22,5 +22,10 @@ 'use strict'; | ||
props = props || {}; | ||
props.iconClassName = props.iconClassName || 'anticon-exclamation-circle'; | ||
var width = props.width || 375; | ||
props.iconClassName = props.iconClassName || 'anticon-question-circle'; | ||
var width = props.width || 416; | ||
// 默认为 true,保持向下兼容 | ||
if (!('okCancel' in props)) { | ||
props.okCancel = true; | ||
} | ||
function close() { | ||
@@ -102,2 +107,29 @@ d.setState({ | ||
if (props.okCancel) { | ||
footer = _react2['default'].createElement( | ||
'div', | ||
{ className: 'ant-confirm-btns' }, | ||
_react2['default'].createElement( | ||
'button', | ||
{ type: 'button', className: 'ant-btn-default ant-btn ant-btn-lg', onClick: onCancel }, | ||
'取 消' | ||
), | ||
_react2['default'].createElement( | ||
'button', | ||
{ type: 'button', className: 'ant-btn-primary ant-btn ant-btn-lg', onClick: onOk }, | ||
'确 定' | ||
) | ||
); | ||
} else { | ||
footer = _react2['default'].createElement( | ||
'div', | ||
{ className: 'ant-confirm-btns' }, | ||
_react2['default'].createElement( | ||
'button', | ||
{ type: 'button', className: 'ant-btn-primary ant-btn ant-btn-lg', onClick: onOk }, | ||
'确 定' | ||
) | ||
); | ||
} | ||
if (!div) { | ||
@@ -104,0 +136,0 @@ div = document.createElement('div'); |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _confirm = require('./confirm'); | ||
var _confirm2 = _interopRequireDefault(_confirm); | ||
function noop() {} | ||
@@ -27,4 +31,4 @@ | ||
exports['default'] = _react2['default'].createClass({ | ||
displayName: 'index', | ||
var AntModal = _react2['default'].createClass({ | ||
displayName: 'AntModal', | ||
@@ -117,2 +121,27 @@ getDefaultProps: function getDefaultProps() { | ||
}); | ||
AntModal.info = function (props) { | ||
props.iconClassName = 'anticon-info-circle'; | ||
props.okCancel = false; | ||
return (0, _confirm2['default'])(props); | ||
}; | ||
AntModal.success = function (props) { | ||
props.iconClassName = 'anticon-check-circle'; | ||
props.okCancel = false; | ||
return (0, _confirm2['default'])(props); | ||
}; | ||
AntModal.error = function (props) { | ||
props.iconClassName = 'anticon-exclamation-circle'; | ||
props.okCancel = false; | ||
return (0, _confirm2['default'])(props); | ||
}; | ||
AntModal.confirm = function (props) { | ||
props.okCancel = true; | ||
return (0, _confirm2['default'])(props); | ||
}; | ||
exports['default'] = AntModal; | ||
module.exports = exports['default']; |
@@ -51,3 +51,3 @@ 'use strict'; | ||
var end = props.end; | ||
var endCls = end ? prefixCls + '-item-tail-end' : ''; | ||
var endCls = end ? prefixCls + '-item-last' : ''; | ||
var last = end ? _react2['default'].createElement('div', { className: prefixCls + '-item-head ' + prefixCls + '-item-head-end' }) : null; | ||
@@ -58,4 +58,4 @@ var lastLineShow = props.timelineLast && !end ? 'none' : 'block'; | ||
'li', | ||
{ className: prefixCls + '-item' }, | ||
_react2['default'].createElement('div', { style: { display: lastLineShow }, className: prefixCls + '-item-tail ' + endCls }), | ||
{ className: prefixCls + '-item ' + endCls }, | ||
_react2['default'].createElement('div', { style: { display: lastLineShow }, className: prefixCls + '-item-tail' }), | ||
_react2['default'].createElement('div', { className: prefixCls + '-item-head ' + prefixCls + '-item-head-' + color }), | ||
@@ -62,0 +62,0 @@ _react2['default'].createElement( |
{ | ||
"name": "antd", | ||
"version": "0.9.0-beta2", | ||
"version": "0.9.0-beta3", | ||
"stableVersion": "0.8.0", | ||
@@ -5,0 +5,0 @@ "title": "Ant Design", |
Sorry, the diff of this file is not supported yet
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
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
352670
12485