@bahmni/widgets 0.0.1-dev.372 → 0.0.1-dev.374
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-JhFgVdG6.js → DocumentsTable-C_-YzxGb.js} +9 -9
- package/dist/{FormsTable-bVAqZ7qq.js → FormsTable-_NogPmEX.js} +93 -81
- package/dist/{Observations-BugeqHPC.js → Observations-qZwvlxRo.js} +15 -15
- package/dist/forms/FormsTable.d.ts +1 -4
- package/dist/forms/FormsTable.d.ts.map +1 -1
- package/dist/{index-CtCHmEQX.js → index-D9XqmG48.js} +16180 -16153
- package/dist/index.js +10 -10
- package/dist/observations/utils.d.ts +1 -1
- package/dist/observations/utils.d.ts.map +1 -1
- package/dist/observationsRenderer/ObservationsRenderer.d.ts +1 -0
- package/dist/observationsRenderer/ObservationsRenderer.d.ts.map +1 -1
- package/dist/search/commonSearch/ResultsTable.d.ts.map +1 -1
- package/dist/search/commonSearch/__tests__/__mocks__/resultsTableMocks.d.ts +2 -0
- package/dist/search/commonSearch/__tests__/__mocks__/resultsTableMocks.d.ts.map +1 -1
- package/dist/search/commonSearch/utils.d.ts +1 -0
- package/dist/search/commonSearch/utils.d.ts.map +1 -1
- 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, _ as J, P as Z, x, q as ee, F as te } from "./index-D9XqmG48.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";
|
|
@@ -45,7 +45,7 @@ const Te = [
|
|
|
45
45
|
L(!1), U(null), A(/* @__PURE__ */ new Set());
|
|
46
46
|
}, []), F = _((e) => {
|
|
47
47
|
A((t) => new Set(t).add(e));
|
|
48
|
-
}, []), { data: i, isLoading: q, isError: S, error:
|
|
48
|
+
}, []), { data: i, isLoading: q, isError: S, error: y } = ne({
|
|
49
49
|
queryKey: [
|
|
50
50
|
"documents",
|
|
51
51
|
E,
|
|
@@ -68,18 +68,18 @@ const Te = [
|
|
|
68
68
|
}, [E]), I(() => {
|
|
69
69
|
S && w({
|
|
70
70
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
71
|
-
message:
|
|
71
|
+
message: y?.message ?? "",
|
|
72
72
|
type: "error"
|
|
73
73
|
});
|
|
74
|
-
}, [S,
|
|
74
|
+
}, [S, y, w, o]), I(() => {
|
|
75
75
|
const e = new AbortController();
|
|
76
76
|
return (async () => {
|
|
77
77
|
if (!d || !s) return;
|
|
78
78
|
const a = /* @__PURE__ */ new Set(), g = B(s);
|
|
79
79
|
for (let m = 0; m < g.length; m++) {
|
|
80
|
-
const
|
|
80
|
+
const b = R(g[m].url);
|
|
81
81
|
try {
|
|
82
|
-
(await fetch(
|
|
82
|
+
(await fetch(b, {
|
|
83
83
|
method: "HEAD",
|
|
84
84
|
signal: e.signal
|
|
85
85
|
})).ok || a.add(m);
|
|
@@ -146,7 +146,7 @@ const Te = [
|
|
|
146
146
|
ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
|
|
147
147
|
rows: j,
|
|
148
148
|
loading: q,
|
|
149
|
-
errorStateMessage: S ?
|
|
149
|
+
errorStateMessage: S ? y?.message : null,
|
|
150
150
|
sortable: G,
|
|
151
151
|
emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
|
|
152
152
|
renderCell: Q,
|
|
@@ -170,8 +170,8 @@ 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 = R(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""),
|
|
174
|
-
return a === "#" ||
|
|
173
|
+
const a = R(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
|
|
174
|
+
return a === "#" || b ? /* @__PURE__ */ T(
|
|
175
175
|
"div",
|
|
176
176
|
{
|
|
177
177
|
className: c.attachmentError,
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { u as be,
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { useState as W, useMemo as d, useCallback as
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
formsTableBody:
|
|
8
|
-
modalHeading:
|
|
9
|
-
customAccordianItem:
|
|
10
|
-
},
|
|
11
|
-
episodeOfCareUuids:
|
|
1
|
+
import { jsx as i, jsxs as j, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import { u as be, b as Oe, c as Ne, t as Ee, X as Te, W as Fe, J as Ie, C as ve, p as _e, e as Ae, d as Re, Y as z, x as De, i as G, $ as K, P as Me, q as Q, T as Ce, R as Le, F as Se, O as Be, f as Ue } from "./index-D9XqmG48.js";
|
|
3
|
+
import { useQueryClient as we, useQuery as E } from "@tanstack/react-query";
|
|
4
|
+
import { useState as W, useMemo as d, useCallback as c } from "react";
|
|
5
|
+
import { useTranslation as He } from "react-i18next";
|
|
6
|
+
const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", Pe = "FormsTable-module_customAccordianItem__isszs", T = {
|
|
7
|
+
formsTableBody: ke,
|
|
8
|
+
modalHeading: qe,
|
|
9
|
+
customAccordianItem: Pe
|
|
10
|
+
}, Ve = "startConsultation", Ke = ({
|
|
11
|
+
episodeOfCareUuids: D,
|
|
12
12
|
encounterUuids: m,
|
|
13
13
|
config: Y,
|
|
14
14
|
disableActions: J = !1,
|
|
15
15
|
activeEncounterUuid: y = null
|
|
16
16
|
}) => {
|
|
17
|
-
const { t: n } =
|
|
17
|
+
const { t: n } = He(), u = be(), [g, M] = W(!1), [a, C] = W(null), {
|
|
18
18
|
numberOfVisits: X,
|
|
19
19
|
hideThumbnail: Z = !1,
|
|
20
|
-
forms:
|
|
21
|
-
} = Y ?? {}, ee =
|
|
22
|
-
|
|
23
|
-
), { userPrivileges: O } =
|
|
24
|
-
|
|
20
|
+
forms: b
|
|
21
|
+
} = Y ?? {}, ee = Oe(
|
|
22
|
+
Ue.EDIT_OBSERVATIONS
|
|
23
|
+
), { userPrivileges: O } = Ne(), F = ee && !J && !!y, L = Ee(
|
|
24
|
+
D,
|
|
25
25
|
m
|
|
26
|
-
), re =
|
|
26
|
+
), re = we(), {
|
|
27
27
|
data: S = [],
|
|
28
28
|
isLoading: B,
|
|
29
29
|
isError: U,
|
|
30
30
|
error: te,
|
|
31
31
|
refetch: oe
|
|
32
|
-
} =
|
|
33
|
-
queryKey: ["forms", u,
|
|
32
|
+
} = E({
|
|
33
|
+
queryKey: ["forms", u, D],
|
|
34
34
|
queryFn: () => Te(u, void 0, X),
|
|
35
35
|
enabled: !!u && !L
|
|
36
36
|
}), w = d(() => {
|
|
37
37
|
let e = S;
|
|
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(b) && b.length > 0 && (e = e.filter(
|
|
41
|
+
(r) => b.some((o) => o.toLowerCase() === r.formName.toLowerCase())
|
|
42
42
|
)), e;
|
|
43
|
-
}, [S, m,
|
|
43
|
+
}, [S, m, b]), { data: N = [] } = E({
|
|
44
44
|
queryKey: ["observationForms"],
|
|
45
|
-
queryFn: () =>
|
|
46
|
-
}), H =
|
|
45
|
+
queryFn: () => Fe()
|
|
46
|
+
}), H = c(
|
|
47
47
|
(e) => {
|
|
48
48
|
const r = N.find((t) => t.name === e);
|
|
49
49
|
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
@@ -54,42 +54,42 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
54
54
|
);
|
|
55
55
|
},
|
|
56
56
|
[N, O]
|
|
57
|
-
), f =
|
|
57
|
+
), f = c(
|
|
58
58
|
(e) => !y || e.encounterUuid !== y ? !1 : H(e.formName),
|
|
59
59
|
[y, H]
|
|
60
|
-
), k =
|
|
60
|
+
), k = c(
|
|
61
61
|
(e) => N.find((o) => o.name === e)?.uuid,
|
|
62
62
|
[N]
|
|
63
63
|
), I = d(() => {
|
|
64
64
|
if (a)
|
|
65
65
|
return k(a.formName);
|
|
66
66
|
}, [a, k]), {
|
|
67
|
-
data:
|
|
67
|
+
data: l,
|
|
68
68
|
isLoading: se,
|
|
69
69
|
isError: ae,
|
|
70
70
|
error: v
|
|
71
|
-
} =
|
|
71
|
+
} = E({
|
|
72
72
|
queryKey: ["formMetadata", I],
|
|
73
|
-
queryFn: () =>
|
|
74
|
-
enabled: !!I &&
|
|
73
|
+
queryFn: () => Ie(I),
|
|
74
|
+
enabled: !!I && g
|
|
75
75
|
}), {
|
|
76
76
|
data: _,
|
|
77
77
|
isLoading: ne,
|
|
78
78
|
isError: ie,
|
|
79
79
|
error: A
|
|
80
|
-
} =
|
|
80
|
+
} = E({
|
|
81
81
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
82
|
-
queryFn: () =>
|
|
83
|
-
enabled: !!a?.encounterUuid &&
|
|
82
|
+
queryFn: () => ve(a.encounterUuid),
|
|
83
|
+
enabled: !!a?.encounterUuid && g
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
_e(
|
|
86
86
|
(e) => {
|
|
87
|
-
e.patientUUID === u &&
|
|
87
|
+
e.patientUUID === u && (oe(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
88
88
|
},
|
|
89
89
|
[u]
|
|
90
90
|
);
|
|
91
|
-
const de = d(() => !_?.entry || !a?.formName ? [] : _.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) =>
|
|
92
|
-
if (!
|
|
91
|
+
const de = d(() => !_?.entry || !a?.formName ? [] : _.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => Ae(r) ? Re(r)?.toLowerCase() === a.formName.toLowerCase() : !0), [_, a?.formName]), le = d(() => {
|
|
92
|
+
if (!l?.schema) return;
|
|
93
93
|
const e = [], r = (o) => {
|
|
94
94
|
(o ?? []).forEach((t) => {
|
|
95
95
|
const s = t;
|
|
@@ -97,40 +97,51 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
99
|
return r(
|
|
100
|
-
|
|
100
|
+
l.schema.controls ?? []
|
|
101
101
|
), e.length > 0 ? e : void 0;
|
|
102
|
-
}, [
|
|
103
|
-
if (!
|
|
102
|
+
}, [l]), ce = d(() => {
|
|
103
|
+
if (!l?.schema) return;
|
|
104
104
|
const e = {}, r = (o, t) => {
|
|
105
105
|
for (const s of o)
|
|
106
106
|
if (s.type === "section") {
|
|
107
|
-
const
|
|
108
|
-
r(s.controls ?? [],
|
|
107
|
+
const h = s.label?.value ?? "Section";
|
|
108
|
+
r(s.controls ?? [], h);
|
|
109
109
|
} else
|
|
110
110
|
s.id != null && t && (e[String(s.id)] = t), s.controls && r(s.controls, t);
|
|
111
111
|
};
|
|
112
112
|
return r(
|
|
113
|
-
|
|
113
|
+
l.schema.controls ?? [],
|
|
114
114
|
null
|
|
115
115
|
), Object.keys(e).length > 0 ? e : void 0;
|
|
116
|
-
}, [
|
|
116
|
+
}, [l]), me = d(() => {
|
|
117
|
+
if (!l?.schema) return;
|
|
118
|
+
const e = {}, r = (o) => {
|
|
119
|
+
(o ?? []).forEach((t) => {
|
|
120
|
+
const s = t;
|
|
121
|
+
s.concept?.uuid && s.concept?.datatype && (e[s.concept.uuid] = s.concept.datatype), s.controls && r(s.controls);
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
return r(
|
|
125
|
+
l.schema.controls ?? []
|
|
126
|
+
), Object.keys(e).length > 0 ? e : void 0;
|
|
127
|
+
}, [l]), ue = d(() => {
|
|
117
128
|
if (v)
|
|
118
|
-
return
|
|
129
|
+
return z(v).message;
|
|
119
130
|
if (A)
|
|
120
|
-
return
|
|
121
|
-
}, [v, A]),
|
|
131
|
+
return z(A).message;
|
|
132
|
+
}, [v, A]), p = d(
|
|
122
133
|
() => [
|
|
123
134
|
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
124
135
|
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
125
136
|
],
|
|
126
137
|
[n]
|
|
127
138
|
), q = d(
|
|
128
|
-
() => [...
|
|
129
|
-
[
|
|
130
|
-
),
|
|
131
|
-
(e) => F && e.some((o) => f(o)) ? q :
|
|
132
|
-
[F, f, q,
|
|
133
|
-
),
|
|
139
|
+
() => [...p, { key: "actions", header: n("ACTIONS") }],
|
|
140
|
+
[p, n]
|
|
141
|
+
), fe = c(
|
|
142
|
+
(e) => F && e.some((o) => f(o)) ? q : p,
|
|
143
|
+
[F, f, q, p]
|
|
144
|
+
), pe = p, he = d(
|
|
134
145
|
() => [
|
|
135
146
|
{ key: "recordedOn", sortable: !0 },
|
|
136
147
|
{ key: "recordedBy", sortable: !0 }
|
|
@@ -141,12 +152,12 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
141
152
|
(o, t) => {
|
|
142
153
|
const s = t.formName;
|
|
143
154
|
o[s] ??= [];
|
|
144
|
-
const
|
|
155
|
+
const h = t.providers.map((ye) => ye.providerName).filter(Boolean).join(", ");
|
|
145
156
|
return o[s].push({
|
|
146
157
|
id: t.encounterUuid,
|
|
147
158
|
formName: t.formName,
|
|
148
|
-
recordedOn:
|
|
149
|
-
recordedBy:
|
|
159
|
+
recordedOn: De(t.encounterDateTime, n, !0).formattedResult,
|
|
160
|
+
recordedBy: h ?? "--",
|
|
150
161
|
encounterDateTime: t.encounterDateTime,
|
|
151
162
|
encounterUuid: t.encounterUuid
|
|
152
163
|
}), o;
|
|
@@ -157,17 +168,17 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
157
168
|
([o, t]) => ({
|
|
158
169
|
formName: o,
|
|
159
170
|
records: t.sort(
|
|
160
|
-
(s,
|
|
171
|
+
(s, h) => h.encounterDateTime - s.encounterDateTime
|
|
161
172
|
)
|
|
162
173
|
})
|
|
163
174
|
).sort((o, t) => o.formName.localeCompare(t.formName));
|
|
164
|
-
}, [w, n]), V =
|
|
165
|
-
C(e),
|
|
166
|
-
}, []), x =
|
|
167
|
-
|
|
168
|
-
}, []), R =
|
|
175
|
+
}, [w, n]), V = c((e) => {
|
|
176
|
+
C(e), M(!0);
|
|
177
|
+
}, []), x = c(() => {
|
|
178
|
+
M(!1), C(null);
|
|
179
|
+
}, []), R = c((e) => {
|
|
169
180
|
globalThis.dispatchEvent(
|
|
170
|
-
new CustomEvent(
|
|
181
|
+
new CustomEvent(Ve, {
|
|
171
182
|
detail: {
|
|
172
183
|
editOnly: "observationForms",
|
|
173
184
|
editTitle: "EDIT_OBSERVATION_FORM_TITLE",
|
|
@@ -177,7 +188,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
177
188
|
}
|
|
178
189
|
})
|
|
179
190
|
);
|
|
180
|
-
}, []), $ =
|
|
191
|
+
}, []), $ = c(
|
|
181
192
|
(e, r) => {
|
|
182
193
|
switch (r) {
|
|
183
194
|
case "recordedOn":
|
|
@@ -202,27 +213,27 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
202
213
|
},
|
|
203
214
|
[V, R, f, n]
|
|
204
215
|
);
|
|
205
|
-
return /* @__PURE__ */
|
|
216
|
+
return /* @__PURE__ */ j(ge, { children: [
|
|
206
217
|
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: B || U || P.length === 0 || L ? /* @__PURE__ */ i(
|
|
207
218
|
Q,
|
|
208
219
|
{
|
|
209
|
-
headers:
|
|
220
|
+
headers: pe,
|
|
210
221
|
ariaLabel: n("FORMS_HEADING"),
|
|
211
222
|
rows: [],
|
|
212
223
|
loading: B,
|
|
213
224
|
errorStateMessage: U ? te?.message : void 0,
|
|
214
225
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
215
226
|
renderCell: $,
|
|
216
|
-
className:
|
|
227
|
+
className: T.formsTableBody,
|
|
217
228
|
dataTestId: "forms-table"
|
|
218
229
|
}
|
|
219
|
-
) : /* @__PURE__ */ i(
|
|
220
|
-
const { formName: o, records: t } = e, s =
|
|
230
|
+
) : /* @__PURE__ */ i(Ce, { align: "start", children: P.map((e, r) => {
|
|
231
|
+
const { formName: o, records: t } = e, s = fe(t);
|
|
221
232
|
return /* @__PURE__ */ i(
|
|
222
|
-
|
|
233
|
+
Le,
|
|
223
234
|
{
|
|
224
235
|
title: o,
|
|
225
|
-
className:
|
|
236
|
+
className: T.customAccordianItem,
|
|
226
237
|
testId: `accordian-title-${o}`,
|
|
227
238
|
open: r === 0,
|
|
228
239
|
children: /* @__PURE__ */ i(
|
|
@@ -236,7 +247,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
236
247
|
sortable: he,
|
|
237
248
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
238
249
|
renderCell: $,
|
|
239
|
-
className:
|
|
250
|
+
className: T.formsTableBody,
|
|
240
251
|
dataTestId: `forms-table-${o}`
|
|
241
252
|
}
|
|
242
253
|
)
|
|
@@ -244,14 +255,14 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
244
255
|
o
|
|
245
256
|
);
|
|
246
257
|
}) }) }),
|
|
247
|
-
|
|
248
|
-
|
|
258
|
+
g && a && /* @__PURE__ */ i(
|
|
259
|
+
Se,
|
|
249
260
|
{
|
|
250
261
|
id: "modalIdForActionAreaLayout",
|
|
251
262
|
portalId: "main-display-area",
|
|
252
|
-
open:
|
|
263
|
+
open: g,
|
|
253
264
|
onRequestClose: x,
|
|
254
|
-
modalHeading: /* @__PURE__ */
|
|
265
|
+
modalHeading: /* @__PURE__ */ j("div", { className: T.modalHeading, children: [
|
|
255
266
|
/* @__PURE__ */ i("span", { children: a.formName }),
|
|
256
267
|
F && f(a) && /* @__PURE__ */ i(
|
|
257
268
|
G,
|
|
@@ -272,17 +283,18 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
272
283
|
size: "md",
|
|
273
284
|
testId: "form-details-modal",
|
|
274
285
|
children: /* @__PURE__ */ i(
|
|
275
|
-
|
|
286
|
+
Be,
|
|
276
287
|
{
|
|
277
288
|
observations: de,
|
|
278
289
|
isLoading: se || ne,
|
|
279
290
|
isError: ae || ie,
|
|
280
|
-
errorMessage:
|
|
291
|
+
errorMessage: ue,
|
|
281
292
|
emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
|
|
282
293
|
testIdPrefix: a.formName,
|
|
283
294
|
hideThumbnail: Z,
|
|
284
295
|
controlOrder: le,
|
|
285
|
-
sectionMap: ce
|
|
296
|
+
sectionMap: ce,
|
|
297
|
+
conceptDatatypeMap: me
|
|
286
298
|
}
|
|
287
299
|
)
|
|
288
300
|
}
|
|
@@ -290,5 +302,5 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
290
302
|
] });
|
|
291
303
|
};
|
|
292
304
|
export {
|
|
293
|
-
|
|
305
|
+
Ke as default
|
|
294
306
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as d, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { g as K, h as D, j as V, I as q, k as Q, l as k, r as G, n as H, u as P, a as j, w as z, m as J, p as W, o as Y, s as X, v as Z, y as x, q as ee } from "./index-D9XqmG48.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";
|
|
6
6
|
const B = (t, i, c, l, u, r) => {
|
|
7
|
-
const s =
|
|
7
|
+
const s = V(t, i, u), o = s.value, a = q(o);
|
|
8
8
|
let n = o;
|
|
9
9
|
a === "Image" && (n = /* @__PURE__ */ d(
|
|
10
10
|
k,
|
|
@@ -24,7 +24,7 @@ const B = (t, i, c, l, u, r) => {
|
|
|
24
24
|
)), a === "PDF" && (n = /* @__PURE__ */ d(H, { 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
|
Q,
|
|
30
30
|
{
|
|
@@ -61,7 +61,7 @@ const B = (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 B = (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 B = (t, i, c, l, u, r) => {
|
|
|
158
158
|
});
|
|
159
159
|
}, [h]);
|
|
160
160
|
const I = 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]), A = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
168
|
-
], _ = y || !f, $ = h && f, F = (!
|
|
168
|
+
], _ = 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, w = I.length > 0 && !_ && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
|
|
169
169
|
return /* @__PURE__ */ N(
|
|
170
170
|
"div",
|
|
171
171
|
{
|
|
@@ -184,7 +184,7 @@ const B = (t, i, c, l, u, r) => {
|
|
|
184
184
|
children: /* @__PURE__ */ d("p", { children: E })
|
|
185
185
|
}
|
|
186
186
|
),
|
|
187
|
-
|
|
187
|
+
w ? /* @__PURE__ */ d(
|
|
188
188
|
ae,
|
|
189
189
|
{
|
|
190
190
|
groupedData: I,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { WidgetProps } from '../registry/model';
|
|
3
|
-
/**
|
|
4
|
-
* Component to display patient forms grouped by form name in accordion format
|
|
5
|
-
* Each accordion item contains a SortableDataTable with form records for that form type
|
|
6
|
-
*/
|
|
3
|
+
/** Displays patient forms grouped by form name in accordion format. */
|
|
7
4
|
declare const FormsTable: React.FC<WidgetProps>;
|
|
8
5
|
export default FormsTable;
|
|
9
6
|
//# sourceMappingURL=FormsTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehD
|
|
1
|
+
{"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehD,uEAAuE;AACvE,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8drC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|