@bahmni/widgets 0.0.1-dev.141 → 0.0.1-dev.142
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as b, jsx as a, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { c as L, u as J,
|
|
2
|
+
import { c as L, u as J, Q as W, o as Z, s as ee, a as te, X as re, l as oe, b as ae, K as U, g as se, M as ne, p as ce, d as de, e as q, f as le } from "./index-CJY_nv9v.js";
|
|
3
3
|
import { useQuery as y } from "@tanstack/react-query";
|
|
4
4
|
import { useState as k, useMemo as g, useCallback as M } from "react";
|
|
5
5
|
import { useTranslation as me } from "react-i18next";
|
|
@@ -24,10 +24,10 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
24
24
|
nestedGroup: Re,
|
|
25
25
|
nestedGroupLabel: Ce,
|
|
26
26
|
nestedGroupMembers: Fe
|
|
27
|
-
}, ve = "ABNORMAL",
|
|
27
|
+
}, ve = "ABNORMAL", P = (e) => {
|
|
28
28
|
const s = e.concept?.units, d = e.concept?.lowNormal, t = e.concept?.hiNormal, u = d != null, n = t != null, l = u && n ? ` (${d} - ${t})` : u ? ` (>${d})` : n ? ` (<${t})` : "", r = e.interpretation && e.interpretation.toUpperCase() === ve;
|
|
29
29
|
return { units: s, rangeString: l, isAbnormal: r };
|
|
30
|
-
},
|
|
30
|
+
}, H = ({
|
|
31
31
|
member: e,
|
|
32
32
|
depth: s = 0,
|
|
33
33
|
memberIndex: d = 0,
|
|
@@ -56,7 +56,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
56
56
|
className: o.nestedGroupMembers,
|
|
57
57
|
"data-testid": `${l}obs-nested-group-members-${n}-${d}`,
|
|
58
58
|
children: e.groupMembers?.map((N, $) => /* @__PURE__ */ a(
|
|
59
|
-
|
|
59
|
+
H,
|
|
60
60
|
{
|
|
61
61
|
member: N,
|
|
62
62
|
depth: s + 1,
|
|
@@ -70,7 +70,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
70
70
|
]
|
|
71
71
|
}
|
|
72
72
|
);
|
|
73
|
-
const { units: r, rangeString: _, isAbnormal: f } =
|
|
73
|
+
const { units: r, rangeString: _, isAbnormal: f } = P(e);
|
|
74
74
|
return /* @__PURE__ */ b(
|
|
75
75
|
"div",
|
|
76
76
|
{
|
|
@@ -114,7 +114,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
114
114
|
index: s,
|
|
115
115
|
formName: d = ""
|
|
116
116
|
}) => {
|
|
117
|
-
const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } =
|
|
117
|
+
const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = P(e), r = d ? `${d}-` : "";
|
|
118
118
|
return /* @__PURE__ */ b(
|
|
119
119
|
"div",
|
|
120
120
|
{
|
|
@@ -147,7 +147,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
147
147
|
className: o.groupMembers,
|
|
148
148
|
"data-testid": `${r}observation-group-members-${e.conceptNameToDisplay}-${s}`,
|
|
149
149
|
children: e.groupMembers?.map((_, f) => /* @__PURE__ */ a(
|
|
150
|
-
|
|
150
|
+
H,
|
|
151
151
|
{
|
|
152
152
|
member: _,
|
|
153
153
|
depth: 0,
|
|
@@ -201,7 +201,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
201
201
|
data: $ = [],
|
|
202
202
|
isLoading: O,
|
|
203
203
|
isError: R,
|
|
204
|
-
error:
|
|
204
|
+
error: K
|
|
205
205
|
} = y({
|
|
206
206
|
queryKey: ["forms", u, e],
|
|
207
207
|
queryFn: () => Z(u, void 0, f),
|
|
@@ -227,7 +227,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
227
227
|
enabled: !!D && n
|
|
228
228
|
}), {
|
|
229
229
|
data: T,
|
|
230
|
-
isLoading:
|
|
230
|
+
isLoading: Q,
|
|
231
231
|
error: E
|
|
232
232
|
} = y({
|
|
233
233
|
queryKey: ["formsEncounter", r?.encounterUuid],
|
|
@@ -241,18 +241,18 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
241
241
|
{ key: "recordedBy", header: t("FORM_RECORDED_BY") }
|
|
242
242
|
],
|
|
243
243
|
[t]
|
|
244
|
-
),
|
|
244
|
+
), X = g(
|
|
245
245
|
() => [
|
|
246
246
|
{ key: "recordedOn", sortable: !0 },
|
|
247
247
|
{ key: "recordedBy", sortable: !0 }
|
|
248
248
|
],
|
|
249
249
|
[]
|
|
250
|
-
),
|
|
250
|
+
), V = g(() => {
|
|
251
251
|
const c = C.reduce(
|
|
252
252
|
(m, i) => {
|
|
253
253
|
const h = i.formName;
|
|
254
254
|
m[h] ??= [];
|
|
255
|
-
const A = i.providers.map((
|
|
255
|
+
const A = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
|
|
256
256
|
return m[h].push({
|
|
257
257
|
id: i.encounterUuid,
|
|
258
258
|
formName: i.formName,
|
|
@@ -272,38 +272,38 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
272
272
|
)
|
|
273
273
|
})
|
|
274
274
|
).sort((m, i) => m.formName.localeCompare(i.formName));
|
|
275
|
-
}, [C, t]),
|
|
275
|
+
}, [C, t]), S = M((c) => {
|
|
276
276
|
_(c), l(!0);
|
|
277
|
-
}, []),
|
|
277
|
+
}, []), x = M(() => {
|
|
278
278
|
l(!1), _(null);
|
|
279
|
-
}, []),
|
|
279
|
+
}, []), G = M(
|
|
280
280
|
(c, p) => {
|
|
281
281
|
switch (p) {
|
|
282
282
|
case "recordedOn":
|
|
283
|
-
return /* @__PURE__ */ a(ae, { onClick: () =>
|
|
283
|
+
return /* @__PURE__ */ a(ae, { onClick: () => S(c), children: c.recordedOn });
|
|
284
284
|
case "recordedBy":
|
|
285
285
|
return c.recordedBy;
|
|
286
286
|
default:
|
|
287
287
|
return null;
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
-
[
|
|
290
|
+
[S]
|
|
291
291
|
);
|
|
292
292
|
return /* @__PURE__ */ b(Y, { children: [
|
|
293
|
-
/* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R ||
|
|
293
|
+
/* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R || V.length === 0 || N ? /* @__PURE__ */ a(
|
|
294
294
|
U,
|
|
295
295
|
{
|
|
296
296
|
headers: B,
|
|
297
297
|
ariaLabel: t("FORMS_HEADING"),
|
|
298
298
|
rows: [],
|
|
299
299
|
loading: O,
|
|
300
|
-
errorStateMessage: R ?
|
|
300
|
+
errorStateMessage: R ? K?.message : void 0,
|
|
301
301
|
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
302
|
-
renderCell:
|
|
302
|
+
renderCell: G,
|
|
303
303
|
className: o.formsTableBody,
|
|
304
304
|
dataTestId: "forms-table"
|
|
305
305
|
}
|
|
306
|
-
) : /* @__PURE__ */ a(se, { align: "start", children:
|
|
306
|
+
) : /* @__PURE__ */ a(se, { align: "start", children: V.map((c, p) => {
|
|
307
307
|
const { formName: m, records: i } = c;
|
|
308
308
|
return /* @__PURE__ */ a(
|
|
309
309
|
ne,
|
|
@@ -320,9 +320,9 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
320
320
|
rows: i,
|
|
321
321
|
loading: !1,
|
|
322
322
|
errorStateMessage: "",
|
|
323
|
-
sortable:
|
|
323
|
+
sortable: X,
|
|
324
324
|
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
325
|
-
renderCell:
|
|
325
|
+
renderCell: G,
|
|
326
326
|
className: o.formsTableBody,
|
|
327
327
|
dataTestId: `forms-table-${m}`
|
|
328
328
|
}
|
|
@@ -336,13 +336,13 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
|
|
|
336
336
|
{
|
|
337
337
|
id: "modalIdForActionAreaLayout",
|
|
338
338
|
open: n,
|
|
339
|
-
onRequestClose:
|
|
339
|
+
onRequestClose: x,
|
|
340
340
|
modalHeading: r.formName,
|
|
341
341
|
modalLabel: `${r.recordedOn} | ${r.recordedBy}`,
|
|
342
342
|
passiveModal: !0,
|
|
343
343
|
size: "md",
|
|
344
344
|
testId: "form-details-modal",
|
|
345
|
-
children: /* @__PURE__ */ a("div", { className: o.formContent, children: j ||
|
|
345
|
+
children: /* @__PURE__ */ a("div", { className: o.formContent, children: j || Q ? /* @__PURE__ */ a(de, { width: "100%", lineCount: 3 }) : w ? /* @__PURE__ */ a("div", { children: q(w).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((c, p) => /* @__PURE__ */ a(
|
|
346
346
|
we,
|
|
347
347
|
{
|
|
348
348
|
observation: c,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as v, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { h as F, L as N, R as K, z as k, H as q, V as Q, u as G, i as H, j as P, k as x, T as j, K as Y } from "./index-CJY_nv9v.js";
|
|
3
3
|
import { useQueries as z, useQuery as J } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as W, useEffect as S, useMemo as y } from "react";
|
|
5
5
|
import { useTranslation as A } from "react-i18next";
|
|
@@ -113,9 +113,9 @@ function ue(e, n) {
|
|
|
113
113
|
location: t.location?.[0]?.location?.display
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function D(e, n, t) {
|
|
117
117
|
const s = O(e.encounter), r = (e.hasMember ?? []).map((o) => O(o)).map((o) => o ? t.get(o) : void 0).filter((o) => !!o).map(
|
|
118
|
-
(o) =>
|
|
118
|
+
(o) => D(o, n, t)
|
|
119
119
|
);
|
|
120
120
|
return {
|
|
121
121
|
id: e.id,
|
|
@@ -138,7 +138,7 @@ function ce(e) {
|
|
|
138
138
|
const r = [], o = [];
|
|
139
139
|
return t.forEach((i, a) => {
|
|
140
140
|
if (s.has(a)) return;
|
|
141
|
-
const u =
|
|
141
|
+
const u = D(
|
|
142
142
|
i,
|
|
143
143
|
n,
|
|
144
144
|
t
|
|
@@ -178,15 +178,15 @@ function de(e) {
|
|
|
178
178
|
return !s && !r ? 0 : s ? r ? new Date(r).getTime() - new Date(s).getTime() : -1 : 1;
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
-
const
|
|
182
|
-
const o = se(e, n), i = o.value, a =
|
|
181
|
+
const w = (e, n, t, s, r) => {
|
|
182
|
+
const o = se(e, n), i = o.value, a = K(i);
|
|
183
183
|
let u = i;
|
|
184
|
-
a === "Image" && (u = /* @__PURE__ */ v(
|
|
184
|
+
a === "Image" && (u = /* @__PURE__ */ v(q, { imageSrc: i, alt: i, id: `${i}-img` })), a === "Video" && (u = /* @__PURE__ */ v(Q, { id: `${i}-video`, videoSrc: i }));
|
|
185
185
|
const c = r("OBSERVATIONS_RECORDED_BY", {
|
|
186
186
|
provider: o.provider
|
|
187
187
|
}), d = e.display, f = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", m = s ? `${s}-${f}-${d}-${t}-${n}` : `${f}-${d}-${t}-${n}`;
|
|
188
188
|
return /* @__PURE__ */ v(
|
|
189
|
-
|
|
189
|
+
k,
|
|
190
190
|
{
|
|
191
191
|
header: o.header,
|
|
192
192
|
value: u,
|
|
@@ -204,7 +204,7 @@ const D = (e, n, t, s, r) => {
|
|
|
204
204
|
id: `grouped-obs-${e.display}-${s}`,
|
|
205
205
|
open: t,
|
|
206
206
|
children: e.children.map(
|
|
207
|
-
(i, a) =>
|
|
207
|
+
(i, a) => w(i, a, r, o, n)
|
|
208
208
|
)
|
|
209
209
|
},
|
|
210
210
|
`grouped-obs-${e.id}`
|
|
@@ -222,7 +222,7 @@ const D = (e, n, t, s, r) => {
|
|
|
222
222
|
open: o,
|
|
223
223
|
children: [
|
|
224
224
|
r.observations.map(
|
|
225
|
-
(u, c) =>
|
|
225
|
+
(u, c) => w(u, c, i, n, t)
|
|
226
226
|
),
|
|
227
227
|
r.groupedObservations.map(
|
|
228
228
|
(u, c) => ve(
|
|
@@ -307,7 +307,7 @@ const D = (e, n, t, s, r) => {
|
|
|
307
307
|
className: I.observations,
|
|
308
308
|
children: [
|
|
309
309
|
/* @__PURE__ */ v(
|
|
310
|
-
|
|
310
|
+
j,
|
|
311
311
|
{
|
|
312
312
|
id: "observations-title",
|
|
313
313
|
testId: h ? `observations-title-${b}` : "observations-title",
|
|
@@ -317,7 +317,7 @@ const D = (e, n, t, s, r) => {
|
|
|
317
317
|
}
|
|
318
318
|
),
|
|
319
319
|
L ? /* @__PURE__ */ v(pe, { groupedData: R, title: b }) : /* @__PURE__ */ v(
|
|
320
|
-
|
|
320
|
+
Y,
|
|
321
321
|
{
|
|
322
322
|
headers: C,
|
|
323
323
|
rows: [],
|