@bahmni/home-app 0.0.1-dev.466 → 0.0.1-dev.472
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-Cdjrw4yW-Bvm9v6KO.js → DocumentsTable-D05Z8kWb-DzQ5bm6e.js} +93 -93
- package/dist/{FormsTable-hfP2wv7g-DaziNRV1.js → FormsTable-DS8v_y5q-BRmywf2r.js} +91 -91
- package/dist/{LNWAZHJI-UvSDfL7G.js → LNWAZHJI-DdY39os1.js} +2 -2
- package/dist/{MWZ6AO7Z-Dce_RT_N.js → MWZ6AO7Z-BUJGOmip.js} +5 -5
- package/dist/Observations-UeuPSqCU-CwJXcB-L.js +246 -0
- package/dist/{YPM2AS64-CTijv4oG.js → YPM2AS64-C8dmMwSG.js} +138 -138
- package/dist/{index-sSTaq7Q4.js → index-BZHrIUJp.js} +11 -11
- package/dist/{index-BXrO9hti.js → index-Cee5-kEn.js} +107158 -85211
- package/dist/index-Dyt17CgX-XFw_K91S.js +6900 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/Observations-B-dxdRlx-BF_q1_kq.js +0 -246
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as n, jsxs as u, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useQuery as
|
|
4
|
-
import { useState as h, useRef as
|
|
5
|
-
const
|
|
6
|
-
documentsTableBody:
|
|
7
|
-
viewAttachmentsLink:
|
|
8
|
-
documentViewerContainer:
|
|
9
|
-
printContainer:
|
|
10
|
-
attachmentItem:
|
|
11
|
-
attachmentCounter:
|
|
12
|
-
attachmentError:
|
|
13
|
-
documentIframe:
|
|
14
|
-
attachmentContent:
|
|
15
|
-
attachmentLoading:
|
|
16
|
-
hiddenWhileLoading:
|
|
2
|
+
import { Q as _e, u as Ee, a as ge, f as Ce, z as Ne, D as fe, $ as Ae, B as v, b as De, Z as Ie, t as be, H as Le, k as ye, c as ve, C as K, d as we, o as Oe, M as Se, R as Me, x as Re, T as Y, e as ee } from "./index-Cee5-kEn.js";
|
|
3
|
+
import { useQuery as Ue } from "@tanstack/react-query";
|
|
4
|
+
import { useState as h, useRef as ke, useEffect as _, useMemo as E, useCallback as T } from "react";
|
|
5
|
+
const Be = "DocumentsTable-module_documentsTableBody__6iR3w", $e = "DocumentsTable-module_viewAttachmentsLink__aQ1on", He = "DocumentsTable-module_documentViewerContainer__F5m8D", xe = "DocumentsTable-module_printContainer__rtarJ", ze = "DocumentsTable-module_attachmentItem__17KA7", Ve = "DocumentsTable-module_attachmentCounter__WFiI3", We = "DocumentsTable-module_attachmentError__RI4U2", Fe = "DocumentsTable-module_documentIframe__ptq5I", Ge = "DocumentsTable-module_attachmentContent__IaCEe", qe = "DocumentsTable-module_attachmentLoading__FAR6p", je = "DocumentsTable-module_hiddenWhileLoading__IxocW", Pe = "DocumentsTable-module_documentImage__KQVgS", Qe = "DocumentsTable-module_header__345GY", Ke = "DocumentsTable-module_documentTypeCell__uWGM8", Ye = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", o = {
|
|
6
|
+
documentsTableBody: Be,
|
|
7
|
+
viewAttachmentsLink: $e,
|
|
8
|
+
documentViewerContainer: He,
|
|
9
|
+
printContainer: xe,
|
|
10
|
+
attachmentItem: ze,
|
|
11
|
+
attachmentCounter: Ve,
|
|
12
|
+
attachmentError: We,
|
|
13
|
+
documentIframe: Fe,
|
|
14
|
+
attachmentContent: Ge,
|
|
15
|
+
attachmentLoading: qe,
|
|
16
|
+
hiddenWhileLoading: je,
|
|
17
17
|
documentImage: Pe,
|
|
18
|
-
header:
|
|
19
|
-
documentTypeCell:
|
|
20
|
-
printAllButton:
|
|
21
|
-
attachmentHeader:
|
|
22
|
-
},
|
|
18
|
+
header: Qe,
|
|
19
|
+
documentTypeCell: Ke,
|
|
20
|
+
printAllButton: Ye,
|
|
21
|
+
attachmentHeader: Ze
|
|
22
|
+
}, Je = "add", Z = "document-print-container", J = () => /* @__PURE__ */ n(ee, {}), Xe = /* @__PURE__ */ new Set([
|
|
23
23
|
"ArrowUp",
|
|
24
24
|
"ArrowDown",
|
|
25
25
|
"PageUp",
|
|
@@ -33,73 +33,73 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
33
33
|
"attachments",
|
|
34
34
|
"uploadedOn",
|
|
35
35
|
"uploadedBy"
|
|
36
|
-
], nt = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, X = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], st = ({ config: l, encounterUuids:
|
|
37
|
-
const [i,
|
|
36
|
+
], nt = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, X = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], st = ({ config: l, encounterUuids: $ }) => {
|
|
37
|
+
const [i, H] = h(!1), [r, x] = h(
|
|
38
38
|
null
|
|
39
|
-
), [
|
|
39
|
+
), [D, w] = h(
|
|
40
40
|
/* @__PURE__ */ new Set()
|
|
41
|
-
), [
|
|
41
|
+
), [I, O] = h(
|
|
42
42
|
/* @__PURE__ */ new Set()
|
|
43
|
-
),
|
|
43
|
+
), N = ke(null), [S, z] = h(
|
|
44
44
|
null
|
|
45
|
-
),
|
|
46
|
-
_(() => () =>
|
|
47
|
-
const g = _e(), { t: a } = Ee(), { addNotification: b } = ge(),
|
|
45
|
+
), V = S !== null;
|
|
46
|
+
_(() => () => N.current?.abort(), []);
|
|
47
|
+
const g = _e(), { t: a } = Ee(), { addNotification: b } = ge(), C = E(
|
|
48
48
|
() => l?.actions?.find(
|
|
49
|
-
(e) => e.type ===
|
|
49
|
+
(e) => e.type === Je
|
|
50
50
|
),
|
|
51
51
|
[l?.actions]
|
|
52
|
-
), te =
|
|
53
|
-
|
|
52
|
+
), te = Ce(C?.requiredPrivilege), ne = !!C && te, ae = Number(l?.pageSize) || 5, [M, R] = h(1), [f, oe] = h(ae), [re, U] = h(void 0), W = T((e) => {
|
|
53
|
+
x(e), H(!0);
|
|
54
54
|
}, []), de = T(() => {
|
|
55
|
-
|
|
56
|
-
}, []), x = T((e) => {
|
|
57
|
-
O((t) => new Set(t).add(e));
|
|
55
|
+
N.current?.abort(), O(/* @__PURE__ */ new Set()), H(!1), x(null), w(/* @__PURE__ */ new Set());
|
|
58
56
|
}, []), F = T((e) => {
|
|
59
|
-
|
|
57
|
+
O((t) => new Set(t).add(e));
|
|
58
|
+
}, []), G = T((e) => {
|
|
59
|
+
w((t) => new Set(t).add(e));
|
|
60
60
|
}, []), se = T(() => {
|
|
61
|
-
|
|
62
|
-
context: { encounterType:
|
|
61
|
+
C && Ne({
|
|
62
|
+
context: { encounterType: C.encounterType },
|
|
63
63
|
action: { type: "create", resourceType: "DocumentReference" }
|
|
64
64
|
});
|
|
65
|
-
}, [
|
|
65
|
+
}, [C]), { data: A, isLoading: le, isError: k, error: B, refetch: q } = Ue({
|
|
66
66
|
queryKey: [
|
|
67
67
|
"documents",
|
|
68
68
|
g,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
$,
|
|
70
|
+
M,
|
|
71
71
|
f
|
|
72
72
|
],
|
|
73
73
|
enabled: !!g,
|
|
74
74
|
queryFn: () => fe(
|
|
75
75
|
g,
|
|
76
|
-
|
|
76
|
+
$,
|
|
77
77
|
f,
|
|
78
|
-
|
|
78
|
+
M
|
|
79
79
|
)
|
|
80
80
|
});
|
|
81
81
|
Ae(
|
|
82
82
|
(e) => {
|
|
83
|
-
e.patientUUID === g && e.updatedResources.documents &&
|
|
83
|
+
e.patientUUID === g && e.updatedResources.documents && q();
|
|
84
84
|
},
|
|
85
|
-
[g,
|
|
85
|
+
[g, q]
|
|
86
86
|
), _(() => {
|
|
87
|
-
A &&
|
|
87
|
+
A && U(A.total);
|
|
88
88
|
}, [A]), _(() => {
|
|
89
|
-
|
|
89
|
+
R(1), U(void 0);
|
|
90
90
|
}, [g]), _(() => {
|
|
91
|
-
|
|
91
|
+
k && b({
|
|
92
92
|
title: a("ERROR_DEFAULT_TITLE"),
|
|
93
|
-
message:
|
|
93
|
+
message: B?.message ?? "",
|
|
94
94
|
type: "error"
|
|
95
95
|
});
|
|
96
|
-
}, [
|
|
96
|
+
}, [k, B, b, a]), _(() => {
|
|
97
97
|
const e = new AbortController();
|
|
98
98
|
return (async () => {
|
|
99
99
|
if (!i || !r) return;
|
|
100
100
|
const t = /* @__PURE__ */ new Set(), d = X(r);
|
|
101
101
|
for (let s = 0; s < d.length; s++) {
|
|
102
|
-
const m =
|
|
102
|
+
const m = v(d[s].url);
|
|
103
103
|
try {
|
|
104
104
|
(await fetch(m, {
|
|
105
105
|
method: "HEAD",
|
|
@@ -109,7 +109,7 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
109
109
|
p instanceof Error && p.name !== "AbortError" && t.add(s);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
e.signal.aborted ||
|
|
112
|
+
e.signal.aborted || w(t);
|
|
113
113
|
})(), () => e.abort();
|
|
114
114
|
}, [i, r]), _(() => {
|
|
115
115
|
if (!i || !r) return;
|
|
@@ -134,23 +134,23 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
134
134
|
}, [i, r]);
|
|
135
135
|
const ce = T(
|
|
136
136
|
(e, t) => {
|
|
137
|
-
t !== f ? (oe(t),
|
|
137
|
+
t !== f ? (oe(t), R(1), U(void 0)) : R(e);
|
|
138
138
|
},
|
|
139
139
|
[f]
|
|
140
|
-
),
|
|
140
|
+
), L = E(
|
|
141
141
|
() => l?.fields ?? tt,
|
|
142
142
|
[l?.fields]
|
|
143
|
-
), ie = E(() => [...A?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [A]), me = E(() =>
|
|
144
|
-
() =>
|
|
143
|
+
), ie = E(() => [...A?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [A]), me = E(() => De(L, a), [L, a]), ue = E(
|
|
144
|
+
() => L.map((e) => ({
|
|
145
145
|
key: e,
|
|
146
146
|
sortable: e !== "attachments"
|
|
147
147
|
})),
|
|
148
|
-
[
|
|
148
|
+
[L]
|
|
149
149
|
), c = E(
|
|
150
150
|
() => r ? X(r) : [],
|
|
151
151
|
[r]
|
|
152
|
-
),
|
|
153
|
-
(e, t) =>
|
|
152
|
+
), j = c.every(
|
|
153
|
+
(e, t) => I.has(t) || D.has(t) || v(e.url) === "#"
|
|
154
154
|
);
|
|
155
155
|
_(() => {
|
|
156
156
|
if (!i || c.length === 0) return;
|
|
@@ -162,12 +162,12 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
162
162
|
}, [i, c]);
|
|
163
163
|
const P = T(
|
|
164
164
|
async (e, t) => {
|
|
165
|
-
if (!r ||
|
|
165
|
+
if (!r || N.current) return;
|
|
166
166
|
const d = new AbortController(), { signal: s } = d;
|
|
167
|
-
|
|
168
|
-
const m = document.getElementById(
|
|
167
|
+
N.current = d, z(t);
|
|
168
|
+
const m = document.getElementById(Z);
|
|
169
169
|
try {
|
|
170
|
-
await
|
|
170
|
+
await Ie(
|
|
171
171
|
e,
|
|
172
172
|
r.documentIdentifier,
|
|
173
173
|
{ container: m, signal: s }
|
|
@@ -179,15 +179,15 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
179
179
|
type: "error"
|
|
180
180
|
});
|
|
181
181
|
} finally {
|
|
182
|
-
|
|
182
|
+
N.current = null, z(null);
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
185
|
[r, b, a]
|
|
186
|
-
),
|
|
186
|
+
), Q = E(
|
|
187
187
|
() => c.filter(
|
|
188
|
-
(e, t) =>
|
|
188
|
+
(e, t) => v(e.url) !== "#" && !D.has(t)
|
|
189
189
|
),
|
|
190
|
-
[c,
|
|
190
|
+
[c, D]
|
|
191
191
|
), he = T(
|
|
192
192
|
(e, t) => {
|
|
193
193
|
switch (t) {
|
|
@@ -207,7 +207,7 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
207
207
|
)
|
|
208
208
|
] });
|
|
209
209
|
case "uploadedOn":
|
|
210
|
-
return
|
|
210
|
+
return Le(
|
|
211
211
|
e.uploadedOn,
|
|
212
212
|
a,
|
|
213
213
|
!0
|
|
@@ -218,7 +218,7 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
218
218
|
return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ n(
|
|
219
219
|
be,
|
|
220
220
|
{
|
|
221
|
-
onClick: () =>
|
|
221
|
+
onClick: () => W(e),
|
|
222
222
|
className: o.viewAttachmentsLink,
|
|
223
223
|
"data-testid": `view-attachments-${e.id}`,
|
|
224
224
|
children: a("DOCUMENTS_VIEW_ATTACHMENTS")
|
|
@@ -228,21 +228,21 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
228
228
|
return null;
|
|
229
229
|
}
|
|
230
230
|
},
|
|
231
|
-
[
|
|
231
|
+
[W, a]
|
|
232
232
|
);
|
|
233
233
|
return /* @__PURE__ */ u(pe, { children: [
|
|
234
|
-
ne && /* @__PURE__ */ u(
|
|
234
|
+
ne && /* @__PURE__ */ u(ve, { className: o.header, testId: "documents-header", children: [
|
|
235
235
|
/* @__PURE__ */ n("p", { children: a("DOCUMENTS_TABLE_HEADING") }),
|
|
236
236
|
/* @__PURE__ */ n(
|
|
237
|
-
|
|
237
|
+
K,
|
|
238
238
|
{
|
|
239
239
|
autoAlign: !0,
|
|
240
240
|
size: "lg",
|
|
241
241
|
kind: "ghost",
|
|
242
|
-
label: a(
|
|
242
|
+
label: a(C.label),
|
|
243
243
|
testId: "documents-add-button",
|
|
244
244
|
onClick: se,
|
|
245
|
-
children: /* @__PURE__ */ n(
|
|
245
|
+
children: /* @__PURE__ */ n(we, { id: "documents-add-icon", name: "fa-plus", size: Oe.LG })
|
|
246
246
|
}
|
|
247
247
|
)
|
|
248
248
|
] }),
|
|
@@ -253,7 +253,7 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
253
253
|
ariaLabel: a("DOCUMENTS_TABLE_HEADING"),
|
|
254
254
|
rows: ie,
|
|
255
255
|
loading: le,
|
|
256
|
-
errorStateMessage:
|
|
256
|
+
errorStateMessage: k ? B?.message : null,
|
|
257
257
|
sortable: ue,
|
|
258
258
|
emptyStateMessage: a("DOCUMENTS_NO_RECORDS"),
|
|
259
259
|
renderCell: he,
|
|
@@ -261,12 +261,12 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
261
261
|
dataTestId: "documents-table",
|
|
262
262
|
pageSize: f,
|
|
263
263
|
totalItems: re,
|
|
264
|
-
page:
|
|
264
|
+
page: M,
|
|
265
265
|
onPageChange: ce
|
|
266
266
|
}
|
|
267
267
|
) }),
|
|
268
268
|
i && r && /* @__PURE__ */ n(
|
|
269
|
-
|
|
269
|
+
Me,
|
|
270
270
|
{
|
|
271
271
|
id: "modalIdForActionAreaLayout",
|
|
272
272
|
portalId: "main-display-area",
|
|
@@ -277,21 +277,21 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
277
277
|
size: "lg",
|
|
278
278
|
testId: "document-view-modal",
|
|
279
279
|
children: /* @__PURE__ */ u("div", { className: o.documentViewerContainer, children: [
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
Q.length > 1 && /* @__PURE__ */ n(
|
|
281
|
+
Re,
|
|
282
282
|
{
|
|
283
283
|
kind: "tertiary",
|
|
284
284
|
size: "sm",
|
|
285
285
|
className: o.printAllButton,
|
|
286
|
-
renderIcon: S === "all" ?
|
|
287
|
-
disabled:
|
|
286
|
+
renderIcon: S === "all" ? J : Y,
|
|
287
|
+
disabled: V || !j,
|
|
288
288
|
testId: "print-all-attachments",
|
|
289
|
-
onClick: () => P(
|
|
289
|
+
onClick: () => P(Q, "all"),
|
|
290
290
|
children: a("DOCUMENTS_PRINT_ALL")
|
|
291
291
|
}
|
|
292
292
|
),
|
|
293
293
|
c.map((e, t) => {
|
|
294
|
-
const d =
|
|
294
|
+
const d = v(e.url), s = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || nt.test(e.url ?? ""), p = D.has(t);
|
|
295
295
|
return d === "#" || p ? /* @__PURE__ */ u(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
@@ -318,22 +318,22 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
318
318
|
total: c.length
|
|
319
319
|
}) }) : /* @__PURE__ */ n("span", {}),
|
|
320
320
|
/* @__PURE__ */ n(
|
|
321
|
-
|
|
321
|
+
K,
|
|
322
322
|
{
|
|
323
323
|
kind: "ghost",
|
|
324
324
|
size: "sm",
|
|
325
325
|
label: a("DOCUMENTS_PRINT_ATTACHMENT", {
|
|
326
326
|
index: t + 1
|
|
327
327
|
}),
|
|
328
|
-
disabled:
|
|
328
|
+
disabled: V || !j,
|
|
329
329
|
testId: `print-attachment-${t}`,
|
|
330
330
|
onClick: () => P([e], t),
|
|
331
|
-
children: S === t ? /* @__PURE__ */ n(
|
|
331
|
+
children: S === t ? /* @__PURE__ */ n(J, {}) : /* @__PURE__ */ n(Y, {})
|
|
332
332
|
}
|
|
333
333
|
)
|
|
334
334
|
] }),
|
|
335
335
|
/* @__PURE__ */ u("div", { className: o.attachmentContent, children: [
|
|
336
|
-
!
|
|
336
|
+
!I.has(t) && /* @__PURE__ */ n(
|
|
337
337
|
"div",
|
|
338
338
|
{
|
|
339
339
|
className: o.attachmentLoading,
|
|
@@ -351,18 +351,18 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
351
351
|
{
|
|
352
352
|
src: d,
|
|
353
353
|
alt: r.documentIdentifier,
|
|
354
|
-
className: `${o.documentImage} ${
|
|
355
|
-
onLoad: () =>
|
|
356
|
-
onError: () =>
|
|
354
|
+
className: `${o.documentImage} ${I.has(t) ? "" : o.hiddenWhileLoading}`,
|
|
355
|
+
onLoad: () => F(t),
|
|
356
|
+
onError: () => G(t)
|
|
357
357
|
}
|
|
358
358
|
) : /* @__PURE__ */ n(
|
|
359
359
|
"iframe",
|
|
360
360
|
{
|
|
361
361
|
src: s ? `${d}#toolbar=0` : d,
|
|
362
|
-
className: `${o.documentIframe} ${
|
|
362
|
+
className: `${o.documentIframe} ${I.has(t) ? "" : o.hiddenWhileLoading}`,
|
|
363
363
|
title: r.documentIdentifier,
|
|
364
|
-
onLoad: () =>
|
|
365
|
-
onError: () =>
|
|
364
|
+
onLoad: () => F(t),
|
|
365
|
+
onError: () => G(t)
|
|
366
366
|
}
|
|
367
367
|
)
|
|
368
368
|
] })
|
|
@@ -371,7 +371,7 @@ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", He = "DocumentsTab
|
|
|
371
371
|
`${r.id}-${e.url}`
|
|
372
372
|
);
|
|
373
373
|
}),
|
|
374
|
-
/* @__PURE__ */ n("div", { id:
|
|
374
|
+
/* @__PURE__ */ n("div", { id: Z, className: o.printContainer })
|
|
375
375
|
] })
|
|
376
376
|
}
|
|
377
377
|
)
|