@bahmni/widgets 0.0.1-dev.167 → 0.0.1-dev.170

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 { jsxs as b, jsx as d, Fragment as k } from "react/jsx-runtime";
2
- import { c as C, L as te, N as re, $ as ae, e as oe, T as se, u as ne, a as de, y as ie, m as le, g as ce, b as me, d as ue, v as pe, f as be, t as x, H as fe, C as _e, h as $e, o as ge, i as H, l as ye } from "./index-CefCE_cy.js";
2
+ import { c as C, L as te, N as re, $ as ae, e as oe, A as se, u as ne, l as de, v as ie, g as le, y as ce, a as me, I as ue, b as pe, m as be, t as x, H as fe, C as _e, d as $e, o as ge, f as H, h as ye } from "./index-BGXPYdVf.js";
3
3
  import { useQueryClient as he, useQuery as O } from "@tanstack/react-query";
4
4
  import { useState as P, useMemo as h, useCallback as F } from "react";
5
5
  import { useTranslation as ve } from "react-i18next";
6
- const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", Me = "_groupContainer_1pd36_39", Re = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", De = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Ee = "_memberLabel_1pd36_86", Ie = "_memberValue_1pd36_94", Be = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", Ge = "_commentText_1pd36_116", qe = "_nestedGroup_1pd36_125", Ue = "_nestedGroupLabel_1pd36_132", xe = "_nestedGroupMembers_1pd36_141", o = {
6
+ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", Me = "_groupContainer_1pd36_39", Re = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", De = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Ie = "_memberLabel_1pd36_86", Ee = "_memberValue_1pd36_94", Be = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", Ge = "_commentText_1pd36_116", qe = "_nestedGroup_1pd36_125", Ue = "_nestedGroupLabel_1pd36_132", xe = "_nestedGroupMembers_1pd36_141", o = {
7
7
  formsTableBody: Ne,
8
8
  customAccordianItem: Le,
9
9
  formContent: Oe,
@@ -12,12 +12,12 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
12
12
  groupContainer: Me,
13
13
  rowContainer: Re,
14
14
  groupLabel: we,
15
- rowLabel: Te,
16
- rowValue: De,
15
+ rowLabel: De,
16
+ rowValue: Te,
17
17
  groupMembers: Ve,
18
18
  memberRow: Ae,
19
- memberLabel: Ee,
20
- memberValue: Ie,
19
+ memberLabel: Ie,
20
+ memberValue: Ee,
21
21
  abnormalValue: Be,
22
22
  commentSection: Se,
23
23
  commentText: Ge,
@@ -220,7 +220,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
220
220
  )?.valueString : void 0, ke = (e) => {
221
221
  if (e)
222
222
  return e.note?.[0]?.text;
223
- }, Ke = (e, t) => e.entry?.find((a) => a.resource?.id === t)?.resource, T = (e, t) => {
223
+ }, Ke = (e, t) => e.entry?.find((a) => a.resource?.id === t)?.resource, D = (e, t) => {
224
224
  const a = Ke(e, t);
225
225
  return a ? {
226
226
  formFieldPath: Pe(a),
@@ -232,16 +232,16 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
232
232
  const a = oe(e);
233
233
  return [
234
234
  ...a.observations.map((s) => {
235
- const { formFieldPath: c, comment: i } = T(
235
+ const { formFieldPath: c, comment: i } = D(
236
236
  e,
237
237
  s.id
238
238
  );
239
239
  return { obs: s, formFieldPath: c, comment: i };
240
240
  }),
241
241
  ...a.groupedObservations.flatMap((s) => {
242
- const { formFieldPath: c } = T(e, s.id);
242
+ const { formFieldPath: c } = D(e, s.id);
243
243
  return (s.members ?? []).map((i) => {
244
- const { comment: r } = T(e, i.id);
244
+ const { comment: r } = D(e, i.id);
245
245
  return { obs: i, formFieldPath: c, comment: r };
246
246
  });
247
247
  })
@@ -266,7 +266,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
266
266
  queryKey: ["forms", s, e],
267
267
  queryFn: () => ie(s, void 0, y),
268
268
  enabled: !!s && !f
269
- }), D = h(() => !t || t.length === 0 ? $ : $.filter(
269
+ }), T = h(() => !t || t.length === 0 ? $ : $.filter(
270
270
  (l) => t.includes(l.encounterUuid)
271
271
  ), [$, t]), { data: V = [] } = O({
272
272
  queryKey: ["observationForms"],
@@ -277,14 +277,14 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
277
277
  ), M = h(() => {
278
278
  if (r)
279
279
  return A(r.formName);
280
- }, [r, A]), { isLoading: Y, error: E } = O({
280
+ }, [r, A]), { isLoading: Y, error: I } = O({
281
281
  queryKey: ["formMetadata", M],
282
282
  queryFn: () => ce(M),
283
283
  enabled: !!M && c
284
284
  }), {
285
285
  data: R,
286
286
  isLoading: J,
287
- error: I
287
+ error: E
288
288
  } = O({
289
289
  queryKey: ["formsEncounterFHIR", r?.encounterUuid],
290
290
  queryFn: () => me(r.encounterUuid),
@@ -312,7 +312,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
312
312
  ],
313
313
  []
314
314
  ), G = h(() => {
315
- const l = D.reduce(
315
+ const l = T.reduce(
316
316
  (m, u) => {
317
317
  const L = u.formName;
318
318
  m[L] ??= [];
@@ -336,7 +336,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
336
336
  )
337
337
  })
338
338
  ).sort((m, u) => m.formName.localeCompare(u.formName));
339
- }, [D, n]), q = F((l) => {
339
+ }, [T, n]), q = F((l) => {
340
340
  p(l), i(!0);
341
341
  }, []), Z = F(() => {
342
342
  i(!1), p(null);
@@ -406,7 +406,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
406
406
  passiveModal: !0,
407
407
  size: "md",
408
408
  testId: "form-details-modal",
409
- children: /* @__PURE__ */ d("div", { className: o.formContent, children: Y || J ? /* @__PURE__ */ d(ge, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ d("div", { children: H(E).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : I ? /* @__PURE__ */ d("div", { children: H(I).message ?? n("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ d("div", { className: o.formDetailsContainer, children: B.map(({ obs: l, comment: g }, m) => /* @__PURE__ */ d(
409
+ children: /* @__PURE__ */ d("div", { className: o.formContent, children: Y || J ? /* @__PURE__ */ d(ge, { width: "100%", lineCount: 3 }) : I ? /* @__PURE__ */ d("div", { children: H(I).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ d("div", { children: H(E).message ?? n("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ d("div", { className: o.formDetailsContainer, children: B.map(({ obs: l, comment: g }, m) => /* @__PURE__ */ d(
410
410
  He,
411
411
  {
412
412
  observation: l,
@@ -1,10 +1,10 @@
1
1
  import { jsx as d, jsxs as S } from "react/jsx-runtime";
2
- import { j as k, _ as C, k as q, L as M, n as V, N as K, $ as Q, u as G, p as j, q as H, r as P, d as z, e as Y, s as J, w as W, B as X, t as Z } from "./index-CefCE_cy.js";
2
+ import { i as q, _ as C, j as w, L as M, k as V, N as K, $ as Q, u as G, n as j, p as H, q as P, I as z, e as Y, r as J, s as W, B as X, t as Z } from "./index-BGXPYdVf.js";
3
3
  import { useQueries as x, useQuery as ee } from "@tanstack/react-query";
4
- import { useRef as te, useEffect as I, useMemo as h } from "react";
4
+ import { useRef as te, useEffect as $, useMemo as h } from "react";
5
5
  import { useTranslation as D } from "react-i18next";
6
6
  const U = (t, c, n, l, o) => {
7
- const s = q(t, c), r = s.value, a = M(r);
7
+ const s = w(t, c), r = s.value, a = M(r);
8
8
  let i = r;
9
9
  a === "Image" && (i = /* @__PURE__ */ d(K, { imageSrc: r, alt: r, id: `${r}-img` })), a === "Video" && (i = /* @__PURE__ */ d(Q, { id: `${r}-video`, videoSrc: r }));
10
10
  const u = o("OBSERVATIONS_RECORDED_BY", {
@@ -38,7 +38,7 @@ const U = (t, c, n, l, o) => {
38
38
  title: c = ""
39
39
  }) => {
40
40
  const { t: n } = D(), l = (o, s, r) => {
41
- const a = k(o.encounterDetails, n);
41
+ const a = q(o.encounterDetails, n);
42
42
  return /* @__PURE__ */ S(
43
43
  C,
44
44
  {
@@ -86,7 +86,7 @@ const U = (t, c, n, l, o) => {
86
86
  enabled: !!e
87
87
  }))
88
88
  });
89
- I(() => {
89
+ $(() => {
90
90
  i.forEach((e, m) => {
91
91
  if (e.isError && !o.current.has(m)) {
92
92
  const g = n[m];
@@ -115,7 +115,7 @@ const U = (t, c, n, l, o) => {
115
115
  ) && R();
116
116
  },
117
117
  [s, R]
118
- ), I(() => {
118
+ ), $(() => {
119
119
  O && r({
120
120
  title: a("ERROR_DEFAULT_TITLE"),
121
121
  message: a("ERROR_FETCHING_OBSERVATIONS"),
@@ -130,7 +130,7 @@ const U = (t, c, n, l, o) => {
130
130
  { key: "name", header: "name" },
131
131
  { key: "value", header: "value" },
132
132
  { key: "form", header: "form" }
133
- ], _ = f || !v, $ = O && v, L = (!p || p.entry?.length === 0 || b.length === 0) && v, A = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? a("NO_OBSERVATIONS_FOUND") : void 0, w = T.length > 0 && !_ && !$, E = c.titleTranslationKey, y = E ? a(E) : "";
133
+ ], I = f || !v, _ = O && v, L = (!p || p.entry?.length === 0 || b.length === 0) && v, A = _ ? a("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? a("NO_OBSERVATIONS_FOUND") : void 0, k = T.length > 0 && !I && !_, E = c.titleTranslationKey, y = E ? a(E) : "";
134
134
  return /* @__PURE__ */ S(
135
135
  "div",
136
136
  {
@@ -149,13 +149,13 @@ const U = (t, c, n, l, o) => {
149
149
  children: /* @__PURE__ */ d("p", { children: y })
150
150
  }
151
151
  ),
152
- w ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
152
+ k ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
153
  Z,
154
154
  {
155
155
  headers: B,
156
156
  rows: [],
157
157
  ariaLabel: a("OBSERVATIONS"),
158
- loading: _,
158
+ loading: I,
159
159
  errorStateMessage: A,
160
160
  emptyStateMessage: F,
161
161
  dataTestId: "observations-table"