hplx-feature-library 1.0.82 → 1.0.84

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.
@@ -2,6 +2,10 @@ import { I_InvestigationTestWithPrint, I_TestRanges } from '../../types/AllInves
2
2
  interface InvestigationsTableProps {
3
3
  data: I_InvestigationTestWithPrint[];
4
4
  testDetails: I_TestRanges[];
5
+ enableColumnCheckbox: boolean;
6
+ tableHeaderRowClasses?: string;
7
+ investigationCheckBoxMap: Map<string, boolean>;
8
+ onColumnCheckboxClickHandler: (key: string, isClicked: boolean) => void;
5
9
  }
6
- declare const AllInvestigationsTable: ({ data, testDetails }: InvestigationsTableProps) => import("react/jsx-runtime").JSX.Element;
10
+ declare const AllInvestigationsTable: ({ data, testDetails, enableColumnCheckbox, tableHeaderRowClasses, investigationCheckBoxMap, onColumnCheckboxClickHandler, }: InvestigationsTableProps) => import("react/jsx-runtime").JSX.Element;
7
11
  export default AllInvestigationsTable;
@@ -1,4 +1,4 @@
1
- import { A as f } from "../AllInvestigationsTable-n-z7PX2L.js";
1
+ import { A as f } from "../AllInvestigationsTable-RWRitNq3.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1 @@
1
+ "use strict";const n=require("./index-D-wXK-PO.cjs"),i=require("react"),j=({data:a=[],testDetails:f=[],enableColumnCheckbox:d,tableHeaderRowClasses:x,investigationCheckBoxMap:o,onColumnCheckboxClickHandler:r})=>{const[g,h]=i.useState([]),[m,p]=i.useState([]),v=i.useRef(null);i.useEffect(()=>{if(!a.length)return;const _=[...new Set(a.map(e=>e.test_date))];p(_);const s=new Map;a.forEach(e=>{const u=f.find(R=>R?.test_id?.toString()===e?.test_id?.toString());s.has(e.test_id)||s.set(e.test_id,{created_on:e.created_on,out_of_range:e.out_of_range,test_date:e.test_date,test_id:e.test_id,test_name:u?.test_names||e.test_name,test_value:e.test_value,test_unit:u?.test_units||e.test_unit});const c=s.get(e.test_id);c[e.test_date]=e.test_value});const t=Array.from(s.values());h(t)},[a,f]);const l="hfl-text-1",w=i.useMemo(()=>{const _=[{field:"#",fieldHeaderName:"No.",renderCell:(t,e,u,c)=>n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:c+1}),pinned:"left",width:"60px",minWidth:"60px",cellClasses:`${l}`},{field:"test_name",fieldHeaderName:"Tests / Investigations",pinned:"left",width:"250px",minWidth:"250px",cellClasses:`${l}`,enableColumnCheckbox:d,isCheckboxMarked:o.get("test_name"),onColumnCheckboxClick:t=>{r("test_name",t)}},{field:"test_unit",fieldHeaderName:"Units",pinned:"left",width:"80px",minWidth:"80px",cellClasses:`${l}`}],s=m.map(t=>({field:t,fieldHeaderName:t,width:"150px",minWidth:"150px",cellClasses:`${l}`,enableColumnCheckbox:d,isCheckboxMarked:o.get(t),onColumnCheckboxClick:e=>{r(t,e)}}));return[..._,...s]},[m,d,o,r]);return n.jsxRuntimeExports.jsx("div",{className:"",children:n.jsxRuntimeExports.jsx(n.uO,{headerRowClasses:`hfl-bg-Blue_gray-50 hfl-text-Indigo-500 hfl-text-1 hfl-border ${x}`,tableRef:v,columns:w,tableName:"Investigations",rows:g})})};exports.AllInvestigationsTable=j;
@@ -0,0 +1,93 @@
1
+ import { j as a, u as R } from "./index-D6vi5Sgs.js";
2
+ import { useState as c, useRef as j, useEffect as C, useMemo as D } from "react";
3
+ const S = ({
4
+ data: n = [],
5
+ testDetails: m = [],
6
+ enableColumnCheckbox: l,
7
+ tableHeaderRowClasses: h,
8
+ investigationCheckBoxMap: d,
9
+ onColumnCheckboxClickHandler: o
10
+ }) => {
11
+ const [p, g] = c([]), [u, x] = c([]), w = j(null);
12
+ C(() => {
13
+ if (!n.length) return;
14
+ const r = [...new Set(n.map((e) => e.test_date))];
15
+ x(r);
16
+ const s = /* @__PURE__ */ new Map();
17
+ n.forEach((e) => {
18
+ const _ = m.find((N) => N?.test_id?.toString() === e?.test_id?.toString());
19
+ s.has(e.test_id) || s.set(e.test_id, {
20
+ created_on: e.created_on,
21
+ out_of_range: e.out_of_range,
22
+ test_date: e.test_date,
23
+ test_id: e.test_id,
24
+ test_name: _?.test_names || e.test_name,
25
+ test_value: e.test_value,
26
+ test_unit: _?.test_units || e.test_unit
27
+ });
28
+ const f = s.get(e.test_id);
29
+ f[e.test_date] = e.test_value;
30
+ });
31
+ const t = Array.from(s.values());
32
+ g(t);
33
+ }, [n, m]);
34
+ const i = "hfl-text-1", v = D(() => {
35
+ const r = [
36
+ {
37
+ field: "#",
38
+ fieldHeaderName: "No.",
39
+ renderCell: (t, e, _, f) => /* @__PURE__ */ a.jsx(a.Fragment, { children: f + 1 }),
40
+ pinned: "left",
41
+ width: "60px",
42
+ minWidth: "60px",
43
+ cellClasses: `${i}`
44
+ },
45
+ {
46
+ field: "test_name",
47
+ fieldHeaderName: "Tests / Investigations",
48
+ pinned: "left",
49
+ width: "250px",
50
+ minWidth: "250px",
51
+ cellClasses: `${i}`,
52
+ enableColumnCheckbox: l,
53
+ isCheckboxMarked: d.get("test_name"),
54
+ onColumnCheckboxClick: (t) => {
55
+ o("test_name", t);
56
+ }
57
+ },
58
+ {
59
+ field: "test_unit",
60
+ fieldHeaderName: "Units",
61
+ pinned: "left",
62
+ width: "80px",
63
+ minWidth: "80px",
64
+ cellClasses: `${i}`
65
+ }
66
+ ], s = u.map((t) => ({
67
+ field: t,
68
+ fieldHeaderName: t,
69
+ width: "150px",
70
+ minWidth: "150px",
71
+ cellClasses: `${i}`,
72
+ enableColumnCheckbox: l,
73
+ isCheckboxMarked: d.get(t),
74
+ onColumnCheckboxClick: (e) => {
75
+ o(t, e);
76
+ }
77
+ }));
78
+ return [...r, ...s];
79
+ }, [u, l, d, o]);
80
+ return /* @__PURE__ */ a.jsx("div", { className: "", children: /* @__PURE__ */ a.jsx(
81
+ R,
82
+ {
83
+ headerRowClasses: `hfl-bg-Blue_gray-50 hfl-text-Indigo-500 hfl-text-1 hfl-border ${h}`,
84
+ tableRef: w,
85
+ columns: v,
86
+ tableName: "Investigations",
87
+ rows: p
88
+ }
89
+ ) });
90
+ };
91
+ export {
92
+ S as A
93
+ };