@bahmni/widgets 0.0.1-dev.329 → 0.0.1-dev.330
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-CensDFhN.js → DocumentsTable-Cf3p9347.js} +27 -27
- package/dist/{FormsTable-DnuqfSeq.js → FormsTable-B4_TlgZN.js} +84 -84
- package/dist/{Observations-B6hrSDAh.js → Observations-Dn1nN_ai.js} +15 -15
- package/dist/documentUpload/DocumentUpload.d.ts +5 -0
- package/dist/documentUpload/DocumentUpload.d.ts.map +1 -0
- package/dist/documentUpload/constants.d.ts +3 -0
- package/dist/documentUpload/constants.d.ts.map +1 -0
- package/dist/documentUpload/index.d.ts +5 -0
- package/dist/documentUpload/index.d.ts.map +1 -0
- package/dist/documentUpload/models.d.ts +15 -0
- package/dist/documentUpload/models.d.ts.map +1 -0
- package/dist/documentUpload/renderDocumentTile.d.ts +9 -0
- package/dist/documentUpload/renderDocumentTile.d.ts.map +1 -0
- package/dist/documentUpload/utils.d.ts +2 -0
- package/dist/documentUpload/utils.d.ts.map +1 -0
- package/dist/{index-CRlR0q5_.js → index-CjcMwA1O.js} +59650 -48039
- 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 +37 -35
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as r, jsxs as T, Fragment as
|
|
2
|
-
import { u as
|
|
1
|
+
import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { u as W, a as Z, z as X, Z as J, i as x, j as ee, P as te } from "./index-CjcMwA1O.js";
|
|
3
3
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
4
4
|
import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
|
|
5
5
|
import { useTranslation as ae } from "react-i18next";
|
|
@@ -19,13 +19,13 @@ const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTab
|
|
|
19
19
|
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
20
20
|
attachments: "DOCUMENTS_ATTACHMENTS"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
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, f) {
|
|
26
26
|
return n.map((d) => ({
|
|
27
27
|
key: d,
|
|
28
|
-
header:
|
|
28
|
+
header: f(ie[d])
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
const Te = [
|
|
@@ -34,29 +34,29 @@ const Te = [
|
|
|
34
34
|
"attachments",
|
|
35
35
|
"uploadedOn",
|
|
36
36
|
"uploadedBy"
|
|
37
|
-
], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i,
|
|
37
|
+
], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, P = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
|
|
38
38
|
const [d, L] = l(!1), [s, U] = l(
|
|
39
39
|
null
|
|
40
40
|
), [F, A] = l(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
),
|
|
42
|
+
), E = W(), { t: o } = ae(), { addNotification: w } = Z(), V = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(V), [k, O] = l(void 0), v = _((e) => {
|
|
43
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: i, isLoading:
|
|
48
|
+
}, []), { data: i, isLoading: H, isError: S, error: y } = ne({
|
|
49
49
|
queryKey: [
|
|
50
50
|
"documents",
|
|
51
|
-
f,
|
|
52
51
|
E,
|
|
52
|
+
f,
|
|
53
53
|
N,
|
|
54
54
|
u
|
|
55
55
|
],
|
|
56
|
-
enabled: !!
|
|
56
|
+
enabled: !!E,
|
|
57
57
|
queryFn: () => X(
|
|
58
|
-
f,
|
|
59
58
|
E,
|
|
59
|
+
f,
|
|
60
60
|
u,
|
|
61
61
|
N
|
|
62
62
|
)
|
|
@@ -65,7 +65,7 @@ const Te = [
|
|
|
65
65
|
i && O(i.total);
|
|
66
66
|
}, [i]), I(() => {
|
|
67
67
|
C(1), O(void 0);
|
|
68
|
-
}, [
|
|
68
|
+
}, [E]), I(() => {
|
|
69
69
|
S && w({
|
|
70
70
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
71
71
|
message: y?.message ?? "",
|
|
@@ -75,9 +75,9 @@ const Te = [
|
|
|
75
75
|
const e = new AbortController();
|
|
76
76
|
return (async () => {
|
|
77
77
|
if (!d || !s) return;
|
|
78
|
-
const a = /* @__PURE__ */ new Set(), g =
|
|
78
|
+
const a = /* @__PURE__ */ new Set(), g = P(s);
|
|
79
79
|
for (let m = 0; m < g.length; m++) {
|
|
80
|
-
const b =
|
|
80
|
+
const b = B(g[m].url);
|
|
81
81
|
try {
|
|
82
82
|
(await fetch(b, {
|
|
83
83
|
method: "HEAD",
|
|
@@ -98,16 +98,16 @@ const Te = [
|
|
|
98
98
|
), D = p(
|
|
99
99
|
() => n?.fields ?? Te,
|
|
100
100
|
[n?.fields]
|
|
101
|
-
), q = 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]),
|
|
101
|
+
), q = 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
104
|
sortable: e !== "attachments"
|
|
105
105
|
})),
|
|
106
106
|
[D]
|
|
107
107
|
), h = p(
|
|
108
|
-
() => s ?
|
|
108
|
+
() => s ? P(s) : [],
|
|
109
109
|
[s]
|
|
110
|
-
),
|
|
110
|
+
), Q = _(
|
|
111
111
|
(e, t) => {
|
|
112
112
|
switch (t) {
|
|
113
113
|
case "documentIdentifier":
|
|
@@ -138,18 +138,18 @@ const Te = [
|
|
|
138
138
|
},
|
|
139
139
|
[v, o]
|
|
140
140
|
);
|
|
141
|
-
return /* @__PURE__ */ T(
|
|
141
|
+
return /* @__PURE__ */ T(Y, { children: [
|
|
142
142
|
/* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
|
|
143
143
|
ee,
|
|
144
144
|
{
|
|
145
145
|
headers: K,
|
|
146
146
|
ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
|
|
147
147
|
rows: q,
|
|
148
|
-
loading:
|
|
148
|
+
loading: H,
|
|
149
149
|
errorStateMessage: S ? y?.message : null,
|
|
150
|
-
sortable:
|
|
150
|
+
sortable: G,
|
|
151
151
|
emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
|
|
152
|
-
renderCell:
|
|
152
|
+
renderCell: Q,
|
|
153
153
|
className: c.documentsTableBody,
|
|
154
154
|
dataTestId: "documents-table",
|
|
155
155
|
pageSize: u,
|
|
@@ -164,13 +164,13 @@ const Te = [
|
|
|
164
164
|
id: "modalIdForActionAreaLayout",
|
|
165
165
|
portalId: "main-display-area",
|
|
166
166
|
open: d,
|
|
167
|
-
onRequestClose:
|
|
167
|
+
onRequestClose: z,
|
|
168
168
|
modalHeading: s.documentIdentifier,
|
|
169
169
|
passiveModal: !0,
|
|
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 =
|
|
173
|
+
const a = B(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = F.has(t);
|
|
174
174
|
return a === "#" || b ? /* @__PURE__ */ T(
|
|
175
175
|
"div",
|
|
176
176
|
{
|
|
@@ -203,7 +203,7 @@ const Te = [
|
|
|
203
203
|
src: a,
|
|
204
204
|
alt: s.documentIdentifier,
|
|
205
205
|
className: c.documentImage,
|
|
206
|
-
onError: () =>
|
|
206
|
+
onError: () => R(t)
|
|
207
207
|
}
|
|
208
208
|
) : /* @__PURE__ */ r(
|
|
209
209
|
"iframe",
|
|
@@ -211,7 +211,7 @@ const Te = [
|
|
|
211
211
|
src: g ? `${a}#toolbar=0` : a,
|
|
212
212
|
className: c.documentIframe,
|
|
213
213
|
title: s.documentIdentifier,
|
|
214
|
-
onError: () =>
|
|
214
|
+
onError: () => R(t)
|
|
215
215
|
}
|
|
216
216
|
)
|
|
217
217
|
]
|
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import { useQueryClient as ge, useQuery as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
formsTableBody:
|
|
1
|
+
import { jsx as i, jsxs as oe, Fragment as te } from "react/jsx-runtime";
|
|
2
|
+
import { b as se, u as ae, c as ne, T as de, _ as ie, v as ce, o as le, M as me, q as j, i as ue, Z as fe, j as k, d as ye, R as pe, P as be, O as he } from "./index-CjcMwA1O.js";
|
|
3
|
+
import { useQueryClient as ge, useQuery as b } from "@tanstack/react-query";
|
|
4
|
+
import { useState as x, useMemo as d, useCallback as h } from "react";
|
|
5
|
+
import { useTranslation as Fe } from "react-i18next";
|
|
6
|
+
const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs", E = {
|
|
7
|
+
formsTableBody: Ne,
|
|
8
8
|
customAccordianItem: Oe
|
|
9
|
-
},
|
|
9
|
+
}, ve = (m) => m ? m.extension?.find(
|
|
10
10
|
(g) => g.url === se
|
|
11
|
-
)?.valueString : void 0,
|
|
11
|
+
)?.valueString : void 0, Ae = ({
|
|
12
12
|
episodeOfCareUuids: m,
|
|
13
13
|
encounterUuids: c,
|
|
14
14
|
config: g
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: n } =
|
|
16
|
+
const { t: n } = Fe(), u = ae(), [y, M] = x(!1), [a, _] = x(null), {
|
|
17
17
|
numberOfVisits: P,
|
|
18
18
|
hideThumbnail: w = !1,
|
|
19
|
-
forms:
|
|
20
|
-
} = g ?? {},
|
|
19
|
+
forms: p
|
|
20
|
+
} = g ?? {}, I = ne(
|
|
21
21
|
m,
|
|
22
22
|
c
|
|
23
23
|
), H = ge(), {
|
|
24
|
-
data:
|
|
25
|
-
isLoading:
|
|
26
|
-
isError:
|
|
24
|
+
data: T = [],
|
|
25
|
+
isLoading: A,
|
|
26
|
+
isError: D,
|
|
27
27
|
error: K,
|
|
28
28
|
refetch: V
|
|
29
|
-
} =
|
|
29
|
+
} = b({
|
|
30
30
|
queryKey: ["forms", u, m],
|
|
31
31
|
queryFn: () => de(u, void 0, P),
|
|
32
|
-
enabled: !!u && !
|
|
32
|
+
enabled: !!u && !I
|
|
33
33
|
}), B = d(() => {
|
|
34
|
-
let e =
|
|
34
|
+
let e = T;
|
|
35
35
|
return c && c.length > 0 && (e = e.filter(
|
|
36
|
-
(
|
|
37
|
-
)), Array.isArray(
|
|
38
|
-
(
|
|
36
|
+
(o) => c.includes(o.encounterUuid)
|
|
37
|
+
)), Array.isArray(p) && p.length > 0 && (e = e.filter(
|
|
38
|
+
(o) => p.some((r) => r.toLowerCase() === o.formName.toLowerCase())
|
|
39
39
|
)), e;
|
|
40
|
-
}, [
|
|
40
|
+
}, [T, c, p]), { data: R = [] } = b({
|
|
41
41
|
queryKey: ["observationForms"],
|
|
42
42
|
queryFn: () => ie()
|
|
43
43
|
}), L = h(
|
|
44
|
-
(e) =>
|
|
45
|
-
[
|
|
46
|
-
),
|
|
44
|
+
(e) => R.find((r) => r.name === e)?.uuid,
|
|
45
|
+
[R]
|
|
46
|
+
), F = d(() => {
|
|
47
47
|
if (a)
|
|
48
48
|
return L(a.formName);
|
|
49
49
|
}, [a, L]), {
|
|
50
50
|
data: l,
|
|
51
51
|
isLoading: $,
|
|
52
52
|
isError: z,
|
|
53
|
-
error:
|
|
54
|
-
} =
|
|
55
|
-
queryKey: ["formMetadata",
|
|
56
|
-
queryFn: () => ce(
|
|
57
|
-
enabled: !!
|
|
53
|
+
error: N
|
|
54
|
+
} = b({
|
|
55
|
+
queryKey: ["formMetadata", F],
|
|
56
|
+
queryFn: () => ce(F),
|
|
57
|
+
enabled: !!F && y
|
|
58
58
|
}), {
|
|
59
59
|
data: O,
|
|
60
60
|
isLoading: G,
|
|
61
61
|
isError: Q,
|
|
62
|
-
error:
|
|
63
|
-
} =
|
|
62
|
+
error: v
|
|
63
|
+
} = b({
|
|
64
64
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
65
65
|
queryFn: () => le(a.encounterUuid),
|
|
66
66
|
enabled: !!a?.encounterUuid && y
|
|
@@ -71,40 +71,40 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
71
71
|
},
|
|
72
72
|
[u]
|
|
73
73
|
);
|
|
74
|
-
const
|
|
75
|
-
const r =
|
|
74
|
+
const Z = d(() => !O?.entry || !a?.formName ? [] : O.entry.filter((o) => o.resource?.resourceType === "Observation").map((o) => o.resource).filter((o) => {
|
|
75
|
+
const r = ve(o);
|
|
76
76
|
return !r || r.includes(a.formName);
|
|
77
77
|
}), [O, a?.formName]), Y = d(() => {
|
|
78
78
|
if (!l?.schema) return;
|
|
79
|
-
const e = [],
|
|
80
|
-
(r ?? []).forEach((
|
|
81
|
-
const s =
|
|
82
|
-
s.id != null && e.push(String(s.id)), s.controls &&
|
|
79
|
+
const e = [], o = (r) => {
|
|
80
|
+
(r ?? []).forEach((t) => {
|
|
81
|
+
const s = t;
|
|
82
|
+
s.id != null && e.push(String(s.id)), s.controls && o(s.controls);
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
return
|
|
85
|
+
return o(
|
|
86
86
|
l.schema.controls ?? []
|
|
87
87
|
), e.length > 0 ? e : void 0;
|
|
88
|
-
}, [l]),
|
|
88
|
+
}, [l]), J = d(() => {
|
|
89
89
|
if (!l?.schema) return;
|
|
90
|
-
const e = {},
|
|
90
|
+
const e = {}, o = (r, t) => {
|
|
91
91
|
for (const s of r)
|
|
92
92
|
if (s.type === "section") {
|
|
93
93
|
const f = s.label?.value ?? "Section";
|
|
94
|
-
|
|
94
|
+
o(s.controls ?? [], f);
|
|
95
95
|
} else
|
|
96
|
-
s.id != null &&
|
|
96
|
+
s.id != null && t && (e[String(s.id)] = t), s.controls && o(s.controls, t);
|
|
97
97
|
};
|
|
98
|
-
return
|
|
98
|
+
return o(
|
|
99
99
|
l.schema.controls ?? [],
|
|
100
100
|
null
|
|
101
101
|
), Object.keys(e).length > 0 ? e : void 0;
|
|
102
|
-
}, [l]),
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
107
|
-
}, [
|
|
102
|
+
}, [l]), W = d(() => {
|
|
103
|
+
if (N)
|
|
104
|
+
return j(N).message;
|
|
105
|
+
if (v)
|
|
106
|
+
return j(v).message;
|
|
107
|
+
}, [N, v]), C = d(
|
|
108
108
|
() => [
|
|
109
109
|
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
110
110
|
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
@@ -118,36 +118,36 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
118
118
|
[]
|
|
119
119
|
), S = d(() => {
|
|
120
120
|
const e = B.reduce(
|
|
121
|
-
(r,
|
|
122
|
-
const s =
|
|
121
|
+
(r, t) => {
|
|
122
|
+
const s = t.formName;
|
|
123
123
|
r[s] ??= [];
|
|
124
|
-
const f =
|
|
124
|
+
const f = t.providers.map((re) => re.providerName).filter(Boolean).join(", ");
|
|
125
125
|
return r[s].push({
|
|
126
|
-
id:
|
|
127
|
-
formName:
|
|
128
|
-
recordedOn: ue(
|
|
126
|
+
id: t.encounterUuid,
|
|
127
|
+
formName: t.formName,
|
|
128
|
+
recordedOn: ue(t.encounterDateTime, n, !0).formattedResult,
|
|
129
129
|
recordedBy: f ?? "--",
|
|
130
|
-
encounterDateTime:
|
|
131
|
-
encounterUuid:
|
|
130
|
+
encounterDateTime: t.encounterDateTime,
|
|
131
|
+
encounterUuid: t.encounterUuid
|
|
132
132
|
}), r;
|
|
133
133
|
},
|
|
134
134
|
{}
|
|
135
135
|
);
|
|
136
136
|
return Object.entries(e).map(
|
|
137
|
-
([r,
|
|
137
|
+
([r, t]) => ({
|
|
138
138
|
formName: r,
|
|
139
|
-
records:
|
|
139
|
+
records: t.sort(
|
|
140
140
|
(s, f) => f.encounterDateTime - s.encounterDateTime
|
|
141
141
|
)
|
|
142
142
|
})
|
|
143
|
-
).sort((r,
|
|
143
|
+
).sort((r, t) => r.formName.localeCompare(t.formName));
|
|
144
144
|
}, [B, n]), q = h((e) => {
|
|
145
|
-
|
|
145
|
+
_(e), M(!0);
|
|
146
146
|
}, []), ee = h(() => {
|
|
147
|
-
M(!1),
|
|
147
|
+
M(!1), _(null);
|
|
148
148
|
}, []), U = h(
|
|
149
|
-
(e,
|
|
150
|
-
switch (
|
|
149
|
+
(e, o) => {
|
|
150
|
+
switch (o) {
|
|
151
151
|
case "recordedOn":
|
|
152
152
|
return /* @__PURE__ */ i(fe, { onClick: () => q(e), children: e.recordedOn });
|
|
153
153
|
case "recordedBy":
|
|
@@ -158,41 +158,41 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
158
158
|
},
|
|
159
159
|
[q]
|
|
160
160
|
);
|
|
161
|
-
return /* @__PURE__ */ te
|
|
162
|
-
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children:
|
|
163
|
-
|
|
161
|
+
return /* @__PURE__ */ oe(te, { children: [
|
|
162
|
+
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: A || D || S.length === 0 || I ? /* @__PURE__ */ i(
|
|
163
|
+
k,
|
|
164
164
|
{
|
|
165
165
|
headers: C,
|
|
166
166
|
ariaLabel: n("FORMS_HEADING"),
|
|
167
167
|
rows: [],
|
|
168
|
-
loading:
|
|
169
|
-
errorStateMessage:
|
|
168
|
+
loading: A,
|
|
169
|
+
errorStateMessage: D ? K?.message : void 0,
|
|
170
170
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
171
171
|
renderCell: U,
|
|
172
|
-
className:
|
|
172
|
+
className: E.formsTableBody,
|
|
173
173
|
dataTestId: "forms-table"
|
|
174
174
|
}
|
|
175
|
-
) : /* @__PURE__ */ i(ye, { align: "start", children: S.map((e,
|
|
176
|
-
const { formName: r, records:
|
|
175
|
+
) : /* @__PURE__ */ i(ye, { align: "start", children: S.map((e, o) => {
|
|
176
|
+
const { formName: r, records: t } = e;
|
|
177
177
|
return /* @__PURE__ */ i(
|
|
178
|
-
|
|
178
|
+
pe,
|
|
179
179
|
{
|
|
180
180
|
title: r,
|
|
181
|
-
className:
|
|
181
|
+
className: E.customAccordianItem,
|
|
182
182
|
testId: `accordian-title-${r}`,
|
|
183
|
-
open:
|
|
183
|
+
open: o === 0,
|
|
184
184
|
children: /* @__PURE__ */ i(
|
|
185
|
-
|
|
185
|
+
k,
|
|
186
186
|
{
|
|
187
187
|
headers: C,
|
|
188
188
|
ariaLabel: n("FORMS_HEADING"),
|
|
189
|
-
rows:
|
|
189
|
+
rows: t,
|
|
190
190
|
loading: !1,
|
|
191
191
|
errorStateMessage: "",
|
|
192
192
|
sortable: X,
|
|
193
193
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
194
194
|
renderCell: U,
|
|
195
|
-
className:
|
|
195
|
+
className: E.formsTableBody,
|
|
196
196
|
dataTestId: `forms-table-${r}`
|
|
197
197
|
}
|
|
198
198
|
)
|
|
@@ -201,7 +201,7 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
201
201
|
);
|
|
202
202
|
}) }) }),
|
|
203
203
|
y && a && /* @__PURE__ */ i(
|
|
204
|
-
|
|
204
|
+
be,
|
|
205
205
|
{
|
|
206
206
|
id: "modalIdForActionAreaLayout",
|
|
207
207
|
portalId: "main-display-area",
|
|
@@ -215,15 +215,15 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
215
215
|
children: /* @__PURE__ */ i(
|
|
216
216
|
he,
|
|
217
217
|
{
|
|
218
|
-
observations:
|
|
218
|
+
observations: Z,
|
|
219
219
|
isLoading: $ || G,
|
|
220
220
|
isError: z || Q,
|
|
221
|
-
errorMessage:
|
|
221
|
+
errorMessage: W,
|
|
222
222
|
emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
|
|
223
223
|
testIdPrefix: a.formName,
|
|
224
224
|
hideThumbnail: w,
|
|
225
225
|
controlOrder: Y,
|
|
226
|
-
sectionMap:
|
|
226
|
+
sectionMap: J
|
|
227
227
|
}
|
|
228
228
|
)
|
|
229
229
|
}
|
|
@@ -231,5 +231,5 @@ const Fe = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
231
231
|
] });
|
|
232
232
|
};
|
|
233
233
|
export {
|
|
234
|
-
|
|
234
|
+
Ae as default
|
|
235
235
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as d, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { f as H, J as D, t as K, s as V, F as k, X as w, e as j, Q as q, u as G, a as P, g as z, h as J, M as X, k as Y, l as W, m as Z, n as x, j as ee } from "./index-CjcMwA1O.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as oe, useEffect as S, useMemo as g } from "react";
|
|
5
5
|
import { useTranslation as U } from "react-i18next";
|
|
@@ -7,7 +7,7 @@ const F = (t, i, c, l, u, r) => {
|
|
|
7
7
|
const s = K(t, i, u), o = s.value, a = V(o);
|
|
8
8
|
let n = o;
|
|
9
9
|
a === "Image" && (n = /* @__PURE__ */ d(
|
|
10
|
-
|
|
10
|
+
w,
|
|
11
11
|
{
|
|
12
12
|
imageSrc: o,
|
|
13
13
|
alt: o,
|
|
@@ -24,9 +24,9 @@ const F = (t, i, c, l, u, r) => {
|
|
|
24
24
|
)), a === "PDF" && (n = /* @__PURE__ */ d(q, { id: `${o}-pdf`, src: o }));
|
|
25
25
|
const b = u("OBSERVATIONS_RECORDED_BY", {
|
|
26
26
|
provider: s.provider
|
|
27
|
-
}),
|
|
27
|
+
}), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
|
|
28
28
|
return /* @__PURE__ */ d(
|
|
29
|
-
|
|
29
|
+
k,
|
|
30
30
|
{
|
|
31
31
|
header: s.header,
|
|
32
32
|
value: n,
|
|
@@ -117,7 +117,7 @@ const F = (t, i, c, l, u, r) => {
|
|
|
117
117
|
} = i, r = oe(/* @__PURE__ */ new Set()), s = G(), { addNotification: o } = P(), { t: a } = U(), n = te({
|
|
118
118
|
queries: c.map((e) => ({
|
|
119
119
|
queryKey: ce(e),
|
|
120
|
-
queryFn: () =>
|
|
120
|
+
queryFn: () => z(e),
|
|
121
121
|
enabled: !!e
|
|
122
122
|
}))
|
|
123
123
|
});
|
|
@@ -133,20 +133,20 @@ const F = (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]),
|
|
137
|
-
data:
|
|
136
|
+
const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
|
|
137
|
+
data: p,
|
|
138
138
|
isLoading: y,
|
|
139
139
|
isError: h,
|
|
140
140
|
refetch: T
|
|
141
141
|
} = se({
|
|
142
|
-
queryKey: le(s,
|
|
143
|
-
queryFn: () =>
|
|
144
|
-
enabled: !!s &&
|
|
142
|
+
queryKey: le(s, m),
|
|
143
|
+
queryFn: () => J(s, m),
|
|
144
|
+
enabled: !!s && m.length > 0 && f
|
|
145
145
|
});
|
|
146
146
|
X(
|
|
147
147
|
(e) => {
|
|
148
148
|
e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
149
|
-
(R) =>
|
|
149
|
+
(R) => m.includes(R)
|
|
150
150
|
) && T();
|
|
151
151
|
},
|
|
152
152
|
[s, T]
|
|
@@ -158,14 +158,14 @@ const F = (t, i, c, l, u, r) => {
|
|
|
158
158
|
});
|
|
159
159
|
}, [h]);
|
|
160
160
|
const _ = g(() => {
|
|
161
|
-
if (!
|
|
162
|
-
const e = Y(
|
|
161
|
+
if (!p) return [];
|
|
162
|
+
const e = Y(p), v = W(e);
|
|
163
163
|
return Z(v);
|
|
164
|
-
}, [
|
|
164
|
+
}, [p]), B = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
168
|
-
], I = y || !f, $ = h && f, A = (!
|
|
168
|
+
], I = y || !f, $ = h && f, A = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = A ? a("NO_OBSERVATIONS_FOUND") : void 0, Q = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
|
|
169
169
|
return /* @__PURE__ */ N(
|
|
170
170
|
"div",
|
|
171
171
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAaA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAMhD,OAAO,EAAE,mBAAmB,EAAmB,MAAM,UAAU,CAAC;AAIhE,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoOxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/documentUpload/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,oCAAoC,CAAC;AAGnE,eAAO,MAAM,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DocumentUpload } from './DocumentUpload';
|
|
2
|
+
export { renderDocumentTile } from './renderDocumentTile';
|
|
3
|
+
export type { DocumentTileData } from './renderDocumentTile';
|
|
4
|
+
export type { DocumentUploadProps, DocumentSaveTarget } from './models';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DocumentSaveTarget, DocumentType } from '@bahmni/services';
|
|
2
|
+
export type { DocumentSaveTarget } from '@bahmni/services';
|
|
3
|
+
export interface DocumentUploadProps {
|
|
4
|
+
patientUuid: string;
|
|
5
|
+
encounterTypeName: string;
|
|
6
|
+
saveTarget: DocumentSaveTarget;
|
|
7
|
+
documentTypes?: DocumentType[];
|
|
8
|
+
onSaved?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface PendingDocument {
|
|
11
|
+
url: string;
|
|
12
|
+
fileName: string;
|
|
13
|
+
contentType: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/documentUpload/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGzE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAGD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface DocumentTileData {
|
|
3
|
+
id: string;
|
|
4
|
+
src: string;
|
|
5
|
+
title: string;
|
|
6
|
+
contentType?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const renderDocumentTile: ({ id, src, title, contentType, }: DocumentTileData) => React.ReactElement;
|
|
9
|
+
//# sourceMappingURL=renderDocumentTile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderDocumentTile.d.ts","sourceRoot":"","sources":["../../src/documentUpload/renderDocumentTile.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,GAAI,kCAKhC,gBAAgB,KAAG,KAAK,CAAC,YAS3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documentUpload/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,OAGtB,CAAC"}
|