Skip to content

Commit

Permalink
feat(module: imagepicker): add capture&disableDelete API (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisherspy authored May 5, 2019
1 parent 8503f67 commit be87325
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/image-picker/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ Properties | Descrition | Type | Default
| selectable | whether to show selector button | boolean | true |
| multiple | whether support choose multi images at once | boolean | false |
| accept | File type accept | string | image/* |
| length | Number of images in line | number | 4 |
| length | Number of images in line | number | 4 |
| capture | Image capture setting, please refer to the description of capture in [MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input) | boolean \| string | false |
| disableDelete | whether to hide delete icon | boolean | false |
2 changes: 2 additions & 0 deletions components/image-picker/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ subtitle: 图片选择器
| multiple | 是否支持多选 | boolean | false |
| accept | 图片类型 | string | image/* |
| length | 单行的图片数量 | number | 4 |
| capture | 图片捕获设置, 具体请参考[MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input)中关于capture的说明 | boolean \| string | false |
| disableDelete | 是否隐藏删除按钮 | boolean | false |
2 changes: 2 additions & 0 deletions components/image-picker/image-picker.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<FlexItem *ngFor="let item of rowItem;let j =index;">
<div *ngIf="item && 'img' === item.type && item.backgroundImage" class="{{prefixCls}}-item">
<div role="button"
*ngIf="!disableDelete"
aria-label="Click and Remove this image"
class="{{prefixCls}}-item-remove"
(click)="removeImage(i * length + j)"
Expand All @@ -24,6 +25,7 @@
type="file"
[accept]="accept"
[multiple]="multiple"
[attr.capture]="capture ? capture : null"
(change)="fileChange($event)"
/>
</div>
Expand Down
2 changes: 2 additions & 0 deletions components/image-picker/image-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export class ImagePicker {
@ViewChild('fileSelectorInput', { read: ViewContainerRef })
private _fileSelectorInput: ViewContainerRef;

@Input() capture: boolean | string = false;
@Input() disableDelete: boolean = false;
@Input()
get files() {
return this._files;
Expand Down

0 comments on commit be87325

Please sign in to comment.