@bahmni/widgets 0.0.1-dev.151 → 0.0.1-dev.152
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/FormsTable-BvLIP7_L.js +368 -0
- package/dist/Observations-DOJ5N4ZB.js +172 -0
- package/dist/forms/FormsTable.d.ts.map +1 -1
- package/dist/{index-42HVMUOV.js → index-CImzN7Zl.js} +1846 -1835
- package/dist/index.js +5 -5
- package/dist/observations/Observations.d.ts.map +1 -1
- package/dist/vitalFlowSheet/VitalFlowSheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/FormsTable-C5t7PeEU.js +0 -360
- package/dist/Observations-DYZ1p4Gs.js +0 -164
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Y as t, W as s, w as o, y as r, C as n, z as g, G as l, E as P, M as c, N as d, Q as v, P as T, I as b, K as W, B as m, R as p, S as A, U as f, F as u, a3 as C, a2 as R, $ as y, a0 as I, a1 as S, Z as U, a4 as D, X as N, m as h, u as w, T as x } from "./index-CImzN7Zl.js";
|
|
2
2
|
import "react";
|
|
3
3
|
export {
|
|
4
4
|
t as ActivePractitionerContext,
|
|
@@ -14,10 +14,10 @@ export {
|
|
|
14
14
|
v as NotificationServiceComponent,
|
|
15
15
|
T as PatientDetails,
|
|
16
16
|
b as PatientProgramsTable,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
W as ProgramDetails,
|
|
18
|
+
m as RadiologyInvestigationReport,
|
|
19
|
+
p as RadiologyInvestigationTable,
|
|
20
|
+
A as SearchPatient,
|
|
21
21
|
f as UserPrivilegeProvider,
|
|
22
22
|
u as VitalFlowSheet,
|
|
23
23
|
C as getAllWidgetConfigs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Observations.d.ts","sourceRoot":"","sources":["../../src/observations/Observations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Observations.d.ts","sourceRoot":"","sources":["../../src/observations/Observations.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,qCACjB,CAAC;AAExC,eAAO,MAAM,qBAAqB,GAChC,aAAa,MAAM,EACnB,cAAc,MAAM,EAAE,mDACoC,CAAC;AAE7D,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2JvC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VitalFlowSheet.d.ts","sourceRoot":"","sources":["../../src/vitalFlowSheet/VitalFlowSheet.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VitalFlowSheet.d.ts","sourceRoot":"","sources":["../../src/vitalFlowSheet/VitalFlowSheet.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAcvC,UAAU,oBAAoB;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AA0BD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgPjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import { jsxs as b, jsx as a, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { c as L, u as W, o as X, h as Z, f as ee, p as te, a as re, g as oe, b as ae, J as U, L as se, H as ne, d as de, t as ce, e as q, l as le } from "./index-42HVMUOV.js";
|
|
3
|
-
import { useQuery as y } from "@tanstack/react-query";
|
|
4
|
-
import { useState as H, useMemo as g, useCallback as M } from "react";
|
|
5
|
-
import { useTranslation as me } from "react-i18next";
|
|
6
|
-
const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", _e = "_observation_1pd36_30", fe = "_groupContainer_1pd36_39", ge = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", he = "_rowValue_1pd36_67", ye = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Le = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Te = "_abnormalValue_1pd36_102", Ae = "_commentSection_1pd36_110", Oe = "_commentText_1pd36_116", Re = "_nestedGroup_1pd36_125", we = "_nestedGroupLabel_1pd36_132", Ce = "_nestedGroupMembers_1pd36_141", o = {
|
|
7
|
-
formsTableBody: ie,
|
|
8
|
-
customAccordianItem: ue,
|
|
9
|
-
formContent: pe,
|
|
10
|
-
formDetailsContainer: be,
|
|
11
|
-
observation: _e,
|
|
12
|
-
groupContainer: fe,
|
|
13
|
-
rowContainer: ge,
|
|
14
|
-
groupLabel: Ne,
|
|
15
|
-
rowLabel: $e,
|
|
16
|
-
rowValue: he,
|
|
17
|
-
groupMembers: ye,
|
|
18
|
-
memberRow: Me,
|
|
19
|
-
memberLabel: Le,
|
|
20
|
-
memberValue: De,
|
|
21
|
-
abnormalValue: Te,
|
|
22
|
-
commentSection: Ae,
|
|
23
|
-
commentText: Oe,
|
|
24
|
-
nestedGroup: Re,
|
|
25
|
-
nestedGroupLabel: we,
|
|
26
|
-
nestedGroupMembers: Ce
|
|
27
|
-
}, Fe = "ABNORMAL", k = (e) => {
|
|
28
|
-
const s = e.concept?.units, c = e.concept?.lowNormal, t = e.concept?.hiNormal, u = c != null, n = t != null, l = u && n ? ` (${c} - ${t})` : u ? ` (>${c})` : n ? ` (<${t})` : "", r = e.interpretation && e.interpretation.toUpperCase() === Fe;
|
|
29
|
-
return { units: s, rangeString: l, isAbnormal: r };
|
|
30
|
-
}, P = ({
|
|
31
|
-
member: e,
|
|
32
|
-
depth: s = 0,
|
|
33
|
-
memberIndex: c = 0,
|
|
34
|
-
formName: t = ""
|
|
35
|
-
}) => {
|
|
36
|
-
const u = e.groupMembers && e.groupMembers.length > 0, n = e.conceptNameToDisplay ?? e.concept?.shortName ?? e.concept?.name, l = t ? `${t}-` : "";
|
|
37
|
-
if (u)
|
|
38
|
-
return /* @__PURE__ */ b(
|
|
39
|
-
"div",
|
|
40
|
-
{
|
|
41
|
-
className: o.nestedGroup,
|
|
42
|
-
"data-testid": `${l}obs-nested-group-${n}-${c}`,
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ a(
|
|
45
|
-
"div",
|
|
46
|
-
{
|
|
47
|
-
className: o.nestedGroupLabel,
|
|
48
|
-
"data-testid": `${l}obs-nested-group-label-${n}-${c}`,
|
|
49
|
-
style: { paddingLeft: `${s * 16}px` },
|
|
50
|
-
children: n
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ a(
|
|
54
|
-
"div",
|
|
55
|
-
{
|
|
56
|
-
className: o.nestedGroupMembers,
|
|
57
|
-
"data-testid": `${l}obs-nested-group-members-${n}-${c}`,
|
|
58
|
-
children: e.groupMembers?.map((N, $) => /* @__PURE__ */ a(
|
|
59
|
-
P,
|
|
60
|
-
{
|
|
61
|
-
member: N,
|
|
62
|
-
depth: s + 1,
|
|
63
|
-
memberIndex: $,
|
|
64
|
-
formName: t
|
|
65
|
-
},
|
|
66
|
-
`${N.concept.uuid}`
|
|
67
|
-
))
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
const { units: r, rangeString: _, isAbnormal: f } = k(e);
|
|
74
|
-
return /* @__PURE__ */ b(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: o.memberRow,
|
|
78
|
-
"data-testid": `${l}obs-member-row-${n}-${c}`,
|
|
79
|
-
style: { paddingLeft: `${s * 16}px` },
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ b(
|
|
82
|
-
"p",
|
|
83
|
-
{
|
|
84
|
-
className: L(
|
|
85
|
-
o.memberLabel,
|
|
86
|
-
f ? o.abnormalValue : ""
|
|
87
|
-
),
|
|
88
|
-
"data-testid": `${l}obs-member-label-${n}-${c}`,
|
|
89
|
-
children: [
|
|
90
|
-
n,
|
|
91
|
-
_
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ b(
|
|
96
|
-
"p",
|
|
97
|
-
{
|
|
98
|
-
className: L(
|
|
99
|
-
o.memberValue,
|
|
100
|
-
f ? o.abnormalValue : ""
|
|
101
|
-
),
|
|
102
|
-
"data-testid": `${l}obs-member-value-${n}-${c}`,
|
|
103
|
-
children: [
|
|
104
|
-
e.valueAsString,
|
|
105
|
-
r && ` ${r}`
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
)
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
}, ve = ({
|
|
113
|
-
observation: e,
|
|
114
|
-
index: s,
|
|
115
|
-
formName: c = ""
|
|
116
|
-
}) => {
|
|
117
|
-
const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = k(e), r = c ? `${c}-` : "";
|
|
118
|
-
return /* @__PURE__ */ b(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
className: o.observation,
|
|
122
|
-
"data-testid": `${r}observation-item-${e.conceptNameToDisplay}-${s}`,
|
|
123
|
-
children: [
|
|
124
|
-
/* @__PURE__ */ b(
|
|
125
|
-
"div",
|
|
126
|
-
{
|
|
127
|
-
className: t ? o.groupContainer : o.rowContainer,
|
|
128
|
-
"data-testid": `${r}observation-container-${e.conceptNameToDisplay}-${s}`,
|
|
129
|
-
children: [
|
|
130
|
-
/* @__PURE__ */ b(
|
|
131
|
-
"p",
|
|
132
|
-
{
|
|
133
|
-
className: L(
|
|
134
|
-
t ? o.groupLabel : o.rowLabel,
|
|
135
|
-
!t && l ? o.abnormalValue : ""
|
|
136
|
-
),
|
|
137
|
-
"data-testid": `${r}observation-label-${e.conceptNameToDisplay}-${s}`,
|
|
138
|
-
children: [
|
|
139
|
-
e.conceptNameToDisplay,
|
|
140
|
-
!t && n && /* @__PURE__ */ a("span", { className: o.rangeInfo, children: n })
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
t ? /* @__PURE__ */ a(
|
|
145
|
-
"div",
|
|
146
|
-
{
|
|
147
|
-
className: o.groupMembers,
|
|
148
|
-
"data-testid": `${r}observation-group-members-${e.conceptNameToDisplay}-${s}`,
|
|
149
|
-
children: e.groupMembers?.map((_, f) => /* @__PURE__ */ a(
|
|
150
|
-
P,
|
|
151
|
-
{
|
|
152
|
-
member: _,
|
|
153
|
-
depth: 0,
|
|
154
|
-
memberIndex: f,
|
|
155
|
-
formName: c
|
|
156
|
-
},
|
|
157
|
-
`${_.concept.uuid}`
|
|
158
|
-
))
|
|
159
|
-
}
|
|
160
|
-
) : /* @__PURE__ */ b(
|
|
161
|
-
"p",
|
|
162
|
-
{
|
|
163
|
-
className: L(
|
|
164
|
-
o.rowValue,
|
|
165
|
-
l ? o.abnormalValue : ""
|
|
166
|
-
),
|
|
167
|
-
"data-testid": `${r}observation-value-${e.conceptNameToDisplay}-${s}`,
|
|
168
|
-
children: [
|
|
169
|
-
e.valueAsString,
|
|
170
|
-
u && ` ${u}`
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
|
-
)
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
),
|
|
177
|
-
e.comment && /* @__PURE__ */ a(
|
|
178
|
-
"div",
|
|
179
|
-
{
|
|
180
|
-
className: o.commentSection,
|
|
181
|
-
"data-testid": `${r}observation-comment-${e.conceptNameToDisplay}-${s}`,
|
|
182
|
-
children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
|
|
183
|
-
e.comment,
|
|
184
|
-
e.providers?.[0]?.name && ` - by ${e.providers[0].name}`
|
|
185
|
-
] })
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
]
|
|
189
|
-
},
|
|
190
|
-
`${e.concept.uuid}-${s}`
|
|
191
|
-
);
|
|
192
|
-
}, Ue = ({
|
|
193
|
-
episodeOfCareUuids: e,
|
|
194
|
-
encounterUuids: s,
|
|
195
|
-
config: c
|
|
196
|
-
}) => {
|
|
197
|
-
const { t } = me(), u = W(), [n, l] = H(!1), [r, _] = H(null), f = c?.numberOfVisits, N = X(
|
|
198
|
-
e,
|
|
199
|
-
s
|
|
200
|
-
), {
|
|
201
|
-
data: $ = [],
|
|
202
|
-
isLoading: O,
|
|
203
|
-
isError: R,
|
|
204
|
-
error: j
|
|
205
|
-
} = y({
|
|
206
|
-
queryKey: ["forms", u, e],
|
|
207
|
-
queryFn: () => Z(u, void 0, f),
|
|
208
|
-
enabled: !!u && !N
|
|
209
|
-
}), w = g(() => !s || s.length === 0 ? $ : $.filter(
|
|
210
|
-
(d) => s.includes(d.encounterUuid)
|
|
211
|
-
), [$, s]), { data: C = [] } = y({
|
|
212
|
-
queryKey: ["observationForms"],
|
|
213
|
-
queryFn: () => ee()
|
|
214
|
-
}), F = M(
|
|
215
|
-
(d) => C.find((m) => m.name === d)?.uuid,
|
|
216
|
-
[C]
|
|
217
|
-
), D = g(() => {
|
|
218
|
-
if (r)
|
|
219
|
-
return F(r.formName);
|
|
220
|
-
}, [r, F]), {
|
|
221
|
-
data: Ee,
|
|
222
|
-
isLoading: K,
|
|
223
|
-
error: v
|
|
224
|
-
} = y({
|
|
225
|
-
queryKey: ["formMetadata", D],
|
|
226
|
-
queryFn: () => te(D),
|
|
227
|
-
enabled: !!D && n
|
|
228
|
-
}), {
|
|
229
|
-
data: T,
|
|
230
|
-
isLoading: J,
|
|
231
|
-
error: E
|
|
232
|
-
} = y({
|
|
233
|
-
queryKey: ["formsEncounter", r?.encounterUuid],
|
|
234
|
-
queryFn: () => re(r.encounterUuid, !0),
|
|
235
|
-
enabled: !!r?.encounterUuid && n
|
|
236
|
-
}), I = g(() => !T?.observations || !r?.formName ? [] : T.observations.filter(
|
|
237
|
-
(p) => "formFieldPath" in p && typeof p.formFieldPath == "string" && p.formFieldPath.includes(r.formName)
|
|
238
|
-
), [T?.observations, r?.formName]), B = g(
|
|
239
|
-
() => [
|
|
240
|
-
{ key: "recordedOn", header: t("FORM_RECORDED_ON") },
|
|
241
|
-
{ key: "recordedBy", header: t("FORM_RECORDED_BY") }
|
|
242
|
-
],
|
|
243
|
-
[t]
|
|
244
|
-
), x = g(
|
|
245
|
-
() => [
|
|
246
|
-
{ key: "recordedOn", sortable: !0 },
|
|
247
|
-
{ key: "recordedBy", sortable: !0 }
|
|
248
|
-
],
|
|
249
|
-
[]
|
|
250
|
-
), V = g(() => {
|
|
251
|
-
const d = w.reduce(
|
|
252
|
-
(m, i) => {
|
|
253
|
-
const h = i.formName;
|
|
254
|
-
m[h] ??= [];
|
|
255
|
-
const A = i.providers.map((Q) => Q.providerName).filter(Boolean).join(", ");
|
|
256
|
-
return m[h].push({
|
|
257
|
-
id: i.encounterUuid,
|
|
258
|
-
formName: i.formName,
|
|
259
|
-
recordedOn: oe(i.encounterDateTime, t, le).formattedResult,
|
|
260
|
-
recordedBy: A ?? "--",
|
|
261
|
-
encounterDateTime: i.encounterDateTime,
|
|
262
|
-
encounterUuid: i.encounterUuid
|
|
263
|
-
}), m;
|
|
264
|
-
},
|
|
265
|
-
{}
|
|
266
|
-
);
|
|
267
|
-
return Object.entries(d).map(
|
|
268
|
-
([m, i]) => ({
|
|
269
|
-
formName: m,
|
|
270
|
-
records: i.sort(
|
|
271
|
-
(h, A) => A.encounterDateTime - h.encounterDateTime
|
|
272
|
-
)
|
|
273
|
-
})
|
|
274
|
-
).sort((m, i) => m.formName.localeCompare(i.formName));
|
|
275
|
-
}, [w, t]), S = M((d) => {
|
|
276
|
-
_(d), l(!0);
|
|
277
|
-
}, []), z = M(() => {
|
|
278
|
-
l(!1), _(null);
|
|
279
|
-
}, []), G = M(
|
|
280
|
-
(d, p) => {
|
|
281
|
-
switch (p) {
|
|
282
|
-
case "recordedOn":
|
|
283
|
-
return /* @__PURE__ */ a(ae, { onClick: () => S(d), children: d.recordedOn });
|
|
284
|
-
case "recordedBy":
|
|
285
|
-
return d.recordedBy;
|
|
286
|
-
default:
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
[S]
|
|
291
|
-
);
|
|
292
|
-
return /* @__PURE__ */ b(Y, { children: [
|
|
293
|
-
/* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R || V.length === 0 || N ? /* @__PURE__ */ a(
|
|
294
|
-
U,
|
|
295
|
-
{
|
|
296
|
-
headers: B,
|
|
297
|
-
ariaLabel: t("FORMS_HEADING"),
|
|
298
|
-
rows: [],
|
|
299
|
-
loading: O,
|
|
300
|
-
errorStateMessage: R ? j?.message : void 0,
|
|
301
|
-
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
302
|
-
renderCell: G,
|
|
303
|
-
className: o.formsTableBody,
|
|
304
|
-
dataTestId: "forms-table"
|
|
305
|
-
}
|
|
306
|
-
) : /* @__PURE__ */ a(se, { align: "start", children: V.map((d, p) => {
|
|
307
|
-
const { formName: m, records: i } = d;
|
|
308
|
-
return /* @__PURE__ */ a(
|
|
309
|
-
ne,
|
|
310
|
-
{
|
|
311
|
-
title: m,
|
|
312
|
-
className: o.customAccordianItem,
|
|
313
|
-
testId: `accordian-title-${m}`,
|
|
314
|
-
open: p === 0,
|
|
315
|
-
children: /* @__PURE__ */ a(
|
|
316
|
-
U,
|
|
317
|
-
{
|
|
318
|
-
headers: B,
|
|
319
|
-
ariaLabel: t("FORMS_HEADING"),
|
|
320
|
-
rows: i,
|
|
321
|
-
loading: !1,
|
|
322
|
-
errorStateMessage: "",
|
|
323
|
-
sortable: x,
|
|
324
|
-
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
325
|
-
renderCell: G,
|
|
326
|
-
className: o.formsTableBody,
|
|
327
|
-
dataTestId: `forms-table-${m}`
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
},
|
|
331
|
-
m
|
|
332
|
-
);
|
|
333
|
-
}) }) }),
|
|
334
|
-
n && r && /* @__PURE__ */ a(
|
|
335
|
-
de,
|
|
336
|
-
{
|
|
337
|
-
id: "modalIdForActionAreaLayout",
|
|
338
|
-
open: n,
|
|
339
|
-
onRequestClose: z,
|
|
340
|
-
modalHeading: r.formName,
|
|
341
|
-
modalLabel: `${r.recordedOn} | ${r.recordedBy}`,
|
|
342
|
-
passiveModal: !0,
|
|
343
|
-
size: "md",
|
|
344
|
-
testId: "form-details-modal",
|
|
345
|
-
children: /* @__PURE__ */ a("div", { className: o.formContent, children: K || J ? /* @__PURE__ */ a(ce, { width: "100%", lineCount: 3 }) : v ? /* @__PURE__ */ a("div", { children: q(v).message ?? t("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ a("div", { children: q(E).message ?? t("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: I.map((d, p) => /* @__PURE__ */ a(
|
|
346
|
-
ve,
|
|
347
|
-
{
|
|
348
|
-
observation: d,
|
|
349
|
-
index: p,
|
|
350
|
-
formName: r.formName
|
|
351
|
-
},
|
|
352
|
-
`${d.concept.uuid}`
|
|
353
|
-
)) }) : /* @__PURE__ */ a("div", { children: t("NO_FORM_DATA_AVAILABLE") }) })
|
|
354
|
-
}
|
|
355
|
-
)
|
|
356
|
-
] });
|
|
357
|
-
};
|
|
358
|
-
export {
|
|
359
|
-
Ue as default
|
|
360
|
-
};
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { jsx as d, jsxs as $ } from "react/jsx-runtime";
|
|
2
|
-
import { i as V, V as N, j as q, D as k, _ as w, x as K, k as Q, u as M, m as G, n as j, r as H, q as P, s as J, v as Y, O as x, J as z } from "./index-42HVMUOV.js";
|
|
3
|
-
import { useQueries as W, useQuery as X } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as Z, useEffect as _, useMemo as O } from "react";
|
|
5
|
-
import { useTranslation as S } from "react-i18next";
|
|
6
|
-
const D = (e, c, a, l, t) => {
|
|
7
|
-
const s = q(e, c), o = s.value, r = k(o);
|
|
8
|
-
let n = o;
|
|
9
|
-
r === "Image" && (n = /* @__PURE__ */ d(K, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ d(Q, { id: `${o}-video`, videoSrc: o }));
|
|
10
|
-
const u = t("OBSERVATIONS_RECORDED_BY", {
|
|
11
|
-
provider: s.provider
|
|
12
|
-
}), m = e.display, b = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${b}-${m}-${a}-${c}` : `${b}-${m}-${a}-${c}`;
|
|
13
|
-
return /* @__PURE__ */ d(
|
|
14
|
-
w,
|
|
15
|
-
{
|
|
16
|
-
header: s.header,
|
|
17
|
-
value: n,
|
|
18
|
-
info: u,
|
|
19
|
-
id: y,
|
|
20
|
-
testId: y,
|
|
21
|
-
ariaLabel: y
|
|
22
|
-
},
|
|
23
|
-
`obs-${e.id}`
|
|
24
|
-
);
|
|
25
|
-
}, ee = (e, c, a, l, t, s) => /* @__PURE__ */ d(
|
|
26
|
-
N,
|
|
27
|
-
{
|
|
28
|
-
title: e.display,
|
|
29
|
-
id: `grouped-obs-${e.display}-${l}`,
|
|
30
|
-
open: a,
|
|
31
|
-
children: e.members?.map(
|
|
32
|
-
(o, r) => D(o, r, t, s, c)
|
|
33
|
-
)
|
|
34
|
-
},
|
|
35
|
-
`grouped-obs-${e.id}`
|
|
36
|
-
), te = ({
|
|
37
|
-
groupedData: e,
|
|
38
|
-
title: c = ""
|
|
39
|
-
}) => {
|
|
40
|
-
const { t: a } = S(), l = (t, s, o) => {
|
|
41
|
-
const r = V(t.encounterDetails, a);
|
|
42
|
-
return /* @__PURE__ */ $(
|
|
43
|
-
N,
|
|
44
|
-
{
|
|
45
|
-
title: r,
|
|
46
|
-
id: `encounter-${t.encounterId}`,
|
|
47
|
-
open: s,
|
|
48
|
-
children: [
|
|
49
|
-
t.observations.map(
|
|
50
|
-
(n, u) => D(n, u, o, c, a)
|
|
51
|
-
),
|
|
52
|
-
t.groupedObservations.map(
|
|
53
|
-
(n, u) => ee(
|
|
54
|
-
n,
|
|
55
|
-
a,
|
|
56
|
-
s,
|
|
57
|
-
u,
|
|
58
|
-
o,
|
|
59
|
-
c
|
|
60
|
-
)
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
`encounter-${t.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: e.map(
|
|
74
|
-
(t, s) => l(t, s === 0, s)
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}, se = "_observations_kfbhq_1", oe = "_title_kfbhq_12", I = {
|
|
79
|
-
observations: se,
|
|
80
|
-
title: oe
|
|
81
|
-
}, re = (e) => ["conceptUuid", e], ae = (e, c) => ["observations", e, ...c], ue = ({ config: e }) => {
|
|
82
|
-
const c = e, { conceptNames: a = [], conceptUuid: l = [] } = c, t = Z(/* @__PURE__ */ new Set()), s = M(), { addNotification: o } = G(), { t: r } = S(), n = W({
|
|
83
|
-
queries: a.map((i) => ({
|
|
84
|
-
queryKey: re(i),
|
|
85
|
-
queryFn: () => j(i),
|
|
86
|
-
enabled: !!i
|
|
87
|
-
}))
|
|
88
|
-
});
|
|
89
|
-
_(() => {
|
|
90
|
-
n.forEach((i, v) => {
|
|
91
|
-
if (i.isError && !t.current.has(v)) {
|
|
92
|
-
const L = a[v];
|
|
93
|
-
o({
|
|
94
|
-
title: r("ERROR_DEFAULT_TITLE"),
|
|
95
|
-
message: r("ERROR_FETCHING_CONCEPT", { conceptName: L }),
|
|
96
|
-
type: "error"
|
|
97
|
-
}), t.current.add(v);
|
|
98
|
-
} else i.isError || t.current.delete(v);
|
|
99
|
-
});
|
|
100
|
-
}, [n, a]);
|
|
101
|
-
const u = O(() => n.map((i) => i.data?.uuid).filter((i) => !!i), [n]), m = O(() => [.../* @__PURE__ */ new Set([...u, ...l])], [u, l]), p = O(() => a.length === 0 ? !0 : n.every((i) => !i.isLoading), [n, a.length]), {
|
|
102
|
-
data: b,
|
|
103
|
-
isLoading: y,
|
|
104
|
-
isError: h
|
|
105
|
-
} = X({
|
|
106
|
-
queryKey: ae(s, m),
|
|
107
|
-
queryFn: () => H(s, m),
|
|
108
|
-
enabled: !!s && m.length > 0 && p
|
|
109
|
-
});
|
|
110
|
-
_(() => {
|
|
111
|
-
h && o({
|
|
112
|
-
title: r("ERROR_DEFAULT_TITLE"),
|
|
113
|
-
message: r("ERROR_FETCHING_OBSERVATIONS"),
|
|
114
|
-
type: "error"
|
|
115
|
-
});
|
|
116
|
-
}, [h]);
|
|
117
|
-
const g = O(() => {
|
|
118
|
-
if (!b) return [];
|
|
119
|
-
const i = P(b), v = J(i);
|
|
120
|
-
return Y(v);
|
|
121
|
-
}, [b]), U = [
|
|
122
|
-
{ key: "name", header: "name" },
|
|
123
|
-
{ key: "value", header: "value" },
|
|
124
|
-
{ key: "form", header: "form" }
|
|
125
|
-
], R = y || !p, T = h && p, B = (!b || b.entry?.length === 0 || m.length === 0) && p, C = T ? r("ERROR_FETCHING_OBSERVATIONS") : null, A = B ? r("NO_OBSERVATIONS_FOUND") : void 0, F = g.length > 0 && !R && !T, f = c.titleTranslationKey, E = f ? r(f) : "";
|
|
126
|
-
return /* @__PURE__ */ $(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
id: "observations",
|
|
130
|
-
"data-testid": f ? `observations-${E}` : "observations",
|
|
131
|
-
"aria-label": "observations-aria-label",
|
|
132
|
-
className: I.observations,
|
|
133
|
-
children: [
|
|
134
|
-
/* @__PURE__ */ d(
|
|
135
|
-
x,
|
|
136
|
-
{
|
|
137
|
-
id: "observations-title",
|
|
138
|
-
testId: f ? `observations-title-${E}` : "observations-title",
|
|
139
|
-
title: E,
|
|
140
|
-
className: I.title,
|
|
141
|
-
children: /* @__PURE__ */ d("p", { children: E })
|
|
142
|
-
}
|
|
143
|
-
),
|
|
144
|
-
F ? /* @__PURE__ */ d(te, { groupedData: g, title: E }) : /* @__PURE__ */ d(
|
|
145
|
-
z,
|
|
146
|
-
{
|
|
147
|
-
headers: U,
|
|
148
|
-
rows: [],
|
|
149
|
-
ariaLabel: r("OBSERVATIONS"),
|
|
150
|
-
loading: R,
|
|
151
|
-
errorStateMessage: C,
|
|
152
|
-
emptyStateMessage: A,
|
|
153
|
-
dataTestId: "observations-table"
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
};
|
|
160
|
-
export {
|
|
161
|
-
re as conceptUuidQueryKeys,
|
|
162
|
-
ue as default,
|
|
163
|
-
ae as observationsQueryKeys
|
|
164
|
-
};
|