Skip to content

Commit 5a753fd

Browse files
authored
Merge branch 'master' into provenance
2 parents 8fa18bf + df15727 commit 5a753fd

12 files changed

+85
-22
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,12 @@ To keep our build dependencies local we use npm scripts to run our webpack, gulp
163163

164164
## Code of Conduct
165165
Read our code of conduct [here](./.github/CODE_OF_CONDUCT.md)
166+
167+
## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
168+
169+
This package uses IBM Telemetry to collect metrics data. By installing this
170+
package as a dependency you are agreeing to telemetry collection. To opt out,
171+
see
172+
[Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
173+
For more information on the data being collected, please see the
174+
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"commit": "git-cz -s",
1818
"ng": "ng",
1919
"ng:build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build",
20-
"prepare": "husky install"
20+
"prepare": "husky install",
21+
"postinstall": "ibmtelemetry --config=telemetry.yml"
2122
},
2223
"release": {
2324
"pkgRoot": "dist",
@@ -140,8 +141,8 @@
140141
"dependencies": {
141142
"@carbon/icon-helpers": "10.37.0",
142143
"@carbon/icons": "11.14.0",
143-
"@carbon/telemetry": "0.1.0",
144144
"@carbon/utils-position": "1.1.4",
145+
"@ibm/telemetry-js": "^1.2.1",
145146
"flatpickr": "4.6.13",
146147
"tslib": "2.3.0"
147148
}

src/popover/popover.directive.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ChangeDetectorRef,
23
Directive,
34
EventEmitter,
45
HostBinding,
@@ -95,6 +96,8 @@ export class PopoverContainer {
9596
"left" | "left-bottom" | "left-top" |
9697
"right" | "right-bottom" | "right-top" = "bottom";
9798

99+
constructor(private changeDetectorRef: ChangeDetectorRef) {}
100+
98101
handleChange(open: boolean, event: Event) {
99102
if (this.isOpen !== open) {
100103
this.isOpenChange.emit(open);
@@ -106,5 +109,6 @@ export class PopoverContainer {
106109
this.onClose.emit(event);
107110
}
108111
this.isOpen = open;
112+
this.changeDetectorRef.markForCheck();
109113
}
110114
}

src/table/cell/table-radio.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "@angular/core";
77
import { I18n } from "carbon-components-angular/i18n";
88
import { TableItem } from "../table-item.class";
9+
import { TableRow } from "../table-row.class";
910
import { Observable } from "rxjs";
1011

1112
@Component({
@@ -17,6 +18,7 @@ import { Observable } from "rxjs";
1718
[attr.aria-label]="getLabel() | i18nReplace:getSelectionLabelValue(row) | async"
1819
[ariaLabel]="getLabel() | i18nReplace:getSelectionLabelValue(row) | async"
1920
[checked]="selected"
21+
[disabled]="disabled"
2022
(change)="change.emit()">
2123
</cds-radio>
2224
`
@@ -35,6 +37,10 @@ export class TableRadio {
3537
return this._label.value;
3638
}
3739

40+
get disabled(): boolean {
41+
return this.row ? !!(this.row as TableRow).disabled : false;
42+
}
43+
3844
/**
3945
* Used to populate the row selection checkbox label with a useful value if set.
4046
*

src/toggletip/toggletip.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,11 @@ describe("Toggletip", () => {
102102
fixture.detectChanges();
103103
expect(toggletipEl.componentInstance.isOpen).toBeFalsy();
104104
}));
105+
106+
it("should markForCheck given the changeDetectorRef is set", () => {
107+
const spy = spyOn(toggletipEl.componentInstance.ref, "markForCheck");
108+
buttonEl.nativeElement.click();
109+
fixture.detectChanges();
110+
expect(spy).toHaveBeenCalled();
111+
});
105112
});

src/toggletip/toggletip.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import {
22
AfterViewInit,
3+
ChangeDetectionStrategy,
4+
ChangeDetectorRef,
35
Component,
46
ContentChild,
57
ElementRef,
@@ -23,6 +25,7 @@ import { ToggletipButton } from "./toggletip-button.directive";
2325
*/
2426
@Component({
2527
selector: "cds-toggletip, ibm-toggletip",
28+
changeDetection: ChangeDetectionStrategy.OnPush,
2629
template: `
2730
<ng-content select="[cdsToggletipButton]"></ng-content>
2831
<cds-popover-content>
@@ -42,8 +45,8 @@ export class Toggletip extends PopoverContainer implements AfterViewInit {
4245

4346
documentClick = this.handleFocusOut.bind(this);
4447

45-
constructor(private hostElement: ElementRef, private renderer: Renderer2) {
46-
super();
48+
constructor(private hostElement: ElementRef, private renderer: Renderer2, private ref: ChangeDetectorRef) {
49+
super(ref);
4750
this.highContrast = true;
4851
this.dropShadow = false;
4952
}

src/tooltip/definition-tooltip.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,11 @@ describe("Definition tooltip", () => {
5151
fixture.detectChanges();
5252
expect(tooltipEl.componentInstance.isOpenChange.emit).toHaveBeenCalled();
5353
});
54+
55+
it("should markForCheck given the changeDetectorRef is set", () => {
56+
const spy = spyOn(tooltipEl.componentInstance.ref, "markForCheck");
57+
buttonEl.triggerEventHandler("click", null);
58+
fixture.detectChanges();
59+
expect(spy).toHaveBeenCalled();
60+
});
5461
});

src/tooltip/definition-tooptip.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import {
2+
ChangeDetectionStrategy,
3+
ChangeDetectorRef,
24
Component,
35
HostListener,
46
Input,
@@ -17,6 +19,7 @@ import { PopoverContainer } from "carbon-components-angular/popover";
1719
*/
1820
@Component({
1921
selector: "cds-tooltip-definition, ibm-tooltip-definition",
22+
changeDetection: ChangeDetectionStrategy.OnPush,
2023
template: `
2124
<button
2225
class="cds--definition-term"
@@ -57,8 +60,8 @@ export class TooltipDefinition extends PopoverContainer {
5760
*/
5861
@Input() description: string | TemplateRef<any>;
5962

60-
constructor() {
61-
super();
63+
constructor(private ref: ChangeDetectorRef) {
64+
super(ref);
6265
this.highContrast = true;
6366
this.dropShadow = false;
6467
}

src/tooltip/tooltip.component.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,11 @@ describe("Tooltip", () => {
6868
expect(tooltipEl.componentInstance.isOpenChange.emit).toHaveBeenCalled();
6969
expect(tooltipEl.componentInstance.isOpen).toBeFalsy();
7070
});
71+
72+
it("should markForCheck given the changeDetectorRef is set", () => {
73+
const spy = spyOn(tooltipEl.componentInstance.ref, "markForCheck");
74+
tooltipEl.nativeElement.dispatchEvent(new Event("focusin"));
75+
fixture.detectChanges();
76+
expect(spy).toHaveBeenCalled();
77+
});
7178
});

0 commit comments

Comments
 (0)