Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ATable Loading Options #226

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions atable/src/components/ATableLoading.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<template>
<div class="aloading">
<h2 class="aloading-header">
<slot></slot>
</h2>
<div class="aloading-bar"></div>
</div>
</template>

<style scoped>
.aloading {
width: 100%;
border-top: 1px solid var(--sc-row-border-color);
border-bottom: 1px solid var(--sc-row-border-color);
display: flex;
background-color: white;
border-left: 4px solid var(--sc-row-border-color);
padding-left: 0.5ch !important;
padding-right: 0.5ch;
padding-top: var(--sc-atable-row-padding);
padding-bottom: var(--sc-atable-row-padding);
align-items: center;
box-sizing: border-box;
background: var(--sc-focus-cell-background);
overflow: hidden;
position: relative;
}
.aloading-bar {
width: 100%;
height: 100%;
position: absolute;
left: -100%;
top: 0;
background: linear-gradient(
90deg,
rgba(var(--sc-table-loading-color), 0) 0%,
rgba(var(--sc-table-loading-color), 1) 50%,
rgba(var(--sc-table-loading-color), 0) 100%
);
animation: gradient infinite 2s;
z-index: 0;
}
.aloading-header {
color: var(--sc-cell-text-color);
font-family: var(--sc-atable-font-family);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: var(--sc-table-font-size);
padding: 0;
margin: 0;
font-weight: normal;
z-index: 1;
}
.aloading-header::after {
content: '...';
animation: ellipse 2s;
animation-iteration-count: infinite;
}

@keyframes gradient {
0% {
left: -100%;
}
100% {
left: 100%;
}
}

@keyframes ellipse {
0% {
content: '';
}
20% {
content: '';
}
40% {
content: '.';
}
60% {
content: '..';
}
80% {
content: '...';
}
}
</style>
81 changes: 81 additions & 0 deletions atable/src/components/ATableLoadingBar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<template>
<div class="aloading">
<h2 class="aloading-header">
<slot></slot>
</h2>
<div class="aloading-bar"></div>
</div>
</template>

<style scoped>
.aloading {
width: 100%;
border-top: 1px solid var(--sc-row-border-color);
border-bottom: 1px solid var(--sc-row-border-color);
display: flex;
background-color: white;
border-left: 4px solid var(--sc-row-border-color);
padding-left: 0.5ch !important;
padding-right: 0.5ch;
padding-top: var(--sc-atable-row-padding);
padding-bottom: var(--sc-atable-row-padding);
align-items: center;
box-sizing: border-box;
background: var(--sc-focus-cell-background);
overflow: hidden;
position: relative;
}
.aloading-bar {
width: 50%;
height: 3px;
position: absolute;
left: -100%;
bottom: 0;
background: var(--sc-row-border-color);
animation: bar-left infinite 2s;
z-index: 0;
}
.aloading-header {
color: var(--sc-cell-text-color);
font-family: var(--sc-atable-font-family);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: var(--sc-table-font-size);
padding: 0;
margin: 0;
font-weight: normal;
z-index: 1;
}
.aloading-header::after {
content: '...';
animation: ellipse 2s;
animation-iteration-count: infinite;
}

@keyframes bar-left {
0% {
left: -50%;
}
100% {
left: 100%;
}
}

@keyframes ellipse {
0% {
content: '';
}
20% {
content: '';
}
40% {
content: '.';
}
60% {
content: '..';
}
80% {
content: '...';
}
}
</style>
6 changes: 5 additions & 1 deletion atable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import AExpansionRow from './components/AExpansionRow.vue'
import ARow from './components/ARow.vue'
import ATable from './components/ATable.vue'
import ATableHeader from './components/ATableHeader.vue'
import ATableLoading from './components/ATableLoading.vue'
import ATableLoadingBar from './components/ATableLoadingBar.vue'
import ATableModal from './components/ATableModal.vue'
export { createTableStore } from './stores/table'
export type {
Expand All @@ -28,7 +30,9 @@ function install(app: App /* options */) {
app.component('ARow', ARow)
app.component('ATable', ATable)
app.component('ATableHeader', ATableHeader)
app.component('ATableLoading', ATableLoading)
app.component('ATableLoadingBar', ATableLoadingBar)
app.component('ATableModal', ATableModal)
}

export { install, ACell, AExpansionRow, ARow, ATable, ATableHeader, ATableModal }
export { install, ACell, AExpansionRow, ARow, ATable, ATableHeader, ATableLoading, ATableModal }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/atable",
"comment": "added atable loading component",
"type": "patch"
}
],
"packageName": "@stonecrop/atable"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@stonecrop/themes",
"comment": "added rgb variable for loading gradient color",
"type": "patch"
}
],
"packageName": "@stonecrop/themes"
}
3 changes: 3 additions & 0 deletions common/reviews/api/atable.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { App } from 'vue';
import ARow from './components/ARow.vue';
import ATable from './components/ATable.vue';
import ATableHeader from './components/ATableHeader.vue';
import ATableLoading from './components/ATableLoading.vue';
import ATableModal from './components/ATableModal.vue';
import { ComputedRef } from 'vue';
import { CSSProperties } from 'vue';
Expand All @@ -26,6 +27,8 @@ export { ATable }

export { ATableHeader }

export { ATableLoading }

export { ATableModal }

// @public
Expand Down
18 changes: 18 additions & 0 deletions examples/atable/default.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<Variant title="full width">
<ATable v-model="full_width_table.rows" :columns="full_width_table.columns" :config="full_width_table.config" />
</Variant>
<Variant title="loading options">
<ATableLoading>Loading</ATableLoading>
<br />
<ATableLoadingBar>Loading</ATableLoadingBar>
</Variant>
</Story>
</template>

Expand All @@ -21,6 +26,19 @@ import { reactive } from 'vue'

import rows from './sample_data/http_logs.json'

const empty_rows = [
{
home_page: {
title: 'https://ceara.berlin',
url: 'https://ceara.berlin',
},
http_method: 'HEAD',
ip_address: '75.228.138.84',
report_date: 1580804064118.311,
status: '503 Service Unavailable',
},
]

const columns: TableColumn[] = [
{
label: 'Home Page',
Expand Down
1 change: 1 addition & 0 deletions themes/default/_variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
--sc-atable-row-padding: 0.125rem;
--sc-atable-row-height: 1.5em;
--sc-atable-cell-border-width: 2px;
--sc-table-loading-color: 204, 204, 204;

/* BTNS */
--sc-btn-border: #cccccc;
Expand Down
Loading