Skip to content

Dashboard widget rowspan #2007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/documentation/docs/controls/Dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Provides settings of Dashboard's widget
| controlOptions | IWidgetControlOptions | no | Component rendering options. |
| body | IWidgetBodyContent[] | no | Widget's content (children) rendered as tabs. |
| link | IWidgetLink | no | Widget's link rendered at the bottom part of the widget. |
| rowSpan | number | no | Number of rows the widget should span. If specified, it will override any vertical value set from the size property. |

Interface `IWidgetActionKey`

Expand Down
4 changes: 4 additions & 0 deletions src/controls/dashboard/widget/IWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export interface IWidget {
* Widget's link
*/
link?: IWidgetLink;
/**
* Number of rows to span (vertical extension)
*/
rowSpan?: number;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/controls/dashboard/widget/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const Widget = ({
break
}

// Support vertical extension via rowSpan
if (widget.rowSpan && widget.rowSpan > 1) {
cardStyle.gridRowEnd = `span ${widget.rowSpan}`;
}

if(widget.controlOptions && widget.controlOptions.isHidden){
return null;
}
Expand Down
4 changes: 3 additions & 1 deletion src/webparts/controlsTest/components/ControlsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ import {
VariantType,
} from '../../../controls/variantThemeProvider';
import {
IWidgetLink,
WidgetSize,
} from '../../../controls/dashboard';
import { debounce } from 'lodash';
Expand Down Expand Up @@ -1055,7 +1056,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
}

const linkExample = { href: "#" };
const customizedLinkExample = {
const customizedLinkExample: any = {
href: "#",
title: "This is a customized link!",
color: "red",
Expand Down Expand Up @@ -2358,6 +2359,7 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
title: "Card 2",
size: WidgetSize.Single,
link: customizedLinkExample,
rowSpan: 2
},
{
title: "Card 3",
Expand Down