ui-kit-ck-consultant 0.6.60 → 0.6.61

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.
@@ -889,39 +889,57 @@ var Table = /*#__PURE__*/function (_React$Component) {
889
889
 
890
890
  _this.getCSV = function (callback) {
891
891
  var dataCSV = '';
892
- console.log('this.props', _this.props);
893
892
 
894
- if (_this.props && _this.props.children) {
895
- console.log('this.props.children', _this.props.children);
893
+ if (_this.props.data) {
894
+ Object.keys(_this.props.data).forEach(function (key) {
895
+ var rowData = _this.props.data[key].map(function (cell) {
896
+ return cell ? _this.extractText(cell) : '';
897
+ }).join(';');
896
898
 
897
- var tableChildren = _this.getArray(_this.props.children);
899
+ dataCSV += rowData + '\n';
900
+ });
898
901
 
899
- var allRows = tableChildren.flatMap(function (section) {
900
- var _section$props;
902
+ _this.props.data.map(function (row) {
903
+ var rowData = row.map(function (cell) {
904
+ return cell ? _this.extractText(cell) : '';
905
+ }).join(';');
906
+ dataCSV += rowData + '\n';
907
+ });
908
+ } else {
909
+ console.log('this.props', _this.props);
901
910
 
902
- return _this.getArray((_section$props = section.props) === null || _section$props === void 0 ? void 0 : _section$props.children).filter(function (child) {
903
- var _child$type, _child$type2, _child$type3;
911
+ if (_this.props && _this.props.children) {
912
+ console.log('this.props.children', _this.props.children);
904
913
 
905
- return (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'Tr' || (child === null || child === void 0 ? void 0 : (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'Tr' || (child === null || child === void 0 ? void 0 : (_child$type3 = child.type) === null || _child$type3 === void 0 ? void 0 : _child$type3.displayName) === 'tr';
906
- });
907
- });
908
- console.log('Toutes les lignes (Tr) trouvées:', allRows);
914
+ var tableChildren = _this.getArray(_this.props.children);
909
915
 
910
- if (allRows.length > 0) {
911
- allRows.forEach(function (row, rowIndex) {
912
- console.log(row.props.children.length, row.props.children.length !== 2, row.props.children.type, row.props.children.type === React.Fragment, row);
916
+ var allRows = tableChildren.flatMap(function (section) {
917
+ var _section$props;
913
918
 
914
- var cells = _this.getArray(row.props.children.length !== 2 ? row.props.children.type === React.Fragment ? row.props.children.props.children[0] : row.props.children : row.props.children[0]).filter(function (cell) {
915
- var _cell$type, _cell$type2, _cell$type3, _cell$type4, _cell$type5, _cell$type6;
919
+ return _this.getArray((_section$props = section.props) === null || _section$props === void 0 ? void 0 : _section$props.children).filter(function (child) {
920
+ var _child$type, _child$type2, _child$type3;
916
921
 
917
- return (cell === null || cell === void 0 ? void 0 : (_cell$type = cell.type) === null || _cell$type === void 0 ? void 0 : _cell$type.name) === 'Th' || (cell === null || cell === void 0 ? void 0 : (_cell$type2 = cell.type) === null || _cell$type2 === void 0 ? void 0 : _cell$type2.name) === 'Td' || (cell === null || cell === void 0 ? void 0 : (_cell$type3 = cell.type) === null || _cell$type3 === void 0 ? void 0 : _cell$type3.displayName) === 'Th' || (cell === null || cell === void 0 ? void 0 : (_cell$type4 = cell.type) === null || _cell$type4 === void 0 ? void 0 : _cell$type4.displayName) === 'Td' || (cell === null || cell === void 0 ? void 0 : (_cell$type5 = cell.type) === null || _cell$type5 === void 0 ? void 0 : _cell$type5.displayName) === 'th' || (cell === null || cell === void 0 ? void 0 : (_cell$type6 = cell.type) === null || _cell$type6 === void 0 ? void 0 : _cell$type6.displayName) === 'td';
922
+ return (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'Tr' || (child === null || child === void 0 ? void 0 : (_child$type2 = child.type) === null || _child$type2 === void 0 ? void 0 : _child$type2.displayName) === 'Tr' || (child === null || child === void 0 ? void 0 : (_child$type3 = child.type) === null || _child$type3 === void 0 ? void 0 : _child$type3.displayName) === 'tr';
918
923
  });
919
-
920
- var rowData = cells.map(function (cell) {
921
- return cell.props && cell.props.children ? _this.extractText(cell.props.children) : '';
922
- }).join(';');
923
- dataCSV += rowData + '\n';
924
924
  });
925
+ console.log('Toutes les lignes (Tr) trouvées:', allRows);
926
+
927
+ if (allRows.length > 0) {
928
+ allRows.forEach(function (row, rowIndex) {
929
+ console.log(row.props.children.length, row.props.children.length !== 2, row.props.children.type, row.props.children.type === React.Fragment, row);
930
+
931
+ var cells = _this.getArray(row.props.children.length !== 2 ? row.props.children.type === React.Fragment ? row.props.children.props.children[0] : row.props.children : row.props.children[0]).filter(function (cell) {
932
+ var _cell$type, _cell$type2, _cell$type3, _cell$type4, _cell$type5, _cell$type6;
933
+
934
+ return (cell === null || cell === void 0 ? void 0 : (_cell$type = cell.type) === null || _cell$type === void 0 ? void 0 : _cell$type.name) === 'Th' || (cell === null || cell === void 0 ? void 0 : (_cell$type2 = cell.type) === null || _cell$type2 === void 0 ? void 0 : _cell$type2.name) === 'Td' || (cell === null || cell === void 0 ? void 0 : (_cell$type3 = cell.type) === null || _cell$type3 === void 0 ? void 0 : _cell$type3.displayName) === 'Th' || (cell === null || cell === void 0 ? void 0 : (_cell$type4 = cell.type) === null || _cell$type4 === void 0 ? void 0 : _cell$type4.displayName) === 'Td' || (cell === null || cell === void 0 ? void 0 : (_cell$type5 = cell.type) === null || _cell$type5 === void 0 ? void 0 : _cell$type5.displayName) === 'th' || (cell === null || cell === void 0 ? void 0 : (_cell$type6 = cell.type) === null || _cell$type6 === void 0 ? void 0 : _cell$type6.displayName) === 'td';
935
+ });
936
+
937
+ var rowData = cells.map(function (cell) {
938
+ return cell.props && cell.props.children ? _this.extractText(cell.props.children) : '';
939
+ }).join(';');
940
+ dataCSV += rowData + '\n';
941
+ });
942
+ }
925
943
  }
926
944
  }
927
945