-
Notifications
You must be signed in to change notification settings - Fork 877
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
Moved some examples to new /examples route #213
Changes from 1 commit
ae44008
b0e1797
65a4f8b
265dd05
229574d
156e336
88402e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component, OnInit, Input } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'header-component', | ||
templateUrl: 'header.html' | ||
}) | ||
export class HeaderComponent { | ||
|
||
@Input() tagline: string = ''; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<section class="page-header internal"> | ||
<h1 class="project-name"><a routerLink="/">ng2-smart-table</a></h1> | ||
<h2 class="project-tagline">{{ tagline }}</h2> | ||
|
||
<a routerLinkActive="active" routerLink="/demo" class="btn">Quick Start</a> | ||
<a routerLinkActive="active" routerLink="/examples" class="btn">Examples</a> | ||
<a routerLinkActive="active" routerLink="/documentation" class="btn">Documentation</a> | ||
<a target="_blank" href="https://github.com/akveo/ng2-smart-table" class="btn">View on GitHub</a> | ||
</section> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './header/header.component'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
<section class="page-header internal"> | ||
<h1 class="project-name"><a [routerLink]="['']">ng2-smart-table</a></h1> | ||
<h2 class="project-tagline">Documentation</h2> | ||
|
||
<a routerLinkActive="active" routerLink="/demo" class="btn">Quick Start & Demos</a> | ||
<a routerLinkActive="active" routerLink="/documentation" class="btn">Documentation</a> | ||
<a target="_blank" href="https://github.com/akveo/ng2-smart-table" class="btn">View on GitHub</a> | ||
</section> | ||
<header-component [tagline]="'Documentation'"></header-component> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can write a literal value like |
||
|
||
<section class="main-content"> | ||
<h2><a id="documentation" class="anchor" href="#documentation" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Documentation</h2> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename file to |
||
FilterExamplesComponent, | ||
DefaultExampleComponent, | ||
ServerExamplesComponent, | ||
CustomViewEditExamplesComponent, | ||
VariousExamplesComponent } from './examples'; | ||
|
||
export const examplesRoutes = [ | ||
{ | ||
path: '', | ||
component: DefaultExampleComponent | ||
}, | ||
{ | ||
path: 'using-filters', | ||
component: FilterExamplesComponent | ||
}, | ||
{ | ||
path: 'populate-from-server', | ||
component: ServerExamplesComponent | ||
}, | ||
{ | ||
path: 'custom-editors-viewers', | ||
component: CustomViewEditExamplesComponent | ||
}, | ||
{ | ||
path: 'various', | ||
component: VariousExamplesComponent | ||
} | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'examples', | ||
templateUrl: 'examples.html' | ||
}) | ||
export class ExamplesComponent { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<header-component [tagline]="'Examples'"></header-component> | ||
<section class="main-content with-sidebar"> | ||
<nav class="fixed-sidebar"> | ||
<h4>Examples</h4> | ||
<ul class="examples-menu"> | ||
<li><a routerLink="./using-filters" routerLinkActive="active">Advanced & custom filtering</a></li> | ||
<li><a routerLink="./populate-from-server" routerLinkActive="active">Populating with external data</a></li> | ||
<li><a routerLink="./custom-editors-viewers" routerLinkActive="active">Custom editors and viewers</a></li> | ||
<li><a routerLink="./various" routerLinkActive="active">Various</a></li> | ||
</ul> | ||
</nav> | ||
<router-outlet></router-outlet> | ||
</section> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component } from '@angular/core'; | ||
import * as hljs from 'highlight.js'; | ||
|
||
import 'style-loader!../../../../../../node_modules/highlight.js/styles/dracula.css'; | ||
|
||
import 'style-loader!../../demo/demo.scss'; | ||
|
||
@Component({ | ||
selector: 'custom-edit-view-examples', | ||
templateUrl: './custom-edit-view-examples.html', | ||
}) | ||
export class CustomViewEditExamplesComponent { | ||
|
||
snippets = { | ||
customEditorModule: require('raw-loader!../snippets/custom-editor-module.md'), | ||
}; | ||
|
||
ngAfterViewInit(): void { | ||
hljs.initHighlighting(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<h2>Customized edit and view cells examples</h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, for file naming use angular style guide. For example: |
||
<h3><a id="types" class="anchor" href="#types" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Select, Completer and Textarea column types</h3> | ||
<p> | ||
An example on how to use select, completer, textarea column types: | ||
</p> | ||
<div class="with-source"> | ||
<a class="source" href="https://github.com/akveo/ng2-smart-table/blob/master/demo/src/app/pages/demo/components/advanced-example-types.component.ts" target="_blank">Demo Source</a> | ||
<advanced-example-types></advanced-example-types> | ||
</div> | ||
<h3><a id="custom-editor-renderer" class="anchor" href="#custom-editor-renderer" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Custom editor/renderer column type</h3> | ||
<p>An example on how to use a custom cell editor and/or custom cell renderer:</p> | ||
<div class="with-source"> | ||
<a class="source" href="https://github.com/akveo/ng2-smart-table/blob/master/demo/src/app/pages/demo/components/advanced-example-custom-editor.component.ts" target="_blank">Demo Source</a> | ||
<advanced-example-custom-editor></advanced-example-custom-editor> | ||
</div> | ||
<p>When implementing a custom editor or renderer remember to add it to the <code>entryComponents</code> and to the <code>declarations</code> part of your module</p> | ||
<pre> | ||
<code class="typescript">{{ snippets.customEditorModule }}</code> | ||
</pre> | ||
<p> | ||
<b>For the custom cell editor:</b><br> | ||
To inherit the methods needed to interact with the table you can either extend the component with the <code>DefaultEditor</code> class or implement the <code>Editor</code> interface and reproduce the same methods on your component.<br> | ||
<b>For the custom cell renderer:</b><br> | ||
In this example the custom component is applying a <code>.toUpperCase()</code> to one of the columns. You can implement the ViewCell interface to make sure you are setting up your component correctly. | ||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'default-example', | ||
templateUrl: './default.html' | ||
}) | ||
export class DefaultExampleComponent { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<h2>Advanced examples</h2> | ||
<p> | ||
Use the menu on the right to navigate through the examples. | ||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Component } from '@angular/core'; | ||
import * as hljs from 'highlight.js'; | ||
|
||
import 'style-loader!../../../../../../node_modules/highlight.js/styles/dracula.css'; | ||
|
||
import 'style-loader!../../demo/demo.scss'; | ||
|
||
@Component({ | ||
selector: 'filter-examples', | ||
templateUrl: './filter-examples.html', | ||
}) | ||
export class FilterExamplesComponent { | ||
|
||
snippets = { | ||
sourceRequire: require('raw-loader!../snippets/source-require.md'), | ||
createSource: require('raw-loader!../snippets/create-source.md'), | ||
sourceTemplate: require('raw-loader!../snippets/source-template.md'), | ||
search: require('raw-loader!../snippets/search.md'), | ||
searchTable: require('raw-loader!../snippets/search-table.md'), | ||
sourceFull: require('raw-loader!../snippets/source-full.md'), | ||
hideFilters: require('raw-loader!../snippets/hide-filters.md'), | ||
}; | ||
|
||
ngAfterViewInit(): void { | ||
hljs.initHighlighting(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can write
routerLink="demo"
and etc. without slash.