ui-kit-ck-consultant 0.6.42 → 0.6.44

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,56 +891,47 @@ 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).find(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('Lignes (Tr) détectées:', JSON.stringify(allRows));
917
906
 
918
- if (headerRow) {
919
- var headers = _this.getArray(headerRow.props.children).flatMap(function (row) {
920
- return _this.getArray(row.props.children);
921
- }).map(function (th) {
922
- return th.props && th.props.children ? _this.extractText(th.props.children) : '';
923
- }).join(';');
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;
924
911
 
925
- dataCSV += headers + '\n';
926
- }
927
- }
928
-
929
- if (tbody) {
930
- var bodyRow = _this.getArray(tbody.props.children).filter(function (row) {
931
- 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';
932
913
  });
933
914
 
934
- if (bodyRow) {
935
- _this.getArray(bodyRow).forEach(function (row) {
936
- var body = _this.getArray(row.props.children).map(function (td) {
937
- return td.props && td.props.children ? _this.extractText(td.props.children) : '';
938
- }).join(';');
939
-
940
- dataCSV += body + '\n';
941
- });
942
- }
943
- }
915
+ console.log("Ligne " + (rowIndex + 1) + " - Cellules d\xE9tect\xE9es:", JSON.stringify(cells));
916
+ var rowData = cells.map(function (cell) {
917
+ return cell.props && cell.props.children ? _this.extractText(cell.props.children) : '';
918
+ }).join(';');
919
+ dataCSV += rowData + '\n';
920
+ });
944
921
  }
945
922
  }
946
923
 
947
- console.log(dataCSV);
948
- var link = document.createElement('a');
949
- link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
950
- link.download = _this.props.nameCSV || 'file.csv';
951
- link.click();
924
+ console.log('CSV généré:', dataCSV);
925
+
926
+ if (dataCSV) {
927
+ var link = document.createElement('a');
928
+ link.href = "data:text/csv;charset=utf-8,\uFEFF" + encodeURIComponent(dataCSV);
929
+ link.download = _this.props.nameCSV || 'file.csv';
930
+ link.click();
931
+ } else {
932
+ console.warn('Le CSV est vide, vérifiez la structure du tableau.');
933
+ }
934
+
952
935
  callback();
953
936
  };
954
937