@bahmni/clinical-app 0.0.1-dev.269 → 0.0.1-dev.271

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 { aw as i } from "./index-CVOSTJhz.js";
1
+ import { at as i } from "./index-D8R0WjHJ.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.269",
3
+ "version": "0.0.1-dev.271",
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
- };