@bahmni/widgets 0.0.1-dev.378 → 0.0.1-dev.380

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
1
  import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
2
- import { u as W, a as X, T as J, b as Z, k as x, c as ee, F as te } from "./index-DO4VzF3-.js";
2
+ import { u as W, a as X, T as J, m as Z, k as x, b as ee, F as te } from "./index-Dx9ELBfB.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as $, Fragment as ge } from "react/jsx-runtime";
2
- import { u as be, d as Oe, e as Ne, r as Ee, f as Te, Q as Fe, X as ve, L as Ie, m as _e, g as Ae, h as Re, Y as G, k as De, H as K, Z as Q, b as Le, c as z, n as Me, i as Se, F as Be, O as Ce, C as ke } from "./index-DO4VzF3-.js";
2
+ import { u as be, c as Oe, d as Ne, r as Ee, e as Te, Q as Fe, X as ve, L as Ie, f as _e, g as Ae, h as Re, Y as G, k as De, C as K, B as Q, m as Le, b as z, i as Me, j as Be, F as Ce, O as Se, l as ke } from "./index-Dx9ELBfB.js";
3
3
  import { useQueryClient as Ue, useQuery as E } from "@tanstack/react-query";
4
4
  import { useState as Y, useMemo as d, useCallback as c } from "react";
5
5
  import { useTranslation as we } from "react-i18next";
@@ -11,36 +11,36 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
11
11
  episodeOfCareUuids: D,
12
12
  encounterUuids: m,
13
13
  config: X,
14
- disableActions: Z = !1,
14
+ disableActions: W = !1,
15
15
  activeEncounterUuid: y = null
16
16
  }) => {
17
17
  const { t: n } = we(), u = be(), [g, L] = Y(!1), [a, M] = Y(null), {
18
- numberOfVisits: W,
19
- hideThumbnail: J = !1,
18
+ numberOfVisits: J,
19
+ hideThumbnail: Z = !1,
20
20
  forms: b
21
21
  } = X ?? {}, ee = Oe(
22
22
  ke.EDIT_OBSERVATIONS
23
- ), { userPrivileges: O } = Ne(), F = ee && !Z && !!y, S = Ee(
23
+ ), { userPrivileges: O } = Ne(), F = ee && !W && !!y, B = Ee(
24
24
  D,
25
25
  m
26
26
  ), re = Ue(), {
27
- data: B = [],
28
- isLoading: C,
27
+ data: C = [],
28
+ isLoading: S,
29
29
  isError: k,
30
30
  error: te,
31
31
  refetch: oe
32
32
  } = E({
33
33
  queryKey: ["forms", u, D],
34
- queryFn: () => Te(u, void 0, W),
35
- enabled: !!u && !S
34
+ queryFn: () => Te(u, void 0, J),
35
+ enabled: !!u && !B
36
36
  }), U = d(() => {
37
- let e = B;
37
+ let e = C;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (r) => m.includes(r.encounterUuid)
40
40
  )), Array.isArray(b) && b.length > 0 && (e = e.filter(
41
41
  (r) => b.some((o) => o.toLowerCase() === r.formName.toLowerCase())
42
42
  )), e;
43
- }, [B, m, b]), { data: N = [] } = E({
43
+ }, [C, m, b]), { data: N = [] } = E({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => Fe()
46
46
  }), w = c(
@@ -214,13 +214,13 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
214
214
  [V, R, f, n]
215
215
  );
216
216
  return /* @__PURE__ */ $(ge, { children: [
217
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: C || k || P.length === 0 || S ? /* @__PURE__ */ i(
217
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || k || P.length === 0 || B ? /* @__PURE__ */ i(
218
218
  z,
219
219
  {
220
220
  headers: he,
221
221
  ariaLabel: n("FORMS_HEADING"),
222
222
  rows: [],
223
- loading: C,
223
+ loading: S,
224
224
  errorStateMessage: k ? te?.message : void 0,
225
225
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
226
226
  renderCell: x,
@@ -230,7 +230,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
230
230
  ) : /* @__PURE__ */ i(Me, { align: "start", children: P.map((e, r) => {
231
231
  const { formName: o, records: t } = e, s = fe(t);
232
232
  return /* @__PURE__ */ i(
233
- Se,
233
+ Be,
234
234
  {
235
235
  title: o,
236
236
  className: T.customAccordianItem,
@@ -256,7 +256,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
256
256
  );
257
257
  }) }) }),
258
258
  g && a && /* @__PURE__ */ i(
259
- Be,
259
+ Ce,
260
260
  {
261
261
  id: "modalIdForActionAreaLayout",
262
262
  portalId: "main-display-area",
@@ -283,7 +283,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
283
283
  size: "md",
284
284
  testId: "form-details-modal",
285
285
  children: /* @__PURE__ */ i(
286
- Ce,
286
+ Se,
287
287
  {
288
288
  observations: de,
289
289
  isLoading: se || ne,
@@ -291,7 +291,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
291
291
  errorMessage: ue,
292
292
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
293
293
  testIdPrefix: a.formName,
294
- hideThumbnail: J,
294
+ hideThumbnail: Z,
295
295
  controlOrder: le,
296
296
  sectionMap: ce,
297
297
  conceptDatatypeMap: me
@@ -1,9 +1,9 @@
1
- import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
- import { j as M, _ as C, t as V, D as Q, p as q, z as k, l as z, y as G, u as P, a as j, w as H, o as J, m as Y, q as W, s as X, v as Z, R as x, c as ee } from "./index-DO4VzF3-.js";
1
+ import { jsx as d, jsxs as S } from "react/jsx-runtime";
2
+ import { n as M, z as C, t as V, D as Q, o as q, y as k, N as z, p as G, u as P, a as H, w as j, q as J, f as Y, s as W, v as X, x as Z, A as x, b as ee } from "./index-Dx9ELBfB.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
- import { useRef as oe, useEffect as D, useMemo as R } from "react";
4
+ import { useRef as oe, useEffect as D, useMemo as h } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const B = (t, i, c, l, u, r) => {
6
+ const A = (t, i, c, l, 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__ */ d(
@@ -44,7 +44,7 @@ const B = (t, i, c, l, u, r) => {
44
44
  id: `grouped-obs-${t.display}-${l}`,
45
45
  open: c,
46
46
  children: t.members?.map(
47
- (o, a) => B(
47
+ (o, a) => A(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -62,7 +62,7 @@ const B = (t, i, c, l, u, r) => {
62
62
  }) => {
63
63
  const { t: l } = U(), u = (r, s, o) => {
64
64
  const a = M(r.encounterDetails, l);
65
- return /* @__PURE__ */ N(
65
+ return /* @__PURE__ */ S(
66
66
  C,
67
67
  {
68
68
  title: a,
@@ -70,7 +70,7 @@ const B = (t, i, c, l, u, r) => {
70
70
  open: s,
71
71
  children: [
72
72
  r.observations.map(
73
- (n, b) => B(
73
+ (n, b) => A(
74
74
  n,
75
75
  b,
76
76
  o,
@@ -106,7 +106,7 @@ const B = (t, i, c, l, u, r) => {
106
106
  )
107
107
  }
108
108
  );
109
- }, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", S = {
109
+ }, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", N = {
110
110
  observations: ne,
111
111
  title: ie
112
112
  }, ce = (t) => ["conceptUuid", t], le = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
@@ -114,26 +114,26 @@ const B = (t, i, c, l, u, r) => {
114
114
  conceptNames: c = [],
115
115
  conceptUuid: l = [],
116
116
  hideThumbnail: u = !1
117
- } = i, r = oe(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: a } = U(), n = te({
117
+ } = i, r = oe(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = H(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
- queryFn: () => H(e),
120
+ queryFn: () => j(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
124
124
  D(() => {
125
125
  n.forEach((e, v) => {
126
126
  if (e.isError && !r.current.has(v)) {
127
- const h = c[v];
127
+ const R = c[v];
128
128
  o({
129
129
  title: a("ERROR_DEFAULT_TITLE"),
130
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: h }),
130
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: R }),
131
131
  type: "error"
132
132
  }), r.current.add(v);
133
133
  } else e.isError || r.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = R(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = R(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), y = R(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
136
+ const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), y = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
137
  data: p,
138
138
  isLoading: f,
139
139
  isError: g,
@@ -146,7 +146,7 @@ const B = (t, i, c, l, u, r) => {
146
146
  Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (h) => m.includes(h)
149
+ (R) => m.includes(R)
150
150
  ) && T();
151
151
  },
152
152
  [s, T]
@@ -157,22 +157,22 @@ const B = (t, i, c, l, u, r) => {
157
157
  type: "error"
158
158
  });
159
159
  }, [g]);
160
- const _ = R(() => {
160
+ const _ = h(() => {
161
161
  if (!p) return [];
162
162
  const e = W(p), v = X(e);
163
163
  return Z(v);
164
- }, [p]), L = [
164
+ }, [p]), B = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], I = f || !y, $ = g && y, A = (!p || p.entry?.length === 0 || m.length === 0) && y, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, w = A ? a("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
- return /* @__PURE__ */ N(
168
+ ], I = f || !y, $ = g && y, L = (!p || p.entry?.length === 0 || m.length === 0) && y, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, w = L ? a("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
+ return /* @__PURE__ */ S(
170
170
  "div",
171
171
  {
172
172
  id: "observations",
173
173
  "data-testid": O ? `observations-${E}` : "observations",
174
174
  "aria-label": "observations-aria-label",
175
- className: S.observations,
175
+ className: N.observations,
176
176
  children: [
177
177
  /* @__PURE__ */ d(
178
178
  x,
@@ -180,7 +180,7 @@ const B = (t, i, c, l, u, r) => {
180
180
  id: "observations-title",
181
181
  testId: O ? `observations-title-${E}` : "observations-title",
182
182
  title: E,
183
- className: S.title,
183
+ className: N.title,
184
184
  children: /* @__PURE__ */ d("p", { children: E })
185
185
  }
186
186
  ),
@@ -194,7 +194,7 @@ const B = (t, i, c, l, u, r) => {
194
194
  ) : /* @__PURE__ */ d(
195
195
  ee,
196
196
  {
197
- headers: L,
197
+ headers: B,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: I,