Skip to content

Commit 4c669a5

Browse files
fix(module:cascader): update position when click menu item (#7306)
* docs: fix typo * docs(module:skeleton): fix typo * docs(module:tooltip): fix typo * fix(module:cascader): update position when click menu item * fix(module:cascader): fix typo * fix(module:cascader): use function reposition * fix(module:cascader): detectChanges before reposition * docs(module:cascader): clean up console
1 parent bea9cf8 commit 4c669a5

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

components/cascader/cascader.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,9 @@ export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit,
376376
// These operations would not mutate data.
377377
this.checkChildren();
378378
this.setDisplayLabel();
379+
this.cdr.detectChanges();
379380
this.reposition();
380381
this.setDropdownStyles();
381-
382-
this.cdr.markForCheck();
383382
});
384383

385384
srv.$loading.pipe(takeUntil(this.destroy$)).subscribe(loading => {
@@ -597,6 +596,7 @@ export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit,
597596
if (option && option.disabled) {
598597
return;
599598
}
599+
600600
this.el.focus();
601601
this.inSearchingMode
602602
? this.cascaderService.setSearchOptionSelected(option as NzCascaderSearchOption)
@@ -721,6 +721,7 @@ export class NzCascaderComponent implements NzCascaderComponentAsSource, OnInit,
721721
if (this.overlay && this.overlay.overlayRef && this.menuVisible) {
722722
Promise.resolve().then(() => {
723723
this.overlay.overlayRef.updatePosition();
724+
this.cdr.markForCheck();
724725
});
725726
}
726727
}

components/cascader/cascader.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ export class NzCascaderService implements OnDestroy {
173173
if (option.disabled) {
174174
return;
175175
}
176-
177176
this.activatedOptions[columnIndex] = option;
178177
this.trackAncestorActivatedOptions(columnIndex);
179178
this.dropBehindActivatedOptions(columnIndex);

components/core/overlay/overlay-position.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export const DEFAULT_CASCADER_POSITIONS = [
4444
POSITION_MAP.bottomLeft,
4545
POSITION_MAP.bottomRight,
4646
POSITION_MAP.topLeft,
47-
POSITION_MAP.topRight
47+
POSITION_MAP.topRight,
48+
POSITION_MAP.topCenter,
49+
POSITION_MAP.bottomCenter
4850
];
4951

5052
export const DEFAULT_MENTION_TOP_POSITIONS = [

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
2727
| `[nzTooltipArrowPointAtCenter]` | 箭头指向锚点的中心 | `boolean` | `false` |
2828
| `[nzTooltipTitle]` | 提示文字 | `string \| TemplateRef<void>` | - |
2929
| `[nzTooltipTitleContext]` | 提示文字模板上下文 | `object` | - |
30-
| `[nzTooltipTrigger]` | 触发行为,可选 `hover/focus/click`,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'hover'` |
30+
| `[nzTooltipTrigger]` | 触发行为,可选 `hover` \| `focus` \| `click`,为 `null` 时不响应光标事件 | `'click' \| 'focus' \| 'hover' \| null` | `'hover'` |
3131
| `[nzTooltipPlacement]` | 气泡框位置 | `'top' \| 'left' \| 'right' \| 'bottom' \| 'topLeft' \| 'topRight' \| 'bottomLeft' \| 'bottomRight' \| 'leftTop' \| 'leftBottom' \| 'rightTop' \| 'rightBottom' \| Array<string>` | `'top'` |
3232
| `[nzTooltipColor]` | 背景颜色 | `string` | - |
3333
| `[nzTooltipOrigin]` | 气泡框定位元素 | `ElementRef` | - |

0 commit comments

Comments
 (0)