feat(tables): add smart table page

This commit is contained in:
Alexander Zhukov 2017-01-27 12:02:08 +03:00
parent 3a9ecd2f64
commit 33f0fbb457
16 changed files with 6364 additions and 608 deletions

View file

@ -3,7 +3,6 @@ sudo: false
language: node_js
node_js:
- "4"
- "5"
- "6"
@ -16,13 +15,12 @@ addons:
install:
- npm config set spin false
- npm install -g npm@3
- npm install -g typescript@2.0.0
- npm install
script:
- npm run build:prod
- npm run build:aot
notifications:
slack: akveo:q559HckfZMSyZRb803aiLcjH

8
config/empty.js Normal file
View file

@ -0,0 +1,8 @@
module.exports = {
NgProbeToken: {},
HmrState: function() {},
_createConditionalRootRenderer: function(rootRenderer, extraTokens, coreTokens) {
return rootRenderer;
},
__platform_browser_private__: {}
};

View file

View file

@ -1,548 +0,0 @@
const helpers = require('./helpers');
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js'); // the settings that are common to prod and dev
const ngtools = require('@ngtools/webpack');
const webpack = require('webpack');
/**
* Webpack Plugins
*/
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const IgnorePlugin = require('webpack/lib/IgnorePlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const WebpackMd5Hash = require('webpack-md5-hash');
const AssetsPlugin = require('assets-webpack-plugin');
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;
const HtmlElementsPlugin = require('./html-elements-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
/**
* Webpack Constants
*/
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
const HOST = process.env.HOST || 'localhost';
const PORT = process.env.PORT || 8080;
const METADATA = webpackMerge(commonConfig({
env: ENV
}).metadata, {
host: HOST,
port: PORT,
ENV: ENV,
HMR: false
});
module.exports = function (env) {
isProd = true;
return {
/**
* Developer tool to enhance debugging
*
* See: http://webpack.github.io/docs/configuration.html#devtool
* See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps
*/
devtool: 'source-map',
/*
* The entry point for the bundle
* Our Angular.js app
*
* See: http://webpack.github.io/docs/configuration.html#entry
*/
entry: {
'polyfills': './src/polyfills.browser.ts',
'vendor': './src/vendor.browser.ts',
'main': './src/main.browser.aot.ts'
},
/*
* Options affecting the resolving of modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve
*/
resolve: {
/*
* An array of extensions that should be used to resolve modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['.ts', '.js', '.json', '.scss'],
// An array of directory names to be resolved to the current directory
modules: [helpers.root('src'), 'node_modules'],
},
/**
* Options affecting the output of the compilation.
*
* See: http://webpack.github.io/docs/configuration.html#output
*/
output: {
/**
* The output directory as absolute path (required).
*
* See: http://webpack.github.io/docs/configuration.html#output-path
*/
path: helpers.root('dist'),
/**
* Specifies the name of each output file on disk.
* IMPORTANT: You must not specify an absolute path here!
*
* See: http://webpack.github.io/docs/configuration.html#output-filename
*/
filename: '[name].[chunkhash].bundle.js',
/**
* The filename of the SourceMaps for the JavaScript files.
* They are inside the output.path directory.
*
* See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
*/
sourceMapFilename: '[name].[chunkhash].bundle.map',
/**
* The filename of non-entry chunks as relative path
* inside the output.path directory.
*
* See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
*/
chunkFilename: '[id].[chunkhash].chunk.js'
},
/*
* Options affecting the normal modules.
*
* See: http://webpack.github.io/docs/configuration.html#module
*/
module: {
rules: [
/*
* Typescript loader support for .ts and Angular 2 async routes via .async.ts
* Replace templateUrl and stylesUrl with require()
*
* See: https://github.com/s-panferov/awesome-typescript-loader
* See: https://github.com/TheLarkInn/angular2-template-loader
*/
{
test: /\.ts$/,
loaders: [
// '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,
// 'awesome-typescript-loader',
// 'angular2-template-loader',
// 'angular2-router-loader'
'@ngtools/webpack'
],
exclude: [/\.(spec|e2e)\.ts$/]
},
/*
* Json loader support for *.json files.
*
* See: https://github.com/webpack/json-loader
*/
{
test: /\.json$/,
loader: 'json-loader'
},
/*
* to string and css loader support for *.css files
* Returns file content as string
*
*/
{
test: /\.css$/,
loaders: ['to-string-loader', 'css-loader']
},
/* Raw loader support for *.html
* Returns file content as string
*
* See: https://github.com/webpack/raw-loader
*/
{
test: /\.html$/,
loader: 'raw-loader',
exclude: [helpers.root('src/index.html')]
},
/* File loader for supporting images, for example, in CSS files.
*/
{
test: /\.(jpg|png|gif)$/,
loader: 'file'
},
{
test: /\.css$/,
// loaders: ['to-string-loader', 'css-loader']
use: ['raw-loader']
},
{
test: /\.scss$/,
use: ['raw-loader', 'sass-loader']
},
{
test: /\.woff(2)?(\?v=.+)?$/,
use: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg)(\?v=.+)?$/,
use: 'file-loader'
},
{
test: /initial\.scss$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: 'css-loader!sass-loader?sourceMap'
})
},
],
},
resolveLoader: {
moduleExtensions: ['-loader']
},
/**
* Add additional plugins to the compiler.
*
* See: http://webpack.github.io/docs/configuration.html#plugins
*/
plugins: [
new ExtractTextPlugin({filename: 'initial.css', allChunks: true}),
/**
* Plugin: WebpackMd5Hash
* Description: Plugin to replace a standard webpack chunkhash with md5.
*
* See: https://www.npmjs.com/package/webpack-md5-hash
*/
new WebpackMd5Hash(),
new ngtools.AotPlugin({
tsConfigPath: './tsconfig.aot.json',
baseDir: process.cwd(),
entryModule: helpers.root('src/app/app.module') + '#AppModule'
}),
new AssetsPlugin({
path: helpers.root('dist'),
filename: 'webpack-assets.json',
prettyPrint: true
}),
/*
* Plugin: ForkCheckerPlugin
* Description: Do type checking in a separate process, so webpack don't need to wait.
*
* See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse
*/
new ForkCheckerPlugin(),
/*
* Plugin: CommonsChunkPlugin
* Description: Shares common code between the pages.
* It identifies common modules and put them into a commons chunk.
*
* See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
* See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
*/
new CommonsChunkPlugin({
name: ['polyfills', 'vendor'].reverse()
}),
/**
* Plugin: ContextReplacementPlugin
* Description: Provides context to Angular's use of System.import
*
* See: https://webpack.github.io/docs/list-of-plugins.html#contextreplacementplugin
* See: https://github.com/angular/angular/issues/11580
*/
new ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
helpers.root('src') // location of your src
),
/**
* Plugin: DedupePlugin
* Description: Prevents the inclusion of duplicate code into your bundle
* and instead applies a copy of the function at runtime.
*
* See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
* See: https://github.com/webpack/docs/wiki/optimization#deduplication
*/
// new DedupePlugin(), // see: https://github.com/angular/angular-cli/issues/1587
/**
* Plugin: DefinePlugin
* Description: Define free variables.
* Useful for having development builds with debug logging or adding global constants.
*
* фironment helpers
*
* See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
*/
// NOTE: when adding more properties make sure you include them in custom-typings.d.ts
new DefinePlugin({
'ENV': JSON.stringify(METADATA.ENV),
'HMR': METADATA.HMR,
'process.env': {
'ENV': JSON.stringify(METADATA.ENV),
'NODE_ENV': JSON.stringify(METADATA.ENV),
'HMR': METADATA.HMR,
}
}),
/**
* Plugin: UglifyJsPlugin
* Description: Minimize all JavaScript output of chunks.
* Loaders are switched into minimizing mode.
*
* See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
*/
// NOTE: To debug prod builds uncomment //debug lines and comment //prod lines
// new UglifyJsPlugin({
// // beautify: true, //debug
// // mangle: false, //debug
// // dead_code: false, //debug
// // unused: false, //debug
// // deadCode: false, //debug
// // compress: {
// // screw_ie8: true,
// // keep_fnames: true,
// // drop_debugger: false,
// // dead_code: false,
// // unused: false
// // }, // debug
// // comments: true, //debug
//
//
// beautify: false, //prod
// mangle: {
// screw_ie8: true,
// keep_fnames: true
// }, //prod
// compress: {
// screw_ie8: true
// }, //prod
// comments: false //prod
// }),
/**
* Plugin: NormalModuleReplacementPlugin
* Description: Replace resources that matches resourceRegExp with newResource
*
* See: http://webpack.github.io/docs/list-of-plugins.html#normalmodulereplacementplugin
*/
new NormalModuleReplacementPlugin(
/angular2-hmr/,
helpers.root('config/modules/angular2-hmr-prod.js')
),
/**
* Plugin: IgnorePlugin
* Description: Dont generate modules for requests matching the provided RegExp.
*
* See: http://webpack.github.io/docs/list-of-plugins.html#ignoreplugin
*/
// new IgnorePlugin(/angular2-hmr/),
/**
* Plugin: CompressionPlugin
* Description: Prepares compressed versions of assets to serve
* them with Content-Encoding
*
* See: https://github.com/webpack/compression-webpack-plugin
*/
// install compression-webpack-plugin
// new CompressionPlugin({
// regExp: /\.css$|\.html$|\.js$|\.map$/,
// threshold: 2 * 1024
// })
/*
* Plugin: CopyWebpackPlugin
* Description: Copy files and directories in webpack.
*
* Copies project static assets.
*
* See: https://www.npmjs.com/package/copy-webpack-plugin
*/
new CopyWebpackPlugin([
{ from: 'src/assets', to: 'assets' },
{ from: 'node_modules/ckeditor', to: 'ckeditor' },
{ from: 'src/meta'}
]),
/*
* Plugin: HtmlWebpackPlugin
* Description: Simplifies creation of HTML files to serve your webpack bundles.
* This is especially useful for webpack bundles that include a hash in the filename
* which changes every compilation.
*
* See: https://github.com/ampedandwired/html-webpack-plugin
*/
new HtmlWebpackPlugin({
template: 'src/index.html',
title: METADATA.title,
chunksSortMode: 'dependency',
metadata: METADATA,
inject: 'head'
}),
/*
* Plugin: ScriptExtHtmlWebpackPlugin
* Description: Enhances html-webpack-plugin functionality
* with different deployment options for your scripts including:
*
* See: https://github.com/numical/script-ext-html-webpack-plugin
*/
new ScriptExtHtmlWebpackPlugin({
defaultAttribute: 'defer'
}),
/*
* Plugin: HtmlHeadConfigPlugin
* Description: Generate html tags based on javascript maps.
*
* If a publicPath is set in the webpack output configuration, it will be automatically added to
* href attributes, you can disable that by adding a "=href": false property.
* You can also enable it to other attribute by settings "=attName": true.
*
* The configuration supplied is map between a location (key) and an element definition object (value)
* The location (key) is then exported to the template under then htmlElements property in webpack configuration.
*
* Example:
* Adding this plugin configuration
* new HtmlElementsPlugin({
* headTags: { ... }
* })
*
* Means we can use it in the template like this:
* <%= webpackConfig.htmlElements.headTags %>
*
* Dependencies: HtmlWebpackPlugin
*/
new HtmlElementsPlugin({
headTags: require('./head-config.common')
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
Tether: "tether",
"window.Tether": "tether",
Tooltip: "exports-loader?Tooltip!bootstrap/js/dist/tooltip",
Alert: "exports-loader?Alert!bootstrap/js/dist/alert",
Button: "exports-loader?Button!bootstrap/js/dist/button",
Carousel: "exports-loader?Carousel!bootstrap/js/dist/carousel",
Collapse: "exports-loader?Collapse!bootstrap/js/dist/collapse",
Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
Modal: "exports-loader?Modal!bootstrap/js/dist/modal",
Popover: "exports-loader?Popover!bootstrap/js/dist/popover",
Scrollspy: "exports-loader?Scrollspy!bootstrap/js/dist/scrollspy",
Tab: "exports-loader?Tab!bootstrap/js/dist/tab",
Util: "exports-loader?Util!bootstrap/js/dist/util"
}),
/**
* Plugin LoaderOptionsPlugin (experimental)
*
* See: https://gist.github.com/sokra/27b24881210b56bbaff7
*/
new LoaderOptionsPlugin({
debug: false,
options: {
context: helpers.root('src'),
output: {
path: helpers.root('dist')
},
/**
* Static analysis linter for TypeScript advanced options configuration
* Description: An extensible linter for the TypeScript language.
*
* See: https://github.com/wbuchwalter/tslint-loader
*/
tslint: {
emitErrors: true,
failOnHint: true,
resourcePath: 'src'
},
/**
* Html loader advanced options
*
* See: https://github.com/webpack/html-loader#advanced-options
*/
// TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor
htmlLoader: {
minimize: true,
removeAttributeQuotes: false,
caseSensitive: true,
customAttrSurround: [
[/#/, /(?:)/],
[/\*/, /(?:)/],
[/\[?\(?/, /(?:)/]
],
customAttrAssign: [/\)?\]?=/]
},
}
}),
],
/*
* Include polyfills or mocks for various node stuff
* Description: Node configuration
*
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: true,
crypto: 'empty',
process: false,
module: false,
clearImmediate: false,
setImmediate: false
}
}
}

5616
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -6,15 +6,15 @@
"homepage": "http://akveo.github.io/ng2-admin/",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.4",
"@angular/compiler": "~2.4.4",
"@angular/core": "~2.4.4",
"@angular/forms": "~2.4.4",
"@angular/http": "~2.4.4",
"@angular/platform-browser": "~2.4.4",
"@angular/platform-browser-dynamic": "~2.4.4",
"@angular/platform-server": "~2.4.4",
"@angular/router": "~3.4.4",
"@angular/common": "2.4.4",
"@angular/compiler": "2.4.4",
"@angular/core": "2.4.4",
"@angular/forms": "2.4.4",
"@angular/http": "2.4.4",
"@angular/platform-browser": "2.4.4",
"@angular/platform-browser-dynamic": "2.4.4",
"@angular/platform-server": "2.4.4",
"@angular/router": "3.4.4",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.2",
"@angularclass/hmr-loader": "~3.0.2",
@ -23,7 +23,7 @@
"animate.css": "^3.5.1",
"bootstrap": "4.0.0-alpha.4",
"chart.js": "^1.1.1",
"chartist": "^0.9.7",
"chartist": "^0.10.1",
"ckeditor": "4.6.0",
"core-js": "^2.4.1",
"easy-pie-chart": "^2.1.7",
@ -42,7 +42,7 @@
"lodash": "^4.12.0",
"ng2-bootstrap": "1.1.16-11",
"ng2-ckeditor": "1.1.5",
"ng2-smart-table": "^0.3.2",
"ng2-smart-table": "^0.5.1-0",
"ng2-tree": "^2.0.0-alpha.0",
"ngx-uploader": "^2.0.24",
"normalize.css": "^4.1.1",
@ -52,7 +52,7 @@
"zone.js": "~0.7.4"
},
"devDependencies": {
"@angular/compiler-cli": "~2.4.3",
"@angular/compiler-cli": "2.4.4",
"@types/electron": "^1.3.20",
"@types/fullcalendar": "^2.7.35",
"@types/hammerjs": "^2.0.33",
@ -183,7 +183,6 @@
"url": "https://github.com/akveo/ng2-admin/issues"
},
"engines": {
"node": ">= 4.2.1",
"npm": ">= 3"
"node": ">= 5.4.1 < 7"
}
}

View file

@ -184,14 +184,14 @@ export const PAGES_MENU = [
}
}
},
// {
// path: 'smarttables',
// data: {
// menu: {
// title: 'Smart Tables',
// }
// }
// }
{
path: 'smarttables',
data: {
menu: {
title: 'Smart Tables',
}
}
}
]
},
{

View file

@ -0,0 +1 @@
export * from './smartTables.component';

View file

@ -0,0 +1,74 @@
import { Component, ViewEncapsulation } from '@angular/core';
import { SmartTablesService } from './smartTables.service';
import { LocalDataSource } from 'ng2-smart-table';
@Component({
selector: 'basic-tables',
encapsulation: ViewEncapsulation.None,
styleUrls: ['./smartTables.scss'],
templateUrl: './smartTables.html',
})
export class SmartTables {
query: string = '';
settings = {
add: {
addButtonContent: '<i class="ion-ios-plus-outline"></i>',
createButtonContent: '<i class="ion-checkmark"></i>',
cancelButtonContent: '<i class="ion-close"></i>',
},
edit: {
editButtonContent: '<i class="ion-edit"></i>',
saveButtonContent: '<i class="ion-checkmark"></i>',
cancelButtonContent: '<i class="ion-close"></i>',
},
delete: {
deleteButtonContent: '<i class="ion-trash-a"></i>',
confirmDelete: true
},
columns: {
id: {
title: 'ID',
type: 'number'
},
firstName: {
title: 'First Name',
type: 'string'
},
lastName: {
title: 'Last Name',
type: 'string'
},
username: {
title: 'Username',
type: 'string'
},
email: {
title: 'E-mail',
type: 'string'
},
age: {
title: 'Age',
type: 'number'
}
}
};
source: LocalDataSource = new LocalDataSource();
constructor(protected service: SmartTablesService) {
this.service.getData().then((data) => {
this.source.load(data);
});
}
onDeleteConfirm(event): void {
if (window.confirm('Are you sure you want to delete?')) {
event.confirm.resolve();
} else {
event.confirm.reject();
}
}
}

View file

@ -0,0 +1,9 @@
<div class="widgets">
<div class="row">
<ba-card title="Basic Example" baCardClass="with-scroll">
<ng2-smart-table [settings]="settings" [source]="source" (deleteConfirm)="onDeleteConfirm($event)"></ng2-smart-table>
</ba-card>
</div>
</div>

View file

@ -0,0 +1,59 @@
@import "../../../../theme/sass/conf/conf";
.ng2-smart-table-container table.ng2-smart-table {
th, td {
border: 1px solid $border-light !important;
line-height: 35px;
vertical-align: middle;
}
color: $default-text;
input {
line-height: 1.5 !important;
}
tbody {
tr:hover {
background: rgba(0, 0, 0, 0.03);
}
}
a.ng2-smart-sort-link {
font-size: 14px !important;
color: $default-text;
font-weight: $font-bolder;
&.sort {
font-weight: $font-bolder !important;
&::after {
border-bottom-color: $default-text !important;
}
}
}
.ng2-smart-actions {
width: 70px;
text-align: center;
.actions {
float: none;
text-align: center;
}
}
a.ng2-smart-action {
font-size: 14px !important;
color: $default-text;
padding: 0 5px;
display: inline-block;
&.ng2-smart-action-add-add {
font-size: 25px !important;
}
}
}
nav.ng2-smart-pagination-nav {
display: flex;
justify-content: center;
}

View file

@ -0,0 +1,549 @@
import {Injectable} from '@angular/core';
@Injectable()
export class SmartTablesService {
smartTableData = [
{
id: 1,
firstName: 'Mark',
lastName: 'Otto',
username: '@mdo',
email: 'mdo@gmail.com',
age: '28'
},
{
id: 2,
firstName: 'Jacob',
lastName: 'Thornton',
username: '@fat',
email: 'fat@yandex.ru',
age: '45'
},
{
id: 3,
firstName: 'Larry',
lastName: 'Bird',
username: '@twitter',
email: 'twitter@outlook.com',
age: '18'
},
{
id: 4,
firstName: 'John',
lastName: 'Snow',
username: '@snow',
email: 'snow@gmail.com',
age: '20'
},
{
id: 5,
firstName: 'Jack',
lastName: 'Sparrow',
username: '@jack',
email: 'jack@yandex.ru',
age: '30'
},
{
id: 6,
firstName: 'Ann',
lastName: 'Smith',
username: '@ann',
email: 'ann@gmail.com',
age: '21'
},
{
id: 7,
firstName: 'Barbara',
lastName: 'Black',
username: '@barbara',
email: 'barbara@yandex.ru',
age: '43'
},
{
id: 8,
firstName: 'Sevan',
lastName: 'Bagrat',
username: '@sevan',
email: 'sevan@outlook.com',
age: '13'
},
{
id: 9,
firstName: 'Ruben',
lastName: 'Vardan',
username: '@ruben',
email: 'ruben@gmail.com',
age: '22'
},
{
id: 10,
firstName: 'Karen',
lastName: 'Sevan',
username: '@karen',
email: 'karen@yandex.ru',
age: '33'
},
{
id: 11,
firstName: 'Mark',
lastName: 'Otto',
username: '@mark',
email: 'mark@gmail.com',
age: '38'
},
{
id: 12,
firstName: 'Jacob',
lastName: 'Thornton',
username: '@jacob',
email: 'jacob@yandex.ru',
age: '48'
},
{
id: 13,
firstName: 'Haik',
lastName: 'Hakob',
username: '@haik',
email: 'haik@outlook.com',
age: '48'
},
{
id: 14,
firstName: 'Garegin',
lastName: 'Jirair',
username: '@garegin',
email: 'garegin@gmail.com',
age: '40'
},
{
id: 15,
firstName: 'Krikor',
lastName: 'Bedros',
username: '@krikor',
email: 'krikor@yandex.ru',
age: '32'
},
{
"id": 16,
"firstName": "Francisca",
"lastName": "Brady",
"username": "@Gibson",
"email": "franciscagibson@comtours.com",
"age": 11
},
{
"id": 17,
"firstName": "Tillman",
"lastName": "Figueroa",
"username": "@Snow",
"email": "tillmansnow@comtours.com",
"age": 34
},
{
"id": 18,
"firstName": "Jimenez",
"lastName": "Morris",
"username": "@Bryant",
"email": "jimenezbryant@comtours.com",
"age": 45
},
{
"id": 19,
"firstName": "Sandoval",
"lastName": "Jacobson",
"username": "@Mcbride",
"email": "sandovalmcbride@comtours.com",
"age": 32
},
{
"id": 20,
"firstName": "Griffin",
"lastName": "Torres",
"username": "@Charles",
"email": "griffincharles@comtours.com",
"age": 19
},
{
"id": 21,
"firstName": "Cora",
"lastName": "Parker",
"username": "@Caldwell",
"email": "coracaldwell@comtours.com",
"age": 27
},
{
"id": 22,
"firstName": "Cindy",
"lastName": "Bond",
"username": "@Velez",
"email": "cindyvelez@comtours.com",
"age": 24
},
{
"id": 23,
"firstName": "Frieda",
"lastName": "Tyson",
"username": "@Craig",
"email": "friedacraig@comtours.com",
"age": 45
},
{
"id": 24,
"firstName": "Cote",
"lastName": "Holcomb",
"username": "@Rowe",
"email": "coterowe@comtours.com",
"age": 20
},
{
"id": 25,
"firstName": "Trujillo",
"lastName": "Mejia",
"username": "@Valenzuela",
"email": "trujillovalenzuela@comtours.com",
"age": 16
},
{
"id": 26,
"firstName": "Pruitt",
"lastName": "Shepard",
"username": "@Sloan",
"email": "pruittsloan@comtours.com",
"age": 44
},
{
"id": 27,
"firstName": "Sutton",
"lastName": "Ortega",
"username": "@Black",
"email": "suttonblack@comtours.com",
"age": 42
},
{
"id": 28,
"firstName": "Marion",
"lastName": "Heath",
"username": "@Espinoza",
"email": "marionespinoza@comtours.com",
"age": 47
},
{
"id": 29,
"firstName": "Newman",
"lastName": "Hicks",
"username": "@Keith",
"email": "newmankeith@comtours.com",
"age": 15
},
{
"id": 30,
"firstName": "Boyle",
"lastName": "Larson",
"username": "@Summers",
"email": "boylesummers@comtours.com",
"age": 32
},
{
"id": 31,
"firstName": "Haynes",
"lastName": "Vinson",
"username": "@Mckenzie",
"email": "haynesmckenzie@comtours.com",
"age": 15
},
{
"id": 32,
"firstName": "Miller",
"lastName": "Acosta",
"username": "@Young",
"email": "milleryoung@comtours.com",
"age": 55
},
{
"id": 33,
"firstName": "Johnston",
"lastName": "Brown",
"username": "@Knight",
"email": "johnstonknight@comtours.com",
"age": 29
},
{
"id": 34,
"firstName": "Lena",
"lastName": "Pitts",
"username": "@Forbes",
"email": "lenaforbes@comtours.com",
"age": 25
},
{
"id": 35,
"firstName": "Terrie",
"lastName": "Kennedy",
"username": "@Branch",
"email": "terriebranch@comtours.com",
"age": 37
},
{
"id": 36,
"firstName": "Louise",
"lastName": "Aguirre",
"username": "@Kirby",
"email": "louisekirby@comtours.com",
"age": 44
},
{
"id": 37,
"firstName": "David",
"lastName": "Patton",
"username": "@Sanders",
"email": "davidsanders@comtours.com",
"age": 26
},
{
"id": 38,
"firstName": "Holden",
"lastName": "Barlow",
"username": "@Mckinney",
"email": "holdenmckinney@comtours.com",
"age": 11
},
{
"id": 39,
"firstName": "Baker",
"lastName": "Rivera",
"username": "@Montoya",
"email": "bakermontoya@comtours.com",
"age": 47
},
{
"id": 40,
"firstName": "Belinda",
"lastName": "Lloyd",
"username": "@Calderon",
"email": "belindacalderon@comtours.com",
"age": 21
},
{
"id": 41,
"firstName": "Pearson",
"lastName": "Patrick",
"username": "@Clements",
"email": "pearsonclements@comtours.com",
"age": 42
},
{
"id": 42,
"firstName": "Alyce",
"lastName": "Mckee",
"username": "@Daugherty",
"email": "alycedaugherty@comtours.com",
"age": 55
},
{
"id": 43,
"firstName": "Valencia",
"lastName": "Spence",
"username": "@Olsen",
"email": "valenciaolsen@comtours.com",
"age": 20
},
{
"id": 44,
"firstName": "Leach",
"lastName": "Holcomb",
"username": "@Humphrey",
"email": "leachhumphrey@comtours.com",
"age": 28
},
{
"id": 45,
"firstName": "Moss",
"lastName": "Baxter",
"username": "@Fitzpatrick",
"email": "mossfitzpatrick@comtours.com",
"age": 51
},
{
"id": 46,
"firstName": "Jeanne",
"lastName": "Cooke",
"username": "@Ward",
"email": "jeanneward@comtours.com",
"age": 59
},
{
"id": 47,
"firstName": "Wilma",
"lastName": "Briggs",
"username": "@Kidd",
"email": "wilmakidd@comtours.com",
"age": 53
},
{
"id": 48,
"firstName": "Beatrice",
"lastName": "Perry",
"username": "@Gilbert",
"email": "beatricegilbert@comtours.com",
"age": 39
},
{
"id": 49,
"firstName": "Whitaker",
"lastName": "Hyde",
"username": "@Mcdonald",
"email": "whitakermcdonald@comtours.com",
"age": 35
},
{
"id": 50,
"firstName": "Rebekah",
"lastName": "Duran",
"username": "@Gross",
"email": "rebekahgross@comtours.com",
"age": 40
},
{
"id": 51,
"firstName": "Earline",
"lastName": "Mayer",
"username": "@Woodward",
"email": "earlinewoodward@comtours.com",
"age": 52
},
{
"id": 52,
"firstName": "Moran",
"lastName": "Baxter",
"username": "@Johns",
"email": "moranjohns@comtours.com",
"age": 20
},
{
"id": 53,
"firstName": "Nanette",
"lastName": "Hubbard",
"username": "@Cooke",
"email": "nanettecooke@comtours.com",
"age": 55
},
{
"id": 54,
"firstName": "Dalton",
"lastName": "Walker",
"username": "@Hendricks",
"email": "daltonhendricks@comtours.com",
"age": 25
},
{
"id": 55,
"firstName": "Bennett",
"lastName": "Blake",
"username": "@Pena",
"email": "bennettpena@comtours.com",
"age": 13
},
{
"id": 56,
"firstName": "Kellie",
"lastName": "Horton",
"username": "@Weiss",
"email": "kellieweiss@comtours.com",
"age": 48
},
{
"id": 57,
"firstName": "Hobbs",
"lastName": "Talley",
"username": "@Sanford",
"email": "hobbssanford@comtours.com",
"age": 28
},
{
"id": 58,
"firstName": "Mcguire",
"lastName": "Donaldson",
"username": "@Roman",
"email": "mcguireroman@comtours.com",
"age": 38
},
{
"id": 59,
"firstName": "Rodriquez",
"lastName": "Saunders",
"username": "@Harper",
"email": "rodriquezharper@comtours.com",
"age": 20
},
{
"id": 60,
"firstName": "Lou",
"lastName": "Conner",
"username": "@Sanchez",
"email": "lousanchez@comtours.com",
"age": 16
}
];
metricsTableData = [
{
image: 'app/browsers/chrome.svg',
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.smartTableData);
}, 2000);
});
}
}

View file

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgaModule } from '../../theme/nga.module';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { routing } from './tables.routing';
import { Tables } from './tables.component';
@ -13,14 +14,16 @@ import { BorderedTable } from './components/basicTables/components/borderedTable
import { HoverTable } from './components/basicTables/components/hoverTable';
import { CondensedTable } from './components/basicTables/components/condensedTable';
import { ContextualTable } from './components/basicTables/components/contextualTable';
import { SmartTables } from './components/smartTables/smartTables.component';
import { SmartTablesService } from './components/smartTables/smartTables.service';
@NgModule({
imports: [
CommonModule,
FormsModule,
NgaModule,
routing
routing,
Ng2SmartTableModule,
],
declarations: [
Tables,
@ -30,10 +33,13 @@ import { ContextualTable } from './components/basicTables/components/contextualT
CondensedTable,
StripedTable,
ContextualTable,
ResponsiveTable
ResponsiveTable,
SmartTables,
],
providers: [
BasicTablesService
BasicTablesService,
SmartTablesService,
]
})
export class TablesModule {}
export class TablesModule {
}

View file

@ -2,6 +2,7 @@ import { Routes, RouterModule } from '@angular/router';
import { Tables } from './tables.component';
import { BasicTables } from './components/basicTables/basicTables.component';
import { SmartTables } from './components/smartTables/smartTables.component';
// noinspection TypeScriptValidateTypes
const routes: Routes = [
@ -9,7 +10,8 @@ const routes: Routes = [
path: '',
component: Tables,
children: [
{ path: 'basictables', component: BasicTables }
{ path: 'basictables', component: BasicTables },
{ path: 'smarttables', component: SmartTables }
]
}
];

View file

@ -5,27 +5,16 @@
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"paths": {
},
"lib": [
"dom",
"es6"
"es2015",
"dom"
],
"typeRoots": [
"node_modules/@types"
],
"types": [
"hammerjs",
"node",
"source-map",
"uglify-js",
"webpack"
]
},
"exclude": [
@ -38,5 +27,7 @@
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
"atom": {
"rewriteTsconfig": false
}
}

View file

@ -1,16 +1,13 @@
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"noEmit": true,
"noEmitHelpers": true,
"strictNullChecks": false,
"baseUrl": "./src",
"outDir": "compiled",
"paths": {
},
"lib": [
@ -19,19 +16,12 @@
],
"typeRoots": [
"node_modules/@types"
],
"types": [
"hammerjs",
"node",
"source-map",
"webpack",
"fullcalendar",
"jquery.slimscroll"
]
},
"exclude": [
"node_modules",
"dist",
"compiled",
"src/**/*.spec.ts",
"src/**/*.e2e.ts"
],
@ -40,10 +30,12 @@
"useWebpackText": true
},
"angularCompilerOptions": {
"genDir": "./compiled",
"genDir": "compiled",
"skipMetadataEmit": true
},
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
"atom": {
"rewriteTsconfig": false
}
}