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.
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,54 +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).filter(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
- _this.getArray(headerRow).forEach(function (row) {
923
- var header = row.props.children.map(function (th) {
924
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
925
- }).join(';');
926
- dataCSV += header + '\n';
927
- });
928
- }
929
- }
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;
930
914
 
931
- if (tbody) {
932
- var bodyRow = _this.getArray(tbody.props.children).filter(function (row) {
933
- 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';
934
916
  });
935
917
 
936
- if (bodyRow) {
937
- _this.getArray(bodyRow).forEach(function (row) {
938
- var body = row.props.children[0].map(function (th) {
939
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
940
- }).join(';');
941
- dataCSV += body + '\n';
942
- });
943
- }
944
- }
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
+ });
945
923
  }
946
924
  }
947
925
 
948
- console.log(dataCSV);
949
- var link = document.createElement('a');
950
- link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
951
- link.download = _this.props.nameCSV || 'file.csv';
952
- 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
+
953
937
  callback();
954
938
  };
955
939