-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stark-ui): add sticky action column to
stark-table
- added documentation / demo - added and implemented `StarkTableRowActions` interface ISSUES CLOSED: #1143
- Loading branch information
1 parent
60ea76a
commit 3639513
Showing
25 changed files
with
400 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/stark-ui/src/modules/table/components/column.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/stark-ui/src/modules/table/entities/table-row-actions.intf.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { StarkActionBarConfig } from "@nationalbankbelgium/stark-ui"; | ||
|
||
/** | ||
* StarkTableRowActions interface | ||
*/ | ||
export interface StarkTableRowActions extends StarkActionBarConfig { | ||
/** | ||
* Should the actions always be shown on the right side of the table (sticky) | ||
* Default: false | ||
*/ | ||
isFixed?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
showcase/src/app/demo-ui/components/table-with-fixed-actions/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./table-with-fixed-actions.component"; |
10 changes: 10 additions & 0 deletions
10
...c/app/demo-ui/components/table-with-fixed-actions/table-with-fixed-actions.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<stark-table | ||
[data]="data" | ||
[columnProperties]="columns" | ||
[filter]="filter" | ||
[paginationConfig]="pagination" | ||
[tableRowsActionBarConfig]="tableRowActions" | ||
customTableActionsType="alt" | ||
> | ||
<header><h1 class="mb0" translate>SHOWCASE.DEMO.TABLE.WITH_FIXED_ACTIONS</h1></header> | ||
</stark-table> |
9 changes: 9 additions & 0 deletions
9
...c/app/demo-ui/components/table-with-fixed-actions/table-with-fixed-actions.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
::ng-deep table { | ||
td, | ||
th { | ||
white-space: nowrap; | ||
&.mat-cell { | ||
padding-right: 20px; | ||
} | ||
} | ||
} |
166 changes: 166 additions & 0 deletions
166
...src/app/demo-ui/components/table-with-fixed-actions/table-with-fixed-actions.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
import { Component, Inject, OnInit } from "@angular/core"; | ||
import { STARK_LOGGING_SERVICE, StarkLoggingService } from "@nationalbankbelgium/stark-core"; | ||
import { StarkPaginationConfig, StarkTableColumnProperties, StarkTableFilter, StarkTableRowActions } from "@nationalbankbelgium/stark-ui"; | ||
|
||
// tslint:disable:no-duplicate-string | ||
const DUMMY_DATA: object[] = [ | ||
{ | ||
id: 1, | ||
title: { label: "first title (value: 1)", value: 1 }, | ||
description: "number one", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 10, | ||
title: { label: "second title (value: 2)", value: 2 }, | ||
description: "second description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 12, | ||
title: { label: "third title (value: 3)", value: 3 }, | ||
description: "the third description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 2, | ||
title: { label: "fourth title (value: 4)", value: 4 }, | ||
description: "description number four", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 23, | ||
title: { label: "fifth title (value: 5)", value: 5 }, | ||
description: "fifth description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 222, | ||
title: { label: "sixth title (value: 6)", value: 6 }, | ||
description: "the sixth description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 112, | ||
title: { label: "seventh title (value: 7)", value: 7 }, | ||
description: "seventh description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 232, | ||
title: { label: "eighth title (value: 8)", value: 8 }, | ||
description: "description number eight", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 154, | ||
title: { label: "ninth title (value: 9)", value: 9 }, | ||
description: "the ninth description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 27, | ||
title: { label: "tenth title (value: 10)", value: 10 }, | ||
description: "description number ten", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 86, | ||
title: { label: "eleventh title (value: 11)", value: 11 }, | ||
description: "eleventh description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
}, | ||
{ | ||
id: 44, | ||
title: { label: "twelfth title (value: 12)", value: 12 }, | ||
description: "the twelfth description", | ||
info: "This is some info.", | ||
more_info: "This is even more info.", | ||
even_more_info: "This is a ludicrous amount of info." | ||
} | ||
]; | ||
// tslint:enable:no-duplicate-string | ||
|
||
@Component({ | ||
selector: "showcase-table-with-fixed-actions", | ||
templateUrl: "./table-with-fixed-actions.component.html", | ||
styleUrls: ["./table-with-fixed-actions.component.scss"] | ||
}) | ||
export class TableWithFixedActionsComponent implements OnInit { | ||
public data: object[]; | ||
|
||
public columns: StarkTableColumnProperties[]; | ||
|
||
public filter: StarkTableFilter; | ||
|
||
public pagination: StarkPaginationConfig; | ||
|
||
public tableRowActions: StarkTableRowActions; | ||
|
||
public constructor(@Inject(STARK_LOGGING_SERVICE) private logger: StarkLoggingService) {} | ||
|
||
public ngOnInit(): void { | ||
this.data = DUMMY_DATA; | ||
|
||
this.columns = [ | ||
{ name: "id", label: "Id" }, | ||
{ | ||
name: "title", | ||
label: "SHOWCASE.DEMO.TABLE.LABELS.TITLE", | ||
cellFormatter: (value: { label: string }): string => "~" + value.label | ||
}, | ||
{ name: "description", label: "SHOWCASE.DEMO.TABLE.LABELS.DESCRIPTION" }, | ||
// tslint:disable:no-duplicate-string | ||
{ name: "info", label: "SHOWCASE.DEMO.TABLE.LABELS.EXTRA_INFO" }, | ||
{ name: "more_info", label: "SHOWCASE.DEMO.TABLE.LABELS.EXTRA_INFO" }, | ||
{ name: "even_more_info", label: "SHOWCASE.DEMO.TABLE.LABELS.EXTRA_INFO" } | ||
// tslint:enable:no-duplicate-string | ||
]; | ||
|
||
this.filter = { globalFilterPresent: false, columns: [] }; | ||
|
||
this.pagination = { totalItems: DUMMY_DATA.length, page: 1, itemsPerPage: 10 }; | ||
|
||
this.tableRowActions = { | ||
actions: [ | ||
{ | ||
id: "edit-item", | ||
label: "STARK.ICONS.EDIT_ITEM", | ||
icon: "pencil", | ||
actionCall: ($event: Event, data: object) => this.logger.debug("EDIT", $event, data), | ||
isEnabled: true | ||
}, | ||
{ | ||
id: "delete-item", | ||
label: "STARK.ICONS.DELETE_ITEM", | ||
icon: "delete", | ||
actionCall: ($event: Event, data: object) => this.logger.debug("DELETE", $event, data), | ||
isEnabled: true | ||
} | ||
], | ||
isFixed: true | ||
}; | ||
} | ||
} |
Oops, something went wrong.