@bahmni/widgets 0.0.1-dev.455 → 0.0.1-dev.457

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.
@@ -1,9 +1,9 @@
1
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, d as De, Q as Ie, A as Le, i as Oe, M as be, e as ye, _ as J, N as Se, f as ve, x as we, W as Me, g as Ue, h as X, j as te } from "./index-DgKYjKyR.js";
2
+ import { p as fe, a as Ae, u as ge, b as Ce, c as Ne, d as De, Z as Ie, A as Le, e as Oe, M as be, Q as ye, _ as Z, N as Se, f as ve, x as we, W as Me, g as Ue, h as J, i as te } from "./index-B4qp8zC7.js";
3
3
  import { useQuery as Re } from "@tanstack/react-query";
4
4
  import { useState as p, useRef as Pe, useEffect as f, useMemo as A, useCallback as E } from "react";
5
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", Je = "DocumentsTable-module_documentTypeCell__uWGM8", Xe = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", c = {
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", Ze = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "DocumentsTable-module_printAllButton__IVYUW", Xe = "DocumentsTable-module_attachmentHeader__yI2xn", c = {
7
7
  documentsTableBody: He,
8
8
  viewAttachmentsLink: Be,
9
9
  documentViewerContainer: $e,
@@ -17,9 +17,9 @@ const He = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
17
17
  hiddenWhileLoading: Ke,
18
18
  documentImage: Qe,
19
19
  header: je,
20
- documentTypeCell: Je,
21
- printAllButton: Xe,
22
- attachmentHeader: Ze
20
+ documentTypeCell: Ze,
21
+ printAllButton: Je,
22
+ attachmentHeader: Xe
23
23
  }, xe = {
24
24
  documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
25
25
  documentType: "DOCUMENTS_TYPE",
@@ -72,7 +72,7 @@ async function rt(n, d, {
72
72
  );
73
73
  }
74
74
  }
75
- const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-print-container", x = () => /* @__PURE__ */ o(te, {}), it = /* @__PURE__ */ new Set([
75
+ const ct = "startConsultation", lt = "add", dt = "documents", X = "document-print-container", x = () => /* @__PURE__ */ o(te, {}), it = /* @__PURE__ */ new Set([
76
76
  "ArrowUp",
77
77
  "ArrowDown",
78
78
  "PageUp",
@@ -223,7 +223,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
223
223
  if (!r || I.current) return;
224
224
  const a = new AbortController(), { signal: u } = a;
225
225
  I.current = a, V(t);
226
- const i = document.getElementById(Z);
226
+ const i = document.getElementById(X);
227
227
  try {
228
228
  await rt(
229
229
  e,
@@ -292,7 +292,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
292
292
  oe && /* @__PURE__ */ _(ye, { className: c.header, testId: "documents-header", children: [
293
293
  /* @__PURE__ */ o("p", { children: s("DOCUMENTS_TABLE_HEADING") }),
294
294
  /* @__PURE__ */ o(
295
- J,
295
+ Z,
296
296
  {
297
297
  autoAlign: !0,
298
298
  size: "lg",
@@ -341,7 +341,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
341
341
  kind: "tertiary",
342
342
  size: "sm",
343
343
  className: c.printAllButton,
344
- renderIcon: R === "all" ? x : X,
344
+ renderIcon: R === "all" ? x : J,
345
345
  disabled: W || !K,
346
346
  testId: "print-all-attachments",
347
347
  onClick: () => Q(j, "all"),
@@ -376,7 +376,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
376
376
  total: m.length
377
377
  }) }) : /* @__PURE__ */ o("span", {}),
378
378
  /* @__PURE__ */ o(
379
- J,
379
+ Z,
380
380
  {
381
381
  kind: "ghost",
382
382
  size: "sm",
@@ -386,7 +386,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
386
386
  disabled: W || !K,
387
387
  testId: `print-attachment-${t}`,
388
388
  onClick: () => Q([e], t),
389
- children: R === t ? /* @__PURE__ */ o(x, {}) : /* @__PURE__ */ o(X, {})
389
+ children: R === t ? /* @__PURE__ */ o(x, {}) : /* @__PURE__ */ o(J, {})
390
390
  }
391
391
  )
392
392
  ] }),
@@ -429,7 +429,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
429
429
  `${r.id}-${e.url}`
430
430
  );
431
431
  }),
432
- /* @__PURE__ */ o("div", { id: Z, className: c.printContainer })
432
+ /* @__PURE__ */ o("div", { id: X, className: c.printContainer })
433
433
  ] })
434
434
  }
435
435
  )
@@ -1,46 +1,46 @@
1
- import { jsx as n, jsxs as x, Fragment as ie } from "react/jsx-runtime";
2
- import { u as de, c as le, k as me, C as ce, l as ue, m as fe, n as be, Q as he, o as Ne, q as ye, J as Oe, i as ge, _ as q, P as V, A as Te, x as $, r as pe, s as Ee, W as Ie, O as Ae, t as Fe } from "./index-DgKYjKyR.js";
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";
3
3
  import { useQueryClient as _e, useQuery as A } from "@tanstack/react-query";
4
- import { useState as G, useMemo as i, useCallback as d } from "react";
4
+ import { useState as j, useMemo as i, useCallback as d } from "react";
5
5
  import { useTranslation as ve } from "react-i18next";
6
- const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
6
+ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
7
7
  formsTableBody: Re,
8
- modalHeading: Ce,
8
+ modalHeading: Le,
9
9
  customAccordianItem: De
10
- }, Le = "startConsultation", ke = ({
10
+ }, Ce = "startConsultation", ke = ({
11
11
  episodeOfCareUuids: F,
12
12
  encounterUuids: m,
13
- config: Q,
14
- disableActions: j = !1,
13
+ config: G,
14
+ disableActions: z = !1,
15
15
  activeEncounterUuid: b = null
16
16
  }) => {
17
- const { t: o } = ve(), c = de(), [O, _] = G(!1), [a, v] = G(null), {
18
- numberOfVisits: z,
19
- hideThumbnail: K = !1,
17
+ const { t: o } = ve(), c = de(), [O, _] = j(!1), [a, v] = j(null), {
18
+ numberOfVisits: K,
19
+ hideThumbnail: Q = !1,
20
20
  forms: h
21
- } = Q ?? {}, W = le(
21
+ } = G ?? {}, W = le(
22
22
  Fe.EDIT_OBSERVATIONS
23
- ), { userPrivileges: N } = me(), g = W && !j && !!b, R = ce(
23
+ ), { userPrivileges: N } = me(), g = W && !z && !!b, R = ce(
24
24
  F,
25
25
  m
26
26
  ), J = _e(), {
27
- data: C = [],
27
+ data: L = [],
28
28
  isLoading: D,
29
- isError: L,
30
- error: Y,
31
- refetch: X
29
+ isError: C,
30
+ error: Z,
31
+ refetch: Y
32
32
  } = A({
33
33
  queryKey: ["forms", c, F],
34
- queryFn: () => ue(c, void 0, z),
34
+ queryFn: () => ue(c, void 0, K),
35
35
  enabled: !!c && !R
36
36
  }), S = i(() => {
37
- let e = C;
37
+ let e = L;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (t) => m.includes(t.encounterUuid)
40
40
  )), Array.isArray(h) && h.length > 0 && (e = e.filter(
41
41
  (t) => h.some((s) => s.toLowerCase() === t.formName.toLowerCase())
42
42
  )), e;
43
- }, [C, m, h]), { data: B = [] } = A({
43
+ }, [L, m, h]), { data: B = [] } = A({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => fe()
46
46
  }), M = d(
@@ -61,7 +61,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
61
61
  [b, M]
62
62
  ), {
63
63
  data: T,
64
- isLoading: Z,
64
+ isLoading: X,
65
65
  isError: ee,
66
66
  error: p
67
67
  } = A({
@@ -71,7 +71,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
71
71
  });
72
72
  he(
73
73
  (e) => {
74
- e.patientUUID === c && (X(), J.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
+ e.patientUUID === c && (Y(), J.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
75
75
  },
76
76
  [c]
77
77
  );
@@ -127,7 +127,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
127
127
  _(!1), v(null);
128
128
  }, []), E = d((e) => {
129
129
  globalThis.dispatchEvent(
130
- new CustomEvent(Le, {
130
+ new CustomEvent(Ce, {
131
131
  detail: {
132
132
  editOnly: "observationForms",
133
133
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -146,7 +146,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
146
146
  return e.recordedBy;
147
147
  case "actions":
148
148
  return u(e) ? /* @__PURE__ */ n(
149
- q,
149
+ x,
150
150
  {
151
151
  label: o("EDIT_OBSERVATION_FORM"),
152
152
  kind: "ghost",
@@ -162,15 +162,15 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
162
162
  },
163
163
  [k, E, u, o]
164
164
  );
165
- return /* @__PURE__ */ x(ie, { children: [
166
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || U.length === 0 || R ? /* @__PURE__ */ n(
165
+ return /* @__PURE__ */ q(ie, { children: [
166
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || C || U.length === 0 || R ? /* @__PURE__ */ n(
167
167
  $,
168
168
  {
169
169
  headers: oe,
170
170
  ariaLabel: o("FORMS_HEADING"),
171
171
  rows: [],
172
172
  loading: D,
173
- errorStateMessage: L ? Y?.message : void 0,
173
+ errorStateMessage: C ? Z?.message : void 0,
174
174
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
175
175
  renderCell: P,
176
176
  className: y.formsTableBody,
@@ -211,10 +211,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
211
211
  portalId: "main-display-area",
212
212
  open: O,
213
213
  onRequestClose: H,
214
- modalHeading: /* @__PURE__ */ x("div", { className: y.modalHeading, children: [
214
+ modalHeading: /* @__PURE__ */ q("div", { className: y.modalHeading, children: [
215
215
  /* @__PURE__ */ n("span", { children: a.formName }),
216
216
  g && u(a) && /* @__PURE__ */ n(
217
- q,
217
+ x,
218
218
  {
219
219
  label: o("EDIT_OBSERVATION_FORM"),
220
220
  kind: "ghost",
@@ -235,12 +235,12 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
235
235
  Ae,
236
236
  {
237
237
  observations: re,
238
- isLoading: Z,
238
+ isLoading: X,
239
239
  isError: ee,
240
240
  errorMessage: te,
241
241
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
242
242
  testIdPrefix: a.formName,
243
- hideThumbnail: K,
243
+ hideThumbnail: Q,
244
244
  formName: a.formName
245
245
  }
246
246
  )
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { v as q, w as F, y as x, G as z, i as H, z as P, F as j, B as J, D as W, u as Y, b as X, E as Z, C as ee, H as se, I as te, Q as re, K as ae, L as oe, R as ne, S as ie, e as ce, x as le } from "./index-DgKYjKyR.js";
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";
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";
@@ -20,13 +20,13 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
20
20
  hideThumbnail: r
21
21
  }
22
22
  )), p === "Video" && (o = /* @__PURE__ */ i(
23
- J,
23
+ W,
24
24
  {
25
25
  id: `${e}-video`,
26
26
  videoSrc: e,
27
27
  hideThumbnail: r
28
28
  }
29
- )), p === "PDF" && (o = /* @__PURE__ */ i(W, { id: `${e}-pdf`, src: e }));
29
+ )), p === "PDF" && (o = /* @__PURE__ */ i(Z, { id: `${e}-pdf`, src: e }));
30
30
  const b = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
31
31
  /* @__PURE__ */ i("span", { children: a.header.display }),
32
32
  a.header.referenceRange && /* @__PURE__ */ i("span", { className: y.secondary, children: a.header.referenceRange })
@@ -72,7 +72,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
72
72
  hideThumbnail: n
73
73
  }) => {
74
74
  const { t: c } = w(), u = (r, a, e) => {
75
- const p = q(r.encounterDetails, c);
75
+ const p = G(r.encounterDetails, c);
76
76
  return /* @__PURE__ */ N(
77
77
  F,
78
78
  {
@@ -133,10 +133,10 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
133
133
  conceptUuid: r = [],
134
134
  hideThumbnail: a = !1,
135
135
  scope: e = "all"
136
- } = c, p = pe(/* @__PURE__ */ new Set()), o = Y(), { addNotification: b } = X(), { t: d } = w(), m = de({
136
+ } = c, p = pe(/* @__PURE__ */ new Set()), o = J(), { addNotification: b } = Y(), { t: d } = w(), m = de({
137
137
  queries: u.map((s) => ({
138
138
  queryKey: Ee(s),
139
- queryFn: () => Z(s),
139
+ queryFn: () => X(s),
140
140
  enabled: !!s
141
141
  }))
142
142
  });
@@ -188,17 +188,17 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
188
188
  type: "error"
189
189
  });
190
190
  }, [S]);
191
- const A = I(() => {
191
+ const L = I(() => {
192
192
  if (!E) return [];
193
193
  let s = ae(E);
194
194
  e === "latest-encounter" && (s = oe(s));
195
195
  const R = ne(s);
196
196
  return ie(R);
197
- }, [E, e]), Q = [
197
+ }, [E, e]), K = [
198
198
  { key: "name", header: "name" },
199
199
  { key: "value", header: "value" },
200
200
  { key: "form", header: "form" }
201
- ], B = V || !f, L = S && f, K = (!E || E.entry?.length === 0 || v.length === 0) && f, M = L ? d("ERROR_FETCHING_OBSERVATIONS") : null, G = K ? d("NO_OBSERVATIONS_FOUND") : void 0, k = A.length > 0 && !B && !L, T = c.titleTranslationKey, h = T ? d(T) : "";
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) : "";
202
202
  return /* @__PURE__ */ N(
203
203
  "div",
204
204
  {
@@ -217,22 +217,22 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
217
217
  children: /* @__PURE__ */ i("p", { children: h })
218
218
  }
219
219
  ),
220
- k ? /* @__PURE__ */ i(
220
+ q ? /* @__PURE__ */ i(
221
221
  Oe,
222
222
  {
223
- groupedData: A,
223
+ groupedData: L,
224
224
  title: h,
225
225
  hideThumbnail: a
226
226
  }
227
227
  ) : /* @__PURE__ */ i(
228
228
  le,
229
229
  {
230
- headers: Q,
230
+ headers: K,
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
- loading: B,
233
+ loading: A,
234
234
  errorStateMessage: M,
235
- emptyStateMessage: G ?? d("NO_OBSERVATIONS_AVAILABLE"),
235
+ emptyStateMessage: k ?? d("NO_OBSERVATIONS_AVAILABLE"),
236
236
  dataTestId: "observations-table"
237
237
  }
238
238
  )