forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
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 ISSUES CLOSED: NationalBankBelgium#1143
- Loading branch information
1 parent
92496bc
commit c916f96
Showing
18 changed files
with
354 additions
and
22 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
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
1 change: 1 addition & 0 deletions
1
showcase/src/app/demo-ui/components/table-with-sticky-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-sticky-actions.component"; |
10 changes: 10 additions & 0 deletions
10
...app/demo-ui/components/table-with-sticky-actions/table-with-sticky-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]="tableRowsActionBarConfig" | ||
customTableActionsType="alt" | ||
> | ||
<header><h1 class="mb0" translate>SHOWCASE.DEMO.TABLE.WITH_STICKY_ACTIONS</h1></header> | ||
</stark-table> |
9 changes: 9 additions & 0 deletions
9
...app/demo-ui/components/table-with-sticky-actions/table-with-sticky-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
...c/app/demo-ui/components/table-with-sticky-actions/table-with-sticky-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 { StarkActionBarConfig, StarkPaginationConfig, StarkTableColumnProperties, StarkTableFilter } 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-sticky-actions", | ||
templateUrl: "./table-with-sticky-actions.component.html", | ||
styleUrls: ["./table-with-sticky-actions.component.scss"] | ||
}) | ||
export class TableWithStickyActionsComponent implements OnInit { | ||
public data: object[]; | ||
|
||
public columns: StarkTableColumnProperties[]; | ||
|
||
public filter: StarkTableFilter; | ||
|
||
public pagination: StarkPaginationConfig; | ||
|
||
public tableRowsActionBarConfig: StarkActionBarConfig; | ||
|
||
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.tableRowsActionBarConfig = { | ||
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 | ||
} | ||
], | ||
isSticky: true | ||
}; | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
showcase/src/assets/examples/table/with-sticky-actions/table.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]="tableRowsActionBarConfig" | ||
customTableActionsType="alt" | ||
> | ||
<header><h1 class="mb0">Table with sticky row actions</h1></header> | ||
</stark-table> |
9 changes: 9 additions & 0 deletions
9
showcase/src/assets/examples/table/with-sticky-actions/table.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; | ||
} | ||
} | ||
} |
Oops, something went wrong.