@bahmni/widgets 0.0.1-dev.214 → 0.0.1-dev.215

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 s, jsxs as _, Fragment as Q } from "react/jsx-runtime";
2
- import { u as W, a as X, C as J, t as Z, b as x, h as ee, y as te } from "./index-CCRQ_2lk.js";
2
+ import { u as W, a as X, C as J, c as Z, b as x, d as ee, y as te } from "./index-Cu7kAJjg.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as p, useEffect as N, useMemo as f } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -1,26 +1,26 @@
1
- import { jsxs as f, jsx as a, Fragment as K } from "react/jsx-runtime";
2
- import { f as Q, c as M, d as oe, w as se, g as ne, v as de, e as ie, O as le, u as ce, i as me, j as ue, m as pe, k as be, l as fe, I as _e, b as ye, t as $e, h as k, J as ge, X as he, y as ve, U as Ne, R as H } from "./index-CCRQ_2lk.js";
1
+ import { jsxs as f, jsx as a, Fragment as j } from "react/jsx-runtime";
2
+ import { f as Q, e as R, g as oe, h as se, E as ne, M as de, i as ie, O as le, u as ce, j as me, k as ue, m as pe, l as be, n as fe, I as _e, b as ye, c as $e, d as k, X as ge, Q as he, y as ve, K as Ne, R as H } from "./index-Cu7kAJjg.js";
3
3
  import { useQueryClient as Oe, useQuery as L } from "@tanstack/react-query";
4
- import { useState as j, useMemo as v, useCallback as R } from "react";
5
- import { useTranslation as I } from "react-i18next";
6
- const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re = "_formContent_1pd36_18", Me = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", De = "_groupContainer_1pd36_39", Ve = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", Ie = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ee = "_groupMembers_1pd36_75", Be = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ge = "_memberValue_1pd36_94", Se = "_abnormalValue_1pd36_102", Ue = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", Pe = "_nestedGroupLabel_1pd36_132", ke = "_nestedGroupMembers_1pd36_141", o = {
4
+ import { useState as K, useMemo as v, useCallback as M } from "react";
5
+ import { useTranslation as T } from "react-i18next";
6
+ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Me = "_formContent_1pd36_18", Re = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", De = "_groupContainer_1pd36_39", Ve = "_rowContainer_1pd36_43", Ie = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Ee = "_rowValue_1pd36_67", we = "_groupMembers_1pd36_75", Be = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ge = "_memberValue_1pd36_94", Se = "_abnormalValue_1pd36_102", qe = "_commentSection_1pd36_110", Ue = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", Pe = "_nestedGroupLabel_1pd36_132", ke = "_nestedGroupMembers_1pd36_141", o = {
7
7
  formsTableBody: Fe,
8
8
  customAccordianItem: Le,
9
- formContent: Re,
10
- formDetailsContainer: Me,
9
+ formContent: Me,
10
+ formDetailsContainer: Re,
11
11
  observation: Ce,
12
12
  groupContainer: De,
13
13
  rowContainer: Ve,
14
- groupLabel: we,
15
- rowLabel: Ie,
16
- rowValue: Te,
17
- groupMembers: Ee,
14
+ groupLabel: Ie,
15
+ rowLabel: Te,
16
+ rowValue: Ee,
17
+ groupMembers: we,
18
18
  memberRow: Be,
19
19
  memberLabel: Ae,
20
20
  memberValue: Ge,
21
21
  abnormalValue: Se,
22
- commentSection: Ue,
23
- commentText: qe,
22
+ commentSection: qe,
23
+ commentText: Ue,
24
24
  nestedGroup: xe,
25
25
  nestedGroupLabel: Pe,
26
26
  nestedGroupMembers: ke
@@ -42,13 +42,13 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
42
42
  hideThumbnail: r
43
43
  }
44
44
  ) : t === "PDF" ? /* @__PURE__ */ a(de, { id: `${e}-pdf`, src: e }) : e;
45
- }, J = (e) => {
45
+ }, X = (e) => {
46
46
  const r = e.observationValue?.referenceRange?.low?.value, t = e.observationValue?.referenceRange?.high?.value, s = r != null, n = t != null;
47
47
  let l = "";
48
48
  s && n ? l = ` (${r} - ${t})` : s ? l = ` (>${r})` : n && (l = ` (<${t})`);
49
49
  const c = e.observationValue?.isAbnormal === !0;
50
50
  return { rangeString: l, isAbnormal: c };
51
- }, X = ({
51
+ }, W = ({
52
52
  member: e,
53
53
  depth: r = 0,
54
54
  memberIndex: t = 0,
@@ -56,7 +56,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
56
56
  comment: n,
57
57
  hideThumbnail: l
58
58
  }) => {
59
- const { t: c } = I(), d = e.members && e.members.length > 0, p = e.display, m = s ? `${s}-` : "";
59
+ const { t: c } = T(), d = e.members && e.members.length > 0, p = e.display, m = s ? `${s}-` : "";
60
60
  if (d)
61
61
  return /* @__PURE__ */ f(
62
62
  "div",
@@ -79,7 +79,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
79
79
  className: o.nestedGroupMembers,
80
80
  "data-testid": `${m}obs-nested-group-members-${p}-${t}`,
81
81
  children: e.members?.map((N, O) => /* @__PURE__ */ a(
82
- X,
82
+ W,
83
83
  {
84
84
  member: N,
85
85
  depth: r + 1,
@@ -94,8 +94,8 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
94
94
  ]
95
95
  }
96
96
  );
97
- const { rangeString: h, isAbnormal: _ } = J(e), y = Q(e, c), $ = y ? z(y, l) : null;
98
- return /* @__PURE__ */ f(K, { children: [
97
+ const { rangeString: h, isAbnormal: _ } = X(e), y = Q(e, c), $ = y ? z(y, l) : null;
98
+ return /* @__PURE__ */ f(j, { children: [
99
99
  /* @__PURE__ */ f(
100
100
  "div",
101
101
  {
@@ -106,7 +106,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
106
106
  /* @__PURE__ */ f(
107
107
  "p",
108
108
  {
109
- className: M(
109
+ className: R(
110
110
  o.memberLabel,
111
111
  _ ? o.abnormalValue : ""
112
112
  ),
@@ -120,7 +120,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
120
120
  /* @__PURE__ */ a(
121
121
  "div",
122
122
  {
123
- className: M(
123
+ className: R(
124
124
  o.memberValue,
125
125
  _ ? o.abnormalValue : ""
126
126
  ),
@@ -151,7 +151,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
151
151
  comment: s,
152
152
  hideThumbnail: n
153
153
  }) => {
154
- const { t: l } = I(), c = e.members && e.members.length > 0, { rangeString: d, isAbnormal: p } = J(e), m = t ? `${t}-` : "", h = Q(e, l), _ = h ? z(h, n) : null;
154
+ const { t: l } = T(), c = e.members && e.members.length > 0, { rangeString: d, isAbnormal: p } = X(e), m = t ? `${t}-` : "", h = Q(e, l), _ = h ? z(h, n) : null;
155
155
  return /* @__PURE__ */ f(
156
156
  "div",
157
157
  {
@@ -167,7 +167,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
167
167
  /* @__PURE__ */ f(
168
168
  "p",
169
169
  {
170
- className: M(
170
+ className: R(
171
171
  c ? o.groupLabel : o.rowLabel,
172
172
  !c && p ? o.abnormalValue : ""
173
173
  ),
@@ -184,7 +184,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
184
184
  className: o.groupMembers,
185
185
  "data-testid": `${m}observation-group-members-${e.display}-${r}`,
186
186
  children: e.members?.map((y, $) => /* @__PURE__ */ a(
187
- X,
187
+ W,
188
188
  {
189
189
  member: y,
190
190
  depth: 0,
@@ -198,7 +198,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
198
198
  ) : /* @__PURE__ */ a(
199
199
  "div",
200
200
  {
201
- className: M(
201
+ className: R(
202
202
  o.rowValue,
203
203
  p ? o.abnormalValue : ""
204
204
  ),
@@ -224,16 +224,16 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
224
224
  },
225
225
  `${e.id}-${r}`
226
226
  );
227
- }, je = (e) => e ? e.extension?.find(
227
+ }, Ke = (e) => e ? e.extension?.find(
228
228
  (t) => t.url === le
229
- )?.valueString : void 0, Ke = (e) => {
229
+ )?.valueString : void 0, je = (e) => {
230
230
  if (e)
231
231
  return e.note?.[0]?.text;
232
- }, Qe = (e, r) => e.entry?.find((t) => t.resource?.id === r)?.resource, w = (e, r) => {
232
+ }, Qe = (e, r) => e.entry?.find((t) => t.resource?.id === r)?.resource, I = (e, r) => {
233
233
  const t = Qe(e, r);
234
234
  return t ? {
235
- formFieldPath: je(t),
236
- comment: Ke(t)
235
+ formFieldPath: Ke(t),
236
+ comment: je(t)
237
237
  } : {};
238
238
  }, ze = (e, r) => {
239
239
  if (!e?.entry || !r)
@@ -241,16 +241,16 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
241
241
  const t = ie(e);
242
242
  return [
243
243
  ...t.observations.map((n) => {
244
- const { formFieldPath: l, comment: c } = w(
244
+ const { formFieldPath: l, comment: c } = I(
245
245
  e,
246
246
  n.id
247
247
  );
248
248
  return { obs: n, formFieldPath: l, comment: c };
249
249
  }),
250
250
  ...t.groupedObservations.flatMap((n) => {
251
- const { formFieldPath: l } = w(e, n.id);
251
+ const { formFieldPath: l } = I(e, n.id);
252
252
  return (n.members ?? []).map((c) => {
253
- const { comment: d } = w(e, c.id);
253
+ const { comment: d } = I(e, c.id);
254
254
  return { obs: c, formFieldPath: l, comment: d };
255
255
  });
256
256
  })
@@ -262,27 +262,27 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
262
262
  encounterUuids: r,
263
263
  config: t
264
264
  }) => {
265
- const { t: s } = I(), n = ce(), [l, c] = j(!1), [d, p] = j(null), { numberOfVisits: m, hideThumbnail: h = !1 } = t ?? {}, _ = me(
265
+ const { t: s } = T(), n = ce(), [l, c] = K(!1), [d, p] = K(null), { numberOfVisits: m, hideThumbnail: h = !1 } = t ?? {}, _ = me(
266
266
  e,
267
267
  r
268
268
  ), y = Oe(), {
269
269
  data: $ = [],
270
270
  isLoading: N,
271
271
  isError: O,
272
- error: W,
273
- refetch: Y
272
+ error: Y,
273
+ refetch: J
274
274
  } = L({
275
275
  queryKey: ["forms", n, e],
276
276
  queryFn: () => ue(n, void 0, m),
277
277
  enabled: !!n && !_
278
- }), T = v(() => !r || r.length === 0 ? $ : $.filter(
278
+ }), E = v(() => !r || r.length === 0 ? $ : $.filter(
279
279
  (i) => r.includes(i.encounterUuid)
280
- ), [$, r]), { data: E = [] } = L({
280
+ ), [$, r]), { data: w = [] } = L({
281
281
  queryKey: ["observationForms"],
282
282
  queryFn: () => pe()
283
- }), B = R(
284
- (i) => E.find((u) => u.name === i)?.uuid,
285
- [E]
283
+ }), B = M(
284
+ (i) => w.find((u) => u.name === i)?.uuid,
285
+ [w]
286
286
  ), C = v(() => {
287
287
  if (d)
288
288
  return B(d.formName);
@@ -301,14 +301,14 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
301
301
  });
302
302
  _e(
303
303
  (i) => {
304
- i.patientUUID === n && i.updatedConcepts.size > 0 && (Y(), y.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
304
+ i.patientUUID === n && i.updatedConcepts.size > 0 && (J(), y.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
305
305
  },
306
306
  [n]
307
307
  );
308
308
  const S = v(() => !D || !d?.formName ? [] : ze(
309
309
  D,
310
310
  d.formName
311
- ), [D, d?.formName]), U = v(
311
+ ), [D, d?.formName]), q = v(
312
312
  () => [
313
313
  { key: "recordedOn", header: s("FORM_RECORDED_ON") },
314
314
  { key: "recordedBy", header: s("FORM_RECORDED_BY") }
@@ -320,8 +320,8 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
320
320
  { key: "recordedBy", sortable: !0 }
321
321
  ],
322
322
  []
323
- ), q = v(() => {
324
- const i = T.reduce(
323
+ ), U = v(() => {
324
+ const i = E.reduce(
325
325
  (u, b) => {
326
326
  const F = b.formName;
327
327
  u[F] ??= [];
@@ -345,11 +345,11 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
345
345
  )
346
346
  })
347
347
  ).sort((u, b) => u.formName.localeCompare(b.formName));
348
- }, [T, s]), x = R((i) => {
348
+ }, [E, s]), x = M((i) => {
349
349
  p(i), c(!0);
350
- }, []), te = R(() => {
350
+ }, []), te = M(() => {
351
351
  c(!1), p(null);
352
- }, []), P = R(
352
+ }, []), P = M(
353
353
  (i, g) => {
354
354
  switch (g) {
355
355
  case "recordedOn":
@@ -362,21 +362,21 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
362
362
  },
363
363
  [x]
364
364
  );
365
- return /* @__PURE__ */ f(K, { children: [
366
- /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: N || O || q.length === 0 || _ ? /* @__PURE__ */ a(
365
+ return /* @__PURE__ */ f(j, { children: [
366
+ /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: N || O || U.length === 0 || _ ? /* @__PURE__ */ a(
367
367
  k,
368
368
  {
369
- headers: U,
369
+ headers: q,
370
370
  ariaLabel: s("FORMS_HEADING"),
371
371
  rows: [],
372
372
  loading: N,
373
- errorStateMessage: O ? W?.message : void 0,
373
+ errorStateMessage: O ? Y?.message : void 0,
374
374
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
375
375
  renderCell: P,
376
376
  className: o.formsTableBody,
377
377
  dataTestId: "forms-table"
378
378
  }
379
- ) : /* @__PURE__ */ a(ge, { align: "start", children: q.map((i, g) => {
379
+ ) : /* @__PURE__ */ a(ge, { align: "start", children: U.map((i, g) => {
380
380
  const { formName: u, records: b } = i;
381
381
  return /* @__PURE__ */ a(
382
382
  he,
@@ -388,7 +388,7 @@ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re =
388
388
  children: /* @__PURE__ */ a(
389
389
  k,
390
390
  {
391
- headers: U,
391
+ headers: q,
392
392
  ariaLabel: s("FORMS_HEADING"),
393
393
  rows: b,
394
394
  loading: !1,
@@ -1,10 +1,10 @@
1
1
  import { jsx as l, jsxs as C } from "react/jsx-runtime";
2
- import { n as M, o as D, p as V, d as k, q as K, w as Q, g as G, v as P, u as z, a as H, r as j, s as Y, I as J, e as W, x as X, z as Z, A as x, h as ee } from "./index-CCRQ_2lk.js";
2
+ import { o as V, v as D, t as k, g as w, p as K, h as Q, E as G, M as P, u as H, a as j, q as z, r as Y, I as J, i as W, s as X, w as Z, x, d as ee } from "./index-Cu7kAJjg.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
4
  import { useRef as oe, useEffect as N, useMemo as g } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const A = (t, i, c, d, u, r) => {
7
- const s = V(t, i, u), o = s.value, a = k(o);
6
+ const B = (t, i, c, d, u, r) => {
7
+ const s = k(t, i, u), o = s.value, a = w(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ l(
10
10
  Q,
@@ -44,7 +44,7 @@ const A = (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) => A(
47
+ (o, a) => B(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -61,7 +61,7 @@ const A = (t, i, c, d, u, r) => {
61
61
  hideThumbnail: c
62
62
  }) => {
63
63
  const { t: d } = U(), u = (r, s, o) => {
64
- const a = M(r.encounterDetails, d);
64
+ const a = V(r.encounterDetails, d);
65
65
  return /* @__PURE__ */ C(
66
66
  D,
67
67
  {
@@ -70,7 +70,7 @@ const A = (t, i, c, d, u, r) => {
70
70
  open: s,
71
71
  children: [
72
72
  r.observations.map(
73
- (n, b) => A(
73
+ (n, b) => B(
74
74
  n,
75
75
  b,
76
76
  o,
@@ -114,10 +114,10 @@ const A = (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 = z(), { addNotification: o } = H(), { t: a } = U(), n = te({
117
+ } = i, r = oe(/* @__PURE__ */ new Set()), s = H(), { addNotification: o } = j(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
- queryFn: () => j(e),
120
+ queryFn: () => z(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
@@ -161,11 +161,11 @@ const A = (t, i, c, d, u, r) => {
161
161
  if (!v) return [];
162
162
  const e = W(v), m = X(e);
163
163
  return Z(m);
164
- }, [v]), B = [
164
+ }, [v]), A = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], _ = y || !f, $ = O && f, F = (!v || v.entry?.length === 0 || p.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, q = F ? a("NO_OBSERVATIONS_FOUND") : void 0, w = I.length > 0 && !_ && !$, h = i.titleTranslationKey, E = h ? a(h) : "";
168
+ ], _ = y || !f, $ = O && f, F = (!v || v.entry?.length === 0 || p.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = F ? a("NO_OBSERVATIONS_FOUND") : void 0, q = I.length > 0 && !_ && !$, h = i.titleTranslationKey, E = h ? a(h) : "";
169
169
  return /* @__PURE__ */ C(
170
170
  "div",
171
171
  {
@@ -184,7 +184,7 @@ const A = (t, i, c, d, u, r) => {
184
184
  children: /* @__PURE__ */ l("p", { children: E })
185
185
  }
186
186
  ),
187
- w ? /* @__PURE__ */ l(
187
+ q ? /* @__PURE__ */ l(
188
188
  ae,
189
189
  {
190
190
  groupedData: I,
@@ -194,12 +194,12 @@ const A = (t, i, c, d, u, r) => {
194
194
  ) : /* @__PURE__ */ l(
195
195
  ee,
196
196
  {
197
- headers: B,
197
+ headers: A,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: _,
201
201
  errorStateMessage: L,
202
- emptyStateMessage: q,
202
+ emptyStateMessage: M,
203
203
  dataTestId: "observations-table"
204
204
  }
205
205
  )