@bahmni/clinical-app 0.0.1-dev.441 → 0.0.1-dev.443

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 { cX as c } from "./index-CXVD8oVf.js";
1
+ import { cX as c } from "./index-D9IwfHx_.js";
2
2
  export {
3
3
  c as ClinicalApp
4
4
  };
@@ -97,6 +97,7 @@
97
97
  "COMMON_SEARCH_RESULTS_TABLE_TITLE": "Search Results",
98
98
  "COMMON_SEARCH_RESULTS_TABLE_TITLE_WITH_COUNT": "Search Results ({{total}})",
99
99
  "COMMON_SEARCH_SEARCH_BUTTON": "Search",
100
+ "COMMON_SEARCH_RESET_BUTTON": "Clear Search",
100
101
  "COMMON_SEARCH_SELECT_CONTEXT_PLACEHOLDER": "Select a context",
101
102
  "COMMON_SEARCH_SELECT_CONTEXT_TITLE": "Search Context",
102
103
  "COMMON_SEARCH_SELECT_LOCATION_LABEL": "Location",
@@ -106,6 +106,7 @@
106
106
  "COMMON_SEARCH_RESULTS_TABLE_TITLE": "Resultados de búsqueda",
107
107
  "COMMON_SEARCH_RESULTS_TABLE_TITLE_WITH_COUNT": "Resultados de búsqueda ({{total}})",
108
108
  "COMMON_SEARCH_SEARCH_BUTTON": "Buscar",
109
+ "COMMON_SEARCH_RESET_BUTTON": "Borrar Buscar",
109
110
  "COMMON_SEARCH_SELECT_CONTEXT_PLACEHOLDER": "Seleccionar un contexto",
110
111
  "COMMON_SEARCH_SELECT_CONTEXT_TITLE": "Contexto de Búsqueda",
111
112
  "COMMON_SEARCH_SELECT_LOCATION_LABEL": "Ubicación",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.441",
3
+ "version": "0.0.1-dev.443",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,246 +0,0 @@
1
- import { jsxs as I, jsx as o } from "react/jsx-runtime";
2
- import { d as G, z as H, u as F, I as j, H as J, i as M, Z as Y, w as x, Y as P, Q as X, J as Z, X as W, j as ee, $ as ae, G as se, E as U, K as te, l as re, h as ie, m as ne, n as oe, o as de, F as le } from "./index-CXVD8oVf.js";
3
- import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
4
- import { useRef as me, useEffect as D, useMemo as g } from "react";
5
- const pe = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", O = {
6
- observations: pe,
7
- title: be,
8
- wrapper: he,
9
- secondary: ve
10
- }, w = (s, l, n, d, c, t) => {
11
- const r = te(s, l, c), e = r.value, m = re(e);
12
- let i = e;
13
- m === "Image" && (i = /* @__PURE__ */ o(
14
- oe,
15
- {
16
- imageSrc: e,
17
- alt: e,
18
- id: `${e}-img`,
19
- hideThumbnail: t
20
- }
21
- )), m === "Video" && (i = /* @__PURE__ */ o(
22
- de,
23
- {
24
- id: `${e}-video`,
25
- videoSrc: e,
26
- hideThumbnail: t
27
- }
28
- )), m === "PDF" && (i = /* @__PURE__ */ o(le, { id: `${e}-pdf`, src: e }));
29
- const p = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
30
- /* @__PURE__ */ o("span", { children: r.header.display }),
31
- r.header.referenceRange && /* @__PURE__ */ o("span", { className: O.secondary, children: r.header.referenceRange })
32
- ] }), u = c("OBSERVATIONS_RECORDED_BY", {
33
- provider: r.provider
34
- }), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, E = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
35
- /* @__PURE__ */ o("span", { children: u }),
36
- b && /* @__PURE__ */ o("span", { className: O.secondary, children: b })
37
- ] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", R = d ? `${d}-${v}-${h}-${n}-${l}` : `${v}-${h}-${n}-${l}`;
38
- return /* @__PURE__ */ o(
39
- ne,
40
- {
41
- header: p,
42
- value: i,
43
- info: E,
44
- id: R,
45
- testId: R,
46
- ariaLabel: R
47
- },
48
- `obs-${s.id}`
49
- );
50
- }, ye = (s, l, n, d, c, t, r) => /* @__PURE__ */ o(
51
- U,
52
- {
53
- title: s.display,
54
- id: `grouped-obs-${s.display}-${d}`,
55
- open: n,
56
- children: s.members?.map(
57
- (e, m) => w(
58
- e,
59
- m,
60
- c,
61
- t,
62
- l,
63
- r
64
- )
65
- )
66
- },
67
- `grouped-obs-${s.id}`
68
- ), Oe = ({
69
- groupedData: s,
70
- title: l = "",
71
- hideThumbnail: n
72
- }) => {
73
- const { t: d } = F(), c = (t, r, e) => {
74
- const m = se(t.encounterDetails, d);
75
- return /* @__PURE__ */ I(
76
- U,
77
- {
78
- title: m,
79
- id: `encounter-${t.encounterId}`,
80
- open: r,
81
- children: [
82
- t.observations.map(
83
- (i, p) => w(
84
- i,
85
- p,
86
- e,
87
- l,
88
- d,
89
- n
90
- )
91
- ),
92
- t.groupedObservations.map(
93
- (i, p) => ye(
94
- i,
95
- d,
96
- r,
97
- p,
98
- e,
99
- l,
100
- n
101
- )
102
- )
103
- ]
104
- },
105
- `encounter-${t.encounterId}`
106
- );
107
- };
108
- return /* @__PURE__ */ o(
109
- "div",
110
- {
111
- id: "obs-by-encounter",
112
- "data-testid": "obs-by-encounter-test-id",
113
- "aria-label": "obs-by-encounter-aria-label",
114
- children: s.map(
115
- (t, r) => c(t, r === 0, r)
116
- )
117
- }
118
- );
119
- }, Re = (s) => ["conceptUuid", s], _e = (s, l, n, d) => [
120
- "observations",
121
- s,
122
- ...l,
123
- n,
124
- d
125
- ], Ie = ({
126
- config: s,
127
- episodeOfCareUuids: l,
128
- encounterUuids: n
129
- }) => {
130
- const d = s, {
131
- conceptNames: c = [],
132
- conceptUuid: t = [],
133
- hideThumbnail: r = !1,
134
- scope: e = "all"
135
- } = d, m = me(/* @__PURE__ */ new Set()), i = G(), { addNotification: p } = H(), { t: u } = F(), b = ue({
136
- queries: c.map((a) => ({
137
- queryKey: Re(a),
138
- queryFn: () => j(a),
139
- enabled: !!a
140
- }))
141
- });
142
- D(() => {
143
- const a = b.some((z) => z.isError), y = m.current.size > 0;
144
- a && !y ? (p({
145
- title: u("ERROR_DEFAULT_TITLE"),
146
- message: u("ERROR_FETCHING_OBSERVATIONS"),
147
- type: "error"
148
- }), m.current.add(0)) : !a && y && m.current.clear();
149
- }, [b, p, u]);
150
- const E = g(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = g(() => [.../* @__PURE__ */ new Set([...E, ...t])], [E, t]), v = g(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), R = e === "latest" || e === "latest-encounter", B = J(
151
- l,
152
- n
153
- ), {
154
- data: _,
155
- isLoading: V,
156
- isError: S,
157
- refetch: $
158
- } = ce({
159
- queryKey: _e(
160
- i,
161
- h,
162
- n,
163
- e
164
- ),
165
- queryFn: () => R ? M(
166
- i,
167
- h,
168
- n
169
- ) : Y(
170
- i,
171
- h,
172
- n
173
- ),
174
- enabled: !!i && h.length > 0 && v && !B
175
- });
176
- x(
177
- (a) => {
178
- a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
179
- (y) => h.includes(y)
180
- ) && $();
181
- },
182
- [i, $]
183
- ), D(() => {
184
- S && p({
185
- title: u("ERROR_DEFAULT_TITLE"),
186
- message: u("ERROR_FETCHING_OBSERVATIONS"),
187
- type: "error"
188
- });
189
- }, [S]);
190
- const N = g(() => {
191
- if (!_) return [];
192
- let a = P(_);
193
- e === "latest-encounter" && (a = X(a));
194
- const y = Z(a);
195
- return W(y);
196
- }, [_, e]), K = [
197
- { key: "name", header: "name" },
198
- { key: "value", header: "value" },
199
- { key: "form", header: "form" }
200
- ], A = V || !v, L = S && v, k = (!_ || _.entry?.length === 0 || h.length === 0) && v, C = L ? u("ERROR_FETCHING_OBSERVATIONS") : null, Q = k ? u("NO_OBSERVATIONS_FOUND") : void 0, q = N.length > 0 && !A && !L, T = d.titleTranslationKey, f = T ? u(T) : "";
201
- return /* @__PURE__ */ I(
202
- "div",
203
- {
204
- id: "observations",
205
- "data-testid": T ? `observations-${f}` : "observations",
206
- "aria-label": "observations-aria-label",
207
- className: O.observations,
208
- children: [
209
- /* @__PURE__ */ o(
210
- ee,
211
- {
212
- id: "observations-title",
213
- testId: T ? `observations-title-${f}` : "observations-title",
214
- title: f,
215
- className: O.title,
216
- children: /* @__PURE__ */ o("p", { children: f })
217
- }
218
- ),
219
- q ? /* @__PURE__ */ o(
220
- Oe,
221
- {
222
- groupedData: N,
223
- title: f,
224
- hideThumbnail: r
225
- }
226
- ) : /* @__PURE__ */ o(
227
- ae,
228
- {
229
- headers: K,
230
- rows: [],
231
- ariaLabel: u("OBSERVATIONS"),
232
- loading: A,
233
- errorStateMessage: C,
234
- emptyStateMessage: Q ?? u("NO_OBSERVATIONS_AVAILABLE"),
235
- dataTestId: "observations-table"
236
- }
237
- )
238
- ]
239
- }
240
- );
241
- };
242
- export {
243
- Re as conceptUuidQueryKeys,
244
- Ie as default,
245
- _e as observationsQueryKeys
246
- };