@bahmni/widgets 0.0.1-dev.180 → 0.0.1-dev.182
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/{DocumentsTable-BzmQHWFJ.js → DocumentsTable-LWSWpNu-.js} +1 -1
- package/dist/{FormsTable-CnE2r-gc.js → FormsTable-yGF0uRTn.js} +150 -150
- package/dist/Observations-lSueidDj.js +172 -0
- package/dist/forms/ObservationItem.d.ts.map +1 -1
- package/dist/{index-CQhvLeWL.js → index-ByTTSt4p.js} +20105 -17529
- package/dist/index.css +1 -1
- package/dist/index.js +14 -14
- package/dist/observations/components/ObsByEncounter.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/Observations-BcE6RCUS.js +0 -172
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as l, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { g as q, h as C, t as Q, Q as w, j as M, G as V, b as k, Y as G, u as P, a as j, q as H, R as Y, K as z, e as J, l as W, s as X, m as Z, E as x } from "./index-ByTTSt4p.js";
|
|
3
|
+
import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as se, useEffect as $, useMemo as E } from "react";
|
|
5
|
+
import { useTranslation as D } from "react-i18next";
|
|
6
|
+
const U = (t, c, i, d, a) => {
|
|
7
|
+
const s = Q(t, c), o = s.value, r = w(o);
|
|
8
|
+
let n = o;
|
|
9
|
+
r === "Image" && (n = /* @__PURE__ */ l(V, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ l(k, { id: `${o}-video`, videoSrc: o })), r === "PDF" && (n = /* @__PURE__ */ l(G, { id: `${o}-pdf`, src: o }));
|
|
10
|
+
const u = a("OBSERVATIONS_RECORDED_BY", {
|
|
11
|
+
provider: s.provider
|
|
12
|
+
}), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", h = d ? `${d}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
|
|
13
|
+
return /* @__PURE__ */ l(
|
|
14
|
+
M,
|
|
15
|
+
{
|
|
16
|
+
header: s.header,
|
|
17
|
+
value: n,
|
|
18
|
+
info: u,
|
|
19
|
+
id: h,
|
|
20
|
+
testId: h,
|
|
21
|
+
ariaLabel: h
|
|
22
|
+
},
|
|
23
|
+
`obs-${t.id}`
|
|
24
|
+
);
|
|
25
|
+
}, oe = (t, c, i, d, a, s) => /* @__PURE__ */ l(
|
|
26
|
+
C,
|
|
27
|
+
{
|
|
28
|
+
title: t.display,
|
|
29
|
+
id: `grouped-obs-${t.display}-${d}`,
|
|
30
|
+
open: i,
|
|
31
|
+
children: t.members?.map(
|
|
32
|
+
(o, r) => U(o, r, a, s, c)
|
|
33
|
+
)
|
|
34
|
+
},
|
|
35
|
+
`grouped-obs-${t.id}`
|
|
36
|
+
), re = ({
|
|
37
|
+
groupedData: t,
|
|
38
|
+
title: c = ""
|
|
39
|
+
}) => {
|
|
40
|
+
const { t: i } = D(), d = (a, s, o) => {
|
|
41
|
+
const r = q(a.encounterDetails, i);
|
|
42
|
+
return /* @__PURE__ */ S(
|
|
43
|
+
C,
|
|
44
|
+
{
|
|
45
|
+
title: r,
|
|
46
|
+
id: `encounter-${a.encounterId}`,
|
|
47
|
+
open: s,
|
|
48
|
+
children: [
|
|
49
|
+
a.observations.map(
|
|
50
|
+
(n, u) => U(n, u, o, c, i)
|
|
51
|
+
),
|
|
52
|
+
a.groupedObservations.map(
|
|
53
|
+
(n, u) => oe(
|
|
54
|
+
n,
|
|
55
|
+
i,
|
|
56
|
+
s,
|
|
57
|
+
u,
|
|
58
|
+
o,
|
|
59
|
+
c
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
`encounter-${a.encounterId}`
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
return /* @__PURE__ */ l(
|
|
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
|
+
(a, s) => d(a, s === 0, s)
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
|
|
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: d = [] } = c, a = se(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: r } = 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 && !a.current.has(m)) {
|
|
92
|
+
const g = i[m];
|
|
93
|
+
o({
|
|
94
|
+
title: r("ERROR_DEFAULT_TITLE"),
|
|
95
|
+
message: r("ERROR_FETCHING_CONCEPT", { conceptName: g }),
|
|
96
|
+
type: "error"
|
|
97
|
+
}), a.current.add(m);
|
|
98
|
+
} else e.isError || a.current.delete(m);
|
|
99
|
+
});
|
|
100
|
+
}, [n, i]);
|
|
101
|
+
const u = E(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), b = E(() => [.../* @__PURE__ */ new Set([...u, ...d])], [u, d]), v = E(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
|
|
102
|
+
data: p,
|
|
103
|
+
isLoading: h,
|
|
104
|
+
isError: O,
|
|
105
|
+
refetch: R
|
|
106
|
+
} = te({
|
|
107
|
+
queryKey: ce(s, b),
|
|
108
|
+
queryFn: () => Y(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
|
+
(g) => b.includes(g)
|
|
115
|
+
) && R();
|
|
116
|
+
},
|
|
117
|
+
[s, R]
|
|
118
|
+
), $(() => {
|
|
119
|
+
O && o({
|
|
120
|
+
title: r("ERROR_DEFAULT_TITLE"),
|
|
121
|
+
message: r("ERROR_FETCHING_OBSERVATIONS"),
|
|
122
|
+
type: "error"
|
|
123
|
+
});
|
|
124
|
+
}, [O]);
|
|
125
|
+
const T = E(() => {
|
|
126
|
+
if (!p) return [];
|
|
127
|
+
const e = J(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 = h || !v, _ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, K = A ? r("NO_OBSERVATIONS_FOUND") : void 0, L = T.length > 0 && !I && !_, y = c.titleTranslationKey, f = y ? r(y) : "";
|
|
134
|
+
return /* @__PURE__ */ S(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
id: "observations",
|
|
138
|
+
"data-testid": y ? `observations-${f}` : "observations",
|
|
139
|
+
"aria-label": "observations-aria-label",
|
|
140
|
+
className: N.observations,
|
|
141
|
+
children: [
|
|
142
|
+
/* @__PURE__ */ l(
|
|
143
|
+
Z,
|
|
144
|
+
{
|
|
145
|
+
id: "observations-title",
|
|
146
|
+
testId: y ? `observations-title-${f}` : "observations-title",
|
|
147
|
+
title: f,
|
|
148
|
+
className: N.title,
|
|
149
|
+
children: /* @__PURE__ */ l("p", { children: f })
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
L ? /* @__PURE__ */ l(re, { groupedData: T, title: f }) : /* @__PURE__ */ l(
|
|
153
|
+
x,
|
|
154
|
+
{
|
|
155
|
+
headers: B,
|
|
156
|
+
rows: [],
|
|
157
|
+
ariaLabel: r("OBSERVATIONS"),
|
|
158
|
+
loading: I,
|
|
159
|
+
errorStateMessage: F,
|
|
160
|
+
emptyStateMessage: K,
|
|
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
|
+
};
|
|
@@ -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;
|
|
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"}
|