RELEASE 🚒 : 1.0.2

Ability of specifying the "filename" of the downloaded CSV file .

```
 <CSVLink filename={"persons.csv"} data={data}>Click here</CSVLink>
```
This commit is contained in:
abdennour 2017-02-17 21:29:18 +03:00
commit d4544e117e
9 changed files with 4259 additions and 27 deletions

4217
cdn/react-csv-1.0.2.js Normal file

File diff suppressed because it is too large Load diff

3
cdn/react-csv-1.0.2.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -12,6 +12,8 @@ Object.defineProperty(exports, "__esModule", {
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _class, _temp;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@ -31,8 +33,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
var defaultProps = {
target: '_blank'
};
var CSVDownload = function (_React$Component) {
var CSVDownload = (_temp = _class = function (_React$Component) {
_inherits(CSVDownload, _React$Component);
function CSVDownload(props) {
@ -75,11 +76,7 @@ var CSVDownload = function (_React$Component) {
}]);
return CSVDownload;
}(_react2.default.Component);
CSVDownload.defaultProps = Object.assign(_metaProps.defaultProps, defaultProps);
CSVDownload.PropTypes = _metaProps.PropTypes;
}(_react2.default.Component), _class.defaultProps = Object.assign(_metaProps.defaultProps, defaultProps), _class.propTypes = _metaProps.propTypes, _temp);
exports.default = CSVDownload;
},{"../core":4,"../metaProps":6,"react":37}],3:[function(require,module,exports){
'use strict';
@ -92,6 +89,8 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _class, _temp;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
@ -110,7 +109,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var CSVLink = function (_React$Component) {
var CSVLink = (_temp = _class = function (_React$Component) {
_inherits(CSVLink, _React$Component);
function CSVLink(props) {
@ -134,12 +133,13 @@ var CSVLink = function (_React$Component) {
data = _props.data,
headers = _props.headers,
separator = _props.separator,
filename = _props.filename,
children = _props.children,
rest = _objectWithoutProperties(_props, ['data', 'headers', 'separator', 'children']);
rest = _objectWithoutProperties(_props, ['data', 'headers', 'separator', 'filename', 'children']);
return _react2.default.createElement(
'a',
_extends({}, rest, {
_extends({ download: filename }, rest, {
href: this.buildURI(data, headers, separator) }),
children
);
@ -147,11 +147,7 @@ var CSVLink = function (_React$Component) {
}]);
return CSVLink;
}(_react2.default.Component);
CSVLink.defaultProps = _metaProps.defaultProps;
CSVLink.PropTypes = _metaProps.PropTypes;
}(_react2.default.Component), _class.defaultProps = _metaProps.defaultProps, _class.propTypes = _metaProps.propTypes, _temp);
exports.default = CSVLink;
},{"../core":4,"../metaProps":6,"react":37}],4:[function(require,module,exports){
'use strict';
@ -248,7 +244,7 @@ var CSVLink = exports.CSVLink = _Link2.default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PropsNotForwarded = exports.defaultProps = exports.PropTypes = undefined;
exports.PropsNotForwarded = exports.defaultProps = exports.propTypes = undefined;
var _react = require('react');
@ -256,15 +252,17 @@ var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PropTypes = exports.PropTypes = {
var propTypes = exports.propTypes = {
data: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.array]).isRequired,
headers: _react2.default.PropTypes.array,
target: _react2.default.PropTypes.string,
separator: _react2.default.PropTypes.string
separator: _react2.default.PropTypes.string,
filename: _react2.default.PropTypes.string
};
var defaultProps = exports.defaultProps = {
separator: ','
separator: ',',
filename: 'generatedBy_react-csv.csv'
};
var PropsNotForwarded = exports.PropsNotForwarded = ['data', 'headers'];

File diff suppressed because one or more lines are too long