Skip to content

Commit 6fc70e8

Browse files
committed
feat(table): add striped columns
1 parent 9c54ba9 commit 6fc70e8

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

projects/coreui-angular/src/lib/table/table.directive.ts

+39-2
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,21 @@ export class TableDirective implements OnInit {
1111
static ngAcceptInputType_hover: BooleanInput;
1212
static ngAcceptInputType_small: BooleanInput;
1313
static ngAcceptInputType_striped: BooleanInput;
14+
static ngAcceptInputType_stripedColumns: BooleanInput;
1415

1516
/**
1617
* Set the vertical alignment.
1718
* @type string
1819
* @values 'bottom' | 'middle' | 'top'
1920
*/
2021
@Input() align?: 'bottom' | 'middle' | 'top';
22+
2123
/**
2224
* Sets the border color of the component to one of CoreUI’s themed colors.
2325
* @type Colors
2426
*/
2527
@Input() borderColor?: Colors;
28+
2629
/**
2730
* Add borders on all sides of the table and cells.
2831
* @type boolean
@@ -31,10 +34,13 @@ export class TableDirective implements OnInit {
3134
set bordered(value: boolean) {
3235
this._bordered = coerceBooleanProperty(value);
3336
};
37+
3438
get bordered() {
3539
return this._bordered;
3640
}
41+
3742
private _bordered = false;
43+
3844
/**
3945
* Remove borders on all sides of the table and cells.
4046
* @type boolean
@@ -43,20 +49,25 @@ export class TableDirective implements OnInit {
4349
set borderless(value: boolean) {
4450
this._borderless = coerceBooleanProperty(value);
4551
};
52+
4653
get borderless() {
4754
return this._borderless;
4855
}
56+
4957
private _borderless = false;
58+
5059
/**
5160
* Put the `<caption>` on the top of the table.
5261
* @values 'top'
5362
*/
5463
@Input() caption?: 'top';
64+
5565
/**
5666
* Sets the color context of the component to one of CoreUI’s themed colors.
5767
* @type Colors
5868
*/
5969
@Input() color?: Colors;
70+
6071
/**
6172
* Enable a hover state on table rows within table body.
6273
* @type boolean
@@ -65,15 +76,19 @@ export class TableDirective implements OnInit {
6576
set hover(value: boolean) {
6677
this._hover = coerceBooleanProperty(value);
6778
};
79+
6880
get hover() {
6981
return this._hover;
7082
}
83+
7184
private _hover = false;
85+
7286
/**
7387
* Make table responsive across all viewports or pick a maximum breakpoint with which to have a responsive table up to.
7488
* @type: {boolean | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'}
7589
*/
7690
@Input() responsive?: boolean | Omit<Breakpoints, 'xs'>;
91+
7792
/**
7893
* Make table more compact by cutting all cell `padding` in half.
7994
* @type boolean
@@ -82,23 +97,44 @@ export class TableDirective implements OnInit {
8297
set small(value: boolean) {
8398
this._small = coerceBooleanProperty(value);
8499
};
100+
85101
get small() {
86102
return this._small;
87103
}
104+
88105
private _small = false;
106+
89107
/**
90-
* Add zebra-striping to any table row within the table body`.
108+
* Add zebra-striping to any table row within the table body.
91109
* @type boolean
92110
*/
93111
@Input()
94112
set striped(value: boolean) {
95113
this._striped = coerceBooleanProperty(value);
96114
};
115+
97116
get striped() {
98117
return this._striped;
99118
}
119+
100120
private _striped = false;
101121

122+
/**
123+
* Add zebra-striping to any table column.
124+
* @type boolean
125+
* @since 4.2.4
126+
*/
127+
@Input()
128+
set stripedColumns(value: boolean) {
129+
this._stripedColumns = coerceBooleanProperty(value);
130+
};
131+
132+
get stripedColumns() {
133+
return this._stripedColumns;
134+
}
135+
136+
private _stripedColumns = false;
137+
102138
constructor(
103139
private renderer: Renderer2,
104140
private hostElement: ElementRef
@@ -116,7 +152,8 @@ export class TableDirective implements OnInit {
116152
[`table-${this.color}`]: !!this.color,
117153
'table-hover': this.hover,
118154
'table-sm': this.small,
119-
'table-striped': this.striped
155+
'table-striped': this.striped,
156+
'table-striped-columns': this.stripedColumns
120157
};
121158
}
122159

0 commit comments

Comments
 (0)