|
npm i -g [email protected]
|
|
"scripts": {
"start": "webpack && webpack-dev-server --open-page src/",
"build": "webpack"
},
"dependencies": {
"@syncfusion/ej2-react-lists": "^16.1.28",
"@syncfusion/ej2-react-navigations": "^16.1.28",
"react": "~16.2.0",
"react-dom": "~16.2.0",
"react-router-dom": "^4.2.2",
"@types/react-router-dom": "^4.2.3",
"@types/react": "~16.0.36",
"@types/react-dom": "~16.0.3",
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
"awesome-typescript-loader": "^3.4.1",
"css-loader": "~0.28.9",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "~1.1.6",
"style-loader": "~0.20.1",
"typescript": "~2.7.1",
"url-loader": "~0.6.2",
"webpack": "~3.10.0",
"webpack-dev-server": "^2.11.1"
}
|
|
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var basePath = __dirname;
module.exports = {
context: path.join(basePath, "src"),
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
entry: [
'./main.tsx',
],
output: {
path: path.resolve('dist'),
filename: 'bundle.js'
},
devServer: {
port: 5001,
stats: 'errors-only'
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
loader: 'awesome-typescript-loader',
options: {
useBabel: true,
},
},
{
test: /\.css$/,
include: /node_modules/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: {
loader: 'css-loader',
},
}),
},
]
},
plugins: [
new ExtractTextPlugin({
filename: 'bundle.css',
disable: false,
allChunks: true,
}),
]
}
|
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel='nofollow' href="../dist/bundle.css" rel="stylesheet" />
<title>EJ2 react component</title>
</head>
<body>
<div id="root"></div>
<script type="text/javascript" src="../dist/bundle.js"></script></body>
</body>
</html> |
|
import * as React from "react"
import { Link } from 'react-router-dom';
import {ButtonComponent} from '@syncfusion/ej2-react-buttons';
import { AccordionComponent,AccordionItemsDirective,AccordionItemDirective } from '@syncfusion/ej2-react-navigations';
import '@syncfusion/ej2-react-navigations/styles/material.css';
export class Accordion extends React.Component {
render(){
return (
<div>
<h2>Essential J2 React Accordion component</h2>
<Link to="/">Show Listview component</Link>
<br />
<hr/>
<br/>
<AccordionComponent>
<AccordionItemsDirective>
<AccordionItemDirective header='ASP.NET' expanded={true} content='Microsoft ASP.NET is a set of technologies in the Microsoft .NET Framework for building Web applications and XML Web services. ASP.NET pages execute on the server and generate markup such as HTML, WML, or XML that is sent to a desktop or mobile browser. ASP.NET pages use a compiled,event-driven programming model that improves performance and enables the separation of application logic and user interface.' />
<AccordionItemDirective header='ASP.NET MVC' content='The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications.The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication.' />
<AccordionItemDirective header='JavaScript' content='JavaScript (JS) is an interpreted computer programming language.It was originally implemented as part of web browsers so that client-side scripts could interact with the user, control the browser, communicate asynchronously, and alter the document content that was displayed.More recently, however, it has become common in both game development and the creation of desktop applications.' />
</AccordionItemsDirective>
</AccordionComponent>
</div>
)
}
}
|
|
import * as React from "react"
import { Link } from 'react-router-dom';
import {ListViewComponent} from '@syncfusion/ej2-react-lists';
import '@syncfusion/ej2-react-lists/styles/material.css'
export class Lists extends React.Component {
public data: { [key: string]: Object }[] = [
{ text: 'Hennessey Venom', id: 'list-01' },
{ text: 'Bugatti Chiron', id: 'list-02' },
{ text: 'Bugatti Veyron Super Sport', id: 'list-03' },
{ text: 'SSC Ultimate Aero', id: 'list-04' },
{ text: 'Koenigsegg CCR', id: 'list-05' },
{ text: 'McLaren F1', id: 'list-06' },
{ text: 'Aston Martin One- 77', id: 'list-07' },
{ text: 'Jaguar XJ220', id: 'list-08' },
{ text: 'McLaren P1', id: 'list-09' },
{ text: 'Ferrari LaFerrari', id: 'list-10' },
];
render(){
return (
<div>
<h2>Essential JS2 ListView ListViewComponent</h2>
<Link to="/accordion">show Accordion</Link>
<hr/>
<br />
<ListViewComponent id="sample-list-flat" dataSource={this.data}> </ListViewComponent>
</div>
)
}
}
|
|
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { HashRouter, Switch, Route } from 'react-router-dom';
import { Lists } from './listview';
import { Accordion } from './accordion';
ReactDOM.render(
<HashRouter>
<Switch>
<Route exact={true} path="/" component={Lists} />
<Route path="/accordion" component={Accordion} />
</Switch>
</HashRouter>
, document.getElementById('root')
);
|
|
npm start |