@bahmni/clinical-app 0.0.1-dev.107 → 0.0.1-dev.108
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/FormsTable-BhgvFijg-DpVuvYKa.js +318 -0
- package/dist/{LNWAZHJI-DKhyLV_Q.js → LNWAZHJI-CSzbmhBu.js} +5 -5
- package/dist/{MWZ6AO7Z-CwM39bNX.js → MWZ6AO7Z-BHBRGSOE.js} +7 -7
- package/dist/{YPM2AS64-DRx2fnqw.js → YPM2AS64--kUlzXUl.js} +1 -1
- package/dist/{index-DQ_AJQ-E.js → index-jQa2f6J7.js} +55 -60
- package/dist/index.css +1 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/dist/FormsTable-COjqJWg6-DL1-WqVh.js +0 -259
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as _, Fragment as K } from "react/jsx-runtime";
|
|
2
|
-
import { u as Q, C as J, a as p, b as X, V as z, Q as I, A as Y, _ as W, l as Z, E as ee, t as S, G as re, e as ae, X as oe, c as ne, J as te } from "./index-DQ_AJQ-E.js";
|
|
3
|
-
import { useState as U, useMemo as u, useCallback as f } from "react";
|
|
4
|
-
import { createPortal as se } from "react-dom";
|
|
5
|
-
const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie = "_formContent_ua0cn_18", ce = "_formDetailsContainer_ua0cn_25", le = "_observation_ua0cn_30", ue = "_groupContainer_ua0cn_39", _e = "_rowContainer_ua0cn_43", be = "_groupLabel_ua0cn_48", pe = "_rowLabel_ua0cn_58", fe = "_rowValue_ua0cn_67", he = "_groupMembers_ua0cn_75", Ne = "_memberRow_ua0cn_81", ge = "_memberLabel_ua0cn_86", ye = "_memberValue_ua0cn_94", ve = "_commentSection_ua0cn_102", Me = "_commentText_ua0cn_108", Ce = "_nestedGroup_ua0cn_117", Le = "_nestedGroupLabel_ua0cn_124", Ae = "_nestedGroupMembers_ua0cn_133", o = {
|
|
6
|
-
formsTableBody: de,
|
|
7
|
-
customAccordianItem: me,
|
|
8
|
-
formContent: ie,
|
|
9
|
-
formDetailsContainer: ce,
|
|
10
|
-
observation: le,
|
|
11
|
-
groupContainer: ue,
|
|
12
|
-
rowContainer: _e,
|
|
13
|
-
groupLabel: be,
|
|
14
|
-
rowLabel: pe,
|
|
15
|
-
rowValue: fe,
|
|
16
|
-
groupMembers: he,
|
|
17
|
-
memberRow: Ne,
|
|
18
|
-
memberLabel: ge,
|
|
19
|
-
memberValue: ye,
|
|
20
|
-
commentSection: ve,
|
|
21
|
-
commentText: Me,
|
|
22
|
-
nestedGroup: Ce,
|
|
23
|
-
nestedGroupLabel: Le,
|
|
24
|
-
nestedGroupMembers: Ae
|
|
25
|
-
}, V = ({
|
|
26
|
-
member: r,
|
|
27
|
-
depth: m = 0
|
|
28
|
-
}) => {
|
|
29
|
-
const i = r.groupMembers && r.groupMembers.length > 0, n = r.conceptNameToDisplay ?? r.concept?.shortName ?? r.concept?.name;
|
|
30
|
-
return i ? /* @__PURE__ */ _("div", { className: o.nestedGroup, children: [
|
|
31
|
-
/* @__PURE__ */ e(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
className: o.nestedGroupLabel,
|
|
35
|
-
style: { paddingLeft: `${m * 16}px` },
|
|
36
|
-
children: n
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
/* @__PURE__ */ e("div", { className: o.nestedGroupMembers, children: r.groupMembers?.map((c, b) => /* @__PURE__ */ e(
|
|
40
|
-
V,
|
|
41
|
-
{
|
|
42
|
-
member: c,
|
|
43
|
-
depth: m + 1
|
|
44
|
-
},
|
|
45
|
-
`${c.concept.uuid}`
|
|
46
|
-
)) })
|
|
47
|
-
] }) : /* @__PURE__ */ _(
|
|
48
|
-
"div",
|
|
49
|
-
{
|
|
50
|
-
className: o.memberRow,
|
|
51
|
-
style: { paddingLeft: `${m * 16}px` },
|
|
52
|
-
children: [
|
|
53
|
-
/* @__PURE__ */ e("p", { className: o.memberLabel, children: n }),
|
|
54
|
-
/* @__PURE__ */ e("p", { className: o.memberValue, children: r.valueAsString })
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}, Oe = ({
|
|
59
|
-
observation: r,
|
|
60
|
-
index: m
|
|
61
|
-
}) => {
|
|
62
|
-
const i = r.groupMembers && r.groupMembers.length > 0;
|
|
63
|
-
return /* @__PURE__ */ _(
|
|
64
|
-
"div",
|
|
65
|
-
{
|
|
66
|
-
className: o.observation,
|
|
67
|
-
children: [
|
|
68
|
-
/* @__PURE__ */ _(
|
|
69
|
-
"div",
|
|
70
|
-
{
|
|
71
|
-
className: i ? o.groupContainer : o.rowContainer,
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ e("p", { className: i ? o.groupLabel : o.rowLabel, children: r.conceptNameToDisplay }),
|
|
74
|
-
i ? /* @__PURE__ */ e("div", { className: o.groupMembers, children: r.groupMembers?.map((n, c) => /* @__PURE__ */ e(
|
|
75
|
-
V,
|
|
76
|
-
{
|
|
77
|
-
member: n,
|
|
78
|
-
depth: 0
|
|
79
|
-
},
|
|
80
|
-
`${n.concept.uuid}`
|
|
81
|
-
)) }) : /* @__PURE__ */ e("p", { className: o.rowValue, children: r.valueAsString })
|
|
82
|
-
]
|
|
83
|
-
}
|
|
84
|
-
),
|
|
85
|
-
r.comment && /* @__PURE__ */ e("div", { className: o.commentSection, children: /* @__PURE__ */ _("span", { className: o.commentText, children: [
|
|
86
|
-
r.comment,
|
|
87
|
-
r.providers?.[0]?.name && ` - by ${r.providers[0].name}`
|
|
88
|
-
] }) })
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
`${r.concept.uuid}-${m}`
|
|
92
|
-
);
|
|
93
|
-
}, Ge = ({
|
|
94
|
-
episodeOfCareUuids: r,
|
|
95
|
-
encounterUuids: m,
|
|
96
|
-
config: i
|
|
97
|
-
}) => {
|
|
98
|
-
const { t: n } = Q(), c = J(), [b, v] = U(!1), [d, M] = U(null), $ = i?.numberOfVisits, {
|
|
99
|
-
data: h = [],
|
|
100
|
-
isLoading: C,
|
|
101
|
-
isError: L,
|
|
102
|
-
error: q
|
|
103
|
-
} = p({
|
|
104
|
-
queryKey: ["forms", c, r],
|
|
105
|
-
queryFn: () => ae(c, void 0, $),
|
|
106
|
-
enabled: !!c
|
|
107
|
-
}), A = u(() => !m || m.length === 0 ? h : h.filter(
|
|
108
|
-
(a) => m.includes(a.encounterUuid)
|
|
109
|
-
), [h, m]), { data: O = [] } = p({
|
|
110
|
-
queryKey: ["observationForms"],
|
|
111
|
-
queryFn: oe
|
|
112
|
-
}), R = f(
|
|
113
|
-
(a) => O.find((t) => t.name === a)?.uuid,
|
|
114
|
-
[O]
|
|
115
|
-
), N = u(() => {
|
|
116
|
-
if (d)
|
|
117
|
-
return R(d.formName);
|
|
118
|
-
}, [d, R]), {
|
|
119
|
-
data: Re,
|
|
120
|
-
isLoading: x,
|
|
121
|
-
error: T
|
|
122
|
-
} = p({
|
|
123
|
-
queryKey: ["formMetadata", N],
|
|
124
|
-
queryFn: () => ne(N),
|
|
125
|
-
enabled: !!N && b
|
|
126
|
-
}), {
|
|
127
|
-
data: g,
|
|
128
|
-
isLoading: k,
|
|
129
|
-
error: D
|
|
130
|
-
} = p({
|
|
131
|
-
queryKey: ["formsEncounter", d?.encounterUuid],
|
|
132
|
-
queryFn: () => te(d.encounterUuid, !0),
|
|
133
|
-
enabled: !!d?.encounterUuid && b
|
|
134
|
-
}), F = u(() => !g?.observations || !d?.formName ? [] : g.observations.filter(
|
|
135
|
-
(a) => "formFieldPath" in a && typeof a.formFieldPath == "string" && a.formFieldPath.includes(d.formName)
|
|
136
|
-
), [g?.observations, d?.formName]), E = u(
|
|
137
|
-
() => [
|
|
138
|
-
{ key: "recordedOn", header: n("FORM_RECORDED_ON") },
|
|
139
|
-
{ key: "recordedBy", header: n("FORM_RECORDED_BY") }
|
|
140
|
-
],
|
|
141
|
-
[n]
|
|
142
|
-
), H = u(
|
|
143
|
-
() => [
|
|
144
|
-
{ key: "recordedOn", sortable: !0 },
|
|
145
|
-
{ key: "recordedBy", sortable: !0 }
|
|
146
|
-
],
|
|
147
|
-
[]
|
|
148
|
-
), G = u(() => {
|
|
149
|
-
const a = A.reduce(
|
|
150
|
-
(t, s) => {
|
|
151
|
-
const l = s.formName;
|
|
152
|
-
t[l] ??= [];
|
|
153
|
-
const y = s.providers.map((P) => P.providerName).filter(Boolean).join(", ");
|
|
154
|
-
return t[l].push({
|
|
155
|
-
id: s.encounterUuid,
|
|
156
|
-
formName: s.formName,
|
|
157
|
-
recordedOn: X(s.encounterDateTime, n, re).formattedResult,
|
|
158
|
-
recordedBy: y ?? "--",
|
|
159
|
-
encounterDateTime: s.encounterDateTime,
|
|
160
|
-
encounterUuid: s.encounterUuid
|
|
161
|
-
}), t;
|
|
162
|
-
},
|
|
163
|
-
{}
|
|
164
|
-
);
|
|
165
|
-
return Object.entries(a).map(
|
|
166
|
-
([t, s]) => ({
|
|
167
|
-
formName: t,
|
|
168
|
-
records: s.sort(
|
|
169
|
-
(l, y) => y.encounterDateTime - l.encounterDateTime
|
|
170
|
-
)
|
|
171
|
-
})
|
|
172
|
-
).sort((t, s) => t.formName.localeCompare(s.formName));
|
|
173
|
-
}, [A, n]), w = f((a) => {
|
|
174
|
-
M(a), v(!0);
|
|
175
|
-
}, []), j = f(() => {
|
|
176
|
-
v(!1), M(null);
|
|
177
|
-
}, []), B = f(
|
|
178
|
-
(a, t) => {
|
|
179
|
-
switch (t) {
|
|
180
|
-
case "recordedOn":
|
|
181
|
-
return /* @__PURE__ */ e(z, { onClick: () => w(a), children: a.recordedOn });
|
|
182
|
-
case "recordedBy":
|
|
183
|
-
return a.recordedBy;
|
|
184
|
-
default:
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
[w]
|
|
189
|
-
);
|
|
190
|
-
return /* @__PURE__ */ _(K, { children: [
|
|
191
|
-
/* @__PURE__ */ e("div", { "data-testid": "forms-table", children: C || L || G.length === 0 ? /* @__PURE__ */ e(
|
|
192
|
-
I,
|
|
193
|
-
{
|
|
194
|
-
headers: E,
|
|
195
|
-
ariaLabel: n("FORMS_HEADING"),
|
|
196
|
-
rows: [],
|
|
197
|
-
loading: C,
|
|
198
|
-
errorStateMessage: L ? q?.message : void 0,
|
|
199
|
-
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
200
|
-
renderCell: B,
|
|
201
|
-
className: o.formsTableBody,
|
|
202
|
-
"data-testid": "sortable-data-table"
|
|
203
|
-
}
|
|
204
|
-
) : /* @__PURE__ */ e(Y, { align: "start", children: G.map((a, t) => {
|
|
205
|
-
const { formName: s, records: l } = a;
|
|
206
|
-
return /* @__PURE__ */ e(
|
|
207
|
-
W,
|
|
208
|
-
{
|
|
209
|
-
title: s,
|
|
210
|
-
className: o.customAccordianItem,
|
|
211
|
-
testId: "accordian-table-title",
|
|
212
|
-
open: t === 0,
|
|
213
|
-
children: /* @__PURE__ */ e(
|
|
214
|
-
I,
|
|
215
|
-
{
|
|
216
|
-
headers: E,
|
|
217
|
-
ariaLabel: n("FORMS_HEADING"),
|
|
218
|
-
rows: l,
|
|
219
|
-
loading: !1,
|
|
220
|
-
errorStateMessage: "",
|
|
221
|
-
sortable: H,
|
|
222
|
-
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
223
|
-
renderCell: B,
|
|
224
|
-
className: o.formsTableBody,
|
|
225
|
-
"data-testid": "sortable-data-table"
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
},
|
|
229
|
-
s
|
|
230
|
-
);
|
|
231
|
-
}) }) }),
|
|
232
|
-
b && d && se(
|
|
233
|
-
/* @__PURE__ */ e(
|
|
234
|
-
Z,
|
|
235
|
-
{
|
|
236
|
-
open: b,
|
|
237
|
-
onRequestClose: j,
|
|
238
|
-
modalHeading: d.formName,
|
|
239
|
-
modalLabel: `${d.recordedOn} | ${d.recordedBy}`,
|
|
240
|
-
passiveModal: !0,
|
|
241
|
-
size: "md",
|
|
242
|
-
testId: "form-details-modal",
|
|
243
|
-
children: /* @__PURE__ */ e("div", { className: o.formContent, children: x || k ? /* @__PURE__ */ e(ee, { width: "100%", lineCount: 3 }) : T ? /* @__PURE__ */ e("div", { children: S(T).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : D ? /* @__PURE__ */ e("div", { children: S(D).message ?? n("ERROR_FETCHING_FORM_DATA") }) : F.length > 0 ? /* @__PURE__ */ e("div", { className: o.formDetailsContainer, children: F.map((a, t) => /* @__PURE__ */ e(
|
|
244
|
-
Oe,
|
|
245
|
-
{
|
|
246
|
-
observation: a,
|
|
247
|
-
index: t
|
|
248
|
-
},
|
|
249
|
-
`${a.concept.uuid}`
|
|
250
|
-
)) }) : /* @__PURE__ */ e("div", { children: n("NO_FORM_DATA_AVAILABLE") }) })
|
|
251
|
-
}
|
|
252
|
-
),
|
|
253
|
-
document.getElementById("actionAreaLayout") ?? document.body
|
|
254
|
-
)
|
|
255
|
-
] });
|
|
256
|
-
};
|
|
257
|
-
export {
|
|
258
|
-
Ge as default
|
|
259
|
-
};
|