Skip to content

Commit 2b673f2

Browse files
authored
Merge branch 'master' into feat/add-telemetry-js-scope
2 parents 1f46244 + e26a9c9 commit 2b673f2

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/code-snippet/code-snippet.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ export enum SnippetType {
7474
</div>
7575
<div *ngIf="hasLeft" class="cds--snippet__overflow-indicator--left"></div>
7676
<div *ngIf="hasRight" class="cds--snippet__overflow-indicator--right"></div>
77-
<ng-container *ngTemplateOutlet="buttonTemplate"></ng-container>
77+
<ng-container *ngIf="!hideCopyButton;">
78+
<ng-container *ngTemplateOutlet="buttonTemplate"></ng-container>
79+
</ng-container>
7880
<button
7981
*ngIf="isExpandable"
8082
class="cds--btn cds--btn--ghost cds--btn--sm cds--snippet-btn--expand"

src/slider/slider.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { EventService } from "carbon-components-angular/utils";
2121
* Get started with importing the module:
2222
*
2323
* ```typescript
24-
* import { SkeletonModule } from 'carbon-components-angular';
24+
* import { SliderModule } from 'carbon-components-angular';
2525
* ```
2626
*
2727
* The simplest possible slider usage looks something like:

src/tooltip/tooltip.component.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import {
88
HostListener,
99
Input,
1010
NgZone,
11+
OnChanges,
1112
Renderer2,
13+
SimpleChanges,
1214
TemplateRef,
1315
ViewChild
1416
} from "@angular/core";
@@ -47,7 +49,7 @@ import { PopoverContainer } from "carbon-components-angular/popover";
4749
</span>
4850
`
4951
})
50-
export class Tooltip extends PopoverContainer implements AfterContentChecked {
52+
export class Tooltip extends PopoverContainer implements OnChanges, AfterContentChecked {
5153
static tooltipCount = 0;
5254

5355
@HostBinding("class.cds--tooltip") tooltipClass = true;
@@ -132,6 +134,34 @@ export class Tooltip extends PopoverContainer implements AfterContentChecked {
132134
return value instanceof TemplateRef;
133135
}
134136

137+
/**
138+
* Close the popover and reopen it with updated values without emitting an event
139+
* @param changes
140+
*/
141+
ngOnChanges(changes: SimpleChanges): void {
142+
// Close and reopen the popover, handle alignment/programmatic open/close
143+
const originalState = this.isOpen;
144+
this.handleChange(false);
145+
146+
// Ignore first change since content is not initialized
147+
if ((changes.autoAlign && !changes.autoAlign.firstChange)
148+
|| (changes.disabled && !changes.disabled.firstChange && !changes.disabled.currentValue)) {
149+
/**
150+
* When `disabled` is `true`, popover content node is removed. So when re-enabling `disabled`,
151+
* we manually update view so querySelector can detect the popover content node.
152+
* Otherwise, the position of the popover will be incorrect when autoAlign is enabled.
153+
*/
154+
this.changeDetectorRef.detectChanges();
155+
156+
// Reset the inline styles
157+
this.popoverContentRef = this.elementRef.nativeElement.querySelector(".cds--popover-content");
158+
this.popoverContentRef.setAttribute("style", "");
159+
this.caretRef = this.elementRef.nativeElement.querySelector("span.cds--popover-caret");
160+
}
161+
162+
this.handleChange(originalState);
163+
}
164+
135165
/**
136166
* Check for any changes in the projected content & apply accessibility attribute if needed
137167
*/

0 commit comments

Comments
 (0)