Skip to content

Commit

Permalink
feat(module:popconfirm): support popconfirm template context (#7989)
Browse files Browse the repository at this point in the history
* feat(module:popconfirm): support popconfirm template context

* feat(module:popconfirm): update doc

* feat(module:popconfirm): fix lint in doc

* feat(module:popconfirm): fix lint in doc

---------

Co-authored-by: YuhengZhou <YuhengZhou@thoughtworks.com>
Co-authored-by: Yuheng Zhou <yuhengzhou@YuhengdeMacBook-Pro.local>
  • Loading branch information
3 people committed Jul 15, 2024
1 parent 4301e95 commit 6d27073
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/popconfirm/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';

## API


### [nz-popconfirm]:standalone

| Param | Description | Type | Default value |
| ---------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `[nzPopconfirmArrowPointAtCenter]` | Arrow point at center of the origin | `boolean` | `false` |
| `[nzPopconfirmTitle]` | Title of the confirmation box | `string \| TemplateRef<void>` | - |
| `[nzPopconfirmTitleContext]` | The context of confirmation box title | `object` | - |
| `[nzPopconfirmTrigger]` | Popconfirm trigger mode. If set to `null` it would not be triggered | `'click' \| 'focus' \| 'hover' \| null` | `'click'` |
| `[nzPopconfirmPlacement]` | The position of the popconfirm relative to the target | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' \| 'leftTop' \| 'leftBottom' \| 'rightTop' \| 'rightBottom' \| Array<string>` | `'top'` |
| `[nzPopconfirmOrigin]` | Origin of the popconfirm | `ElementRef` | - |
Expand Down
2 changes: 2 additions & 0 deletions components/popconfirm/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';

## API


### [nz-popconfirm]:standalone

| 参数 | 说明 | 类型 | 默认值 |
| ---------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `[nzPopconfirmArrowPointAtCenter]` | 箭头指向锚点的中心 | `boolean` | `false` |
| `[nzPopconfirmTitle]` | 确认框的描述 | `string \| TemplateRef<void>` | - |
| `[nzPopconfirmTitleContext]` | 确认框描述的上下文 | `object` | - |
| `[nzPopconfirmTrigger]` | 触发行为,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'click'` |
| `[nzPopconfirmPlacement]` | 气泡框位置 | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' \| 'leftTop' \| 'leftBottom' \| 'rightTop' \| 'rightBottom' \| Array<string>` | `'top'` |
| `[nzPopconfirmOrigin]` | 气泡框定位元素 | `ElementRef` | - |
Expand Down
4 changes: 3 additions & 1 deletion components/popconfirm/popconfirm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
@Input({ alias: 'nzPopconfirmArrowPointAtCenter', transform: booleanAttribute })
override arrowPointAtCenter?: boolean;
@Input('nzPopconfirmTitle') override title?: NzTSType;
@Input('nzPopconfirmTitleContext') titleContext?: Object | null = null;
@Input('nz-popconfirm') override directiveTitle?: NzTSType | null;
@Input('nzPopconfirmTrigger') override trigger?: NzTooltipTrigger = 'click';
@Input('nzPopconfirmPlacement') override placement?: string | string[] = 'top';
Expand Down Expand Up @@ -97,6 +98,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
nzIcon: ['nzIcon', () => this.nzIcon],
nzPopconfirmShowArrow: ['nzPopconfirmShowArrow', () => this.nzPopconfirmShowArrow],
nzPopconfirmBackdrop: ['nzBackdrop', () => this.nzPopconfirmBackdrop],
nzPopconfirmContext: ['nzTitleContext', () => this.titleContext],
nzAutoFocus: ['nzAutoFocus', () => this.nzAutofocus],
...super.getProxyPropertyMap()
};
Expand Down Expand Up @@ -164,7 +166,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
<div>
<div class="ant-popover-inner-content">
<div class="ant-popover-message">
<ng-container *nzStringTemplateOutlet="nzTitle">
<ng-container *nzStringTemplateOutlet="nzTitle; context: nzTitleContext">
<ng-container *nzStringTemplateOutlet="nzIcon; let icon">
<span class="ant-popover-message-icon">
<span nz-icon [nzType]="icon || 'exclamation-circle'" nzTheme="fill"></span>
Expand Down

0 comments on commit 6d27073

Please sign in to comment.