@bahmni/widgets 0.0.1-dev.350 → 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, g as J, B as Z, P as x, q as ee, F as te } from "./index-C1f36q-O.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";
@@ -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(), D = R(s);
79
- for (let m = 0; m < D.length; m++) {
80
- const b = F(D[m].url);
78
+ const a = /* @__PURE__ */ new Set(), g = R(s);
79
+ for (let m = 0; m < g.length; m++) {
80
+ const b = F(g[m].url);
81
81
  try {
82
82
  (await fetch(b, {
83
83
  method: "HEAD",
@@ -95,15 +95,15 @@ const Te = [
95
95
  t !== u ? ($(t), C(1), O(void 0)) : C(e);
96
96
  },
97
97
  [u]
98
- ), g = p(
98
+ ), D = p(
99
99
  () => n?.fields ?? Te,
100
100
  [n?.fields]
101
- ), j = p(() => [...i?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [i]), K = p(() => he(g, o), [g, o]), G = p(
102
- () => g.map((e) => ({
101
+ ), j = p(() => [...i?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [i]), K = p(() => he(D, o), [D, o]), G = p(
102
+ () => D.map((e) => ({
103
103
  key: e,
104
104
  sortable: e !== "attachments"
105
105
  })),
106
- [g]
106
+ [D]
107
107
  ), h = p(
108
108
  () => s ? R(s) : [],
109
109
  [s]
@@ -170,7 +170,7 @@ const Te = [
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 = F(e.url), D = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
173
+ const a = F(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
  {
@@ -208,7 +208,7 @@ const Te = [
208
208
  ) : /* @__PURE__ */ r(
209
209
  "iframe",
210
210
  {
211
- src: D ? `${a}#toolbar=0` : a,
211
+ src: g ? `${a}#toolbar=0` : a,
212
212
  className: c.documentIframe,
213
213
  title: s.documentIdentifier,
214
214
  onError: () => B(t)
@@ -1,5 +1,5 @@
1
- import { jsx as i, jsxs as K, Fragment as ye } from "react/jsx-runtime";
2
- import { u as be, b as pe, c as Oe, D as Ne, K as Te, z as Ee, Y as Fe, v as Ie, d as ve, e as _e, f as Ae, h as x, P as Re, l as j, $ as G, B as De, q as Q, T as Me, R as Be, F as Ce, O as Le, C as Se } from "./index-C1f36q-O.js";
1
+ import { jsx as i, jsxs as x, Fragment as be } from "react/jsx-runtime";
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
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
5
  import { useTranslation as we } from "react-i18next";
@@ -12,15 +12,15 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
12
12
  encounterUuids: m,
13
13
  config: W,
14
14
  disableActions: J = !1,
15
- activeEncounterUuid: y = null
15
+ activeEncounterUuid: b = null
16
16
  }) => {
17
- const { t: n } = we(), u = be(), [b, M] = Y(!1), [a, B] = 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
20
  forms: p
21
21
  } = W ?? {}, ee = pe(
22
22
  Se.EDIT_OBSERVATIONS
23
- ), { userPrivileges: O } = Oe(), F = ee && !J && !!y, C = Ne(
23
+ ), { userPrivileges: O } = Oe(), F = ee && !J && !!b, C = Ne(
24
24
  D,
25
25
  m
26
26
  ), re = Ue(), {
@@ -55,8 +55,8 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
55
55
  },
56
56
  [N, O]
57
57
  ), f = l(
58
- (e) => !y || e.encounterUuid !== y ? !1 : H(e.formName),
59
- [y, H]
58
+ (e) => !b || e.encounterUuid !== b ? !1 : H(e.formName),
59
+ [b, H]
60
60
  ), k = l(
61
61
  (e) => N.find((o) => o.name === e)?.uuid,
62
62
  [N]
@@ -71,7 +71,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
71
71
  } = T({
72
72
  queryKey: ["formMetadata", I],
73
73
  queryFn: () => Fe(I),
74
- enabled: !!I && b
74
+ enabled: !!I && y
75
75
  }), {
76
76
  data: _,
77
77
  isLoading: ne,
@@ -80,7 +80,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
80
80
  } = T({
81
81
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
82
82
  queryFn: () => Ie(a.encounterUuid),
83
- enabled: !!a?.encounterUuid && b
83
+ enabled: !!a?.encounterUuid && y
84
84
  });
85
85
  ve(
86
86
  (e) => {
@@ -104,8 +104,8 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
104
104
  const e = {}, r = (o, t) => {
105
105
  for (const s of o)
106
106
  if (s.type === "section") {
107
- const g = s.label?.value ?? "Section";
108
- r(s.controls ?? [], g);
107
+ const h = s.label?.value ?? "Section";
108
+ r(s.controls ?? [], h);
109
109
  } else
110
110
  s.id != null && t && (e[String(s.id)] = t), s.controls && r(s.controls, t);
111
111
  };
@@ -115,22 +115,22 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
115
115
  ), Object.keys(e).length > 0 ? e : void 0;
116
116
  }, [c]), me = d(() => {
117
117
  if (v)
118
- return x(v).message;
118
+ return z(v).message;
119
119
  if (A)
120
- return x(A).message;
121
- }, [v, A]), h = d(
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") }
125
125
  ],
126
126
  [n]
127
127
  ), q = d(
128
- () => [...h, { key: "actions", header: n("ACTIONS") }],
129
- [h, n]
128
+ () => [...g, { key: "actions", header: n("ACTIONS") }],
129
+ [g, n]
130
130
  ), ue = l(
131
- (e) => F && e.some((o) => f(o)) ? q : h,
132
- [F, f, q, h]
133
- ), fe = h, he = d(
131
+ (e) => F && e.some((o) => f(o)) ? q : g,
132
+ [F, f, q, g]
133
+ ), fe = g, ge = d(
134
134
  () => [
135
135
  { key: "recordedOn", sortable: !0 },
136
136
  { key: "recordedBy", sortable: !0 }
@@ -141,12 +141,12 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
141
141
  (o, t) => {
142
142
  const s = t.formName;
143
143
  o[s] ??= [];
144
- const g = t.providers.map((ge) => ge.providerName).filter(Boolean).join(", ");
144
+ const h = t.providers.map((he) => he.providerName).filter(Boolean).join(", ");
145
145
  return o[s].push({
146
146
  id: t.encounterUuid,
147
147
  formName: t.formName,
148
148
  recordedOn: Re(t.encounterDateTime, n, !0).formattedResult,
149
- recordedBy: g ?? "--",
149
+ recordedBy: h ?? "--",
150
150
  encounterDateTime: t.encounterDateTime,
151
151
  encounterUuid: t.encounterUuid
152
152
  }), o;
@@ -157,13 +157,13 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
157
157
  ([o, t]) => ({
158
158
  formName: o,
159
159
  records: t.sort(
160
- (s, g) => g.encounterDateTime - s.encounterDateTime
160
+ (s, h) => h.encounterDateTime - s.encounterDateTime
161
161
  )
162
162
  })
163
163
  ).sort((o, t) => o.formName.localeCompare(t.formName));
164
164
  }, [w, n]), V = l((e) => {
165
165
  B(e), M(!0);
166
- }, []), z = l(() => {
166
+ }, []), $ = l(() => {
167
167
  M(!1), B(null);
168
168
  }, []), R = l((e) => {
169
169
  globalThis.dispatchEvent(
@@ -177,7 +177,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
177
177
  }
178
178
  })
179
179
  );
180
- }, []), $ = l(
180
+ }, []), G = l(
181
181
  (e, r) => {
182
182
  switch (r) {
183
183
  case "recordedOn":
@@ -193,7 +193,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
193
193
  size: "sm",
194
194
  testId: `edit-form-${e.encounterUuid}`,
195
195
  onClick: () => R(e),
196
- children: /* @__PURE__ */ i(G, {})
196
+ children: /* @__PURE__ */ i(K, {})
197
197
  }
198
198
  ) : null;
199
199
  default:
@@ -202,7 +202,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
202
202
  },
203
203
  [V, R, f, n]
204
204
  );
205
- return /* @__PURE__ */ K(ye, { children: [
205
+ return /* @__PURE__ */ x(be, { children: [
206
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
  {
@@ -212,7 +212,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
212
212
  loading: S,
213
213
  errorStateMessage: U ? te?.message : void 0,
214
214
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
215
- renderCell: $,
215
+ renderCell: G,
216
216
  className: E.formsTableBody,
217
217
  dataTestId: "forms-table"
218
218
  }
@@ -233,9 +233,9 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
233
233
  rows: t,
234
234
  loading: !1,
235
235
  errorStateMessage: "",
236
- sortable: he,
236
+ sortable: ge,
237
237
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
238
- renderCell: $,
238
+ renderCell: G,
239
239
  className: E.formsTableBody,
240
240
  dataTestId: `forms-table-${o}`
241
241
  }
@@ -244,14 +244,14 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
244
244
  o
245
245
  );
246
246
  }) }) }),
247
- b && a && /* @__PURE__ */ i(
247
+ y && a && /* @__PURE__ */ i(
248
248
  Ce,
249
249
  {
250
250
  id: "modalIdForActionAreaLayout",
251
251
  portalId: "main-display-area",
252
- open: b,
253
- onRequestClose: z,
254
- modalHeading: /* @__PURE__ */ K("div", { className: E.modalHeading, children: [
252
+ open: y,
253
+ onRequestClose: $,
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
257
  j,
@@ -261,9 +261,9 @@ const He = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
261
261
  size: "sm",
262
262
  testId: `edit-form-modal-${a.encounterUuid}`,
263
263
  onClick: () => {
264
- z(), R(a);
264
+ $(), R(a);
265
265
  },
266
- children: /* @__PURE__ */ i(G, {})
266
+ children: /* @__PURE__ */ i(K, {})
267
267
  }
268
268
  )
269
269
  ] }),
@@ -1,9 +1,9 @@
1
1
  import { jsx as d, jsxs as N } from "react/jsx-runtime";
2
- import { i as K, Q as D, t as V, j as q, W as w, k, n as H, m as G, u as P, a as j, o as z, p as W, d as J, r as Y, s as X, w as Z, x, q as ee } from "./index-C1f36q-O.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) => {
6
+ const A = (t, i, c, l, u, r) => {
7
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(
@@ -21,7 +21,7 @@ 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}`;
@@ -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 = K(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"}