@bahmni/widgets 0.0.1-dev.247 → 0.0.1-dev.256

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, E as J, f as Z, q as x, m as ee, y as te } from "./index-B9vjxIp3.js";
2
+ import { u as W, a as X, S as J, f as Z, B as x, m as ee, y as te } from "./index-Dis2HQ87.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";
@@ -45,7 +45,7 @@ const _e = [
45
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: y, error: S } = ne({
48
+ }, []), { data: u, isLoading: z, isError: S, error: y } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
51
  T,
@@ -66,12 +66,12 @@ const _e = [
66
66
  }, [u]), N(() => {
67
67
  O(1), C(void 0);
68
68
  }, [T]), N(() => {
69
- y && w({
69
+ S && w({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
- message: S?.message ?? "",
71
+ message: y?.message ?? "",
72
72
  type: "error"
73
73
  });
74
- }, [y, S, w, o]), N(() => {
74
+ }, [S, y, w, o]), N(() => {
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
77
  if (!d || !r) return;
@@ -90,7 +90,7 @@ const _e = [
90
90
  e.signal.aborted || A(a);
91
91
  })(), () => e.abort();
92
92
  }, [d, r]);
93
- const q = f(
93
+ const H = f(
94
94
  (e, t) => {
95
95
  t !== m ? ($(t), O(1), C(void 0)) : O(e);
96
96
  },
@@ -98,7 +98,7 @@ const _e = [
98
98
  ), g = p(
99
99
  () => n?.fields ?? _e,
100
100
  [n?.fields]
101
- ), H = p(() => [...u?.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), [u]), G = p(() => he(g, o), [g, o]), Y = p(
101
+ ), q = p(() => [...u?.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), [u]), G = p(() => he(g, o), [g, o]), Y = p(
102
102
  () => g.map((e) => ({
103
103
  key: e,
104
104
  sortable: e !== "action"
@@ -144,9 +144,9 @@ const _e = [
144
144
  {
145
145
  headers: G,
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
- rows: H,
147
+ rows: q,
148
148
  loading: z,
149
- errorStateMessage: y ? S?.message : null,
149
+ errorStateMessage: S ? y?.message : null,
150
150
  sortable: Y,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
152
152
  renderCell: K,
@@ -155,7 +155,7 @@ const _e = [
155
155
  pageSize: m,
156
156
  totalItems: k,
157
157
  page: D,
158
- onPageChange: q
158
+ onPageChange: H
159
159
  }
160
160
  ) }),
161
161
  d && r && /* @__PURE__ */ s(
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as X, Fragment as Z } from "react/jsx-runtime";
2
- import { b as ee, u as re, H as te, r as oe, e as ae, t as se, B as ne, g as de, O as C, q as ie, f as me, m as U, c as ce, d as le, y as ue, h as fe } from "./index-B9vjxIp3.js";
2
+ import { d as ee, u as re, W as te, i as oe, o as ae, b as se, K as ne, v as de, O as C, B as ie, f as me, m as U, e as ce, t as le, y as ue, c as fe } from "./index-Dis2HQ87.js";
3
3
  import { useQueryClient as ye, useQuery as f } from "@tanstack/react-query";
4
4
  import { useState as x, useMemo as d, useCallback as y } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
@@ -8,24 +8,24 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
8
8
  customAccordianItem: ge
9
9
  }, he = (m) => m ? m.extension?.find(
10
10
  (p) => p.url === ee
11
- )?.valueString : void 0, De = ({
11
+ )?.valueString : void 0, Be = ({
12
12
  episodeOfCareUuids: m,
13
13
  encounterUuids: i,
14
14
  config: p
15
15
  }) => {
16
- const { t: s } = pe(), c = re(), [l, B] = x(!1), [t, D] = x(null), { numberOfVisits: k, hideThumbnail: H = !1 } = p ?? {}, I = te(
16
+ const { t: s } = pe(), c = re(), [l, v] = x(!1), [t, B] = x(null), { numberOfVisits: k, hideThumbnail: K = !1 } = p ?? {}, D = te(
17
17
  m,
18
18
  i
19
19
  ), P = ye(), {
20
20
  data: b = [],
21
- isLoading: M,
22
- isError: v,
23
- error: K,
21
+ isLoading: I,
22
+ isError: M,
23
+ error: H,
24
24
  refetch: j
25
25
  } = f({
26
26
  queryKey: ["forms", c, m],
27
27
  queryFn: () => oe(c, void 0, k),
28
- enabled: !!c && !I
28
+ enabled: !!c && !D
29
29
  }), A = d(() => !i || i.length === 0 ? b : b.filter(
30
30
  (e) => i.includes(e.encounterUuid)
31
31
  ), [b, i]), { data: _ = [] } = f({
@@ -75,7 +75,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
75
75
  { key: "recordedBy", header: s("RECORDED_BY") }
76
76
  ],
77
77
  [s]
78
- ), Y = d(
78
+ ), W = d(
79
79
  () => [
80
80
  { key: "recordedOn", sortable: !0 },
81
81
  { key: "recordedBy", sortable: !0 }
@@ -86,7 +86,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
86
86
  (r, o) => {
87
87
  const u = o.formName;
88
88
  r[u] ??= [];
89
- const F = o.providers.map((W) => W.providerName).filter(Boolean).join(", ");
89
+ const F = o.providers.map((J) => J.providerName).filter(Boolean).join(", ");
90
90
  return r[u].push({
91
91
  id: o.encounterUuid,
92
92
  formName: o.formName,
@@ -106,34 +106,34 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
106
106
  )
107
107
  })
108
108
  ).sort((r, o) => r.formName.localeCompare(o.formName));
109
- }, [A, s]), q = y((e) => {
110
- D(e), B(!0);
111
- }, []), J = y(() => {
112
- B(!1), D(null);
113
- }, []), S = y(
109
+ }, [A, s]), S = y((e) => {
110
+ B(e), v(!0);
111
+ }, []), Y = y(() => {
112
+ v(!1), B(null);
113
+ }, []), q = y(
114
114
  (e, a) => {
115
115
  switch (a) {
116
116
  case "recordedOn":
117
- return /* @__PURE__ */ n(me, { onClick: () => q(e), children: e.recordedOn });
117
+ return /* @__PURE__ */ n(me, { onClick: () => S(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
- [q]
124
+ [S]
125
125
  );
126
126
  return /* @__PURE__ */ X(Z, { children: [
127
- /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: M || v || L.length === 0 || I ? /* @__PURE__ */ n(
127
+ /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: I || M || L.length === 0 || D ? /* @__PURE__ */ n(
128
128
  U,
129
129
  {
130
130
  headers: T,
131
131
  ariaLabel: s("FORMS_HEADING"),
132
132
  rows: [],
133
- loading: M,
134
- errorStateMessage: v ? K?.message : void 0,
133
+ loading: I,
134
+ errorStateMessage: M ? H?.message : void 0,
135
135
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
136
- renderCell: S,
136
+ renderCell: q,
137
137
  className: N.formsTableBody,
138
138
  dataTestId: "forms-table"
139
139
  }
@@ -154,9 +154,9 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
154
154
  rows: o,
155
155
  loading: !1,
156
156
  errorStateMessage: "",
157
- sortable: Y,
157
+ sortable: W,
158
158
  emptyStateMessage: s("FORMS_UNAVAILABLE"),
159
- renderCell: S,
159
+ renderCell: q,
160
160
  className: N.formsTableBody,
161
161
  dataTestId: `forms-table-${r}`
162
162
  }
@@ -171,7 +171,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
171
171
  id: "modalIdForActionAreaLayout",
172
172
  portalId: "main-display-area",
173
173
  open: l,
174
- onRequestClose: J,
174
+ onRequestClose: Y,
175
175
  modalHeading: t.formName,
176
176
  modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
177
177
  passiveModal: !0,
@@ -186,7 +186,7 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
186
186
  errorMessage: G,
187
187
  emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
188
188
  testIdPrefix: t.formName,
189
- hideThumbnail: H
189
+ hideThumbnail: K
190
190
  }
191
191
  )
192
192
  }
@@ -194,5 +194,5 @@ const be = "_formsTableBody_81hra_1", ge = "_customAccordianItem_81hra_6", N = {
194
194
  ] });
195
195
  };
196
196
  export {
197
- De as default
197
+ Be as default
198
198
  };
@@ -1,10 +1,10 @@
1
1
  import { jsx as l, jsxs as S } from "react/jsx-runtime";
2
- import { i as V, C as D, j as q, z as K, k as Q, x as w, l as z, n as G, u as P, a as j, J as H, F as J, g as Y, o as x, p as W, s as X, $ as Z, m as ee } from "./index-B9vjxIp3.js";
2
+ import { g as M, C as D, h as V, Y as K, j as Q, x as w, k as z, z as G, u as P, a as j, l as H, n as Y, v as x, p as J, q as W, s as X, $ as Z, m as ee } from "./index-Dis2HQ87.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
- import { useRef as oe, useEffect as C, useMemo as h } from "react";
4
+ import { useRef as oe, useEffect as C, useMemo as g } from "react";
5
5
  import { useTranslation as U } from "react-i18next";
6
- const F = (t, i, c, d, u, r) => {
7
- const s = q(t, i, u), o = s.value, a = K(o);
6
+ const B = (t, i, c, d, u, r) => {
7
+ const s = V(t, i, u), o = s.value, a = K(o);
8
8
  let n = o;
9
9
  a === "Image" && (n = /* @__PURE__ */ l(
10
10
  w,
@@ -24,16 +24,16 @@ const F = (t, i, c, d, u, r) => {
24
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
- }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
27
+ }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", E = d ? `${d}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
28
28
  return /* @__PURE__ */ l(
29
29
  Q,
30
30
  {
31
31
  header: s.header,
32
32
  value: n,
33
33
  info: b,
34
- id: y,
35
- testId: y,
36
- ariaLabel: y
34
+ id: E,
35
+ testId: E,
36
+ ariaLabel: E
37
37
  },
38
38
  `obs-${t.id}`
39
39
  );
@@ -44,7 +44,7 @@ const F = (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) => F(
47
+ (o, a) => B(
48
48
  o,
49
49
  a,
50
50
  u,
@@ -61,7 +61,7 @@ const F = (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 = V(r.encounterDetails, d);
64
+ const a = M(r.encounterDetails, d);
65
65
  return /* @__PURE__ */ S(
66
66
  D,
67
67
  {
@@ -70,7 +70,7 @@ const F = (t, i, c, d, 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,
@@ -133,17 +133,17 @@ const F = (t, i, c, d, u, r) => {
133
133
  } else e.isError || r.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = h(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
136
+ const b = g(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = g(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
137
  data: m,
138
- isLoading: y,
138
+ isLoading: E,
139
139
  isError: O,
140
140
  refetch: T
141
141
  } = se({
142
142
  queryKey: de(s, p),
143
- queryFn: () => J(s, p),
143
+ queryFn: () => Y(s, p),
144
144
  enabled: !!s && p.length > 0 && f
145
145
  });
146
- Y(
146
+ x(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
149
  (R) => p.includes(R)
@@ -157,20 +157,20 @@ const F = (t, i, c, d, u, r) => {
157
157
  type: "error"
158
158
  });
159
159
  }, [O]);
160
- const $ = h(() => {
160
+ const $ = g(() => {
161
161
  if (!m) return [];
162
- const e = x(m), v = W(e);
162
+ const e = J(m), v = W(e);
163
163
  return X(v);
164
- }, [m]), B = [
164
+ }, [m]), A = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], _ = y || !f, I = O && f, A = (!m || m.entry?.length === 0 || p.length === 0) && f, L = I ? a("ERROR_FETCHING_OBSERVATIONS") : null, k = A ? a("NO_OBSERVATIONS_FOUND") : void 0, M = $.length > 0 && !_ && !I, g = i.titleTranslationKey, E = g ? a(g) : "";
168
+ ], _ = E || !f, I = O && 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, y = h ? a(h) : "";
169
169
  return /* @__PURE__ */ S(
170
170
  "div",
171
171
  {
172
172
  id: "observations",
173
- "data-testid": g ? `observations-${E}` : "observations",
173
+ "data-testid": h ? `observations-${y}` : "observations",
174
174
  "aria-label": "observations-aria-label",
175
175
  className: N.observations,
176
176
  children: [
@@ -178,23 +178,23 @@ const F = (t, i, c, d, u, r) => {
178
178
  Z,
179
179
  {
180
180
  id: "observations-title",
181
- testId: g ? `observations-title-${E}` : "observations-title",
182
- title: E,
181
+ testId: h ? `observations-title-${y}` : "observations-title",
182
+ title: y,
183
183
  className: N.title,
184
- children: /* @__PURE__ */ l("p", { children: E })
184
+ children: /* @__PURE__ */ l("p", { children: y })
185
185
  }
186
186
  ),
187
- M ? /* @__PURE__ */ l(
187
+ q ? /* @__PURE__ */ l(
188
188
  ae,
189
189
  {
190
190
  groupedData: $,
191
- title: E,
191
+ title: y,
192
192
  hideThumbnail: u
193
193
  }
194
194
  ) : /* @__PURE__ */ l(
195
195
  ee,
196
196
  {
197
- headers: B,
197
+ headers: A,
198
198
  rows: [],
199
199
  ariaLabel: a("OBSERVATIONS"),
200
200
  loading: _,
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/conditions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAmB,MAAM,UAAU,CAAC;AAgC/D;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,EAAE,GACtB,kBAAkB,EAAE,CAyBtB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/conditions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAmB,MAAM,UAAU,CAAC;AAkC/D;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,SAAS,EAAE,GACtB,kBAAkB,EAAE,CA6BtB"}