@bahmni/widgets 0.0.1-dev.457 → 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.
@@ -0,0 +1,388 @@
1
+ import { jsx as a, jsxs as T, Fragment as _e } from "react/jsx-runtime";
2
+ import { u as pe, a as Ae, b as Ee, c as ge, Z as Ne, d as Ce, e as S, p as fe, A as Ie, f as De, M as Le, Q as be, _ as Y, N as Oe, g as Se, x as ve, W as ye, h as we, i as Z, j as ee } from "./index-DepMUZYx.js";
3
+ import { useQuery as Me } from "@tanstack/react-query";
4
+ import { useState as _, useRef as Ue, useEffect as A, useMemo as E, useCallback as p } from "react";
5
+ import { useTranslation as Re } from "react-i18next";
6
+ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", ke = "DocumentsTable-module_viewAttachmentsLink__aQ1on", Be = "DocumentsTable-module_documentViewerContainer__F5m8D", He = "DocumentsTable-module_printContainer__rtarJ", $e = "DocumentsTable-module_attachmentItem__17KA7", Fe = "DocumentsTable-module_attachmentCounter__WFiI3", Ve = "DocumentsTable-module_attachmentError__RI4U2", We = "DocumentsTable-module_documentIframe__ptq5I", ze = "DocumentsTable-module_attachmentContent__IaCEe", Ge = "DocumentsTable-module_attachmentLoading__FAR6p", qe = "DocumentsTable-module_hiddenWhileLoading__IxocW", Ke = "DocumentsTable-module_documentImage__KQVgS", Qe = "DocumentsTable-module_header__345GY", je = "DocumentsTable-module_documentTypeCell__uWGM8", Ye = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", s = {
7
+ documentsTableBody: Pe,
8
+ viewAttachmentsLink: ke,
9
+ documentViewerContainer: Be,
10
+ printContainer: He,
11
+ attachmentItem: $e,
12
+ attachmentCounter: Fe,
13
+ attachmentError: Ve,
14
+ documentIframe: We,
15
+ attachmentContent: ze,
16
+ attachmentLoading: Ge,
17
+ hiddenWhileLoading: qe,
18
+ documentImage: Ke,
19
+ header: Qe,
20
+ documentTypeCell: je,
21
+ printAllButton: Ye,
22
+ attachmentHeader: Ze
23
+ }, Je = "startConsultation", Xe = "add", xe = "documents", J = "document-print-container", X = () => /* @__PURE__ */ a(ee, {}), et = /* @__PURE__ */ new Set([
24
+ "ArrowUp",
25
+ "ArrowDown",
26
+ "PageUp",
27
+ "PageDown",
28
+ "Home",
29
+ "End",
30
+ " "
31
+ ]), tt = 15e3, nt = [
32
+ "documentType",
33
+ "documentIdentifier",
34
+ "attachments",
35
+ "uploadedOn",
36
+ "uploadedBy"
37
+ ], at = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, x = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], dt = ({ config: l, encounterUuids: B }) => {
38
+ const [u, H] = _(!1), [r, $] = _(
39
+ null
40
+ ), [D, v] = _(
41
+ /* @__PURE__ */ new Set()
42
+ ), [L, y] = _(
43
+ /* @__PURE__ */ new Set()
44
+ ), C = Ue(null), [w, F] = _(
45
+ null
46
+ ), V = w !== null;
47
+ A(() => () => C.current?.abort(), []);
48
+ const g = pe(), { t: o } = Re(), { addNotification: b } = Ae(), m = E(
49
+ () => l?.actions?.find(
50
+ (e) => e.type === Xe
51
+ ),
52
+ [l?.actions]
53
+ ), te = Ee(m?.requiredPrivilege), ne = !!m && te, ae = Number(l?.pageSize) || 5, [M, U] = _(1), [f, oe] = _(ae), [se, R] = _(void 0), W = p((e) => {
54
+ $(e), H(!0);
55
+ }, []), re = p(() => {
56
+ C.current?.abort(), y(/* @__PURE__ */ new Set()), H(!1), $(null), v(/* @__PURE__ */ new Set());
57
+ }, []), z = p((e) => {
58
+ y((t) => new Set(t).add(e));
59
+ }, []), G = p((e) => {
60
+ v((t) => new Set(t).add(e));
61
+ }, []), ce = p(() => {
62
+ m && globalThis.dispatchEvent(
63
+ new CustomEvent(Je, {
64
+ detail: {
65
+ encounterType: m.encounterType,
66
+ editOnly: m.editOnly ?? xe,
67
+ ...m.editTitle ? { editTitle: m.editTitle } : {}
68
+ }
69
+ })
70
+ );
71
+ }, [m]), { data: I, isLoading: le, isError: P, error: k, refetch: q } = Me({
72
+ queryKey: [
73
+ "documents",
74
+ g,
75
+ B,
76
+ M,
77
+ f
78
+ ],
79
+ enabled: !!g,
80
+ queryFn: () => ge(
81
+ g,
82
+ B,
83
+ f,
84
+ M
85
+ )
86
+ });
87
+ Ne(
88
+ (e) => {
89
+ e.patientUUID === g && e.updatedResources.documents && q();
90
+ },
91
+ [g, q]
92
+ ), A(() => {
93
+ I && R(I.total);
94
+ }, [I]), A(() => {
95
+ U(1), R(void 0);
96
+ }, [g]), A(() => {
97
+ P && b({
98
+ title: o("ERROR_DEFAULT_TITLE"),
99
+ message: k?.message ?? "",
100
+ type: "error"
101
+ });
102
+ }, [P, k, b, o]), A(() => {
103
+ const e = new AbortController();
104
+ return (async () => {
105
+ if (!u || !r) return;
106
+ const n = /* @__PURE__ */ new Set(), i = x(r);
107
+ for (let c = 0; c < i.length; c++) {
108
+ const N = S(i[c].url);
109
+ try {
110
+ (await fetch(N, {
111
+ method: "HEAD",
112
+ signal: e.signal
113
+ })).ok || n.add(c);
114
+ } catch (h) {
115
+ h instanceof Error && h.name !== "AbortError" && n.add(c);
116
+ }
117
+ }
118
+ e.signal.aborted || v(n);
119
+ })(), () => e.abort();
120
+ }, [u, r]), A(() => {
121
+ if (!u || !r) return;
122
+ const e = document.querySelector(
123
+ '[data-testid="document-view-modal"] .cds--modal-content'
124
+ );
125
+ if (!e) return;
126
+ let t = !1;
127
+ const n = () => {
128
+ t = !0;
129
+ }, i = (h) => {
130
+ h.target === e && n();
131
+ }, c = (h) => {
132
+ const Te = h.target;
133
+ et.has(h.key) && !Te?.closest("button, input, textarea, select, a") && n();
134
+ }, N = () => {
135
+ !t && e.scrollTop !== 0 && (e.scrollTop = 0);
136
+ };
137
+ return e.addEventListener("wheel", n, { passive: !0 }), e.addEventListener("touchmove", n, { passive: !0 }), e.addEventListener("mousedown", i), e.addEventListener("keydown", c), e.addEventListener("scroll", N), () => {
138
+ e.removeEventListener("wheel", n), e.removeEventListener("touchmove", n), e.removeEventListener("mousedown", i), e.removeEventListener("keydown", c), e.removeEventListener("scroll", N);
139
+ };
140
+ }, [u, r]);
141
+ const de = p(
142
+ (e, t) => {
143
+ t !== f ? (oe(t), U(1), R(void 0)) : U(e);
144
+ },
145
+ [f]
146
+ ), O = E(
147
+ () => l?.fields ?? nt,
148
+ [l?.fields]
149
+ ), ie = E(() => [...I?.documents ?? []].sort((t, n) => !t.uploadedOn && !n.uploadedOn ? 0 : t.uploadedOn ? n.uploadedOn ? new Date(n.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [I]), me = E(() => Ce(O, o), [O, o]), ue = E(
150
+ () => O.map((e) => ({
151
+ key: e,
152
+ sortable: e !== "attachments"
153
+ })),
154
+ [O]
155
+ ), d = E(
156
+ () => r ? x(r) : [],
157
+ [r]
158
+ ), K = d.every(
159
+ (e, t) => L.has(t) || D.has(t) || S(e.url) === "#"
160
+ );
161
+ A(() => {
162
+ if (!u || d.length === 0) return;
163
+ const e = setTimeout(
164
+ () => y(new Set(d.keys())),
165
+ tt
166
+ );
167
+ return () => clearTimeout(e);
168
+ }, [u, d]);
169
+ const Q = p(
170
+ async (e, t) => {
171
+ if (!r || C.current) return;
172
+ const n = new AbortController(), { signal: i } = n;
173
+ C.current = n, F(t);
174
+ const c = document.getElementById(J);
175
+ try {
176
+ await fe(
177
+ e,
178
+ r.documentIdentifier,
179
+ { container: c, signal: i }
180
+ );
181
+ } catch {
182
+ i.aborted || b({
183
+ title: o("ERROR_DEFAULT_TITLE"),
184
+ message: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT"),
185
+ type: "error"
186
+ });
187
+ } finally {
188
+ C.current = null, F(null);
189
+ }
190
+ },
191
+ [r, b, o]
192
+ ), j = E(
193
+ () => d.filter(
194
+ (e, t) => S(e.url) !== "#" && !D.has(t)
195
+ ),
196
+ [d, D]
197
+ ), he = p(
198
+ (e, t) => {
199
+ switch (t) {
200
+ case "documentIdentifier":
201
+ return /* @__PURE__ */ a("span", { children: e.documentIdentifier?.trim() || "-" });
202
+ case "documentType":
203
+ return /* @__PURE__ */ T("div", { className: s.documentTypeCell, children: [
204
+ /* @__PURE__ */ a("span", { children: e.documentType ?? o("DOCUMENTS_NOT_AVAILABLE") }),
205
+ e.description && /* @__PURE__ */ a(
206
+ Le,
207
+ {
208
+ iconName: "fa-file-lines",
209
+ content: e.description,
210
+ ariaLabel: e.description,
211
+ testId: `document-notes-${e.id}`
212
+ }
213
+ )
214
+ ] });
215
+ case "uploadedOn":
216
+ return De(
217
+ e.uploadedOn,
218
+ o,
219
+ !0
220
+ ).formattedResult || o("DOCUMENTS_NOT_AVAILABLE");
221
+ case "uploadedBy":
222
+ return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
223
+ case "attachments":
224
+ return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ a(
225
+ Ie,
226
+ {
227
+ onClick: () => W(e),
228
+ className: s.viewAttachmentsLink,
229
+ "data-testid": `view-attachments-${e.id}`,
230
+ children: o("DOCUMENTS_VIEW_ATTACHMENTS")
231
+ }
232
+ ) : "--";
233
+ default:
234
+ return null;
235
+ }
236
+ },
237
+ [W, o]
238
+ );
239
+ return /* @__PURE__ */ T(_e, { children: [
240
+ ne && /* @__PURE__ */ T(be, { className: s.header, testId: "documents-header", children: [
241
+ /* @__PURE__ */ a("p", { children: o("DOCUMENTS_TABLE_HEADING") }),
242
+ /* @__PURE__ */ a(
243
+ Y,
244
+ {
245
+ autoAlign: !0,
246
+ size: "lg",
247
+ kind: "ghost",
248
+ label: o(m.label),
249
+ testId: "documents-add-button",
250
+ onClick: ce,
251
+ children: /* @__PURE__ */ a(Oe, { id: "documents-add-icon", name: "fa-plus", size: Se.LG })
252
+ }
253
+ )
254
+ ] }),
255
+ /* @__PURE__ */ a("div", { "data-testid": "documents-table", children: /* @__PURE__ */ a(
256
+ ve,
257
+ {
258
+ headers: me,
259
+ ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
260
+ rows: ie,
261
+ loading: le,
262
+ errorStateMessage: P ? k?.message : null,
263
+ sortable: ue,
264
+ emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
265
+ renderCell: he,
266
+ className: s.documentsTableBody,
267
+ dataTestId: "documents-table",
268
+ pageSize: f,
269
+ totalItems: se,
270
+ page: M,
271
+ onPageChange: de
272
+ }
273
+ ) }),
274
+ u && r && /* @__PURE__ */ a(
275
+ ye,
276
+ {
277
+ id: "modalIdForActionAreaLayout",
278
+ portalId: "main-display-area",
279
+ open: u,
280
+ onRequestClose: re,
281
+ modalHeading: r.documentIdentifier,
282
+ passiveModal: !0,
283
+ size: "lg",
284
+ testId: "document-view-modal",
285
+ children: /* @__PURE__ */ T("div", { className: s.documentViewerContainer, children: [
286
+ j.length > 1 && /* @__PURE__ */ a(
287
+ we,
288
+ {
289
+ kind: "tertiary",
290
+ size: "sm",
291
+ className: s.printAllButton,
292
+ renderIcon: w === "all" ? X : Z,
293
+ disabled: V || !K,
294
+ testId: "print-all-attachments",
295
+ onClick: () => Q(j, "all"),
296
+ children: o("DOCUMENTS_PRINT_ALL")
297
+ }
298
+ ),
299
+ d.map((e, t) => {
300
+ const n = S(e.url), i = e.contentType?.toLowerCase().includes("pdf"), c = (e.contentType?.toLowerCase().includes("image") ?? !1) || at.test(e.url ?? ""), N = D.has(t);
301
+ return n === "#" || N ? /* @__PURE__ */ T(
302
+ "div",
303
+ {
304
+ className: s.attachmentError,
305
+ "data-testid": `attachment-error-${t}`,
306
+ children: [
307
+ d.length > 1 && /* @__PURE__ */ a("p", { className: s.attachmentCounter, children: o("DOCUMENTS_ATTACHMENT_COUNTER", {
308
+ current: t + 1,
309
+ total: d.length
310
+ }) }),
311
+ /* @__PURE__ */ a("p", { children: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
312
+ ]
313
+ },
314
+ `${r.id}-${e.url}`
315
+ ) : /* @__PURE__ */ T(
316
+ "div",
317
+ {
318
+ className: s.attachmentItem,
319
+ "data-testid": `attachment-item-${t}`,
320
+ children: [
321
+ /* @__PURE__ */ T("div", { className: s.attachmentHeader, children: [
322
+ d.length > 1 ? /* @__PURE__ */ a("p", { className: s.attachmentCounter, children: o("DOCUMENTS_ATTACHMENT_COUNTER", {
323
+ current: t + 1,
324
+ total: d.length
325
+ }) }) : /* @__PURE__ */ a("span", {}),
326
+ /* @__PURE__ */ a(
327
+ Y,
328
+ {
329
+ kind: "ghost",
330
+ size: "sm",
331
+ label: o("DOCUMENTS_PRINT_ATTACHMENT", {
332
+ index: t + 1
333
+ }),
334
+ disabled: V || !K,
335
+ testId: `print-attachment-${t}`,
336
+ onClick: () => Q([e], t),
337
+ children: w === t ? /* @__PURE__ */ a(X, {}) : /* @__PURE__ */ a(Z, {})
338
+ }
339
+ )
340
+ ] }),
341
+ /* @__PURE__ */ T("div", { className: s.attachmentContent, children: [
342
+ !L.has(t) && /* @__PURE__ */ a(
343
+ "div",
344
+ {
345
+ className: s.attachmentLoading,
346
+ "data-testid": `attachment-loading-${t}`,
347
+ children: /* @__PURE__ */ a(
348
+ ee,
349
+ {
350
+ description: o("DOCUMENTS_LOADING_ATTACHMENT")
351
+ }
352
+ )
353
+ }
354
+ ),
355
+ c ? /* @__PURE__ */ a(
356
+ "img",
357
+ {
358
+ src: n,
359
+ alt: r.documentIdentifier,
360
+ className: `${s.documentImage} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
361
+ onLoad: () => z(t),
362
+ onError: () => G(t)
363
+ }
364
+ ) : /* @__PURE__ */ a(
365
+ "iframe",
366
+ {
367
+ src: i ? `${n}#toolbar=0` : n,
368
+ className: `${s.documentIframe} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
369
+ title: r.documentIdentifier,
370
+ onLoad: () => z(t),
371
+ onError: () => G(t)
372
+ }
373
+ )
374
+ ] })
375
+ ]
376
+ },
377
+ `${r.id}-${e.url}`
378
+ );
379
+ }),
380
+ /* @__PURE__ */ a("div", { id: J, className: s.printContainer })
381
+ ] })
382
+ }
383
+ )
384
+ ] });
385
+ };
386
+ export {
387
+ dt as default
388
+ };
@@ -1,7 +1,7 @@
1
1
  import { jsx as n, jsxs as q, Fragment as ie } from "react/jsx-runtime";
2
- import { u as de, c as le, j as me, L as ce, U as ue, k as fe, l as be, Z as he, m as Ne, n as ye, J as Oe, e as ge, _ as x, P as V, A as Te, x as $, o as pe, q as Ee, W as Ie, O as Ae, C as Fe } from "./index-B4qp8zC7.js";
2
+ import { u as de, b as le, k as me, L as ce, U as ue, l as fe, m as be, Z as he, n as Ne, o as ye, J as Oe, f as ge, _ as x, P as V, A as Te, x as $, q as pe, r as Ee, W as Ie, O as Ae, C as Fe } from "./index-DepMUZYx.js";
3
3
  import { useQueryClient as _e, useQuery as A } from "@tanstack/react-query";
4
- import { useState as j, useMemo as i, useCallback as d } from "react";
4
+ import { useState as G, useMemo as i, useCallback as d } from "react";
5
5
  import { useTranslation as ve } from "react-i18next";
6
6
  const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
7
7
  formsTableBody: Re,
@@ -10,15 +10,15 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
10
10
  }, Ce = "startConsultation", ke = ({
11
11
  episodeOfCareUuids: F,
12
12
  encounterUuids: m,
13
- config: G,
13
+ config: j,
14
14
  disableActions: z = !1,
15
15
  activeEncounterUuid: b = null
16
16
  }) => {
17
- const { t: o } = ve(), c = de(), [O, _] = j(!1), [a, v] = j(null), {
17
+ const { t: o } = ve(), c = de(), [O, _] = G(!1), [a, v] = G(null), {
18
18
  numberOfVisits: K,
19
19
  hideThumbnail: Q = !1,
20
20
  forms: h
21
- } = G ?? {}, W = le(
21
+ } = j ?? {}, W = le(
22
22
  Fe.EDIT_OBSERVATIONS
23
23
  ), { userPrivileges: N } = me(), g = W && !z && !!b, R = ce(
24
24
  F,
@@ -1,13 +1,13 @@
1
1
  import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { r as G, s as F, t as x, v as z, e as H, w as P, F as j, y as W, z as Z, u as J, b as Y, B as X, L as ee, D as se, E as te, Z as re, G as ae, H as oe, I as ne, K as ie, Q as ce, x as le } from "./index-B4qp8zC7.js";
2
+ import { s as G, t as F, v as x, w as z, f as H, y as P, F as j, z as W, B as Z, u as J, a as Y, D as X, L as ee, E as se, G as te, Z as re, H as ae, I as oe, K as ne, R as ie, Q as ce, x as le } from "./index-DepMUZYx.js";
3
3
  import { useQueries as de, useQuery as ue } from "@tanstack/react-query";
4
4
  import { useRef as pe, useEffect as C, useMemo as I } from "react";
5
5
  import { useTranslation as w } from "react-i18next";
6
- const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", ye = "Observations-module_secondary__14nuS", y = {
6
+ const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", fe = "Observations-module_secondary__14nuS", f = {
7
7
  observations: be,
8
8
  title: me,
9
9
  wrapper: ve,
10
- secondary: ye
10
+ secondary: fe
11
11
  }, U = (t, l, n, c, u, r) => {
12
12
  const a = x(t, l, u), e = a.value, p = z(e);
13
13
  let o = e;
@@ -27,14 +27,14 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
27
27
  hideThumbnail: r
28
28
  }
29
29
  )), p === "PDF" && (o = /* @__PURE__ */ i(Z, { id: `${e}-pdf`, src: e }));
30
- const b = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
30
+ const b = /* @__PURE__ */ N("div", { className: f.wrapper, children: [
31
31
  /* @__PURE__ */ i("span", { children: a.header.display }),
32
- a.header.referenceRange && /* @__PURE__ */ i("span", { className: y.secondary, children: a.header.referenceRange })
32
+ a.header.referenceRange && /* @__PURE__ */ i("span", { className: f.secondary, children: a.header.referenceRange })
33
33
  ] }), d = u("OBSERVATIONS_RECORDED_BY", {
34
34
  provider: a.provider
35
- }), m = t.effectiveDateTime ? H(t.effectiveDateTime, u, !0).formattedResult : void 0, _ = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
35
+ }), m = t.effectiveDateTime ? H(t.effectiveDateTime, u, !0).formattedResult : void 0, _ = /* @__PURE__ */ N("div", { className: f.wrapper, children: [
36
36
  /* @__PURE__ */ i("span", { children: d }),
37
- m && /* @__PURE__ */ i("span", { className: y.secondary, children: m })
37
+ m && /* @__PURE__ */ i("span", { className: f.secondary, children: m })
38
38
  ] }), v = t.display, g = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = c ? `${c}-${g}-${v}-${n}-${l}` : `${g}-${v}-${n}-${l}`;
39
39
  return /* @__PURE__ */ i(
40
40
  P,
@@ -48,7 +48,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
48
48
  },
49
49
  `obs-${t.id}`
50
50
  );
51
- }, fe = (t, l, n, c, u, r, a) => /* @__PURE__ */ i(
51
+ }, ye = (t, l, n, c, u, r, a) => /* @__PURE__ */ i(
52
52
  F,
53
53
  {
54
54
  title: t.display,
@@ -91,7 +91,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
91
91
  )
92
92
  ),
93
93
  r.groupedObservations.map(
94
- (o, b) => fe(
94
+ (o, b) => ye(
95
95
  o,
96
96
  c,
97
97
  a,
@@ -148,7 +148,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
148
148
  type: "error"
149
149
  }), p.current.add(0)) : !s && R && p.current.clear();
150
150
  }, [m, b, d]);
151
- const _ = I(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = I(() => [.../* @__PURE__ */ new Set([..._, ...r])], [_, r]), f = I(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), g = e === "latest" || e === "latest-encounter", O = ee(
151
+ const _ = I(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = I(() => [.../* @__PURE__ */ new Set([..._, ...r])], [_, r]), y = I(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), g = e === "latest" || e === "latest-encounter", O = ee(
152
152
  l,
153
153
  n
154
154
  ), {
@@ -172,7 +172,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
172
172
  v,
173
173
  n
174
174
  ),
175
- enabled: !!o && v.length > 0 && f && !O
175
+ enabled: !!o && v.length > 0 && y && !O
176
176
  });
177
177
  re(
178
178
  (s) => {
@@ -198,14 +198,14 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
198
198
  { key: "name", header: "name" },
199
199
  { key: "value", header: "value" },
200
200
  { key: "form", header: "form" }
201
- ], A = V || !f, B = S && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, M = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, k = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = L.length > 0 && !A && !B, T = c.titleTranslationKey, h = T ? d(T) : "";
201
+ ], A = V || !y, B = S && y, Q = (!E || E.entry?.length === 0 || v.length === 0) && y, M = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, k = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = L.length > 0 && !A && !B, T = c.titleTranslationKey, h = T ? d(T) : "";
202
202
  return /* @__PURE__ */ N(
203
203
  "div",
204
204
  {
205
205
  id: "observations",
206
206
  "data-testid": T ? `observations-${h}` : "observations",
207
207
  "aria-label": "observations-aria-label",
208
- className: y.observations,
208
+ className: f.observations,
209
209
  children: [
210
210
  /* @__PURE__ */ i(
211
211
  ce,
@@ -213,7 +213,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
213
213
  id: "observations-title",
214
214
  testId: T ? `observations-title-${h}` : "observations-title",
215
215
  title: h,
216
- className: y.title,
216
+ className: f.title,
217
217
  children: /* @__PURE__ */ i("p", { children: h })
218
218
  }
219
219
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAGL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAyNlB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+IxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE,OAAO,EAGL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAkPlB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqKxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -35,5 +35,6 @@ export interface DocumentUploadProps {
35
35
  config?: DocumentUploadConfig;
36
36
  documentsTitle?: string;
37
37
  isSaving?: boolean;
38
+ defaultOption?: string | null;
38
39
  }
39
40
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/documentUpload/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,iBAAiB,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACxD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/documentUpload/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,iBAAiB,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACxD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface DocumentPreviewAttachment {
3
+ url: string;
4
+ contentType?: string;
5
+ }
6
+ export interface DocumentPreviewProps {
7
+ id: string;
8
+ title: string;
9
+ attachments: DocumentPreviewAttachment[];
10
+ }
11
+ /**
12
+ * One thumbnail per document. Opening it previews every attachment of the
13
+ * document, one below the other, instead of only the first file.
14
+ */
15
+ export declare const DocumentPreview: React.FC<DocumentPreviewProps>;
16
+ export default DocumentPreview;
17
+ //# sourceMappingURL=DocumentPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPreview.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,yBAAyB,EAAE,CAAC;CAC1C;AAqCD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0E1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { default as DocumentsTable } from './DocumentsTable';
2
+ export { DocumentPreview } from './DocumentPreview';
3
+ export type { DocumentPreviewAttachment, DocumentPreviewProps, } from './DocumentPreview';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}