ui-kit-ck-consultant 0.6.42 → 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.
package/dist/index.js CHANGED
@@ -45,14 +45,6 @@ function _setPrototypeOf(o, p) {
45
45
  return _setPrototypeOf(o, p);
46
46
  }
47
47
 
48
- function _assertThisInitialized(self) {
49
- if (self === void 0) {
50
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
51
- }
52
-
53
- return self;
54
- }
55
-
56
48
  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"};
57
49
 
58
50
  var Modal = /*#__PURE__*/function (_React$Component) {
@@ -902,56 +894,46 @@ var Table = /*#__PURE__*/function (_React$Component) {
902
894
  var dataCSV = '';
903
895
 
904
896
  if (_this.props && _this.props.children) {
905
- var table = _assertThisInitialized(_this);
897
+ var tableChildren = _this.getArray(_this.props.children);
906
898
 
907
- if (table) {
908
- var thead = _this.getArray(table.props.children).find(function (child) {
909
- return child.type.name === 'Thead';
910
- });
899
+ var allRows = tableChildren.flatMap(function (section) {
900
+ var _section$props;
911
901
 
912
- var tbody = _this.getArray(table.props.children).find(function (child) {
913
- return child.type.name === 'Tbody';
914
- });
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;
915
904
 
916
- if (thead) {
917
- var headerRow = _this.getArray(thead.props.children).find(function (row) {
918
- return row.type.name === 'Tr';
919
- });
905
+ return (child === null || child === void 0 ? void 0 : (_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.name) === 'Tr';
906
+ });
907
+ });
908
+ console.log('Toutes les lignes (Tr) trouvées:', allRows);
920
909
 
921
- if (headerRow) {
922
- var headers = _this.getArray(headerRow.props.children).flatMap(function (row) {
923
- return _this.getArray(row.props.children);
924
- }).map(function (th) {
925
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
926
- }).join(';');
910
+ if (allRows.length > 0) {
911
+ allRows.forEach(function (row, rowIndex) {
912
+ var cells = _this.getArray(row.props.children).filter(function (cell) {
913
+ var _cell$type, _cell$type2;
927
914
 
928
- dataCSV += headers + '\n';
929
- }
930
- }
931
-
932
- if (tbody) {
933
- var bodyRow = _this.getArray(tbody.props.children).filter(function (row) {
934
- return row.type.name === 'Tr';
915
+ 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';
935
916
  });
936
917
 
937
- if (bodyRow) {
938
- _this.getArray(bodyRow).forEach(function (row) {
939
- var body = _this.getArray(row.props.children).map(function (td) {
940
- return td.props && td.props.children ? _this.extractText(td.props.children) : '';
941
- }).join(';');
942
-
943
- dataCSV += body + '\n';
944
- });
945
- }
946
- }
918
+ var rowData = cells.map(function (cell) {
919
+ return cell.props && cell.props.children ? _this.extractText(cell.props.children) : '';
920
+ }).join(';');
921
+ dataCSV += rowData + '\n';
922
+ });
947
923
  }
948
924
  }
949
925
 
950
- console.log(dataCSV);
951
- var link = document.createElement('a');
952
- link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
953
- link.download = _this.props.nameCSV || 'file.csv';
954
- link.click();
926
+ console.log('CSV output:', dataCSV);
927
+
928
+ if (dataCSV) {
929
+ var link = document.createElement('a');
930
+ link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
931
+ link.download = _this.props.nameCSV || 'file.csv';
932
+ link.click();
933
+ } else {
934
+ console.warn('Le CSV est vide, vérifiez la structure du tableau.');
935
+ }
936
+
955
937
  callback();
956
938
  };
957
939