Skip to content

Commit

Permalink
feat(module: checkboxitem&radioitem): support wrap API (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherspy committed Apr 29, 2019
1 parent 9c39051 commit db8a6c8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/checkbox/checkbox-item.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ListItem [className]="'am-checkbox-item ' + (disabled ? 'am-checkbox-item-disabled' : '')"
[disabled]="disabled"
[thumb]="checkbox"
[wrap]="wrap"
(onClick)="onCheckboxClick($event)"
>
<ng-content></ng-content>
Expand Down
2 changes: 2 additions & 0 deletions components/checkbox/checkbox-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class CheckboxItem implements ControlValueAccessor {
@Input()
value: string;
@Input()
wrap: boolean = false;
@Input()
get disabled(): boolean {
return this._disabled;
}
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The encapsulation about `Checkbox` based on `ListItem`, the property `thumb` of
| value | value | String | - |
| ngModel | whether is checked now, double binding | Boolean | <span> false </span> |
| disabled | whether is been disabled | Boolean | false |
| wrap | Whether to wrap long texts, otherwise it will be hidden by default. | Boolean | `false` |
| onChange | callback when check status is changed | (name: string, value: string, checked: boolean) => void | - |

### AgreeItem
Expand Down
1 change: 1 addition & 0 deletions components/checkbox/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ subtitle: 复选框
| value | value | String | - |
| ngModel | 指定当前是否选中,可双向绑定 | Boolean | false |
| disabled | 是否禁用 | Boolean | false |
| wrap | 是否换行,默认情况下,文字超长会被隐藏, | Boolean | `false` |
| onChange | change 事件触发的回调函数 | (name: string, value: string, checked: boolean) => void ||

### AgreeItem
Expand Down
3 changes: 2 additions & 1 deletion components/radio/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ Properties | Descrition | Type | Default
-----------|------------|------|--------
| name | name | String | - |
| value | value | String | - |
| disabled | whether disabled | Boolean | false |
| disabled | whether disabled | Boolean | false |
| wrap | Whether to wrap long texts, otherwise it will be hidden by default. | Boolean | `false` |
1 change: 1 addition & 0 deletions components/radio/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ subtitle: 单选框
| name | name | String ||
| value | value | String ||
| disabled | 禁用 | Boolean | false |
| wrap | 是否换行,默认情况下,文字超长会被隐藏, | Boolean | `false` |
1 change: 1 addition & 0 deletions components/radio/radio-item.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ListItem [className]="'am-radio-item ' + (disabled ? 'am-radio-item-disabled' : '')"
[extra]="radio"
[disabled]="disabled"
[wrap]="wrap"
(onClick)="onRadioItemClick($event)"
>
<ng-content></ng-content>
Expand Down
2 changes: 2 additions & 0 deletions components/radio/radio-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export class RadioItem {
@Input()
value: string;
@Input()
wrap: boolean = false;
@Input()
get disabled(): boolean {
return this._disabled;
}
Expand Down
13 changes: 13 additions & 0 deletions components/radio/style/addon.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
@radioWarpPrefixCls: am-radio;
@listPrefixCls: am-list;

radioitem {
display: block;
}

.@{listPrefixCls} {
& .@{radioWarpPrefixCls}-item {
.@{listPrefixCls}-line {
.@{listPrefixCls}-content {
padding-right: 20px;
}
}
}
}

0 comments on commit db8a6c8

Please sign in to comment.