Skip to content

Commit

Permalink
Merge pull request #26 from binjie09/master
Browse files Browse the repository at this point in the history
upgrade to 0.4.2
  • Loading branch information
devane001 committed Nov 15, 2018
2 parents 9954b64 + 1b3a59d commit e7be829
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 10 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ timeline: true

---

## 0.4.2

`2018-11-13`

- 🌟 `Icon`: Add new icons.
- 🌟 `Table`: Add `noFilters`, Used to block the default filtering.
- 🌟 `Table.Column`: Add `disableClick` to disable the check for the `Table` filter.
- 💄 `Tag`: Fix hot label display issues.
- 💄 `Select`: all-select and no logic optimization.

## 0.4.1

`2018-10-26`
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ timeline: true

---

## 0.4.2

`2018-11-13`

- 🌟 `Icon`: 增加新的图标。
- 🌟 `Table`: 增加`noFilters`,用于阻止默认的过滤筛选功能。
- 🌟 `Table.Column`: 增加`disableClick`, 用于 `Table` 筛选项禁用勾选。
- 💄 `Tag`: 修复热门标签显示问题。
- 💄 `Select`: Select全选和无的逻辑优化。

## 0.4.1

`2018-10-26`
Expand Down
1 change: 1 addition & 0 deletions components/icon/icons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const icons = {
default: [
'cluster', 'kubernetes_cluster', 'disconnect', 'running', 'notification_setting',
'authority', 'develop_console', 'frame', 'record_test',
'agile_epic', 'agile_fault', 'agile_story', 'agile_subtask', 'agile_task', 'auto_test', 'devops_chart',
'agile_chart', 'test_chart', 'bar_chart', 'unlock', 'classname',
Expand Down
2 changes: 1 addition & 1 deletion components/rc-components/menu/MenuItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const MenuItem = createReactClass({
}

const notFound = props.eventKey === 'NOT_FOUND';
const checkbox = props.multiple && !notFound ? <Checkbox checked={props.isSelected} /> : null;
const checkbox = props.multiple && !notFound ? <Checkbox disabled={props.disabled} checked={props.isSelected} /> : null;
return (
<Ripple>
<li
Expand Down
14 changes: 9 additions & 5 deletions components/rc-components/select/Select.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1363,13 +1363,17 @@ export default class Select extends React.Component {
if (props.disabled) {
return;
}

let newValues;
const values = this._options.map((option) => {
return getValuePropValue(option);
});
if (name === 'check-all') {
const values = this._options.map((option) => {
return getValuePropValue(option);
});
this.fireChange(values);
newValues = new Set(state.value.concat(values));
this.fireChange(Array.from(newValues));
} else if (name === 'check-none') {
this.fireChange([]);
newValues = state.value.filter((e) => values.indexOf(e) < 0);
this.fireChange(newValues);
this.focus();
}
};
Expand Down
17 changes: 17 additions & 0 deletions components/style/core/iconfont.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,23 @@
height: @icon-font-size-sm;
}
}
// 11.09

.@{iconfont-css-prefix}-cluster:before {
content: "\e9c1";
}
.@{iconfont-css-prefix}-kubernetes_cluster:before {
content: "\e9c4";
}
.@{iconfont-css-prefix}-disconnect:before {
content: "\e9c5";
}
.@{iconfont-css-prefix}-running:before {
content: "\e9c6";
}
.@{iconfont-css-prefix}-notification_setting:before {
content: "\e9c7";
}

// 10.24

Expand Down
2 changes: 1 addition & 1 deletion components/table/ColumnFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export default class ColumnFilter<T> extends React.Component<ColumnFilterProps<T
(this.props.columns || []).map((column, i) => {
const item = column.title ? (
<MenuItem
disabled={column.disableClick}
style={UNSELECTABLE_STYLE}
attribute={UNSELECTABLE_ATTRIBUTE}
value={column}
Expand All @@ -96,5 +97,4 @@ export default class ColumnFilter<T> extends React.Component<ColumnFilterProps<T
getVisibleColumns() {
return (this.props.columns || []).filter((column) => !column.hidden);
}

}
12 changes: 11 additions & 1 deletion components/table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
filterBar: PropTypes.bool,
filters: PropTypes.array,
filterBarPlaceholder: PropTypes.string,
onFilterSelectChange: PropTypes.func,
noFilter: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -98,6 +100,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
rowKey: 'key',
showHeader: true,
filterBar: true,
noFilter: false,
};

CheckboxPropsCache: {
Expand Down Expand Up @@ -459,6 +462,10 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
};

handleFilterSelectChange = (barFilters: any[]) => {
const { onFilterSelectChange } = this.props;
if (onFilterSelectChange) {
onFilterSelectChange(barFilters);
}
this.setNewFilterState({
barFilters,
});
Expand Down Expand Up @@ -940,7 +947,7 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
}

getLocalData() {
const { dataSource } = this.props;
const { dataSource, noFilter } = this.props;
if (dataSource) {
const state = this.state;
const { filters, barFilters } = state;
Expand Down Expand Up @@ -981,6 +988,9 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
}
});
}
if (noFilter) {
return data;
}
return filteredData;
} else {
return [];
Expand Down
2 changes: 2 additions & 0 deletions components/table/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const columns = [{
| onRow | 设置行属性 | Function(record, index) | - |
| filterBar | 显示过滤条,设置为false时,在列头上会显示过滤菜单按钮 | boolean | true |
| filters | <受控>过滤条中的过滤条件,例:`[{ name: 'Jom' }, 'OR', { name: 'Jim' }]``name` 为列的 `key``dataIndex` | any\[] | - |
| noFilters |
| filterBarPlaceholder | 过滤条的占位文本 | string | |


Expand Down Expand Up @@ -117,6 +118,7 @@ const columns = [{
| className | 列的 className | string | - |
| colSpan | 表头列合并,设置为 0 时,不渲染 | number | |
| dataIndex | 列数据在数据项中对应的 key,支持 `a.b.c` 的嵌套写法 | string | - |
| disableClick | 禁用点击列表筛选项 | boolean | false |
| filterDropdown | 可以自定义筛选菜单,此函数只负责渲染图层,需要自行编写各种交互 | ReactNode | - |
| filterDropdownVisible | 用于控制自定义筛选菜单是否可见 | boolean | - |
| filtered | 标识数据是否经过过滤,筛选图标会高亮 | boolean | false |
Expand Down
3 changes: 3 additions & 0 deletions components/table/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ColumnProps<T> {
onCell?: (record: T) => any;
onHeaderCell?: (props: ColumnProps<T>) => any;
hidden?: boolean;
disableClick?: boolean;
}

export interface TableComponents {
Expand Down Expand Up @@ -86,6 +87,7 @@ export interface TableRowSelection<T> {
export interface TableProps<T> {
prefixCls?: string;
dropdownPrefixCls?: string;
noFilter?: boolean;
rowSelection?: TableRowSelection<T>;
pagination?: TablePaginationConfig | false;
size?: 'default' | 'middle' | 'small';
Expand All @@ -104,6 +106,7 @@ export interface TableProps<T> {
onExpandedRowsChange?: (expandedRowKeys: string[] | number[]) => void;
onExpand?: (expanded: boolean, record: T) => void;
onChange?: (pagination: TablePaginationConfig | boolean, filters: string[], sorter: Object) => any;
onFilterSelectChange?: (item: any) => void;
onColumnFilterChange?: (item: any) => void;
loading?: boolean | SpinProps;
locale?: Object;
Expand Down
2 changes: 1 addition & 1 deletion components/table/util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function findColumnByFilterValue<T>(record: T, columns: ColumnProps<T>[],
const key = getColumnKey(col);
if (key) {
let value = (record as any)[key];
if (value) {
if (value && (typeof value !== 'object')) {
value = value.toString();
if (value.toLowerCase().indexOf(inputValue.toLowerCase()) !== -1) {
return true;
Expand Down
5 changes: 5 additions & 0 deletions components/tag/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
&:not(&-checked):hover {
color: @primary-color;
}
&,
a,
a:hover {
color: #000;
}
&:active,
&-checked {
color: #fff;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "choerodon-ui",
"version": "0.4.1",
"version": "0.4.2",
"title": "Choerodon UI",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "",
Expand Down

0 comments on commit e7be829

Please sign in to comment.