@bahmni/widgets 0.0.1-dev.338 → 0.0.1-dev.340

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.
Files changed (27) hide show
  1. package/dist/{DocumentsTable-DwzMSQBY.js → DocumentsTable-r8skJwV6.js} +18 -18
  2. package/dist/{FormsTable-C6IhR7Ju.js → FormsTable-D2gWE4gn.js} +24 -24
  3. package/dist/{Observations-Dz2tbSRx.js → Observations-GVDM1XHV.js} +23 -23
  4. package/dist/{index-9HLwBpJu.js → index-DLYjfDvw.js} +15536 -15404
  5. package/dist/index.css +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +37 -34
  9. package/dist/userGlobalAction/UserGlobalAction.d.ts +5 -0
  10. package/dist/userGlobalAction/UserGlobalAction.d.ts.map +1 -0
  11. package/dist/userGlobalAction/actions/index.d.ts +3 -0
  12. package/dist/userGlobalAction/actions/index.d.ts.map +1 -0
  13. package/dist/userGlobalAction/actions/logout/index.d.ts +3 -0
  14. package/dist/userGlobalAction/actions/logout/index.d.ts.map +1 -0
  15. package/dist/userGlobalAction/index.d.ts +4 -0
  16. package/dist/userGlobalAction/index.d.ts.map +1 -0
  17. package/dist/userGlobalAction/models.d.ts +9 -0
  18. package/dist/userGlobalAction/models.d.ts.map +1 -0
  19. package/dist/userGlobalAction/registry/context.d.ts +10 -0
  20. package/dist/userGlobalAction/registry/context.d.ts.map +1 -0
  21. package/dist/userGlobalAction/registry/hook.d.ts +2 -0
  22. package/dist/userGlobalAction/registry/hook.d.ts.map +1 -0
  23. package/dist/userGlobalAction/registry/index.d.ts +3 -0
  24. package/dist/userGlobalAction/registry/index.d.ts.map +1 -0
  25. package/dist/userGlobalAction/registry/provider.d.ts +7 -0
  26. package/dist/userGlobalAction/registry/provider.d.ts.map +1 -0
  27. package/package.json +1 -1
@@ -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 Z, z as X, Z as J, i as x, j as ee, P as te } from "./index-9HLwBpJu.js";
2
+ import { u as W, a as Z, H as X, Z as J, s as x, j as ee, F as te } from "./index-DLYjfDvw.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";
@@ -19,7 +19,7 @@ const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTab
19
19
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
20
20
  attachments: "DOCUMENTS_ATTACHMENTS"
21
21
  };
22
- function B(n) {
22
+ function R(n) {
23
23
  return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
24
24
  }
25
25
  function he(n, f) {
@@ -34,18 +34,18 @@ const Te = [
34
34
  "attachments",
35
35
  "uploadedOn",
36
36
  "uploadedBy"
37
- ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, P = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
37
+ ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
38
38
  const [d, L] = l(!1), [s, U] = l(
39
39
  null
40
- ), [F, A] = l(
40
+ ), [P, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
- ), E = W(), { t: o } = ae(), { addNotification: w } = Z(), V = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(V), [k, O] = l(void 0), v = _((e) => {
42
+ ), E = W(), { t: o } = ae(), { addNotification: w } = Z(), H = Number(n?.pageSize) || 5, [N, C] = l(1), [u, V] = l(H), [$, O] = l(void 0), v = _((e) => {
43
43
  U(e), L(!0);
44
- }, []), z = _(() => {
44
+ }, []), k = _(() => {
45
45
  L(!1), U(null), A(/* @__PURE__ */ new Set());
46
- }, []), R = _((e) => {
46
+ }, []), F = _((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: i, isLoading: H, isError: S, error: y } = ne({
48
+ }, []), { data: i, isLoading: z, isError: S, error: y } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
51
  E,
@@ -75,9 +75,9 @@ const Te = [
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
77
  if (!d || !s) return;
78
- const a = /* @__PURE__ */ new Set(), g = P(s);
78
+ const a = /* @__PURE__ */ new Set(), g = B(s);
79
79
  for (let m = 0; m < g.length; m++) {
80
- const b = B(g[m].url);
80
+ const b = R(g[m].url);
81
81
  try {
82
82
  (await fetch(b, {
83
83
  method: "HEAD",
@@ -92,7 +92,7 @@ const Te = [
92
92
  }, [d, s]);
93
93
  const j = _(
94
94
  (e, t) => {
95
- t !== u ? ($(t), C(1), O(void 0)) : C(e);
95
+ t !== u ? (V(t), C(1), O(void 0)) : C(e);
96
96
  },
97
97
  [u]
98
98
  ), D = p(
@@ -105,7 +105,7 @@ const Te = [
105
105
  })),
106
106
  [D]
107
107
  ), h = p(
108
- () => s ? P(s) : [],
108
+ () => s ? B(s) : [],
109
109
  [s]
110
110
  ), Q = _(
111
111
  (e, t) => {
@@ -145,7 +145,7 @@ const Te = [
145
145
  headers: K,
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
147
  rows: q,
148
- loading: H,
148
+ loading: z,
149
149
  errorStateMessage: S ? y?.message : null,
150
150
  sortable: G,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
@@ -153,7 +153,7 @@ const Te = [
153
153
  className: c.documentsTableBody,
154
154
  dataTestId: "documents-table",
155
155
  pageSize: u,
156
- totalItems: k,
156
+ totalItems: $,
157
157
  page: N,
158
158
  onPageChange: j
159
159
  }
@@ -164,13 +164,13 @@ const Te = [
164
164
  id: "modalIdForActionAreaLayout",
165
165
  portalId: "main-display-area",
166
166
  open: d,
167
- onRequestClose: z,
167
+ onRequestClose: k,
168
168
  modalHeading: s.documentIdentifier,
169
169
  passiveModal: !0,
170
170
  size: "lg",
171
171
  testId: "document-view-modal",
172
172
  children: /* @__PURE__ */ r("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
173
- const a = B(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = F.has(t);
173
+ const a = R(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
174
174
  return a === "#" || b ? /* @__PURE__ */ T(
175
175
  "div",
176
176
  {
@@ -203,7 +203,7 @@ const Te = [
203
203
  src: a,
204
204
  alt: s.documentIdentifier,
205
205
  className: c.documentImage,
206
- onError: () => R(t)
206
+ onError: () => F(t)
207
207
  }
208
208
  ) : /* @__PURE__ */ r(
209
209
  "iframe",
@@ -211,7 +211,7 @@ const Te = [
211
211
  src: g ? `${a}#toolbar=0` : a,
212
212
  className: c.documentIframe,
213
213
  title: s.documentIdentifier,
214
- onError: () => R(t)
214
+ onError: () => F(t)
215
215
  }
216
216
  )
217
217
  ]
@@ -1,34 +1,34 @@
1
1
  import { jsx as i, jsxs as oe, Fragment as te } from "react/jsx-runtime";
2
- import { u as se, c as ae, T as ne, _ as de, v as ie, o as ce, M as le, e as me, q as U, i as ue, Z as fe, j as k, b as ye, R as be, P as pe, O as ge } from "./index-9HLwBpJu.js";
2
+ import { u as se, b as ae, _ as ne, E as de, c as ie, n as ce, x as le, e as me, q as U, s as ue, Z as fe, j as k, T as ye, R as be, F as pe, O as ge } from "./index-DLYjfDvw.js";
3
3
  import { useQueryClient as he, useQuery as b } from "@tanstack/react-query";
4
4
  import { useState as j, useMemo as d, useCallback as p } from "react";
5
5
  import { useTranslation as Fe } from "react-i18next";
6
6
  const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs", O = {
7
7
  formsTableBody: Ne,
8
8
  customAccordianItem: Oe
9
- }, Te = ({
10
- episodeOfCareUuids: v,
9
+ }, Ae = ({
10
+ episodeOfCareUuids: E,
11
11
  encounterUuids: l,
12
- config: H
12
+ config: x
13
13
  }) => {
14
- const { t: n } = Fe(), m = se(), [f, M] = j(!1), [a, E] = j(null), {
15
- numberOfVisits: P,
14
+ const { t: n } = Fe(), m = se(), [f, v] = j(!1), [a, M] = j(null), {
15
+ numberOfVisits: H,
16
16
  hideThumbnail: w = !1,
17
17
  forms: y
18
- } = H ?? {}, _ = ae(
19
- v,
18
+ } = x ?? {}, _ = ae(
19
+ E,
20
20
  l
21
- ), x = he(), {
21
+ ), K = he(), {
22
22
  data: I = [],
23
- isLoading: T,
24
- isError: A,
25
- error: K,
23
+ isLoading: A,
24
+ isError: D,
25
+ error: P,
26
26
  refetch: V
27
27
  } = b({
28
- queryKey: ["forms", m, v],
29
- queryFn: () => ne(m, void 0, P),
28
+ queryKey: ["forms", m, E],
29
+ queryFn: () => ne(m, void 0, H),
30
30
  enabled: !!m && !_
31
- }), D = d(() => {
31
+ }), T = d(() => {
32
32
  let e = I;
33
33
  return l && l.length > 0 && (e = e.filter(
34
34
  (o) => l.includes(o.encounterUuid)
@@ -65,7 +65,7 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
65
65
  });
66
66
  le(
67
67
  (e) => {
68
- e.patientUUID === m && e.updatedConcepts.size > 0 && (V(), x.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
68
+ e.patientUUID === m && e.updatedConcepts.size > 0 && (V(), K.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
69
  },
70
70
  [m]
71
71
  );
@@ -115,7 +115,7 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
115
115
  ],
116
116
  []
117
117
  ), C = d(() => {
118
- const e = D.reduce(
118
+ const e = T.reduce(
119
119
  (r, t) => {
120
120
  const s = t.formName;
121
121
  r[s] ??= [];
@@ -139,10 +139,10 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
139
139
  )
140
140
  })
141
141
  ).sort((r, t) => r.formName.localeCompare(t.formName));
142
- }, [D, n]), q = p((e) => {
143
- E(e), M(!0);
142
+ }, [T, n]), q = p((e) => {
143
+ M(e), v(!0);
144
144
  }, []), ee = p(() => {
145
- M(!1), E(null);
145
+ v(!1), M(null);
146
146
  }, []), S = p(
147
147
  (e, o) => {
148
148
  switch (o) {
@@ -157,14 +157,14 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
157
157
  [q]
158
158
  );
159
159
  return /* @__PURE__ */ oe(te, { children: [
160
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: T || A || C.length === 0 || _ ? /* @__PURE__ */ i(
160
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: A || D || C.length === 0 || _ ? /* @__PURE__ */ i(
161
161
  k,
162
162
  {
163
163
  headers: L,
164
164
  ariaLabel: n("FORMS_HEADING"),
165
165
  rows: [],
166
- loading: T,
167
- errorStateMessage: A ? K?.message : void 0,
166
+ loading: A,
167
+ errorStateMessage: D ? P?.message : void 0,
168
168
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
169
169
  renderCell: S,
170
170
  className: O.formsTableBody,
@@ -229,5 +229,5 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
229
229
  ] });
230
230
  };
231
231
  export {
232
- Te as default
232
+ Ae as default
233
233
  };
@@ -1,9 +1,9 @@
1
1
  import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
- import { f as H, J as D, t as K, s as V, F as k, X as w, d as j, Q as q, u as G, a as P, g as z, h as J, M as X, k as Y, l as W, m as Z, n as x, j as ee } from "./index-9HLwBpJu.js";
2
+ import { f as Q, J as D, t as K, r as V, d as k, X as w, g as j, Q as q, u as G, a as P, h as J, W as z, x as W, i as X, k as Y, l as x, o as Z, j as ee } from "./index-DLYjfDvw.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 g } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const F = (t, i, c, l, u, r) => {
6
+ const B = (t, i, c, l, u, r) => {
7
7
  const s = K(t, i, u), o = s.value, a = V(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ d(
@@ -24,7 +24,7 @@ const F = (t, i, c, l, u, r) => {
24
24
  )), a === "PDF" && (n = /* @__PURE__ */ d(q, { id: `${o}-pdf`, src: o }));
25
25
  const b = u("OBSERVATIONS_RECORDED_BY", {
26
26
  provider: s.provider
27
- }), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
27
+ }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
28
28
  return /* @__PURE__ */ d(
29
29
  k,
30
30
  {
@@ -44,7 +44,7 @@ const F = (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) => F(
47
+ (o, a) => B(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -61,7 +61,7 @@ const F = (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 = H(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 F = (t, i, c, l, u, r) => {
70
70
  open: s,
71
71
  children: [
72
72
  r.observations.map(
73
- (n, b) => F(
73
+ (n, b) => B(
74
74
  n,
75
75
  b,
76
76
  o,
@@ -117,7 +117,7 @@ const F = (t, i, c, l, u, r) => {
117
117
  } = i, r = oe(/* @__PURE__ */ new Set()), s = G(), { addNotification: o } = P(), { t: a } = U(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
- queryFn: () => z(e),
120
+ queryFn: () => J(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
@@ -133,20 +133,20 @@ const F = (t, i, c, l, u, r) => {
133
133
  } else e.isError || r.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
- data: p,
136
+ const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
+ data: m,
138
138
  isLoading: y,
139
139
  isError: h,
140
140
  refetch: T
141
141
  } = se({
142
- queryKey: le(s, m),
143
- queryFn: () => J(s, m),
144
- enabled: !!s && m.length > 0 && f
142
+ queryKey: le(s, p),
143
+ queryFn: () => z(s, p),
144
+ enabled: !!s && p.length > 0 && f
145
145
  });
146
- X(
146
+ W(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (R) => m.includes(R)
149
+ (R) => p.includes(R)
150
150
  ) && T();
151
151
  },
152
152
  [s, T]
@@ -158,14 +158,14 @@ const F = (t, i, c, l, u, r) => {
158
158
  });
159
159
  }, [h]);
160
160
  const _ = g(() => {
161
- if (!p) return [];
162
- const e = Y(p), v = W(e);
163
- return Z(v);
164
- }, [p]), B = [
161
+ if (!m) return [];
162
+ const e = X(m), v = Y(e);
163
+ return x(v);
164
+ }, [m]), F = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], I = y || !f, $ = h && f, A = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = A ? a("NO_OBSERVATIONS_FOUND") : void 0, Q = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
168
+ ], I = y || !f, $ = h && f, A = (!m || m.entry?.length === 0 || p.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, H = A ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
169
169
  return /* @__PURE__ */ N(
170
170
  "div",
171
171
  {
@@ -175,7 +175,7 @@ const F = (t, i, c, l, u, r) => {
175
175
  className: C.observations,
176
176
  children: [
177
177
  /* @__PURE__ */ d(
178
- x,
178
+ Z,
179
179
  {
180
180
  id: "observations-title",
181
181
  testId: O ? `observations-title-${E}` : "observations-title",
@@ -184,7 +184,7 @@ const F = (t, i, c, l, u, r) => {
184
184
  children: /* @__PURE__ */ d("p", { children: E })
185
185
  }
186
186
  ),
187
- Q ? /* @__PURE__ */ d(
187
+ M ? /* @__PURE__ */ d(
188
188
  ae,
189
189
  {
190
190
  groupedData: _,
@@ -194,12 +194,12 @@ const F = (t, i, c, l, u, r) => {
194
194
  ) : /* @__PURE__ */ d(
195
195
  ee,
196
196
  {
197
- headers: B,
197
+ headers: F,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: I,
201
201
  errorStateMessage: L,
202
- emptyStateMessage: M,
202
+ emptyStateMessage: H,
203
203
  dataTestId: "observations-table"
204
204
  }
205
205
  )