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