ui-kit-ck-consultant 0.6.11 → 0.6.13
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 +42 -19
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +42 -19
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -884,32 +884,55 @@ var Table = /*#__PURE__*/function (_React$Component) {
|
|
884
884
|
};
|
885
885
|
|
886
886
|
_this.getCSV = function (callback) {
|
887
|
+
extractText = function extractText(node) {
|
888
|
+
if (typeof node === 'string') return node.trim();
|
889
|
+
if (Array.isArray(node)) return node.map(_this.extractText).join(' ');
|
890
|
+
if (node.props && node.props.children) return _this.extractText(node.props.children);
|
891
|
+
return '';
|
892
|
+
};
|
893
|
+
|
887
894
|
var dataCSV = '';
|
888
895
|
|
889
896
|
if (_this.props && _this.props.children) {
|
890
|
-
_this.getArray(_this.props.children).
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
dataCSV += column.props.children.toString() + ";";
|
903
|
-
} else {
|
904
|
-
dataCSV += ';';
|
905
|
-
}
|
906
|
-
});
|
897
|
+
var table = _this.getArray(_this.props.children).find(function (child) {
|
898
|
+
return child.type === 'table';
|
899
|
+
});
|
900
|
+
|
901
|
+
if (table) {
|
902
|
+
var thead = _this.getArray(table.props.children).find(function (child) {
|
903
|
+
return child.type === 'thead';
|
904
|
+
});
|
905
|
+
|
906
|
+
var tbody = _this.getArray(table.props.children).find(function (child) {
|
907
|
+
return child.type === 'tbody';
|
908
|
+
});
|
907
909
|
|
908
|
-
|
910
|
+
if (thead) {
|
911
|
+
var headerRow = _this.getArray(thead.props.children).find(function (row) {
|
912
|
+
return row.type === 'tr';
|
913
|
+
});
|
914
|
+
|
915
|
+
if (headerRow) {
|
916
|
+
var headers = _this.getArray(headerRow.props.children).map(function (th) {
|
917
|
+
return th.props && th.props.children ? _this.extractText(th.props.children) : '';
|
918
|
+
}).join(';');
|
919
|
+
|
920
|
+
dataCSV += headers + '\n';
|
921
|
+
}
|
922
|
+
}
|
923
|
+
|
924
|
+
if (tbody) {
|
925
|
+
_this.getArray(tbody.props.children).forEach(function (row) {
|
926
|
+
if (row.type === 'tr') {
|
927
|
+
var rowData = _this.getArray(row.props.children).map(function (td) {
|
928
|
+
return td.props && td.props.children ? _this.extractText(td.props.children) : '';
|
929
|
+
}).join(';');
|
930
|
+
|
931
|
+
dataCSV += rowData + '\n';
|
909
932
|
}
|
910
933
|
});
|
911
934
|
}
|
912
|
-
}
|
935
|
+
}
|
913
936
|
}
|
914
937
|
|
915
938
|
var link = document.createElement('a');
|