@bahmni/widgets 0.0.1-dev.273 → 0.0.1-dev.275

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, p as J, b as Z, T as x, m as ee, y as te } from "./index-Deay0cXM.js";
2
+ import { u as W, a as X, m as J, p as Z, R as x, b as ee, y as te } from "./index-uWfi2bKy.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as m, useCallback as p, useEffect as I, useMemo as _ } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
2
- import { z as re, u as te, D as oe, K as ae, Y as se, G as ne, I as de, c as ie, M as U, T as me, b as le, m as x, e as ce, t as ue, y as fe, O as ye } from "./index-Deay0cXM.js";
2
+ import { Y as re, u as te, C as oe, W as ae, G as se, K as ne, D as de, c as ie, M as U, R as me, p as le, b as x, e as ce, t as ue, y as fe, O as ye } from "./index-uWfi2bKy.js";
3
3
  import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as k, useMemo as d, useCallback as b } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
@@ -8,47 +8,47 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
8
8
  customAccordianItem: Fe
9
9
  }, he = (m) => m ? m.extension?.find(
10
10
  (p) => p.url === re
11
- )?.valueString : void 0, Me = ({
11
+ )?.valueString : void 0, Ae = ({
12
12
  episodeOfCareUuids: m,
13
13
  encounterUuids: i,
14
14
  config: p
15
15
  }) => {
16
- const { t: s } = pe(), l = te(), [c, D] = k(!1), [o, I] = k(null), {
16
+ const { t: s } = pe(), l = te(), [c, D] = k(!1), [o, M] = k(null), {
17
17
  numberOfVisits: K,
18
18
  hideThumbnail: P = !1,
19
19
  forms: u
20
- } = p ?? {}, M = oe(
20
+ } = p ?? {}, A = oe(
21
21
  m,
22
22
  i
23
23
  ), w = be(), {
24
- data: A = [],
25
- isLoading: T,
26
- isError: v,
27
- error: z,
28
- refetch: G
24
+ data: I = [],
25
+ isLoading: v,
26
+ isError: B,
27
+ error: G,
28
+ refetch: H
29
29
  } = y({
30
30
  queryKey: ["forms", l, m],
31
31
  queryFn: () => ae(l, void 0, K),
32
- enabled: !!l && !M
33
- }), B = d(() => {
34
- let e = A;
32
+ enabled: !!l && !A
33
+ }), R = d(() => {
34
+ let e = I;
35
35
  return i && i.length > 0 && (e = e.filter(
36
36
  (t) => i.includes(t.encounterUuid)
37
37
  )), Array.isArray(u) && u.length > 0 && (e = e.filter(
38
38
  (t) => u.some((r) => r.toLowerCase() === t.formName.toLowerCase())
39
39
  )), e;
40
- }, [A, i, u]), { data: L = [] } = y({
40
+ }, [I, i, u]), { data: T = [] } = y({
41
41
  queryKey: ["observationForms"],
42
42
  queryFn: () => se()
43
- }), R = b(
44
- (e) => L.find((r) => r.name === e)?.uuid,
45
- [L]
43
+ }), L = b(
44
+ (e) => T.find((r) => r.name === e)?.uuid,
45
+ [T]
46
46
  ), g = d(() => {
47
47
  if (o)
48
- return R(o.formName);
49
- }, [o, R]), {
50
- isLoading: H,
51
- isError: j,
48
+ return L(o.formName);
49
+ }, [o, L]), {
50
+ isLoading: j,
51
+ isError: V,
52
52
  error: F
53
53
  } = y({
54
54
  queryKey: ["formMetadata", g],
@@ -56,8 +56,8 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
56
56
  enabled: !!g && c
57
57
  }), {
58
58
  data: h,
59
- isLoading: V,
60
- isError: $,
59
+ isLoading: $,
60
+ isError: z,
61
61
  error: N
62
62
  } = y({
63
63
  queryKey: ["formsEncounterFHIR", o?.encounterUuid],
@@ -66,7 +66,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
66
66
  });
67
67
  ie(
68
68
  (e) => {
69
- e.patientUUID === l && e.updatedConcepts.size > 0 && (G(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
+ e.patientUUID === l && e.updatedConcepts.size > 0 && (H(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
70
  },
71
71
  [l]
72
72
  );
@@ -84,14 +84,14 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
84
84
  { key: "recordedBy", header: s("RECORDED_BY") }
85
85
  ],
86
86
  [s]
87
- ), J = d(
87
+ ), W = d(
88
88
  () => [
89
89
  { key: "recordedOn", sortable: !0 },
90
90
  { key: "recordedBy", sortable: !0 }
91
91
  ],
92
92
  []
93
93
  ), C = d(() => {
94
- const e = B.reduce(
94
+ const e = R.reduce(
95
95
  (r, a) => {
96
96
  const f = a.formName;
97
97
  r[f] ??= [];
@@ -115,10 +115,10 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
115
115
  )
116
116
  })
117
117
  ).sort((r, a) => r.formName.localeCompare(a.formName));
118
- }, [B, s]), S = b((e) => {
119
- I(e), D(!0);
120
- }, []), W = b(() => {
121
- D(!1), I(null);
118
+ }, [R, s]), S = b((e) => {
119
+ M(e), D(!0);
120
+ }, []), J = b(() => {
121
+ D(!1), M(null);
122
122
  }, []), q = b(
123
123
  (e, t) => {
124
124
  switch (t) {
@@ -133,14 +133,14 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
133
133
  [S]
134
134
  );
135
135
  return /* @__PURE__ */ Z(ee, { children: [
136
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: T || v || C.length === 0 || M ? /* @__PURE__ */ n(
136
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: v || B || C.length === 0 || A ? /* @__PURE__ */ n(
137
137
  x,
138
138
  {
139
139
  headers: _,
140
140
  ariaLabel: s("FORMS_HEADING"),
141
141
  rows: [],
142
- loading: T,
143
- errorStateMessage: v ? z?.message : void 0,
142
+ loading: v,
143
+ errorStateMessage: B ? G?.message : void 0,
144
144
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
145
145
  renderCell: q,
146
146
  className: O.formsTableBody,
@@ -163,7 +163,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
163
163
  rows: a,
164
164
  loading: !1,
165
165
  errorStateMessage: "",
166
- sortable: J,
166
+ sortable: W,
167
167
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
168
168
  renderCell: q,
169
169
  className: O.formsTableBody,
@@ -180,7 +180,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
180
180
  id: "modalIdForActionAreaLayout",
181
181
  portalId: "main-display-area",
182
182
  open: c,
183
- onRequestClose: W,
183
+ onRequestClose: J,
184
184
  modalHeading: o.formName,
185
185
  modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
186
186
  passiveModal: !0,
@@ -190,8 +190,8 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
190
190
  ye,
191
191
  {
192
192
  observations: Q,
193
- isLoading: H || V,
194
- isError: j || $,
193
+ isLoading: j || $,
194
+ isError: V || z,
195
195
  errorMessage: Y,
196
196
  emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
197
197
  testIdPrefix: o.formName,
@@ -203,5 +203,5 @@ const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_cu
203
203
  ] });
204
204
  };
205
205
  export {
206
- Me as default
206
+ Ae as default
207
207
  };
@@ -1,9 +1,9 @@
1
1
  import { jsx as l, jsxs as C } from "react/jsx-runtime";
2
- import { f as V, x as D, d as k, g as w, i as Q, h as q, j as G, k as P, u as j, a as z, l as H, n as J, c as Y, o as x, q as W, s as X, r as Z, m as ee } from "./index-Deay0cXM.js";
2
+ import { f as V, x as D, d as k, g as w, i as Q, z as q, h as z, j as G, u as P, a as j, k as H, A as J, c as Y, l as x, n as W, s as X, T as Z, b as ee } from "./index-uWfi2bKy.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
4
  import { useRef as oe, useEffect as S, useMemo as h } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const B = (t, i, c, d, u, r) => {
6
+ const A = (t, i, c, d, u, r) => {
7
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(
@@ -15,13 +15,13 @@ const B = (t, i, c, d, u, r) => {
15
15
  hideThumbnail: r
16
16
  }
17
17
  )), a === "Video" && (n = /* @__PURE__ */ l(
18
- G,
18
+ z,
19
19
  {
20
20
  id: `${o}-video`,
21
21
  videoSrc: o,
22
22
  hideThumbnail: r
23
23
  }
24
- )), a === "PDF" && (n = /* @__PURE__ */ l(P, { id: `${o}-pdf`, src: o }));
24
+ )), a === "PDF" && (n = /* @__PURE__ */ l(G, { 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 = d ? `${d}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
@@ -44,7 +44,7 @@ const B = (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) => B(
47
+ (o, a) => A(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -70,7 +70,7 @@ const B = (t, i, c, d, 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, d, u, r) => {
114
114
  conceptNames: c = [],
115
115
  conceptUuid: d = [],
116
116
  hideThumbnail: u = !1
117
- } = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = z(), { t: a } = U(), n = te({
117
+ } = i, r = oe(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
120
  queryFn: () => H(e),
@@ -124,10 +124,10 @@ const B = (t, i, c, d, u, r) => {
124
124
  S(() => {
125
125
  n.forEach((e, v) => {
126
126
  if (e.isError && !r.current.has(v)) {
127
- const T = c[v];
127
+ const R = c[v];
128
128
  o({
129
129
  title: a("ERROR_DEFAULT_TITLE"),
130
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: T }),
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);
@@ -137,7 +137,7 @@ const B = (t, i, c, d, u, r) => {
137
137
  data: p,
138
138
  isLoading: y,
139
139
  isError: g,
140
- refetch: R
140
+ refetch: T
141
141
  } = se({
142
142
  queryKey: de(s, m),
143
143
  queryFn: () => J(s, m),
@@ -146,10 +146,10 @@ const B = (t, i, c, d, u, r) => {
146
146
  Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (T) => m.includes(T)
150
- ) && R();
149
+ (R) => m.includes(R)
150
+ ) && T();
151
151
  },
152
- [s, R]
152
+ [s, T]
153
153
  ), S(() => {
154
154
  g && o({
155
155
  title: a("ERROR_DEFAULT_TITLE"),
@@ -161,7 +161,7 @@ const B = (t, i, c, d, u, r) => {
161
161
  if (!p) return [];
162
162
  const e = x(p), v = W(e);
163
163
  return X(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" }
@@ -194,7 +194,7 @@ const B = (t, i, c, d, u, r) => {
194
194
  ) : /* @__PURE__ */ l(
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":"AllergiesTable.d.ts","sourceRoot":"","sources":["../../src/allergies/AllergiesTable.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0BpE,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyKzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"AllergiesTable.d.ts","sourceRoot":"","sources":["../../src/allergies/AllergiesTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA6BpE,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2OzC,CAAC;AAEF,eAAe,cAAc,CAAC"}