@bahmni/widgets 0.0.1-dev.220 → 0.0.1-dev.221
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-CzTsPYJg.js → DocumentsTable-CWnsA1VB.js} +14 -14
- package/dist/{FormsTable-Bj2-Fk7L.js → FormsTable-DyLWyfxB.js} +52 -52
- package/dist/{Observations-iTkADFbN.js → Observations-Diofp2D3.js} +11 -11
- package/dist/{index-CVIZL5V2.js → index-Bf5IwO7Y.js} +1531 -1531
- package/dist/index.js +13 -13
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as s, jsxs as _, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import { u as W, a as X,
|
|
2
|
+
import { u as W, a as X, K as J, r as Z, w as x, b as ee, y as te } from "./index-Bf5IwO7Y.js";
|
|
3
3
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
4
4
|
import { useState as l, useCallback as p, useEffect as N, useMemo as f } from "react";
|
|
5
5
|
import { useTranslation as ae } from "react-i18next";
|
|
@@ -35,14 +35,14 @@ const _e = [
|
|
|
35
35
|
"uploadedBy",
|
|
36
36
|
"action"
|
|
37
37
|
], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ne = ({ config: n, encounterUuids: E }) => {
|
|
38
|
-
const [d,
|
|
38
|
+
const [d, L] = l(!1), [r, M] = l(
|
|
39
39
|
null
|
|
40
40
|
), [P, A] = l(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
), T = W(), { t: o } = ae(), { addNotification:
|
|
43
|
-
|
|
42
|
+
), T = W(), { t: o } = ae(), { addNotification: U } = X(), F = Number(n?.pageSize) || 5, [D, O] = l(1), [m, $] = l(F), [k, C] = l(void 0), b = p((e) => {
|
|
43
|
+
M(e), L(!0);
|
|
44
44
|
}, []), V = p(() => {
|
|
45
|
-
|
|
45
|
+
L(!1), M(null), A(/* @__PURE__ */ new Set());
|
|
46
46
|
}, []), B = p((e) => {
|
|
47
47
|
A((t) => new Set(t).add(e));
|
|
48
48
|
}, []), { data: u, isLoading: z, isError: y, error: S } = ne({
|
|
@@ -66,12 +66,12 @@ const _e = [
|
|
|
66
66
|
}, [u]), N(() => {
|
|
67
67
|
O(1), C(void 0);
|
|
68
68
|
}, [T]), N(() => {
|
|
69
|
-
y &&
|
|
69
|
+
y && U({
|
|
70
70
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
71
71
|
message: S?.message ?? "",
|
|
72
72
|
type: "error"
|
|
73
73
|
});
|
|
74
|
-
}, [y, S,
|
|
74
|
+
}, [y, S, U, o]), N(() => {
|
|
75
75
|
const e = new AbortController();
|
|
76
76
|
return (async () => {
|
|
77
77
|
if (!d || !r) return;
|
|
@@ -83,8 +83,8 @@ const _e = [
|
|
|
83
83
|
method: "HEAD",
|
|
84
84
|
signal: e.signal
|
|
85
85
|
})).ok || a.add(i);
|
|
86
|
-
} catch (
|
|
87
|
-
|
|
86
|
+
} catch (w) {
|
|
87
|
+
w instanceof Error && w.name !== "AbortError" && a.add(i);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
e.signal.aborted || A(a);
|
|
@@ -98,7 +98,7 @@ const _e = [
|
|
|
98
98
|
), g = f(
|
|
99
99
|
() => n?.fields ?? _e,
|
|
100
100
|
[n?.fields]
|
|
101
|
-
),
|
|
101
|
+
), q = f(() => [...u?.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), [u]), K = f(() => he(g, o), [g, o]), G = f(
|
|
102
102
|
() => g.map((e) => ({
|
|
103
103
|
key: e,
|
|
104
104
|
sortable: e !== "action"
|
|
@@ -107,7 +107,7 @@ const _e = [
|
|
|
107
107
|
), h = f(
|
|
108
108
|
() => r ? R(r) : [],
|
|
109
109
|
[r]
|
|
110
|
-
),
|
|
110
|
+
), Y = p(
|
|
111
111
|
(e, t) => {
|
|
112
112
|
switch (t) {
|
|
113
113
|
case "documentIdentifier":
|
|
@@ -142,14 +142,14 @@ const _e = [
|
|
|
142
142
|
/* @__PURE__ */ s("div", { "data-testid": "documents-table", children: /* @__PURE__ */ s(
|
|
143
143
|
ee,
|
|
144
144
|
{
|
|
145
|
-
headers:
|
|
145
|
+
headers: K,
|
|
146
146
|
ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
|
|
147
|
-
rows:
|
|
147
|
+
rows: q,
|
|
148
148
|
loading: z,
|
|
149
149
|
errorStateMessage: y ? S?.message : null,
|
|
150
150
|
sortable: G,
|
|
151
151
|
emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
|
|
152
|
-
renderCell:
|
|
152
|
+
renderCell: Y,
|
|
153
153
|
className: c.documentsTableBody,
|
|
154
154
|
dataTestId: "documents-table",
|
|
155
155
|
pageSize: m,
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { jsx as n, jsxs as X, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { F as ee, u as re, S as te, I as oe, N as ae, P as se, _ as ne, z as de, R as C, w as ie, r as me, b as U, Q as ce, e as le, y as ue, O as fe } from "./index-Bf5IwO7Y.js";
|
|
3
3
|
import { useQueryClient as ye, useQuery as f } from "@tanstack/react-query";
|
|
4
4
|
import { useState as x, useMemo as d, useCallback as y } from "react";
|
|
5
5
|
import { useTranslation as pe } from "react-i18next";
|
|
6
|
-
const be = "_formsTableBody_81hra_1",
|
|
6
|
+
const be = "_formsTableBody_81hra_1", Fe = "_customAccordianItem_81hra_6", v = {
|
|
7
7
|
formsTableBody: be,
|
|
8
|
-
customAccordianItem:
|
|
9
|
-
},
|
|
8
|
+
customAccordianItem: Fe
|
|
9
|
+
}, Ne = (m) => m ? m.extension?.find(
|
|
10
10
|
(p) => p.url === ee
|
|
11
11
|
)?.valueString : void 0, Ie = ({
|
|
12
12
|
episodeOfCareUuids: m,
|
|
13
13
|
encounterUuids: i,
|
|
14
14
|
config: p
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: s } = pe(), c = re(), [l,
|
|
16
|
+
const { t: s } = pe(), c = re(), [l, E] = x(!1), [t, I] = x(null), { numberOfVisits: P, hideThumbnail: k = !1 } = p ?? {}, D = te(
|
|
17
17
|
m,
|
|
18
18
|
i
|
|
19
|
-
),
|
|
19
|
+
), w = ye(), {
|
|
20
20
|
data: b = [],
|
|
21
21
|
isLoading: M,
|
|
22
|
-
isError:
|
|
22
|
+
isError: A,
|
|
23
23
|
error: H,
|
|
24
24
|
refetch: K
|
|
25
25
|
} = f({
|
|
26
26
|
queryKey: ["forms", c, m],
|
|
27
27
|
queryFn: () => oe(c, void 0, P),
|
|
28
28
|
enabled: !!c && !D
|
|
29
|
-
}),
|
|
29
|
+
}), B = d(() => !i || i.length === 0 ? b : b.filter(
|
|
30
30
|
(e) => i.includes(e.encounterUuid)
|
|
31
|
-
), [b, i]), { data:
|
|
31
|
+
), [b, i]), { data: R = [] } = f({
|
|
32
32
|
queryKey: ["observationForms"],
|
|
33
33
|
queryFn: () => ae()
|
|
34
34
|
}), T = y(
|
|
35
|
-
(e) =>
|
|
36
|
-
[
|
|
37
|
-
),
|
|
35
|
+
(e) => R.find((r) => r.name === e)?.uuid,
|
|
36
|
+
[R]
|
|
37
|
+
), F = d(() => {
|
|
38
38
|
if (t)
|
|
39
39
|
return T(t.formName);
|
|
40
40
|
}, [t, T]), {
|
|
41
41
|
isLoading: Q,
|
|
42
|
-
isError:
|
|
43
|
-
error:
|
|
42
|
+
isError: j,
|
|
43
|
+
error: N
|
|
44
44
|
} = f({
|
|
45
|
-
queryKey: ["formMetadata",
|
|
46
|
-
queryFn: () => se(
|
|
47
|
-
enabled: !!
|
|
45
|
+
queryKey: ["formMetadata", F],
|
|
46
|
+
queryFn: () => se(F),
|
|
47
|
+
enabled: !!F && l
|
|
48
48
|
}), {
|
|
49
|
-
data:
|
|
50
|
-
isLoading:
|
|
51
|
-
isError:
|
|
52
|
-
error:
|
|
49
|
+
data: g,
|
|
50
|
+
isLoading: z,
|
|
51
|
+
isError: V,
|
|
52
|
+
error: h
|
|
53
53
|
} = f({
|
|
54
54
|
queryKey: ["formsEncounterFHIR", t?.encounterUuid],
|
|
55
55
|
queryFn: () => ne(t.encounterUuid),
|
|
@@ -57,19 +57,19 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
|
|
|
57
57
|
});
|
|
58
58
|
de(
|
|
59
59
|
(e) => {
|
|
60
|
-
e.patientUUID === c && e.updatedConcepts.size > 0 && (K(),
|
|
60
|
+
e.patientUUID === c && e.updatedConcepts.size > 0 && (K(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
61
61
|
},
|
|
62
62
|
[c]
|
|
63
63
|
);
|
|
64
|
-
const
|
|
65
|
-
const r =
|
|
64
|
+
const $ = d(() => !g?.entry || !t?.formName ? [] : g.entry.filter((a) => a.resource?.resourceType === "Observation").map((a) => a.resource).filter((a) => {
|
|
65
|
+
const r = Ne(a);
|
|
66
66
|
return !r || r.includes(t.formName);
|
|
67
|
-
}), [
|
|
67
|
+
}), [g, t?.formName]), G = d(() => {
|
|
68
|
+
if (N)
|
|
69
|
+
return C(N).message;
|
|
68
70
|
if (h)
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
return q(F).message;
|
|
72
|
-
}, [h, F]), L = d(
|
|
71
|
+
return C(h).message;
|
|
72
|
+
}, [N, h]), _ = d(
|
|
73
73
|
() => [
|
|
74
74
|
{ key: "recordedOn", header: s("RECORDED_ON") },
|
|
75
75
|
{ key: "recordedBy", header: s("RECORDED_BY") }
|
|
@@ -81,17 +81,17 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
|
|
|
81
81
|
{ key: "recordedBy", sortable: !0 }
|
|
82
82
|
],
|
|
83
83
|
[]
|
|
84
|
-
),
|
|
85
|
-
const e =
|
|
84
|
+
), L = d(() => {
|
|
85
|
+
const e = B.reduce(
|
|
86
86
|
(r, o) => {
|
|
87
87
|
const u = o.formName;
|
|
88
88
|
r[u] ??= [];
|
|
89
|
-
const
|
|
89
|
+
const O = o.providers.map((W) => W.providerName).filter(Boolean).join(", ");
|
|
90
90
|
return r[u].push({
|
|
91
91
|
id: o.encounterUuid,
|
|
92
92
|
formName: o.formName,
|
|
93
93
|
recordedOn: ie(o.encounterDateTime, s, !0).formattedResult,
|
|
94
|
-
recordedBy:
|
|
94
|
+
recordedBy: O ?? "--",
|
|
95
95
|
encounterDateTime: o.encounterDateTime,
|
|
96
96
|
encounterUuid: o.encounterUuid
|
|
97
97
|
}), r;
|
|
@@ -102,15 +102,15 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
|
|
|
102
102
|
([r, o]) => ({
|
|
103
103
|
formName: r,
|
|
104
104
|
records: o.sort(
|
|
105
|
-
(u,
|
|
105
|
+
(u, O) => O.encounterDateTime - u.encounterDateTime
|
|
106
106
|
)
|
|
107
107
|
})
|
|
108
108
|
).sort((r, o) => r.formName.localeCompare(o.formName));
|
|
109
|
-
}, [
|
|
110
|
-
I(e),
|
|
109
|
+
}, [B, s]), S = y((e) => {
|
|
110
|
+
I(e), E(!0);
|
|
111
111
|
}, []), J = y(() => {
|
|
112
|
-
|
|
113
|
-
}, []),
|
|
112
|
+
E(!1), I(null);
|
|
113
|
+
}, []), q = y(
|
|
114
114
|
(e, a) => {
|
|
115
115
|
switch (a) {
|
|
116
116
|
case "recordedOn":
|
|
@@ -124,40 +124,40 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
|
|
|
124
124
|
[S]
|
|
125
125
|
);
|
|
126
126
|
return /* @__PURE__ */ X(Z, { children: [
|
|
127
|
-
/* @__PURE__ */ n("div", { "data-testid": "forms-table", children: M ||
|
|
127
|
+
/* @__PURE__ */ n("div", { "data-testid": "forms-table", children: M || A || L.length === 0 || D ? /* @__PURE__ */ n(
|
|
128
128
|
U,
|
|
129
129
|
{
|
|
130
|
-
headers:
|
|
130
|
+
headers: _,
|
|
131
131
|
ariaLabel: s("FORMS_HEADING"),
|
|
132
132
|
rows: [],
|
|
133
133
|
loading: M,
|
|
134
|
-
errorStateMessage:
|
|
134
|
+
errorStateMessage: A ? H?.message : void 0,
|
|
135
135
|
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
136
|
-
renderCell:
|
|
137
|
-
className:
|
|
136
|
+
renderCell: q,
|
|
137
|
+
className: v.formsTableBody,
|
|
138
138
|
dataTestId: "forms-table"
|
|
139
139
|
}
|
|
140
|
-
) : /* @__PURE__ */ n(ce, { align: "start", children:
|
|
140
|
+
) : /* @__PURE__ */ n(ce, { align: "start", children: L.map((e, a) => {
|
|
141
141
|
const { formName: r, records: o } = e;
|
|
142
142
|
return /* @__PURE__ */ n(
|
|
143
143
|
le,
|
|
144
144
|
{
|
|
145
145
|
title: r,
|
|
146
|
-
className:
|
|
146
|
+
className: v.customAccordianItem,
|
|
147
147
|
testId: `accordian-title-${r}`,
|
|
148
148
|
open: a === 0,
|
|
149
149
|
children: /* @__PURE__ */ n(
|
|
150
150
|
U,
|
|
151
151
|
{
|
|
152
|
-
headers:
|
|
152
|
+
headers: _,
|
|
153
153
|
ariaLabel: s("FORMS_HEADING"),
|
|
154
154
|
rows: o,
|
|
155
155
|
loading: !1,
|
|
156
156
|
errorStateMessage: "",
|
|
157
157
|
sortable: Y,
|
|
158
158
|
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
159
|
-
renderCell:
|
|
160
|
-
className:
|
|
159
|
+
renderCell: q,
|
|
160
|
+
className: v.formsTableBody,
|
|
161
161
|
dataTestId: `forms-table-${r}`
|
|
162
162
|
}
|
|
163
163
|
)
|
|
@@ -180,10 +180,10 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
|
|
|
180
180
|
children: /* @__PURE__ */ n(
|
|
181
181
|
fe,
|
|
182
182
|
{
|
|
183
|
-
observations:
|
|
184
|
-
isLoading: Q ||
|
|
185
|
-
isError:
|
|
186
|
-
errorMessage:
|
|
183
|
+
observations: $,
|
|
184
|
+
isLoading: Q || z,
|
|
185
|
+
isError: j || V,
|
|
186
|
+
errorMessage: G,
|
|
187
187
|
emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
|
|
188
188
|
testIdPrefix: t.formName,
|
|
189
189
|
hideThumbnail: k
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as l, jsxs as C } from "react/jsx-runtime";
|
|
2
|
-
import { f as k, g as D, t as q,
|
|
2
|
+
import { f as k, g as D, t as q, c as w, l as K, M as Q, V as P, E as G, u as j, a as z, d as H, h as Y, z as J, i as W, j as X, s as Z, k as x, b as ee } from "./index-Bf5IwO7Y.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as oe, useEffect as N, useMemo as g } from "react";
|
|
5
5
|
import { useTranslation as U } from "react-i18next";
|
|
6
|
-
const
|
|
7
|
-
const s = q(t, i, u), o = s.value, a =
|
|
6
|
+
const B = (t, i, c, d, u, r) => {
|
|
7
|
+
const s = q(t, i, u), o = s.value, a = w(o);
|
|
8
8
|
let n = o;
|
|
9
9
|
a === "Image" && (n = /* @__PURE__ */ l(
|
|
10
10
|
Q,
|
|
@@ -15,13 +15,13 @@ const A = (t, i, c, d, u, r) => {
|
|
|
15
15
|
hideThumbnail: r
|
|
16
16
|
}
|
|
17
17
|
)), a === "Video" && (n = /* @__PURE__ */ l(
|
|
18
|
-
|
|
18
|
+
P,
|
|
19
19
|
{
|
|
20
20
|
id: `${o}-video`,
|
|
21
21
|
videoSrc: o,
|
|
22
22
|
hideThumbnail: r
|
|
23
23
|
}
|
|
24
|
-
)), a === "PDF" && (n = /* @__PURE__ */ l(
|
|
24
|
+
)), a === "PDF" && (n = /* @__PURE__ */ l(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 = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
|
|
@@ -44,7 +44,7 @@ const A = (t, i, c, d, u, r) => {
|
|
|
44
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,
|
|
@@ -70,7 +70,7 @@ const A = (t, i, c, d, u, r) => {
|
|
|
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,
|
|
@@ -114,10 +114,10 @@ const A = (t, i, c, d, u, r) => {
|
|
|
114
114
|
conceptNames: c = [],
|
|
115
115
|
conceptUuid: d = [],
|
|
116
116
|
hideThumbnail: u = !1
|
|
117
|
-
} = i, r = oe(/* @__PURE__ */ new Set()), s =
|
|
117
|
+
} = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = z(), { t: a } = U(), n = te({
|
|
118
118
|
queries: c.map((e) => ({
|
|
119
119
|
queryKey: ce(e),
|
|
120
|
-
queryFn: () =>
|
|
120
|
+
queryFn: () => H(e),
|
|
121
121
|
enabled: !!e
|
|
122
122
|
}))
|
|
123
123
|
});
|
|
@@ -161,7 +161,7 @@ const A = (t, i, c, d, 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]), A = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
@@ -194,7 +194,7 @@ const A = (t, i, c, d, u, r) => {
|
|
|
194
194
|
) : /* @__PURE__ */ l(
|
|
195
195
|
ee,
|
|
196
196
|
{
|
|
197
|
-
headers:
|
|
197
|
+
headers: A,
|
|
198
198
|
rows: [],
|
|
199
199
|
ariaLabel: a("OBSERVATIONS"),
|
|
200
200
|
loading: _,
|