@bahmni/clinical-app 0.0.1-dev.268 → 0.0.1-dev.270

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 h, Fragment as Y } from "react/jsx-runtime";
2
- import { u as K, a as Q, h as W, b as J, c as X, m as Z, d as ee, n as te, e as ae } from "./index-CVOSTJhz.js";
2
+ import { u as K, a as Q, h as W, b as J, c as X, m as Z, d as ee, n as te, e as ae } from "./index-DzoLJTzR.js";
3
3
  import { useState as m, useCallback as p, useEffect as f, useMemo as T } from "react";
4
4
  const ne = "_documentsTableBody_1voj8_1", oe = "_viewAttachmentsLink_1voj8_11", re = "_documentViewerContainer_1voj8_15", de = "_attachmentItem_1voj8_23", se = "_attachmentCounter_1voj8_27", ce = "_attachmentError_1voj8_36", ie = "_documentIframe_1voj8_44", me = "_documentImage_1voj8_50", d = {
5
5
  documentsTableBody: ne,
@@ -0,0 +1,205 @@
1
+ import { jsx as s, jsxs as W, Fragment as Z } from "react/jsx-runtime";
2
+ import { a as ee, u as re, w as ae, f as oe, b as f, X as te, R as v, m as se, c as ne, d as U, C as de, T as ie, n as me, J as ue, K as le, g as ce, i as fe, Q as ye, G as pe } from "./index-DzoLJTzR.js";
3
+ import { useState as S, useMemo as d, useCallback as y } from "react";
4
+ const be = "_formsTableBody_ourq9_5", ge = "_customAccordianItem_ourq9_10", A = {
5
+ formsTableBody: be,
6
+ customAccordianItem: ge
7
+ }, Ne = (m) => m ? m.extension?.find(
8
+ (n) => n.url === le
9
+ )?.valueString : void 0, Ie = ({
10
+ episodeOfCareUuids: m,
11
+ encounterUuids: n,
12
+ config: w
13
+ }) => {
14
+ const { t } = ee(), u = re(), [l, O] = S(!1), [o, I] = S(null), {
15
+ numberOfVisits: K,
16
+ hideThumbnail: k = !1,
17
+ forms: c
18
+ } = w ?? {}, T = ae(
19
+ m,
20
+ n
21
+ ), H = oe(), {
22
+ data: L = [],
23
+ isLoading: B,
24
+ isError: C,
25
+ error: Q,
26
+ refetch: j
27
+ } = f({
28
+ queryKey: ["forms", u, m],
29
+ queryFn: () => ce(u, void 0, K),
30
+ enabled: !!u && !T
31
+ }), E = d(() => {
32
+ let e = L;
33
+ return n && n.length > 0 && (e = e.filter(
34
+ (r) => n.includes(r.encounterUuid)
35
+ )), Array.isArray(c) && c.length > 0 && (e = e.filter(
36
+ (r) => c.some((a) => a.toLowerCase() === r.formName.toLowerCase())
37
+ )), e;
38
+ }, [L, n, c]), { data: M = [] } = f({
39
+ queryKey: ["observationForms"],
40
+ queryFn: () => fe()
41
+ }), R = y(
42
+ (e) => M.find((r) => r.name === e)?.uuid,
43
+ [M]
44
+ ), p = d(() => {
45
+ if (o)
46
+ return R(o.formName);
47
+ }, [o, R]), {
48
+ isLoading: x,
49
+ isError: G,
50
+ error: b
51
+ } = f({
52
+ queryKey: ["formMetadata", p],
53
+ queryFn: () => ye(p),
54
+ enabled: !!p && l
55
+ }), {
56
+ data: g,
57
+ isLoading: V,
58
+ isError: $,
59
+ error: N
60
+ } = f({
61
+ queryKey: ["formsEncounterFHIR", o?.encounterUuid],
62
+ queryFn: () => pe(o.encounterUuid),
63
+ enabled: !!o?.encounterUuid && l
64
+ });
65
+ te(
66
+ (e) => {
67
+ e.patientUUID === u && e.updatedConcepts.size > 0 && (j(), H.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
68
+ },
69
+ [u]
70
+ );
71
+ const J = d(() => !g?.entry || !o?.formName ? [] : g.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
72
+ const r = Ne(e);
73
+ return !r || r.includes(o.formName);
74
+ }), [g, o?.formName]), z = d(() => {
75
+ if (b)
76
+ return v(b).message;
77
+ if (N)
78
+ return v(N).message;
79
+ }, [b, N]), _ = d(
80
+ () => [
81
+ { key: "recordedOn", header: t("RECORDED_ON") },
82
+ { key: "recordedBy", header: t("RECORDED_BY") }
83
+ ],
84
+ [t]
85
+ ), X = d(
86
+ () => [
87
+ { key: "recordedOn", sortable: !0 },
88
+ { key: "recordedBy", sortable: !0 }
89
+ ],
90
+ []
91
+ ), F = d(() => {
92
+ const e = E.reduce(
93
+ (r, a) => {
94
+ const i = a.formName;
95
+ r[i] ??= [];
96
+ const h = a.providers.map((Y) => Y.providerName).filter(Boolean).join(", ");
97
+ return r[i].push({
98
+ id: a.encounterUuid,
99
+ formName: a.formName,
100
+ recordedOn: se(a.encounterDateTime, t, !0).formattedResult,
101
+ recordedBy: h ?? "--",
102
+ encounterDateTime: a.encounterDateTime,
103
+ encounterUuid: a.encounterUuid
104
+ }), r;
105
+ },
106
+ {}
107
+ );
108
+ return Object.entries(e).map(
109
+ ([r, a]) => ({
110
+ formName: r,
111
+ records: a.sort(
112
+ (i, h) => h.encounterDateTime - i.encounterDateTime
113
+ )
114
+ })
115
+ ).sort((r, a) => r.formName.localeCompare(a.formName));
116
+ }, [E, t]), D = y((e) => {
117
+ I(e), O(!0);
118
+ }, []), P = y(() => {
119
+ O(!1), I(null);
120
+ }, []), q = y(
121
+ (e, r) => {
122
+ switch (r) {
123
+ case "recordedOn":
124
+ return /* @__PURE__ */ s(ne, { onClick: () => D(e), children: e.recordedOn });
125
+ case "recordedBy":
126
+ return e.recordedBy;
127
+ default:
128
+ return null;
129
+ }
130
+ },
131
+ [D]
132
+ );
133
+ return /* @__PURE__ */ W(Z, { children: [
134
+ /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: B || C || F.length === 0 || T ? /* @__PURE__ */ s(
135
+ U,
136
+ {
137
+ headers: _,
138
+ ariaLabel: t("FORMS_HEADING"),
139
+ rows: [],
140
+ loading: B,
141
+ errorStateMessage: C ? Q?.message : void 0,
142
+ emptyStateMessage: t("FORMS_UNAVAILABLE"),
143
+ renderCell: q,
144
+ className: A.formsTableBody,
145
+ dataTestId: "forms-table"
146
+ }
147
+ ) : /* @__PURE__ */ s(de, { align: "start", children: F.map((e, r) => {
148
+ const { formName: a, records: i } = e;
149
+ return /* @__PURE__ */ s(
150
+ ie,
151
+ {
152
+ title: a,
153
+ className: A.customAccordianItem,
154
+ testId: `accordian-title-${a}`,
155
+ open: r === 0,
156
+ children: /* @__PURE__ */ s(
157
+ U,
158
+ {
159
+ headers: _,
160
+ ariaLabel: t("FORMS_HEADING"),
161
+ rows: i,
162
+ loading: !1,
163
+ errorStateMessage: "",
164
+ sortable: X,
165
+ emptyStateMessage: t("FORMS_UNAVAILABLE"),
166
+ renderCell: q,
167
+ className: A.formsTableBody,
168
+ dataTestId: `forms-table-${a}`
169
+ }
170
+ )
171
+ },
172
+ a
173
+ );
174
+ }) }) }),
175
+ l && o && /* @__PURE__ */ s(
176
+ me,
177
+ {
178
+ id: "modalIdForActionAreaLayout",
179
+ portalId: "main-display-area",
180
+ open: l,
181
+ onRequestClose: P,
182
+ modalHeading: o.formName,
183
+ modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
184
+ passiveModal: !0,
185
+ size: "md",
186
+ testId: "form-details-modal",
187
+ children: /* @__PURE__ */ s(
188
+ ue,
189
+ {
190
+ observations: J,
191
+ isLoading: x || V,
192
+ isError: G || $,
193
+ errorMessage: z,
194
+ emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
195
+ testIdPrefix: o.formName,
196
+ hideThumbnail: k
197
+ }
198
+ )
199
+ }
200
+ )
201
+ ] });
202
+ };
203
+ export {
204
+ Ie as default
205
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as v, D as u, Q as i } from "./YPM2AS64-bWTEzVUO.js";
2
- import { r as d, t as f, v as e } from "./index-CVOSTJhz.js";
1
+ import { c, T as l, P as m, a as v, D as u, Q as i } from "./YPM2AS64-CamXVL9E.js";
2
+ import { r as d, t as f, v as e } from "./index-DzoLJTzR.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
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-bWTEzVUO.js";
2
- import { r as v, t as C, v as e } from "./index-CVOSTJhz.js";
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-CamXVL9E.js";
2
+ import { r as v, t as C, v as e } from "./index-DzoLJTzR.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,5 +1,5 @@
1
1
  import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
- import { u as w, h as M, a as N, j as k, W as x, b as K, X as Q, k as X, l as Y, s as j, z, d as G, o as H, _ as A, p as P, y as W, Y as J, M as Z, S as ee, A as ae, q as te } from "./index-CVOSTJhz.js";
2
+ import { u as w, h as M, a as N, j as k, W as x, b as K, X as Q, k as X, l as Y, s as j, z, d as G, o as H, _ as A, p as P, y as W, Y as J, M as Z, S as ee, A as ae, q as te } from "./index-DzoLJTzR.js";
3
3
  import { useRef as se, useEffect as f, useMemo as R } from "react";
4
4
  const D = (a, n, d, l, b, r) => {
5
5
  const t = P(a, n, b), s = t.value, i = W(s);
@@ -1,4 +1,4 @@
1
- import { x as we, B as z, D as xt, E as B, t as q, v as y, P as Ro, F as ye, H as R, I as _, L as k, N, O as A, U as bs, V as ir, Z as $e, $ as U, a0 as Hn, a1 as Vn, a2 as dt, a3 as D, a4 as xs, a5 as cn, a6 as Be, a7 as ws, a8 as qt, a9 as zt, aa as $s, ab as Cs, ac as $n, ad as Ss, ae as Nr, af as Bt, ag as zo, ah as ks, ai as Es, aj as j, ak as Ur, al as Ms, am as Ds, an as sr, ao as As, ap as Ts, aq as zn, ar as Fs, as as Is, at as Z, au as Ps, av as Ls } from "./index-CVOSTJhz.js";
1
+ import { x as we, B as z, D as xt, E as B, t as q, v as y, P as Ro, F as ye, H as R, I as _, L as k, N, O as A, U as bs, V as ir, Z as $e, $ as U, a0 as Hn, a1 as Vn, a2 as dt, a3 as D, a4 as xs, a5 as cn, a6 as Be, a7 as ws, a8 as qt, a9 as zt, aa as $s, ab as Cs, ac as $n, ad as Ss, ae as Nr, af as Bt, ag as zo, ah as ks, ai as Es, aj as j, ak as Ur, al as Ms, am as Ds, an as sr, ao as As, ap as Ts, aq as zn, ar as Fs, as as Is, at as Z, au as Ps, av as Ls } from "./index-DzoLJTzR.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -171574,7 +171574,7 @@ const mpt = [
171574
171574
  },
171575
171575
  {
171576
171576
  type: "patientDocuments",
171577
- component: lazy$1(() => import("./DocumentsTable-DpdDopmT-BgWZuB5k.js"))
171577
+ component: lazy$1(() => import("./DocumentsTable-DEvlbfDU-Di0Ts4Z9.js"))
171578
171578
  },
171579
171579
  {
171580
171580
  type: "flowSheet",
@@ -171582,7 +171582,7 @@ const mpt = [
171582
171582
  },
171583
171583
  {
171584
171584
  type: "forms",
171585
- component: lazy$1(() => import("./FormsTable-DpzSwpFX-Dew3_ZTC.js"))
171585
+ component: lazy$1(() => import("./FormsTable-DBD0f2fD-DgJr0wEu.js"))
171586
171586
  },
171587
171587
  {
171588
171588
  type: "labOrders",
@@ -171590,7 +171590,7 @@ const mpt = [
171590
171590
  },
171591
171591
  {
171592
171592
  type: "observations",
171593
- component: lazy$1(() => import("./Observations-BGcqFMV8-CsAcn2N_.js"))
171593
+ component: lazy$1(() => import("./Observations-D6WZol9t-BhtaqvFg.js"))
171594
171594
  },
171595
171595
  {
171596
171596
  type: "ordersControl",
@@ -173496,7 +173496,7 @@ var displayValue = (t, e = !1) => {
173496
173496
  const e = render(() => {
173497
173497
  const n = this, [r] = this.#o, [a] = this.#d, [l] = this.#f, [c] = this.#u, [g] = this.#h, [A] = this.#t;
173498
173498
  let w;
173499
- return this.#s ? w = this.#s : (w = lazy(() => import("./LNWAZHJI-BSTsZcDO.js")), this.#s = w), setupStyleSheet(this.#i, this.#l), createComponent(w, mergeProps({
173499
+ return this.#s ? w = this.#s : (w = lazy(() => import("./LNWAZHJI-Dw-Q_sgA.js")), this.#s = w), setupStyleSheet(this.#i, this.#l), createComponent(w, mergeProps({
173500
173500
  get queryFlavor() {
173501
173501
  return n.#n;
173502
173502
  },
@@ -173594,7 +173594,7 @@ var displayValue = (t, e = !1) => {
173594
173594
  const e = render(() => {
173595
173595
  const n = this, [r] = this.#o, [a] = this.#d, [l] = this.#f, [c] = this.#u, [g] = this.#h, [A] = this.#t, [w] = this.#s;
173596
173596
  let _;
173597
- return this.#c ? _ = this.#c : (_ = lazy(() => import("./MWZ6AO7Z-CgkjbjEu.js")), this.#c = _), setupStyleSheet(this.#i, this.#l), createComponent(_, mergeProps({
173597
+ return this.#c ? _ = this.#c : (_ = lazy(() => import("./MWZ6AO7Z-BgDg8hMY.js")), this.#c = _), setupStyleSheet(this.#i, this.#l), createComponent(_, mergeProps({
173598
173598
  get queryFlavor() {
173599
173599
  return n.#n;
173600
173600
  },
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aw as i } from "./index-CVOSTJhz.js";
1
+ import { aw as i } from "./index-DzoLJTzR.js";
2
2
  export {
3
3
  i as ClinicalApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.268",
3
+ "version": "0.0.1-dev.270",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,196 +0,0 @@
1
- import { jsx as s, jsxs as Y, Fragment as W } from "react/jsx-runtime";
2
- import { a as Z, u as ee, w as re, f as ae, b as c, X as te, R as v, m as oe, c as se, d as C, C as ne, T as de, n as ie, J as ue, K as me, g as le, i as ce, Q as fe, G as ye } from "./index-CVOSTJhz.js";
3
- import { useState as U, useMemo as d, useCallback as f } from "react";
4
- const pe = "_formsTableBody_ourq9_5", be = "_customAccordianItem_ourq9_10", I = {
5
- formsTableBody: pe,
6
- customAccordianItem: be
7
- }, ge = (u) => u ? u.extension?.find(
8
- (n) => n.url === me
9
- )?.valueString : void 0, Oe = ({
10
- episodeOfCareUuids: u,
11
- encounterUuids: n,
12
- config: S
13
- }) => {
14
- const { t: o } = Z(), m = ee(), [l, O] = U(!1), [t, A] = U(null), { numberOfVisits: K, hideThumbnail: k = !1 } = S ?? {}, T = re(
15
- u,
16
- n
17
- ), w = ae(), {
18
- data: y = [],
19
- isLoading: E,
20
- isError: B,
21
- error: H,
22
- refetch: Q
23
- } = c({
24
- queryKey: ["forms", m, u],
25
- queryFn: () => le(m, void 0, K),
26
- enabled: !!m && !T
27
- }), R = d(() => !n || n.length === 0 ? y : y.filter(
28
- (e) => n.includes(e.encounterUuid)
29
- ), [y, n]), { data: _ = [] } = c({
30
- queryKey: ["observationForms"],
31
- queryFn: () => ce()
32
- }), F = f(
33
- (e) => _.find((r) => r.name === e)?.uuid,
34
- [_]
35
- ), p = d(() => {
36
- if (t)
37
- return F(t.formName);
38
- }, [t, F]), {
39
- isLoading: j,
40
- isError: x,
41
- error: b
42
- } = c({
43
- queryKey: ["formMetadata", p],
44
- queryFn: () => fe(p),
45
- enabled: !!p && l
46
- }), {
47
- data: g,
48
- isLoading: G,
49
- isError: V,
50
- error: N
51
- } = c({
52
- queryKey: ["formsEncounterFHIR", t?.encounterUuid],
53
- queryFn: () => ye(t.encounterUuid),
54
- enabled: !!t?.encounterUuid && l
55
- });
56
- te(
57
- (e) => {
58
- e.patientUUID === m && e.updatedConcepts.size > 0 && (Q(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
59
- },
60
- [m]
61
- );
62
- const $ = d(() => !g?.entry || !t?.formName ? [] : g.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
63
- const r = ge(e);
64
- return !r || r.includes(t.formName);
65
- }), [g, t?.formName]), J = d(() => {
66
- if (b)
67
- return v(b).message;
68
- if (N)
69
- return v(N).message;
70
- }, [b, N]), L = d(
71
- () => [
72
- { key: "recordedOn", header: o("RECORDED_ON") },
73
- { key: "recordedBy", header: o("RECORDED_BY") }
74
- ],
75
- [o]
76
- ), z = d(
77
- () => [
78
- { key: "recordedOn", sortable: !0 },
79
- { key: "recordedBy", sortable: !0 }
80
- ],
81
- []
82
- ), M = d(() => {
83
- const e = R.reduce(
84
- (r, a) => {
85
- const i = a.formName;
86
- r[i] ??= [];
87
- const h = a.providers.map((P) => P.providerName).filter(Boolean).join(", ");
88
- return r[i].push({
89
- id: a.encounterUuid,
90
- formName: a.formName,
91
- recordedOn: oe(a.encounterDateTime, o, !0).formattedResult,
92
- recordedBy: h ?? "--",
93
- encounterDateTime: a.encounterDateTime,
94
- encounterUuid: a.encounterUuid
95
- }), r;
96
- },
97
- {}
98
- );
99
- return Object.entries(e).map(
100
- ([r, a]) => ({
101
- formName: r,
102
- records: a.sort(
103
- (i, h) => h.encounterDateTime - i.encounterDateTime
104
- )
105
- })
106
- ).sort((r, a) => r.formName.localeCompare(a.formName));
107
- }, [R, o]), D = f((e) => {
108
- A(e), O(!0);
109
- }, []), X = f(() => {
110
- O(!1), A(null);
111
- }, []), q = f(
112
- (e, r) => {
113
- switch (r) {
114
- case "recordedOn":
115
- return /* @__PURE__ */ s(se, { onClick: () => D(e), children: e.recordedOn });
116
- case "recordedBy":
117
- return e.recordedBy;
118
- default:
119
- return null;
120
- }
121
- },
122
- [D]
123
- );
124
- return /* @__PURE__ */ Y(W, { children: [
125
- /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: E || B || M.length === 0 || T ? /* @__PURE__ */ s(
126
- C,
127
- {
128
- headers: L,
129
- ariaLabel: o("FORMS_HEADING"),
130
- rows: [],
131
- loading: E,
132
- errorStateMessage: B ? H?.message : void 0,
133
- emptyStateMessage: o("FORMS_UNAVAILABLE"),
134
- renderCell: q,
135
- className: I.formsTableBody,
136
- dataTestId: "forms-table"
137
- }
138
- ) : /* @__PURE__ */ s(ne, { align: "start", children: M.map((e, r) => {
139
- const { formName: a, records: i } = e;
140
- return /* @__PURE__ */ s(
141
- de,
142
- {
143
- title: a,
144
- className: I.customAccordianItem,
145
- testId: `accordian-title-${a}`,
146
- open: r === 0,
147
- children: /* @__PURE__ */ s(
148
- C,
149
- {
150
- headers: L,
151
- ariaLabel: o("FORMS_HEADING"),
152
- rows: i,
153
- loading: !1,
154
- errorStateMessage: "",
155
- sortable: z,
156
- emptyStateMessage: o("FORMS_UNAVAILABLE"),
157
- renderCell: q,
158
- className: I.formsTableBody,
159
- dataTestId: `forms-table-${a}`
160
- }
161
- )
162
- },
163
- a
164
- );
165
- }) }) }),
166
- l && t && /* @__PURE__ */ s(
167
- ie,
168
- {
169
- id: "modalIdForActionAreaLayout",
170
- portalId: "main-display-area",
171
- open: l,
172
- onRequestClose: X,
173
- modalHeading: t.formName,
174
- modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
175
- passiveModal: !0,
176
- size: "md",
177
- testId: "form-details-modal",
178
- children: /* @__PURE__ */ s(
179
- ue,
180
- {
181
- observations: $,
182
- isLoading: j || G,
183
- isError: x || V,
184
- errorMessage: J,
185
- emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
186
- testIdPrefix: t.formName,
187
- hideThumbnail: k
188
- }
189
- )
190
- }
191
- )
192
- ] });
193
- };
194
- export {
195
- Oe as default
196
- };