hplx-feature-library 1.0.31 → 1.0.33
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/PediatricsCalculator/components/PediatricsCalculatorTable.d.ts +1 -1
- package/dist/PediatricsCalculator/components/PediatricsCalculatorTableContext.d.ts +2 -2
- package/dist/PediatricsCalculator/index.js +1 -1
- package/dist/{PediatricsCalculatorTable-kT0uGKWk.js → PediatricsCalculatorTable-BbAtgJ_a.js} +24 -20
- package/dist/{PediatricsCalculatorTable-Br8bo3VT.cjs → PediatricsCalculatorTable-U3lJnOOI.cjs} +2 -2
- package/dist/constants/PediatricsCalculatorConstants/index.js +18 -15
- package/dist/constants/PediatricsCalculatorConstants.d.ts +8 -1
- package/dist/index.js +1 -1
- package/dist/types/PediatricsCalculatorTypes.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ interface PediatricsCalculatorTableProps {
|
|
|
5
5
|
externallyTriggeredEditRowIds?: string[];
|
|
6
6
|
externallyTriggeredEditMode?: boolean;
|
|
7
7
|
getMedicineOptions?: (searchTerm: string) => Promise<Medicine[]>;
|
|
8
|
-
onRowChange?: (updatedRow: IMedicineViewData) => void;
|
|
8
|
+
onRowChange?: (updatedRow: IMedicineViewData, updatedKey?: string) => void;
|
|
9
9
|
onRowDelete?: (rowId: string) => Promise<boolean>;
|
|
10
10
|
onRowCopy?: (clickedRow: IMedicineViewData, selectedMedicines: Medicine[]) => Promise<boolean>;
|
|
11
11
|
onSaveRow?: (row: IMedicineViewData[]) => Promise<boolean>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IMedicineViewData, Medicine } from '../../types/PediatricsCalculatorTypes';
|
|
1
|
+
import { CalcFieldKeys, IMedicineViewData, Medicine } from '../../types/PediatricsCalculatorTypes';
|
|
2
2
|
export interface IPediatricsCalculatorTableContext {
|
|
3
3
|
variant: 'standard' | 'prescription';
|
|
4
4
|
externallyTriggeredEditMode: boolean;
|
|
5
5
|
externallyTriggeredEditRowIds?: string[];
|
|
6
6
|
getMedicineOptions?: (searchTerm: string) => Promise<Medicine[]>;
|
|
7
|
-
onRowChange?: (updatedRow: IMedicineViewData) => void;
|
|
7
|
+
onRowChange?: (updatedRow: IMedicineViewData, updatedKey?: CalcFieldKeys) => void;
|
|
8
8
|
onRowDelete?: (rowId: string) => void;
|
|
9
9
|
onRowCopy?: (clickedRow: IMedicineViewData, selectedMedicines: Medicine[]) => void;
|
|
10
10
|
setRowToDelete?: (id: string | null) => void;
|
package/dist/{PediatricsCalculatorTable-kT0uGKWk.js → PediatricsCalculatorTable-BbAtgJ_a.js}
RENAMED
|
@@ -9747,24 +9747,26 @@ const ej = /* @__PURE__ */ ou(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
|
|
|
9747
9747
|
label: M.doctorMedicineName,
|
|
9748
9748
|
value: M
|
|
9749
9749
|
})) || [], P = s || i?.includes(r.rowId) || a, E = Ve.useMemo(() => p.calculation_type === Xi[0] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), _ = Ve.useMemo(() => p.calculation_type === Xi[1] ? p.calculation_fields : null, [p.calculation_fields, p.calculation_type]), C = (w, S) => {
|
|
9750
|
+
let M;
|
|
9750
9751
|
if (w === "calculation_type") {
|
|
9751
|
-
const
|
|
9752
|
+
const R = S, k = {
|
|
9752
9753
|
frequency: p.calculation_fields.frequency,
|
|
9753
9754
|
pedia_dosage: p.calculation_fields.pedia_dosage
|
|
9754
9755
|
};
|
|
9755
|
-
|
|
9756
|
+
M = {
|
|
9756
9757
|
...p,
|
|
9757
|
-
calculation_type:
|
|
9758
|
-
calculation_fields:
|
|
9759
|
-
}
|
|
9758
|
+
calculation_type: R,
|
|
9759
|
+
calculation_fields: R === "mg/kg/dose" ? { ...Yy, ...k } : { ...Uy, ...k }
|
|
9760
|
+
};
|
|
9760
9761
|
} else
|
|
9761
|
-
|
|
9762
|
+
M = {
|
|
9762
9763
|
...p,
|
|
9763
9764
|
[w]: S
|
|
9764
|
-
}
|
|
9765
|
+
};
|
|
9766
|
+
h(M), o === "prescription" && g(M, w);
|
|
9765
9767
|
}, g = Ch(
|
|
9766
|
-
() => ej((w) => {
|
|
9767
|
-
u?.(w);
|
|
9768
|
+
() => ej((w, S) => {
|
|
9769
|
+
u?.(w, S || "");
|
|
9768
9770
|
}, 500),
|
|
9769
9771
|
[u]
|
|
9770
9772
|
);
|
|
@@ -9789,10 +9791,10 @@ const ej = /* @__PURE__ */ ou(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
|
|
|
9789
9791
|
...M,
|
|
9790
9792
|
calculation_fields: R
|
|
9791
9793
|
};
|
|
9792
|
-
return o === "prescription" && g(
|
|
9794
|
+
return o === "prescription" && g(k, w), k;
|
|
9793
9795
|
});
|
|
9794
9796
|
},
|
|
9795
|
-
[
|
|
9797
|
+
[g, o]
|
|
9796
9798
|
), j = async () => {
|
|
9797
9799
|
const w = {
|
|
9798
9800
|
...p,
|
|
@@ -9807,7 +9809,7 @@ const ej = /* @__PURE__ */ ou(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
|
|
|
9807
9809
|
h(r), o === "standard" && e(!1);
|
|
9808
9810
|
}, Q = (w) => o === "prescription" && w === "medicine_name" ? !1 : P, q = () => {
|
|
9809
9811
|
const w = !(p?.isSavedToLibrary ?? !1), S = { ...p, isSavedToLibrary: w };
|
|
9810
|
-
h(S), g(S);
|
|
9812
|
+
h(S), g(S, "isSavedToLibrary");
|
|
9811
9813
|
};
|
|
9812
9814
|
return /* @__PURE__ */ W.jsxs(
|
|
9813
9815
|
"div",
|
|
@@ -10087,7 +10089,9 @@ const ej = /* @__PURE__ */ ou(Z1), Or = (t) => /^(\d+)?(\.)?(\d*)?$/.test(t), Xt
|
|
|
10087
10089
|
options: o !== "prescription" ? S.map((M) => ({ label: M, value: M })) : void 0,
|
|
10088
10090
|
onChangeHandler: o !== "prescription" ? (M) => v("pedia_dosage", M.value) : void 0,
|
|
10089
10091
|
hideDropdownIcon: o === "prescription",
|
|
10090
|
-
showEmptyDropdownPopup: o !== "prescription"
|
|
10092
|
+
showEmptyDropdownPopup: o !== "prescription",
|
|
10093
|
+
showErrorMsg: p.out_of_range || p.isDosageMismatch,
|
|
10094
|
+
errorMsg: p.out_of_range ? "Dosage Exceeds Safety Limits" : p.isDosageMismatch ? "Dosage is in mismatch with the selected frequency" : ""
|
|
10091
10095
|
}
|
|
10092
10096
|
);
|
|
10093
10097
|
})() : /* @__PURE__ */ W.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
|
|
@@ -11296,11 +11300,11 @@ const xy = /* @__PURE__ */ ou(hj), mj = (t) => {
|
|
|
11296
11300
|
setSearchDisabled: c
|
|
11297
11301
|
}, f) => {
|
|
11298
11302
|
const [d, p] = qt(null), [h, m] = qt(!1), [b, P] = qt(), E = xt(
|
|
11299
|
-
(q, w) => {
|
|
11300
|
-
const
|
|
11301
|
-
if (!
|
|
11302
|
-
const
|
|
11303
|
-
o?.(
|
|
11303
|
+
(q, w, S) => {
|
|
11304
|
+
const M = t.find((k) => k.rowId === q);
|
|
11305
|
+
if (!M) return;
|
|
11306
|
+
const R = { ...M, ...w };
|
|
11307
|
+
o?.(R, S || void 0);
|
|
11304
11308
|
},
|
|
11305
11309
|
[t, o]
|
|
11306
11310
|
), _ = xt(async () => {
|
|
@@ -11362,8 +11366,8 @@ const xy = /* @__PURE__ */ ou(hj), mj = (t) => {
|
|
|
11362
11366
|
externallyTriggeredEditMode: e,
|
|
11363
11367
|
externallyTriggeredEditRowIds: a,
|
|
11364
11368
|
getMedicineOptions: n,
|
|
11365
|
-
onRowChange: (q) => {
|
|
11366
|
-
E(q.rowId, q), o?.(q);
|
|
11369
|
+
onRowChange: (q, w) => {
|
|
11370
|
+
E(q.rowId, q, w), o?.(q, w);
|
|
11367
11371
|
},
|
|
11368
11372
|
onRowDelete: s,
|
|
11369
11373
|
onRowCopy: i,
|
package/dist/{PediatricsCalculatorTable-Br8bo3VT.cjs → PediatricsCalculatorTable-U3lJnOOI.cjs}
RENAMED
|
@@ -90,7 +90,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
90
90
|
font-size: ${ee?.fontSize};
|
|
91
91
|
color: ${ee?.color};
|
|
92
92
|
}
|
|
93
|
-
`}),W.jsx("input",{ref:Pe,style:g?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,className:`input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${k?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":U||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>F&&F(we,V,Pe),maxLength:$??$}),!e&&!n&&W.jsx("i",{className:"hx_down hfl-mx-2"}),n&&W.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),At(!0))}}),E?W.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:E}):null]}),K&&W.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:D})]}):W.jsxs("button",{ref:Ke,onClick:St,className:`hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${s||""} ${M||"hfl-border-1"} ${D?"hfl-border-Error-300":"hfl-border-Gray-300"} ${R||"hfl-h-[40px]"} ${k?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:S||u?.label?{}:ee?{fontFamily:ee?.fontFamily,fontSize:ee?.fontSize,fontWeight:ee?.fontWeight,lineHeight:ee?.lineHeight,color:ee?.color}:{},children:[W.jsx("span",{className:"hfl-pr-4",children:S||u?.label||i||"Select an option"}),W.jsx("img",{src:F1,alt:"down arrow"})]}),l&&l?.length>=0&&W.jsxs("ul",{ref:de,className:`${te?"hfl-visible":"hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${j?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[Q?W.jsx(A1,{onChangeHandler:q,selectedOption:w,options:_}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=j?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?W.jsx("li",{onClick:()=>{j?gr(we):(c&&c(we),V(!1),At(!1))},className:`hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${T?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:j?W.jsx(wm,{size:"sm",disabled:!1,text:W.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):null}),l?.length===0&&B&&W.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function b(g,v,j){var H,Q,q,w,_,M,R=0,k=!1,U=!1,D=!0;if(typeof g!="function")throw new TypeError(t);v=C(v)||0,P(j)&&(k=!!j.leading,U="maxWait"in j,q=U?p(C(j.maxWait)||0,v):q,D="trailing"in j?!!j.trailing:D);function K(N){var I=H,z=Q;return H=Q=void 0,R=N,w=g.apply(z,I),w}function ee(N){return R=N,_=setTimeout(J,v),k?K(N):w}function F(N){var I=N-M,z=N-R,G=v-I;return U?h(G,q-z):G}function B(N){var I=N-M,z=N-R;return M===void 0||I>=v||I<0||U&&z>=q}function J(){var N=m();if(B(N))return A(N);_=setTimeout(J,F(N))}function A(N){return _=void 0,D&&H?K(N):(H=Q=void 0,w)}function Y(){_!==void 0&&clearTimeout(_),R=0,H=M=Q=_=void 0}function $(){return _===void 0?w:A(m())}function T(){var N=m(),I=B(N);if(H=arguments,Q=this,M=N,I){if(_===void 0)return ee(M);if(U)return _=setTimeout(J,v),K(M)}return _===void 0&&(_=setTimeout(J,v)),w}return T.cancel=Y,T.flush=$,T}function P(g){var v=typeof g;return!!g&&(v=="object"||v=="function")}function E(g){return!!g&&typeof g=="object"}function S(g){return typeof g=="symbol"||E(g)&&d.call(g)==a}function C(g){if(typeof g=="number")return g;if(S(g))return r;if(P(g)){var v=typeof g.valueOf=="function"?g.valueOf():g;g=P(v)?v+"":v}if(typeof g!="string")return g===0?g:+g;g=g.replace(e,"");var j=o.test(g);return j||s.test(g)?i(g.slice(2),j?2:8):n.test(g)?r:+g}return el=b,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>W.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=ie.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=ie.useState([]),[p,h]=ie.useState(r);ie.useEffect(()=>{a||h(r)},[r,a]);const m=async w=>(await l?.(w))?.map(M=>({label:M.doctorMedicineName,value:M}))||[],P=s||i?.includes(r.rowId)||a,E=ie.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),S=ie.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),C=(w,_)=>{if(w==="calculation_type"){const M=_,R={frequency:p.calculation_fields.frequency,pedia_dosage:p.calculation_fields.pedia_dosage};h({...p,calculation_type:M,calculation_fields:M==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...R}:{...wt.C_DefaultMlKgFields,...R}})}else h({...p,[w]:_})},g=ie.useMemo(()=>Y1(w=>{u?.(w)},500),[u]);ie.useEffect(()=>()=>{g.cancel()},[g]);const v=ie.useCallback((w,_)=>{h(M=>{let R={...M.calculation_fields,[w]:_};if(w==="frequency"&&o==="standard"){const U=wt.C_FrequencyDosageMap[_]||[];U.length>0?R={...R,pedia_dosage:U[0]}:R={...R,pedia_dosage:""}}const k={...M,calculation_fields:R};return o==="prescription"&&g({...p,calculation_fields:R}),k})},[p,g,o]),j=async()=>{const w={...p,calculation_fields:{...p.calculation_fields}};await n?.(w)&&g({...w,isEditing:!1})},H=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},Q=w=>o==="prescription"&&w==="medicine_name"?!1:P,q=()=>{const w=!(p?.isSavedToLibrary??!1),_={...p,isSavedToLibrary:w};h(_),g(_)};return W.jsxs("div",{className:`medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${P?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""}`,children:[W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("medicine_name")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async w=>{if(C("medicine_name",w),w.trim()){const _=await m(w);d(_)}else d([])},onInputFocus:async()=>{const w=await m(p.medicine_name);d(w)},onChangeHandler:w=>{const _=w.value,M=wt.C_MedicineTypeList.find(R=>R.val===_.medicineType);h(R=>({...R,medicine_name:_.doctorMedicineName,medicine_id:_.medicineId,generic_name:_.doctorGenericName,type:M?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine"}):W.jsx(na,{children:r.medicine_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("generic_name")?W.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:w=>C("generic_name",w),hideDropdownIcon:!0}):W.jsx(na,{children:r.generic_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const w=wt.C_MedicineTypeList.find(_=>_.type===p.type);return w?{label:w.type,value:w.type}:void 0})(),options:wt.C_MedicineTypeList.map(w=>({label:w.type,value:w.type})),onChangeHandler:w=>C("type",w.value)}):W.jsx(na,{children:r.type||""})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("calculation_type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(w=>({label:w,value:w})),onChangeHandler:w=>C("calculation_type",w.value)}):W.jsx(na,{children:r.calculation_type})}),W.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:Q("calculation_fields")?W.jsxs(W.Fragment,{children:[E&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Drug Strength",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.drug_strength||"",inputChangeHandler:w=>{wr(w)&&v("drug_strength",w)}})}),W.jsx(Qt,{label:"Dose/mg/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.dose_mg_kg||"",inputChangeHandler:w=>{wr(w)&&v("dose_mg_kg",w)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{v("frequency",w.value)}})}),W.jsx(Qt,{label:"Max Dose (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.max_mg_dose||"",inputChangeHandler:w=>{wr(w)&&v("max_mg_dose",w)}})}),W.jsx(Qt,{label:"Max Day (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.max_mg_day||"",inputChangeHandler:w=>{wr(w)&&v("max_mg_day",w)}})})]}),S&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Multiplier",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.multiplier||"",inputChangeHandler:w=>{wr(w)&&v("multiplier",w)}})}),W.jsx(Qt,{label:"Dose/mL/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_ml_kg||"",inputChangeHandler:w=>{wr(w)&&v("dose_ml_kg",w)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{v("frequency",w.value)}})}),W.jsx(Qt,{label:"Max Dose (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_ml_dose||"",inputChangeHandler:w=>{wr(w)&&v("max_ml_dose",w)}})}),W.jsx(Qt,{label:"Max Day (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_ml_day||"",inputChangeHandler:w=>{wr(w)&&v("max_ml_day",w)}})})]})]}):W.jsxs(W.Fragment,{children:[E&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Drug Strength",value:E.drug_strength}),W.jsx(Xt,{label:"Dose/mg/kg",value:E.dose_mg_kg}),W.jsx(Xt,{label:"Frequency",value:E.frequency}),W.jsx(Xt,{label:"Max Dose (mg)",value:E.max_mg_dose}),W.jsx(Xt,{label:"Max Day (mg)",value:E.max_mg_day})]}),S&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Multiplier",value:S.multiplier}),W.jsx(Xt,{label:"Dose/mL/kg",value:S.dose_ml_kg}),W.jsx(Xt,{label:"Frequency",value:S.frequency}),W.jsx(Xt,{label:"Max Dose (mL)",value:S.max_ml_dose}),W.jsx(Xt,{label:"Max Day (mL)",value:S.max_ml_day})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("pedia_dosage")?(()=>{const w=p.calculation_fields.frequency,_=wt.C_FrequencyDosageMap[w]||[];return W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:p.calculation_fields.pedia_dosage,inputChangeHandler:M=>v("pedia_dosage",M),selectedOption:{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage},options:o!=="prescription"?_.map(M=>({label:M,value:M})):void 0,onChangeHandler:o!=="prescription"?M=>v("pedia_dosage",M.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription"})})():W.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[W.jsx(na,{children:r.calculation_fields.pedia_dosage}),r.out_of_range&&W.jsxs("div",{className:"hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2",children:[W.jsx("div",{className:"hx_warning hfl-text-Error-400"}),W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceed safety limits"})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:W.jsx(R1,{effectiveEditMode:P,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:j,onCancel:H,onEdit:()=>e(!0),onCheckboxToggle:q})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
|
|
93
|
+
`}),W.jsx("input",{ref:Pe,style:g?{}:{width:`${Number(f?.length)>4?(f?.length||0)+5:12}ch`},type:b,placeholder:i,value:f,className:`input-placeholder hfl-flex-1 hfl-pl-2 hfl-placeholder hfl-py-1 focus-visible:hfl-outline-0 focus-visible:hfl-outline-none hfl-border-0 focus:hfl-border-0 ${k?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":U||"hfl-bg-White"} ${h||""}`,onChange:we=>{d&&d(we.target.value),At(!0)},onClick:Fr,onKeyDown:we=>F&&F(we,V,Pe),maxLength:$??$}),!e&&!n&&W.jsx("i",{className:"hx_down hfl-mx-2"}),n&&W.jsx("i",{className:`${f?"hx_close hfl-cursor-pointer":"hx_down"} hfl-mx-2`,onClick:()=>{(u?.value||f)&&(d&&d(""),At(!0))}}),E?W.jsx("span",{style:{left:`${ur<2?"3":ur}ch`},className:"hfl-absolute hfl-top-1/2 hfl--translate-y-1/2 hfl-pointer-events-none",children:E}):null]}),K&&W.jsx("span",{className:"hfl-text-0 hfl-text-Error-600",children:D})]}):W.jsxs("button",{ref:Ke,onClick:St,className:`hfl-w-full hfl-bg-White hfl-py-[6px] hfl-px-4 hfl-rounded-lg hfl-inline-flex hfl-justify-between hfl-items-center ${s||""} ${M||"hfl-border-1"} ${D?"hfl-border-Error-300":"hfl-border-Gray-300"} ${R||"hfl-h-[40px]"} ${k?"!hfl-bg-Gray-50 !hfl-cursor-not-allowed":""}`,style:S||u?.label?{}:ee?{fontFamily:ee?.fontFamily,fontSize:ee?.fontSize,fontWeight:ee?.fontWeight,lineHeight:ee?.lineHeight,color:ee?.color}:{},children:[W.jsx("span",{className:"hfl-pr-4",children:S||u?.label||i||"Select an option"}),W.jsx("img",{src:F1,alt:"down arrow"})]}),l&&l?.length>=0&&W.jsxs("ul",{ref:de,className:`${te?"hfl-visible":"hfl-invisible"} hfl-absolute hfl-z-50 hfl-grid hfl-gap-1 hfl-mt-3 hfl-w-full hfl-rounded-lg hfl-shadow-lg hfl-bg-White hfl-font-inter-0 hfl-p-1 hfl-px-2 ${j?"hfl-min-w-[20em]":"hfl-min-w-[16em]"} hfl-max-h-[330px] hfl-overflow-y-scroll ${A}`,role:"menu","aria-orientation":"vertical","aria-labelledby":"options-menu",children:[Q?W.jsx(A1,{onChangeHandler:q,selectedOption:w,options:_}):!1,(m?Qe:l)?.map((we,qe)=>{const ot=j?!!v?.some(Wn=>Wn.value===we?.value):!1,Lr=u?.value===we?.value,Bi=ue===qe;return we?W.jsx("li",{onClick:()=>{j?gr(we):(c&&c(we),V(!1),At(!1))},className:`hfl-text-1 hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item ${T?"odd:hfl-bg-Gray-100":""} ${Lr?"hfl-bg-Blue-50 hfl-text-Blue-500":""}`,role:"menuitem","aria-selected":Lr,tabIndex:Bi?0:-1,ref:Wn=>{Ge.current[qe]=Wn},children:j?W.jsx(wm,{size:"sm",disabled:!1,text:W.jsx("span",{children:we.label}),secondaryText:"",id:`${we.label}-${qe}`,isMarked:ot}):we.label},`${we.label}-${qe}`):null}),l?.length===0&&B&&W.jsx("li",{className:"hfl-block hfl-px-4 hfl-py-2 hfl-rounded-md hover:hfl-bg-Blue-50 hfl-cursor-pointer custom_dropdown_item",children:"No items found, please change the search criteria"})]})]})}var el,oh;function L1(){if(oh)return el;oh=1;var t="Expected a function",r=NaN,a="[object Symbol]",e=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,s=/^0o[0-7]+$/i,i=parseInt,l=typeof qa=="object"&&qa&&qa.Object===Object&&qa,u=typeof self=="object"&&self&&self.Object===Object&&self,c=l||u||Function("return this")(),f=Object.prototype,d=f.toString,p=Math.max,h=Math.min,m=function(){return c.Date.now()};function b(g,v,j){var H,Q,q,w,_,M,R=0,k=!1,U=!1,D=!0;if(typeof g!="function")throw new TypeError(t);v=C(v)||0,P(j)&&(k=!!j.leading,U="maxWait"in j,q=U?p(C(j.maxWait)||0,v):q,D="trailing"in j?!!j.trailing:D);function K(N){var I=H,z=Q;return H=Q=void 0,R=N,w=g.apply(z,I),w}function ee(N){return R=N,_=setTimeout(J,v),k?K(N):w}function F(N){var I=N-M,z=N-R,G=v-I;return U?h(G,q-z):G}function B(N){var I=N-M,z=N-R;return M===void 0||I>=v||I<0||U&&z>=q}function J(){var N=m();if(B(N))return A(N);_=setTimeout(J,F(N))}function A(N){return _=void 0,D&&H?K(N):(H=Q=void 0,w)}function Y(){_!==void 0&&clearTimeout(_),R=0,H=M=Q=_=void 0}function $(){return _===void 0?w:A(m())}function T(){var N=m(),I=B(N);if(H=arguments,Q=this,M=N,I){if(_===void 0)return ee(M);if(U)return _=setTimeout(J,v),K(M)}return _===void 0&&(_=setTimeout(J,v)),w}return T.cancel=Y,T.flush=$,T}function P(g){var v=typeof g;return!!g&&(v=="object"||v=="function")}function E(g){return!!g&&typeof g=="object"}function S(g){return typeof g=="symbol"||E(g)&&d.call(g)==a}function C(g){if(typeof g=="number")return g;if(S(g))return r;if(P(g)){var v=typeof g.valueOf=="function"?g.valueOf():g;g=P(v)?v+"":v}if(typeof g!="string")return g===0?g:+g;g=g.replace(e,"");var j=o.test(g);return j||s.test(g)?i(g.slice(2),j?2:8):n.test(g)?r:+g}return el=b,el}var W1=L1();const Y1=eu(W1),wr=t=>/^(\d+)?(\.)?(\d*)?$/.test(t),Qt=({label:t,children:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx("div",{className:"hfl-flex-1 hfl-min-w-0",children:r})]}),Xt=({label:t,value:r})=>W.jsxs($e,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-text-Blue_gray-800 hfl-gap-1",children:[W.jsxs("span",{className:"hfl-flex-shrink-0",children:[t,":"]}),W.jsx($e,{variant:"Bold",type:"Text sm",className:"hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0",children:r||"--"})]}),na=({children:t,className:r=""})=>W.jsx($e,{variant:"Regular",type:"Text sm",className:`hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${r}`,children:t}),U1=ie.memo(function({rowData:r,isEditing:a,setIsEditing:e,onSaveRow:n}){const{variant:o,externallyTriggeredEditMode:s,externallyTriggeredEditRowIds:i,getMedicineOptions:l,onRowChange:u,onRowDelete:c}=iy(),[f,d]=ie.useState([]),[p,h]=ie.useState(r);ie.useEffect(()=>{a||h(r)},[r,a]);const m=async w=>(await l?.(w))?.map(M=>({label:M.doctorMedicineName,value:M}))||[],P=s||i?.includes(r.rowId)||a,E=ie.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[0]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),S=ie.useMemo(()=>p.calculation_type===wt.C_MedicineCalculatorList[1]?p.calculation_fields:null,[p.calculation_fields,p.calculation_type]),C=(w,_)=>{let M;if(w==="calculation_type"){const R=_,k={frequency:p.calculation_fields.frequency,pedia_dosage:p.calculation_fields.pedia_dosage};M={...p,calculation_type:R,calculation_fields:R==="mg/kg/dose"?{...wt.C_DefaultMgKgFields,...k}:{...wt.C_DefaultMlKgFields,...k}}}else M={...p,[w]:_};h(M),o==="prescription"&&g(M,w)},g=ie.useMemo(()=>Y1((w,_)=>{u?.(w,_||"")},500),[u]);ie.useEffect(()=>()=>{g.cancel()},[g]);const v=ie.useCallback((w,_)=>{h(M=>{let R={...M.calculation_fields,[w]:_};if(w==="frequency"&&o==="standard"){const U=wt.C_FrequencyDosageMap[_]||[];U.length>0?R={...R,pedia_dosage:U[0]}:R={...R,pedia_dosage:""}}const k={...M,calculation_fields:R};return o==="prescription"&&g(k,w),k})},[g,o]),j=async()=>{const w={...p,calculation_fields:{...p.calculation_fields}};await n?.(w)&&g({...w,isEditing:!1})},H=async()=>{if(!r.medicine_name||r.medicine_name.trim()===""){c?.(r.rowId);return}h(r),o==="standard"&&e(!1)},Q=w=>o==="prescription"&&w==="medicine_name"?!1:P,q=()=>{const w=!(p?.isSavedToLibrary??!1),_={...p,isSavedToLibrary:w};h(_),g(_,"isSavedToLibrary")};return W.jsxs("div",{className:`medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${P?"hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50":""}`,children:[W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("medicine_name")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",inputValue:p.medicine_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:async w=>{if(C("medicine_name",w),w.trim()){const _=await m(w);d(_)}else d([])},onInputFocus:async()=>{const w=await m(p.medicine_name);d(w)},onChangeHandler:w=>{const _=w.value,M=wt.C_MedicineTypeList.find(R=>R.val===_.medicineType);h(R=>({...R,medicine_name:_.doctorMedicineName,medicine_id:_.medicineId,generic_name:_.doctorGenericName,type:M?.type??""}))},options:f,isSearchable:!0,placeholder:"Search medicine"}):W.jsx(na,{children:r.medicine_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("generic_name")?W.jsx(st,{wrapperClass:"hfl-w-full",inputClassName:"hfl-w-full",btnClassName:"hfl-w-full",inputValue:p.generic_name,showInput:!0,disableInputAutoSize:!0,inputChangeHandler:w=>C("generic_name",w),hideDropdownIcon:!0}):W.jsx(na,{children:r.generic_name})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:(()=>{const w=wt.C_MedicineTypeList.find(_=>_.type===p.type);return w?{label:w.type,value:w.type}:void 0})(),options:wt.C_MedicineTypeList.map(w=>({label:w.type,value:w.type})),onChangeHandler:w=>C("type",w.value)}):W.jsx(na,{children:r.type||""})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("calculation_type")?W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",placeholder:"Select",showInput:!1,disableInputAutoSize:!0,selectedOption:{label:p.calculation_type,value:p.calculation_type},options:wt.C_MedicineCalculatorList.map(w=>({label:w,value:w})),onChangeHandler:w=>C("calculation_type",w.value)}):W.jsx(na,{children:r.calculation_type})}),W.jsx("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2",children:Q("calculation_fields")?W.jsxs(W.Fragment,{children:[E&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Drug Strength",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 250",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.drug_strength||"",inputChangeHandler:w=>{wr(w)&&v("drug_strength",w)}})}),W.jsx(Qt,{label:"Dose/mg/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 15",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.dose_mg_kg||"",inputChangeHandler:w=>{wr(w)&&v("dose_mg_kg",w)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{v("frequency",w.value)}})}),W.jsx(Qt,{label:"Max Dose (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.max_mg_dose||"",inputChangeHandler:w=>{wr(w)&&v("max_mg_dose",w)}})}),W.jsx(Qt,{label:"Max Day (mg)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mg/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:E.max_mg_day||"",inputChangeHandler:w=>{wr(w)&&v("max_mg_day",w)}})})]}),S&&W.jsxs(W.Fragment,{children:[W.jsx(Qt,{label:"Multiplier",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 0.5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.multiplier||"",inputChangeHandler:w=>{wr(w)&&v("multiplier",w)}})}),W.jsx(Qt,{label:"Dose/mL/kg",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"e.g., 5",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.dose_ml_kg||"",inputChangeHandler:w=>{wr(w)&&v("dose_ml_kg",w)}})}),W.jsx(Qt,{label:"Frequency",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Frequency",showInput:!1,selectedOption:p.calculation_fields.frequency?{label:p.calculation_fields.frequency,value:p.calculation_fields.frequency}:void 0,options:wt.C_MedicineFrequencyList.map(w=>({label:w,value:w})),onChangeHandler:w=>{v("frequency",w.value)}})}),W.jsx(Qt,{label:"Max Dose (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/dose",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_ml_dose||"",inputChangeHandler:w=>{wr(w)&&v("max_ml_dose",w)}})}),W.jsx(Qt,{label:"Max Day (mL)",children:W.jsx(st,{wrapperClass:"hfl-w-full",placeholder:"Max mL/day",showInput:!0,hideDropdownIcon:!0,disableInputAutoSize:!0,inputType:"text",inputValue:S.max_ml_day||"",inputChangeHandler:w=>{wr(w)&&v("max_ml_day",w)}})})]})]}):W.jsxs(W.Fragment,{children:[E&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Drug Strength",value:E.drug_strength}),W.jsx(Xt,{label:"Dose/mg/kg",value:E.dose_mg_kg}),W.jsx(Xt,{label:"Frequency",value:E.frequency}),W.jsx(Xt,{label:"Max Dose (mg)",value:E.max_mg_dose}),W.jsx(Xt,{label:"Max Day (mg)",value:E.max_mg_day})]}),S&&W.jsxs(W.Fragment,{children:[W.jsx(Xt,{label:"Multiplier",value:S.multiplier}),W.jsx(Xt,{label:"Dose/mL/kg",value:S.dose_ml_kg}),W.jsx(Xt,{label:"Frequency",value:S.frequency}),W.jsx(Xt,{label:"Max Dose (mL)",value:S.max_ml_dose}),W.jsx(Xt,{label:"Max Day (mL)",value:S.max_ml_day})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:Q("pedia_dosage")?(()=>{const w=p.calculation_fields.frequency,_=wt.C_FrequencyDosageMap[w]||[];return W.jsx(st,{wrapperClass:"hfl-w-full",btnClassName:"hfl-w-full",inputClassName:"hfl-w-full",placeholder:"Select",showInput:o!=="standard",disableInputAutoSize:!0,inputValue:p.calculation_fields.pedia_dosage,inputChangeHandler:M=>v("pedia_dosage",M),selectedOption:{label:p.calculation_fields.pedia_dosage,value:p.calculation_fields.pedia_dosage},options:o!=="prescription"?_.map(M=>({label:M,value:M})):void 0,onChangeHandler:o!=="prescription"?M=>v("pedia_dosage",M.value):void 0,hideDropdownIcon:o==="prescription",showEmptyDropdownPopup:o!=="prescription",showErrorMsg:p.out_of_range||p.isDosageMismatch,errorMsg:p.out_of_range?"Dosage Exceeds Safety Limits":p.isDosageMismatch?"Dosage is in mismatch with the selected frequency":""})})():W.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0",children:[W.jsx(na,{children:r.calculation_fields.pedia_dosage}),r.out_of_range&&W.jsxs("div",{className:"hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2",children:[W.jsx("div",{className:"hx_warning hfl-text-Error-400"}),W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-px-2 hfl-text-1 hfl-text-Error-500",children:"Dosage exceed safety limits"})]})]})}),W.jsx("div",{className:"hfl-w-full hfl-py-2.5 hfl-min-w-0",children:W.jsx(R1,{effectiveEditMode:P,rowData:r,isSavedToLibrary:p.isSavedToLibrary??!1,onSave:j,onCancel:H,onEdit:()=>e(!0),onCheckboxToggle:q})})]})},(t,r)=>t.isEditing===r.isEditing&&t.rowData.rowId===r.rowData.rowId&&t.rowData.isEditing===r.rowData.isEditing&&t.rowData.medicine_name===r.rowData.medicine_name&&t.rowData.generic_name===r.rowData.generic_name&&t.rowData.type===r.rowData.type&&t.rowData.calculation_type===r.rowData.calculation_type&&JSON.stringify(t.rowData.calculation_fields)===JSON.stringify(r.rowData.calculation_fields)&&t.rowData.calculation_fields.pedia_dosage===r.rowData.calculation_fields.pedia_dosage);var vo={exports:{}},xr={},yo={exports:{}},kt={},go={exports:{}},ih;function sy(){return ih||(ih=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=c;/*!
|
|
94
94
|
* Adapted from jQuery UI core
|
|
95
95
|
*
|
|
96
96
|
* http://jqueryui.com
|
|
@@ -121,4 +121,4 @@ doc.body (`+u+`):
|
|
|
121
121
|
`+n:"")+`
|
|
122
122
|
|
|
123
123
|
The above lifecycles should be removed. Learn more about this warning here:
|
|
124
|
-
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof t.getDerivedStateFromProps=="function"&&(r.componentWillMount=cy,r.componentWillReceiveProps=fy),typeof r.getSnapshotBeforeUpdate=="function"){if(typeof r.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");r.componentWillUpdate=dy;var i=r.componentDidUpdate;r.componentDidUpdate=function(u,c,f){var d=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:f;i.call(this,u,c,d)}}return t}const Q1=Object.freeze(Object.defineProperty({__proto__:null,polyfill:G1},Symbol.toStringTag,{value:"Module"})),X1=Py(Q1);var yh;function J1(){if(yh)return xr;yh=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.bodyOpenClassName=xr.portalClassName=void 0;var t=Object.assign||function(w){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var R in M)Object.prototype.hasOwnProperty.call(M,R)&&(w[R]=M[R])}return w},r=function(){function w(_,M){for(var R=0;R<M.length;R++){var k=M[R];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(_,k.key,k)}}return function(_,M,R){return M&&w(_.prototype,M),R&&w(_,R),_}}(),a=ie,e=b(a),n=_a,o=b(n),s=ru(),i=b(s),l=K1(),u=b(l),c=ly(),f=m(c),d=rc(),p=b(d),h=X1;function m(w){if(w&&w.__esModule)return w;var _={};if(w!=null)for(var M in w)Object.prototype.hasOwnProperty.call(w,M)&&(_[M]=w[M]);return _.default=w,_}function b(w){return w&&w.__esModule?w:{default:w}}function P(w,_){if(!(w instanceof _))throw new TypeError("Cannot call a class as a function")}function E(w,_){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:w}function S(w,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);w.prototype=Object.create(_&&_.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(w,_):w.__proto__=_)}var C=xr.portalClassName="ReactModalPortal",g=xr.bodyOpenClassName="ReactModal__Body--open",v=d.canUseDOM&&o.default.createPortal!==void 0,j=function(_){return document.createElement(_)},H=function(){return v?o.default.createPortal:o.default.unstable_renderSubtreeIntoContainer};function Q(w){return w()}var q=function(w){S(_,w);function _(){var M,R,k,U;P(this,_);for(var D=arguments.length,K=Array(D),ee=0;ee<D;ee++)K[ee]=arguments[ee];return U=(R=(k=E(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(K))),k),k.removePortal=function(){!v&&o.default.unmountComponentAtNode(k.node);var F=Q(k.props.parentSelector);F&&F.contains(k.node)?F.removeChild(k.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},k.portalRef=function(F){k.portal=F},k.renderPortal=function(F){var B=H(),J=B(k,e.default.createElement(u.default,t({defaultStyles:_.defaultStyles},F)),k.node);k.portalRef(J)},R),E(k,U)}return r(_,[{key:"componentDidMount",value:function(){if(d.canUseDOM){v||(this.node=j("div")),this.node.className=this.props.portalClassName;var R=Q(this.props.parentSelector);R.appendChild(this.node),!v&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(R){var k=Q(R.parentSelector),U=Q(this.props.parentSelector);return{prevParent:k,nextParent:U}}},{key:"componentDidUpdate",value:function(R,k,U){if(d.canUseDOM){var D=this.props,K=D.isOpen,ee=D.portalClassName;R.portalClassName!==ee&&(this.node.className=ee);var F=U.prevParent,B=U.nextParent;B!==F&&(F.removeChild(this.node),B.appendChild(this.node)),!(!R.isOpen&&!K)&&!v&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!d.canUseDOM||!this.node||!this.portal)){var R=this.portal.state,k=Date.now(),U=R.isOpen&&this.props.closeTimeoutMS&&(R.closesAt||k+this.props.closeTimeoutMS);U?(R.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,U-k)):this.removePortal()}}},{key:"render",value:function(){if(!d.canUseDOM||!v)return null;!this.node&&v&&(this.node=j("div"));var R=H();return R(e.default.createElement(u.default,t({ref:this.portalRef,defaultStyles:_.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(R){f.setElement(R)}}]),_}(a.Component);return q.propTypes={isOpen:i.default.bool.isRequired,style:i.default.shape({content:i.default.object,overlay:i.default.object}),portalClassName:i.default.string,bodyOpenClassName:i.default.string,htmlOpenClassName:i.default.string,className:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),overlayClassName:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),appElement:i.default.oneOfType([i.default.instanceOf(p.default),i.default.instanceOf(d.SafeHTMLCollection),i.default.instanceOf(d.SafeNodeList),i.default.arrayOf(i.default.instanceOf(p.default))]),onAfterOpen:i.default.func,onRequestClose:i.default.func,closeTimeoutMS:i.default.number,ariaHideApp:i.default.bool,shouldFocusAfterRender:i.default.bool,shouldCloseOnOverlayClick:i.default.bool,shouldReturnFocusAfterClose:i.default.bool,preventScroll:i.default.bool,parentSelector:i.default.func,aria:i.default.object,data:i.default.object,role:i.default.string,contentLabel:i.default.string,shouldCloseOnEsc:i.default.bool,overlayRef:i.default.func,contentRef:i.default.func,id:i.default.string,overlayElement:i.default.func,contentElement:i.default.func},q.defaultProps={isOpen:!1,portalClassName:C,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(_,M){return e.default.createElement("div",_,M)},contentElement:function(_,M){return e.default.createElement("div",_,M)}},q.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(q),process.env.NODE_ENV!=="production"&&(q.setCreateHTMLElement=function(w){return j=w}),xr.default=q,xr}var gh;function Z1(){return gh||(gh=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0});var a=J1(),e=n(a);function n(o){return o&&o.__esModule?o:{default:o}}r.default=e.default,t.exports=r.default}(vo,vo.exports)),vo.exports}var ej=Z1();const py=eu(ej),tj=t=>{const{openState:r,closePopupCallback:a,headingIconFile:e,headingText:n,subHeadingText:o,positiveButtonText:s,negativeButtonText:i,classNamePositiveBtn:l,classNameNegativeBtn:u,positiveActionCallback:c,negativeActionCallback:f}=t;return W.jsxs(py,{isOpen:r,onRequestClose:a,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:r?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:r?"block":"none"}},children:[e=="warning"&&W.jsx("div",{className:"hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600",children:W.jsx("i",{className:"hx_warning hfl-text-5"})}),W.jsx($e,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:n}),o&&W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:o}),W.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[i&&W.jsx(ma,{size:"md",textField:i,hierarchy:"Primary",className:u||"",onClick:f,"data-qa":"negative-action"}),s&&W.jsx(ma,{size:"md",textField:s,hierarchy:"Secondary",className:l||"",onClick:c,"data-qa":"positive-action"})]})]})},rj=({open:t,onCancel:r,onCopySave:a,rowMedicineData:e,getMedicineOptions:n})=>{const[o,s]=ie.useState([]),[i,l]=ie.useState(""),[u,c]=ie.useState([]),f=ie.useCallback(async m=>{const P=(await n?.(m))?.map(E=>({label:E.doctorMedicineName,value:E}));c(P||[])},[n]);ie.useEffect(()=>{t&&f(i)},[i,f,t]);const d=m=>{const b=m.value;o.some(E=>E.medicineId===b.medicineId&&E.doctorMedicineName.trim().toLowerCase()===b.doctorMedicineName.trim().toLowerCase())||s(E=>[...E,b]),l(""),c([])},p=m=>{s(b=>b.filter(P=>P.medicineId!==m))},h=async()=>{i.trim()||await f("")};return W.jsxs(py,{isOpen:t,onRequestClose:r,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[W.jsx($e,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),W.jsxs("div",{className:"hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1",children:[W.jsx(st,{inputValue:i,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:l,onChangeHandler:d,onInputFocus:h,options:u,placeholder:"Search for medicines"}),W.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:o.map(m=>W.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:m.doctorMedicineName}),W.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>p(m.medicineId),children:W.jsx("i",{className:"hx_close"})})]},m.doctorMedicineName+m.medicineId))})]}),W.jsxs("div",{className:"hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200",children:[W.jsx(ma,{size:"md",textField:"Cancel",onClick:r,hierarchy:"Secondary-Grey"}),W.jsx(ma,{size:"md",textField:"Save",disabled:!o||o.length==0,onClick:async()=>{await a(e,o)&&r()},className:"hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",hierarchy:"Primary"})]})]})},nj=ie.forwardRef(({data:t=[],variant:r,externallyTriggeredEditRowIds:a=[],externallyTriggeredEditMode:e=!1,getMedicineOptions:n,onRowChange:o,onRowDelete:s,onRowCopy:i,onSaveRow:l,externalSaveTrigger:u,setSearchDisabled:c},f)=>{const[d,p]=ie.useState(null),[h,m]=ie.useState(!1),[b,P]=ie.useState(),E=ie.useCallback((q,w)=>{const _=t.find(R=>R.rowId===q);if(!_)return;const M={..._,...w};o?.(M)},[t,o]),S=ie.useCallback(async()=>{const q=t.filter(w=>w.isEditing&&w.medicine_name);if(q.length!==0)try{await l?.(q)&&q.forEach(_=>{o?.({..._,isEditing:!1})})}catch(w){console.error("Bulk save failed",w)}finally{c?.(!1)}},[t,l,o,c]);ie.useEffect(()=>{u&&S()},[u,S]),ie.useEffect(()=>{const q=t.some(w=>w.isEditing);c?.(q)},[t,c]);const C=ie.useCallback(q=>{P(q),m(!0)},[]),g=ie.useCallback(async()=>{if(d)try{await s?.(d)}catch(q){console.error("Delete failed",q)}finally{p(null)}},[d,s]),v=ie.useCallback(()=>{p(null)},[]),j=ie.useCallback(async q=>{try{return await l?.([q])?(o?.({...q,isEditing:!1}),!0):!1}catch(w){return console.error("Save row failed",w),!1}},[l,o]),H=ie.useCallback(async()=>{const q=t.filter(w=>w.isEditing&&w.medicine_name);if(q.length===0)return!0;try{const w=await l?.(q);return w&&t.map(M=>M.isEditing?{...M,isEditing:!1}:M).forEach(M=>o?.(M)),!!w}catch(w){return console.error("External bulk save failed",w),!1}},[t,l,o]);ie.useImperativeHandle(f,()=>({triggerExternalSave:H}));const Q={variant:r,externallyTriggeredEditMode:e,externallyTriggeredEditRowIds:a,getMedicineOptions:n,onRowChange:q=>{E(q.rowId,q),o?.(q)},onRowDelete:s,onRowCopy:i,setRowToDelete:p,openPopupForRow:C};return W.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[W.jsx("div",{className:"table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50",children:wt.C_Table_Column_Name.map(q=>W.jsx($e,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:q},q))}),W.jsxs(oy.Provider,{value:Q,children:[W.jsx("div",{className:"table-body",children:t.length===0?W.jsx($e,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):t.map(q=>W.jsx(U1,{rowData:q,isEditing:q.isEditing||!1,setIsEditing:w=>E(q.rowId,{isEditing:w}),onSaveRow:j},q.rowId))}),W.jsx(tj,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!d,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:g,negativeActionCallback:v,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:v}),W.jsx(rj,{open:h,onCancel:()=>m(!1),onCopySave:i,rowMedicineData:b,getMedicineOptions:n})]})]})});exports.PediatricsCalculatorTable=nj;
|
|
124
|
+
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof t.getDerivedStateFromProps=="function"&&(r.componentWillMount=cy,r.componentWillReceiveProps=fy),typeof r.getSnapshotBeforeUpdate=="function"){if(typeof r.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");r.componentWillUpdate=dy;var i=r.componentDidUpdate;r.componentDidUpdate=function(u,c,f){var d=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:f;i.call(this,u,c,d)}}return t}const Q1=Object.freeze(Object.defineProperty({__proto__:null,polyfill:G1},Symbol.toStringTag,{value:"Module"})),X1=Py(Q1);var yh;function J1(){if(yh)return xr;yh=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.bodyOpenClassName=xr.portalClassName=void 0;var t=Object.assign||function(w){for(var _=1;_<arguments.length;_++){var M=arguments[_];for(var R in M)Object.prototype.hasOwnProperty.call(M,R)&&(w[R]=M[R])}return w},r=function(){function w(_,M){for(var R=0;R<M.length;R++){var k=M[R];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(_,k.key,k)}}return function(_,M,R){return M&&w(_.prototype,M),R&&w(_,R),_}}(),a=ie,e=b(a),n=_a,o=b(n),s=ru(),i=b(s),l=K1(),u=b(l),c=ly(),f=m(c),d=rc(),p=b(d),h=X1;function m(w){if(w&&w.__esModule)return w;var _={};if(w!=null)for(var M in w)Object.prototype.hasOwnProperty.call(w,M)&&(_[M]=w[M]);return _.default=w,_}function b(w){return w&&w.__esModule?w:{default:w}}function P(w,_){if(!(w instanceof _))throw new TypeError("Cannot call a class as a function")}function E(w,_){if(!w)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return _&&(typeof _=="object"||typeof _=="function")?_:w}function S(w,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof _);w.prototype=Object.create(_&&_.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),_&&(Object.setPrototypeOf?Object.setPrototypeOf(w,_):w.__proto__=_)}var C=xr.portalClassName="ReactModalPortal",g=xr.bodyOpenClassName="ReactModal__Body--open",v=d.canUseDOM&&o.default.createPortal!==void 0,j=function(_){return document.createElement(_)},H=function(){return v?o.default.createPortal:o.default.unstable_renderSubtreeIntoContainer};function Q(w){return w()}var q=function(w){S(_,w);function _(){var M,R,k,U;P(this,_);for(var D=arguments.length,K=Array(D),ee=0;ee<D;ee++)K[ee]=arguments[ee];return U=(R=(k=E(this,(M=_.__proto__||Object.getPrototypeOf(_)).call.apply(M,[this].concat(K))),k),k.removePortal=function(){!v&&o.default.unmountComponentAtNode(k.node);var F=Q(k.props.parentSelector);F&&F.contains(k.node)?F.removeChild(k.node):console.warn('React-Modal: "parentSelector" prop did not returned any DOM element. Make sure that the parent element is unmounted to avoid any memory leaks.')},k.portalRef=function(F){k.portal=F},k.renderPortal=function(F){var B=H(),J=B(k,e.default.createElement(u.default,t({defaultStyles:_.defaultStyles},F)),k.node);k.portalRef(J)},R),E(k,U)}return r(_,[{key:"componentDidMount",value:function(){if(d.canUseDOM){v||(this.node=j("div")),this.node.className=this.props.portalClassName;var R=Q(this.props.parentSelector);R.appendChild(this.node),!v&&this.renderPortal(this.props)}}},{key:"getSnapshotBeforeUpdate",value:function(R){var k=Q(R.parentSelector),U=Q(this.props.parentSelector);return{prevParent:k,nextParent:U}}},{key:"componentDidUpdate",value:function(R,k,U){if(d.canUseDOM){var D=this.props,K=D.isOpen,ee=D.portalClassName;R.portalClassName!==ee&&(this.node.className=ee);var F=U.prevParent,B=U.nextParent;B!==F&&(F.removeChild(this.node),B.appendChild(this.node)),!(!R.isOpen&&!K)&&!v&&this.renderPortal(this.props)}}},{key:"componentWillUnmount",value:function(){if(!(!d.canUseDOM||!this.node||!this.portal)){var R=this.portal.state,k=Date.now(),U=R.isOpen&&this.props.closeTimeoutMS&&(R.closesAt||k+this.props.closeTimeoutMS);U?(R.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,U-k)):this.removePortal()}}},{key:"render",value:function(){if(!d.canUseDOM||!v)return null;!this.node&&v&&(this.node=j("div"));var R=H();return R(e.default.createElement(u.default,t({ref:this.portalRef,defaultStyles:_.defaultStyles},this.props)),this.node)}}],[{key:"setAppElement",value:function(R){f.setElement(R)}}]),_}(a.Component);return q.propTypes={isOpen:i.default.bool.isRequired,style:i.default.shape({content:i.default.object,overlay:i.default.object}),portalClassName:i.default.string,bodyOpenClassName:i.default.string,htmlOpenClassName:i.default.string,className:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),overlayClassName:i.default.oneOfType([i.default.string,i.default.shape({base:i.default.string.isRequired,afterOpen:i.default.string.isRequired,beforeClose:i.default.string.isRequired})]),appElement:i.default.oneOfType([i.default.instanceOf(p.default),i.default.instanceOf(d.SafeHTMLCollection),i.default.instanceOf(d.SafeNodeList),i.default.arrayOf(i.default.instanceOf(p.default))]),onAfterOpen:i.default.func,onRequestClose:i.default.func,closeTimeoutMS:i.default.number,ariaHideApp:i.default.bool,shouldFocusAfterRender:i.default.bool,shouldCloseOnOverlayClick:i.default.bool,shouldReturnFocusAfterClose:i.default.bool,preventScroll:i.default.bool,parentSelector:i.default.func,aria:i.default.object,data:i.default.object,role:i.default.string,contentLabel:i.default.string,shouldCloseOnEsc:i.default.bool,overlayRef:i.default.func,contentRef:i.default.func,id:i.default.string,overlayElement:i.default.func,contentElement:i.default.func},q.defaultProps={isOpen:!1,portalClassName:C,bodyOpenClassName:g,role:"dialog",ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,shouldCloseOnOverlayClick:!0,shouldReturnFocusAfterClose:!0,preventScroll:!1,parentSelector:function(){return document.body},overlayElement:function(_,M){return e.default.createElement("div",_,M)},contentElement:function(_,M){return e.default.createElement("div",_,M)}},q.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},(0,h.polyfill)(q),process.env.NODE_ENV!=="production"&&(q.setCreateHTMLElement=function(w){return j=w}),xr.default=q,xr}var gh;function Z1(){return gh||(gh=1,function(t,r){Object.defineProperty(r,"__esModule",{value:!0});var a=J1(),e=n(a);function n(o){return o&&o.__esModule?o:{default:o}}r.default=e.default,t.exports=r.default}(vo,vo.exports)),vo.exports}var ej=Z1();const py=eu(ej),tj=t=>{const{openState:r,closePopupCallback:a,headingIconFile:e,headingText:n,subHeadingText:o,positiveButtonText:s,negativeButtonText:i,classNamePositiveBtn:l,classNameNegativeBtn:u,positiveActionCallback:c,negativeActionCallback:f}=t;return W.jsxs(py,{isOpen:r,onRequestClose:a,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1030,display:r?"block":"none"},content:{zIndex:1030,padding:"24px",maxWidth:"750px",maxHeight:"600px",width:"400px",height:"fit-content",margin:"auto",borderRadius:"12px",overflow:"unset",display:r?"block":"none"}},children:[e=="warning"&&W.jsx("div",{className:"hfl-hx_warning hfl-mb-4 hfl-flex hfl-h-12 hfl-w-12 hfl-items-center hfl-justify-center hfl-rounded-full hfl-border-8 hfl-border-Warning-50 hfl-bg-Warning-100 hfl-text-Warning-600",children:W.jsx("i",{className:"hx_warning hfl-text-5"})}),W.jsx($e,{variant:"Medium",type:"Text xl",className:"hfl-mt-5 hfl-text-Gray-900",children:n}),o&&W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-mt-1 hfl-text-Gray-500 ",children:o}),W.jsxs("div",{className:"hfl-mt-4 hfl-flex hfl-items-center hfl-justify-center hfl-gap-4",children:[i&&W.jsx(ma,{size:"md",textField:i,hierarchy:"Primary",className:u||"",onClick:f,"data-qa":"negative-action"}),s&&W.jsx(ma,{size:"md",textField:s,hierarchy:"Secondary",className:l||"",onClick:c,"data-qa":"positive-action"})]})]})},rj=({open:t,onCancel:r,onCopySave:a,rowMedicineData:e,getMedicineOptions:n})=>{const[o,s]=ie.useState([]),[i,l]=ie.useState(""),[u,c]=ie.useState([]),f=ie.useCallback(async m=>{const P=(await n?.(m))?.map(E=>({label:E.doctorMedicineName,value:E}));c(P||[])},[n]);ie.useEffect(()=>{t&&f(i)},[i,f,t]);const d=m=>{const b=m.value;o.some(E=>E.medicineId===b.medicineId&&E.doctorMedicineName.trim().toLowerCase()===b.doctorMedicineName.trim().toLowerCase())||s(E=>[...E,b]),l(""),c([])},p=m=>{s(b=>b.filter(P=>P.medicineId!==m))},h=async()=>{i.trim()||await f("")};return W.jsxs(py,{isOpen:t,onRequestClose:r,shouldCloseOnOverlayClick:!1,style:{overlay:{backgroundColor:"rgba(52, 64, 84, 0.5)",zIndex:1030},content:{zIndex:1031,maxWidth:"600px",maxHeight:"50vh",height:"auto",margin:"auto",borderRadius:"12px",padding:"0px",display:"flex",flexDirection:"column"}},children:[W.jsx($e,{variant:"Bold",type:"Text lg",className:"hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",children:"Please select medicine to copy"}),W.jsxs("div",{className:"hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1",children:[W.jsx(st,{inputValue:i,showInput:!0,isSearchable:!0,disableInputAutoSize:!0,inputChangeHandler:l,onChangeHandler:d,onInputFocus:h,options:u,placeholder:"Search for medicines"}),W.jsx("div",{className:"hfl-flex hfl-flex-wrap hfl-gap-2",children:o.map(m=>W.jsxs("div",{className:"hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",children:[W.jsx($e,{variant:"Regular",type:"Text sm",className:"hfl-text-nowrap",children:m.doctorMedicineName}),W.jsx("button",{className:"hfl-text-Blue_gray-800",onClick:()=>p(m.medicineId),children:W.jsx("i",{className:"hx_close"})})]},m.doctorMedicineName+m.medicineId))})]}),W.jsxs("div",{className:"hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200",children:[W.jsx(ma,{size:"md",textField:"Cancel",onClick:r,hierarchy:"Secondary-Grey"}),W.jsx(ma,{size:"md",textField:"Save",disabled:!o||o.length==0,onClick:async()=>{await a(e,o)&&r()},className:"hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",hierarchy:"Primary"})]})]})},nj=ie.forwardRef(({data:t=[],variant:r,externallyTriggeredEditRowIds:a=[],externallyTriggeredEditMode:e=!1,getMedicineOptions:n,onRowChange:o,onRowDelete:s,onRowCopy:i,onSaveRow:l,externalSaveTrigger:u,setSearchDisabled:c},f)=>{const[d,p]=ie.useState(null),[h,m]=ie.useState(!1),[b,P]=ie.useState(),E=ie.useCallback((q,w,_)=>{const M=t.find(k=>k.rowId===q);if(!M)return;const R={...M,...w};o?.(R,_||void 0)},[t,o]),S=ie.useCallback(async()=>{const q=t.filter(w=>w.isEditing&&w.medicine_name);if(q.length!==0)try{await l?.(q)&&q.forEach(_=>{o?.({..._,isEditing:!1})})}catch(w){console.error("Bulk save failed",w)}finally{c?.(!1)}},[t,l,o,c]);ie.useEffect(()=>{u&&S()},[u,S]),ie.useEffect(()=>{const q=t.some(w=>w.isEditing);c?.(q)},[t,c]);const C=ie.useCallback(q=>{P(q),m(!0)},[]),g=ie.useCallback(async()=>{if(d)try{await s?.(d)}catch(q){console.error("Delete failed",q)}finally{p(null)}},[d,s]),v=ie.useCallback(()=>{p(null)},[]),j=ie.useCallback(async q=>{try{return await l?.([q])?(o?.({...q,isEditing:!1}),!0):!1}catch(w){return console.error("Save row failed",w),!1}},[l,o]),H=ie.useCallback(async()=>{const q=t.filter(w=>w.isEditing&&w.medicine_name);if(q.length===0)return!0;try{const w=await l?.(q);return w&&t.map(M=>M.isEditing?{...M,isEditing:!1}:M).forEach(M=>o?.(M)),!!w}catch(w){return console.error("External bulk save failed",w),!1}},[t,l,o]);ie.useImperativeHandle(f,()=>({triggerExternalSave:H}));const Q={variant:r,externallyTriggeredEditMode:e,externallyTriggeredEditRowIds:a,getMedicineOptions:n,onRowChange:(q,w)=>{E(q.rowId,q,w),o?.(q,w)},onRowDelete:s,onRowCopy:i,setRowToDelete:p,openPopupForRow:C};return W.jsxs("div",{className:"hfl-border-1 hfl-border-Gray-200",children:[W.jsx("div",{className:"table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50",children:wt.C_Table_Column_Name.map(q=>W.jsx($e,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600",children:q},q))}),W.jsxs(oy.Provider,{value:Q,children:[W.jsx("div",{className:"table-body",children:t.length===0?W.jsx($e,{variant:"Medium",type:"Text sm",className:"hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3",children:"No medicines added"}):t.map(q=>W.jsx(U1,{rowData:q,isEditing:q.isEditing||!1,setIsEditing:w=>E(q.rowId,{isEditing:w}),onSaveRow:j},q.rowId))}),W.jsx(tj,{headingText:"Delete Medicine",subHeadingText:"Are you sure you want to delete this medicine?",openState:!!d,positiveButtonText:"Delete",negativeButtonText:"Cancel",positiveActionCallback:g,negativeActionCallback:v,classNameNegativeBtn:"hfl-bg-Blue-600",classNamePositiveBtn:"hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",closePopupCallback:v}),W.jsx(rj,{open:h,onCancel:()=>m(!1),onCopySave:i,rowMedicineData:b,getMedicineOptions:n})]})]})});exports.PediatricsCalculatorTable=nj;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l = [
|
|
2
2
|
"Medicine Name",
|
|
3
3
|
"Generic Name",
|
|
4
4
|
"Type",
|
|
@@ -6,7 +6,7 @@ const t = [
|
|
|
6
6
|
"Additional Information",
|
|
7
7
|
"Dosage",
|
|
8
8
|
"Options"
|
|
9
|
-
],
|
|
9
|
+
], p = [
|
|
10
10
|
{
|
|
11
11
|
type: "TAB.",
|
|
12
12
|
val: 2
|
|
@@ -99,26 +99,28 @@ const t = [
|
|
|
99
99
|
type: "SPR.",
|
|
100
100
|
val: 24
|
|
101
101
|
}
|
|
102
|
-
]
|
|
102
|
+
];
|
|
103
|
+
var a = /* @__PURE__ */ ((e) => (e["1(OD)"] = "1(OD)", e["2(BD)"] = "2(BD)", e["3(TDS)"] = "3(TDS)", e["4(QID)"] = "4(QID)", e["6(Q4H)"] = "6(Q4H)", e))(a || {});
|
|
104
|
+
const y = Object.values(a), s = {
|
|
103
105
|
"1(OD)": ["X-0-0", "0-X-0", "0-0-X"],
|
|
104
106
|
"2(BD)": ["X-X-0", "X-0-X", "0-X-X"],
|
|
105
107
|
"3(TDS)": ["X-X-X"],
|
|
106
108
|
"4(QID)": ["X-X-X-X"],
|
|
107
109
|
"6(Q4H)": ["X-X-X-X-X-X"]
|
|
108
110
|
};
|
|
109
|
-
var
|
|
110
|
-
const
|
|
111
|
+
var t = /* @__PURE__ */ ((e) => (e.MgKgDose = "mg/kg/dose", e.MlKg = "mL/kg", e))(t || {});
|
|
112
|
+
const v = [
|
|
111
113
|
"mg/kg/dose",
|
|
112
114
|
"mL/kg"
|
|
113
115
|
/* MlKg */
|
|
114
|
-
],
|
|
116
|
+
], o = {
|
|
115
117
|
drug_strength: "",
|
|
116
118
|
dose_mg_kg: "",
|
|
117
119
|
frequency: "",
|
|
118
120
|
max_mg_dose: "",
|
|
119
121
|
max_mg_day: "",
|
|
120
122
|
pedia_dosage: ""
|
|
121
|
-
},
|
|
123
|
+
}, g = {
|
|
122
124
|
multiplier: "",
|
|
123
125
|
dose_ml_kg: "",
|
|
124
126
|
frequency: "",
|
|
@@ -127,12 +129,13 @@ const o = [
|
|
|
127
129
|
pedia_dosage: ""
|
|
128
130
|
};
|
|
129
131
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
o as C_DefaultMgKgFields,
|
|
133
|
+
g as C_DefaultMlKgFields,
|
|
134
|
+
s as C_FrequencyDosageMap,
|
|
135
|
+
v as C_MedicineCalculatorList,
|
|
136
|
+
y as C_MedicineFrequencyList,
|
|
137
|
+
p as C_MedicineTypeList,
|
|
138
|
+
l as C_Table_Column_Name,
|
|
139
|
+
t as E_CalculationType,
|
|
140
|
+
a as E_MEDICINE_FREQUENCY
|
|
138
141
|
};
|
|
@@ -4,7 +4,14 @@ export declare const C_MedicineTypeList: {
|
|
|
4
4
|
type: string;
|
|
5
5
|
val: number;
|
|
6
6
|
}[];
|
|
7
|
-
export declare
|
|
7
|
+
export declare enum E_MEDICINE_FREQUENCY {
|
|
8
|
+
'1(OD)' = "1(OD)",
|
|
9
|
+
'2(BD)' = "2(BD)",
|
|
10
|
+
'3(TDS)' = "3(TDS)",
|
|
11
|
+
'4(QID)' = "4(QID)",
|
|
12
|
+
'6(Q4H)' = "6(Q4H)"
|
|
13
|
+
}
|
|
14
|
+
export declare const C_MedicineFrequencyList: E_MEDICINE_FREQUENCY[];
|
|
8
15
|
export declare const C_FrequencyDosageMap: Record<string, string[]>;
|
|
9
16
|
export declare enum E_CalculationType {
|
|
10
17
|
MgKgDose = "mg/kg/dose",
|
package/dist/index.js
CHANGED