@bahmni/widgets 0.0.1-dev.191 → 0.0.1-dev.192

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.
Files changed (32) hide show
  1. package/dist/{DocumentsTable-DjFKN-vZ.js → DocumentsTable-DBGR411T.js} +54 -54
  2. package/dist/FormsTable-BP08e4n9.js +423 -0
  3. package/dist/Observations-SiLS1rRQ.js +172 -0
  4. package/dist/appContext/AppContextProvider.d.ts +7 -0
  5. package/dist/appContext/AppContextProvider.d.ts.map +1 -0
  6. package/dist/appContext/index.d.ts +2 -0
  7. package/dist/appContext/index.d.ts.map +1 -0
  8. package/dist/appointments/AppointmentsTable.d.ts.map +1 -1
  9. package/dist/diagnoses/DiagnosesTable.d.ts.map +1 -1
  10. package/dist/documents/DocumentsTable.d.ts.map +1 -1
  11. package/dist/forms/FormsTable.d.ts.map +1 -1
  12. package/dist/forms/ObservationItem.d.ts.map +1 -1
  13. package/dist/genericServiceRequest/GenericServiceRequestTable.d.ts.map +1 -1
  14. package/dist/{index-HMYBr9oP.js → index-B0cIttpN.js} +19407 -20641
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +24 -23
  18. package/dist/labinvestigation/utils.d.ts.map +1 -1
  19. package/dist/medications/MedicationsTable.d.ts.map +1 -1
  20. package/dist/observations/utils.d.ts +2 -2
  21. package/dist/observations/utils.d.ts.map +1 -1
  22. package/dist/patientDetails/PatientDetails.d.ts.map +1 -1
  23. package/dist/patientPrograms/PatientProgramsTable.d.ts.map +1 -1
  24. package/dist/programDetails/ProgramDetails.d.ts.map +1 -1
  25. package/dist/radiologyInvestigation/RadiologyInvestigationTable.d.ts.map +1 -1
  26. package/dist/radiologyInvestigationReport/RadiologyInvestigationReport.d.ts.map +1 -1
  27. package/dist/searchPatient/strategies/AppointmentSearchStrategy.d.ts.map +1 -1
  28. package/dist/searchPatient/strategies/AttributeSearchStrategy.d.ts.map +1 -1
  29. package/dist/searchPatient/strategies/NameOrIdSearchStrategy.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/FormsTable-mzSugDHQ.js +0 -426
  32. package/dist/Observations-DsWnt3nO.js +0 -172
@@ -0,0 +1,172 @@
1
+ import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
+ import { j as k, k as S, t as q, J as M, l as V, r as Q, d as w, e as G, u as P, a as j, K as H, C as J, s as z, g as Y, m as W, p as X, q as Z, c as x } from "./index-B0cIttpN.js";
3
+ import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
+ import { useRef as se, useEffect as $, useMemo as h } from "react";
5
+ import { useTranslation as D } from "react-i18next";
6
+ const U = (t, c, i, l, r) => {
7
+ const s = q(t, c, r), o = s.value, a = M(o);
8
+ let n = o;
9
+ a === "Image" && (n = /* @__PURE__ */ d(Q, { imageSrc: o, alt: o, id: `${o}-img` })), a === "Video" && (n = /* @__PURE__ */ d(w, { id: `${o}-video`, videoSrc: o })), a === "PDF" && (n = /* @__PURE__ */ d(G, { id: `${o}-pdf`, src: o }));
10
+ const u = r("OBSERVATIONS_RECORDED_BY", {
11
+ provider: s.provider
12
+ }), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
13
+ return /* @__PURE__ */ d(
14
+ V,
15
+ {
16
+ header: s.header,
17
+ value: n,
18
+ info: u,
19
+ id: f,
20
+ testId: f,
21
+ ariaLabel: f
22
+ },
23
+ `obs-${t.id}`
24
+ );
25
+ }, oe = (t, c, i, l, r, s) => /* @__PURE__ */ d(
26
+ S,
27
+ {
28
+ title: t.display,
29
+ id: `grouped-obs-${t.display}-${l}`,
30
+ open: i,
31
+ children: t.members?.map(
32
+ (o, a) => U(o, a, r, s, c)
33
+ )
34
+ },
35
+ `grouped-obs-${t.id}`
36
+ ), re = ({
37
+ groupedData: t,
38
+ title: c = ""
39
+ }) => {
40
+ const { t: i } = D(), l = (r, s, o) => {
41
+ const a = k(r.encounterDetails, i);
42
+ return /* @__PURE__ */ N(
43
+ S,
44
+ {
45
+ title: a,
46
+ id: `encounter-${r.encounterId}`,
47
+ open: s,
48
+ children: [
49
+ r.observations.map(
50
+ (n, u) => U(n, u, o, c, i)
51
+ ),
52
+ r.groupedObservations.map(
53
+ (n, u) => oe(
54
+ n,
55
+ i,
56
+ s,
57
+ u,
58
+ o,
59
+ c
60
+ )
61
+ )
62
+ ]
63
+ },
64
+ `encounter-${r.encounterId}`
65
+ );
66
+ };
67
+ return /* @__PURE__ */ d(
68
+ "div",
69
+ {
70
+ id: "obs-by-encounter",
71
+ "data-testid": "obs-by-encounter-test-id",
72
+ "aria-label": "obs-by-encounter-aria-label",
73
+ children: t.map(
74
+ (r, s) => l(r, s === 0, s)
75
+ )
76
+ }
77
+ );
78
+ }, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12", C = {
79
+ observations: ae,
80
+ title: ne
81
+ }, ie = (t) => ["conceptUuid", t], ce = (t, c) => ["observations", t, ...c], me = ({ config: t }) => {
82
+ const c = t, { conceptNames: i = [], conceptUuid: l = [] } = c, r = se(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: a } = D(), n = ee({
83
+ queries: i.map((e) => ({
84
+ queryKey: ie(e),
85
+ queryFn: () => H(e),
86
+ enabled: !!e
87
+ }))
88
+ });
89
+ $(() => {
90
+ n.forEach((e, m) => {
91
+ if (e.isError && !r.current.has(m)) {
92
+ const O = i[m];
93
+ o({
94
+ title: a("ERROR_DEFAULT_TITLE"),
95
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: O }),
96
+ type: "error"
97
+ }), r.current.add(m);
98
+ } else e.isError || r.current.delete(m);
99
+ });
100
+ }, [n, i]);
101
+ const u = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), b = h(() => [.../* @__PURE__ */ new Set([...u, ...l])], [u, l]), v = h(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
102
+ data: p,
103
+ isLoading: f,
104
+ isError: g,
105
+ refetch: R
106
+ } = te({
107
+ queryKey: ce(s, b),
108
+ queryFn: () => J(s, b),
109
+ enabled: !!s && b.length > 0 && v
110
+ });
111
+ z(
112
+ (e) => {
113
+ e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
114
+ (O) => b.includes(O)
115
+ ) && R();
116
+ },
117
+ [s, R]
118
+ ), $(() => {
119
+ g && o({
120
+ title: a("ERROR_DEFAULT_TITLE"),
121
+ message: a("ERROR_FETCHING_OBSERVATIONS"),
122
+ type: "error"
123
+ });
124
+ }, [g]);
125
+ const T = h(() => {
126
+ if (!p) return [];
127
+ const e = Y(p), m = W(e);
128
+ return X(m);
129
+ }, [p]), B = [
130
+ { key: "name", header: "name" },
131
+ { key: "value", header: "value" },
132
+ { key: "form", header: "form" }
133
+ ], I = f || !v, _ = g && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? a("NO_OBSERVATIONS_FOUND") : void 0, K = T.length > 0 && !I && !_, E = c.titleTranslationKey, y = E ? a(E) : "";
134
+ return /* @__PURE__ */ N(
135
+ "div",
136
+ {
137
+ id: "observations",
138
+ "data-testid": E ? `observations-${y}` : "observations",
139
+ "aria-label": "observations-aria-label",
140
+ className: C.observations,
141
+ children: [
142
+ /* @__PURE__ */ d(
143
+ Z,
144
+ {
145
+ id: "observations-title",
146
+ testId: E ? `observations-title-${y}` : "observations-title",
147
+ title: y,
148
+ className: C.title,
149
+ children: /* @__PURE__ */ d("p", { children: y })
150
+ }
151
+ ),
152
+ K ? /* @__PURE__ */ d(re, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
+ x,
154
+ {
155
+ headers: B,
156
+ rows: [],
157
+ ariaLabel: a("OBSERVATIONS"),
158
+ loading: I,
159
+ errorStateMessage: F,
160
+ emptyStateMessage: L,
161
+ dataTestId: "observations-table"
162
+ }
163
+ )
164
+ ]
165
+ }
166
+ );
167
+ };
168
+ export {
169
+ ie as conceptUuidQueryKeys,
170
+ me as default,
171
+ ce as observationsQueryKeys
172
+ };
@@ -0,0 +1,7 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ interface AppContextProviderProps {
3
+ children: ReactNode;
4
+ }
5
+ export declare const AppContextProvider: React.FC<AppContextProviderProps>;
6
+ export {};
7
+ //# sourceMappingURL=AppContextProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppContextProvider.d.ts","sourceRoot":"","sources":["../../src/appContext/AppContextProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAEpD,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAWhE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { AppContextProvider } from './AppContextProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/appContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppointmentsTable.d.ts","sourceRoot":"","sources":["../../src/appointments/AppointmentsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwI5C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"AppointmentsTable.d.ts","sourceRoot":"","sources":["../../src/appointments/AppointmentsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhD,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4I5C,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosesTable.d.ts","sourceRoot":"","sources":["../../src/diagnoses/DiagnosesTable.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA8G3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DiagnosesTable.d.ts","sourceRoot":"","sources":["../../src/diagnoses/DiagnosesTable.tsx"],"names":[],"mappings":"AAUA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA6G3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsBhD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmOzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsBhD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmOzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+RrC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+RrC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ObservationItem.d.ts","sourceRoot":"","sources":["../../src/forms/ObservationItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,UAAU,oBAAoB;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAoKD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAmF1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ObservationItem.d.ts","sourceRoot":"","sources":["../../src/forms/ObservationItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAI9D,UAAU,oBAAoB;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA8JD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkF1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAkOrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6NrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}