@bahmni/widgets 0.0.1-dev.349 → 0.0.1-dev.351

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, h as J, B as Z, A as x, q as ee, F as te } from "./index-BAz36sQ7.js";
2
+ import { u as W, a as X, y as J, B as Z, D as x, q as ee, F as te } from "./index-_K1cix3h.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,65 +1,65 @@
1
1
  import { jsx as i, jsxs as x, Fragment as be } from "react/jsx-runtime";
2
- import { u as ye, b as Ne, c as pe, N as Oe, Y as Te, H as Ee, d as Fe, e as Ie, f as ve, g as Ae, i as _e, j as z, A as Re, l as G, $ as K, B as Be, q as Q, T as Me, R as De, F as Ce, O as Le, C as Se } from "./index-BAz36sQ7.js";
3
- import { useQueryClient as He, useQuery as T } from "@tanstack/react-query";
2
+ import { u as ye, b as pe, c as Oe, Q as Ne, W as Te, Y as Ee, G as Fe, P as Ie, d as ve, e as _e, f as Ae, g as z, D as Re, l as j, $ as K, B as De, q as Q, T as Me, R as Be, F as Ce, O as Le, C as Se } from "./index-_K1cix3h.js";
3
+ import { useQueryClient as Ue, useQuery as T } from "@tanstack/react-query";
4
4
  import { useState as Y, useMemo as d, useCallback as l } from "react";
5
- import { useTranslation as Ue } from "react-i18next";
6
- const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", E = {
7
- formsTableBody: we,
5
+ import { useTranslation as we } from "react-i18next";
6
+ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", E = {
7
+ formsTableBody: He,
8
8
  modalHeading: ke,
9
9
  customAccordianItem: qe
10
- }, Pe = "startConsultation", Ge = ({
11
- episodeOfCareUuids: B,
10
+ }, Pe = "startConsultation", je = ({
11
+ episodeOfCareUuids: D,
12
12
  encounterUuids: m,
13
13
  config: W,
14
14
  disableActions: J = !1,
15
15
  activeEncounterUuid: b = null
16
16
  }) => {
17
- const { t: n } = Ue(), u = ye(), [y, M] = Y(!1), [a, D] = Y(null), {
17
+ const { t: n } = we(), u = ye(), [y, M] = Y(!1), [a, B] = Y(null), {
18
18
  numberOfVisits: X,
19
19
  hideThumbnail: Z = !1,
20
- forms: N
21
- } = W ?? {}, ee = Ne(
20
+ forms: p
21
+ } = W ?? {}, ee = pe(
22
22
  Se.EDIT_OBSERVATIONS
23
- ), { userPrivileges: p } = pe(), F = ee && !J && !!b, C = Oe(
24
- B,
23
+ ), { userPrivileges: O } = Oe(), F = ee && !J && !!b, C = Ne(
24
+ D,
25
25
  m
26
- ), re = He(), {
26
+ ), re = Ue(), {
27
27
  data: L = [],
28
28
  isLoading: S,
29
- isError: H,
29
+ isError: U,
30
30
  error: te,
31
31
  refetch: oe
32
32
  } = T({
33
- queryKey: ["forms", u, B],
33
+ queryKey: ["forms", u, D],
34
34
  queryFn: () => Te(u, void 0, X),
35
35
  enabled: !!u && !C
36
- }), U = d(() => {
36
+ }), w = d(() => {
37
37
  let e = L;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (r) => m.includes(r.encounterUuid)
40
- )), Array.isArray(N) && N.length > 0 && (e = e.filter(
41
- (r) => N.some((o) => o.toLowerCase() === r.formName.toLowerCase())
40
+ )), Array.isArray(p) && p.length > 0 && (e = e.filter(
41
+ (r) => p.some((o) => o.toLowerCase() === r.formName.toLowerCase())
42
42
  )), e;
43
- }, [L, m, N]), { data: O = [] } = T({
43
+ }, [L, m, p]), { data: N = [] } = T({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => Ee()
46
- }), w = l(
46
+ }), H = l(
47
47
  (e) => {
48
- const r = O.find((t) => t.name === e);
48
+ const r = N.find((t) => t.name === e);
49
49
  if (!r?.privileges || r.privileges.length === 0) return !0;
50
- if (!p || p.length === 0) return !1;
51
- const o = new Set(p.map((t) => t.name));
50
+ if (!O || O.length === 0) return !1;
51
+ const o = new Set(O.map((t) => t.name));
52
52
  return r.privileges.some(
53
53
  (t) => o.has(t.privilegeName) && t.editable
54
54
  );
55
55
  },
56
- [O, p]
56
+ [N, O]
57
57
  ), f = l(
58
- (e) => !b || e.encounterUuid !== b ? !1 : w(e.formName),
59
- [b, w]
58
+ (e) => !b || e.encounterUuid !== b ? !1 : H(e.formName),
59
+ [b, H]
60
60
  ), k = l(
61
- (e) => O.find((o) => o.name === e)?.uuid,
62
- [O]
61
+ (e) => N.find((o) => o.name === e)?.uuid,
62
+ [N]
63
63
  ), I = d(() => {
64
64
  if (a)
65
65
  return k(a.formName);
@@ -73,10 +73,10 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
73
73
  queryFn: () => Fe(I),
74
74
  enabled: !!I && y
75
75
  }), {
76
- data: A,
76
+ data: _,
77
77
  isLoading: ne,
78
78
  isError: ie,
79
- error: _
79
+ error: A
80
80
  } = T({
81
81
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
82
82
  queryFn: () => Ie(a.encounterUuid),
@@ -88,7 +88,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
88
88
  },
89
89
  [u]
90
90
  );
91
- const de = d(() => !A?.entry || !a?.formName ? [] : A.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => Ae(r) ? _e(r)?.toLowerCase() === a.formName.toLowerCase() : !0), [A, a?.formName]), le = d(() => {
91
+ const de = d(() => !_?.entry || !a?.formName ? [] : _.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => _e(r) ? Ae(r)?.toLowerCase() === a.formName.toLowerCase() : !0), [_, a?.formName]), le = d(() => {
92
92
  if (!c?.schema) return;
93
93
  const e = [], r = (o) => {
94
94
  (o ?? []).forEach((t) => {
@@ -116,9 +116,9 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
116
116
  }, [c]), me = d(() => {
117
117
  if (v)
118
118
  return z(v).message;
119
- if (_)
120
- return z(_).message;
121
- }, [v, _]), g = d(
119
+ if (A)
120
+ return z(A).message;
121
+ }, [v, A]), g = d(
122
122
  () => [
123
123
  { key: "recordedOn", header: n("RECORDED_ON") },
124
124
  { key: "recordedBy", header: n("RECORDED_BY") }
@@ -137,7 +137,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
137
137
  ],
138
138
  []
139
139
  ), P = d(() => {
140
- const e = U.reduce(
140
+ const e = w.reduce(
141
141
  (o, t) => {
142
142
  const s = t.formName;
143
143
  o[s] ??= [];
@@ -161,10 +161,10 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
161
161
  )
162
162
  })
163
163
  ).sort((o, t) => o.formName.localeCompare(t.formName));
164
- }, [U, n]), V = l((e) => {
165
- D(e), M(!0);
164
+ }, [w, n]), V = l((e) => {
165
+ B(e), M(!0);
166
166
  }, []), $ = l(() => {
167
- M(!1), D(null);
167
+ M(!1), B(null);
168
168
  }, []), R = l((e) => {
169
169
  globalThis.dispatchEvent(
170
170
  new CustomEvent(Pe, {
@@ -177,16 +177,16 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
177
177
  }
178
178
  })
179
179
  );
180
- }, []), j = l(
180
+ }, []), G = l(
181
181
  (e, r) => {
182
182
  switch (r) {
183
183
  case "recordedOn":
184
- return /* @__PURE__ */ i(Be, { onClick: () => V(e), children: e.recordedOn });
184
+ return /* @__PURE__ */ i(De, { onClick: () => V(e), children: e.recordedOn });
185
185
  case "recordedBy":
186
186
  return e.recordedBy;
187
187
  case "actions":
188
188
  return f(e) ? /* @__PURE__ */ i(
189
- G,
189
+ j,
190
190
  {
191
191
  label: n("EDIT_OBSERVATION_FORM"),
192
192
  kind: "ghost",
@@ -203,23 +203,23 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
203
203
  [V, R, f, n]
204
204
  );
205
205
  return /* @__PURE__ */ x(be, { children: [
206
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || H || P.length === 0 || C ? /* @__PURE__ */ i(
206
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || U || P.length === 0 || C ? /* @__PURE__ */ i(
207
207
  Q,
208
208
  {
209
209
  headers: fe,
210
210
  ariaLabel: n("FORMS_HEADING"),
211
211
  rows: [],
212
212
  loading: S,
213
- errorStateMessage: H ? te?.message : void 0,
213
+ errorStateMessage: U ? te?.message : void 0,
214
214
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
215
- renderCell: j,
215
+ renderCell: G,
216
216
  className: E.formsTableBody,
217
217
  dataTestId: "forms-table"
218
218
  }
219
219
  ) : /* @__PURE__ */ i(Me, { align: "start", children: P.map((e, r) => {
220
220
  const { formName: o, records: t } = e, s = ue(t);
221
221
  return /* @__PURE__ */ i(
222
- De,
222
+ Be,
223
223
  {
224
224
  title: o,
225
225
  className: E.customAccordianItem,
@@ -235,7 +235,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
235
235
  errorStateMessage: "",
236
236
  sortable: ge,
237
237
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
238
- renderCell: j,
238
+ renderCell: G,
239
239
  className: E.formsTableBody,
240
240
  dataTestId: `forms-table-${o}`
241
241
  }
@@ -254,7 +254,7 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
254
254
  modalHeading: /* @__PURE__ */ x("div", { className: E.modalHeading, children: [
255
255
  /* @__PURE__ */ i("span", { children: a.formName }),
256
256
  F && f(a) && /* @__PURE__ */ i(
257
- G,
257
+ j,
258
258
  {
259
259
  label: n("EDIT_OBSERVATION_FORM"),
260
260
  kind: "ghost",
@@ -290,5 +290,5 @@ const we = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
290
290
  ] });
291
291
  };
292
292
  export {
293
- Ge as default
293
+ je as default
294
294
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
- import { k as w, Q as D, t as K, m as V, W as q, n as k, o as H, p as G, u as P, a as j, r as z, w as W, f as J, s as Y, v as X, x as Z, y as x, q as ee } from "./index-BAz36sQ7.js";
2
+ import { h as Q, i as D, t as V, j as q, k as w, m as k, n as H, o as P, u as G, a as j, p as z, A as J, d as W, r as Y, s as X, v as Z, w as x, q as ee } from "./index-_K1cix3h.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
4
  import { useRef as oe, useEffect as C, useMemo as g } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const B = (t, i, c, l, u, r) => {
7
- const s = K(t, i, u), o = s.value, a = V(o);
6
+ const A = (t, i, c, l, u, r) => {
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(
10
10
  k,
@@ -21,12 +21,12 @@ const B = (t, i, c, l, u, r) => {
21
21
  videoSrc: o,
22
22
  hideThumbnail: r
23
23
  }
24
- )), a === "PDF" && (n = /* @__PURE__ */ d(G, { id: `${o}-pdf`, src: o }));
24
+ )), a === "PDF" && (n = /* @__PURE__ */ d(P, { id: `${o}-pdf`, src: o }));
25
25
  const b = u("OBSERVATIONS_RECORDED_BY", {
26
26
  provider: s.provider
27
27
  }), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
28
28
  return /* @__PURE__ */ d(
29
- q,
29
+ w,
30
30
  {
31
31
  header: s.header,
32
32
  value: n,
@@ -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,
@@ -61,7 +61,7 @@ const B = (t, i, c, l, u, r) => {
61
61
  hideThumbnail: c
62
62
  }) => {
63
63
  const { t: l } = U(), u = (r, s, o) => {
64
- const a = w(r.encounterDetails, l);
64
+ const a = Q(r.encounterDetails, l);
65
65
  return /* @__PURE__ */ N(
66
66
  D,
67
67
  {
@@ -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,
@@ -114,7 +114,7 @@ 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 = G(), { addNotification: o } = j(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
120
  queryFn: () => z(e),
@@ -140,10 +140,10 @@ const B = (t, i, c, l, u, r) => {
140
140
  refetch: T
141
141
  } = se({
142
142
  queryKey: le(s, m),
143
- queryFn: () => W(s, m),
143
+ queryFn: () => J(s, m),
144
144
  enabled: !!s && m.length > 0 && f
145
145
  });
146
- J(
146
+ W(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
149
  (R) => m.includes(R)
@@ -161,11 +161,11 @@ const B = (t, i, c, l, u, r) => {
161
161
  if (!p) return [];
162
162
  const e = Y(p), v = X(e);
163
163
  return Z(v);
164
- }, [p]), A = [
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, F = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = F ? a("NO_OBSERVATIONS_FOUND") : void 0, Q = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
168
+ ], I = y || !f, $ = h && f, F = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = F ? a("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
169
  return /* @__PURE__ */ N(
170
170
  "div",
171
171
  {
@@ -184,7 +184,7 @@ const B = (t, i, c, l, u, r) => {
184
184
  children: /* @__PURE__ */ d("p", { children: E })
185
185
  }
186
186
  ),
187
- Q ? /* @__PURE__ */ d(
187
+ K ? /* @__PURE__ */ d(
188
188
  ae,
189
189
  {
190
190
  groupedData: _,
@@ -194,7 +194,7 @@ const B = (t, i, c, l, u, r) => {
194
194
  ) : /* @__PURE__ */ d(
195
195
  ee,
196
196
  {
197
- headers: A,
197
+ headers: B,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: I,
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionsTable.d.ts","sourceRoot":"","sources":["../../src/conditions/ConditionsTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOpE,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4N1C,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ConditionsTable.d.ts","sourceRoot":"","sources":["../../src/conditions/ConditionsTable.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOpE,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyP1C,CAAC;AAEF,eAAe,eAAe,CAAC"}