Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnb committed Dec 18, 2017
0 parents commit e09d24f
Show file tree
Hide file tree
Showing 34 changed files with 12,734 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"test": {
"plugins": ["istanbul"]
}
},
"presets": [
"react",
["env", {
"targets": {
"browsers": ["> 1%", "iOS >= 8", "Android >= 4"],
"node": "6.10"
},
"debug": false
}]
],
"plugins": [
"babel-plugin-transform-class-properties",
"transform-object-rest-spread"
]
}
1 change: 1 addition & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repo_token: mUu8CcBb7ZPxJvlzfjykPQjABLh52Gxob
40 changes: 40 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"parser": "babel-eslint",
"settings": {
"import/extensions": [".js"],
"import/parser": "babel-eslint",
"import/resolver": {
"node": {
"extensions": [".js"]
},
"webpack": {
"config": "webpack.config.js"
}
}
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"allowImportExportEverywhere": true,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
},
},
"env": {
"es6": true,
"browser": true,
"mocha": true,
"node": true
},
"rules": {
"no-console": "off",
"semi": 2,
"no-tabs": 2,
},
"plugins": [
"import",
"react",
"filenames"
]
}
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Logs
logs
*.log
npm-debug.log*

# sublime project
*.sublime-project
*.sublime-workspace

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output/

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
node_modules

# Optional npm cache directory
.npm

# Build Data
dist/*
es/*
lib/*

# Optional REPL history
.node_repl_history
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js
node_js:
- "node"

script:
- npm run -s build
- npm run -s lint
- npm run -s test

after_success:
- npm run coverage
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 gregn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
216 changes: 216 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<div align="center">
<img src="https://user-images.githubusercontent.com/19170080/34070522-e15d32e2-e235-11e7-8af5-fa704cdcad56.png" />
</div>

# MUI-Datatables - Datatables for Material-UI

[![Build Status](https://travis-ci.org/gregnb/mui-datatables.svg?branch=master)](https://travis-ci.org/gregnb/mui-datatables)
[![Coverage Status](https://coveralls.io/repos/github/gregnb/mui-datatables/badge.svg?branch=master)](https://coveralls.io/github/gregnb/mui-datatables?branch=master)
[![dependencies Status](https://david-dm.org/gregnb/mui-datatables/status.svg)](https://david-dm.org/gregnb/mui-datatables)
[![npm version](https://badge.fury.io/js/mui-datatables.svg)](https://badge.fury.io/js/mui-datatables)

MUI-Datatables is a data tables component built on [Material-UI V1](https://www.material-ui-next.com). It comes with features like filtering, view/hide columns, search, export to CSV download, printing, pagination, and sorting. On top of the ability to customize styling on most views, there is a responsive data stacking mode for mobile/tablet devices.

## Install

`npm install mui-datatables --save-dev `

## Demo

[![Edit react-to-print](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/edit-this)

## Usage


```js

import MUIDataTable from "mui-datatables";

const columns = ["Name", "Company", "City", "State"];

const data = [
["Joe James", "Test Corp", "Yonkers", "NY"],
["John Walsh", "Test Corp", "Hartford", "CT"],
["Bob Herm", "Test Corp", "Tampa", "FL"],
["James Houston", "Test Corp", "Dallas", "TX"],
];

const options = {
filter: true,
filterType: 'checkbox',
};

<MUIDataTable data={data} columns={columns} options={options} />

```

## API


#### &lt;MUIDataTable />

The component accepts the following props:

|Name|Type|Description
|:--:|:-----|:-----|
|**`columns`**|array|Columns used to describe table. Must be an array of simple strings
|**`data`**|array|Data used to describe table. Must be an array of simple strings
|**`options`**|object|Options used to describe table

#### Options:
|Name|Type|Description
|:--:|:-----|:-----|
|**`styles`**|object|Extend or override default styling
|**`filterType `**|string|Choice of filtering view. Options are "checkbox" or "dropdown" (default: checkbox)
|**`pagination`**|boolean|Enable/disable pagination
|**`responsive`**|boolean|Enable/disable responsive data stacking
|**`rowsPerPage`**|number|Number of rows allowed per page
|**`rowsPerPageOptions`**|array|Options to provide in pagination for number of rows a user can select
|**`rowHover`**|boolean|Enable/disable hover style over rows
|**`sort`**|boolean|Show/hide sort icon from toolbar
|**`filter`**|boolean|Show/hide filter icon from toolbar
|**`search`**|boolean|Show/hide search icon from toolbar
|**`print`**|boolean|Show/hide print icon from toolbar
|**`download`**|boolean|Show/hide download icon from toolbar


## Customize Styling

In the options object, you have the ability to customize styling to your liking with the 'styles' property. Here are the following sections you can customize:

#### Table of Contents

- [Table](#styletable)
- [Toolbar](#styletoolbar)
- [FilterList](#stylefilterlist)
- [Pagination](#stylepagination)


An example of how we would target FilterList would look like:

```js

const options = {
filter: true,
filterType: 'checkbox',
styles: {
filterList: {
root: {
color: "#FF0000"
},
chip: {
color: "#FEFEF0"
},
},
}
};

<MUIDataTable data={data} columns={columns} options={options} />

```

#### Styling Table
--
<a name="styletable"></a>


```js

const options = {
styles: {
table: {
head: {
row: {
},
cell: {
root: {
},
sortLabel: {
},
}
},
body: {
row: {
},
cell: {
root: {
}
}
},
},
}
};

```

#### Styling Toolbar
--
<a name="styletoolbar"></a>

```js

const options = {
styles: {
toolbar: {
root: {},
spacer: {
},
actions: {
},
titleRoot: {
},
titleText: {
},
icon: {
},
iconActive: {
},
search: {
},
searchIcon: {
},
searchText: {
},
clearIcon: {
},
},
}
};

```

#### Styling FilterList
--
<a name="stylefilterlist"></a>



```js

const options = {
styles: {
filterList: {
root: {
},
chip: {
},
},
}
};

```

#### Styling Pagination
--
<a name="stylepagination"></a>

```js

const options = {
styles: {
pagination: {
}
}
};

```
Loading

0 comments on commit e09d24f

Please sign in to comment.