Skip to content

Commit

Permalink
Merge pull request #40 from binjie09/master
Browse files Browse the repository at this point in the history
update 0.5.3
  • Loading branch information
devane001 committed Mar 22, 2019
2 parents f4d2d77 + e11f17b commit 9ef39b2
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 13 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ timeline: true
* 主版本号:含有破坏性更新和新特性,不在发布周期内。

---
## 0.5.3

`2018-03-20`

- 💄 `Input`: Input输入到达字符限制时显示提示。
- 🌟 `Modal`: Modal添加disableOk和disableCancel属性。
- 🌟 `TreeNode`: TreeNode添加wrapper属性。
- 🌟 `Icon`: 增加新的图标。
- 🌟 `IconSelect`: 增加showAll属性。

## 0.5.2

`2018-02-22`
Expand Down
23 changes: 18 additions & 5 deletions components/icon-select/IconSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const icons = Icon.icons;

export interface IconSelectProps extends SelectProps {
prefix?: string;
showAll?: boolean;
}
export interface IconSelectState {
current: number,
Expand All @@ -25,6 +26,7 @@ export default class IconSelect extends React.Component<IconSelectProps, IconSel
filter: true,
showArrow: false,
showCheckAll: false,
showAll: false,
};
icons: any;
rcSelect: React.ReactNode | null;
Expand All @@ -44,13 +46,24 @@ export default class IconSelect extends React.Component<IconSelectProps, IconSel
}

initIcon(current: number = 1, pageSize: number = 20, filterValue: string = '') {
const { showAll } = this.props;
const minIndex = (current - 1) * pageSize;
const maxIndex = current * pageSize;
let items = icons.favorite;
if (filterValue) {
items = icons.favorite.filter((name) => {
return name.toLowerCase().indexOf(filterValue.toLowerCase()) !== -1;
});
let items;
if (showAll) {
items = icons.default;
if (filterValue) {
items = icons.favorite.filter((name) => {
return name.toLowerCase().indexOf(filterValue.toLowerCase()) !== -1;
});
}
} else {
items = icons.favorite;
if (filterValue) {
items = icons.favorite.filter((name) => {
return name.toLowerCase().indexOf(filterValue.toLowerCase()) !== -1;
});
}
}
const total = items.length || 0;
const currentData = items.filter((name, index) => {
Expand Down
4 changes: 4 additions & 0 deletions components/icon/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ const icons = {
favorite: ['routeroutline', 'role_tag', 'hdr_strong', 'bar_chart', 'reply', 'class', 'manage_project', 'transfer_within_a_station', 'room_service', 'publish2', 'laptop_mac', 'developer_board', 'CI', 'content_copy', 'book', 'wrench', 'view_day', 'date_range', 'extension', 'filter_vintage', 'hdr_weak', 'dashboard', 'Operation-monitoring', 'application_model', 'folder_shared', 'delete', 'develop_console', 'agile', 'merge_request', 'task_schedule', 'link', 'settings', 'baseline-drag_indicator', 'apps', 'account_box', 'test_planning', 'donut_small', 'agile_fault', 'person', 'view_list', 'directions_run', 'instance_outline', 'password', 'inmail_template', 'error', 'vpn_key', 'classname', 'assignment_ind', 'contact_mail', 'work_log', 'speaker_notes', 'format_list_numbered', 'shuffle', 'API', 'linear_scale', 'device_hub', 'saga_define', 'devops_chart', 'table_chart', 'settings_input_composite', 'event_available', 'flip_to_back', 'kubernetes', 'notifications', 'hearing', 'authority', 'cluster', 'public', 'devops', 'account_balance', 'mail_set', 'person_add', 'record_test', 'folder', 'usermap', 'assignment_late', 'micro', 'secret', 'appmarket', 'brightness_low', 'IAM', 'test', 'message', 'project', 'local_offer', 'domain', 'router', 'settings_applications', 'style', 'polymer', 'manage_organization', 'microservice', 'description', 'jsfiddle', 'manage_person', 'transform', 'subject', 'compare_arrows', 'branch', 'root', 'auto_test', 'strikethrough_s', 'center', 'widgets', 'volume_up', 'link2', 'Development-monitoring', 'whatshot', 'message_notification', 'insert_drive_file', 'accessibility', 'youtube_searched_for', 'test_execution', 'baseline-list_alt', 'cloud_upload', 'APItest', 'build', 'assignment', 'language', 'home', 'favorite', 'filter_drama', 'flare', 'folder_special', 'tag_faces', 'lightbulb_outline', 'loyalty', 'star_border'],

default: [
'project_program', 'agile-feature', 'baseline-vertical_split',
'number', 'popup_selection', 'toggle_off', 'project_program_analyze', 'application_-general',
'deploy_list', 'auto_complete', 'combo_box', 'data_source', 'multistage_combo_box',
'API_management', 'API_market', 'API_publish', 'API_subscription', 'APIS', 'auto_deploy',
'sync_records', 'sync_user', 'test-case', 'test-automation', 'token', 'change_size',
'add_crt', 'add_branch', 'line', 'secret', 'recover', 'table', 'test_execution', 'test_progress',
'test_record', 'execution_schedule', 'cluster', 'kubernetes_cluster', 'disconnect',
Expand Down
2 changes: 1 addition & 1 deletion components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export default class Input extends React.Component<InputProps, any> {
getLengthInfo() {
const { prefixCls, maxLength } = this.props;
const { inputLength, showLengthInfo } = this.state;
return maxLength && showLengthInfo ? (
return (maxLength && showLengthInfo) || (maxLength && maxLength > 0 && inputLength === maxLength ) ? (
<span className={`${prefixCls}-icon`}>
<span className={`${prefixCls}-icon-copy ${prefixCls}-length-info`}>{`${inputLength}/${maxLength}`}</span>
</span>
Expand Down
14 changes: 12 additions & 2 deletions components/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export interface ModalProps {
visible?: boolean;
/** 确定按钮 loading*/
confirmLoading?: boolean;
/** ok按钮是否禁用 loading*/
disableOk?: boolean;
/** Cancel按钮是否禁用 loading*/
disableCancel?: boolean;
/** 标题*/
title?: React.ReactNode | string;
/** 是否显示右上角的关闭按钮*/
Expand Down Expand Up @@ -77,6 +81,8 @@ export interface ModalFuncProps {
transitionName?: string;
funcType?: ButtonFuncType;
confirmLoading?: boolean,
disableOk?: boolean,
disableCancel?: boolean,
footer?: React.ReactNode;
}

Expand Down Expand Up @@ -105,6 +111,8 @@ export default class Modal extends React.Component<ModalProps, {}> {
transitionName: 'zoom',
maskTransitionName: 'fade',
confirmLoading: false,
disableOk: false,
disableCancel: false,
visible: false,
okType: 'primary',
center: false,
Expand Down Expand Up @@ -161,11 +169,11 @@ export default class Modal extends React.Component<ModalProps, {}> {
}

renderFooter = (locale: ModalLocale) => {
const { okText, okType, cancelText, confirmLoading, funcType } = this.props;
const { okText, okType, cancelText, confirmLoading, funcType, disableOk, disableCancel } = this.props;
return (
<div>
<Button
disabled={confirmLoading}
disabled={disableCancel || confirmLoading}
onClick={this.handleCancel}
funcType={funcType}
>
Expand All @@ -174,8 +182,10 @@ export default class Modal extends React.Component<ModalProps, {}> {
<Button
type={okType}
funcType={funcType}
disabled={disableOk}
loading={confirmLoading}
onClick={this.handleOk}

>
{okText || locale.okText}
</Button>
Expand Down
2 changes: 2 additions & 0 deletions components/modal/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ title: Modal
| maskStyle | 遮罩样式 | object | {} |
| okText | 确认按钮文字 | string | 确定 |
| okType | 确认按钮类型 | string | primary |
| disableOk | Ok按钮是否禁用 | boolean | `false` |
| disableCancel | Cancel按钮是否禁用 | boolean | `false` |
| style | 可用于设置浮层的样式,调整浮层位置等 | object | - |
| title | 标题 | string\|ReactNode ||
| visible | 对话框是否可见 | boolean ||
Expand Down
11 changes: 8 additions & 3 deletions components/rc-components/tree/TreeNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class TreeNode extends React.Component {
className: PropTypes.string,
root: PropTypes.object,
onSelect: PropTypes.func,
wrapper: PropTypes.func,

// By parent
expanded: PropTypes.bool,
Expand Down Expand Up @@ -536,6 +537,12 @@ class TreeNode extends React.Component {

let $children;
if (expanded) {
let treeNodes = React.Children.map(nodeList, (node, index) => (
renderTreeNode(node, index, pos)
));
if (this.props.wrapper) {
treeNodes = this.props.wrapper(treeNodes);
}
$children = (
<ul
className={classNames(
Expand All @@ -544,9 +551,7 @@ class TreeNode extends React.Component {
)}
data-expanded={expanded}
>
{React.Children.map(nodeList, (node, index) => (
renderTreeNode(node, index, pos)
))}
{treeNodes}
</ul>
);
}
Expand Down
2 changes: 1 addition & 1 deletion components/select/demo/iconselect.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ Icon Select.
import { IconSelect } from 'choerodon-ui';

ReactDOM.render(
<IconSelect style={{ width: '300px' }} defaultValue={['root']} />,
<IconSelect showAll style={{ width: '300px' }} defaultValue={['root']} />,
mountNode);
````
58 changes: 58 additions & 0 deletions components/style/core/iconfont.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,64 @@
height: @icon-font-size-sm;
}
}
.@{iconfont-css-prefix}-baseline-vertical_split:before {
content: "\e9e9";
}
.@{iconfont-css-prefix}-agile-feature:before {
content: "\e9ea";
}
.@{iconfont-css-prefix}-application_-general:before {
content: "\e9e7";
}
.@{iconfont-css-prefix}-project_program:before {
content: "\e9e8";
}
.@{iconfont-css-prefix}-auto_complete:before {
content: "\e9e0";
}
.@{iconfont-css-prefix}-combo_box:before {
content: "\e9e1";
}
.@{iconfont-css-prefix}-data_source:before {
content: "\e9e2";
}
.@{iconfont-css-prefix}-multistage_combo_box:before {
content: "\e9e3";
}
.@{iconfont-css-prefix}-number:before {
content: "\e9e4";
}
.@{iconfont-css-prefix}-popup_selection:before {
content: "\e9e5";
}
.@{iconfont-css-prefix}-toggle_off:before {
content: "\e9e6";
}
.@{iconfont-css-prefix}-project_program_analyze:before {
content: "\e9df";
}
.@{iconfont-css-prefix}-API_management:before {
content: "\e9d8";
}
.@{iconfont-css-prefix}-API_market:before {
content: "\e9d9";
}
.@{iconfont-css-prefix}-API_publish:before {
content: "\e9da";
}
.@{iconfont-css-prefix}-API_subscription:before {
content: "\e9db";
}
.@{iconfont-css-prefix}-APIS:before {
content: "\e9dc";
}
.@{iconfont-css-prefix}-auto_deploy:before {
content: "\e9dd";
}
.@{iconfont-css-prefix}-deploy_list:before {
content: "\e9de";
}

// 02.19

.@{iconfont-css-prefix}-sync_records:before {
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.5.2",
"version": "0.5.3",
"title": "Choerodon UI",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "",
Expand Down

0 comments on commit 9ef39b2

Please sign in to comment.