ui-kit-ck-consultant 0.6.41 → 0.6.43

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.
@@ -42,14 +42,6 @@ function _setPrototypeOf(o, p) {
42
42
  return _setPrototypeOf(o, p);
43
43
  }
44
44
 
45
- function _assertThisInitialized(self) {
46
- if (self === void 0) {
47
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
48
- }
49
-
50
- return self;
51
- }
52
-
53
45
  var style = {"modal":"_Tr9L0","modal_container":"_2YluD","no_background":"_2vjgy","large":"_22C7A","extraLarge":"_VOwgj","modal_right":"_eWY0H","modal_move":"_20eCx","modal_valid":"_RsujT","modal_close":"_1AbTJ","modal_custom":"_33Wb2","modal_header":"_2EzqX","modal_body":"_1-Y1J","full_modal_container":"_1w6wH","full_modal_header":"_2wSoq","full_modal_body":"_3bfp5","full_modal_body_no_padding":"_Pf5Uh","full_modal_body_no_overflow":"_3sTgK"};
54
46
 
55
47
  var Modal = /*#__PURE__*/function (_React$Component) {
@@ -899,54 +891,46 @@ var Table = /*#__PURE__*/function (_React$Component) {
899
891
  var dataCSV = '';
900
892
 
901
893
  if (_this.props && _this.props.children) {
902
- var table = _assertThisInitialized(_this);
894
+ var tableChildren = _this.getArray(_this.props.children);
903
895
 
904
- if (table) {
905
- var thead = _this.getArray(table.props.children).find(function (child) {
906
- return child.type.name === 'Thead';
907
- });
896
+ var allRows = tableChildren.flatMap(function (section) {
897
+ var _section$props;
908
898
 
909
- var tbody = _this.getArray(table.props.children).find(function (child) {
910
- return child.type.name === 'Tbody';
911
- });
899
+ return _this.getArray((_section$props = section.props) === null || _section$props === void 0 ? void 0 : _section$props.children).filter(function (child) {
900
+ var _child$type;
912
901
 
913
- if (thead) {
914
- var headerRow = _this.getArray(thead.props.children).filter(function (row) {
915
- return row.type.name === 'Tr';
916
- });
902
+ return (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'Tr';
903
+ });
904
+ });
905
+ console.log('Toutes les lignes (Tr) trouvées:', allRows);
917
906
 
918
- if (headerRow) {
919
- _this.getArray(headerRow).forEach(function (row) {
920
- var header = row.props.children.map(function (th) {
921
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
922
- }).join(';');
923
- dataCSV += header + '\n';
924
- });
925
- }
926
- }
907
+ if (allRows.length > 0) {
908
+ allRows.forEach(function (row, rowIndex) {
909
+ var cells = _this.getArray(row.props.children).filter(function (cell) {
910
+ var _cell$type, _cell$type2;
927
911
 
928
- if (tbody) {
929
- var bodyRow = _this.getArray(tbody.props.children).filter(function (row) {
930
- return row.type.name === 'Tr';
912
+ 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';
931
913
  });
932
914
 
933
- if (bodyRow) {
934
- _this.getArray(bodyRow).forEach(function (row) {
935
- var body = row.props.children[0].map(function (th) {
936
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
937
- }).join(';');
938
- dataCSV += body + '\n';
939
- });
940
- }
941
- }
915
+ var rowData = cells.map(function (cell) {
916
+ return cell.props && cell.props.children ? _this.extractText(cell.props.children) : '';
917
+ }).join(';');
918
+ dataCSV += rowData + '\n';
919
+ });
942
920
  }
943
921
  }
944
922
 
945
- console.log(dataCSV);
946
- var link = document.createElement('a');
947
- link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
948
- link.download = _this.props.nameCSV || 'file.csv';
949
- link.click();
923
+ console.log('CSV output:', dataCSV);
924
+
925
+ if (dataCSV) {
926
+ var link = document.createElement('a');
927
+ link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
928
+ link.download = _this.props.nameCSV || 'file.csv';
929
+ link.click();
930
+ } else {
931
+ console.warn('Le CSV est vide, vérifiez la structure du tableau.');
932
+ }
933
+
950
934
  callback();
951
935
  };
952
936