Compare commits

..

3 Commits

Author SHA1 Message Date
Sean Landsman
f81d48b3d4 AG-2490 Regression Testing - Header component example isn't working 2019-01-09 16:58:33 +00:00
Guilherme Lopes
06fa3f01fd AG-2235 - Updated font-awesome to 5.6.3 2019-01-09 15:11:59 +00:00
Sean Landsman
d15bb746cd Release 20.0.0 dist files added and license key updated 2019-01-08 17:05:16 +00:00
10 changed files with 37 additions and 194 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "ag-grid-react-example", "name": "ag-grid-react-example",
"version": "20.1.0", "version": "20.0.0",
"description": "Example Reach applicaiton using ag-Grid.", "description": "Example Reach applicaiton using ag-Grid.",
"main": "dist/ag-grid-react-example.js", "main": "dist/ag-grid-react-example.js",
"scripts": { "scripts": {
@@ -37,35 +37,35 @@
}, },
"homepage": "http://www.ag-grid.com/", "homepage": "http://www.ag-grid.com/",
"devDependencies": { "devDependencies": {
"@babel/core": "7.3.3", "@babel/core": "7.2.2",
"babel-loader": "8.0.5", "babel-loader": "8.0.4",
"@babel/preset-env": "7.3.1", "@babel/preset-env": "7.2.3",
"@babel/preset-react": "7.0.0", "@babel/preset-react": "7.0.0",
"@babel/plugin-proposal-class-properties": "7.3.3", "@babel/plugin-proposal-class-properties": "7.2.3",
"@babel/plugin-proposal-function-bind": "7.2.0", "@babel/plugin-proposal-function-bind": "7.2.0",
"css-loader": "2.1.0", "css-loader": "2.1.0",
"file-loader": "3.0.1", "file-loader": "3.0.1",
"gulp": "3.9.1", "gulp": "3.9.1",
"merge2": "1.2.3", "merge2": "^1.2.3",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"ncp": "2.0.0", "ncp": "2.0.0",
"prop-types": "15.7.2", "prop-types": "15.6.2",
"rimraf": "2.6.3", "rimraf": "~2.6.2",
"style-loader": "0.23.1", "style-loader": "~0.23.0",
"webpack": "4.29.5", "webpack": "4.28.3",
"webpack-cli": "3.2.3", "webpack-cli": "3.2.0",
"webpack-dev-server": "3.2.0" "webpack-dev-server": "3.1.14"
}, },
"dependencies": { "dependencies": {
"ag-grid-community": "^20.1.0", "ag-grid-community": "^20.0.0",
"ag-grid-enterprise": "^20.1.0", "ag-grid-enterprise": "^20.0.0",
"ag-grid-react": "^20.1.0", "ag-grid-react": "^20.0.0",
"bootstrap": "4.3.1", "bootstrap": "4.1.3",
"d3": "4.9.1", "d3": "4.9.1",
"lodash": "4.17.11", "lodash": "^4.17.11",
"react": "16.8.2", "react": "16.7.0",
"react-dom": "16.8.2", "react-dom": "16.7.0",
"react-redux": "6.0.1", "react-redux": "6.0.0",
"react-router-dom": "4.3.1", "react-router-dom": "4.3.1",
"redux": "4.0.1" "redux": "4.0.1"
} }

View File

@@ -5,14 +5,12 @@ import NavItem from "./NavItem";
import RichGridDeclarativeExample from "./richGridDeclarativeExample/RichGridDeclarativeExample"; import RichGridDeclarativeExample from "./richGridDeclarativeExample/RichGridDeclarativeExample";
import SimpleReduxDynamicExample from "./simpleReduxDynamicComponentExample/SimpleReduxExample"; import SimpleReduxDynamicExample from "./simpleReduxDynamicComponentExample/SimpleReduxExample";
import SimpleReduxHookExample from "./simpleReduxHooksExample/SimpleReduxHookExample";
const SideBar = () => ( const SideBar = () => (
<div style={{float: "left", width: 335, marginRight: 25}}> <div style={{float: "left", width: 335, marginRight: 25}}>
<ul className="nav nav-pills"> <ul className="nav nav-pills">
<NavItem to='/rich-grid-declarative'>Rich Grid with Declarative Markup</NavItem> <NavItem to='/rich-grid-declarative'>Rich Grid with Declarative Markup</NavItem>
<NavItem to='/simple-redux-dynamic'>Simple Redux Dynamic Component Example</NavItem> <NavItem to='/simple-redux-dynamic'>Simple Redux Dynamic Component Example</NavItem>
<NavItem to='/simple-redux-hook'>Simple React Hook Component Example</NavItem>
</ul> </ul>
</div> </div>
); );
@@ -27,7 +25,6 @@ class App extends Component {
<Redirect from="/" exact to="/rich-grid-declarative"/> <Redirect from="/" exact to="/rich-grid-declarative"/>
<Route exact path='/rich-grid-declarative' component={RichGridDeclarativeExample}/> <Route exact path='/rich-grid-declarative' component={RichGridDeclarativeExample}/>
<Route exact path='/simple-redux-dynamic' component={SimpleReduxDynamicExample}/> <Route exact path='/simple-redux-dynamic' component={SimpleReduxDynamicExample}/>
<Route exact path='/simple-redux-hook' component={SimpleReduxHookExample}/>
</Switch> </Switch>
</div> </div>
</div> </div>

View File

@@ -5,7 +5,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<script type="text/javascript" src="../dist/react-examples.js" charset="utf-8"></script> <script type="text/javascript" src="../dist/react-examples.js" charset="utf-8"></script>
<!-- Example uses font awesome icons --> <!-- Example uses font awesome icons -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" rel="stylesheet">
<style> <style>
html, body { html, body {

View File

@@ -25,12 +25,12 @@ export default class RichGridDeclarativeExample extends Component {
sideBar: false, sideBar: false,
rowData: new RowDataFactory().createRowData(), rowData: new RowDataFactory().createRowData(),
icons: { icons: {
columnRemoveFromGroup: '<i class="fa fa-remove"/>', columnRemoveFromGroup: '<i class="fa fa-times"/>',
filter: '<i class="fa fa-filter"/>', filter: '<i class="fa fa-filter"/>',
sortAscending: '<i class="fa fa-long-arrow-down"/>', sortAscending: '<i class="fa fa-long-arrow-alt-down"/>',
sortDescending: '<i class="fa fa-long-arrow-up"/>', sortDescending: '<i class="fa fa-long-arrow-alt-up"/>',
groupExpanded: '<i class="fa fa-minus-square-o"/>', groupExpanded: '<i class="far fa-minus-square"/>',
groupContracted: '<i class="fa fa-plus-square-o"/>' groupContracted: '<i class="far fa-plus-square"/>'
} }
}; };
} }
@@ -141,8 +141,17 @@ export default class RichGridDeclarativeExample extends Component {
</div> </div>
<div style={{display: "inline-block", width: "100%", marginTop: 10, marginBottom: 10}}> <div style={{display: "inline-block", width: "100%", marginTop: 10, marginBottom: 10}}>
<div style={{float: "left"}}> <div style={{float: "left"}}>
<label>
<input type="checkbox" onChange={this.onToggleSidebar} style={{marginRight: 5}}/>
Show Side Bar
</label>
</div>
<div style={{float: "left", marginLeft: 20}}>
<button onClick={this.onRefreshData} className="btn btn-primary">Refresh Data</button> <button onClick={this.onRefreshData} className="btn btn-primary">Refresh Data</button>
</div> </div>
<div style={{float: "left", marginLeft: 20}}>
<input type="text" onChange={this.onQuickFilterText} placeholder="Type text to filter..."/>
</div>
<div style={{float: "right"}}> <div style={{float: "right"}}>
Filter API: Filter API:
<button onClick={this.invokeSkillsFilterMethod} <button onClick={this.invokeSkillsFilterMethod}
@@ -152,17 +161,6 @@ export default class RichGridDeclarativeExample extends Component {
</button> </button>
</div> </div>
</div> </div>
<div style={{display: "inline-block", width: "100%", marginTop: 10, marginBottom: 10}}>
<div style={{float: "left"}}>
<label>
<input type="checkbox" onChange={this.onToggleSidebar} style={{marginRight: 5}}/>
Show Side Bar
</label>
</div>
<div style={{float: "left", marginLeft: 20}}>
<input type="text" onChange={this.onQuickFilterText} placeholder="Type text to filter..."/>
</div>
</div>
<div style={{height: 400, width: 900}} className="ag-theme-balham"> <div style={{height: 400, width: 900}} className="ag-theme-balham">
<AgGridReact <AgGridReact
// listening for events // listening for events

View File

@@ -30,10 +30,10 @@ export default class SortableHeaderComponent extends React.Component {
sortElements.push(<div key={`up${this.props.displayName}`} className={downArrowClass} sortElements.push(<div key={`up${this.props.displayName}`} className={downArrowClass}
onClick={this.onSortRequested.bind(this, 'desc')}><i onClick={this.onSortRequested.bind(this, 'desc')}><i
className="fa fa-long-arrow-down"/></div>); className="fa fa-long-arrow-alt-down"/></div>);
sortElements.push(<div key={`down${this.props.displayName}`} className={upArrowClass} sortElements.push(<div key={`down${this.props.displayName}`} className={upArrowClass}
onClick={this.onSortRequested.bind(this, 'asc')}><i onClick={this.onSortRequested.bind(this, 'asc')}><i
className="fa fa-long-arrow-up"/></div>); className="fa fa-long-arrow-alt-up"/></div>);
sortElements.push(<div key={`minus${this.props.displayName}`} className={removeArrowClass} sortElements.push(<div key={`minus${this.props.displayName}`} className={removeArrowClass}
onClick={this.onSortRequested.bind(this, '')}><i onClick={this.onSortRequested.bind(this, '')}><i
className="fa fa-times"/></div>) className="fa fa-times"/></div>)

View File

@@ -1,32 +0,0 @@
import React, { useContext } from "react";
import {Context} from "./store";
import {AgGridReact} from "ag-grid-react";
/*
* This component serves to display the row data (provided by redux)
*/
export default function GridComponent() {
const {store, dispatch} = useContext(Context);
const {columnDefs, rowData} = store;
const onGridReady = (params) => {
params.api.sizeColumnsToFit();
};
// row data will be provided via redux on this.props.rowData
return (
<div style={{height: 400, width: 900, marginTop: 15}}
className="ag-theme-balham">
<AgGridReact
// properties
columnDefs={columnDefs}
rowData={rowData}
reactNext={true}
// events
onGridReady={onGridReady}>
</AgGridReact>
</div>
)
}

View File

@@ -1,13 +0,0 @@
import React, {Component} from "react";
export default class PriceRenderer extends Component {
constructor(props) {
super(props);
}
render() {
return (
<span>{this.props.value}</span>
);
}
}

View File

@@ -1,18 +0,0 @@
import React, {useReducer} from "react";
import GridComponent from "./GridComponent";
import {Context, initialState, reducer} from "./store";
export default function SimpleReduxHookExample() {
const [store, dispatch] = useReducer(reducer, initialState);
return (
<Context.Provider value={{store, dispatch}}>
<div>
<h1>Simple Example using Hooks (with useContext and useReducer)</h1>
<button onClick={() => dispatch({type: "SET_ROW_DATA"})}>Populate Row Data</button>
<GridComponent/>
</div>
</Context.Provider>
)
}

View File

@@ -1,14 +0,0 @@
export function updateRowData(rowData) {
return {
type: 'ROW_DATA_CHANGED',
rowData
}
}
export function setCurrency(currencySymbol, exchangeRate) {
return {
type: 'CURRENCY_CHANGED',
currencySymbol,
exchangeRate
}
}

View File

@@ -1,75 +0,0 @@
import React from "react";
import PriceRenderer from "./PriceRenderer";
export const initialState = {
rowData: [],
columnDefs: [
{
field: 'symbol'
},
{
field: 'price',
cellClass: 'align-right',
cellRendererFramework: PriceRenderer
}
]
};
export const reducer = (state = {rowData: []}, action) => {
switch (action.type) {
case 'SET_ROW_DATA':
return {
...state,
rowData: createRowData()
};
default:
return state;
}
};
export const Context = React.createContext();
// for test data
// the following methods are for creating dummy row data
const createRowData = () => {
let rowData = [];
for (let i = 0; i < 14; i++) {
let newItem = createItem(rowData);
rowData.push(newItem);
}
return rowData;
};
const createItem = (rowData) => {
return {
symbol: createUniqueRandomSymbol(rowData),
price: Math.floor(Math.random() * 100)
};
};
// creates a unique symbol, eg 'ADG' or 'ZJD'
const createUniqueRandomSymbol = (rowData) => {
let symbol;
let possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let isUnique = false;
while (!isUnique) {
symbol = '';
// create symbol
for (let i = 0; i < 3; i++) {
symbol += possible.charAt(Math.floor(Math.random() * possible.length));
}
// check uniqueness
isUnique = true;
rowData.forEach(function (oldItem) {
if (oldItem.symbol === symbol) {
isUnique = false;
}
});
}
return symbol;
};