@bahmni/clinical-app 0.0.1-dev.301 → 0.0.1-dev.302

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { at as i } from "./index-DAZxjezx.js";
1
+ import { at as i } from "./index-CT27-suf.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.301",
3
+ "version": "0.0.1-dev.302",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,206 +0,0 @@
1
- import { jsx as s, jsxs as X, Fragment as Z } from "react/jsx-runtime";
2
- import { u as ee, h as re, y as ae, W as oe, j as te, U as se, F as ne, e as de, _ as R, a as ie, m as me, c as S, T as ue, O as le, o as ce, G as fe, B as ye } from "./index-DAZxjezx.js";
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 pe = "FormsTable-module_formsTableBody__SvGha", ge = "FormsTable-module_customAccordianItem__isszs", O = {
6
- formsTableBody: pe,
7
- customAccordianItem: ge
8
- }, he = (m) => m ? m.extension?.find(
9
- (n) => n.url === ye
10
- )?.valueString : void 0, Fe = ({
11
- episodeOfCareUuids: m,
12
- encounterUuids: n,
13
- config: H
14
- }) => {
15
- const { t } = ee(), u = re(), [l, A] = q(!1), [o, T] = q(null), {
16
- numberOfVisits: j,
17
- hideThumbnail: k = !1,
18
- forms: c
19
- } = H ?? {}, F = ae(
20
- m,
21
- n
22
- ), w = be(), {
23
- data: I = [],
24
- isLoading: B,
25
- isError: _,
26
- error: G,
27
- refetch: K
28
- } = f({
29
- queryKey: ["forms", u, m],
30
- queryFn: () => oe(u, void 0, j),
31
- enabled: !!u && !F
32
- }), L = d(() => {
33
- let e = I;
34
- return n && n.length > 0 && (e = e.filter(
35
- (r) => n.includes(r.encounterUuid)
36
- )), Array.isArray(c) && c.length > 0 && (e = e.filter(
37
- (r) => c.some((a) => a.toLowerCase() === r.formName.toLowerCase())
38
- )), e;
39
- }, [I, n, c]), { data: M = [] } = f({
40
- queryKey: ["observationForms"],
41
- queryFn: () => te()
42
- }), E = y(
43
- (e) => M.find((r) => r.name === e)?.uuid,
44
- [M]
45
- ), b = d(() => {
46
- if (o)
47
- return E(o.formName);
48
- }, [o, E]), {
49
- isLoading: x,
50
- isError: V,
51
- error: p
52
- } = f({
53
- queryKey: ["formMetadata", b],
54
- queryFn: () => se(b),
55
- enabled: !!b && l
56
- }), {
57
- data: g,
58
- isLoading: $,
59
- isError: z,
60
- error: h
61
- } = f({
62
- queryKey: ["formsEncounterFHIR", o?.encounterUuid],
63
- queryFn: () => ne(o.encounterUuid),
64
- enabled: !!o?.encounterUuid && l
65
- });
66
- de(
67
- (e) => {
68
- e.patientUUID === u && e.updatedConcepts.size > 0 && (K(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
69
- },
70
- [u]
71
- );
72
- const Q = d(() => !g?.entry || !o?.formName ? [] : g.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
73
- const r = he(e);
74
- return !r || r.includes(o.formName);
75
- }), [g, o?.formName]), P = d(() => {
76
- if (p)
77
- return R(p).message;
78
- if (h)
79
- return R(h).message;
80
- }, [p, h]), U = d(
81
- () => [
82
- { key: "recordedOn", header: t("RECORDED_ON") },
83
- { key: "recordedBy", header: t("RECORDED_BY") }
84
- ],
85
- [t]
86
- ), W = d(
87
- () => [
88
- { key: "recordedOn", sortable: !0 },
89
- { key: "recordedBy", sortable: !0 }
90
- ],
91
- []
92
- ), v = d(() => {
93
- const e = L.reduce(
94
- (r, a) => {
95
- const i = a.formName;
96
- r[i] ??= [];
97
- const N = a.providers.map((J) => J.providerName).filter(Boolean).join(", ");
98
- return r[i].push({
99
- id: a.encounterUuid,
100
- formName: a.formName,
101
- recordedOn: ie(a.encounterDateTime, t, !0).formattedResult,
102
- recordedBy: N ?? "--",
103
- encounterDateTime: a.encounterDateTime,
104
- encounterUuid: a.encounterUuid
105
- }), r;
106
- },
107
- {}
108
- );
109
- return Object.entries(e).map(
110
- ([r, a]) => ({
111
- formName: r,
112
- records: a.sort(
113
- (i, N) => N.encounterDateTime - i.encounterDateTime
114
- )
115
- })
116
- ).sort((r, a) => r.formName.localeCompare(a.formName));
117
- }, [L, t]), C = y((e) => {
118
- T(e), A(!0);
119
- }, []), Y = y(() => {
120
- A(!1), T(null);
121
- }, []), D = y(
122
- (e, r) => {
123
- switch (r) {
124
- case "recordedOn":
125
- return /* @__PURE__ */ s(me, { onClick: () => C(e), children: e.recordedOn });
126
- case "recordedBy":
127
- return e.recordedBy;
128
- default:
129
- return null;
130
- }
131
- },
132
- [C]
133
- );
134
- return /* @__PURE__ */ X(Z, { children: [
135
- /* @__PURE__ */ s("div", { id: "forms-table", "data-testid": "forms-table", children: B || _ || v.length === 0 || F ? /* @__PURE__ */ s(
136
- S,
137
- {
138
- headers: U,
139
- ariaLabel: t("FORMS_HEADING"),
140
- rows: [],
141
- loading: B,
142
- errorStateMessage: _ ? G?.message : void 0,
143
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
144
- renderCell: D,
145
- className: O.formsTableBody,
146
- dataTestId: "forms-table"
147
- }
148
- ) : /* @__PURE__ */ s(ue, { align: "start", children: v.map((e, r) => {
149
- const { formName: a, records: i } = e;
150
- return /* @__PURE__ */ s(
151
- le,
152
- {
153
- title: a,
154
- className: O.customAccordianItem,
155
- testId: `accordian-title-${a}`,
156
- open: r === 0,
157
- children: /* @__PURE__ */ s(
158
- S,
159
- {
160
- headers: U,
161
- ariaLabel: t("FORMS_HEADING"),
162
- rows: i,
163
- loading: !1,
164
- errorStateMessage: "",
165
- sortable: W,
166
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
167
- renderCell: D,
168
- className: O.formsTableBody,
169
- dataTestId: `forms-table-${a}`
170
- }
171
- )
172
- },
173
- a
174
- );
175
- }) }) }),
176
- l && o && /* @__PURE__ */ s(
177
- ce,
178
- {
179
- id: "modalIdForActionAreaLayout",
180
- portalId: "main-display-area",
181
- open: l,
182
- onRequestClose: Y,
183
- modalHeading: o.formName,
184
- modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
185
- passiveModal: !0,
186
- size: "md",
187
- testId: "form-details-modal",
188
- children: /* @__PURE__ */ s(
189
- fe,
190
- {
191
- observations: Q,
192
- isLoading: x || $,
193
- isError: V || z,
194
- errorMessage: P,
195
- emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
196
- testIdPrefix: o.formName,
197
- hideThumbnail: k
198
- }
199
- )
200
- }
201
- )
202
- ] });
203
- };
204
- export {
205
- Fe as default
206
- };