@bahmni/widgets 0.0.1-dev.192 → 0.0.1-dev.194
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-DBGR411T.js → DocumentsTable-B1EReEvo.js} +54 -54
- package/dist/{FormsTable-BP08e4n9.js → FormsTable-BHR8ELR1.js} +41 -41
- package/dist/{Observations-SiLS1rRQ.js → Observations-BsDev8sJ.js} +21 -21
- package/dist/documents/DocumentsTable.d.ts.map +1 -1
- package/dist/{index-B0cIttpN.js → index-BxI904MH.js} +768 -768
- package/dist/index.css +1 -1
- package/dist/index.js +8 -8
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { u as
|
|
1
|
+
import { jsx as s, jsxs as l, Fragment as k } from "react/jsx-runtime";
|
|
2
|
+
import { u as V, a as H, b as P, F as q, U as z, c as G, y as Y } from "./index-BxI904MH.js";
|
|
3
3
|
import { useQuery as K } from "@tanstack/react-query";
|
|
4
|
-
import { useState as C, useCallback as E, useEffect as
|
|
4
|
+
import { useState as C, useCallback as E, useEffect as L, useMemo as f } from "react";
|
|
5
5
|
import { useTranslation as Q } from "react-i18next";
|
|
6
|
-
const W = "
|
|
6
|
+
const W = "_documentsTableBody_1voj8_1", X = "_viewAttachmentsLink_1voj8_11", J = "_documentViewerContainer_1voj8_15", Z = "_attachmentItem_1voj8_23", x = "_attachmentCounter_1voj8_27", ee = "_attachmentError_1voj8_36", te = "_documentIframe_1voj8_44", ne = "_documentImage_1voj8_50", c = {
|
|
7
7
|
documentsTableBody: W,
|
|
8
|
-
viewAttachmentsLink:
|
|
9
|
-
documentViewerContainer:
|
|
8
|
+
viewAttachmentsLink: X,
|
|
9
|
+
documentViewerContainer: J,
|
|
10
10
|
attachmentItem: Z,
|
|
11
11
|
attachmentCounter: x,
|
|
12
12
|
attachmentError: ee,
|
|
@@ -19,10 +19,10 @@ const W = "_documentsTableBody_6qsah_1", J = "_viewAttachmentsLink_6qsah_11", X
|
|
|
19
19
|
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
20
20
|
action: "DOCUMENTS_ACTION"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function M(t) {
|
|
23
23
|
return !t || t.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${t}`;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function oe(t, u) {
|
|
26
26
|
return t.map((d) => ({
|
|
27
27
|
key: d,
|
|
28
28
|
header: u(ae[d])
|
|
@@ -34,35 +34,35 @@ const re = [
|
|
|
34
34
|
"uploadedOn",
|
|
35
35
|
"uploadedBy",
|
|
36
36
|
"action"
|
|
37
|
-
],
|
|
38
|
-
const [d,
|
|
37
|
+
], se = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, v = (t) => t.attachments.length > 0 ? t.attachments : t.documentUrl ? [{ url: t.documentUrl, contentType: t.contentType }] : [], ue = ({ config: t, encounterUuids: u }) => {
|
|
38
|
+
const [d, g] = C(!1), [a, O] = C(
|
|
39
39
|
null
|
|
40
|
-
), [
|
|
40
|
+
), [w, T] = C(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
), p =
|
|
43
|
-
|
|
44
|
-
}, []),
|
|
45
|
-
|
|
46
|
-
}, []),
|
|
47
|
-
T((
|
|
48
|
-
}, []), { data: B, isLoading:
|
|
42
|
+
), p = V(), { t: n } = Q(), { addNotification: y } = H(), S = E((e) => {
|
|
43
|
+
O(e), g(!0);
|
|
44
|
+
}, []), b = E(() => {
|
|
45
|
+
g(!1), O(null), T(/* @__PURE__ */ new Set());
|
|
46
|
+
}, []), U = E((e) => {
|
|
47
|
+
T((o) => new Set(o).add(e));
|
|
48
|
+
}, []), { data: B, isLoading: j, isError: I, error: A } = K({
|
|
49
49
|
queryKey: ["documents", p, u],
|
|
50
50
|
enabled: !!p,
|
|
51
51
|
queryFn: () => P(p, u)
|
|
52
52
|
});
|
|
53
|
-
|
|
54
|
-
I &&
|
|
53
|
+
L(() => {
|
|
54
|
+
I && y({
|
|
55
55
|
title: n("ERROR_DEFAULT_TITLE"),
|
|
56
56
|
message: A?.message ?? "",
|
|
57
57
|
type: "error"
|
|
58
58
|
});
|
|
59
|
-
}, [I, A,
|
|
59
|
+
}, [I, A, y, n]), L(() => {
|
|
60
60
|
const e = new AbortController();
|
|
61
61
|
return (async () => {
|
|
62
62
|
if (!d || !a) return;
|
|
63
|
-
const r = /* @__PURE__ */ new Set(), _ =
|
|
63
|
+
const r = /* @__PURE__ */ new Set(), _ = v(a);
|
|
64
64
|
for (let m = 0; m < _.length; m++) {
|
|
65
|
-
const N =
|
|
65
|
+
const N = M(_[m].url);
|
|
66
66
|
try {
|
|
67
67
|
(await fetch(N, {
|
|
68
68
|
method: "HEAD",
|
|
@@ -78,24 +78,24 @@ const re = [
|
|
|
78
78
|
const h = f(
|
|
79
79
|
() => t?.fields ?? re,
|
|
80
80
|
[t?.fields]
|
|
81
|
-
), F = f(() =>
|
|
81
|
+
), F = f(() => oe(h, n), [h, n]), R = f(
|
|
82
82
|
() => h.map((e) => ({
|
|
83
83
|
key: e,
|
|
84
84
|
sortable: e !== "action"
|
|
85
85
|
})),
|
|
86
86
|
[h]
|
|
87
87
|
), i = f(
|
|
88
|
-
() => a ?
|
|
88
|
+
() => a ? v(a) : [],
|
|
89
89
|
[a]
|
|
90
|
-
),
|
|
91
|
-
(e,
|
|
92
|
-
switch (
|
|
90
|
+
), $ = E(
|
|
91
|
+
(e, o) => {
|
|
92
|
+
switch (o) {
|
|
93
93
|
case "documentIdentifier":
|
|
94
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ s("span", { children: e.documentIdentifier });
|
|
95
95
|
case "documentType":
|
|
96
96
|
return e.documentType ?? n("DOCUMENTS_NOT_AVAILABLE");
|
|
97
97
|
case "uploadedOn":
|
|
98
|
-
return
|
|
98
|
+
return z(
|
|
99
99
|
e.uploadedOn,
|
|
100
100
|
n,
|
|
101
101
|
!0
|
|
@@ -103,10 +103,10 @@ const re = [
|
|
|
103
103
|
case "uploadedBy":
|
|
104
104
|
return e.uploadedBy ?? n("DOCUMENTS_NOT_AVAILABLE");
|
|
105
105
|
case "action":
|
|
106
|
-
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */
|
|
107
|
-
|
|
106
|
+
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ s(
|
|
107
|
+
q,
|
|
108
108
|
{
|
|
109
|
-
onClick: () =>
|
|
109
|
+
onClick: () => S(e),
|
|
110
110
|
className: c.viewAttachmentsLink,
|
|
111
111
|
"data-testid": `view-attachments-${e.id}`,
|
|
112
112
|
children: n("DOCUMENTS_VIEW_ATTACHMENTS")
|
|
@@ -116,49 +116,49 @@ const re = [
|
|
|
116
116
|
return null;
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
|
-
[
|
|
119
|
+
[S, n]
|
|
120
120
|
);
|
|
121
|
-
return /* @__PURE__ */ l(
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
|
|
121
|
+
return /* @__PURE__ */ l(k, { children: [
|
|
122
|
+
/* @__PURE__ */ s("div", { "data-testid": "documents-table", children: /* @__PURE__ */ s(
|
|
123
|
+
G,
|
|
124
124
|
{
|
|
125
125
|
headers: F,
|
|
126
126
|
ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
|
|
127
127
|
rows: B ?? [],
|
|
128
|
-
loading:
|
|
128
|
+
loading: j,
|
|
129
129
|
errorStateMessage: I ? A?.message : null,
|
|
130
130
|
sortable: R,
|
|
131
131
|
emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
|
|
132
|
-
renderCell:
|
|
132
|
+
renderCell: $,
|
|
133
133
|
className: c.documentsTableBody,
|
|
134
134
|
dataTestId: "documents-table"
|
|
135
135
|
}
|
|
136
136
|
) }),
|
|
137
|
-
d && a && /* @__PURE__ */
|
|
138
|
-
|
|
137
|
+
d && a && /* @__PURE__ */ s(
|
|
138
|
+
Y,
|
|
139
139
|
{
|
|
140
140
|
id: "modalIdForActionAreaLayout",
|
|
141
141
|
portalId: "main-display-area",
|
|
142
142
|
open: d,
|
|
143
|
-
onRequestClose:
|
|
143
|
+
onRequestClose: b,
|
|
144
144
|
modalHeading: a.documentIdentifier,
|
|
145
145
|
passiveModal: !0,
|
|
146
146
|
size: "lg",
|
|
147
147
|
testId: "document-view-modal",
|
|
148
|
-
children: /* @__PURE__ */
|
|
149
|
-
const r =
|
|
148
|
+
children: /* @__PURE__ */ s("div", { className: c.documentViewerContainer, children: i.map((e, o) => {
|
|
149
|
+
const r = M(e.url), _ = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || se.test(e.url ?? ""), N = w.has(o);
|
|
150
150
|
return r === "#" || N ? /* @__PURE__ */ l(
|
|
151
151
|
"div",
|
|
152
152
|
{
|
|
153
153
|
className: c.attachmentError,
|
|
154
|
-
"data-testid": `attachment-error-${
|
|
154
|
+
"data-testid": `attachment-error-${o}`,
|
|
155
155
|
children: [
|
|
156
156
|
i.length > 1 && /* @__PURE__ */ l("p", { className: c.attachmentCounter, children: [
|
|
157
|
-
|
|
157
|
+
o + 1,
|
|
158
158
|
"/",
|
|
159
159
|
i.length
|
|
160
160
|
] }),
|
|
161
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ s("p", { children: n("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
|
|
162
162
|
]
|
|
163
163
|
},
|
|
164
164
|
`${a.id}-${e.url}`
|
|
@@ -166,28 +166,28 @@ const re = [
|
|
|
166
166
|
"div",
|
|
167
167
|
{
|
|
168
168
|
className: c.attachmentItem,
|
|
169
|
-
"data-testid": `attachment-item-${
|
|
169
|
+
"data-testid": `attachment-item-${o}`,
|
|
170
170
|
children: [
|
|
171
171
|
i.length > 1 && /* @__PURE__ */ l("p", { className: c.attachmentCounter, children: [
|
|
172
|
-
|
|
172
|
+
o + 1,
|
|
173
173
|
"/",
|
|
174
174
|
i.length
|
|
175
175
|
] }),
|
|
176
|
-
m ? /* @__PURE__ */
|
|
176
|
+
m ? /* @__PURE__ */ s(
|
|
177
177
|
"img",
|
|
178
178
|
{
|
|
179
179
|
src: r,
|
|
180
180
|
alt: a.documentIdentifier,
|
|
181
181
|
className: c.documentImage,
|
|
182
|
-
onError: () =>
|
|
182
|
+
onError: () => U(o)
|
|
183
183
|
}
|
|
184
|
-
) : /* @__PURE__ */
|
|
184
|
+
) : /* @__PURE__ */ s(
|
|
185
185
|
"iframe",
|
|
186
186
|
{
|
|
187
187
|
src: _ ? `${r}#toolbar=0` : r,
|
|
188
188
|
className: c.documentIframe,
|
|
189
189
|
title: a.documentIdentifier,
|
|
190
|
-
onError: () =>
|
|
190
|
+
onError: () => U(o)
|
|
191
191
|
}
|
|
192
192
|
)
|
|
193
193
|
]
|
|
@@ -200,5 +200,5 @@ const re = [
|
|
|
200
200
|
] });
|
|
201
201
|
};
|
|
202
202
|
export {
|
|
203
|
-
|
|
203
|
+
ue as default
|
|
204
204
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as b, jsx as o, Fragment as
|
|
2
|
-
import { f as
|
|
1
|
+
import { jsxs as b, jsx as o, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { f as K, d as R, Q as ae, r as oe, o as se, e as ne, g as de, s as ie, u as le, q as ce, G as me, B as ue, z as pe, h as be, i as fe, U as _e, F as ye, c as P, j as he, W as $e, y as ge, D as Ne, R as H } from "./index-BxI904MH.js";
|
|
3
3
|
import { useQueryClient as ve, useQuery as O } from "@tanstack/react-query";
|
|
4
4
|
import { useState as k, useMemo as g, useCallback as L } from "react";
|
|
5
5
|
import { useTranslation as V } from "react-i18next";
|
|
6
|
-
const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Me = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", De = "_rowContainer_1pd36_43", Te = "_groupLabel_1pd36_48", Ve = "_rowLabel_1pd36_58", we = "_rowValue_1pd36_67", Be = "_groupMembers_1pd36_75", Ie = "_memberRow_1pd36_81", Ee = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Ge = "_abnormalValue_1pd36_102",
|
|
6
|
+
const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Me = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", De = "_rowContainer_1pd36_43", Te = "_groupLabel_1pd36_48", Ve = "_rowLabel_1pd36_58", we = "_rowValue_1pd36_67", Be = "_groupMembers_1pd36_75", Ie = "_memberRow_1pd36_81", Ee = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Ge = "_abnormalValue_1pd36_102", Ue = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", Se = "_nestedGroup_1pd36_125", xe = "_nestedGroupLabel_1pd36_132", Pe = "_nestedGroupMembers_1pd36_141", s = {
|
|
7
7
|
formsTableBody: Fe,
|
|
8
8
|
customAccordianItem: Oe,
|
|
9
9
|
formContent: Le,
|
|
@@ -19,12 +19,12 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
19
19
|
memberLabel: Ee,
|
|
20
20
|
memberValue: Ae,
|
|
21
21
|
abnormalValue: Ge,
|
|
22
|
-
commentSection:
|
|
23
|
-
commentText:
|
|
24
|
-
nestedGroup:
|
|
25
|
-
nestedGroupLabel:
|
|
26
|
-
nestedGroupMembers:
|
|
27
|
-
},
|
|
22
|
+
commentSection: Ue,
|
|
23
|
+
commentText: qe,
|
|
24
|
+
nestedGroup: Se,
|
|
25
|
+
nestedGroupLabel: xe,
|
|
26
|
+
nestedGroupMembers: Pe
|
|
27
|
+
}, Q = (e) => {
|
|
28
28
|
const r = ae(e);
|
|
29
29
|
return r === "Image" ? /* @__PURE__ */ o(
|
|
30
30
|
oe,
|
|
@@ -34,7 +34,7 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
34
34
|
id: `${e}-img`
|
|
35
35
|
}
|
|
36
36
|
) : r === "Video" ? /* @__PURE__ */ o(se, { id: `${e}-video`, videoSrc: e }) : r === "PDF" ? /* @__PURE__ */ o(ne, { id: `${e}-pdf`, src: e }) : e;
|
|
37
|
-
},
|
|
37
|
+
}, z = (e) => {
|
|
38
38
|
const r = e.observationValue?.referenceRange?.low?.value, a = e.observationValue?.referenceRange?.high?.value, n = r != null, d = a != null;
|
|
39
39
|
let i = "";
|
|
40
40
|
n && d ? i = ` (${r} - ${a})` : n ? i = ` (>${r})` : d && (i = ` (<${a})`);
|
|
@@ -84,8 +84,8 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
84
84
|
]
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
|
-
const { rangeString: $, isAbnormal: f } =
|
|
88
|
-
return /* @__PURE__ */ b(
|
|
87
|
+
const { rangeString: $, isAbnormal: f } = z(e), _ = K(e, i), y = _ ? Q(_) : null;
|
|
88
|
+
return /* @__PURE__ */ b(j, { children: [
|
|
89
89
|
/* @__PURE__ */ b(
|
|
90
90
|
"div",
|
|
91
91
|
{
|
|
@@ -134,13 +134,13 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
134
134
|
}
|
|
135
135
|
)
|
|
136
136
|
] });
|
|
137
|
-
},
|
|
137
|
+
}, He = ({
|
|
138
138
|
observation: e,
|
|
139
139
|
index: r,
|
|
140
140
|
formName: a = "",
|
|
141
141
|
comment: n
|
|
142
142
|
}) => {
|
|
143
|
-
const { t: d } = V(), i = e.members && e.members.length > 0, { rangeString: u, isAbnormal: t } =
|
|
143
|
+
const { t: d } = V(), i = e.members && e.members.length > 0, { rangeString: u, isAbnormal: t } = z(e), c = a ? `${a}-` : "", $ = K(e, d), f = $ ? Q($) : null;
|
|
144
144
|
return /* @__PURE__ */ b(
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
@@ -214,16 +214,16 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
214
214
|
);
|
|
215
215
|
}, ke = (e) => e ? e.extension?.find(
|
|
216
216
|
(a) => a.url === ie
|
|
217
|
-
)?.valueString : void 0,
|
|
217
|
+
)?.valueString : void 0, je = (e) => {
|
|
218
218
|
if (e)
|
|
219
219
|
return e.note?.[0]?.text;
|
|
220
|
-
},
|
|
221
|
-
const a =
|
|
220
|
+
}, Ke = (e, r) => e.entry?.find((a) => a.resource?.id === r)?.resource, T = (e, r) => {
|
|
221
|
+
const a = Ke(e, r);
|
|
222
222
|
return a ? {
|
|
223
223
|
formFieldPath: ke(a),
|
|
224
|
-
comment:
|
|
224
|
+
comment: je(a)
|
|
225
225
|
} : {};
|
|
226
|
-
},
|
|
226
|
+
}, Qe = (e, r) => {
|
|
227
227
|
if (!e?.entry || !r)
|
|
228
228
|
return [];
|
|
229
229
|
const a = de(e);
|
|
@@ -257,8 +257,8 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
257
257
|
data: y = [],
|
|
258
258
|
isLoading: N,
|
|
259
259
|
isError: v,
|
|
260
|
-
error:
|
|
261
|
-
refetch:
|
|
260
|
+
error: Y,
|
|
261
|
+
refetch: J
|
|
262
262
|
} = O({
|
|
263
263
|
queryKey: ["forms", d, e],
|
|
264
264
|
queryFn: () => me(d, void 0, $),
|
|
@@ -289,14 +289,14 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
289
289
|
});
|
|
290
290
|
fe(
|
|
291
291
|
(l) => {
|
|
292
|
-
l.patientUUID === d && l.updatedConcepts.size > 0 && (
|
|
292
|
+
l.patientUUID === d && l.updatedConcepts.size > 0 && (J(), _.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
293
293
|
},
|
|
294
294
|
[d]
|
|
295
295
|
);
|
|
296
|
-
const G = g(() => !C || !t?.formName ? [] :
|
|
296
|
+
const G = g(() => !C || !t?.formName ? [] : Qe(
|
|
297
297
|
C,
|
|
298
298
|
t.formName
|
|
299
|
-
), [C, t?.formName]),
|
|
299
|
+
), [C, t?.formName]), U = g(
|
|
300
300
|
() => [
|
|
301
301
|
{ key: "recordedOn", header: n("FORM_RECORDED_ON") },
|
|
302
302
|
{ key: "recordedBy", header: n("FORM_RECORDED_BY") }
|
|
@@ -308,7 +308,7 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
308
308
|
{ key: "recordedBy", sortable: !0 }
|
|
309
309
|
],
|
|
310
310
|
[]
|
|
311
|
-
),
|
|
311
|
+
), q = g(() => {
|
|
312
312
|
const l = w.reduce(
|
|
313
313
|
(m, p) => {
|
|
314
314
|
const F = p.formName;
|
|
@@ -333,38 +333,38 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
333
333
|
)
|
|
334
334
|
})
|
|
335
335
|
).sort((m, p) => m.formName.localeCompare(p.formName));
|
|
336
|
-
}, [w, n]),
|
|
336
|
+
}, [w, n]), S = L((l) => {
|
|
337
337
|
c(l), u(!0);
|
|
338
338
|
}, []), re = L(() => {
|
|
339
339
|
u(!1), c(null);
|
|
340
|
-
}, []),
|
|
340
|
+
}, []), x = L(
|
|
341
341
|
(l, h) => {
|
|
342
342
|
switch (h) {
|
|
343
343
|
case "recordedOn":
|
|
344
|
-
return /* @__PURE__ */ o(ye, { onClick: () =>
|
|
344
|
+
return /* @__PURE__ */ o(ye, { onClick: () => S(l), children: l.recordedOn });
|
|
345
345
|
case "recordedBy":
|
|
346
346
|
return l.recordedBy;
|
|
347
347
|
default:
|
|
348
348
|
return null;
|
|
349
349
|
}
|
|
350
350
|
},
|
|
351
|
-
[
|
|
351
|
+
[S]
|
|
352
352
|
);
|
|
353
|
-
return /* @__PURE__ */ b(
|
|
354
|
-
/* @__PURE__ */ o("div", { "data-testid": "forms-table", children: N || v ||
|
|
355
|
-
|
|
353
|
+
return /* @__PURE__ */ b(j, { children: [
|
|
354
|
+
/* @__PURE__ */ o("div", { "data-testid": "forms-table", children: N || v || q.length === 0 || f ? /* @__PURE__ */ o(
|
|
355
|
+
P,
|
|
356
356
|
{
|
|
357
|
-
headers:
|
|
357
|
+
headers: U,
|
|
358
358
|
ariaLabel: n("FORMS_HEADING"),
|
|
359
359
|
rows: [],
|
|
360
360
|
loading: N,
|
|
361
|
-
errorStateMessage: v ?
|
|
361
|
+
errorStateMessage: v ? Y?.message : void 0,
|
|
362
362
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
363
|
-
renderCell:
|
|
363
|
+
renderCell: x,
|
|
364
364
|
className: s.formsTableBody,
|
|
365
365
|
dataTestId: "forms-table"
|
|
366
366
|
}
|
|
367
|
-
) : /* @__PURE__ */ o(he, { align: "start", children:
|
|
367
|
+
) : /* @__PURE__ */ o(he, { align: "start", children: q.map((l, h) => {
|
|
368
368
|
const { formName: m, records: p } = l;
|
|
369
369
|
return /* @__PURE__ */ o(
|
|
370
370
|
$e,
|
|
@@ -374,16 +374,16 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
374
374
|
testId: `accordian-title-${m}`,
|
|
375
375
|
open: h === 0,
|
|
376
376
|
children: /* @__PURE__ */ o(
|
|
377
|
-
|
|
377
|
+
P,
|
|
378
378
|
{
|
|
379
|
-
headers:
|
|
379
|
+
headers: U,
|
|
380
380
|
ariaLabel: n("FORMS_HEADING"),
|
|
381
381
|
rows: p,
|
|
382
382
|
loading: !1,
|
|
383
383
|
errorStateMessage: "",
|
|
384
384
|
sortable: ee,
|
|
385
385
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
386
|
-
renderCell:
|
|
386
|
+
renderCell: x,
|
|
387
387
|
className: s.formsTableBody,
|
|
388
388
|
dataTestId: `forms-table-${m}`
|
|
389
389
|
}
|
|
@@ -404,8 +404,8 @@ const Fe = "_formsTableBody_1pd36_1", Oe = "_customAccordianItem_1pd36_6", Le =
|
|
|
404
404
|
passiveModal: !0,
|
|
405
405
|
size: "md",
|
|
406
406
|
testId: "form-details-modal",
|
|
407
|
-
children: /* @__PURE__ */ o("div", { className: s.formContent, children: X || Z ? /* @__PURE__ */ o(Ne, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ o("div", { children:
|
|
408
|
-
|
|
407
|
+
children: /* @__PURE__ */ o("div", { className: s.formContent, children: X || Z ? /* @__PURE__ */ o(Ne, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ o("div", { children: H(E).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : A ? /* @__PURE__ */ o("div", { children: H(A).message ?? n("ERROR_FETCHING_FORM_DATA") }) : G.length > 0 ? /* @__PURE__ */ o("div", { className: s.formDetailsContainer, children: G.map(({ obs: l, comment: h }, m) => /* @__PURE__ */ o(
|
|
408
|
+
He,
|
|
409
409
|
{
|
|
410
410
|
observation: l,
|
|
411
411
|
index: m,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as d, jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as d, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { k, l as C, t as M, Q as V, J as q, r as K, o as w, e as G, u as P, a as H, Y, L as j, i as J, g as z, m as W, n as X, p as Z, c as x } from "./index-BxI904MH.js";
|
|
3
3
|
import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as se, useEffect as $, useMemo as h } from "react";
|
|
5
5
|
import { useTranslation as D } from "react-i18next";
|
|
6
6
|
const U = (t, c, i, l, r) => {
|
|
7
|
-
const s =
|
|
7
|
+
const s = M(t, c, r), o = s.value, a = V(o);
|
|
8
8
|
let n = o;
|
|
9
|
-
a === "Image" && (n = /* @__PURE__ */ d(
|
|
9
|
+
a === "Image" && (n = /* @__PURE__ */ d(K, { 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
10
|
const u = r("OBSERVATIONS_RECORDED_BY", {
|
|
11
11
|
provider: s.provider
|
|
12
12
|
}), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
|
|
13
13
|
return /* @__PURE__ */ d(
|
|
14
|
-
|
|
14
|
+
q,
|
|
15
15
|
{
|
|
16
16
|
header: s.header,
|
|
17
17
|
value: n,
|
|
@@ -23,7 +23,7 @@ const U = (t, c, i, l, r) => {
|
|
|
23
23
|
`obs-${t.id}`
|
|
24
24
|
);
|
|
25
25
|
}, oe = (t, c, i, l, r, s) => /* @__PURE__ */ d(
|
|
26
|
-
|
|
26
|
+
C,
|
|
27
27
|
{
|
|
28
28
|
title: t.display,
|
|
29
29
|
id: `grouped-obs-${t.display}-${l}`,
|
|
@@ -39,8 +39,8 @@ const U = (t, c, i, l, r) => {
|
|
|
39
39
|
}) => {
|
|
40
40
|
const { t: i } = D(), l = (r, s, o) => {
|
|
41
41
|
const a = k(r.encounterDetails, i);
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
|
|
42
|
+
return /* @__PURE__ */ S(
|
|
43
|
+
C,
|
|
44
44
|
{
|
|
45
45
|
title: a,
|
|
46
46
|
id: `encounter-${r.encounterId}`,
|
|
@@ -75,14 +75,14 @@ const U = (t, c, i, l, r) => {
|
|
|
75
75
|
)
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
|
-
}, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12",
|
|
78
|
+
}, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
|
|
79
79
|
observations: ae,
|
|
80
80
|
title: ne
|
|
81
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 } =
|
|
82
|
+
const c = t, { conceptNames: i = [], conceptUuid: l = [] } = c, r = se(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = H(), { t: a } = D(), n = ee({
|
|
83
83
|
queries: i.map((e) => ({
|
|
84
84
|
queryKey: ie(e),
|
|
85
|
-
queryFn: () =>
|
|
85
|
+
queryFn: () => Y(e),
|
|
86
86
|
enabled: !!e
|
|
87
87
|
}))
|
|
88
88
|
});
|
|
@@ -105,10 +105,10 @@ const U = (t, c, i, l, r) => {
|
|
|
105
105
|
refetch: R
|
|
106
106
|
} = te({
|
|
107
107
|
queryKey: ce(s, b),
|
|
108
|
-
queryFn: () =>
|
|
108
|
+
queryFn: () => j(s, b),
|
|
109
109
|
enabled: !!s && b.length > 0 && v
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
J(
|
|
112
112
|
(e) => {
|
|
113
113
|
e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
114
114
|
(O) => b.includes(O)
|
|
@@ -124,20 +124,20 @@ const U = (t, c, i, l, r) => {
|
|
|
124
124
|
}, [g]);
|
|
125
125
|
const T = h(() => {
|
|
126
126
|
if (!p) return [];
|
|
127
|
-
const e =
|
|
127
|
+
const e = z(p), m = W(e);
|
|
128
128
|
return X(m);
|
|
129
129
|
}, [p]), B = [
|
|
130
130
|
{ key: "name", header: "name" },
|
|
131
131
|
{ key: "value", header: "value" },
|
|
132
132
|
{ key: "form", header: "form" }
|
|
133
|
-
], I = f || !v, _ = g && v,
|
|
134
|
-
return /* @__PURE__ */
|
|
133
|
+
], I = f || !v, _ = g && v, L = (!p || p.entry?.length === 0 || b.length === 0) && v, A = _ ? a("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? a("NO_OBSERVATIONS_FOUND") : void 0, Q = T.length > 0 && !I && !_, E = c.titleTranslationKey, y = E ? a(E) : "";
|
|
134
|
+
return /* @__PURE__ */ S(
|
|
135
135
|
"div",
|
|
136
136
|
{
|
|
137
137
|
id: "observations",
|
|
138
138
|
"data-testid": E ? `observations-${y}` : "observations",
|
|
139
139
|
"aria-label": "observations-aria-label",
|
|
140
|
-
className:
|
|
140
|
+
className: N.observations,
|
|
141
141
|
children: [
|
|
142
142
|
/* @__PURE__ */ d(
|
|
143
143
|
Z,
|
|
@@ -145,19 +145,19 @@ const U = (t, c, i, l, r) => {
|
|
|
145
145
|
id: "observations-title",
|
|
146
146
|
testId: E ? `observations-title-${y}` : "observations-title",
|
|
147
147
|
title: y,
|
|
148
|
-
className:
|
|
148
|
+
className: N.title,
|
|
149
149
|
children: /* @__PURE__ */ d("p", { children: y })
|
|
150
150
|
}
|
|
151
151
|
),
|
|
152
|
-
|
|
152
|
+
Q ? /* @__PURE__ */ d(re, { groupedData: T, title: y }) : /* @__PURE__ */ d(
|
|
153
153
|
x,
|
|
154
154
|
{
|
|
155
155
|
headers: B,
|
|
156
156
|
rows: [],
|
|
157
157
|
ariaLabel: a("OBSERVATIONS"),
|
|
158
158
|
loading: I,
|
|
159
|
-
errorStateMessage:
|
|
160
|
-
emptyStateMessage:
|
|
159
|
+
errorStateMessage: A,
|
|
160
|
+
emptyStateMessage: F,
|
|
161
161
|
dataTestId: "observations-table"
|
|
162
162
|
}
|
|
163
163
|
)
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAwBhD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoOzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|