Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
feat(table component): table component implementation
Browse files Browse the repository at this point in the history
new table component add with appropriate styles, scrolling feature and responsive behavior

re #5
  • Loading branch information
dmitryueno committed Aug 25, 2020
1 parent 40adea5 commit 34027cd
Show file tree
Hide file tree
Showing 10 changed files with 927 additions and 56 deletions.
213 changes: 160 additions & 53 deletions docs/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"watcherGlob": "**"
},
"dependencies": {
"iframe-coordinator": "2.4.0",
"iframe-coordinator": "^4.1.12",
"monaco-editor": "^0.17.0",
"parse5": "^5.1.0"
},
Expand All @@ -24,7 +24,7 @@
"file-loader": "^5.0.2",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"monaco-editor-webpack-plugin": "^1.7.0",
"monaco-editor-webpack-plugin": "1.7.0",
"style-loader": "^1.1.2",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
Expand Down
8 changes: 8 additions & 0 deletions docs/src/components-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,13 @@
"input": "Standard Event",
"submit": "Standard Event"
}
},
"gux-table": {
"attributes": {
"compact": "checkbox",
"object-table": "checkbox",
"epmty-table-message": "text"
},
"events": {}
}
}
133 changes: 133 additions & 0 deletions src/components/beta/gux-table/example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<h1>Data table</h1>
<gux-table-beta>
<table slot="data">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th data-cell-numeric>Age</th>
<th data-cell-action>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td data-cell-numeric>25</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>21</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
</tbody>
</table>
</gux-table-beta>

<h1>Data table compact</h1>
<gux-table-beta compact>
<table slot="data">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th data-cell-numeric>Age</th>
<th data-cell-action>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td data-cell-numeric>25</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>21</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
</tbody>
</table>
</gux-table-beta>

<h1>Object table</h1>
<gux-table-beta object-table>
<table slot="data">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th data-cell-numeric>Age</th>
<th data-cell-action>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td data-cell-numeric>25</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>21</td>
<td data-cell-action>Delete</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td data-cell-numeric>23</td>
<td data-cell-action>Delete</td>
</tr>
</tbody>
</table>
</gux-table-beta>

<h1>Empty table</h1>
<gux-table-beta object-table>
<table slot="data">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th data-cell-numeric>Age</th>
<th data-cell-action>Action</th>
</tr>
</thead>
</table>
</gux-table-beta>
159 changes: 159 additions & 0 deletions src/components/beta/gux-table/gux-table.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
// Variables part
@gux-scroll-btn-border: #d5dce0;
@gux-scroll-btn-disabled-text:#c3cad4;
@gux-scroll-btn-shadow-left: 1px -1px 1px rgba(34, 37, 41, 0.08);
@gux-scroll-btn-shadow-right: -1px -1px 1px rgba(34, 37, 41, 0.08);
@gux-table-row-hover: #deeafc;
@gux-table-scroll-divider: rgba(34, 37, 41, 0.1);

gux-table-beta {
display: block;
position: relative;

.empty-table {
align-items: center;
background: @gux-off-white;
color: @gux-grey-bg-3;
display: flex;
height: 150px;
justify-content: center;

h2 {
margin: 0px;
}
}

.gux-scroll-left,
.gux-scroll-right {
align-items: center;
background: @gux-border;
border: 1px solid @gux-scroll-btn-border;
color: @gux-grey-2;
cursor: pointer;
display: flex;
font-size: 18px;
height: 38px;
justify-content: center;
position: absolute;
width: 24px;
z-index: 1;

&.disabled {
background: @gux-off-white-bg-2;
color: @gux-scroll-btn-disabled-text;
}
}

.gux-scroll-left {
border-bottom-right-radius: 2px;
border-top-right-radius: 2px;
box-shadow: @gux-scroll-btn-shadow-left;
}

.gux-scroll-right {
border-bottom-left-radius: 2px;
border-top-left-radius: 2px;
box-shadow: @gux-scroll-btn-shadow-right;
right: 0;
}

.gux-table-container {
overflow-x: scroll;
position: relative;

&.vertical-scroll {
.gux-table-header {
border-bottom: 1px solid @gux-table-scroll-divider
}
}

.gux-table-header-column,
.gux-table-body-row-cell {
border-color:@gux-border;
border-style: solid;
border-width: 0px 1px 1px 0px;
padding: 11.5px 24px 11.5px 12px;
white-space: nowrap;

p {
margin: 0px;
}
}

.gux-table-header-column:last-child,
.gux-table-body-row-cell:last-child {
border-right-width: 0px;
}

.gux-table-header {
background: @gux-off-white;
display: flex;
width: fit-content;
}

.gux-table-body {
max-height: calc(100% - 40px);
overflow-y: scroll;
width: fit-content;

.gux-table-body-row {
background: @gux-off-white-bg-2;
display: flex;
}

.gux-table-body-row:nth-child(2n) {
background: @gux-off-white;
}
}

.gux-table-header-column,
.gux-table-body-row-cell {
&.cell-number,
&.cell-action {
padding: 11.5px 12px 11.5px 24px;
text-align: right;
}
}

&.horizontal-scroll {
.gux-table-header-column:first-child {
b, p {
margin-left: 26px;
}
}
}

&.compact {
.gux-table-body-row-cell {
padding-top: 3.5px;
padding-bottom: 3.5px;
}
}

&.object-table {
.gux-table-body-row {
.gux-table-body-row-cell {
border-color:@gux-off-white-bg-2;
}
}

.gux-table-body-row:nth-child(2n) {
.gux-table-body-row-cell {
border-color: @gux-off-white;
}
}

.gux-table-body-row:hover {
background: @gux-table-row-hover;

.gux-table-body-row-cell {
border-color:@gux-table-row-hover;
}
}
}

table {
display: none;
}
}
}
Loading

0 comments on commit 34027cd

Please sign in to comment.