ui-soxo-bootstrap-core 2.6.40-dev.13 → 2.6.40-dev.16

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.
@@ -687,6 +687,29 @@ export default function ReportingDashboard({
687
687
  );
688
688
  }
689
689
 
690
+ /**
691
+ * Filters report records using the same search text that drives the table.
692
+ *
693
+ * @param {Array<Object>} records - Report rows.
694
+ * @param {string} searchText - Current table search text.
695
+ * @returns {Array<Object>} Rows matching the search text.
696
+ */
697
+ function filterReportRecords(records, searchText) {
698
+ if (!Array.isArray(records)) return [];
699
+
700
+ const query = String(searchText || '').trim().toLowerCase();
701
+
702
+ if (!query) return records;
703
+
704
+ return records.filter((record) =>
705
+ Object.values(record).some((value) => {
706
+ if (value === undefined || value === null || typeof value === 'object') return false;
707
+
708
+ return String(value).toLowerCase().indexOf(query) !== -1;
709
+ })
710
+ );
711
+ }
712
+
690
713
  /**
691
714
  *
692
715
  * @param root0
@@ -804,13 +827,13 @@ function GuestList({
804
827
  return col;
805
828
  });
806
829
  const summaryCols = columns.filter((col) => col.enable_summary);
807
- let dataToExport = [...patients];
830
+ let dataToExport = [...filterReportRecords(patients, query)];
808
831
 
809
832
  if (summaryCols.length > 0) {
810
833
  // Build one synthetic row for CSV export that mirrors the table layout:
811
834
  // numeric summary cells are populated from `calculateSummaryValues`, while
812
835
  // non-summary columns stay blank unless a configured caption should be shown.
813
- const summaryValues = calculateSummaryValues(summaryCols, patients);
836
+ const summaryValues = calculateSummaryValues(summaryCols, dataToExport);
814
837
  const summaryRow = { isSummaryRow: true };
815
838
 
816
839
  cols.forEach((col, index) => {
@@ -837,37 +860,15 @@ function GuestList({
837
860
  }
838
861
  let exportDatas = getExportData(dataToExport, exportCols);
839
862
 
840
- if (exportDatas.exportDataColumns.length && exportDatas.exportDataHeaders.length) {
863
+ if (exportDatas.exportDataHeaders.length) {
841
864
  setExportData({ exportDatas });
865
+ } else {
866
+ setExportData({});
842
867
  }
843
868
  }
844
- }, [patients, columns]);
869
+ }, [patients, columns, query]);
845
870
 
846
- let filtered;
847
-
848
- if (patients) {
849
- filtered = patients.filter((record) => {
850
- if (query) {
851
- // Keys
852
- let keys = Object.keys(record);
853
-
854
- let flag = false;
855
-
856
- keys.forEach((key) => {
857
- let ele = record[key];
858
-
859
- if (ele && typeof ele === 'string' && ele.toLowerCase().indexOf(query.toLowerCase()) !== -1) {
860
- flag = true;
861
- }
862
- });
863
-
864
- /**Will return flag */
865
- return flag;
866
- } else {
867
- return true;
868
- }
869
- });
870
- }
871
+ let filtered = filterReportRecords(patients, query);
871
872
 
872
873
  /**
873
874
  * Checks for a match in the filtered patient list based on a scanned code,
@@ -1056,7 +1057,7 @@ function GuestList({
1056
1057
  dataSource={filtered ? filtered : patients} // In case if there is no filtered values we can use patient data
1057
1058
  columns={cols}
1058
1059
  sticky
1059
- pagination={false}
1060
+ pagination={true}
1060
1061
  summary={(pageData) => {
1061
1062
  const summaryCols = columns.filter((col) => col.enable_summary);
1062
1063
  if (!summaryCols.length) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.6.40-dev.13",
3
+ "version": "2.6.40-dev.16",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"