react-csv/src/components/Download.js
abdennour c5053cf334 ✈️ migrate to static properies of ES7
proptypes should not be  capital
Add unit-test to check if separator has default value
2017-02-17 20:24:28 +03:00

43 lines
829 B
JavaScript

import React from 'react';
import {buildURI} from '../core';
import {
defaultProps as commonDefaultProps,
propTypes as commonPropTypes} from '../metaProps';
const defaultProps = {
target: '_blank'
};
class CSVDownload extends React.Component {
static defaultProps = Object.assign(
commonDefaultProps,
defaultProps
);
static propTypes = commonPropTypes;
constructor(props) {
super(props);
this.state={};
}
buildURI() {
return buildURI(...arguments);
}
componentDidMount(){
const {data, headers, separator, target, specs, replace} = this.props;
this.state.page = window.open(
this.buildURI(data, headers, separator), target, specs, replace
);
}
getWindow() {
return this.state.page;
}
render(){
return (null)
}
}
export default CSVDownload;