@bahmni/widgets 0.0.1-dev.280 → 0.0.1-dev.282
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-CgHSGu-_.js → DocumentsTable-_t5Q-fgi.js} +40 -40
- package/dist/{FormsTable-DUP6aJ4M.js → FormsTable-Dr7LvEY-.js} +38 -38
- package/dist/{Observations-C-20EZkJ.js → Observations-DGtRQbJf.js} +43 -43
- package/dist/documentPrintButton/DocumentPrintButton.d.ts +17 -0
- package/dist/documentPrintButton/DocumentPrintButton.d.ts.map +1 -0
- package/dist/documentPrintButton/index.d.ts +3 -0
- package/dist/documentPrintButton/index.d.ts.map +1 -0
- package/dist/documentPrintButton/usePrintDocument.d.ts +12 -0
- package/dist/documentPrintButton/usePrintDocument.d.ts.map +1 -0
- package/dist/{index-Cfvw6Moy.js → index-FhPWvTDE.js} +44623 -39028
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -19
- package/package.json +1 -1
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { jsx as r, jsxs as T, Fragment as X } from "react/jsx-runtime";
|
|
2
|
-
import { u as Y, a as W,
|
|
2
|
+
import { u as Y, a as W, y as J, X as Z, O as x, b as ee, I as te } from "./index-FhPWvTDE.js";
|
|
3
3
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as l, useCallback as _, useEffect as g, useMemo as p } from "react";
|
|
5
5
|
import { useTranslation as ae } from "react-i18next";
|
|
6
|
-
const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3",
|
|
6
|
+
const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", le = "DocumentsTable-module_documentIframe__ptq5I", ue = "DocumentsTable-module_documentImage__KQVgS", c = {
|
|
7
7
|
documentsTableBody: oe,
|
|
8
8
|
viewAttachmentsLink: se,
|
|
9
9
|
documentViewerContainer: re,
|
|
10
10
|
attachmentItem: ce,
|
|
11
11
|
attachmentCounter: de,
|
|
12
|
-
attachmentError:
|
|
13
|
-
documentIframe:
|
|
14
|
-
documentImage:
|
|
15
|
-
},
|
|
12
|
+
attachmentError: me,
|
|
13
|
+
documentIframe: le,
|
|
14
|
+
documentImage: ue
|
|
15
|
+
}, ie = {
|
|
16
16
|
documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
|
|
17
17
|
documentType: "DOCUMENTS_TYPE",
|
|
18
18
|
uploadedOn: "DOCUMENTS_UPLOADED_ON",
|
|
19
19
|
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
20
|
-
|
|
20
|
+
attachments: "DOCUMENTS_ATTACHMENTS"
|
|
21
21
|
};
|
|
22
22
|
function B(n) {
|
|
23
23
|
return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
|
|
24
24
|
}
|
|
25
|
-
function he(n,
|
|
25
|
+
function he(n, E) {
|
|
26
26
|
return n.map((d) => ({
|
|
27
27
|
key: d,
|
|
28
|
-
header:
|
|
28
|
+
header: E(ie[d])
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
const Te = [
|
|
32
32
|
"documentIdentifier",
|
|
33
33
|
"documentType",
|
|
34
|
+
"attachments",
|
|
34
35
|
"uploadedOn",
|
|
35
|
-
"uploadedBy"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const [d, M] = m(!1), [s, U] = m(
|
|
36
|
+
"uploadedBy"
|
|
37
|
+
], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], ge = ({ config: n, encounterUuids: E }) => {
|
|
38
|
+
const [d, L] = l(!1), [s, U] = l(
|
|
39
39
|
null
|
|
40
|
-
), [P, A] =
|
|
40
|
+
), [P, A] = l(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
),
|
|
43
|
-
U(e),
|
|
42
|
+
), f = Y(), { t: o } = ae(), { addNotification: w } = W(), V = Number(n?.pageSize) || 5, [N, O] = l(1), [u, $] = l(V), [k, C] = l(void 0), v = _((e) => {
|
|
43
|
+
U(e), L(!0);
|
|
44
44
|
}, []), z = _(() => {
|
|
45
|
-
|
|
45
|
+
L(!1), U(null), A(/* @__PURE__ */ new Set());
|
|
46
46
|
}, []), R = _((e) => {
|
|
47
47
|
A((t) => new Set(t).add(e));
|
|
48
|
-
}, []), { data:
|
|
48
|
+
}, []), { data: i, isLoading: H, isError: S, error: y } = ne({
|
|
49
49
|
queryKey: [
|
|
50
50
|
"documents",
|
|
51
|
-
E,
|
|
52
51
|
f,
|
|
52
|
+
E,
|
|
53
53
|
N,
|
|
54
|
-
|
|
54
|
+
u
|
|
55
55
|
],
|
|
56
|
-
enabled: !!
|
|
56
|
+
enabled: !!f,
|
|
57
57
|
queryFn: () => J(
|
|
58
|
-
E,
|
|
59
58
|
f,
|
|
60
|
-
|
|
59
|
+
E,
|
|
60
|
+
u,
|
|
61
61
|
N
|
|
62
62
|
)
|
|
63
63
|
});
|
|
64
64
|
g(() => {
|
|
65
|
-
|
|
66
|
-
}, [
|
|
65
|
+
i && C(i.total);
|
|
66
|
+
}, [i]), g(() => {
|
|
67
67
|
O(1), C(void 0);
|
|
68
|
-
}, [
|
|
68
|
+
}, [f]), g(() => {
|
|
69
69
|
S && w({
|
|
70
70
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
71
71
|
message: y?.message ?? "",
|
|
@@ -76,15 +76,15 @@ const Te = [
|
|
|
76
76
|
return (async () => {
|
|
77
77
|
if (!d || !s) return;
|
|
78
78
|
const a = /* @__PURE__ */ new Set(), I = F(s);
|
|
79
|
-
for (let
|
|
80
|
-
const b = B(I[
|
|
79
|
+
for (let m = 0; m < I.length; m++) {
|
|
80
|
+
const b = B(I[m].url);
|
|
81
81
|
try {
|
|
82
82
|
(await fetch(b, {
|
|
83
83
|
method: "HEAD",
|
|
84
84
|
signal: e.signal
|
|
85
|
-
})).ok || a.add(
|
|
86
|
-
} catch (
|
|
87
|
-
|
|
85
|
+
})).ok || a.add(m);
|
|
86
|
+
} catch (M) {
|
|
87
|
+
M instanceof Error && M.name !== "AbortError" && a.add(m);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
e.signal.aborted || A(a);
|
|
@@ -92,16 +92,16 @@ const Te = [
|
|
|
92
92
|
}, [d, s]);
|
|
93
93
|
const q = _(
|
|
94
94
|
(e, t) => {
|
|
95
|
-
t !==
|
|
95
|
+
t !== u ? ($(t), O(1), C(void 0)) : O(e);
|
|
96
96
|
},
|
|
97
|
-
[
|
|
97
|
+
[u]
|
|
98
98
|
), D = p(
|
|
99
99
|
() => n?.fields ?? Te,
|
|
100
100
|
[n?.fields]
|
|
101
|
-
), j = p(() => [...
|
|
101
|
+
), j = p(() => [...i?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [i]), K = p(() => he(D, o), [D, o]), G = p(
|
|
102
102
|
() => D.map((e) => ({
|
|
103
103
|
key: e,
|
|
104
|
-
sortable: e !== "
|
|
104
|
+
sortable: e !== "attachments"
|
|
105
105
|
})),
|
|
106
106
|
[D]
|
|
107
107
|
), h = p(
|
|
@@ -122,7 +122,7 @@ const Te = [
|
|
|
122
122
|
).formattedResult || o("DOCUMENTS_NOT_AVAILABLE");
|
|
123
123
|
case "uploadedBy":
|
|
124
124
|
return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
|
|
125
|
-
case "
|
|
125
|
+
case "attachments":
|
|
126
126
|
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ r(
|
|
127
127
|
Z,
|
|
128
128
|
{
|
|
@@ -152,7 +152,7 @@ const Te = [
|
|
|
152
152
|
renderCell: Q,
|
|
153
153
|
className: c.documentsTableBody,
|
|
154
154
|
dataTestId: "documents-table",
|
|
155
|
-
pageSize:
|
|
155
|
+
pageSize: u,
|
|
156
156
|
totalItems: k,
|
|
157
157
|
page: N,
|
|
158
158
|
onPageChange: q
|
|
@@ -170,7 +170,7 @@ const Te = [
|
|
|
170
170
|
size: "lg",
|
|
171
171
|
testId: "document-view-modal",
|
|
172
172
|
children: /* @__PURE__ */ r("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
|
|
173
|
-
const a = B(e.url), I = e.contentType?.toLowerCase().includes("pdf"),
|
|
173
|
+
const a = B(e.url), I = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
|
|
174
174
|
return a === "#" || b ? /* @__PURE__ */ T(
|
|
175
175
|
"div",
|
|
176
176
|
{
|
|
@@ -197,7 +197,7 @@ const Te = [
|
|
|
197
197
|
"/",
|
|
198
198
|
h.length
|
|
199
199
|
] }),
|
|
200
|
-
|
|
200
|
+
m ? /* @__PURE__ */ r(
|
|
201
201
|
"img",
|
|
202
202
|
{
|
|
203
203
|
src: a,
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { K as re, u as te, x as oe, Q as ae, W as se, J as ne, L as de, d as ie, M as U, O as me, X as le, b as x, c as ce, e as ue, I as fe, f as ye } from "./index-FhPWvTDE.js";
|
|
3
3
|
import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
|
|
4
4
|
import { useState as k, useMemo as d, useCallback as b } from "react";
|
|
5
5
|
import { useTranslation as pe } from "react-i18next";
|
|
6
|
-
const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_customAccordianItem__isszs",
|
|
6
|
+
const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_customAccordianItem__isszs", E = {
|
|
7
7
|
formsTableBody: ge,
|
|
8
8
|
customAccordianItem: Fe
|
|
9
9
|
}, he = (m) => m ? m.extension?.find(
|
|
10
10
|
(p) => p.url === re
|
|
11
|
-
)?.valueString : void 0,
|
|
11
|
+
)?.valueString : void 0, Ae = ({
|
|
12
12
|
episodeOfCareUuids: m,
|
|
13
13
|
encounterUuids: i,
|
|
14
14
|
config: p
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: s } = pe(), l = te(), [c,
|
|
16
|
+
const { t: s } = pe(), l = te(), [c, I] = k(!1), [o, M] = k(null), {
|
|
17
17
|
numberOfVisits: K,
|
|
18
18
|
hideThumbnail: P = !1,
|
|
19
19
|
forms: u
|
|
20
|
-
} = p ?? {},
|
|
20
|
+
} = p ?? {}, A = oe(
|
|
21
21
|
m,
|
|
22
22
|
i
|
|
23
23
|
), w = be(), {
|
|
24
|
-
data:
|
|
24
|
+
data: D = [],
|
|
25
25
|
isLoading: v,
|
|
26
|
-
isError:
|
|
27
|
-
error:
|
|
28
|
-
refetch:
|
|
26
|
+
isError: L,
|
|
27
|
+
error: H,
|
|
28
|
+
refetch: Q
|
|
29
29
|
} = y({
|
|
30
30
|
queryKey: ["forms", l, m],
|
|
31
31
|
queryFn: () => ae(l, void 0, K),
|
|
32
|
-
enabled: !!l && !
|
|
33
|
-
}),
|
|
34
|
-
let e =
|
|
32
|
+
enabled: !!l && !A
|
|
33
|
+
}), B = d(() => {
|
|
34
|
+
let e = D;
|
|
35
35
|
return i && i.length > 0 && (e = e.filter(
|
|
36
36
|
(t) => i.includes(t.encounterUuid)
|
|
37
37
|
)), Array.isArray(u) && u.length > 0 && (e = e.filter(
|
|
38
38
|
(t) => u.some((r) => r.toLowerCase() === t.formName.toLowerCase())
|
|
39
39
|
)), e;
|
|
40
|
-
}, [
|
|
40
|
+
}, [D, i, u]), { data: T = [] } = y({
|
|
41
41
|
queryKey: ["observationForms"],
|
|
42
42
|
queryFn: () => se()
|
|
43
|
-
}),
|
|
43
|
+
}), R = b(
|
|
44
44
|
(e) => T.find((r) => r.name === e)?.uuid,
|
|
45
45
|
[T]
|
|
46
46
|
), g = d(() => {
|
|
47
47
|
if (o)
|
|
48
|
-
return
|
|
49
|
-
}, [o,
|
|
48
|
+
return R(o.formName);
|
|
49
|
+
}, [o, R]), {
|
|
50
50
|
isLoading: j,
|
|
51
51
|
isError: V,
|
|
52
52
|
error: F
|
|
@@ -66,14 +66,14 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
66
66
|
});
|
|
67
67
|
ie(
|
|
68
68
|
(e) => {
|
|
69
|
-
e.patientUUID === l && e.updatedConcepts.size > 0 && (
|
|
69
|
+
e.patientUUID === l && e.updatedConcepts.size > 0 && (Q(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
70
70
|
},
|
|
71
71
|
[l]
|
|
72
72
|
);
|
|
73
|
-
const
|
|
73
|
+
const G = d(() => !h?.entry || !o?.formName ? [] : h.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => {
|
|
74
74
|
const r = he(t);
|
|
75
75
|
return !r || r.includes(o.formName);
|
|
76
|
-
}), [h, o?.formName]),
|
|
76
|
+
}), [h, o?.formName]), J = d(() => {
|
|
77
77
|
if (F)
|
|
78
78
|
return U(F).message;
|
|
79
79
|
if (N)
|
|
@@ -84,23 +84,23 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
84
84
|
{ key: "recordedBy", header: s("RECORDED_BY") }
|
|
85
85
|
],
|
|
86
86
|
[s]
|
|
87
|
-
),
|
|
87
|
+
), X = d(
|
|
88
88
|
() => [
|
|
89
89
|
{ key: "recordedOn", sortable: !0 },
|
|
90
90
|
{ key: "recordedBy", sortable: !0 }
|
|
91
91
|
],
|
|
92
92
|
[]
|
|
93
93
|
), C = d(() => {
|
|
94
|
-
const e =
|
|
94
|
+
const e = B.reduce(
|
|
95
95
|
(r, a) => {
|
|
96
96
|
const f = a.formName;
|
|
97
97
|
r[f] ??= [];
|
|
98
|
-
const
|
|
98
|
+
const O = a.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
|
|
99
99
|
return r[f].push({
|
|
100
100
|
id: a.encounterUuid,
|
|
101
101
|
formName: a.formName,
|
|
102
102
|
recordedOn: me(a.encounterDateTime, s, !0).formattedResult,
|
|
103
|
-
recordedBy:
|
|
103
|
+
recordedBy: O ?? "--",
|
|
104
104
|
encounterDateTime: a.encounterDateTime,
|
|
105
105
|
encounterUuid: a.encounterUuid
|
|
106
106
|
}), r;
|
|
@@ -111,14 +111,14 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
111
111
|
([r, a]) => ({
|
|
112
112
|
formName: r,
|
|
113
113
|
records: a.sort(
|
|
114
|
-
(f,
|
|
114
|
+
(f, O) => O.encounterDateTime - f.encounterDateTime
|
|
115
115
|
)
|
|
116
116
|
})
|
|
117
117
|
).sort((r, a) => r.formName.localeCompare(a.formName));
|
|
118
|
-
}, [
|
|
119
|
-
|
|
120
|
-
}, []),
|
|
121
|
-
|
|
118
|
+
}, [B, s]), S = b((e) => {
|
|
119
|
+
M(e), I(!0);
|
|
120
|
+
}, []), W = b(() => {
|
|
121
|
+
I(!1), M(null);
|
|
122
122
|
}, []), q = b(
|
|
123
123
|
(e, t) => {
|
|
124
124
|
switch (t) {
|
|
@@ -133,17 +133,17 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
133
133
|
[S]
|
|
134
134
|
);
|
|
135
135
|
return /* @__PURE__ */ Z(ee, { children: [
|
|
136
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v ||
|
|
136
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v || L || C.length === 0 || A ? /* @__PURE__ */ n(
|
|
137
137
|
x,
|
|
138
138
|
{
|
|
139
139
|
headers: _,
|
|
140
140
|
ariaLabel: s("FORMS_HEADING"),
|
|
141
141
|
rows: [],
|
|
142
142
|
loading: v,
|
|
143
|
-
errorStateMessage:
|
|
143
|
+
errorStateMessage: L ? H?.message : void 0,
|
|
144
144
|
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
145
145
|
renderCell: q,
|
|
146
|
-
className:
|
|
146
|
+
className: E.formsTableBody,
|
|
147
147
|
dataTestId: "forms-table"
|
|
148
148
|
}
|
|
149
149
|
) : /* @__PURE__ */ n(ce, { align: "start", children: C.map((e, t) => {
|
|
@@ -152,7 +152,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
152
152
|
ue,
|
|
153
153
|
{
|
|
154
154
|
title: r,
|
|
155
|
-
className:
|
|
155
|
+
className: E.customAccordianItem,
|
|
156
156
|
testId: `accordian-title-${r}`,
|
|
157
157
|
open: t === 0,
|
|
158
158
|
children: /* @__PURE__ */ n(
|
|
@@ -163,10 +163,10 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
163
163
|
rows: a,
|
|
164
164
|
loading: !1,
|
|
165
165
|
errorStateMessage: "",
|
|
166
|
-
sortable:
|
|
166
|
+
sortable: X,
|
|
167
167
|
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
168
168
|
renderCell: q,
|
|
169
|
-
className:
|
|
169
|
+
className: E.formsTableBody,
|
|
170
170
|
dataTestId: `forms-table-${r}`
|
|
171
171
|
}
|
|
172
172
|
)
|
|
@@ -180,7 +180,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
180
180
|
id: "modalIdForActionAreaLayout",
|
|
181
181
|
portalId: "main-display-area",
|
|
182
182
|
open: c,
|
|
183
|
-
onRequestClose:
|
|
183
|
+
onRequestClose: W,
|
|
184
184
|
modalHeading: o.formName,
|
|
185
185
|
modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
|
|
186
186
|
passiveModal: !0,
|
|
@@ -189,10 +189,10 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
189
189
|
children: /* @__PURE__ */ n(
|
|
190
190
|
ye,
|
|
191
191
|
{
|
|
192
|
-
observations:
|
|
192
|
+
observations: G,
|
|
193
193
|
isLoading: j || $,
|
|
194
194
|
isError: V || z,
|
|
195
|
-
errorMessage:
|
|
195
|
+
errorMessage: J,
|
|
196
196
|
emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
|
|
197
197
|
testIdPrefix: o.formName,
|
|
198
198
|
hideThumbnail: P
|
|
@@ -203,5 +203,5 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
|
|
|
203
203
|
] });
|
|
204
204
|
};
|
|
205
205
|
export {
|
|
206
|
-
|
|
206
|
+
Ae as default
|
|
207
207
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { g as K, h as C, t as V, i as Q, j as k, p as q, k as G, l as P, u as j, a as H, U as z, N as J, d as Y, m as W, n as X, s as Z, o as x, b as ee } from "./index-FhPWvTDE.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as oe, useEffect as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
const s = V(t, i, u), o = s.value, a =
|
|
4
|
+
import { useRef as oe, useEffect as N, useMemo as g } from "react";
|
|
5
|
+
import { useTranslation as D } from "react-i18next";
|
|
6
|
+
const B = (t, i, c, d, u, r) => {
|
|
7
|
+
const s = V(t, i, u), o = s.value, a = Q(o);
|
|
8
8
|
let n = o;
|
|
9
|
-
a === "Image" && (n = /* @__PURE__ */
|
|
9
|
+
a === "Image" && (n = /* @__PURE__ */ l(
|
|
10
10
|
q,
|
|
11
11
|
{
|
|
12
12
|
imageSrc: o,
|
|
@@ -14,19 +14,19 @@ const A = (t, i, c, l, u, r) => {
|
|
|
14
14
|
id: `${o}-img`,
|
|
15
15
|
hideThumbnail: r
|
|
16
16
|
}
|
|
17
|
-
)), a === "Video" && (n = /* @__PURE__ */
|
|
17
|
+
)), a === "Video" && (n = /* @__PURE__ */ l(
|
|
18
18
|
G,
|
|
19
19
|
{
|
|
20
20
|
id: `${o}-video`,
|
|
21
21
|
videoSrc: o,
|
|
22
22
|
hideThumbnail: r
|
|
23
23
|
}
|
|
24
|
-
)), a === "PDF" && (n = /* @__PURE__ */
|
|
24
|
+
)), a === "PDF" && (n = /* @__PURE__ */ l(P, { id: `${o}-pdf`, src: o }));
|
|
25
25
|
const b = u("OBSERVATIONS_RECORDED_BY", {
|
|
26
26
|
provider: s.provider
|
|
27
|
-
}), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y =
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
27
|
+
}), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
|
|
28
|
+
return /* @__PURE__ */ l(
|
|
29
|
+
k,
|
|
30
30
|
{
|
|
31
31
|
header: s.header,
|
|
32
32
|
value: n,
|
|
@@ -37,14 +37,14 @@ const A = (t, i, c, l, u, r) => {
|
|
|
37
37
|
},
|
|
38
38
|
`obs-${t.id}`
|
|
39
39
|
);
|
|
40
|
-
}, re = (t, i, c,
|
|
41
|
-
|
|
40
|
+
}, re = (t, i, c, d, u, r, s) => /* @__PURE__ */ l(
|
|
41
|
+
C,
|
|
42
42
|
{
|
|
43
43
|
title: t.display,
|
|
44
|
-
id: `grouped-obs-${t.display}-${
|
|
44
|
+
id: `grouped-obs-${t.display}-${d}`,
|
|
45
45
|
open: c,
|
|
46
46
|
children: t.members?.map(
|
|
47
|
-
(o, a) =>
|
|
47
|
+
(o, a) => B(
|
|
48
48
|
o,
|
|
49
49
|
a,
|
|
50
50
|
u,
|
|
@@ -60,29 +60,29 @@ const A = (t, i, c, l, u, r) => {
|
|
|
60
60
|
title: i = "",
|
|
61
61
|
hideThumbnail: c
|
|
62
62
|
}) => {
|
|
63
|
-
const { t:
|
|
64
|
-
const a = K(r.encounterDetails,
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
-
|
|
63
|
+
const { t: d } = D(), u = (r, s, o) => {
|
|
64
|
+
const a = K(r.encounterDetails, d);
|
|
65
|
+
return /* @__PURE__ */ U(
|
|
66
|
+
C,
|
|
67
67
|
{
|
|
68
68
|
title: a,
|
|
69
69
|
id: `encounter-${r.encounterId}`,
|
|
70
70
|
open: s,
|
|
71
71
|
children: [
|
|
72
72
|
r.observations.map(
|
|
73
|
-
(n, b) =>
|
|
73
|
+
(n, b) => B(
|
|
74
74
|
n,
|
|
75
75
|
b,
|
|
76
76
|
o,
|
|
77
77
|
i,
|
|
78
|
-
|
|
78
|
+
d,
|
|
79
79
|
c
|
|
80
80
|
)
|
|
81
81
|
),
|
|
82
82
|
r.groupedObservations.map(
|
|
83
83
|
(n, b) => re(
|
|
84
84
|
n,
|
|
85
|
-
|
|
85
|
+
d,
|
|
86
86
|
s,
|
|
87
87
|
b,
|
|
88
88
|
o,
|
|
@@ -95,7 +95,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
95
95
|
`encounter-${r.encounterId}`
|
|
96
96
|
);
|
|
97
97
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ l(
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
101
101
|
id: "obs-by-encounter",
|
|
@@ -106,22 +106,22 @@ const A = (t, i, c, l, u, r) => {
|
|
|
106
106
|
)
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
|
-
}, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z",
|
|
109
|
+
}, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", S = {
|
|
110
110
|
observations: ne,
|
|
111
111
|
title: ie
|
|
112
|
-
}, ce = (t) => ["conceptUuid", t],
|
|
112
|
+
}, ce = (t) => ["conceptUuid", t], de = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
|
|
113
113
|
const i = t, {
|
|
114
114
|
conceptNames: c = [],
|
|
115
|
-
conceptUuid:
|
|
115
|
+
conceptUuid: d = [],
|
|
116
116
|
hideThumbnail: u = !1
|
|
117
|
-
} = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = H(), { t: a } =
|
|
117
|
+
} = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = H(), { t: a } = D(), n = te({
|
|
118
118
|
queries: c.map((e) => ({
|
|
119
119
|
queryKey: ce(e),
|
|
120
120
|
queryFn: () => z(e),
|
|
121
121
|
enabled: !!e
|
|
122
122
|
}))
|
|
123
123
|
});
|
|
124
|
-
|
|
124
|
+
N(() => {
|
|
125
125
|
n.forEach((e, v) => {
|
|
126
126
|
if (e.isError && !r.current.has(v)) {
|
|
127
127
|
const R = c[v];
|
|
@@ -133,13 +133,13 @@ const A = (t, i, c, l, u, r) => {
|
|
|
133
133
|
} else e.isError || r.current.delete(v);
|
|
134
134
|
});
|
|
135
135
|
}, [n, c]);
|
|
136
|
-
const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...
|
|
136
|
+
const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
|
|
137
137
|
data: m,
|
|
138
138
|
isLoading: y,
|
|
139
139
|
isError: h,
|
|
140
140
|
refetch: T
|
|
141
141
|
} = se({
|
|
142
|
-
queryKey:
|
|
142
|
+
queryKey: de(s, p),
|
|
143
143
|
queryFn: () => J(s, p),
|
|
144
144
|
enabled: !!s && p.length > 0 && f
|
|
145
145
|
});
|
|
@@ -150,7 +150,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
150
150
|
) && T();
|
|
151
151
|
},
|
|
152
152
|
[s, T]
|
|
153
|
-
),
|
|
153
|
+
), N(() => {
|
|
154
154
|
h && o({
|
|
155
155
|
title: a("ERROR_DEFAULT_TITLE"),
|
|
156
156
|
message: a("ERROR_FETCHING_OBSERVATIONS"),
|
|
@@ -161,40 +161,40 @@ const A = (t, i, c, l, u, r) => {
|
|
|
161
161
|
if (!m) return [];
|
|
162
162
|
const e = W(m), v = X(e);
|
|
163
163
|
return Z(v);
|
|
164
|
-
}, [m]),
|
|
164
|
+
}, [m]), w = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
168
|
-
], I = y || !f, $ = h && f,
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
], I = y || !f, $ = h && f, A = (!m || m.entry?.length === 0 || p.length === 0) && f, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
|
|
169
|
+
return /* @__PURE__ */ U(
|
|
170
170
|
"div",
|
|
171
171
|
{
|
|
172
172
|
id: "observations",
|
|
173
173
|
"data-testid": O ? `observations-${E}` : "observations",
|
|
174
174
|
"aria-label": "observations-aria-label",
|
|
175
|
-
className:
|
|
175
|
+
className: S.observations,
|
|
176
176
|
children: [
|
|
177
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ l(
|
|
178
178
|
x,
|
|
179
179
|
{
|
|
180
180
|
id: "observations-title",
|
|
181
181
|
testId: O ? `observations-title-${E}` : "observations-title",
|
|
182
182
|
title: E,
|
|
183
|
-
className:
|
|
184
|
-
children: /* @__PURE__ */
|
|
183
|
+
className: S.title,
|
|
184
|
+
children: /* @__PURE__ */ l("p", { children: E })
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
M ? /* @__PURE__ */
|
|
187
|
+
M ? /* @__PURE__ */ l(
|
|
188
188
|
ae,
|
|
189
189
|
{
|
|
190
190
|
groupedData: _,
|
|
191
191
|
title: E,
|
|
192
192
|
hideThumbnail: u
|
|
193
193
|
}
|
|
194
|
-
) : /* @__PURE__ */
|
|
194
|
+
) : /* @__PURE__ */ l(
|
|
195
195
|
ee,
|
|
196
196
|
{
|
|
197
|
-
headers:
|
|
197
|
+
headers: w,
|
|
198
198
|
rows: [],
|
|
199
199
|
ariaLabel: a("OBSERVATIONS"),
|
|
200
200
|
loading: I,
|
|
@@ -210,5 +210,5 @@ const A = (t, i, c, l, u, r) => {
|
|
|
210
210
|
export {
|
|
211
211
|
ce as conceptUuidQueryKeys,
|
|
212
212
|
ve as default,
|
|
213
|
-
|
|
213
|
+
de as observationsQueryKeys
|
|
214
214
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PrintOption {
|
|
2
|
+
translationKey: string;
|
|
3
|
+
templateId: string;
|
|
4
|
+
shortcutKey?: string;
|
|
5
|
+
privileges?: string[];
|
|
6
|
+
}
|
|
7
|
+
interface DocumentPrintButtonProps {
|
|
8
|
+
printOptions?: PrintOption[];
|
|
9
|
+
renderContext: Record<string, string>;
|
|
10
|
+
renderData?: Record<string, unknown>;
|
|
11
|
+
size?: 'sm' | 'md' | 'lg';
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
'data-testid'?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DocumentPrintButton: ({ printOptions, renderContext, renderData, size, disabled, "data-testid": dataTestId, }: DocumentPrintButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=DocumentPrintButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentPrintButton.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/DocumentPrintButton.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,UAAU,wBAAwB;IAChC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,mBAAmB,GAAI,yFAOjC,wBAAwB,mDA6D1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface UsePrintDocumentOptions {
|
|
2
|
+
context: Record<string, string>;
|
|
3
|
+
data?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
interface UsePrintDocumentResult {
|
|
6
|
+
isPrinting: boolean;
|
|
7
|
+
triggerPrint: (templateId: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const renderTemplateQueryKey: (templateId: string, context: Record<string, string>, locale: string, data?: Record<string, unknown>) => readonly ["renderTemplate", string, "html", Record<string, string>, string, Record<string, unknown> | undefined];
|
|
10
|
+
export declare function usePrintDocument({ context, data, }: UsePrintDocumentOptions): UsePrintDocumentResult;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=usePrintDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrintDocument.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/usePrintDocument.ts"],"names":[],"mappings":"AAUA,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,sBAAsB,GACjC,YAAY,MAAM,EAClB,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,QAAQ,MAAM,EACd,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,qHAC2C,CAAC;AAE5E,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,IAAI,GACL,EAAE,uBAAuB,GAAG,sBAAsB,CAsHlD"}
|