Skip to content

Commit

Permalink
feat(module: popover): feat add customClass for customer (#129)
Browse files Browse the repository at this point in the history
* feat(module: popover): feat add customCls for customer

* feat(module: popover): feat modify className for customer

* docs(module:popover): update docs className descrpition (#120)
  • Loading branch information
Guoyuanqiang authored and 3fuyu committed Dec 3, 2018
1 parent 5f24260 commit 26bbe53
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions components/popover/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Properties | Descrition | Type | Default
| mask | Whether to display the mask background layer | Boolean | false |
| overlay | Popup layer content | TemplateRef | - |
| onSelect | when an option is selected | (node: any, index?: number): void | - |
| className | Custom popover class, e.g. "am-popover-${your className}" | string | am-popover |

### Popover.Item

Expand Down
1 change: 1 addition & 0 deletions components/popover/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ subtitle: 气泡
| mask | 是否显示遮罩背景层 | Boolean | false |
| overlay | 弹出层内容 | TemplateRef | - |
| onSelect | 选中某选项时的回调函数 | (node: any, index?: number): void | - |
| className | 传入自定义class, e.g. "am-popover-${your className}" | string | am-popover |

### Popover.Item

Expand Down
2 changes: 2 additions & 0 deletions components/popover/popover-options.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ export interface PopoverOptionsInterface {
visible?: boolean;
placement?: string;
appendToBody?: boolean;
className?: string;
}

export class PopoverOptions implements PopoverOptionsInterface {
showArrow: boolean = false;
mask: boolean = false;
placement: string = 'bottom';
appendToBody: boolean = false;
className: string = '';
}
3 changes: 2 additions & 1 deletion components/popover/popover.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class PopoverComponent implements OnInit, AfterViewInit {
};
this.popoverCls = {
[`${this.defaultProps.prefixCls}`]: true,
[`${this.defaultProps.prefixCls}-placement-${this.options.placement}`]: true
[`${this.defaultProps.prefixCls}-placement-${this.options.placement}`]: true,
[`${this.defaultProps.prefixCls}-${this.options.className}`]: true
};
}

Expand Down
5 changes: 4 additions & 1 deletion components/popover/popover.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class PopoverDirective implements OnInit, OnChanges, OnDestroy {
onSelect: EventEmitter<any> = new EventEmitter();
@Input()
appendToBody: boolean;
@Input()
className: string;

@HostListener('click')
togglePopover(): void {
Expand Down Expand Up @@ -162,7 +164,8 @@ export class PopoverDirective implements OnInit, OnChanges, OnDestroy {
'showArrow',
'placement',
'appendToBody',
'overlay'
'overlay',
'className'
];
optionalParams.forEach(param => {
if (typeof this[param] !== 'undefined') {
Expand Down

0 comments on commit 26bbe53

Please sign in to comment.