@bahmni/widgets 0.0.1-dev.191 → 0.0.1-dev.193

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.
Files changed (32) hide show
  1. package/dist/{DocumentsTable-DjFKN-vZ.js → DocumentsTable-Clxa2r1r.js} +36 -36
  2. package/dist/FormsTable-DL-5D8n9.js +423 -0
  3. package/dist/Observations-BTyQ4sIk.js +172 -0
  4. package/dist/appContext/AppContextProvider.d.ts +7 -0
  5. package/dist/appContext/AppContextProvider.d.ts.map +1 -0
  6. package/dist/appContext/index.d.ts +2 -0
  7. package/dist/appContext/index.d.ts.map +1 -0
  8. package/dist/appointments/AppointmentsTable.d.ts.map +1 -1
  9. package/dist/diagnoses/DiagnosesTable.d.ts.map +1 -1
  10. package/dist/documents/DocumentsTable.d.ts.map +1 -1
  11. package/dist/forms/FormsTable.d.ts.map +1 -1
  12. package/dist/forms/ObservationItem.d.ts.map +1 -1
  13. package/dist/genericServiceRequest/GenericServiceRequestTable.d.ts.map +1 -1
  14. package/dist/{index-HMYBr9oP.js → index-D3jK_TZZ.js} +19410 -20644
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +27 -26
  18. package/dist/labinvestigation/utils.d.ts.map +1 -1
  19. package/dist/medications/MedicationsTable.d.ts.map +1 -1
  20. package/dist/observations/utils.d.ts +2 -2
  21. package/dist/observations/utils.d.ts.map +1 -1
  22. package/dist/patientDetails/PatientDetails.d.ts.map +1 -1
  23. package/dist/patientPrograms/PatientProgramsTable.d.ts.map +1 -1
  24. package/dist/programDetails/ProgramDetails.d.ts.map +1 -1
  25. package/dist/radiologyInvestigation/RadiologyInvestigationTable.d.ts.map +1 -1
  26. package/dist/radiologyInvestigationReport/RadiologyInvestigationReport.d.ts.map +1 -1
  27. package/dist/searchPatient/strategies/AppointmentSearchStrategy.d.ts.map +1 -1
  28. package/dist/searchPatient/strategies/AttributeSearchStrategy.d.ts.map +1 -1
  29. package/dist/searchPatient/strategies/NameOrIdSearchStrategy.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/FormsTable-mzSugDHQ.js +0 -426
  32. package/dist/Observations-DsWnt3nO.js +0 -172
@@ -1,172 +0,0 @@
1
- import { jsx as l, jsxs as S } from "react/jsx-runtime";
2
- import { k as w, l as C, m as M, Z as Q, G as V, X as q, e as G, d as K, u as P, a as j, n as H, o as X, h as Z, f as z, p as J, s as Y, r as W, t as x } from "./index-HMYBr9oP.js";
3
- import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as $, useMemo as E } from "react";
5
- import { useTranslation as D } from "react-i18next";
6
- const U = (t, c, i, d, a) => {
7
- const s = M(t, c), o = s.value, r = Q(o);
8
- let n = o;
9
- r === "Image" && (n = /* @__PURE__ */ l(q, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ l(G, { id: `${o}-video`, videoSrc: o })), r === "PDF" && (n = /* @__PURE__ */ l(K, { id: `${o}-pdf`, src: o }));
10
- const u = a("OBSERVATIONS_RECORDED_BY", {
11
- provider: s.provider
12
- }), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = d ? `${d}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
13
- return /* @__PURE__ */ l(
14
- V,
15
- {
16
- header: s.header,
17
- value: n,
18
- info: u,
19
- id: f,
20
- testId: f,
21
- ariaLabel: f
22
- },
23
- `obs-${t.id}`
24
- );
25
- }, oe = (t, c, i, d, a, s) => /* @__PURE__ */ l(
26
- C,
27
- {
28
- title: t.display,
29
- id: `grouped-obs-${t.display}-${d}`,
30
- open: i,
31
- children: t.members?.map(
32
- (o, r) => U(o, r, a, s, c)
33
- )
34
- },
35
- `grouped-obs-${t.id}`
36
- ), re = ({
37
- groupedData: t,
38
- title: c = ""
39
- }) => {
40
- const { t: i } = D(), d = (a, s, o) => {
41
- const r = w(a.encounterDetails, i);
42
- return /* @__PURE__ */ S(
43
- C,
44
- {
45
- title: r,
46
- id: `encounter-${a.encounterId}`,
47
- open: s,
48
- children: [
49
- a.observations.map(
50
- (n, u) => U(n, u, o, c, i)
51
- ),
52
- a.groupedObservations.map(
53
- (n, u) => oe(
54
- n,
55
- i,
56
- s,
57
- u,
58
- o,
59
- c
60
- )
61
- )
62
- ]
63
- },
64
- `encounter-${a.encounterId}`
65
- );
66
- };
67
- return /* @__PURE__ */ l(
68
- "div",
69
- {
70
- id: "obs-by-encounter",
71
- "data-testid": "obs-by-encounter-test-id",
72
- "aria-label": "obs-by-encounter-aria-label",
73
- children: t.map(
74
- (a, s) => d(a, s === 0, s)
75
- )
76
- }
77
- );
78
- }, ae = "_observations_kfbhq_1", ne = "_title_kfbhq_12", N = {
79
- observations: ae,
80
- title: ne
81
- }, ie = (t) => ["conceptUuid", t], ce = (t, c) => ["observations", t, ...c], me = ({ config: t }) => {
82
- const c = t, { conceptNames: i = [], conceptUuid: d = [] } = c, a = se(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: r } = D(), n = ee({
83
- queries: i.map((e) => ({
84
- queryKey: ie(e),
85
- queryFn: () => H(e),
86
- enabled: !!e
87
- }))
88
- });
89
- $(() => {
90
- n.forEach((e, m) => {
91
- if (e.isError && !a.current.has(m)) {
92
- const g = i[m];
93
- o({
94
- title: r("ERROR_DEFAULT_TITLE"),
95
- message: r("ERROR_FETCHING_CONCEPT", { conceptName: g }),
96
- type: "error"
97
- }), a.current.add(m);
98
- } else e.isError || a.current.delete(m);
99
- });
100
- }, [n, i]);
101
- const u = E(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), b = E(() => [.../* @__PURE__ */ new Set([...u, ...d])], [u, d]), v = E(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
102
- data: p,
103
- isLoading: f,
104
- isError: O,
105
- refetch: T
106
- } = te({
107
- queryKey: ce(s, b),
108
- queryFn: () => X(s, b),
109
- enabled: !!s && b.length > 0 && v
110
- });
111
- Z(
112
- (e) => {
113
- e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
114
- (g) => b.includes(g)
115
- ) && T();
116
- },
117
- [s, T]
118
- ), $(() => {
119
- O && o({
120
- title: r("ERROR_DEFAULT_TITLE"),
121
- message: r("ERROR_FETCHING_OBSERVATIONS"),
122
- type: "error"
123
- });
124
- }, [O]);
125
- const R = E(() => {
126
- if (!p) return [];
127
- const e = z(p), m = J(e);
128
- return Y(m);
129
- }, [p]), B = [
130
- { key: "name", header: "name" },
131
- { key: "value", header: "value" },
132
- { key: "form", header: "form" }
133
- ], I = f || !v, _ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? r("NO_OBSERVATIONS_FOUND") : void 0, k = R.length > 0 && !I && !_, y = c.titleTranslationKey, h = y ? r(y) : "";
134
- return /* @__PURE__ */ S(
135
- "div",
136
- {
137
- id: "observations",
138
- "data-testid": y ? `observations-${h}` : "observations",
139
- "aria-label": "observations-aria-label",
140
- className: N.observations,
141
- children: [
142
- /* @__PURE__ */ l(
143
- W,
144
- {
145
- id: "observations-title",
146
- testId: y ? `observations-title-${h}` : "observations-title",
147
- title: h,
148
- className: N.title,
149
- children: /* @__PURE__ */ l("p", { children: h })
150
- }
151
- ),
152
- k ? /* @__PURE__ */ l(re, { groupedData: R, title: h }) : /* @__PURE__ */ l(
153
- x,
154
- {
155
- headers: B,
156
- rows: [],
157
- ariaLabel: r("OBSERVATIONS"),
158
- loading: I,
159
- errorStateMessage: F,
160
- emptyStateMessage: L,
161
- dataTestId: "observations-table"
162
- }
163
- )
164
- ]
165
- }
166
- );
167
- };
168
- export {
169
- ie as conceptUuidQueryKeys,
170
- me as default,
171
- ce as observationsQueryKeys
172
- };