react-data-export
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="0.3.4"></a> | ||
## [0.3.4](https://github.com/securedeveloper/react-data-export/compare/v0.3.3...v0.3.4) (2018-04-04) | ||
<a name="0.3.3"></a> | ||
@@ -7,0 +12,0 @@ ## [0.3.3](https://github.com/securedeveloper/react-data-export/compare/v0.3.0...v0.3.3) (2018-04-02) |
@@ -47,3 +47,8 @@ "use strict"; | ||
_this.handleDownload = _this.download.bind(_this); | ||
if (_this.props.hideElement) { | ||
_this.download(); | ||
} else { | ||
_this.handleDownload = _this.download.bind(_this); | ||
} | ||
_this.createSheetData = _this.createSheetData.bind(_this); | ||
@@ -139,7 +144,16 @@ return _this; | ||
value: function render() { | ||
return _react2.default.createElement( | ||
"span", | ||
{ onClick: this.handleDownload }, | ||
this.props.element | ||
); | ||
var _props = this.props, | ||
hideElement = _props.hideElement, | ||
element = _props.element; | ||
if (props.hideElement) { | ||
return null; | ||
} else { | ||
return _react2.default.createElement( | ||
"span", | ||
{ onClick: this.handleDownload }, | ||
element | ||
); | ||
} | ||
} | ||
@@ -152,2 +166,3 @@ }]); | ||
ExcelFile.props = { | ||
hideElement: _propTypes2.default.bool, | ||
filename: _propTypes2.default.string, | ||
@@ -165,2 +180,3 @@ fileExtension: _propTypes2.default.string, | ||
ExcelFile.defaultProps = { | ||
hideElement: false, | ||
filename: "Download", | ||
@@ -167,0 +183,0 @@ fileExtension: "xlsx", |
{ | ||
"name": "react-data-export", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "description": "A set of tools to export dataset from react to different formats.", |
@@ -7,2 +7,3 @@ # React-Data-Export | ||
[![Build Status](https://travis-ci.org/securedeveloper/react-data-export.svg?branch=master)](https://travis-ci.org/securedeveloper/react-data-export) | ||
[![Vulnerabilities](https://snyk.io/test/github/securedeveloper/react-data-export/badge.svg)](https://snyk.io/test/github/securedeveloper/react-data-export) | ||
[![Coverage Status](https://coveralls.io/repos/github/securedeveloper/react-data-export/badge.svg?branch=master)](https://coveralls.io/github/securedeveloper/react-data-export?branch=master) | ||
@@ -29,3 +30,4 @@ | ||
| Prop | Type | Default | Required | Description | ||
| :------------ | :------------------- | :--------- | :------- | :------------------------------- | ||
| :------------ | :------------------- | :--------- | :------- | :------------------------------------------------- | ||
| hideElement | `bool` | false | `false` | To hide the button & directly download excel file | ||
| filename | `string` | Download | `false` | Excel file name to be downloaded | ||
@@ -44,3 +46,3 @@ | fileExtension | `string` | xlsx | `false` | Download file extension [xlsx] | ||
**Note:** In ExcelSheet props `dataSet` has `presedence` over `data` and `children` props. | ||
**Note:** In ExcelSheet props `dataSet` has `precedence` over `data` and `children` props. | ||
@@ -47,0 +49,0 @@ For further types and definitions [Read More](types/types.md) |
@@ -14,2 +14,3 @@ import React from "react"; | ||
static props = { | ||
hideElement: PropTypes.bool, | ||
filename: PropTypes.string, | ||
@@ -28,2 +29,3 @@ fileExtension: PropTypes.string, | ||
static defaultProps = { | ||
hideElement: false, | ||
filename: "Download", | ||
@@ -37,3 +39,8 @@ fileExtension: "xlsx", | ||
this.handleDownload = this.download.bind(this); | ||
if (this.props.hideElement) { | ||
this.download(); | ||
} else { | ||
this.handleDownload = this.download.bind(this); | ||
} | ||
this.createSheetData = this.createSheetData.bind(this); | ||
@@ -113,3 +120,10 @@ } | ||
render() { | ||
return (<span onClick={this.handleDownload}>{this.props.element}</span>); | ||
const { hideElement, element } = this.props; | ||
if (props.hideElement) { | ||
return null; | ||
} else { | ||
return (<span onClick={this.handleDownload}>{element}</span>); | ||
} | ||
} | ||
@@ -116,0 +130,0 @@ } |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
34
816
138
0
102449