Skip to content

Commit 4ed294e

Browse files
author
pipeline
committed
feature(EJ2-4805): Merged the TreeView React samples
1 parent f0c26d5 commit 4ed294e

37 files changed

+910
-0
lines changed

src/common/samplelist.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { toolbarAppRoutes } from '../toolbar/toolbar.module';
66
import { accordionAppRoutes } from '../accordion/accordion.module';
77
import { numericAppRoutes } from '../numerictextbox/numerictextbox.module';
88
import { dropdownlistAppRoutes } from '../dropdownlist/dropdownlist.module';
9+
import { treeAppRoutes } from '../treeview/treeview.module';
910
import { comboboxAppRoutes } from '../combobox/combobox.module';
1011
import { autoCompleteAppRoutes } from '../autocomplete/autocomplete.module';
1112
import { calendarAppRoutes } from '../calendar/calendar.module';
@@ -82,6 +83,9 @@ export let samplesList: any = [
8283
},
8384
{
8485
'name': 'Toolbar', 'category': 'Navigation', 'order': '05', 'path': 'toolbar', 'samples': toolbarAppRoutes
86+
},
87+
{
88+
'name': 'TreeView', 'category': 'Navigation', 'order': '05', 'path': 'treeview', 'samples': treeAppRoutes, "type": "new"
8589
},
8690
{
8791
'name': 'Tooltip', 'category': 'Layout', 'order': '04', 'path': 'tooltip', 'samples': tooltipAppRoutes

src/common/sb.router.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { DateRangePickerSampleModule } from '../daterangepicker/daterangepicker.
1010
import { TimePickerSampleModule } from '../timepicker/timepicker.module';
1111
import { ButtonModule } from '../button/button.module';
1212
import { ListViewSampleModule } from '../listview/listview.module';
13+
import { TreeViewSampleModule } from '../treeview/treeview.module';
1314
import { GridSampleModule } from '../grid/grid.module';
1415
import { ToolbarSampleModule } from '../toolbar/toolbar.module';
1516
import { AccordionSampleModule } from '../accordion/accordion.module';
@@ -45,6 +46,7 @@ const appRoutes: any = [
4546
{ path: 'textboxes', loadChildren: TextboxesModule },
4647
{ path: 'toolbar', loadChildren: ToolbarSampleModule },
4748
{ path: 'accordion', loadChildren: AccordionSampleModule },
49+
{ path: 'treeview', loadChildren: TreeViewSampleModule },
4850
{ path: 'tooltip', loadChildren: TooltipSampleModule },
4951
{ path: 'maskedtextbox', loadChildren: MaskedTextBoxSampleModule },
5052
{ path: 'multiselect', loadChildren: MultiSelectSampleModule },
@@ -74,6 +76,7 @@ const appRoutes: any = [
7476
DialogSampleModule,
7577
ToolbarSampleModule,
7678
AccordionSampleModule,
79+
TreeViewSampleModule,
7780
TooltipSampleModule,
7881
MaskedTextBoxSampleModule,
7982
MultiSelectSampleModule,

src/treeview/checkbox-plnkr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"common/shared.module":"import { NgModule } from '@angular/core';\nimport { ButtonModule } from '@syncfusion/ej2-ng-buttons';\nimport { ListViewModule } from '@syncfusion/ej2-ng-lists';\nimport { DropDownListModule } from '@syncfusion/ej2-ng-dropdowns';\n\n\n@NgModule({\n imports: [\n ButtonModule,\n ListViewModule,\n DropDownListModule\n ],\n \n exports: [\n ButtonModule,\n ListViewModule,\n DropDownListModule\n ]\n})\nexport class SharedModule { }\n","app.module":"import { CheckboxTreeViewComponent } from './checkbox.component';\nimport { HttpModule, JsonpModule } from '@angular/http';\nimport { BrowserModule } from '@angular/platform-browser';\nimport 'rxjs/add/operator/map';\nimport { NgModule, ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';\n\nimport { TreeViewModule } from '@syncfusion/ej2-ng-navigations';\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { SharedModule } from './common/shared.module';\n\n\n\n\n\n@NgModule({\n imports: [TreeViewModule, SharedModule, HttpModule, JsonpModule, BrowserModule],\ndeclarations: [CheckboxTreeViewComponent],\nbootstrap: [CheckboxTreeViewComponent]\n})\nexport class AppModule { }","checkbox.component":"import { Component, Inject } from '@angular/core';\n\n/**\n * TreeView Checkboxes sample\n */\n@Component({\n selector: 'control-content',\n templateUrl: 'checkbox.html'\n})\nexport class CheckboxTreeViewComponent {\n\n public countries: Object[] = [\n { id: 1, name: 'Australia', hasChild: true, expanded: true },\n { id: 2, pid: 1, name: 'New South Wales' },\n { id: 3, pid: 1, name: 'Victoria' },\n { id: 4, pid: 1, name: 'South Australia' },\n { id: 6, pid: 1, name: 'Western Australia' },\n { id: 7, name: 'Brazil', hasChild: true },\n { id: 8, pid: 7, name: 'Paraná' },\n { id: 9, pid: 7, name: 'Ceará' },\n { id: 10, pid: 7, name: 'Acre' },\n { id: 11, name: 'China', hasChild: true },\n { id: 12, pid: 11, name: 'Guangzhou' },\n { id: 13, pid: 11, name: 'Shanghai' },\n { id: 14, pid: 11, name: 'Beijing' },\n { id: 15, pid: 11, name: 'Shantou' },\n { id: 16, name: 'France', hasChild: true },\n { id: 17, pid: 16, name: 'Pays de la Loire' },\n { id: 18, pid: 16, name: 'Aquitaine' },\n { id: 19, pid: 16, name: 'Brittany' },\n { id: 20, pid: 16, name: 'Lorraine' },\n { id: 21, name: 'India', hasChild: true },\n { id: 22, pid: 21, name: 'Assam' },\n { id: 23, pid: 21, name: 'Bihar' },\n { id: 24, pid: 21, name: 'Tamil Nadu' },\n { id: 25, pid: 21, name: 'Punjab' }\n ];\n public field:Object ={ dataSource: this.countries, id: 'id', parentID: 'pid', text: 'name', hasChildren: 'hasChild' };\n public showCheckBox:boolean = true;\n}","checkbox.html":"<div class=\"control-section\" style=\"overflow:hidden;\">\n <div class=\"col-lg-12\">\n <div class=\"control_wrapper\">\n <ej-treeview id=\"checkbox\" [fields]='field' [showCheckBox]='showCheckBox'></ej-treeview>\n </div>\n </div>\n</div>\n<style>\n .control_wrapper {\n max-width: 500px;\n margin: auto;\n border: 1px solid #dddddd;\n border-radius: 3px;\n }\n</style>","index.html":"<!DOCTYPE html>\n<html>\n \n <head>\n <meta name=\"author\" content=\"Syncfusion\" />\n <link href=\"http://npmci.syncfusion.com/packages/production/material.css\" rel=\"stylesheet\" />\n <script src=\"https://unpkg.com/core-js/client/shim.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.25/zone.min.js\"></script>\n <script src=\"https://unpkg.com/[email protected]\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js\"></script>\n <script src=\"systemjs.config.js\"></script>\n </head>\n \n <body>\n <control-content>\n <div id='loader'>Loading...</div>\n </control-content>\n </body>\n \n </html>\n ","systemjs.config.js":"System.config({\n transpiler: \"typescript\",\n typescriptOptions: {\n compilerOptions: {\n target: \"umd\",\n module: \"commonjs\",\n moduleResolution: \"node\",\n emitDecoratorMetadata: true,\n experimentalDecorators: true\n }\n },\n paths: {\n \"syncfusion:\": \"http://npmci.syncfusion.com/packages/production/\",\n \"angular:\": \"https://unpkg.com/@angular/\"\n },\n map: {\n main: 'main.ts',\n typescript: \"https://unpkg.com/[email protected]/lib/typescript.js\",\n \"plugin-json\":\"https://cdnjs.cloudflare.com/ajax/libs/systemjs-plugin-json/0.3.0/json.min.js\",\n \"@syncfusion/ej2-base\": \"syncfusion:ej2-base/dist/ej2-base.umd.min.js\",\n \"@syncfusion/ej2-buttons\": \"syncfusion:ej2-buttons/dist/ej2-buttons.umd.min.js\",\n \"@syncfusion/ej2-calendars\": \"syncfusion:ej2-calendars/dist/ej2-calendars.umd.min.js\",\n \"@syncfusion/ej2-charts\": \"syncfusion:ej2-charts/dist/ej2-charts.umd.min.js\",\n \"@syncfusion/ej2-circulargauge\": \"syncfusion:ej2-circulargauge/dist/ej2-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-data\": \"syncfusion:ej2-data/dist/ej2-data.umd.min.js\",\n \"@syncfusion/ej2-dropdowns\": \"syncfusion:ej2-dropdowns/dist/ej2-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-grids\": \"syncfusion:ej2-grids/dist/ej2-grids.umd.min.js\",\n \"@syncfusion/ej2-inputs\": \"syncfusion:ej2-inputs/dist/ej2-inputs.umd.min.js\",\n \"@syncfusion/ej2-lists\": \"syncfusion:ej2-lists/dist/ej2-lists.umd.min.js\",\n \"@syncfusion/ej2-navigations\": \"syncfusion:ej2-navigations/dist/ej2-navigations.umd.min.js\",\n \"@syncfusion/ej2-popups\": \"syncfusion:ej2-popups/dist/ej2-popups.umd.min.js\",\n \"@syncfusion/ej2-lineargauge\": \"syncfusion:ej2-lineargauge/dist/ej2-lineargauge.umd.min.js\",\n \"@syncfusion/ej2-pdf\": \"syncfusion:ej2-pdf/dist/ej2-pdf.umd.min.js\",\n \"@syncfusion/ej2-compression\": \"syncfusion:ej2-compression/dist/ej2-compression.umd.min.js\",\n \"@syncfusion/ej2-excel-export\": \"syncfusion:ej2-excel-export/dist/ej2-excel-export.umd.min.js\", \n \"@syncfusion/ej2-file-utils\": \"syncfusion:ej2-file-utils/dist/ej2-file-utils.umd.min.js\",\n \n \"@syncfusion/ej2-ng-base\": \"syncfusion:ej2-ng-base/dist/ej2-ng-base.umd.min.js\",\n \"@syncfusion/ej2-ng-buttons\": \"syncfusion:ej2-ng-buttons/dist/ej2-ng-buttons.umd.min.js\",\n \"@syncfusion/ej2-ng-calendars\": \"syncfusion:ej2-ng-calendars/dist/ej2-ng-calendars.umd.min.js\",\n \"@syncfusion/ej2-ng-charts\": \"syncfusion:ej2-ng-charts/dist/ej2-ng-charts.umd.min.js\",\n \"@syncfusion/ej2-ng-circulargauge\": \"syncfusion:ej2-ng-circulargauge/dist/ej2-ng-circulargauge.umd.min.js\",\n \"@syncfusion/ej2-ng-data\": \"syncfusion:ej2-ng-data/dist/ej2-ng-data.umd.min.js\",\n \"@syncfusion/ej2-ng-dropdowns\": \"syncfusion:ej2-ng-dropdowns/dist/ej2-ng-dropdowns.umd.min.js\",\n \"@syncfusion/ej2-ng-grids\": \"syncfusion:ej2-ng-grids/dist/ej2-ng-grids.umd.min.js\",\n \"@syncfusion/ej2-ng-inputs\": \"syncfusion:ej2-ng-inputs/dist/ej2-ng-inputs.umd.min.js\",\n \"@syncfusion/ej2-ng-lists\": \"syncfusion:ej2-ng-lists/dist/ej2-ng-lists.umd.min.js\",\n \"@syncfusion/ej2-ng-navigations\": \"syncfusion:ej2-ng-navigations/dist/ej2-ng-navigations.umd.min.js\",\n \"@syncfusion/ej2-ng-popups\": \"syncfusion:ej2-ng-popups/dist/ej2-ng-popups.umd.min.js\",\n \"@syncfusion/ej2-ng-lineargauge\": \"syncfusion:ej2-ng-lineargauge/dist/ej2-ng-lineargauge.umd.min.js\",\n\n '@angular/core': 'angular:core/bundles/core.umd.js',\n '@angular/common': 'angular:common/bundles/common.umd.js',\n '@angular/compiler': 'angular:compiler/bundles/compiler.umd.js',\n '@angular/http': 'angular:http/bundles/http.umd.js',\n '@angular/forms': 'angular:forms/bundles/forms.umd.js',\n '@angular/router': 'angular:router/bundles/router.umd.js',\n '@angular/platform-browser': 'angular:platform-browser/bundles/platform-browser.umd.js',\n '@angular/platform-browser-dynamic': 'angular:platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',\n '@angular/material': 'angular:material/bundles/material.umd.js',\n 'rxjs': 'https://unpkg.com/rxjs'\n },\n meta: { \n '*.json': { loader: 'plugin-json' }\n }\n});\n\nSystem.import('main.ts').catch(console.error.bind(console));\n","main.ts":"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { enableProdMode } from '@angular/core';\nimport { AppModule } from './app.module';\nimport { enableRipple } from '@syncfusion/ej2-base';\n\nenableRipple(true);\n\nenableProdMode();\nplatformBrowserDynamic().bootstrapModule(AppModule);"}

src/treeview/checkbox.component.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { Component, Inject } from '@angular/core';
2+
3+
/**
4+
* TreeView Checkboxes sample
5+
*/
6+
@Component({
7+
selector: 'control-content',
8+
templateUrl: 'checkbox.html'
9+
})
10+
export class CheckboxTreeViewComponent {
11+
12+
public countries: Object[] = [
13+
{ id: 1, name: 'Australia', hasChild: true, expanded: true },
14+
{ id: 2, pid: 1, name: 'New South Wales' },
15+
{ id: 3, pid: 1, name: 'Victoria' },
16+
{ id: 4, pid: 1, name: 'South Australia' },
17+
{ id: 6, pid: 1, name: 'Western Australia' },
18+
{ id: 7, name: 'Brazil', hasChild: true },
19+
{ id: 8, pid: 7, name: 'Paraná' },
20+
{ id: 9, pid: 7, name: 'Ceará' },
21+
{ id: 10, pid: 7, name: 'Acre' },
22+
{ id: 11, name: 'China', hasChild: true },
23+
{ id: 12, pid: 11, name: 'Guangzhou' },
24+
{ id: 13, pid: 11, name: 'Shanghai' },
25+
{ id: 14, pid: 11, name: 'Beijing' },
26+
{ id: 15, pid: 11, name: 'Shantou' },
27+
{ id: 16, name: 'France', hasChild: true },
28+
{ id: 17, pid: 16, name: 'Pays de la Loire' },
29+
{ id: 18, pid: 16, name: 'Aquitaine' },
30+
{ id: 19, pid: 16, name: 'Brittany' },
31+
{ id: 20, pid: 16, name: 'Lorraine' },
32+
{ id: 21, name: 'India', hasChild: true },
33+
{ id: 22, pid: 21, name: 'Assam' },
34+
{ id: 23, pid: 21, name: 'Bihar' },
35+
{ id: 24, pid: 21, name: 'Tamil Nadu' },
36+
{ id: 25, pid: 21, name: 'Punjab' }
37+
];
38+
public field:Object ={ dataSource: this.countries, id: 'id', parentID: 'pid', text: 'name', hasChildren: 'hasChild' };
39+
public showCheckBox:boolean = true;
40+
}

src/treeview/checkbox.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div class="control-section" style="overflow:hidden;">
2+
<div class="col-lg-12">
3+
<div class="control_wrapper">
4+
<ej-treeview id="checkbox" [fields]='field' [showCheckBox]='showCheckBox'></ej-treeview>
5+
</div>
6+
</div>
7+
</div>
8+
<div id="description">
9+
<p>The <code>TreeView</code> component can be render with checkbox on the left side of each tree node. This allows the user to check more than one nodes, and this can be enabled by <code>showCheckBox</code> property.</p>
10+
<p>In this demo, the TreeView was populated with checkbox enabled.</p>
11+
<p>For more information, you can refer the <a href="../documentation/treeview/checkboxes.html" target="_blank">Checkboxes</a> section from the documentation.</p>
12+
</div>
13+
<style>
14+
.control_wrapper {
15+
max-width: 500px;
16+
margin: auto;
17+
border: 1px solid #dddddd;
18+
border-radius: 3px;
19+
}
20+
</style>

0 commit comments

Comments
 (0)