ui-kit-ck-consultant 0.5.238 → 0.5.240
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +56 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +56 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -713,23 +713,75 @@ var Table = /*#__PURE__*/function (_React$Component) {
|
|
713
713
|
_inheritsLoose(Table, _React$Component);
|
714
714
|
|
715
715
|
function Table() {
|
716
|
-
|
716
|
+
var _this;
|
717
|
+
|
718
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
719
|
+
args[_key] = arguments[_key];
|
720
|
+
}
|
721
|
+
|
722
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
723
|
+
|
724
|
+
_this.getArray = function (data) {
|
725
|
+
if (data && Array.isArray(data)) {
|
726
|
+
return data;
|
727
|
+
} else if (data) {
|
728
|
+
return [data];
|
729
|
+
} else {
|
730
|
+
return [];
|
731
|
+
}
|
732
|
+
};
|
733
|
+
|
734
|
+
_this.getCSV = function () {
|
735
|
+
var dataCSV = '';
|
736
|
+
|
737
|
+
if (_this.props && _this.props.children) {
|
738
|
+
_this.getArray(_this.props.children).forEach(function (children) {
|
739
|
+
if (children.props && children.props.children) {
|
740
|
+
_this.getArray(children.props.children).forEach(function (line) {
|
741
|
+
if (line.props && line.props.children) {
|
742
|
+
_this.getArray(line.props.children).forEach(function (column) {
|
743
|
+
dataCSV += (column.props.children || '').toString() + ";";
|
744
|
+
});
|
745
|
+
|
746
|
+
dataCSV += '\n';
|
747
|
+
}
|
748
|
+
});
|
749
|
+
}
|
750
|
+
});
|
751
|
+
}
|
752
|
+
|
753
|
+
var link = document.createElement('a');
|
754
|
+
link.href = "data:text/csv;charset=utf-8," + encodeURIComponent(dataCSV);
|
755
|
+
link.download = _this.props.nameCSV || 'file.csv';
|
756
|
+
link.click();
|
757
|
+
};
|
758
|
+
|
759
|
+
return _this;
|
717
760
|
}
|
718
761
|
|
719
762
|
var _proto = Table.prototype;
|
720
763
|
|
721
764
|
_proto.render = function render() {
|
722
|
-
var _classNames
|
765
|
+
var _classNames,
|
766
|
+
_this2 = this;
|
723
767
|
|
724
768
|
var tableClass = classNames$1((_classNames = {}, _classNames[style$9.table] = true, _classNames[style$9.tableEmpty] = !!this.props.empty, _classNames[style$9.radiusTopLeft] = !!this.props.radiusTopLeft, _classNames[style$9.radiusTopRight] = !!this.props.radiusTopRight, _classNames[this.props.className] = !!this.props.className, _classNames));
|
725
|
-
return /*#__PURE__*/React__default.createElement("
|
769
|
+
return /*#__PURE__*/React__default.createElement(React.Fragment, null, this.props.isCSV ? /*#__PURE__*/React__default.createElement("div", {
|
770
|
+
className: "d-flex"
|
771
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
772
|
+
text: "T\xE9l\xE9charger CSV",
|
773
|
+
className: "w-auto ml-auto mb-10",
|
774
|
+
onClick: function onClick() {
|
775
|
+
return _this2.getCSV();
|
776
|
+
}
|
777
|
+
})) : null, /*#__PURE__*/React__default.createElement("table", {
|
726
778
|
className: tableClass,
|
727
779
|
style: this.props.style
|
728
780
|
}, this.props.children, this.props.empty ? /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
729
781
|
colSpan: "100"
|
730
782
|
}, /*#__PURE__*/React__default.createElement("div", {
|
731
783
|
className: style$9.trEmpty
|
732
|
-
}, this.props.empty)))) : false);
|
784
|
+
}, this.props.empty)))) : false));
|
733
785
|
};
|
734
786
|
|
735
787
|
return Table;
|