@bahmni/widgets 0.0.1-dev.353 → 0.0.1-dev.355
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-p7Ej5GwL.js → DocumentsTable-CKkxbW5w.js} +9 -9
- package/dist/{FormsTable-BVNSQ0P5.js → FormsTable-B0vdQFeN.js} +40 -40
- package/dist/{Observations-Df0jPwCW.js → Observations-Bn8LFwHv.js} +15 -15
- package/dist/{index-IER0qVSw.js → index-HBLJUkwg.js} +437 -442
- package/dist/index.js +12 -12
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { u as W, a as X,
|
|
2
|
+
import { u as W, a as X, m as J, B as Z, N as x, q as ee, F as te } from "./index-HBLJUkwg.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";
|
|
@@ -37,20 +37,20 @@ const Te = [
|
|
|
37
37
|
], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (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
|
-
), [P,
|
|
40
|
+
), [P, N] = l(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
), E = W(), { t: o } = ae(), { addNotification: w } = X(), V = Number(n?.pageSize) || 5, [
|
|
42
|
+
), E = W(), { t: o } = ae(), { addNotification: w } = X(), V = Number(n?.pageSize) || 5, [A, C] = l(1), [u, $] = l(V), [k, O] = l(void 0), v = _((e) => {
|
|
43
43
|
U(e), L(!0);
|
|
44
44
|
}, []), H = _(() => {
|
|
45
|
-
L(!1), U(null),
|
|
45
|
+
L(!1), U(null), N(/* @__PURE__ */ new Set());
|
|
46
46
|
}, []), B = _((e) => {
|
|
47
|
-
|
|
47
|
+
N((t) => new Set(t).add(e));
|
|
48
48
|
}, []), { data: i, isLoading: q, isError: S, error: y } = ne({
|
|
49
49
|
queryKey: [
|
|
50
50
|
"documents",
|
|
51
51
|
E,
|
|
52
52
|
f,
|
|
53
|
-
|
|
53
|
+
A,
|
|
54
54
|
u
|
|
55
55
|
],
|
|
56
56
|
enabled: !!E,
|
|
@@ -58,7 +58,7 @@ const Te = [
|
|
|
58
58
|
E,
|
|
59
59
|
f,
|
|
60
60
|
u,
|
|
61
|
-
|
|
61
|
+
A
|
|
62
62
|
)
|
|
63
63
|
});
|
|
64
64
|
I(() => {
|
|
@@ -87,7 +87,7 @@ const Te = [
|
|
|
87
87
|
M instanceof Error && M.name !== "AbortError" && a.add(m);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
e.signal.aborted ||
|
|
90
|
+
e.signal.aborted || N(a);
|
|
91
91
|
})(), () => e.abort();
|
|
92
92
|
}, [d, s]);
|
|
93
93
|
const z = _(
|
|
@@ -154,7 +154,7 @@ const Te = [
|
|
|
154
154
|
dataTestId: "documents-table",
|
|
155
155
|
pageSize: u,
|
|
156
156
|
totalItems: k,
|
|
157
|
-
page:
|
|
157
|
+
page: A,
|
|
158
158
|
onPageChange: z
|
|
159
159
|
}
|
|
160
160
|
) }),
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { u as ye, b as
|
|
1
|
+
import { jsx as i, jsxs as G, Fragment as be } from "react/jsx-runtime";
|
|
2
|
+
import { u as ye, b as Ne, c as pe, W as Oe, G as Te, d as Ee, z as Fe, A as Ie, i as ve, e as Ae, f as _e, Y as x, N as Re, l as j, $ as K, B as Me, q as Q, T as Be, R as De, F as Ce, O as Le, C as Se } from "./index-HBLJUkwg.js";
|
|
3
3
|
import { useQueryClient as Ue, useQuery as T } from "@tanstack/react-query";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as W, useMemo as d, useCallback as l } from "react";
|
|
5
5
|
import { useTranslation as we } from "react-i18next";
|
|
6
6
|
const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", E = {
|
|
7
7
|
formsTableBody: He,
|
|
8
8
|
modalHeading: ke,
|
|
9
9
|
customAccordianItem: qe
|
|
10
10
|
}, Pe = "startConsultation", je = ({
|
|
11
|
-
episodeOfCareUuids:
|
|
11
|
+
episodeOfCareUuids: M,
|
|
12
12
|
encounterUuids: m,
|
|
13
|
-
config:
|
|
13
|
+
config: Y,
|
|
14
14
|
disableActions: J = !1,
|
|
15
15
|
activeEncounterUuid: b = null
|
|
16
16
|
}) => {
|
|
17
|
-
const { t: n } = we(), u = ye(), [y,
|
|
17
|
+
const { t: n } = we(), u = ye(), [y, B] = W(!1), [a, D] = W(null), {
|
|
18
18
|
numberOfVisits: X,
|
|
19
19
|
hideThumbnail: Z = !1,
|
|
20
|
-
forms:
|
|
21
|
-
} =
|
|
20
|
+
forms: N
|
|
21
|
+
} = Y ?? {}, ee = Ne(
|
|
22
22
|
Se.EDIT_OBSERVATIONS
|
|
23
|
-
), { userPrivileges:
|
|
24
|
-
|
|
23
|
+
), { userPrivileges: p } = pe(), F = ee && !J && !!b, C = Oe(
|
|
24
|
+
M,
|
|
25
25
|
m
|
|
26
26
|
), re = Ue(), {
|
|
27
27
|
data: L = [],
|
|
@@ -30,36 +30,36 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
30
30
|
error: te,
|
|
31
31
|
refetch: oe
|
|
32
32
|
} = T({
|
|
33
|
-
queryKey: ["forms", u,
|
|
33
|
+
queryKey: ["forms", u, M],
|
|
34
34
|
queryFn: () => Te(u, void 0, X),
|
|
35
35
|
enabled: !!u && !C
|
|
36
36
|
}), w = d(() => {
|
|
37
37
|
let e = L;
|
|
38
38
|
return m && m.length > 0 && (e = e.filter(
|
|
39
39
|
(r) => m.includes(r.encounterUuid)
|
|
40
|
-
)), Array.isArray(
|
|
41
|
-
(r) =>
|
|
40
|
+
)), Array.isArray(N) && N.length > 0 && (e = e.filter(
|
|
41
|
+
(r) => N.some((o) => o.toLowerCase() === r.formName.toLowerCase())
|
|
42
42
|
)), e;
|
|
43
|
-
}, [L, m,
|
|
43
|
+
}, [L, m, N]), { data: O = [] } = T({
|
|
44
44
|
queryKey: ["observationForms"],
|
|
45
45
|
queryFn: () => Ee()
|
|
46
46
|
}), H = l(
|
|
47
47
|
(e) => {
|
|
48
|
-
const r =
|
|
48
|
+
const r = O.find((t) => t.name === e);
|
|
49
49
|
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
50
|
-
if (!
|
|
51
|
-
const o = new Set(
|
|
50
|
+
if (!p || p.length === 0) return !1;
|
|
51
|
+
const o = new Set(p.map((t) => t.name));
|
|
52
52
|
return r.privileges.some(
|
|
53
53
|
(t) => o.has(t.privilegeName) && t.editable
|
|
54
54
|
);
|
|
55
55
|
},
|
|
56
|
-
[
|
|
56
|
+
[O, p]
|
|
57
57
|
), f = l(
|
|
58
58
|
(e) => !b || e.encounterUuid !== b ? !1 : H(e.formName),
|
|
59
59
|
[b, H]
|
|
60
60
|
), k = l(
|
|
61
|
-
(e) =>
|
|
62
|
-
[
|
|
61
|
+
(e) => O.find((o) => o.name === e)?.uuid,
|
|
62
|
+
[O]
|
|
63
63
|
), I = d(() => {
|
|
64
64
|
if (a)
|
|
65
65
|
return k(a.formName);
|
|
@@ -73,10 +73,10 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
73
73
|
queryFn: () => Fe(I),
|
|
74
74
|
enabled: !!I && y
|
|
75
75
|
}), {
|
|
76
|
-
data:
|
|
76
|
+
data: A,
|
|
77
77
|
isLoading: ne,
|
|
78
78
|
isError: ie,
|
|
79
|
-
error:
|
|
79
|
+
error: _
|
|
80
80
|
} = T({
|
|
81
81
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
82
82
|
queryFn: () => Ie(a.encounterUuid),
|
|
@@ -88,7 +88,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
88
88
|
},
|
|
89
89
|
[u]
|
|
90
90
|
);
|
|
91
|
-
const de = d(() => !
|
|
91
|
+
const de = d(() => !A?.entry || !a?.formName ? [] : A.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => Ae(r) ? _e(r)?.toLowerCase() === a.formName.toLowerCase() : !0), [A, a?.formName]), le = d(() => {
|
|
92
92
|
if (!c?.schema) return;
|
|
93
93
|
const e = [], r = (o) => {
|
|
94
94
|
(o ?? []).forEach((t) => {
|
|
@@ -115,10 +115,10 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
115
115
|
), Object.keys(e).length > 0 ? e : void 0;
|
|
116
116
|
}, [c]), me = d(() => {
|
|
117
117
|
if (v)
|
|
118
|
-
return
|
|
119
|
-
if (
|
|
120
|
-
return
|
|
121
|
-
}, [v,
|
|
118
|
+
return x(v).message;
|
|
119
|
+
if (_)
|
|
120
|
+
return x(_).message;
|
|
121
|
+
}, [v, _]), h = d(
|
|
122
122
|
() => [
|
|
123
123
|
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
124
124
|
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
@@ -162,9 +162,9 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
162
162
|
})
|
|
163
163
|
).sort((o, t) => o.formName.localeCompare(t.formName));
|
|
164
164
|
}, [w, n]), V = l((e) => {
|
|
165
|
-
|
|
166
|
-
}, []),
|
|
167
|
-
|
|
165
|
+
D(e), B(!0);
|
|
166
|
+
}, []), z = l(() => {
|
|
167
|
+
B(!1), D(null);
|
|
168
168
|
}, []), R = l((e) => {
|
|
169
169
|
globalThis.dispatchEvent(
|
|
170
170
|
new CustomEvent(Pe, {
|
|
@@ -177,11 +177,11 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
177
177
|
}
|
|
178
178
|
})
|
|
179
179
|
);
|
|
180
|
-
}, []),
|
|
180
|
+
}, []), $ = l(
|
|
181
181
|
(e, r) => {
|
|
182
182
|
switch (r) {
|
|
183
183
|
case "recordedOn":
|
|
184
|
-
return /* @__PURE__ */ i(
|
|
184
|
+
return /* @__PURE__ */ i(Me, { onClick: () => V(e), children: e.recordedOn });
|
|
185
185
|
case "recordedBy":
|
|
186
186
|
return e.recordedBy;
|
|
187
187
|
case "actions":
|
|
@@ -202,7 +202,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
202
202
|
},
|
|
203
203
|
[V, R, f, n]
|
|
204
204
|
);
|
|
205
|
-
return /* @__PURE__ */
|
|
205
|
+
return /* @__PURE__ */ G(be, { children: [
|
|
206
206
|
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || U || P.length === 0 || C ? /* @__PURE__ */ i(
|
|
207
207
|
Q,
|
|
208
208
|
{
|
|
@@ -212,14 +212,14 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
212
212
|
loading: S,
|
|
213
213
|
errorStateMessage: U ? te?.message : void 0,
|
|
214
214
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
215
|
-
renderCell:
|
|
215
|
+
renderCell: $,
|
|
216
216
|
className: E.formsTableBody,
|
|
217
217
|
dataTestId: "forms-table"
|
|
218
218
|
}
|
|
219
|
-
) : /* @__PURE__ */ i(
|
|
219
|
+
) : /* @__PURE__ */ i(Be, { align: "start", children: P.map((e, r) => {
|
|
220
220
|
const { formName: o, records: t } = e, s = ue(t);
|
|
221
221
|
return /* @__PURE__ */ i(
|
|
222
|
-
|
|
222
|
+
De,
|
|
223
223
|
{
|
|
224
224
|
title: o,
|
|
225
225
|
className: E.customAccordianItem,
|
|
@@ -235,7 +235,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
235
235
|
errorStateMessage: "",
|
|
236
236
|
sortable: he,
|
|
237
237
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
238
|
-
renderCell:
|
|
238
|
+
renderCell: $,
|
|
239
239
|
className: E.formsTableBody,
|
|
240
240
|
dataTestId: `forms-table-${o}`
|
|
241
241
|
}
|
|
@@ -250,8 +250,8 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
250
250
|
id: "modalIdForActionAreaLayout",
|
|
251
251
|
portalId: "main-display-area",
|
|
252
252
|
open: y,
|
|
253
|
-
onRequestClose:
|
|
254
|
-
modalHeading: /* @__PURE__ */
|
|
253
|
+
onRequestClose: z,
|
|
254
|
+
modalHeading: /* @__PURE__ */ G("div", { className: E.modalHeading, children: [
|
|
255
255
|
/* @__PURE__ */ i("span", { children: a.formName }),
|
|
256
256
|
F && f(a) && /* @__PURE__ */ i(
|
|
257
257
|
j,
|
|
@@ -261,7 +261,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
261
261
|
size: "sm",
|
|
262
262
|
testId: `edit-form-modal-${a.encounterUuid}`,
|
|
263
263
|
onClick: () => {
|
|
264
|
-
|
|
264
|
+
z(), R(a);
|
|
265
265
|
},
|
|
266
266
|
children: /* @__PURE__ */ i(K, {})
|
|
267
267
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as d, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { g as K, Q as D, t as V, h as q, j as w, k, n as H, o as G, u as P, a as j, p as z, r as J, i as W, s as Y, v as X, w as Z, x, q as ee } from "./index-HBLJUkwg.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as oe, useEffect as C, useMemo as g } from "react";
|
|
5
5
|
import { useTranslation as U } from "react-i18next";
|
|
@@ -24,7 +24,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
24
24
|
)), a === "PDF" && (n = /* @__PURE__ */ d(G, { id: `${o}-pdf`, src: o }));
|
|
25
25
|
const b = u("OBSERVATIONS_RECORDED_BY", {
|
|
26
26
|
provider: s.provider
|
|
27
|
-
}),
|
|
27
|
+
}), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
|
|
28
28
|
return /* @__PURE__ */ d(
|
|
29
29
|
w,
|
|
30
30
|
{
|
|
@@ -61,7 +61,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
61
61
|
hideThumbnail: c
|
|
62
62
|
}) => {
|
|
63
63
|
const { t: l } = U(), u = (r, s, o) => {
|
|
64
|
-
const a =
|
|
64
|
+
const a = K(r.encounterDetails, l);
|
|
65
65
|
return /* @__PURE__ */ N(
|
|
66
66
|
D,
|
|
67
67
|
{
|
|
@@ -133,20 +133,20 @@ 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]),
|
|
137
|
-
data:
|
|
136
|
+
const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
|
|
137
|
+
data: m,
|
|
138
138
|
isLoading: y,
|
|
139
139
|
isError: h,
|
|
140
140
|
refetch: T
|
|
141
141
|
} = se({
|
|
142
|
-
queryKey: le(s,
|
|
143
|
-
queryFn: () => J(s,
|
|
144
|
-
enabled: !!s &&
|
|
142
|
+
queryKey: le(s, p),
|
|
143
|
+
queryFn: () => J(s, p),
|
|
144
|
+
enabled: !!s && p.length > 0 && f
|
|
145
145
|
});
|
|
146
146
|
W(
|
|
147
147
|
(e) => {
|
|
148
148
|
e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
149
|
-
(R) =>
|
|
149
|
+
(R) => p.includes(R)
|
|
150
150
|
) && T();
|
|
151
151
|
},
|
|
152
152
|
[s, T]
|
|
@@ -158,14 +158,14 @@ const A = (t, i, c, l, u, r) => {
|
|
|
158
158
|
});
|
|
159
159
|
}, [h]);
|
|
160
160
|
const _ = g(() => {
|
|
161
|
-
if (!
|
|
162
|
-
const e = Y(
|
|
161
|
+
if (!m) return [];
|
|
162
|
+
const e = Y(m), v = X(e);
|
|
163
163
|
return Z(v);
|
|
164
|
-
}, [
|
|
164
|
+
}, [m]), B = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
168
|
-
],
|
|
168
|
+
], I = y || !f, $ = h && f, F = (!m || m.entry?.length === 0 || p.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = F ? 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
|
{
|
|
@@ -184,7 +184,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
184
184
|
children: /* @__PURE__ */ d("p", { children: E })
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
|
|
187
|
+
Q ? /* @__PURE__ */ d(
|
|
188
188
|
ae,
|
|
189
189
|
{
|
|
190
190
|
groupedData: _,
|
|
@@ -197,7 +197,7 @@ const A = (t, i, c, l, u, r) => {
|
|
|
197
197
|
headers: B,
|
|
198
198
|
rows: [],
|
|
199
199
|
ariaLabel: a("OBSERVATIONS"),
|
|
200
|
-
loading:
|
|
200
|
+
loading: I,
|
|
201
201
|
errorStateMessage: L,
|
|
202
202
|
emptyStateMessage: M,
|
|
203
203
|
dataTestId: "observations-table"
|