@bahmni/widgets 0.0.1-dev.456 → 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, 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";
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", Xe = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "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: Xe,
20
+ documentTypeCell: Ze,
21
21
  printAllButton: Je,
22
- attachmentHeader: Ze
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
- X,
295
+ Z,
296
296
  {
297
297
  autoAlign: !0,
298
298
  size: "lg",
@@ -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
- X,
379
+ Z,
380
380
  {
381
381
  kind: "ghost",
382
382
  size: "sm",
@@ -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,13 +1,13 @@
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, C as ce, k as ue, l as fe, m as be, X as he, n as Ne, o as ye, J as Oe, d as ge, _ as x, P as V, A as pe, x as $, q as Te, r as Ee, W as Ie, O as Ae, s as Fe } from "./index-BSjeukzT.js";
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
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", Ue = ({
10
+ }, Ce = "startConsultation", ke = ({
11
11
  episodeOfCareUuids: F,
12
12
  encounterUuids: m,
13
13
  config: G,
@@ -24,23 +24,23 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
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: X,
29
+ isError: C,
30
+ error: Z,
31
31
  refetch: Y
32
32
  } = A({
33
33
  queryKey: ["forms", c, F],
34
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(
@@ -60,10 +60,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
60
60
  (e) => !b || e.encounterUuid !== b ? !1 : M(e.formName),
61
61
  [b, M]
62
62
  ), {
63
- data: p,
64
- isLoading: Z,
63
+ data: T,
64
+ isLoading: X,
65
65
  isError: ee,
66
- error: T
66
+ error: p
67
67
  } = A({
68
68
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
69
69
  queryFn: () => be(a.encounterUuid),
@@ -75,10 +75,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
75
75
  },
76
76
  [c]
77
77
  );
78
- const re = i(() => !p?.entry || !a?.formName ? [] : p.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => Ne(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [p, a?.formName]), te = i(() => {
79
- if (T)
80
- return Oe(T).message;
81
- }, [T]), f = i(
78
+ const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => Ne(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), te = i(() => {
79
+ if (p)
80
+ return Oe(p).message;
81
+ }, [p]), f = i(
82
82
  () => [
83
83
  { key: "recordedOn", header: o("RECORDED_ON") },
84
84
  { key: "recordedBy", header: o("RECORDED_BY") }
@@ -96,7 +96,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
96
96
  { key: "recordedBy", sortable: !0 }
97
97
  ],
98
98
  []
99
- ), k = i(() => {
99
+ ), U = i(() => {
100
100
  const e = S.reduce(
101
101
  (s, r) => {
102
102
  const l = r.formName;
@@ -121,13 +121,13 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
121
121
  )
122
122
  })
123
123
  ).sort((s, r) => s.formName.localeCompare(r.formName));
124
- }, [S, o]), U = d((e) => {
124
+ }, [S, o]), k = d((e) => {
125
125
  v(e), _(!0);
126
126
  }, []), H = d(() => {
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",
@@ -141,7 +141,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
141
141
  (e, t) => {
142
142
  switch (t) {
143
143
  case "recordedOn":
144
- return /* @__PURE__ */ n(pe, { onClick: () => U(e), children: e.recordedOn });
144
+ return /* @__PURE__ */ n(Te, { onClick: () => k(e), children: e.recordedOn });
145
145
  case "recordedBy":
146
146
  return e.recordedBy;
147
147
  case "actions":
@@ -160,23 +160,23 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
160
160
  return null;
161
161
  }
162
162
  },
163
- [U, E, u, o]
163
+ [k, E, u, o]
164
164
  );
165
165
  return /* @__PURE__ */ q(ie, { children: [
166
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || k.length === 0 || R ? /* @__PURE__ */ n(
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 ? X?.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,
177
177
  dataTestId: "forms-table"
178
178
  }
179
- ) : /* @__PURE__ */ n(Te, { align: "start", children: k.map((e, t) => {
179
+ ) : /* @__PURE__ */ n(pe, { align: "start", children: U.map((e, t) => {
180
180
  const { formName: s, records: r } = e, l = se(r);
181
181
  return /* @__PURE__ */ n(
182
182
  Ee,
@@ -235,7 +235,7 @@ 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"),
@@ -249,5 +249,5 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
249
249
  ] });
250
250
  };
251
251
  export {
252
- Ue as default
252
+ ke as default
253
253
  };
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { t as G, v as F, w as x, K as z, d as H, y as P, F as j, z as X, B as J, u as W, b as Y, D as Z, C as ee, E as se, G as te, X as re, H as ae, I as oe, L as ne, R as ie, Q as ce, x as le } from "./index-BSjeukzT.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
- X,
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(J, { 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 })
@@ -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 = W(), { addNotification: b } = Y(), { 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,7 +188,7 @@ 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));
@@ -198,7 +198,7 @@ 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
- ], B = V || !f, L = S && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, M = L ? d("ERROR_FETCHING_OBSERVATIONS") : null, k = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = 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
  {
@@ -220,7 +220,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
220
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
  }
@@ -230,7 +230,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
230
230
  headers: K,
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
- loading: B,
233
+ loading: A,
234
234
  errorStateMessage: M,
235
235
  emptyStateMessage: k ?? d("NO_OBSERVATIONS_AVAILABLE"),
236
236
  dataTestId: "observations-table"