Browse Source

Merge branch 'master' into authors

pull/1058/head
yiminghe 9 years ago
parent
commit
0c11edbebd
  1. 25
      CHANGELOG.md
  2. 6
      components/cascader/index.jsx
  3. 2
      components/table/demo/row-selection-and-operation.md
  4. 8
      components/table/demo/row-selection.md
  5. 20
      components/table/index.jsx
  6. 4
      components/table/index.md
  7. 12
      components/tabs/demo/editable-card.md
  8. 32
      components/tabs/index.jsx
  9. 2
      package.json
  10. 12
      style/components/inputNumber.less
  11. 3
      style/components/tabs.less

25
CHANGELOG.md

@ -4,6 +4,31 @@
---
## 0.12.7
`2016-03-03`
- 修正 Table 的 `rowSelect.onSelectAll` 的第三个参数 `deselectedRows``changeRows`,记录每次变化的列。
## 0.12.6
`2016-03-02`
- 优化 Table 本地排序在 Chrome 下的稳定性问题。
- 修正 Pagination 的 pageSize 属性为受控属性,并补充了 `defaultPageSize` 属性。[#1087](https://github.com/ant-design/ant-design/issues/1087)
- 优化 Select 的 combobox 模式的交互体验。
- 升级 react-slick 依赖到 `0.11`,修复自动播放有时会失效的问题。[#1009](https://github.com/ant-design/ant-design/issues/1009)
- 修复 TreeSelect 的 allowClear 属性失效的问题。[#1084](https://github.com/ant-design/ant-design/issues/1084)
- 修复 Input 组件的 className 属性失效的问题。[#1103](https://github.com/ant-design/ant-design/issues/1103)
- 修复 Dropdown 的 onClick 属性失效的问题。[#1097](https://github.com/ant-design/ant-design/issues/1097)
- 修复多个 CheckboxGroup 选项互相影响的问题。[#1101](https://github.com/ant-design/ant-design/pull/1101)
- 修复 FormItem 的子元素为 `null` 时报错的问题。
- 修复 Table 组件的选择功能和展开功能配合使用的问题。[#1102](https://github.com/ant-design/ant-design/issues/1102)
- 增加了一个搜索框和提示功能结合的 [例子](http://ant.design/components/select/#demo-search-box)。
- 允许可编辑的 Tabs 删除最后一个页签。[#1071](https://github.com/ant-design/ant-design/issues/1071)
- Table 的 `rowSelect.onSelectAll` 补充了第三个参数 `deselectedRows`, `rowSelect.onChange` 补充了第二个参数 `selectedRows`。[#1105](https://github.com/ant-design/ant-design/issues/1105)
- 修复了部分组件样式的小问题。
## 0.12.5
`2016-02-25`

6
components/cascader/index.jsx

@ -51,7 +51,8 @@ class AntCascader extends React.Component {
this.setState({ popupVisible: false });
}
render() {
const { prefixCls, children, placeholder, size, disabled, className, style, allowClear } = this.props;
const { prefixCls, children, placeholder, size, disabled,
className, style, allowClear, ...otherProps } = this.props;
const sizeCls = classNames({
'ant-input-lg': size === 'large',
'ant-input-sm': size === 'small',
@ -79,7 +80,8 @@ class AntCascader extends React.Component {
<span
style={style}
className={pickerCls}>
<Input placeholder={placeholder}
<Input {...otherProps}
placeholder={placeholder}
className={`${prefixCls}-input ant-input ${sizeCls}`}
style={{ width: '100%' }}
value={this.getLabel()}

2
components/table/demo/row-selection-and-operation.md

@ -4,8 +4,6 @@
选择后进行操作,完成后清空选择,通过 `rowSelection.selectedRowKeys` 来控制选中项。
此版本换页后将会清空选中。
---
````jsx

8
components/table/demo/row-selection.md

@ -41,14 +41,14 @@ const data = [{
// 通过 rowSelection 对象表明需要行选择
const rowSelection = {
onChange(selectedRowKeys) {
console.log(`selectedRowKeys changed: ${selectedRowKeys}`);
onChange(selectedRowKeys, selectedRows) {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
},
onSelect(record, selected, selectedRows) {
console.log(record, selected, selectedRows);
},
onSelectAll(selected, selectedRows) {
console.log(selected, selectedRows);
onSelectAll(selected, selectedRows, changeRows) {
console.log(selected, selectedRows, changeRows);
}
};

20
components/table/index.jsx

@ -110,7 +110,9 @@ let AntTable = React.createClass({
this.setState({ selectedRowKeys });
}
if (this.props.rowSelection && this.props.rowSelection.onChange) {
this.props.rowSelection.onChange(selectedRowKeys);
const data = this.getCurrentPageData();
const selectedRows = data.filter(row => selectedRowKeys.indexOf(row.key) >= 0);
this.props.rowSelection.onChange(selectedRowKeys, selectedRows);
}
},
@ -231,16 +233,21 @@ let AntTable = React.createClass({
!this.props.rowSelection.getCheckboxProps ||
!this.props.rowSelection.getCheckboxProps(item).disabled
).map((item, i) => this.getRecordKey(item, i));
//
const changeRowKeys = [];
if (checked) {
changableRowKeys.forEach(key => {
if (selectedRowKeys.indexOf(key) < 0) {
selectedRowKeys.push(key);
changeRowKeys.push(key);
}
});
} else {
changableRowKeys.forEach(key => {
if (selectedRowKeys.indexOf(key) >= 0) {
selectedRowKeys.splice(selectedRowKeys.indexOf(key), 1);
changeRowKeys.push(key);
}
});
}
@ -249,10 +256,11 @@ let AntTable = React.createClass({
});
this.setSelectedRowKeys(selectedRowKeys);
if (this.props.rowSelection.onSelectAll) {
let selectedRows = data.filter((row, i) => {
return selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0;
});
this.props.rowSelection.onSelectAll(checked, selectedRows);
const selectedRows = data.filter((row, i) =>
selectedRowKeys.indexOf(this.getRecordKey(row, i)) >= 0);
const changeRows = data.filter((row, i) =>
changeRowKeys.indexOf(this.getRecordKey(row, i)) >= 0);
this.props.rowSelection.onSelectAll(checked, selectedRows, changeRows);
}
},
@ -511,7 +519,7 @@ let AntTable = React.createClass({
}
//
// ---
//
//
//
if (data.length > pageSize || pageSize === Number.MAX_VALUE) {
data = data.filter((item, i) => {

4
components/table/index.md

@ -97,10 +97,10 @@ const columns = [{
|------------------|--------------------------|-----------------|---------------------|---------|
| type | 多选/单选,`checkbox` or `radio` | String | `checkbox` |
| selectedRowKeys | 指定选中项的 key 数组,需要和 onChange 进行配合 | Array | [] |
| onChange | 选中项发生变化的时的回调,用户手动点选、换页、更新数据均会触发 | Function(selectedRowKeys) | - |
| onChange | 选中项发生变化的时的回调 | Function(selectedRowKeys, selectedRows) | - |
| getCheckboxProps | 选择框的默认属性配置 | Function(record) | - |
| onSelect | 用户手动选择/取消选择某列的回调 | Function(record, selected, selectedRows) | - |
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows) | - |
| onSelectAll | 用户手动选择/取消选择所有列的回调 | Function(selected, selectedRows, changeRows) | - |
## 注意

12
components/tabs/demo/editable-card.md

@ -36,10 +36,15 @@ const Demo = React.createClass({
},
remove(targetKey) {
let activeKey = this.state.activeKey;
let lastIndex = this.state.panes.findIndex(pane => pane.key === targetKey) - 1;
let lastIndex;
this.state.panes.forEach((pane, i) => {
if (pane.key === targetKey) {
lastIndex = i - 1;
}
});
const panes = this.state.panes.filter(pane => pane.key !== targetKey);
if (activeKey === targetKey) {
activeKey = panes[lastIndex >= 0 ? lastIndex : 0].key;
if (lastIndex >= 0 && activeKey === targetKey) {
activeKey = panes[lastIndex].key;
}
this.setState({ panes, activeKey });
},
@ -55,4 +60,3 @@ const Demo = React.createClass({
ReactDOM.render(<Demo />, mountNode);
````

32
components/tabs/index.jsx

@ -33,23 +33,22 @@ class AntTabs extends React.Component {
[`${prefixCls}-mini`]: size === 'small' || size === 'mini',
[`${prefixCls}-vertical`]: tabPosition === 'left' || tabPosition === 'right',
[`${prefixCls}-card`]: type.indexOf('card') >= 0,
[`${prefixCls}-${type}`]: true,
});
if (tabPosition === 'left' || tabPosition === 'right' || type.indexOf('card') >= 0) {
animation = null;
}
// only card type tabs can be added and closed
if (type === 'editable-card') {
if (children.length > 1) {
children = children.map((child, index) => {
return cloneElement(child, {
tab: <div>
{child.props.tab}
<Icon type="cross" onClick={this.removeTab.bind(this, child.key)} />
</div>,
key: child.key || index,
});
children = children.map((child, index) => {
return cloneElement(child, {
tab: <div>
{child.props.tab}
<Icon type="cross" onClick={this.removeTab.bind(this, child.key)} />
</div>,
key: child.key || index,
});
}
});
// Add new tab handler
tabBarExtraContent = (
<span>
@ -58,16 +57,15 @@ class AntTabs extends React.Component {
</span>
);
}
// Wrap the extra content
tabBarExtraContent = (
<div className={`${prefixCls}-extra-content`}>
{tabBarExtraContent}
</div>
);
return (
<Tabs {...this.props}
className={className}
tabBarExtraContent={tabBarExtraContent}
tabBarExtraContent={
<div className={`${prefixCls}-extra-content`}>
{tabBarExtraContent}
</div>
}
onChange={this.handleChange}
animation={animation}>
{children}

2
package.json

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "0.12.5",
"version": "0.12.7",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"homepage": "http://ant.design/",

12
style/components/inputNumber.less

@ -22,7 +22,7 @@
height: 28px;
display: inline-block;
vertical-align: middle;
border: 1px solid #d9d9d9;
border: 1px solid @border-color-base;
border-radius: @border-radius-base;
overflow: hidden;
width: 90px;
@ -158,11 +158,13 @@
}
&-handler-wrap {
float: right;
border-left: 1px solid #d9d9d9;
border-left: 1px solid @border-color-base;
width: 22px;
height: 28px;
position: relative;
background: #fff;
position: absolute;
top: 0;
right: 0;
opacity: 0;
transition: opacity 0.24s linear 0.1s;
}
@ -189,7 +191,7 @@
}
&-handler-down {
border-top: 1px solid #d9d9d9;
border-top: 1px solid @border-color-base;
top: -1px;
cursor: pointer;
&-inner {

3
style/components/tabs.less

@ -39,6 +39,7 @@
overflow: hidden;
font-size: 14px;
line-height: @line-height-base;
height: 36px;
box-sizing: border-box;
position: relative;
white-space: nowrap;
@ -419,7 +420,7 @@
}
}
&&-card &-tab:not(&-tab-active):hover &-tab-inner {
&&-editable-card &-tab:not(&-tab-active):hover &-tab-inner {
padding-left: 8px;
padding-right: 8px;
}

Loading…
Cancel
Save