@bahmni/widgets 0.0.1-dev.264 → 0.0.1-dev.266

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, U as J, f as Z, e as x, m as ee, y as te } from "./index-BhoSY1KM.js";
2
+ import { u as W, a as X, z as J, f as Z, s as x, m as ee, y as te } from "./index-c9jI-RE8.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as f, useEffect as N, useMemo as p } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -35,17 +35,17 @@ const _e = [
35
35
  "uploadedBy",
36
36
  "action"
37
37
  ], fe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ne = ({ config: n, encounterUuids: E }) => {
38
- const [d, L] = l(!1), [r, M] = l(
38
+ const [d, M] = l(!1), [r, U] = l(
39
39
  null
40
40
  ), [P, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
42
  ), T = W(), { t: o } = ae(), { addNotification: w } = X(), F = Number(n?.pageSize) || 5, [D, O] = l(1), [m, $] = l(F), [k, C] = l(void 0), b = f((e) => {
43
- M(e), L(!0);
44
- }, []), V = f(() => {
45
- L(!1), M(null), A(/* @__PURE__ */ new Set());
43
+ U(e), M(!0);
44
+ }, []), z = f(() => {
45
+ M(!1), U(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), B = f((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: u, isLoading: z, isError: S, error: y } = ne({
48
+ }, []), { data: u, isLoading: V, isError: S, error: y } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
51
  T,
@@ -83,8 +83,8 @@ const _e = [
83
83
  method: "HEAD",
84
84
  signal: e.signal
85
85
  })).ok || a.add(i);
86
- } catch (U) {
87
- U instanceof Error && U.name !== "AbortError" && a.add(i);
86
+ } catch (L) {
87
+ L instanceof Error && L.name !== "AbortError" && a.add(i);
88
88
  }
89
89
  }
90
90
  e.signal.aborted || A(a);
@@ -145,7 +145,7 @@ const _e = [
145
145
  headers: G,
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
147
  rows: q,
148
- loading: z,
148
+ loading: V,
149
149
  errorStateMessage: S ? y?.message : null,
150
150
  sortable: Y,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
@@ -164,7 +164,7 @@ const _e = [
164
164
  id: "modalIdForActionAreaLayout",
165
165
  portalId: "main-display-area",
166
166
  open: d,
167
- onRequestClose: V,
167
+ onRequestClose: z,
168
168
  modalHeading: r.documentIdentifier,
169
169
  passiveModal: !0,
170
170
  size: "lg",
@@ -1,53 +1,53 @@
1
1
  import { jsx as n, jsxs as X, Fragment as Z } from "react/jsx-runtime";
2
- import { w as ee, u as re, o as te, v as oe, _ as ae, b as se, s as ne, k as de, T as C, e as ie, f as me, m as U, c as ce, t as le, y as ue, O as fe } from "./index-BhoSY1KM.js";
2
+ import { R as ee, u as re, b as te, O as oe, S as ae, c as se, d as ne, q as de, $ as C, s as ie, f as me, m as U, e as ce, t as le, y as ue, g as fe } from "./index-c9jI-RE8.js";
3
3
  import { useQueryClient as ye, useQuery as f } from "@tanstack/react-query";
4
- import { useState as k, useMemo as d, useCallback as y } from "react";
4
+ import { useState as x, useMemo as d, useCallback as y } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
6
- const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
6
+ const be = "_formsTableBody_ourq9_5", ge = "_customAccordianItem_ourq9_10", h = {
7
7
  formsTableBody: be,
8
8
  customAccordianItem: ge
9
- }, he = (m) => m ? m.extension?.find(
9
+ }, Oe = (m) => m ? m.extension?.find(
10
10
  (p) => p.url === ee
11
- )?.valueString : void 0, ve = ({
11
+ )?.valueString : void 0, Ie = ({
12
12
  episodeOfCareUuids: m,
13
13
  encounterUuids: i,
14
14
  config: p
15
15
  }) => {
16
- const { t: s } = pe(), c = re(), [l, _] = k(!1), [t, v] = k(null), { numberOfVisits: x, hideThumbnail: w = !1 } = p ?? {}, D = te(
16
+ const { t: s } = pe(), c = re(), [l, D] = x(!1), [t, I] = x(null), { numberOfVisits: k, hideThumbnail: P = !1 } = p ?? {}, _ = te(
17
17
  m,
18
18
  i
19
- ), P = ye(), {
19
+ ), $ = ye(), {
20
20
  data: b = [],
21
- isLoading: I,
22
- isError: M,
21
+ isLoading: M,
22
+ isError: R,
23
23
  error: H,
24
24
  refetch: K
25
25
  } = f({
26
26
  queryKey: ["forms", c, m],
27
- queryFn: () => oe(c, void 0, x),
28
- enabled: !!c && !D
29
- }), A = d(() => !i || i.length === 0 ? b : b.filter(
27
+ queryFn: () => oe(c, void 0, k),
28
+ enabled: !!c && !_
29
+ }), v = d(() => !i || i.length === 0 ? b : b.filter(
30
30
  (e) => i.includes(e.encounterUuid)
31
- ), [b, i]), { data: B = [] } = f({
31
+ ), [b, i]), { data: A = [] } = f({
32
32
  queryKey: ["observationForms"],
33
33
  queryFn: () => ae()
34
- }), T = y(
35
- (e) => B.find((r) => r.name === e)?.uuid,
36
- [B]
34
+ }), B = y(
35
+ (e) => A.find((r) => r.name === e)?.uuid,
36
+ [A]
37
37
  ), g = d(() => {
38
38
  if (t)
39
- return T(t.formName);
40
- }, [t, T]), {
39
+ return B(t.formName);
40
+ }, [t, B]), {
41
41
  isLoading: j,
42
42
  isError: V,
43
- error: h
43
+ error: O
44
44
  } = f({
45
45
  queryKey: ["formMetadata", g],
46
46
  queryFn: () => se(g),
47
47
  enabled: !!g && l
48
48
  }), {
49
49
  data: E,
50
- isLoading: $,
50
+ isLoading: w,
51
51
  isError: Q,
52
52
  error: F
53
53
  } = f({
@@ -57,19 +57,19 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
57
57
  });
58
58
  de(
59
59
  (e) => {
60
- e.patientUUID === c && e.updatedConcepts.size > 0 && (K(), P.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
60
+ e.patientUUID === c && e.updatedConcepts.size > 0 && (K(), $.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
61
61
  },
62
62
  [c]
63
63
  );
64
64
  const z = d(() => !E?.entry || !t?.formName ? [] : E.entry.filter((a) => a.resource?.resourceType === "Observation").map((a) => a.resource).filter((a) => {
65
- const r = he(a);
65
+ const r = Oe(a);
66
66
  return !r || r.includes(t.formName);
67
67
  }), [E, t?.formName]), G = d(() => {
68
- if (h)
69
- return C(h).message;
68
+ if (O)
69
+ return C(O).message;
70
70
  if (F)
71
71
  return C(F).message;
72
- }, [h, F]), R = d(
72
+ }, [O, F]), T = d(
73
73
  () => [
74
74
  { key: "recordedOn", header: s("RECORDED_ON") },
75
75
  { key: "recordedBy", header: s("RECORDED_BY") }
@@ -82,7 +82,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
82
82
  ],
83
83
  []
84
84
  ), L = d(() => {
85
- const e = A.reduce(
85
+ const e = v.reduce(
86
86
  (r, o) => {
87
87
  const u = o.formName;
88
88
  r[u] ??= [];
@@ -106,35 +106,35 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
106
106
  )
107
107
  })
108
108
  ).sort((r, o) => r.formName.localeCompare(o.formName));
109
- }, [A, s]), S = y((e) => {
110
- v(e), _(!0);
109
+ }, [v, s]), q = y((e) => {
110
+ I(e), D(!0);
111
111
  }, []), J = y(() => {
112
- _(!1), v(null);
113
- }, []), q = y(
112
+ D(!1), I(null);
113
+ }, []), S = y(
114
114
  (e, a) => {
115
115
  switch (a) {
116
116
  case "recordedOn":
117
- return /* @__PURE__ */ n(me, { onClick: () => S(e), children: e.recordedOn });
117
+ return /* @__PURE__ */ n(me, { onClick: () => q(e), children: e.recordedOn });
118
118
  case "recordedBy":
119
119
  return e.recordedBy;
120
120
  default:
121
121
  return null;
122
122
  }
123
123
  },
124
- [S]
124
+ [q]
125
125
  );
126
126
  return /* @__PURE__ */ X(Z, { children: [
127
- /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: I || M || L.length === 0 || D ? /* @__PURE__ */ n(
127
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: M || R || L.length === 0 || _ ? /* @__PURE__ */ n(
128
128
  U,
129
129
  {
130
- headers: R,
130
+ headers: T,
131
131
  ariaLabel: s("FORMS_HEADING"),
132
132
  rows: [],
133
- loading: I,
134
- errorStateMessage: M ? H?.message : void 0,
133
+ loading: M,
134
+ errorStateMessage: R ? H?.message : void 0,
135
135
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
136
- renderCell: q,
137
- className: O.formsTableBody,
136
+ renderCell: S,
137
+ className: h.formsTableBody,
138
138
  dataTestId: "forms-table"
139
139
  }
140
140
  ) : /* @__PURE__ */ n(ce, { align: "start", children: L.map((e, a) => {
@@ -143,21 +143,21 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
143
143
  le,
144
144
  {
145
145
  title: r,
146
- className: O.customAccordianItem,
146
+ className: h.customAccordianItem,
147
147
  testId: `accordian-title-${r}`,
148
148
  open: a === 0,
149
149
  children: /* @__PURE__ */ n(
150
150
  U,
151
151
  {
152
- headers: R,
152
+ headers: T,
153
153
  ariaLabel: s("FORMS_HEADING"),
154
154
  rows: o,
155
155
  loading: !1,
156
156
  errorStateMessage: "",
157
157
  sortable: Y,
158
158
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
159
- renderCell: q,
160
- className: O.formsTableBody,
159
+ renderCell: S,
160
+ className: h.formsTableBody,
161
161
  dataTestId: `forms-table-${r}`
162
162
  }
163
163
  )
@@ -181,12 +181,12 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
181
181
  fe,
182
182
  {
183
183
  observations: z,
184
- isLoading: j || $,
184
+ isLoading: j || w,
185
185
  isError: V || Q,
186
186
  errorMessage: G,
187
187
  emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
188
188
  testIdPrefix: t.formName,
189
- hideThumbnail: w
189
+ hideThumbnail: P
190
190
  }
191
191
  )
192
192
  }
@@ -194,5 +194,5 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", O = {
194
194
  ] });
195
195
  };
196
196
  export {
197
- ve as default
197
+ Ie as default
198
198
  };
@@ -1,13 +1,13 @@
1
1
  import { jsx as l, jsxs as S } from "react/jsx-runtime";
2
- import { d as M, C as D, g as V, n as K, i as Q, x as w, h as G, z as P, u as j, a as z, j as H, l as Y, k as x, p as J, q as W, r as X, $ as Z, m as ee } from "./index-BhoSY1KM.js";
2
+ import { h as V, C as D, i as q, j as K, k as Q, x as k, l as G, n as P, u as j, a as H, o as x, p as z, q as Y, r as J, v as W, w as X, A as Z, m as ee } from "./index-c9jI-RE8.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 O } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const B = (t, i, c, d, u, r) => {
7
- const s = V(t, i, u), o = s.value, a = K(o);
6
+ const A = (t, i, c, d, u, r) => {
7
+ const s = q(t, i, u), o = s.value, a = K(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ l(
10
- w,
10
+ k,
11
11
  {
12
12
  imageSrc: o,
13
13
  alt: o,
@@ -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,
@@ -61,7 +61,7 @@ const B = (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__ */ S(
66
66
  D,
67
67
  {
@@ -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,
@@ -106,7 +106,7 @@ const B = (t, i, c, d, u, r) => {
106
106
  )
107
107
  }
108
108
  );
109
- }, ne = "_observations_kfbhq_1", ie = "_title_kfbhq_12", N = {
109
+ }, ne = "_observations_w45xp_1", ie = "_title_w45xp_18", N = {
110
110
  observations: ne,
111
111
  title: ie
112
112
  }, ce = (t) => ["conceptUuid", t], de = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
@@ -114,10 +114,10 @@ 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 = j(), { addNotification: o } = H(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
- queryFn: () => H(e),
120
+ queryFn: () => x(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
@@ -140,10 +140,10 @@ const B = (t, i, c, d, u, r) => {
140
140
  refetch: T
141
141
  } = se({
142
142
  queryKey: de(s, p),
143
- queryFn: () => Y(s, p),
143
+ queryFn: () => z(s, p),
144
144
  enabled: !!s && p.length > 0 && f
145
145
  });
146
- x(
146
+ Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
149
  (R) => p.includes(R)
@@ -161,11 +161,11 @@ const B = (t, i, c, d, u, r) => {
161
161
  if (!m) return [];
162
162
  const e = J(m), v = W(e);
163
163
  return X(v);
164
- }, [m]), A = [
164
+ }, [m]), B = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], $ = y || !f, I = g && f, F = (!m || m.entry?.length === 0 || p.length === 0) && f, L = I ? a("ERROR_FETCHING_OBSERVATIONS") : null, k = F ? a("NO_OBSERVATIONS_FOUND") : void 0, q = _.length > 0 && !$ && !I, h = i.titleTranslationKey, E = h ? a(h) : "";
168
+ ], $ = y || !f, I = g && f, F = (!m || m.entry?.length === 0 || p.length === 0) && f, L = I ? a("ERROR_FETCHING_OBSERVATIONS") : null, w = F ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !$ && !I, h = i.titleTranslationKey, E = h ? a(h) : "";
169
169
  return /* @__PURE__ */ S(
170
170
  "div",
171
171
  {
@@ -184,7 +184,7 @@ const B = (t, i, c, d, u, r) => {
184
184
  children: /* @__PURE__ */ l("p", { children: E })
185
185
  }
186
186
  ),
187
- q ? /* @__PURE__ */ l(
187
+ M ? /* @__PURE__ */ l(
188
188
  ae,
189
189
  {
190
190
  groupedData: _,
@@ -194,12 +194,12 @@ 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: $,
201
201
  errorStateMessage: L,
202
- emptyStateMessage: k,
202
+ emptyStateMessage: w,
203
203
  dataTestId: "observations-table"
204
204
  }
205
205
  )
@@ -1 +1 @@
1
- {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA6NrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAgOrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}