Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module:cascader): update position when click menu item #7306

Merged
merged 9 commits into from Apr 21, 2022
5 changes: 5 additions & 0 deletions components/cascader/cascader.component.ts
Expand Up @@ -587,10 +587,15 @@ export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit,
if (option && option.disabled) {
return;
}

this.el.focus();
this.inSearchingMode
? this.cascaderService.setSearchOptionSelected(option as NzCascaderSearchOption)
: this.cascaderService.setOptionActivated(option, columnIndex, true);
setTimeout(() => {
// 每次点击,等渲染完成(过渡时间),重新定位
this.overlay.overlayRef.updatePosition();
}, 10);
simplejason marked this conversation as resolved.
Show resolved Hide resolved
}

onClickOutside(event: MouseEvent): void {
Expand Down
4 changes: 3 additions & 1 deletion components/core/overlay/overlay-position.ts
Expand Up @@ -44,7 +44,9 @@ export const DEFAULT_CASCADER_POSITIONS = [
POSITION_MAP.bottomLeft,
POSITION_MAP.bottomRight,
POSITION_MAP.topLeft,
POSITION_MAP.topRight
POSITION_MAP.topRight,
POSITION_MAP.topCenter,
POSITION_MAP.bottomCenter
];

export const DEFAULT_MENTION_TOP_POSITIONS = [
Expand Down
2 changes: 1 addition & 1 deletion components/tooltip/doc/index.zh-CN.md
Expand Up @@ -27,7 +27,7 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
| `[nzTooltipArrowPointAtCenter]` | 箭头指向锚点的中心 | `boolean` | `false` |
| `[nzTooltipTitle]` | 提示文字 | `string \| TemplateRef<void>` | - |
| `[nzTooltipTitleContext]` | 提示文字模板上下文 | `object` | - |
| `[nzTooltipTrigger]` | 触发行为,可选 `hover/focus/click`,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'hover'` |
| `[nzTooltipTrigger]` | 触发行为,可选 `hover` \| `focus` \| `click`,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'hover'` |
| `[nzTooltipPlacement]` | 气泡框位置 | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' \| 'leftTop' \| 'leftBottom' \| 'rightTop' \| 'rightBottom' \| Array<string>` | `'top'` |
| `[nzTooltipColor]` | 背景颜色 | `string` | - |
| `[nzTooltipOrigin]` | 气泡框定位元素 | `ElementRef` | - |
Expand Down