Skip to content

Commit 7918906

Browse files
authored
Merge pull request #2007 from GuidoZam/dashboard-widget-rowspan
Dashboard widget rowspan
2 parents cacb5cb + 63093cc commit 7918906

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

docs/documentation/docs/controls/Dashboard.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Provides settings of Dashboard's widget
111111
| controlOptions | IWidgetControlOptions | no | Component rendering options. |
112112
| body | IWidgetBodyContent[] | no | Widget's content (children) rendered as tabs. |
113113
| link | IWidgetLink | no | Widget's link rendered at the bottom part of the widget. |
114+
| rowSpan | number | no | Number of rows the widget should span. If specified, it will override any vertical value set from the size property. |
114115

115116
Interface `IWidgetActionKey`
116117

src/controls/dashboard/widget/IWidget.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ export interface IWidget {
7373
* Widget's link
7474
*/
7575
link?: IWidgetLink;
76+
/**
77+
* Number of rows to span (vertical extension)
78+
*/
79+
rowSpan?: number;
7680
}
7781

7882
/**

src/controls/dashboard/widget/Widget.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ export const Widget = ({
3535
break
3636
}
3737

38+
// Support vertical extension via rowSpan
39+
if (widget.rowSpan && widget.rowSpan > 1) {
40+
cardStyle.gridRowEnd = `span ${widget.rowSpan}`;
41+
}
42+
3843
if(widget.controlOptions && widget.controlOptions.isHidden){
3944
return null;
4045
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ import {
161161
VariantType,
162162
} from '../../../controls/variantThemeProvider';
163163
import {
164+
IWidgetLink,
164165
WidgetSize,
165166
} from '../../../controls/dashboard';
166167
import { debounce } from 'lodash';
@@ -1055,7 +1056,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
10551056
}
10561057

10571058
const linkExample = { href: "#" };
1058-
const customizedLinkExample = {
1059+
const customizedLinkExample: any = {
10591060
href: "#",
10601061
title: "This is a customized link!",
10611062
color: "red",
@@ -2358,6 +2359,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
23582359
title: "Card 2",
23592360
size: WidgetSize.Single,
23602361
link: customizedLinkExample,
2362+
rowSpan: 2
23612363
},
23622364
{
23632365
title: "Card 3",

0 commit comments

Comments
 (0)