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

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, 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
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", Xe = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", c = {
7
7
  documentsTableBody: He,
8
8
  viewAttachmentsLink: Be,
9
9
  documentViewerContainer: $e,
@@ -17,8 +17,8 @@ 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,
20
+ documentTypeCell: Xe,
21
+ printAllButton: Je,
22
22
  attachmentHeader: Ze
23
23
  }, xe = {
24
24
  documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
@@ -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
+ X,
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
+ X,
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
  ] }),
@@ -1,37 +1,37 @@
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, 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";
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
6
  const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
7
7
  formsTableBody: Re,
8
8
  modalHeading: Ce,
9
9
  customAccordianItem: De
10
- }, Le = "startConsultation", ke = ({
10
+ }, Le = "startConsultation", Ue = ({
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
27
  data: C = [],
28
28
  isLoading: D,
29
29
  isError: L,
30
- error: Y,
31
- refetch: X
30
+ error: X,
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
37
  let e = C;
@@ -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: T,
63
+ data: p,
64
64
  isLoading: Z,
65
65
  isError: ee,
66
- error: p
66
+ error: T
67
67
  } = A({
68
68
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
69
69
  queryFn: () => be(a.encounterUuid),
@@ -71,14 +71,14 @@ 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
  );
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(
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(
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
- ), U = i(() => {
99
+ ), k = i(() => {
100
100
  const e = S.reduce(
101
101
  (s, r) => {
102
102
  const l = r.formName;
@@ -121,7 +121,7 @@ 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]), k = d((e) => {
124
+ }, [S, o]), U = d((e) => {
125
125
  v(e), _(!0);
126
126
  }, []), H = d(() => {
127
127
  _(!1), v(null);
@@ -141,12 +141,12 @@ 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(Te, { onClick: () => k(e), children: e.recordedOn });
144
+ return /* @__PURE__ */ n(pe, { onClick: () => U(e), children: e.recordedOn });
145
145
  case "recordedBy":
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",
@@ -160,23 +160,23 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
160
160
  return null;
161
161
  }
162
162
  },
163
- [k, E, u, o]
163
+ [U, 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 || L || k.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: L ? X?.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(pe, { align: "start", children: U.map((e, t) => {
179
+ ) : /* @__PURE__ */ n(Te, { align: "start", children: k.map((e, t) => {
180
180
  const { formName: s, records: r } = e, l = se(r);
181
181
  return /* @__PURE__ */ n(
182
182
  Ee,
@@ -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",
@@ -240,7 +240,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
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
  )
@@ -249,5 +249,5 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
249
249
  ] });
250
250
  };
251
251
  export {
252
- ke as default
252
+ Ue as default
253
253
  };
@@ -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 { 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";
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
+ X,
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(J, { 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,7 +133,7 @@ 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 = W(), { addNotification: b } = Y(), { t: d } = w(), m = de({
137
137
  queries: u.map((s) => ({
138
138
  queryKey: Ee(s),
139
139
  queryFn: () => Z(s),
@@ -194,11 +194,11 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
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
+ ], 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) : "";
202
202
  return /* @__PURE__ */ N(
203
203
  "div",
204
204
  {
@@ -217,7 +217,7 @@ 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
223
  groupedData: A,
@@ -227,12 +227,12 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
227
227
  ) : /* @__PURE__ */ i(
228
228
  le,
229
229
  {
230
- headers: Q,
230
+ headers: K,
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
233
  loading: B,
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
  )