@bahmni/clinical-app 0.0.1-dev.149 → 0.0.1-dev.151

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 t, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
- import { u as J, H as Q, w as X, a as h, i as Z, C as ee, A as G, Y as re, G as ae, b as oe, V as te, c as U, g as ne, d as v, W as se, q as de, U as me, F as ie } from "./index-BrwW-0Mc.js";
2
+ import { u as J, H as Q, w as X, a as h, i as Z, C as ee, A as G, Y as re, G as ae, b as oe, c as te, V as U, g as ne, d as v, K as se, U as de, W as me, q as ie } from "./index-D9U_fT9q.js";
3
3
  import { useState as x, useMemo as N, useCallback as y } from "react";
4
4
  const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Ce = "_commentText_1pd36_116", Le = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
5
5
  formsTableBody: le,
@@ -217,7 +217,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
217
217
  return R(a.formName);
218
218
  }, [a, R]), {
219
219
  data: we,
220
- isLoading: j,
220
+ isLoading: K,
221
221
  error: F
222
222
  } = h({
223
223
  queryKey: ["formMetadata", A],
@@ -225,7 +225,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
225
225
  enabled: !!A && d
226
226
  }), {
227
227
  data: M,
228
- isLoading: K,
228
+ isLoading: j,
229
229
  error: w
230
230
  } = h({
231
231
  queryKey: ["formsEncounter", a?.encounterUuid],
@@ -340,7 +340,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
340
340
  passiveModal: !0,
341
341
  size: "md",
342
342
  testId: "form-details-modal",
343
- children: /* @__PURE__ */ t("div", { className: o.formContent, children: j || K ? /* @__PURE__ */ t(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
343
+ children: /* @__PURE__ */ t("div", { className: o.formContent, children: K || j ? /* @__PURE__ */ t(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
344
344
  Fe,
345
345
  {
346
346
  observation: n,
@@ -1,25 +1,25 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DEDY2qBq.js";
2
- import { L as d, N as f, R as e } from "./index-BrwW-0Mc.js";
3
- var p = (a) => {
4
- const [r, t] = c({
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BRLiQ99R.js";
2
+ import { n as p, o as d, p as e } from "./index-D9U_fT9q.js";
3
+ var f = (a) => {
4
+ const [r, o] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), n = d(), s = f(() => {
7
- const o = r.theme_preference || l;
8
- return o !== "system" ? o : n();
6
+ }), n = p(), s = d(() => {
7
+ const t = r.theme_preference || l;
8
+ return t !== "system" ? t : n();
9
9
  });
10
10
  return e(i.Provider, {
11
11
  value: a,
12
12
  get children() {
13
13
  return e(m, {
14
14
  localStore: r,
15
- setLocalStore: t,
15
+ setLocalStore: o,
16
16
  get children() {
17
17
  return e(u.Provider, {
18
18
  value: s,
19
19
  get children() {
20
20
  return e(v, {
21
21
  localStore: r,
22
- setLocalStore: t
22
+ setLocalStore: o
23
23
  });
24
24
  }
25
25
  });
@@ -27,7 +27,7 @@ var p = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, C = p;
30
+ }, C = f;
31
31
  export {
32
32
  C as default
33
33
  };
@@ -1,5 +1,5 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-DEDY2qBq.js";
2
- import { L as v, N as C, R as e } from "./index-BrwW-0Mc.js";
1
+ import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-BRLiQ99R.js";
2
+ import { n as v, o as C, p as e } from "./index-D9U_fT9q.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -36,7 +36,7 @@ var h = (t) => {
36
36
  });
37
37
  }
38
38
  });
39
- }, p = h;
39
+ }, g = h;
40
40
  export {
41
- p as default
41
+ g as default
42
42
  };
@@ -0,0 +1,162 @@
1
+ import { jsxs as $, jsx as b } from "react/jsx-runtime";
2
+ import { H as C, h as U, u as I, e as V, j as H, a as Q, f as x, Q as K, k as M, l as j, A as w, J as G, m as N, X as P, P as X, L as J, M as Y, x as z, F as W } from "./index-D9U_fT9q.js";
3
+ import { useRef as Z, useEffect as _, useMemo as h } from "react";
4
+ const S = (e, d, o, l, t) => {
5
+ const a = P(e, d), r = a.value, s = X(r);
6
+ let n = r;
7
+ s === "Image" && (n = /* @__PURE__ */ b(Y, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (n = /* @__PURE__ */ b(z, { id: `${r}-video`, videoSrc: r }));
8
+ const c = t("OBSERVATIONS_RECORDED_BY", {
9
+ provider: a.provider
10
+ }), m = e.display, p = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", u = l ? `${l}-${p}-${m}-${o}-${d}` : `${p}-${m}-${o}-${d}`;
11
+ return /* @__PURE__ */ b(
12
+ J,
13
+ {
14
+ header: a.header,
15
+ value: n,
16
+ info: c,
17
+ id: u,
18
+ testId: u,
19
+ ariaLabel: u
20
+ },
21
+ `obs-${e.id}`
22
+ );
23
+ }, ee = (e, d, o, l, t, a) => /* @__PURE__ */ b(
24
+ N,
25
+ {
26
+ title: e.display,
27
+ id: `grouped-obs-${e.display}-${l}`,
28
+ open: o,
29
+ children: e.members?.map(
30
+ (r, s) => S(r, s, t, a, d)
31
+ )
32
+ },
33
+ `grouped-obs-${e.id}`
34
+ ), te = ({
35
+ groupedData: e,
36
+ title: d = ""
37
+ }) => {
38
+ const { t: o } = I(), l = (t, a, r) => {
39
+ const s = G(t.encounterDetails, o);
40
+ return /* @__PURE__ */ $(
41
+ N,
42
+ {
43
+ title: s,
44
+ id: `encounter-${t.encounterId}`,
45
+ open: a,
46
+ children: [
47
+ t.observations.map(
48
+ (n, c) => S(n, c, r, d, o)
49
+ ),
50
+ t.groupedObservations.map(
51
+ (n, c) => ee(
52
+ n,
53
+ o,
54
+ a,
55
+ c,
56
+ r,
57
+ d
58
+ )
59
+ )
60
+ ]
61
+ },
62
+ `encounter-${t.encounterId}`
63
+ );
64
+ };
65
+ return /* @__PURE__ */ b(
66
+ "div",
67
+ {
68
+ id: "obs-by-encounter",
69
+ "data-testid": "obs-by-encounter-test-id",
70
+ "aria-label": "obs-by-encounter-aria-label",
71
+ children: e.map(
72
+ (t, a) => l(t, a === 0, a)
73
+ )
74
+ }
75
+ );
76
+ }, ae = "_observations_kfbhq_1", re = "_title_kfbhq_12", T = {
77
+ observations: ae,
78
+ title: re
79
+ }, se = (e) => ["conceptUuid", e], oe = (e, d) => ["observations", e, ...d], le = ({ config: e }) => {
80
+ const d = e, { conceptNames: o = [], conceptUuid: l = [] } = d, t = Z(/* @__PURE__ */ new Set()), a = C(), { addNotification: r } = U(), { t: s } = I(), n = V({
81
+ queries: o.map((i) => ({
82
+ queryKey: se(i),
83
+ queryFn: () => H(i),
84
+ enabled: !!i
85
+ }))
86
+ });
87
+ _(() => {
88
+ n.forEach((i, y) => {
89
+ if (i.isError && !t.current.has(y)) {
90
+ const B = o[y];
91
+ r({
92
+ title: s("ERROR_DEFAULT_TITLE"),
93
+ message: s("ERROR_FETCHING_CONCEPT", { conceptName: B }),
94
+ type: "error"
95
+ }), t.current.add(y);
96
+ } else i.isError || t.current.delete(y);
97
+ });
98
+ }, [n, o]);
99
+ const c = h(() => n.map((i) => i.data?.uuid).filter((i) => !!i), [n]), m = h(() => [.../* @__PURE__ */ new Set([...c, ...l])], [c, l]), p = h(() => o.length === 0 ? !0 : n.every((i) => !i.isLoading), [n, o.length]), {
100
+ data: u,
101
+ isLoading: A,
102
+ isError: R
103
+ } = Q({
104
+ queryKey: oe(a, m),
105
+ queryFn: () => W(a, m),
106
+ enabled: !!a && m.length > 0 && p
107
+ });
108
+ _(() => {
109
+ R && r({
110
+ title: s("ERROR_DEFAULT_TITLE"),
111
+ message: s("ERROR_FETCHING_OBSERVATIONS"),
112
+ type: "error"
113
+ });
114
+ }, [R]);
115
+ const g = h(() => {
116
+ if (!u) return [];
117
+ const i = x(u), y = K(i);
118
+ return M(y);
119
+ }, [u]), F = [
120
+ { key: "name", header: "name" },
121
+ { key: "value", header: "value" },
122
+ { key: "form", header: "form" }
123
+ ], f = A || !p, O = R && p, L = (!u || u.entry?.length === 0 || m.length === 0) && p, D = O ? s("ERROR_FETCHING_OBSERVATIONS") : null, k = L ? s("NO_OBSERVATIONS_FOUND") : void 0, q = g.length > 0 && !f && !O, E = d.titleTranslationKey, v = E ? s(E) : "";
124
+ return /* @__PURE__ */ $(
125
+ "div",
126
+ {
127
+ id: "observations",
128
+ "data-testid": E ? `observations-${v}` : "observations",
129
+ "aria-label": "observations-aria-label",
130
+ className: T.observations,
131
+ children: [
132
+ /* @__PURE__ */ b(
133
+ j,
134
+ {
135
+ id: "observations-title",
136
+ testId: E ? `observations-title-${v}` : "observations-title",
137
+ title: v,
138
+ className: T.title,
139
+ children: /* @__PURE__ */ b("p", { children: v })
140
+ }
141
+ ),
142
+ q ? /* @__PURE__ */ b(te, { groupedData: g, title: v }) : /* @__PURE__ */ b(
143
+ w,
144
+ {
145
+ headers: F,
146
+ rows: [],
147
+ ariaLabel: s("OBSERVATIONS"),
148
+ loading: f,
149
+ errorStateMessage: D,
150
+ emptyStateMessage: k,
151
+ dataTestId: "observations-table"
152
+ }
153
+ )
154
+ ]
155
+ }
156
+ );
157
+ };
158
+ export {
159
+ se as conceptUuidQueryKeys,
160
+ le as default,
161
+ oe as observationsQueryKeys
162
+ };