@bahmni/clinical-app 0.0.1-dev.278 → 0.0.1-dev.281

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,7 +1,7 @@
1
- import { jsx as r, jsxs as T, Fragment as x } from "react/jsx-runtime";
2
- import { u as G, a as W, h as Y, p as J, b as X, m as Z, c as ee, n as te } from "./index-_ys4AfcI.js";
1
+ import { jsx as r, jsxs as _, Fragment as x } from "react/jsx-runtime";
2
+ import { u as G, a as W, h as Y, K as J, w as X, m as Z, c as ee, n as te } from "./index-BsJk02uJ.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as _, useEffect as O, useMemo as h } from "react";
4
+ import { useState as l, useCallback as p, useEffect as O, useMemo as h } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", ce = "DocumentsTable-module_attachmentError__RI4U2", me = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -27,24 +27,24 @@ function ie(a, E) {
27
27
  header: E(ue[s])
28
28
  }));
29
29
  }
30
- const pe = [
30
+ const Te = [
31
31
  "documentIdentifier",
32
32
  "documentType",
33
33
  "uploadedOn",
34
34
  "uploadedBy",
35
35
  "action"
36
- ], Te = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ie = ({ config: a, encounterUuids: E }) => {
37
- const [s, w] = l(!1), [o, U] = l(
36
+ ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ie = ({ config: a, encounterUuids: E }) => {
37
+ const [s, S] = l(!1), [o, U] = l(
38
38
  null
39
39
  ), [$, D] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
- U(e), w(!0);
43
- }, []), q = _(() => {
44
- w(!1), U(null), D(/* @__PURE__ */ new Set());
45
- }, []), v = _((e) => {
41
+ ), g = G(), { t: n } = W(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = p((e) => {
42
+ U(e), S(!0);
43
+ }, []), H = p(() => {
44
+ S(!1), U(null), D(/* @__PURE__ */ new Set());
45
+ }, []), v = p((e) => {
46
46
  D((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: H, isError: b, error: y } = ae({
47
+ }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
50
  g,
@@ -76,9 +76,9 @@ const pe = [
76
76
  if (!s || !o) return;
77
77
  const t = /* @__PURE__ */ new Set(), c = B(o);
78
78
  for (let m = 0; m < c.length; m++) {
79
- const S = R(c[m].url);
79
+ const w = R(c[m].url);
80
80
  try {
81
- (await fetch(S, {
81
+ (await fetch(w, {
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(m);
@@ -89,24 +89,24 @@ const pe = [
89
89
  e.signal.aborted || D(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const j = _(
92
+ const K = p(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
97
  ), I = h(
98
- () => a?.fields ?? pe,
98
+ () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), P = h(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), z = h(() => ie(I, n), [I, n]), K = h(
100
+ ), j = h(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = h(() => ie(I, n), [I, n]), z = h(
101
101
  () => I.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "action"
104
104
  })),
105
105
  [I]
106
- ), p = h(
106
+ ), T = h(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), Q = _(
109
+ ), Q = p(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,16 +137,16 @@ const pe = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ T(x, { children: [
140
+ return /* @__PURE__ */ _(x, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: z,
144
+ headers: P,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: P,
147
- loading: H,
146
+ rows: j,
147
+ loading: q,
148
148
  errorStateMessage: b ? y?.message : null,
149
- sortable: K,
149
+ sortable: z,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
151
  renderCell: Q,
152
152
  className: d.documentsTableBody,
@@ -154,7 +154,7 @@ const pe = [
154
154
  pageSize: u,
155
155
  totalItems: F,
156
156
  page: f,
157
- onPageChange: j
157
+ onPageChange: K
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -163,40 +163,40 @@ const pe = [
163
163
  id: "modalIdForActionAreaLayout",
164
164
  portalId: "main-display-area",
165
165
  open: s,
166
- onRequestClose: q,
166
+ onRequestClose: H,
167
167
  modalHeading: o.documentIdentifier,
168
168
  passiveModal: !0,
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
- children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: p.map((e, t) => {
172
- const c = R(e.url), m = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || Te.test(e.url ?? ""), N = $.has(t);
173
- return c === "#" || N ? /* @__PURE__ */ T(
171
+ children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: T.map((e, t) => {
172
+ const c = R(e.url), m = e.contentType?.toLowerCase().includes("pdf"), w = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), N = $.has(t);
173
+ return c === "#" || N ? /* @__PURE__ */ _(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
177
177
  "data-testid": `attachment-error-${t}`,
178
178
  children: [
179
- p.length > 1 && /* @__PURE__ */ T("p", { className: d.attachmentCounter, children: [
179
+ T.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
180
180
  t + 1,
181
181
  "/",
182
- p.length
182
+ T.length
183
183
  ] }),
184
184
  /* @__PURE__ */ r("p", { children: n("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
185
185
  ]
186
186
  },
187
187
  `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ T(
188
+ ) : /* @__PURE__ */ _(
189
189
  "div",
190
190
  {
191
191
  className: d.attachmentItem,
192
192
  "data-testid": `attachment-item-${t}`,
193
193
  children: [
194
- p.length > 1 && /* @__PURE__ */ T("p", { className: d.attachmentCounter, children: [
194
+ T.length > 1 && /* @__PURE__ */ _("p", { className: d.attachmentCounter, children: [
195
195
  t + 1,
196
196
  "/",
197
- p.length
197
+ T.length
198
198
  ] }),
199
- S ? /* @__PURE__ */ r(
199
+ w ? /* @__PURE__ */ r(
200
200
  "img",
201
201
  {
202
202
  src: c,
@@ -1,63 +1,63 @@
1
- import { jsx as s, jsxs as W, Fragment as Z } from "react/jsx-runtime";
2
- import { a as ee, u as re, g as ae, d as oe, e as te, f as se, i as ne, j as de, R as S, m as ie, b as me, c as U, C as ue, T as le, n as ce, t as fe, s as ye } from "./index-_ys4AfcI.js";
1
+ import { jsx as s, jsxs as X, Fragment as Z } from "react/jsx-runtime";
2
+ import { a as ee, u as re, E as ae, q as oe, U as te, W as se, j as ne, t as de, _ as R, m as ie, w as me, c as q, O as ue, L as le, n as ce, Y as fe, P as ye } from "./index-BsJk02uJ.js";
3
3
  import { useQueryClient as be, useQuery as f } from "@tanstack/react-query";
4
- import { useState as q, useMemo as d, useCallback as y } from "react";
5
- const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_customAccordianItem__isszs", A = {
6
- formsTableBody: ge,
7
- customAccordianItem: pe
8
- }, he = (m) => m ? m.extension?.find(
4
+ import { useState as S, useMemo as d, useCallback as y } from "react";
5
+ const pe = "FormsTable-module_formsTableBody__SvGha", ge = "FormsTable-module_customAccordianItem__isszs", A = {
6
+ formsTableBody: pe,
7
+ customAccordianItem: ge
8
+ }, Ne = (m) => m ? m.extension?.find(
9
9
  (n) => n.url === ye
10
- )?.valueString : void 0, Ie = ({
10
+ )?.valueString : void 0, Le = ({
11
11
  episodeOfCareUuids: m,
12
12
  encounterUuids: n,
13
- config: j
13
+ config: H
14
14
  }) => {
15
- const { t } = ee(), u = re(), [l, T] = q(!1), [o, O] = q(null), {
16
- numberOfVisits: k,
17
- hideThumbnail: w = !1,
15
+ const { t } = ee(), u = re(), [l, O] = S(!1), [o, I] = S(null), {
16
+ numberOfVisits: w,
17
+ hideThumbnail: j = !1,
18
18
  forms: c
19
- } = j ?? {}, I = ae(
19
+ } = H ?? {}, L = ae(
20
20
  m,
21
21
  n
22
- ), H = be(), {
23
- data: F = [],
24
- isLoading: L,
25
- isError: B,
22
+ ), k = be(), {
23
+ data: T = [],
24
+ isLoading: E,
25
+ isError: F,
26
26
  error: K,
27
27
  refetch: x
28
28
  } = f({
29
29
  queryKey: ["forms", u, m],
30
- queryFn: () => oe(u, void 0, k),
31
- enabled: !!u && !I
32
- }), C = d(() => {
33
- let e = F;
30
+ queryFn: () => oe(u, void 0, w),
31
+ enabled: !!u && !L
32
+ }), _ = d(() => {
33
+ let e = T;
34
34
  return n && n.length > 0 && (e = e.filter(
35
35
  (r) => n.includes(r.encounterUuid)
36
36
  )), Array.isArray(c) && c.length > 0 && (e = e.filter(
37
37
  (r) => c.some((a) => a.toLowerCase() === r.formName.toLowerCase())
38
38
  )), e;
39
- }, [F, n, c]), { data: E = [] } = f({
39
+ }, [T, n, c]), { data: B = [] } = f({
40
40
  queryKey: ["observationForms"],
41
41
  queryFn: () => te()
42
42
  }), M = y(
43
- (e) => E.find((r) => r.name === e)?.uuid,
44
- [E]
43
+ (e) => B.find((r) => r.name === e)?.uuid,
44
+ [B]
45
45
  ), b = d(() => {
46
46
  if (o)
47
47
  return M(o.formName);
48
48
  }, [o, M]), {
49
49
  isLoading: V,
50
50
  isError: $,
51
- error: g
51
+ error: p
52
52
  } = f({
53
53
  queryKey: ["formMetadata", b],
54
54
  queryFn: () => se(b),
55
55
  enabled: !!b && l
56
56
  }), {
57
- data: p,
57
+ data: g,
58
58
  isLoading: z,
59
59
  isError: G,
60
- error: h
60
+ error: N
61
61
  } = f({
62
62
  queryKey: ["formsEncounterFHIR", o?.encounterUuid],
63
63
  queryFn: () => ne(o.encounterUuid),
@@ -65,41 +65,41 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
65
65
  });
66
66
  de(
67
67
  (e) => {
68
- e.patientUUID === u && e.updatedConcepts.size > 0 && (x(), H.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
68
+ e.patientUUID === u && e.updatedConcepts.size > 0 && (x(), k.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
69
  },
70
70
  [u]
71
71
  );
72
- const Q = d(() => !p?.entry || !o?.formName ? [] : p.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
73
- const r = he(e);
72
+ const P = d(() => !g?.entry || !o?.formName ? [] : g.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
73
+ const r = Ne(e);
74
74
  return !r || r.includes(o.formName);
75
- }), [p, o?.formName]), P = d(() => {
76
- if (g)
77
- return S(g).message;
78
- if (h)
79
- return S(h).message;
80
- }, [g, h]), R = d(
75
+ }), [g, o?.formName]), Q = d(() => {
76
+ if (p)
77
+ return R(p).message;
78
+ if (N)
79
+ return R(N).message;
80
+ }, [p, N]), U = d(
81
81
  () => [
82
82
  { key: "recordedOn", header: t("RECORDED_ON") },
83
83
  { key: "recordedBy", header: t("RECORDED_BY") }
84
84
  ],
85
85
  [t]
86
- ), Y = d(
86
+ ), W = d(
87
87
  () => [
88
88
  { key: "recordedOn", sortable: !0 },
89
89
  { key: "recordedBy", sortable: !0 }
90
90
  ],
91
91
  []
92
- ), _ = d(() => {
93
- const e = C.reduce(
92
+ ), v = d(() => {
93
+ const e = _.reduce(
94
94
  (r, a) => {
95
95
  const i = a.formName;
96
96
  r[i] ??= [];
97
- const N = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
97
+ const h = a.providers.map((J) => J.providerName).filter(Boolean).join(", ");
98
98
  return r[i].push({
99
99
  id: a.encounterUuid,
100
100
  formName: a.formName,
101
101
  recordedOn: ie(a.encounterDateTime, t, !0).formattedResult,
102
- recordedBy: N ?? "--",
102
+ recordedBy: h ?? "--",
103
103
  encounterDateTime: a.encounterDateTime,
104
104
  encounterUuid: a.encounterUuid
105
105
  }), r;
@@ -110,42 +110,42 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
110
110
  ([r, a]) => ({
111
111
  formName: r,
112
112
  records: a.sort(
113
- (i, N) => N.encounterDateTime - i.encounterDateTime
113
+ (i, h) => h.encounterDateTime - i.encounterDateTime
114
114
  )
115
115
  })
116
116
  ).sort((r, a) => r.formName.localeCompare(a.formName));
117
- }, [C, t]), v = y((e) => {
118
- O(e), T(!0);
119
- }, []), J = y(() => {
120
- T(!1), O(null);
117
+ }, [_, t]), C = y((e) => {
118
+ I(e), O(!0);
119
+ }, []), Y = y(() => {
120
+ O(!1), I(null);
121
121
  }, []), D = y(
122
122
  (e, r) => {
123
123
  switch (r) {
124
124
  case "recordedOn":
125
- return /* @__PURE__ */ s(me, { onClick: () => v(e), children: e.recordedOn });
125
+ return /* @__PURE__ */ s(me, { onClick: () => C(e), children: e.recordedOn });
126
126
  case "recordedBy":
127
127
  return e.recordedBy;
128
128
  default:
129
129
  return null;
130
130
  }
131
131
  },
132
- [v]
132
+ [C]
133
133
  );
134
- return /* @__PURE__ */ W(Z, { children: [
135
- /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: L || B || _.length === 0 || I ? /* @__PURE__ */ s(
136
- U,
134
+ return /* @__PURE__ */ X(Z, { children: [
135
+ /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: E || F || v.length === 0 || L ? /* @__PURE__ */ s(
136
+ q,
137
137
  {
138
- headers: R,
138
+ headers: U,
139
139
  ariaLabel: t("FORMS_HEADING"),
140
140
  rows: [],
141
- loading: L,
142
- errorStateMessage: B ? K?.message : void 0,
141
+ loading: E,
142
+ errorStateMessage: F ? K?.message : void 0,
143
143
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
144
144
  renderCell: D,
145
145
  className: A.formsTableBody,
146
146
  dataTestId: "forms-table"
147
147
  }
148
- ) : /* @__PURE__ */ s(ue, { align: "start", children: _.map((e, r) => {
148
+ ) : /* @__PURE__ */ s(ue, { align: "start", children: v.map((e, r) => {
149
149
  const { formName: a, records: i } = e;
150
150
  return /* @__PURE__ */ s(
151
151
  le,
@@ -155,14 +155,14 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
155
155
  testId: `accordian-title-${a}`,
156
156
  open: r === 0,
157
157
  children: /* @__PURE__ */ s(
158
- U,
158
+ q,
159
159
  {
160
- headers: R,
160
+ headers: U,
161
161
  ariaLabel: t("FORMS_HEADING"),
162
162
  rows: i,
163
163
  loading: !1,
164
164
  errorStateMessage: "",
165
- sortable: Y,
165
+ sortable: W,
166
166
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
167
167
  renderCell: D,
168
168
  className: A.formsTableBody,
@@ -179,7 +179,7 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
179
179
  id: "modalIdForActionAreaLayout",
180
180
  portalId: "main-display-area",
181
181
  open: l,
182
- onRequestClose: J,
182
+ onRequestClose: Y,
183
183
  modalHeading: o.formName,
184
184
  modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
185
185
  passiveModal: !0,
@@ -188,13 +188,13 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
188
188
  children: /* @__PURE__ */ s(
189
189
  fe,
190
190
  {
191
- observations: Q,
191
+ observations: P,
192
192
  isLoading: V || z,
193
193
  isError: $ || G,
194
- errorMessage: P,
194
+ errorMessage: Q,
195
195
  emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
196
196
  testIdPrefix: o.formName,
197
- hideThumbnail: w
197
+ hideThumbnail: j
198
198
  }
199
199
  )
200
200
  }
@@ -202,5 +202,5 @@ const ge = "FormsTable-module_formsTableBody__SvGha", pe = "FormsTable-module_cu
202
202
  ] });
203
203
  };
204
204
  export {
205
- Ie as default
205
+ Le as default
206
206
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DGTqDb2V.js";
2
- import { r as d, A as f, D as e } from "./index-_ys4AfcI.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-Bh050bR8.js";
2
+ import { g as d, d as f, f as e } from "./index-BsJk02uJ.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,13 +1,13 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-DGTqDb2V.js";
2
- import { r as v, A as C, D as e } from "./index-_ys4AfcI.js";
3
- var h = (t) => {
1
+ import { c as s, T as c, P as u, a as i, b as m, C as d, Q as P } from "./YPM2AS64-Bh050bR8.js";
2
+ import { g as v, d as C, f as e } from "./index-BsJk02uJ.js";
3
+ var f = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
6
  }), a = v(), l = C(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
10
- return e(d.Provider, {
10
+ return e(P.Provider, {
11
11
  value: t,
12
12
  get children() {
13
13
  return e(u, {
@@ -20,7 +20,7 @@ var h = (t) => {
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
23
- return e(P, {
23
+ return e(d, {
24
24
  localStore: r,
25
25
  setLocalStore: o,
26
26
  get onClose() {
@@ -36,7 +36,7 @@ var h = (t) => {
36
36
  });
37
37
  }
38
38
  });
39
- }, p = h;
39
+ }, p = f;
40
40
  export {
41
41
  p as default
42
42
  };