fix(tables): improve smart-table styles

This commit is contained in:
KostyaDanovsky 2017-07-29 13:13:17 +03:00
parent bc536dbded
commit 0f546d950f
6 changed files with 21 additions and 74 deletions

View file

@ -4,11 +4,13 @@ import { CommonModule } from '@angular/common';
import { UserService } from './users.service'; import { UserService } from './users.service';
import { ElectricityService } from './electricity.service'; import { ElectricityService } from './electricity.service';
import { StateService } from './state.service'; import { StateService } from './state.service';
import { SmartTableService } from './smart-table.service';
const SERVICES = [ const SERVICES = [
UserService, UserService,
ElectricityService, ElectricityService,
StateService, StateService,
SmartTableService,
]; ];
@NgModule({ @NgModule({

View file

@ -425,59 +425,7 @@ export class SmartTableService {
'age': 16, 'age': 16,
}]; }];
metricsTableData = [{ getData() {
image: 'app/browsers/chrome.svg', return this.data;
browser: 'Google Chrome',
visits: '10,392',
isVisitsUp: true,
purchases: '4,214',
isPurchasesUp: true,
percent: '45%',
isPercentUp: true,
}, {
image: 'app/browsers/firefox.svg',
browser: 'Mozilla Firefox',
visits: '7,873',
isVisitsUp: true,
purchases: '3,031',
isPurchasesUp: false,
percent: '28%',
isPercentUp: true,
}, {
image: 'app/browsers/ie.svg',
browser: 'Internet Explorer',
visits: '5,890',
isVisitsUp: false,
purchases: '2,102',
isPurchasesUp: false,
percent: '17%',
isPercentUp: false,
}, {
image: 'app/browsers/safari.svg',
browser: 'Safari',
visits: '4,001',
isVisitsUp: false,
purchases: '1,001',
isPurchasesUp: false,
percent: '14%',
isPercentUp: true,
}, {
image: 'app/browsers/opera.svg',
browser: 'Opera',
visits: '1,833',
isVisitsUp: true,
purchases: '83',
isPurchasesUp: true,
percent: '5%',
isPercentUp: false,
}];
getData(): Promise<any> {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(this.data);
}, 2000);
});
} }
} }

View file

@ -1,5 +1,6 @@
@import '../../../@theme/styles/variables'; @import '../../../@theme/styles/variables';
@import '~@akveo/nga-theme/components/card/card.component.theme'; @import '~@akveo/nga-theme/components/card/card.component.theme';
@import '~@akveo/nga-theme/styles/global/typography/typography';
@include nga-install-component() { @include nga-install-component() {

View file

@ -1,10 +1,10 @@
<div class="row"> <nga-card>
<div class="col-md-12"> <nga-card-header>
<nga-card> Smart Table
<nga-card-header>Smart Table</nga-card-header> </nga-card-header>
<nga-card-body>
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"></ng2-smart-table> <nga-card-body>
</nga-card-body> <ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)">
</nga-card> </ng2-smart-table>
</div> </nga-card-body>
</div> </nga-card>

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { LocalDataSource } from 'ng2-smart-table'; import { LocalDataSource } from 'ng2-smart-table';
import { SmartTableService } from './smart-table.service'; import { SmartTableService } from '../../../@core/data/smart-table.service';
@Component({ @Component({
selector: 'ngx-smart-table', selector: 'ngx-smart-table',
@ -9,11 +9,9 @@ import { SmartTableService } from './smart-table.service';
}) })
export class SmartTableComponent { export class SmartTableComponent {
query: string = '';
settings = { settings = {
add: { add: {
addButtonContent: '<i class="ion-ios-plus-outline"></i>', addButtonContent: '<i class="ion-plus"></i>',
createButtonContent: '<i class="ion-checkmark"></i>', createButtonContent: '<i class="ion-checkmark"></i>',
cancelButtonContent: '<i class="ion-close"></i>', cancelButtonContent: '<i class="ion-close"></i>',
}, },
@ -23,7 +21,7 @@ export class SmartTableComponent {
cancelButtonContent: '<i class="ion-close"></i>', cancelButtonContent: '<i class="ion-close"></i>',
}, },
delete: { delete: {
deleteButtonContent: '<i class="ion-trash-a"></i>', deleteButtonContent: '<i class="ion-ios-trash-outline"></i>',
confirmDelete: true, confirmDelete: true,
}, },
columns: { columns: {
@ -57,9 +55,8 @@ export class SmartTableComponent {
source: LocalDataSource = new LocalDataSource(); source: LocalDataSource = new LocalDataSource();
constructor(private service: SmartTableService) { constructor(private service: SmartTableService) {
this.service.getData().then((data) => { let data = this.service.getData();
this.source.load(data); this.source.load(data);
});
} }
onDeleteConfirm(event): void { onDeleteConfirm(event): void {
@ -69,5 +66,4 @@ export class SmartTableComponent {
event.confirm.reject(); event.confirm.reject();
} }
} }
} }

View file

@ -4,7 +4,7 @@ import { Ng2SmartTableModule } from 'ng2-smart-table';
import { SharedModule } from '../../shared.module'; import { SharedModule } from '../../shared.module';
import { TablesRoutingModule, routedComponents } from './tables-routing.module'; import { TablesRoutingModule, routedComponents } from './tables-routing.module';
import { SmartTableService } from './smart-table/smart-table.service'; import { SmartTableService } from '../../@core/data/smart-table.service';
@NgModule({ @NgModule({
imports: [ imports: [