@bahmni/widgets 0.0.1-dev.456 → 0.0.1-dev.458
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-BgmDp581.js +388 -0
- package/dist/{FormsTable-D67NVSvr.js → FormsTable-Cekdbhbb.js} +30 -30
- package/dist/{Observations-WD8m5FwS.js → Observations-DMNiLVdz.js} +21 -21
- package/dist/documentUpload/DocumentUpload.d.ts.map +1 -1
- package/dist/documentUpload/models.d.ts +1 -0
- package/dist/documentUpload/models.d.ts.map +1 -1
- package/dist/documents/DocumentPreview.d.ts +17 -0
- package/dist/documents/DocumentPreview.d.ts.map +1 -0
- package/dist/documents/index.d.ts +2 -0
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/{index-BSjeukzT.js → index-DepMUZYx.js} +19929 -19746
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -50
- package/package.json +1 -1
- package/dist/DocumentsTable-YtzrmAY5.js +0 -440
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "react";
|
|
1
|
+
import { aw as o, au as r, a4 as n, at as c, aR as g, a5 as l, a9 as m, C as d, al as P, aC as u, a6 as v, S as T, a7 as C, a2 as D, T as p, V as A, af as S, ai as b, ac as L, aN as N, aP as y, aQ as E, aT as I, a8 as U, aS as f, an as h, ao as O, O as R, a3 as W, ah as _, aj as x, ab as k, aa as F, ad as G, ag as M, aL as V, aK as w, as as H, ak as K, ae as q, aB as z, ay as B, ax as Y, X as j, aU as J, o as Q, aI as X, aH as $, Y as Z, aA as aa, aE as ea, aF as sa, aG as ta, $ as ia, az as oa, aD as ra, a0 as na, aJ as ca, a1 as ga, av as la, am as ma, ap as da, ar as Pa, b as ua, aO as va, a as Ta, aq as Ca, u as Da, aM as pa, k as Aa } from "./index-DepMUZYx.js";
|
|
3
2
|
import "react/jsx-runtime";
|
|
4
3
|
import "@tanstack/react-query";
|
|
4
|
+
import "react";
|
|
5
5
|
export {
|
|
6
6
|
o as ActivePractitionerContext,
|
|
7
7
|
r as ActivePractitionerProvider,
|
|
@@ -9,67 +9,68 @@ export {
|
|
|
9
9
|
c as AppContextProvider,
|
|
10
10
|
g as AppTile,
|
|
11
11
|
l as AppointmentsTable,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
m as CANCEL_VACCINATION_INPUT_CONTROL_KEY,
|
|
13
|
+
d as CONSULTATION_PAD_PRIVILEGES,
|
|
14
14
|
P as CommandPaletteProvider,
|
|
15
15
|
u as CommonSearchWidget,
|
|
16
16
|
v as ConditionsTable,
|
|
17
17
|
T as ConfirmationModal,
|
|
18
18
|
C as DiagnosesTable,
|
|
19
|
+
D as DocumentPreview,
|
|
19
20
|
p as DocumentPrintButton,
|
|
20
21
|
A as DocumentUpload,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
S as GenericServiceRequestTable,
|
|
23
|
+
b as ImmunizationHistory,
|
|
24
|
+
L as LabInvestigation,
|
|
25
|
+
N as LocationContext,
|
|
26
|
+
y as LocationProvider,
|
|
27
|
+
E as LocationSelector,
|
|
28
|
+
I as MODULE_TILES_SKELETON_COUNT,
|
|
29
|
+
U as MedicationsTable,
|
|
30
|
+
f as ModuleTileGrid,
|
|
31
|
+
h as NotificationProvider,
|
|
32
|
+
O as NotificationServiceComponent,
|
|
33
|
+
R as ObservationsRenderer,
|
|
34
|
+
W as PatientDetails,
|
|
35
|
+
_ as PatientProgramsTable,
|
|
36
|
+
x as ProgramDetails,
|
|
37
|
+
k as RadiologyInvestigationReport,
|
|
37
38
|
F as RadiologyInvestigationTable,
|
|
38
39
|
G as SearchPatient,
|
|
39
40
|
M as TaskList,
|
|
40
41
|
V as UserActionProvider,
|
|
41
|
-
|
|
42
|
+
w as UserGlobalAction,
|
|
42
43
|
H as UserPrivilegeProvider,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
44
|
+
K as VisitsTable,
|
|
45
|
+
q as VitalFlowSheet,
|
|
46
|
+
z as clearSearchWidgetRegistry,
|
|
47
|
+
B as createConfigHook,
|
|
48
|
+
Y as createConfigProvider,
|
|
49
|
+
j as createEmptyDocumentEntry,
|
|
50
|
+
J as deriveFormSchemaData,
|
|
51
|
+
Q as extractFormName,
|
|
52
|
+
X as getAllWidgetConfigs,
|
|
53
|
+
$ as getAllWidgetTypes,
|
|
54
|
+
Z as getDefaultDocumentType,
|
|
55
|
+
aa as getSearchWidget,
|
|
56
|
+
ea as getWidget,
|
|
57
|
+
sa as getWidgetConfig,
|
|
58
|
+
ta as hasWidget,
|
|
59
|
+
ia as isDocumentEntryEmpty,
|
|
60
|
+
oa as registerSearchWidget,
|
|
61
|
+
ra as registerWidget,
|
|
62
|
+
na as renderDocumentTile,
|
|
63
|
+
ca as resetWidgetRegistry,
|
|
64
|
+
ga as revokeDocumentPreview,
|
|
65
|
+
la as useActivePractitioner,
|
|
66
|
+
ma as useCommandPalette,
|
|
66
67
|
da as useDebounce,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
Pa as useFormSchemaData,
|
|
69
|
+
ua as useHasPrivilege,
|
|
70
|
+
va as useLocation,
|
|
71
|
+
Ta as useNotification,
|
|
72
|
+
Ca as usePatientPhoto,
|
|
73
|
+
Da as usePatientUUID,
|
|
73
74
|
pa as useUserActionRegistry,
|
|
74
75
|
Aa as useUserPrivilege
|
|
75
76
|
};
|
package/package.json
CHANGED
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as _, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { p as fe, a as Ae, u as ge, b as Ce, c as Ne, i as De, X as Ie, A as Le, d as Oe, M as be, Q as ye, _ as X, N as Se, e as ve, x as we, W as Me, f as Ue, h as J, g as te } from "./index-BSjeukzT.js";
|
|
3
|
-
import { useQuery as Re } from "@tanstack/react-query";
|
|
4
|
-
import { useState as p, useRef as Pe, useEffect as f, useMemo as A, useCallback as E } from "react";
|
|
5
|
-
import { useTranslation as ke } from "react-i18next";
|
|
6
|
-
const He = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTable-module_viewAttachmentsLink__aQ1on", $e = "DocumentsTable-module_documentViewerContainer__F5m8D", Fe = "DocumentsTable-module_printContainer__rtarJ", Ve = "DocumentsTable-module_attachmentItem__17KA7", We = "DocumentsTable-module_attachmentCounter__WFiI3", ze = "DocumentsTable-module_attachmentError__RI4U2", Ye = "DocumentsTable-module_documentIframe__ptq5I", Ge = "DocumentsTable-module_attachmentContent__IaCEe", qe = "DocumentsTable-module_attachmentLoading__FAR6p", Ke = "DocumentsTable-module_hiddenWhileLoading__IxocW", Qe = "DocumentsTable-module_documentImage__KQVgS", je = "DocumentsTable-module_header__345GY", Xe = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", c = {
|
|
7
|
-
documentsTableBody: He,
|
|
8
|
-
viewAttachmentsLink: Be,
|
|
9
|
-
documentViewerContainer: $e,
|
|
10
|
-
printContainer: Fe,
|
|
11
|
-
attachmentItem: Ve,
|
|
12
|
-
attachmentCounter: We,
|
|
13
|
-
attachmentError: ze,
|
|
14
|
-
documentIframe: Ye,
|
|
15
|
-
attachmentContent: Ge,
|
|
16
|
-
attachmentLoading: qe,
|
|
17
|
-
hiddenWhileLoading: Ke,
|
|
18
|
-
documentImage: Qe,
|
|
19
|
-
header: je,
|
|
20
|
-
documentTypeCell: Xe,
|
|
21
|
-
printAllButton: Je,
|
|
22
|
-
attachmentHeader: Ze
|
|
23
|
-
}, xe = {
|
|
24
|
-
documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
|
|
25
|
-
documentType: "DOCUMENTS_TYPE",
|
|
26
|
-
uploadedOn: "DOCUMENTS_UPLOADED_ON",
|
|
27
|
-
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
28
|
-
attachments: "DOCUMENTS_ATTACHMENTS"
|
|
29
|
-
};
|
|
30
|
-
function et(n) {
|
|
31
|
-
if (!n)
|
|
32
|
-
return "document";
|
|
33
|
-
const d = n.toLowerCase();
|
|
34
|
-
return d.includes("pdf") ? "pdf" : d.includes("image") ? "image" : "document";
|
|
35
|
-
}
|
|
36
|
-
function b(n) {
|
|
37
|
-
return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
|
|
38
|
-
}
|
|
39
|
-
function tt(n, d) {
|
|
40
|
-
return n.map((l) => ({
|
|
41
|
-
key: l,
|
|
42
|
-
header: d(xe[l])
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
const nt = {
|
|
46
|
-
"&": "&",
|
|
47
|
-
"<": "<",
|
|
48
|
-
">": ">",
|
|
49
|
-
'"': """,
|
|
50
|
-
"'": "'"
|
|
51
|
-
}, F = (n) => n.replace(/[&<>"']/g, (d) => nt[d]), at = "body{margin:0}img{max-width:100%;max-height:100vh;object-fit:contain;display:block;margin:0 auto}", ot = ({
|
|
52
|
-
contentType: n
|
|
53
|
-
}) => et(n) === "pdf", ne = (n) => new URL(b(n), globalThis.location.origin).href;
|
|
54
|
-
function st({ url: n }, d) {
|
|
55
|
-
const l = F(ne(n));
|
|
56
|
-
return `<!DOCTYPE html><html><head><meta charset="utf-8" /><title>${F(
|
|
57
|
-
d
|
|
58
|
-
)}</title><style>${at}</style></head><body><img src="${l}" alt="${F(
|
|
59
|
-
d
|
|
60
|
-
)}" /></body></html>`;
|
|
61
|
-
}
|
|
62
|
-
async function rt(n, d, {
|
|
63
|
-
container: l,
|
|
64
|
-
signal: D
|
|
65
|
-
}) {
|
|
66
|
-
const r = { container: l, focus: !1, signal: D };
|
|
67
|
-
for (const g of n) {
|
|
68
|
-
if (D.aborted) break;
|
|
69
|
-
ot(g) ? await fe(ne(g.url), r) : await Ae(
|
|
70
|
-
st(g, d),
|
|
71
|
-
r
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-print-container", x = () => /* @__PURE__ */ o(te, {}), it = /* @__PURE__ */ new Set([
|
|
76
|
-
"ArrowUp",
|
|
77
|
-
"ArrowDown",
|
|
78
|
-
"PageUp",
|
|
79
|
-
"PageDown",
|
|
80
|
-
"Home",
|
|
81
|
-
"End",
|
|
82
|
-
" "
|
|
83
|
-
]), mt = 15e3, ut = [
|
|
84
|
-
"documentType",
|
|
85
|
-
"documentIdentifier",
|
|
86
|
-
"attachments",
|
|
87
|
-
"uploadedOn",
|
|
88
|
-
"uploadedBy"
|
|
89
|
-
], ht = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, ee = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], At = ({ config: n, encounterUuids: d }) => {
|
|
90
|
-
const [l, D] = p(!1), [r, g] = p(
|
|
91
|
-
null
|
|
92
|
-
), [y, M] = p(
|
|
93
|
-
/* @__PURE__ */ new Set()
|
|
94
|
-
), [S, U] = p(
|
|
95
|
-
/* @__PURE__ */ new Set()
|
|
96
|
-
), I = Pe(null), [R, V] = p(
|
|
97
|
-
null
|
|
98
|
-
), W = R !== null;
|
|
99
|
-
f(() => () => I.current?.abort(), []);
|
|
100
|
-
const C = ge(), { t: s } = ke(), { addNotification: v } = Ce(), h = A(
|
|
101
|
-
() => n?.actions?.find(
|
|
102
|
-
(e) => e.type === lt
|
|
103
|
-
),
|
|
104
|
-
[n?.actions]
|
|
105
|
-
), ae = Ne(h?.requiredPrivilege), oe = !!h && ae, se = Number(n?.pageSize) || 5, [P, k] = p(1), [L, re] = p(se), [ce, H] = p(void 0), z = E((e) => {
|
|
106
|
-
g(e), D(!0);
|
|
107
|
-
}, []), le = E(() => {
|
|
108
|
-
I.current?.abort(), U(/* @__PURE__ */ new Set()), D(!1), g(null), M(/* @__PURE__ */ new Set());
|
|
109
|
-
}, []), Y = E((e) => {
|
|
110
|
-
U((t) => new Set(t).add(e));
|
|
111
|
-
}, []), G = E((e) => {
|
|
112
|
-
M((t) => new Set(t).add(e));
|
|
113
|
-
}, []), de = E(() => {
|
|
114
|
-
h && globalThis.dispatchEvent(
|
|
115
|
-
new CustomEvent(ct, {
|
|
116
|
-
detail: {
|
|
117
|
-
encounterType: h.encounterType,
|
|
118
|
-
editOnly: h.editOnly ?? dt,
|
|
119
|
-
...h.editTitle ? { editTitle: h.editTitle } : {}
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
);
|
|
123
|
-
}, [h]), { data: O, isLoading: ie, isError: B, error: $, refetch: q } = Re({
|
|
124
|
-
queryKey: [
|
|
125
|
-
"documents",
|
|
126
|
-
C,
|
|
127
|
-
d,
|
|
128
|
-
P,
|
|
129
|
-
L
|
|
130
|
-
],
|
|
131
|
-
enabled: !!C,
|
|
132
|
-
queryFn: () => De(
|
|
133
|
-
C,
|
|
134
|
-
d,
|
|
135
|
-
L,
|
|
136
|
-
P
|
|
137
|
-
)
|
|
138
|
-
});
|
|
139
|
-
Ie(
|
|
140
|
-
(e) => {
|
|
141
|
-
e.patientUUID === C && e.updatedResources.documents && q();
|
|
142
|
-
},
|
|
143
|
-
[C, q]
|
|
144
|
-
), f(() => {
|
|
145
|
-
O && H(O.total);
|
|
146
|
-
}, [O]), f(() => {
|
|
147
|
-
k(1), H(void 0);
|
|
148
|
-
}, [C]), f(() => {
|
|
149
|
-
B && v({
|
|
150
|
-
title: s("ERROR_DEFAULT_TITLE"),
|
|
151
|
-
message: $?.message ?? "",
|
|
152
|
-
type: "error"
|
|
153
|
-
});
|
|
154
|
-
}, [B, $, v, s]), f(() => {
|
|
155
|
-
const e = new AbortController();
|
|
156
|
-
return (async () => {
|
|
157
|
-
if (!l || !r) return;
|
|
158
|
-
const a = /* @__PURE__ */ new Set(), u = ee(r);
|
|
159
|
-
for (let i = 0; i < u.length; i++) {
|
|
160
|
-
const N = b(u[i].url);
|
|
161
|
-
try {
|
|
162
|
-
(await fetch(N, {
|
|
163
|
-
method: "HEAD",
|
|
164
|
-
signal: e.signal
|
|
165
|
-
})).ok || a.add(i);
|
|
166
|
-
} catch (T) {
|
|
167
|
-
T instanceof Error && T.name !== "AbortError" && a.add(i);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
e.signal.aborted || M(a);
|
|
171
|
-
})(), () => e.abort();
|
|
172
|
-
}, [l, r]), f(() => {
|
|
173
|
-
if (!l || !r) return;
|
|
174
|
-
const e = document.querySelector(
|
|
175
|
-
'[data-testid="document-view-modal"] .cds--modal-content'
|
|
176
|
-
);
|
|
177
|
-
if (!e) return;
|
|
178
|
-
let t = !1;
|
|
179
|
-
const a = () => {
|
|
180
|
-
t = !0;
|
|
181
|
-
}, u = (T) => {
|
|
182
|
-
T.target === e && a();
|
|
183
|
-
}, i = (T) => {
|
|
184
|
-
const pe = T.target;
|
|
185
|
-
it.has(T.key) && !pe?.closest("button, input, textarea, select, a") && a();
|
|
186
|
-
}, N = () => {
|
|
187
|
-
!t && e.scrollTop !== 0 && (e.scrollTop = 0);
|
|
188
|
-
};
|
|
189
|
-
return e.addEventListener("wheel", a, { passive: !0 }), e.addEventListener("touchmove", a, { passive: !0 }), e.addEventListener("mousedown", u), e.addEventListener("keydown", i), e.addEventListener("scroll", N), () => {
|
|
190
|
-
e.removeEventListener("wheel", a), e.removeEventListener("touchmove", a), e.removeEventListener("mousedown", u), e.removeEventListener("keydown", i), e.removeEventListener("scroll", N);
|
|
191
|
-
};
|
|
192
|
-
}, [l, r]);
|
|
193
|
-
const me = E(
|
|
194
|
-
(e, t) => {
|
|
195
|
-
t !== L ? (re(t), k(1), H(void 0)) : k(e);
|
|
196
|
-
},
|
|
197
|
-
[L]
|
|
198
|
-
), w = A(
|
|
199
|
-
() => n?.fields ?? ut,
|
|
200
|
-
[n?.fields]
|
|
201
|
-
), ue = A(() => [...O?.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), [O]), he = A(() => tt(w, s), [w, s]), Te = A(
|
|
202
|
-
() => w.map((e) => ({
|
|
203
|
-
key: e,
|
|
204
|
-
sortable: e !== "attachments"
|
|
205
|
-
})),
|
|
206
|
-
[w]
|
|
207
|
-
), m = A(
|
|
208
|
-
() => r ? ee(r) : [],
|
|
209
|
-
[r]
|
|
210
|
-
), K = m.every(
|
|
211
|
-
(e, t) => S.has(t) || y.has(t) || b(e.url) === "#"
|
|
212
|
-
);
|
|
213
|
-
f(() => {
|
|
214
|
-
if (!l || m.length === 0) return;
|
|
215
|
-
const e = setTimeout(
|
|
216
|
-
() => U(new Set(m.keys())),
|
|
217
|
-
mt
|
|
218
|
-
);
|
|
219
|
-
return () => clearTimeout(e);
|
|
220
|
-
}, [l, m]);
|
|
221
|
-
const Q = E(
|
|
222
|
-
async (e, t) => {
|
|
223
|
-
if (!r || I.current) return;
|
|
224
|
-
const a = new AbortController(), { signal: u } = a;
|
|
225
|
-
I.current = a, V(t);
|
|
226
|
-
const i = document.getElementById(Z);
|
|
227
|
-
try {
|
|
228
|
-
await rt(
|
|
229
|
-
e,
|
|
230
|
-
r.documentIdentifier,
|
|
231
|
-
{ container: i, signal: u }
|
|
232
|
-
);
|
|
233
|
-
} catch {
|
|
234
|
-
u.aborted || v({
|
|
235
|
-
title: s("ERROR_DEFAULT_TITLE"),
|
|
236
|
-
message: s("DOCUMENTS_ERROR_LOADING_ATTACHMENT"),
|
|
237
|
-
type: "error"
|
|
238
|
-
});
|
|
239
|
-
} finally {
|
|
240
|
-
I.current = null, V(null);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
[r, v, s]
|
|
244
|
-
), j = A(
|
|
245
|
-
() => m.filter(
|
|
246
|
-
(e, t) => b(e.url) !== "#" && !y.has(t)
|
|
247
|
-
),
|
|
248
|
-
[m, y]
|
|
249
|
-
), _e = E(
|
|
250
|
-
(e, t) => {
|
|
251
|
-
switch (t) {
|
|
252
|
-
case "documentIdentifier":
|
|
253
|
-
return /* @__PURE__ */ o("span", { children: e.documentIdentifier?.trim() || "-" });
|
|
254
|
-
case "documentType":
|
|
255
|
-
return /* @__PURE__ */ _("div", { className: c.documentTypeCell, children: [
|
|
256
|
-
/* @__PURE__ */ o("span", { children: e.documentType ?? s("DOCUMENTS_NOT_AVAILABLE") }),
|
|
257
|
-
e.description && /* @__PURE__ */ o(
|
|
258
|
-
be,
|
|
259
|
-
{
|
|
260
|
-
iconName: "fa-file-lines",
|
|
261
|
-
content: e.description,
|
|
262
|
-
ariaLabel: e.description,
|
|
263
|
-
testId: `document-notes-${e.id}`
|
|
264
|
-
}
|
|
265
|
-
)
|
|
266
|
-
] });
|
|
267
|
-
case "uploadedOn":
|
|
268
|
-
return Oe(
|
|
269
|
-
e.uploadedOn,
|
|
270
|
-
s,
|
|
271
|
-
!0
|
|
272
|
-
).formattedResult || s("DOCUMENTS_NOT_AVAILABLE");
|
|
273
|
-
case "uploadedBy":
|
|
274
|
-
return e.uploadedBy ?? s("DOCUMENTS_NOT_AVAILABLE");
|
|
275
|
-
case "attachments":
|
|
276
|
-
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ o(
|
|
277
|
-
Le,
|
|
278
|
-
{
|
|
279
|
-
onClick: () => z(e),
|
|
280
|
-
className: c.viewAttachmentsLink,
|
|
281
|
-
"data-testid": `view-attachments-${e.id}`,
|
|
282
|
-
children: s("DOCUMENTS_VIEW_ATTACHMENTS")
|
|
283
|
-
}
|
|
284
|
-
) : "--";
|
|
285
|
-
default:
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
[z, s]
|
|
290
|
-
);
|
|
291
|
-
return /* @__PURE__ */ _(Ee, { children: [
|
|
292
|
-
oe && /* @__PURE__ */ _(ye, { className: c.header, testId: "documents-header", children: [
|
|
293
|
-
/* @__PURE__ */ o("p", { children: s("DOCUMENTS_TABLE_HEADING") }),
|
|
294
|
-
/* @__PURE__ */ o(
|
|
295
|
-
X,
|
|
296
|
-
{
|
|
297
|
-
autoAlign: !0,
|
|
298
|
-
size: "lg",
|
|
299
|
-
kind: "ghost",
|
|
300
|
-
label: s(h.label),
|
|
301
|
-
testId: "documents-add-button",
|
|
302
|
-
onClick: de,
|
|
303
|
-
children: /* @__PURE__ */ o(Se, { id: "documents-add-icon", name: "fa-plus", size: ve.LG })
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
] }),
|
|
307
|
-
/* @__PURE__ */ o("div", { "data-testid": "documents-table", children: /* @__PURE__ */ o(
|
|
308
|
-
we,
|
|
309
|
-
{
|
|
310
|
-
headers: he,
|
|
311
|
-
ariaLabel: s("DOCUMENTS_TABLE_HEADING"),
|
|
312
|
-
rows: ue,
|
|
313
|
-
loading: ie,
|
|
314
|
-
errorStateMessage: B ? $?.message : null,
|
|
315
|
-
sortable: Te,
|
|
316
|
-
emptyStateMessage: s("DOCUMENTS_NO_RECORDS"),
|
|
317
|
-
renderCell: _e,
|
|
318
|
-
className: c.documentsTableBody,
|
|
319
|
-
dataTestId: "documents-table",
|
|
320
|
-
pageSize: L,
|
|
321
|
-
totalItems: ce,
|
|
322
|
-
page: P,
|
|
323
|
-
onPageChange: me
|
|
324
|
-
}
|
|
325
|
-
) }),
|
|
326
|
-
l && r && /* @__PURE__ */ o(
|
|
327
|
-
Me,
|
|
328
|
-
{
|
|
329
|
-
id: "modalIdForActionAreaLayout",
|
|
330
|
-
portalId: "main-display-area",
|
|
331
|
-
open: l,
|
|
332
|
-
onRequestClose: le,
|
|
333
|
-
modalHeading: r.documentIdentifier,
|
|
334
|
-
passiveModal: !0,
|
|
335
|
-
size: "lg",
|
|
336
|
-
testId: "document-view-modal",
|
|
337
|
-
children: /* @__PURE__ */ _("div", { className: c.documentViewerContainer, children: [
|
|
338
|
-
j.length > 1 && /* @__PURE__ */ o(
|
|
339
|
-
Ue,
|
|
340
|
-
{
|
|
341
|
-
kind: "tertiary",
|
|
342
|
-
size: "sm",
|
|
343
|
-
className: c.printAllButton,
|
|
344
|
-
renderIcon: R === "all" ? x : J,
|
|
345
|
-
disabled: W || !K,
|
|
346
|
-
testId: "print-all-attachments",
|
|
347
|
-
onClick: () => Q(j, "all"),
|
|
348
|
-
children: s("DOCUMENTS_PRINT_ALL")
|
|
349
|
-
}
|
|
350
|
-
),
|
|
351
|
-
m.map((e, t) => {
|
|
352
|
-
const a = b(e.url), u = e.contentType?.toLowerCase().includes("pdf"), i = (e.contentType?.toLowerCase().includes("image") ?? !1) || ht.test(e.url ?? ""), N = y.has(t);
|
|
353
|
-
return a === "#" || N ? /* @__PURE__ */ _(
|
|
354
|
-
"div",
|
|
355
|
-
{
|
|
356
|
-
className: c.attachmentError,
|
|
357
|
-
"data-testid": `attachment-error-${t}`,
|
|
358
|
-
children: [
|
|
359
|
-
m.length > 1 && /* @__PURE__ */ o("p", { className: c.attachmentCounter, children: s("DOCUMENTS_ATTACHMENT_COUNTER", {
|
|
360
|
-
current: t + 1,
|
|
361
|
-
total: m.length
|
|
362
|
-
}) }),
|
|
363
|
-
/* @__PURE__ */ o("p", { children: s("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
|
|
364
|
-
]
|
|
365
|
-
},
|
|
366
|
-
`${r.id}-${e.url}`
|
|
367
|
-
) : /* @__PURE__ */ _(
|
|
368
|
-
"div",
|
|
369
|
-
{
|
|
370
|
-
className: c.attachmentItem,
|
|
371
|
-
"data-testid": `attachment-item-${t}`,
|
|
372
|
-
children: [
|
|
373
|
-
/* @__PURE__ */ _("div", { className: c.attachmentHeader, children: [
|
|
374
|
-
m.length > 1 ? /* @__PURE__ */ o("p", { className: c.attachmentCounter, children: s("DOCUMENTS_ATTACHMENT_COUNTER", {
|
|
375
|
-
current: t + 1,
|
|
376
|
-
total: m.length
|
|
377
|
-
}) }) : /* @__PURE__ */ o("span", {}),
|
|
378
|
-
/* @__PURE__ */ o(
|
|
379
|
-
X,
|
|
380
|
-
{
|
|
381
|
-
kind: "ghost",
|
|
382
|
-
size: "sm",
|
|
383
|
-
label: s("DOCUMENTS_PRINT_ATTACHMENT", {
|
|
384
|
-
index: t + 1
|
|
385
|
-
}),
|
|
386
|
-
disabled: W || !K,
|
|
387
|
-
testId: `print-attachment-${t}`,
|
|
388
|
-
onClick: () => Q([e], t),
|
|
389
|
-
children: R === t ? /* @__PURE__ */ o(x, {}) : /* @__PURE__ */ o(J, {})
|
|
390
|
-
}
|
|
391
|
-
)
|
|
392
|
-
] }),
|
|
393
|
-
/* @__PURE__ */ _("div", { className: c.attachmentContent, children: [
|
|
394
|
-
!S.has(t) && /* @__PURE__ */ o(
|
|
395
|
-
"div",
|
|
396
|
-
{
|
|
397
|
-
className: c.attachmentLoading,
|
|
398
|
-
"data-testid": `attachment-loading-${t}`,
|
|
399
|
-
children: /* @__PURE__ */ o(
|
|
400
|
-
te,
|
|
401
|
-
{
|
|
402
|
-
description: s("DOCUMENTS_LOADING_ATTACHMENT")
|
|
403
|
-
}
|
|
404
|
-
)
|
|
405
|
-
}
|
|
406
|
-
),
|
|
407
|
-
i ? /* @__PURE__ */ o(
|
|
408
|
-
"img",
|
|
409
|
-
{
|
|
410
|
-
src: a,
|
|
411
|
-
alt: r.documentIdentifier,
|
|
412
|
-
className: `${c.documentImage} ${S.has(t) ? "" : c.hiddenWhileLoading}`,
|
|
413
|
-
onLoad: () => Y(t),
|
|
414
|
-
onError: () => G(t)
|
|
415
|
-
}
|
|
416
|
-
) : /* @__PURE__ */ o(
|
|
417
|
-
"iframe",
|
|
418
|
-
{
|
|
419
|
-
src: u ? `${a}#toolbar=0` : a,
|
|
420
|
-
className: `${c.documentIframe} ${S.has(t) ? "" : c.hiddenWhileLoading}`,
|
|
421
|
-
title: r.documentIdentifier,
|
|
422
|
-
onLoad: () => Y(t),
|
|
423
|
-
onError: () => G(t)
|
|
424
|
-
}
|
|
425
|
-
)
|
|
426
|
-
] })
|
|
427
|
-
]
|
|
428
|
-
},
|
|
429
|
-
`${r.id}-${e.url}`
|
|
430
|
-
);
|
|
431
|
-
}),
|
|
432
|
-
/* @__PURE__ */ o("div", { id: Z, className: c.printContainer })
|
|
433
|
-
] })
|
|
434
|
-
}
|
|
435
|
-
)
|
|
436
|
-
] });
|
|
437
|
-
};
|
|
438
|
-
export {
|
|
439
|
-
At as default
|
|
440
|
-
};
|