Skip to content

Commit 6d27073

Browse files
yuhengzhouzYuhengZhouYuheng Zhou
authored
feat(module:popconfirm): support popconfirm template context (#7989)
* 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>
1 parent 4301e95 commit 6d27073

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

components/popconfirm/doc/index.en-US.md

+2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
1919

2020
## API
2121

22+
2223
### [nz-popconfirm]:standalone
2324

2425
| Param | Description | Type | Default value |
2526
| ---------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
2627
| `[nzPopconfirmArrowPointAtCenter]` | Arrow point at center of the origin | `boolean` | `false` |
2728
| `[nzPopconfirmTitle]` | Title of the confirmation box | `string \| TemplateRef<void>` | - |
29+
| `[nzPopconfirmTitleContext]` | The context of confirmation box title | `object` | - |
2830
| `[nzPopconfirmTrigger]` | Popconfirm trigger mode. If set to `null` it would not be triggered | `'click' \| 'focus' \| 'hover' \| null` | `'click'` |
2931
| `[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'` |
3032
| `[nzPopconfirmOrigin]` | Origin of the popconfirm | `ElementRef` | - |

components/popconfirm/doc/index.zh-CN.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
2020

2121
## API
2222

23+
2324
### [nz-popconfirm]:standalone
2425

2526
| 参数 | 说明 | 类型 | 默认值 |
2627
| ---------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
2728
| `[nzPopconfirmArrowPointAtCenter]` | 箭头指向锚点的中心 | `boolean` | `false` |
2829
| `[nzPopconfirmTitle]` | 确认框的描述 | `string \| TemplateRef<void>` | - |
30+
| `[nzPopconfirmTitleContext]` | 确认框描述的上下文 | `object` | - |
2931
| `[nzPopconfirmTrigger]` | 触发行为,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'click'` |
3032
| `[nzPopconfirmPlacement]` | 气泡框位置 | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' \| 'leftTop' \| 'leftBottom' \| 'rightTop' \| 'rightBottom' \| Array<string>` | `'top'` |
3133
| `[nzPopconfirmOrigin]` | 气泡框定位元素 | `ElementRef` | - |

components/popconfirm/popconfirm.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
5959
@Input({ alias: 'nzPopconfirmArrowPointAtCenter', transform: booleanAttribute })
6060
override arrowPointAtCenter?: boolean;
6161
@Input('nzPopconfirmTitle') override title?: NzTSType;
62+
@Input('nzPopconfirmTitleContext') titleContext?: Object | null = null;
6263
@Input('nz-popconfirm') override directiveTitle?: NzTSType | null;
6364
@Input('nzPopconfirmTrigger') override trigger?: NzTooltipTrigger = 'click';
6465
@Input('nzPopconfirmPlacement') override placement?: string | string[] = 'top';
@@ -97,6 +98,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
9798
nzIcon: ['nzIcon', () => this.nzIcon],
9899
nzPopconfirmShowArrow: ['nzPopconfirmShowArrow', () => this.nzPopconfirmShowArrow],
99100
nzPopconfirmBackdrop: ['nzBackdrop', () => this.nzPopconfirmBackdrop],
101+
nzPopconfirmContext: ['nzTitleContext', () => this.titleContext],
100102
nzAutoFocus: ['nzAutoFocus', () => this.nzAutofocus],
101103
...super.getProxyPropertyMap()
102104
};
@@ -164,7 +166,7 @@ export class NzPopconfirmDirective extends NzTooltipBaseDirective {
164166
<div>
165167
<div class="ant-popover-inner-content">
166168
<div class="ant-popover-message">
167-
<ng-container *nzStringTemplateOutlet="nzTitle">
169+
<ng-container *nzStringTemplateOutlet="nzTitle; context: nzTitleContext">
168170
<ng-container *nzStringTemplateOutlet="nzIcon; let icon">
169171
<span class="ant-popover-message-icon">
170172
<span nz-icon [nzType]="icon || 'exclamation-circle'" nzTheme="fill"></span>

0 commit comments

Comments
 (0)