@bahmni/widgets 0.0.1-dev.282 → 0.0.1-dev.284

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,5 +1,5 @@
1
- import { jsx as r, jsxs as T, Fragment as X } from "react/jsx-runtime";
2
- import { u as Y, a as W, y as J, X as Z, O as x, b as ee, I as te } from "./index-FhPWvTDE.js";
1
+ import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
2
+ import { u as W, a as X, y as J, t as Z, O as x, i as ee, I as te } from "./index-Ce2aA1IO.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as _, useEffect as g, useMemo as p } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -35,14 +35,14 @@ const Te = [
35
35
  "uploadedOn",
36
36
  "uploadedBy"
37
37
  ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], ge = ({ config: n, encounterUuids: E }) => {
38
- const [d, L] = l(!1), [s, U] = l(
38
+ const [d, w] = l(!1), [s, L] = l(
39
39
  null
40
40
  ), [P, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
- ), f = Y(), { t: o } = ae(), { addNotification: w } = W(), V = Number(n?.pageSize) || 5, [N, O] = l(1), [u, $] = l(V), [k, C] = l(void 0), v = _((e) => {
43
- U(e), L(!0);
42
+ ), f = W(), { t: o } = ae(), { addNotification: U } = X(), V = Number(n?.pageSize) || 5, [N, O] = l(1), [u, $] = l(V), [k, C] = l(void 0), v = _((e) => {
43
+ L(e), w(!0);
44
44
  }, []), z = _(() => {
45
- L(!1), U(null), A(/* @__PURE__ */ new Set());
45
+ w(!1), L(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), R = _((e) => {
47
47
  A((t) => new Set(t).add(e));
48
48
  }, []), { data: i, isLoading: H, isError: S, error: y } = ne({
@@ -66,12 +66,12 @@ const Te = [
66
66
  }, [i]), g(() => {
67
67
  O(1), C(void 0);
68
68
  }, [f]), g(() => {
69
- S && w({
69
+ S && U({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
71
  message: y?.message ?? "",
72
72
  type: "error"
73
73
  });
74
- }, [S, y, w, o]), g(() => {
74
+ }, [S, y, U, o]), g(() => {
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
77
  if (!d || !s) return;
@@ -138,7 +138,7 @@ const Te = [
138
138
  },
139
139
  [v, o]
140
140
  );
141
- return /* @__PURE__ */ T(X, { children: [
141
+ return /* @__PURE__ */ T(Y, { children: [
142
142
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
143
143
  ee,
144
144
  {
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
2
- import { K as re, u as te, x as oe, Q as ae, W as se, J as ne, L as de, d as ie, M as U, O as me, X as le, b as x, c as ce, e as ue, I as fe, f as ye } from "./index-FhPWvTDE.js";
2
+ import { K as re, u as te, x as oe, Q as ae, W as se, J as ne, L as de, d as ie, M as U, O as me, t as le, i as x, X as ce, b as ue, I as fe, c as ye } from "./index-Ce2aA1IO.js";
3
3
  import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as k, useMemo as d, useCallback as b } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
@@ -15,17 +15,17 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
15
15
  }) => {
16
16
  const { t: s } = pe(), l = te(), [c, I] = k(!1), [o, M] = k(null), {
17
17
  numberOfVisits: K,
18
- hideThumbnail: P = !1,
18
+ hideThumbnail: w = !1,
19
19
  forms: u
20
20
  } = p ?? {}, A = oe(
21
21
  m,
22
22
  i
23
- ), w = be(), {
23
+ ), P = be(), {
24
24
  data: D = [],
25
25
  isLoading: v,
26
26
  isError: L,
27
- error: H,
28
- refetch: Q
27
+ error: Q,
28
+ refetch: H
29
29
  } = y({
30
30
  queryKey: ["forms", l, m],
31
31
  queryFn: () => ae(l, void 0, K),
@@ -66,7 +66,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
66
66
  });
67
67
  ie(
68
68
  (e) => {
69
- e.patientUUID === l && e.updatedConcepts.size > 0 && (Q(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
+ e.patientUUID === l && e.updatedConcepts.size > 0 && (H(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
70
  },
71
71
  [l]
72
72
  );
@@ -84,7 +84,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
84
84
  { key: "recordedBy", header: s("RECORDED_BY") }
85
85
  ],
86
86
  [s]
87
- ), X = d(
87
+ ), W = d(
88
88
  () => [
89
89
  { key: "recordedOn", sortable: !0 },
90
90
  { key: "recordedBy", sortable: !0 }
@@ -117,7 +117,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
117
117
  ).sort((r, a) => r.formName.localeCompare(a.formName));
118
118
  }, [B, s]), S = b((e) => {
119
119
  M(e), I(!0);
120
- }, []), W = b(() => {
120
+ }, []), X = b(() => {
121
121
  I(!1), M(null);
122
122
  }, []), q = b(
123
123
  (e, t) => {
@@ -140,7 +140,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
140
140
  ariaLabel: s("FORMS_HEADING"),
141
141
  rows: [],
142
142
  loading: v,
143
- errorStateMessage: L ? H?.message : void 0,
143
+ errorStateMessage: L ? Q?.message : void 0,
144
144
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
145
145
  renderCell: q,
146
146
  className: E.formsTableBody,
@@ -163,7 +163,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
163
163
  rows: a,
164
164
  loading: !1,
165
165
  errorStateMessage: "",
166
- sortable: X,
166
+ sortable: W,
167
167
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
168
168
  renderCell: q,
169
169
  className: E.formsTableBody,
@@ -180,7 +180,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
180
180
  id: "modalIdForActionAreaLayout",
181
181
  portalId: "main-display-area",
182
182
  open: c,
183
- onRequestClose: W,
183
+ onRequestClose: X,
184
184
  modalHeading: o.formName,
185
185
  modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
186
186
  passiveModal: !0,
@@ -195,7 +195,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
195
195
  errorMessage: J,
196
196
  emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
197
197
  testIdPrefix: o.formName,
198
- hideThumbnail: P
198
+ hideThumbnail: w
199
199
  }
200
200
  )
201
201
  }
@@ -1,13 +1,13 @@
1
1
  import { jsx as l, jsxs as U } from "react/jsx-runtime";
2
- import { g as K, h as C, t as V, i as Q, j as k, p as q, k as G, l as P, u as j, a as H, U as z, N as J, d as Y, m as W, n as X, s as Z, o as x, b as ee } from "./index-FhPWvTDE.js";
2
+ import { f as M, e as C, g as V, h as Q, o as k, j as H, w as q, m as G, u as P, a as j, U as z, N as J, d as Y, k as W, l as X, s as Z, H as x, i as ee } from "./index-Ce2aA1IO.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
- import { useRef as oe, useEffect as N, useMemo as g } from "react";
4
+ import { useRef as oe, useEffect as N, useMemo as h } from "react";
5
5
  import { useTranslation as D } from "react-i18next";
6
- const B = (t, i, c, d, u, r) => {
6
+ const w = (t, i, c, d, u, r) => {
7
7
  const s = V(t, i, u), o = s.value, a = Q(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ l(
10
- q,
10
+ H,
11
11
  {
12
12
  imageSrc: o,
13
13
  alt: o,
@@ -15,16 +15,16 @@ const B = (t, i, c, d, u, r) => {
15
15
  hideThumbnail: r
16
16
  }
17
17
  )), a === "Video" && (n = /* @__PURE__ */ l(
18
- G,
18
+ q,
19
19
  {
20
20
  id: `${o}-video`,
21
21
  videoSrc: o,
22
22
  hideThumbnail: r
23
23
  }
24
- )), a === "PDF" && (n = /* @__PURE__ */ l(P, { id: `${o}-pdf`, src: o }));
24
+ )), a === "PDF" && (n = /* @__PURE__ */ l(G, { id: `${o}-pdf`, src: o }));
25
25
  const b = u("OBSERVATIONS_RECORDED_BY", {
26
26
  provider: s.provider
27
- }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
27
+ }), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
28
28
  return /* @__PURE__ */ l(
29
29
  k,
30
30
  {
@@ -44,7 +44,7 @@ const B = (t, i, c, d, u, r) => {
44
44
  id: `grouped-obs-${t.display}-${d}`,
45
45
  open: c,
46
46
  children: t.members?.map(
47
- (o, a) => B(
47
+ (o, a) => w(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -61,7 +61,7 @@ const B = (t, i, c, d, u, r) => {
61
61
  hideThumbnail: c
62
62
  }) => {
63
63
  const { t: d } = D(), u = (r, s, o) => {
64
- const a = K(r.encounterDetails, d);
64
+ const a = M(r.encounterDetails, d);
65
65
  return /* @__PURE__ */ U(
66
66
  C,
67
67
  {
@@ -70,7 +70,7 @@ const B = (t, i, c, d, u, r) => {
70
70
  open: s,
71
71
  children: [
72
72
  r.observations.map(
73
- (n, b) => B(
73
+ (n, b) => w(
74
74
  n,
75
75
  b,
76
76
  o,
@@ -114,7 +114,7 @@ const B = (t, i, c, d, u, r) => {
114
114
  conceptNames: c = [],
115
115
  conceptUuid: d = [],
116
116
  hideThumbnail: u = !1
117
- } = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = H(), { t: a } = D(), n = te({
117
+ } = i, r = oe(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: a } = D(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
120
  queryFn: () => z(e),
@@ -133,39 +133,39 @@ const B = (t, i, c, d, u, r) => {
133
133
  } else e.isError || r.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
- data: m,
136
+ const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
+ data: p,
138
138
  isLoading: y,
139
- isError: h,
139
+ isError: g,
140
140
  refetch: T
141
141
  } = se({
142
- queryKey: de(s, p),
143
- queryFn: () => J(s, p),
144
- enabled: !!s && p.length > 0 && f
142
+ queryKey: de(s, m),
143
+ queryFn: () => J(s, m),
144
+ enabled: !!s && m.length > 0 && f
145
145
  });
146
146
  Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (R) => p.includes(R)
149
+ (R) => m.includes(R)
150
150
  ) && T();
151
151
  },
152
152
  [s, T]
153
153
  ), N(() => {
154
- h && o({
154
+ g && o({
155
155
  title: a("ERROR_DEFAULT_TITLE"),
156
156
  message: a("ERROR_FETCHING_OBSERVATIONS"),
157
157
  type: "error"
158
158
  });
159
- }, [h]);
160
- const _ = g(() => {
161
- if (!m) return [];
162
- const e = W(m), v = X(e);
159
+ }, [g]);
160
+ const _ = h(() => {
161
+ if (!p) return [];
162
+ const e = W(p), v = X(e);
163
163
  return Z(v);
164
- }, [m]), w = [
164
+ }, [p]), B = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], I = y || !f, $ = h && f, A = (!m || m.entry?.length === 0 || p.length === 0) && f, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
168
+ ], I = y || !f, $ = g && f, A = (!p || p.entry?.length === 0 || m.length === 0) && f, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? a("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
169
  return /* @__PURE__ */ U(
170
170
  "div",
171
171
  {
@@ -184,7 +184,7 @@ const B = (t, i, c, d, u, r) => {
184
184
  children: /* @__PURE__ */ l("p", { children: E })
185
185
  }
186
186
  ),
187
- M ? /* @__PURE__ */ l(
187
+ K ? /* @__PURE__ */ l(
188
188
  ae,
189
189
  {
190
190
  groupedData: _,
@@ -194,7 +194,7 @@ const B = (t, i, c, d, u, r) => {
194
194
  ) : /* @__PURE__ */ l(
195
195
  ee,
196
196
  {
197
- headers: w,
197
+ headers: B,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: I,