Skip to content

Commit 888b9c1

Browse files
authored
Fix tables without headers but with borders (#718)
* Fix tables without headers but with borders * Update documentation
1 parent 5222f23 commit 888b9c1

File tree

7 files changed

+56
-28
lines changed

7 files changed

+56
-28
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 2.66.2 (2024-07-01)
2+
3+
### Bugfixes
4+
5+
- **Table**:
6+
- Fix first row corners on table with borders and without header
7+
- Prevent double border on last row without the need of adding `last` attribute on rows
8+
19
# 2.66.1 (2024-06-10)
210

311
### Improvements

projects/demo/src/app/demo/pages/table-page/table-page.component.html

+22-3
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,28 @@ <h4>Table with a border</h4>
128128
<pa-table-cell>Cell 2</pa-table-cell>
129129
<pa-table-cell>Cell 3</pa-table-cell>
130130
</pa-table-row>
131-
<pa-table-row
132-
last
133-
clickable>
131+
<pa-table-row clickable>
132+
<pa-table-cell>Cell 1</pa-table-cell>
133+
<pa-table-cell>Cell 2</pa-table-cell>
134+
<pa-table-cell>Cell 3</pa-table-cell>
135+
</pa-table-row>
136+
</pa-table>
137+
138+
<h4>Table with a border but no header</h4>
139+
<pa-table
140+
border
141+
columns="repeat(3, 1fr)">
142+
<pa-table-row clickable>
143+
<pa-table-cell>Cell 1</pa-table-cell>
144+
<pa-table-cell>Cell 2</pa-table-cell>
145+
<pa-table-cell>Cell 3</pa-table-cell>
146+
</pa-table-row>
147+
<pa-table-row clickable>
148+
<pa-table-cell>Cell 1</pa-table-cell>
149+
<pa-table-cell>Cell 2</pa-table-cell>
150+
<pa-table-cell>Cell 3</pa-table-cell>
151+
</pa-table-row>
152+
<pa-table-row clickable>
134153
<pa-table-cell>Cell 1</pa-table-cell>
135154
<pa-table-cell>Cell 2</pa-table-cell>
136155
<pa-table-cell>Cell 3</pa-table-cell>

projects/demo/src/app/demo/pages/table-page/table-row/table-row-page.component.html

-5
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,6 @@ <h3>Inputs</h3>
8383
If true, hovering the row will change its background.
8484
<small>(default: false)</small>
8585
</dd>
86-
<dt>last</dt>
87-
<dd>
88-
Flag marking a row as the last one so it can be styled accordingly (no border bottom for example).
89-
<small>(default: false)</small>
90-
</dd>
9186
</dl>
9287
</pa-demo-usage>
9388

projects/pastanaga-angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@guillotinaweb/pastanaga-angular",
33
"description": "Provides Pastanaga UI elements as Angular components",
4-
"version": "2.66.1",
4+
"version": "2.66.2",
55
"license": "MIT",
66
"keywords": [
77
"angular",

projects/pastanaga-angular/src/lib/table/table-row/table-row.component.html

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[class.pa-hoverable]="hoverable"
55
[class.pa-clickable]="clickable"
66
[class.pa-disabled]="disabled"
7-
[class.pa-table-grid--row--last]="last"
87
[paFocusDisabled]="!hoverable">
98
<ng-content></ng-content>
109
</div>

projects/pastanaga-angular/src/lib/table/table-row/table-row.component.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export class TableRowComponent {
1010
@Input({ transform: booleanAttribute }) clickable = false;
1111
@Input({ transform: booleanAttribute }) disabled = false;
1212
@Input({ transform: booleanAttribute }) hoverable = false;
13-
@Input({ transform: booleanAttribute }) last = false;
1413
}

projects/pastanaga-angular/src/styles/components/_tables.scss

+25-17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
border-top-right-radius: $border-radius-default;
1616
}
1717
}
18+
pa-table-row:first-of-type {
19+
pa-table-cell:first-of-type .pa-table-grid--cell {
20+
border-top-left-radius: $border-radius-default;
21+
}
22+
pa-table-cell:last-of-type .pa-table-grid--cell {
23+
border-top-right-radius: $border-radius-default;
24+
}
25+
}
1826
}
1927
}
2028

@@ -80,6 +88,23 @@
8088
}
8189
}
8290

91+
pa-table-row:not(:last-of-type) .pa-table-grid--row {
92+
.pa-table-grid--cell {
93+
box-shadow: inset 0px -1px 0px $color-border-table-row;
94+
}
95+
}
96+
pa-table-row:last-of-type .pa-table-grid--row {
97+
pa-table-cell:first-of-type .pa-table-grid--cell,
98+
pa-table-cell-menu:first-of-type .pa-table-grid--menu-cell {
99+
border-bottom-left-radius: $border-radius-default;
100+
}
101+
102+
pa-table-cell:last-of-type .pa-table-grid--cell,
103+
pa-table-cell-menu:last-of-type .pa-table-grid--menu-cell {
104+
border-bottom-right-radius: $border-radius-default;
105+
}
106+
}
107+
83108
.pa-table-grid--row {
84109
display: contents;
85110
font-size: font-size(s);
@@ -100,23 +125,6 @@
100125
z-index: 3;
101126
}
102127

103-
&:not(.pa-table-grid--row--last) {
104-
.pa-table-grid--cell {
105-
box-shadow: inset 0px -1px 0px $color-border-table-row;
106-
}
107-
}
108-
&.pa-table-grid--row--last {
109-
pa-table-cell:first-of-type .pa-table-grid--cell,
110-
pa-table-cell-menu:first-of-type .pa-table-grid--menu-cell {
111-
border-bottom-left-radius: $border-radius-default;
112-
}
113-
114-
pa-table-cell:last-of-type .pa-table-grid--cell,
115-
pa-table-cell-menu:last-of-type .pa-table-grid--menu-cell {
116-
border-bottom-right-radius: $border-radius-default;
117-
}
118-
}
119-
120128
&.pa-disabled .pa-table-grid--cell {
121129
cursor: default;
122130
opacity: 0.5;

0 commit comments

Comments
 (0)