@bahmni/widgets 0.0.1-dev.410 → 0.0.1-dev.412

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, F as J, V as Z, Q as x, b as ee, c as te } from "./index-B4RtTGnL.js";
2
+ import { u as W, a as X, q as J, V as Z, Q as x, b as ee, F as te } from "./index-DIGdc3zN.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";
@@ -41,11 +41,11 @@ const Te = [
41
41
  /* @__PURE__ */ new Set()
42
42
  ), E = W(), { t: o } = ae(), { addNotification: w } = X(), P = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(P), [k, O] = l(void 0), v = _((e) => {
43
43
  U(e), L(!0);
44
- }, []), z = _(() => {
44
+ }, []), q = _(() => {
45
45
  L(!1), U(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), F = _((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: i, isLoading: H, isError: S, error: b } = ne({
48
+ }, []), { data: i, isLoading: z, isError: S, error: b } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
51
  E,
@@ -90,7 +90,7 @@ const Te = [
90
90
  e.signal.aborted || A(a);
91
91
  })(), () => e.abort();
92
92
  }, [d, s]);
93
- const q = _(
93
+ const H = _(
94
94
  (e, t) => {
95
95
  t !== u ? ($(t), C(1), O(void 0)) : C(e);
96
96
  },
@@ -145,7 +145,7 @@ const Te = [
145
145
  headers: j,
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
147
  rows: Q,
148
- loading: H,
148
+ loading: z,
149
149
  errorStateMessage: S ? b?.message : null,
150
150
  sortable: K,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
@@ -155,7 +155,7 @@ const Te = [
155
155
  pageSize: u,
156
156
  totalItems: k,
157
157
  page: N,
158
- onPageChange: q
158
+ onPageChange: H
159
159
  }
160
160
  ) }),
161
161
  d && s && /* @__PURE__ */ r(
@@ -164,7 +164,7 @@ const Te = [
164
164
  id: "modalIdForActionAreaLayout",
165
165
  portalId: "main-display-area",
166
166
  open: d,
167
- onRequestClose: z,
167
+ onRequestClose: q,
168
168
  modalHeading: s.documentIdentifier,
169
169
  passiveModal: !0,
170
170
  size: "lg",
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as j, Fragment as ge } from "react/jsx-runtime";
2
- import { u as pe, d as Ne, e as Oe, y as Ee, g as Te, p as Fe, h as Ie, J as ve, D as Ae, f as _e, i as De, j as Re, Y as G, Q as Me, C as K, B as Q, V as Le, b as z, r as Be, k as Se, c as Ce, O as Ue, l as we } from "./index-B4RtTGnL.js";
2
+ import { u as pe, c as Ne, d as Oe, y as Ee, g as Te, h as Fe, p as Ie, J as Ae, D as _e, e as ve, f as De, i as Re, Y as G, Q as Me, C as K, B as Q, V as Le, b as z, r as Be, j as Se, F as Ce, O as Ue, k as we } from "./index-DIGdc3zN.js";
3
3
  import { useQueryClient as ke, useQuery as N } from "@tanstack/react-query";
4
4
  import { useState as Y, useMemo as i, useCallback as d } from "react";
5
5
  import { useTranslation as He } from "react-i18next";
@@ -14,10 +14,10 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
14
14
  disableActions: W = !1,
15
15
  activeEncounterUuid: y = null
16
16
  }) => {
17
- const { t: s } = He(), c = pe(), [h, R] = Y(!1), [o, M] = Y(null), {
17
+ const { t: s } = He(), c = pe(), [b, R] = Y(!1), [o, M] = Y(null), {
18
18
  numberOfVisits: X,
19
19
  hideThumbnail: Z = !1,
20
- forms: b
20
+ forms: h
21
21
  } = J ?? {}, ee = Ne(
22
22
  we.EDIT_OBSERVATIONS
23
23
  ), { userPrivileges: g } = Oe(), E = ee && !W && !!y, L = Ee(
@@ -37,10 +37,10 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
37
37
  let e = B;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (r) => m.includes(r.encounterUuid)
40
- )), Array.isArray(b) && b.length > 0 && (e = e.filter(
41
- (r) => b.some((t) => t.toLowerCase() === r.formName.toLowerCase())
40
+ )), Array.isArray(h) && h.length > 0 && (e = e.filter(
41
+ (r) => h.some((t) => t.toLowerCase() === r.formName.toLowerCase())
42
42
  )), e;
43
- }, [B, m, b]), { data: p = [] } = N({
43
+ }, [B, m, h]), { data: p = [] } = N({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => Fe()
46
46
  }), w = d(
@@ -71,32 +71,32 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
71
71
  } = N({
72
72
  queryKey: ["formMetadata", T],
73
73
  queryFn: () => Ie(T),
74
- enabled: !!T && h
74
+ enabled: !!T && b
75
75
  }), {
76
76
  data: I,
77
77
  isLoading: ne,
78
78
  isError: ie,
79
- error: v
79
+ error: A
80
80
  } = N({
81
81
  queryKey: ["formsEncounterFHIR", o?.encounterUuid],
82
- queryFn: () => ve(o.encounterUuid),
83
- enabled: !!o?.encounterUuid && h
82
+ queryFn: () => Ae(o.encounterUuid),
83
+ enabled: !!o?.encounterUuid && b
84
84
  });
85
- Ae(
85
+ _e(
86
86
  (e) => {
87
87
  e.patientUUID === c && (ae(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
88
88
  },
89
89
  [c]
90
90
  );
91
- const de = i(() => !I?.entry || !o?.formName ? [] : I.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => _e(r) ? De(r)?.toLowerCase() === o.formName.toLowerCase() : !0), [I, o?.formName]), { controlOrder: le, sectionMap: me, conceptDatatypeMap: ce } = i(
91
+ const de = i(() => !I?.entry || !o?.formName ? [] : I.entry.filter((r) => r.resource?.resourceType === "Observation").map((r) => r.resource).filter((r) => ve(r) ? De(r)?.toLowerCase() === o.formName.toLowerCase() : !0), [I, o?.formName]), { controlOrder: le, sectionMap: me, conceptDatatypeMap: ce } = i(
92
92
  () => Re(H?.schema),
93
93
  [H]
94
94
  ), ue = i(() => {
95
95
  if (F)
96
96
  return G(F).message;
97
- if (v)
98
- return G(v).message;
99
- }, [F, v]), f = i(
97
+ if (A)
98
+ return G(A).message;
99
+ }, [F, A]), f = i(
100
100
  () => [
101
101
  { key: "recordedOn", header: s("RECORDED_ON") },
102
102
  { key: "recordedBy", header: s("RECORDED_BY") }
@@ -108,7 +108,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
108
108
  ), fe = d(
109
109
  (e) => E && e.some((t) => u(t)) ? V : f,
110
110
  [E, u, V, f]
111
- ), ye = f, he = i(
111
+ ), ye = f, be = i(
112
112
  () => [
113
113
  { key: "recordedOn", sortable: !0 },
114
114
  { key: "recordedBy", sortable: !0 }
@@ -119,12 +119,12 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
119
119
  (t, a) => {
120
120
  const l = a.formName;
121
121
  t[l] ??= [];
122
- const _ = a.providers.map((be) => be.providerName).filter(Boolean).join(", ");
122
+ const v = a.providers.map((he) => he.providerName).filter(Boolean).join(", ");
123
123
  return t[l].push({
124
124
  id: a.encounterUuid,
125
125
  formName: a.formName,
126
126
  recordedOn: Me(a.encounterDateTime, s, !0).formattedResult,
127
- recordedBy: _ ?? "--",
127
+ recordedBy: v ?? "--",
128
128
  encounterDateTime: a.encounterDateTime,
129
129
  encounterUuid: a.encounterUuid
130
130
  }), t;
@@ -135,7 +135,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
135
135
  ([t, a]) => ({
136
136
  formName: t,
137
137
  records: a.sort(
138
- (l, _) => _.encounterDateTime - l.encounterDateTime
138
+ (l, v) => v.encounterDateTime - l.encounterDateTime
139
139
  )
140
140
  })
141
141
  ).sort((t, a) => t.formName.localeCompare(a.formName));
@@ -143,7 +143,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
143
143
  M(e), R(!0);
144
144
  }, []), x = d(() => {
145
145
  R(!1), M(null);
146
- }, []), A = d((e) => {
146
+ }, []), _ = d((e) => {
147
147
  globalThis.dispatchEvent(
148
148
  new CustomEvent(xe, {
149
149
  detail: {
@@ -170,7 +170,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
170
170
  kind: "ghost",
171
171
  size: "sm",
172
172
  testId: `edit-form-${e.encounterUuid}`,
173
- onClick: () => A(e),
173
+ onClick: () => _(e),
174
174
  children: /* @__PURE__ */ n(Q, {})
175
175
  }
176
176
  ) : null;
@@ -178,7 +178,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
178
178
  return null;
179
179
  }
180
180
  },
181
- [P, A, u, s]
181
+ [P, _, u, s]
182
182
  );
183
183
  return /* @__PURE__ */ j(ge, { children: [
184
184
  /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: S || C || q.length === 0 || L ? /* @__PURE__ */ n(
@@ -211,7 +211,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
211
211
  rows: a,
212
212
  loading: !1,
213
213
  errorStateMessage: "",
214
- sortable: he,
214
+ sortable: be,
215
215
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
216
216
  renderCell: $,
217
217
  className: O.formsTableBody,
@@ -222,12 +222,12 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
222
222
  t
223
223
  );
224
224
  }) }) }),
225
- h && o && /* @__PURE__ */ n(
225
+ b && o && /* @__PURE__ */ n(
226
226
  Ce,
227
227
  {
228
228
  id: "modalIdForActionAreaLayout",
229
229
  portalId: "main-display-area",
230
- open: h,
230
+ open: b,
231
231
  onRequestClose: x,
232
232
  modalHeading: /* @__PURE__ */ j("div", { className: O.modalHeading, children: [
233
233
  /* @__PURE__ */ n("span", { children: o.formName }),
@@ -239,7 +239,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
239
239
  size: "sm",
240
240
  testId: `edit-form-modal-${o.encounterUuid}`,
241
241
  onClick: () => {
242
- x(), A(o);
242
+ x(), _(o);
243
243
  },
244
244
  children: /* @__PURE__ */ n(Q, {})
245
245
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
- import { m as k, n as F, t as z, G as H, Q as P, o as j, T as x, R as J, S as Y, u as W, a as X, A as Z, y as ee, K as se, q as te, D as re, s as ae, v as oe, w as ne, x as ie, z as ce, b as le } from "./index-B4RtTGnL.js";
2
+ import { l as q, m as F, t as z, G as H, Q as P, n as j, T as x, R as J, S as Y, u as W, a as X, A as Z, y as ee, K as se, o as te, D as re, s as ae, v as oe, w as ne, x as ie, z as ce, b as le } from "./index-DIGdc3zN.js";
3
3
  import { useQueries as de, useQuery as ue } from "@tanstack/react-query";
4
4
  import { useRef as pe, useEffect as C, useMemo as I } from "react";
5
5
  import { useTranslation as w } from "react-i18next";
@@ -72,7 +72,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
72
72
  hideThumbnail: n
73
73
  }) => {
74
74
  const { t: c } = w(), u = (r, a, e) => {
75
- const p = k(r.encounterDetails, c);
75
+ const p = q(r.encounterDetails, c);
76
76
  return /* @__PURE__ */ S(
77
77
  F,
78
78
  {
@@ -198,7 +198,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
198
198
  { key: "name", header: "name" },
199
199
  { key: "value", header: "value" },
200
200
  { key: "form", header: "form" }
201
- ], L = V || !f, B = N && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, G = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, M = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = A.length > 0 && !L && !B, g = c.titleTranslationKey, h = g ? d(g) : "";
201
+ ], L = V || !f, B = N && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, G = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, M = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, k = A.length > 0 && !L && !B, g = c.titleTranslationKey, h = g ? d(g) : "";
202
202
  return /* @__PURE__ */ S(
203
203
  "div",
204
204
  {
@@ -217,7 +217,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
217
217
  children: /* @__PURE__ */ i("p", { children: h })
218
218
  }
219
219
  ),
220
- q ? /* @__PURE__ */ i(
220
+ k ? /* @__PURE__ */ i(
221
221
  Oe,
222
222
  {
223
223
  groupedData: A,