Skip to content

Commit f23d604

Browse files
authored
Merge Angular 20 innerStyle patch release (#317)
Adds the non-conflicting innerStyle input, retains the deprecated style compatibility alias, and prepares 20.0.2.
2 parents 1b259b9 + f41ee0d commit f23d604

7 files changed

Lines changed: 33 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [20.0.2] - 2026-08-20
4+
### Fixed
5+
- Added `[innerStyle]` as the preferred plot container styling input while
6+
retaining `[style]` as a deprecated compatibility alias.
7+
8+
39
## [20.0.1] - 2026-08-20
410
### Fixed
511
- Exported the documented CDN/window modules and Plotly public types.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,19 @@ For a full description of Plotly chart types and attributes see the following re
122122
| `(error)` | `Function(err)` | `undefined` | Callback executed when a plotly.js API method rejects |
123123
| `[divId]` | `string` | `undefined` | id assigned to the `<div>` into which the plot is rendered. |
124124
| `[className]` | `string` | `undefined` | applied to the `<div>` into which the plot is rendered |
125-
| `[style]` | `Object` | `{position: 'relative', display: 'inline-block'}` | used to style the `<div>` into which the plot is rendered |
125+
| `[innerStyle]` | `Object` | `{position: 'relative', display: 'inline-block'}` | used to style the `<div>` into which the plot is rendered |
126+
| `[style]` | `Object` | `undefined` | deprecated compatibility alias for `[innerStyle]` |
126127
| `[debug]` | `Boolean` | `false` | Assign the graph div to `window.gd` for debugging |
127128
| `[useResizeHandler]` | `Boolean` | `false` | When true, adds a call to `Plotly.Plot.resize()` as a `window.resize` event handler |
128129

129-
**Note**: To make a plot responsive, i.e. to fill its containing element and resize when the window is resized, use `style` or `className` to set the dimensions of the element (i.e. using `width: 100%; height: 100%` or some similar values) and set `useResizeHandler` to `true` while setting `layout.autosize` to `true` and leaving `layout.height` and `layout.width` undefined. This will implement the behaviour documented here: https://plot.ly/javascript/responsive-fluid-layout/
130+
**Note**: To make a plot responsive, i.e. to fill its containing element and resize when the window is resized, use `innerStyle` or `className` to set the dimensions of the element (i.e. using `width: 100%; height: 100%` or some similar values) and set `useResizeHandler` to `true` while setting `layout.autosize` to `true` and leaving `layout.height` and `layout.width` undefined. This will implement the behaviour documented here: https://plot.ly/javascript/responsive-fluid-layout/
130131

131132
```typescript
132133
@Component({
133134
selector: 'plotly-example',
134135
template: `
135136
<plotly-plot [data]="graph.data" [layout]="graph.layout"
136-
[useResizeHandler]="true" [style]="{position: 'relative', width: '100%', height: '100%'}">
137+
[useResizeHandler]="true" [innerStyle]="{position: 'relative', width: '100%', height: '100%'}">
137138
</plotly-plot>`,
138139
})
139140
export class PlotlyExampleComponent {

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-plotly.js",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"scripts": {
66
"ng": "ng",

projects/plotly/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-plotly.js",
3-
"version": "20.0.1",
3+
"version": "20.0.2",
44
"license": "MIT",
55
"peerDependencies": {
66
"@angular/common": ">=20.0.0 <21.0.0",

projects/plotly/src/lib/plotly.component.spec.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,25 @@ describe('PlotlyComponent', () => {
4141
expect(component.plotEl.nativeElement).toBeDefined();
4242
});
4343

44-
it('should receive the style from the property', () => {
44+
it('should receive the inner style from the property', () => {
45+
componentRef.setInput('innerStyle', { 'background-color': 'red' });
46+
fixture.detectChanges();
47+
expect(component.plotEl.nativeElement.style.backgroundColor).toBe('red');
48+
});
49+
50+
it('should retain style as a deprecated compatibility alias', () => {
4551
componentRef.setInput('style', { 'background-color': 'red' });
4652
fixture.detectChanges();
4753
expect(component.plotEl.nativeElement.style.backgroundColor).toBe('red');
4854
});
4955

56+
it('should prefer innerStyle when both style inputs are provided', () => {
57+
componentRef.setInput('style', { 'background-color': 'red' });
58+
componentRef.setInput('innerStyle', { 'background-color': 'blue' });
59+
fixture.detectChanges();
60+
expect(component.plotEl.nativeElement.style.backgroundColor).toBe('blue');
61+
});
62+
5063
it('should add the id in the #plotEl', () => {
5164
expect(component.plotEl.nativeElement.id).toBe('');
5265
componentRef.setInput('divId', 'some-id');

projects/plotly/src/lib/plotly.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { Plotly } from './plotly.interface';
2929
selector: 'plotly-plot',
3030
standalone: true,
3131
imports: [CommonModule],
32-
template: `<div #plot [attr.id]="divId()" [ngClass]="getClassName()" [ngStyle]="style()">
32+
template: `<div #plot [attr.id]="divId()" [ngClass]="getClassName()" [ngStyle]="innerStyle() ?? style()">
3333
<ng-content></ng-content>
3434
</div>`,
3535
providers: [PlotlyService],
@@ -49,6 +49,10 @@ export class PlotlyComponent implements OnInit, OnChanges, OnDestroy, DoCheck {
4949
layout = input<Partial<Plotly.Layout>>();
5050
config = input<Partial<Plotly.Config>>();
5151
frames = input<Partial<Plotly.Config>[]>();
52+
innerStyle = input<{ [key: string]: string }>();
53+
/**
54+
* @deprecated Use `innerStyle` to avoid conflicting with Angular's global style binding.
55+
*/
5256
style = input<{ [key: string]: string }>();
5357

5458
divId = input<string>();

0 commit comments

Comments
 (0)