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