@bahmni/widgets 0.0.1-dev.147 → 0.0.1-dev.149

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 (34) hide show
  1. package/dist/{FormsTable-j_uo-nfJ.js → FormsTable-DGv2VghU.js} +1 -1
  2. package/dist/Observations-C7Z9vG6y.js +164 -0
  3. package/dist/genericServiceRequest/GenericServiceRequestTable.d.ts.map +1 -1
  4. package/dist/genericServiceRequest/models.d.ts +7 -0
  5. package/dist/genericServiceRequest/models.d.ts.map +1 -1
  6. package/dist/{index-dsfoXKAL.js → index-Bn92GwzX.js} +18027 -17559
  7. package/dist/index.css +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +16 -15
  11. package/dist/labinvestigation/LabInvestigation.d.ts.map +1 -1
  12. package/dist/labinvestigation/models.d.ts +2 -0
  13. package/dist/labinvestigation/models.d.ts.map +1 -1
  14. package/dist/labinvestigation/utils.d.ts +2 -16
  15. package/dist/labinvestigation/utils.d.ts.map +1 -1
  16. package/dist/observations/__mocks__/observationTestData.d.ts.map +1 -1
  17. package/dist/observations/components/ObsByEncounter.d.ts.map +1 -1
  18. package/dist/observations/models.d.ts +4 -11
  19. package/dist/observations/models.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/radiologyInvestigation/RadiologyInvestigationTable.d.ts.map +1 -1
  23. package/dist/radiologyInvestigation/__mocks__/mocks.d.ts.map +1 -1
  24. package/dist/radiologyInvestigation/models.d.ts +4 -0
  25. package/dist/radiologyInvestigation/models.d.ts.map +1 -1
  26. package/dist/radiologyInvestigation/utils.d.ts.map +1 -1
  27. package/dist/radiologyInvestigationReport/RadiologyInvestigationReport.d.ts +7 -0
  28. package/dist/radiologyInvestigationReport/RadiologyInvestigationReport.d.ts.map +1 -0
  29. package/dist/radiologyInvestigationReport/index.d.ts +2 -0
  30. package/dist/radiologyInvestigationReport/index.d.ts.map +1 -0
  31. package/dist/utils/Investigations.d.ts +18 -0
  32. package/dist/utils/Investigations.d.ts.map +1 -0
  33. package/package.json +1 -1
  34. package/dist/Observations-GyA59xrS.js +0 -339
@@ -1,5 +1,5 @@
1
1
  import { jsxs as b, jsx as a, Fragment as Y } from "react/jsx-runtime";
2
- import { c as L, u as W, o as X, h as Z, f as ee, p as te, a as re, g as oe, b as ae, J as U, L as se, H as ne, d as de, t as ce, e as q, l as le } from "./index-dsfoXKAL.js";
2
+ import { c as L, u as W, o as X, h as Z, f as ee, p as te, a as re, g as oe, b as ae, J as U, L as se, H as ne, d as de, t as ce, e as q, l as le } from "./index-Bn92GwzX.js";
3
3
  import { useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as H, useMemo as g, useCallback as M } from "react";
5
5
  import { useTranslation as me } from "react-i18next";
@@ -0,0 +1,164 @@
1
+ import { jsx as d, jsxs as $ } from "react/jsx-runtime";
2
+ import { i as V, V as N, j as q, D as k, _ as w, x as K, k as Q, u as M, m as G, n as j, r as H, q as P, s as J, v as Y, O as x, J as z } from "./index-Bn92GwzX.js";
3
+ import { useQueries as W, useQuery as X } from "@tanstack/react-query";
4
+ import { useRef as Z, useEffect as _, useMemo as O } from "react";
5
+ import { useTranslation as S } from "react-i18next";
6
+ const D = (e, c, a, l, t) => {
7
+ const s = q(e, c), o = s.value, r = k(o);
8
+ let n = o;
9
+ r === "Image" && (n = /* @__PURE__ */ d(K, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ d(Q, { id: `${o}-video`, videoSrc: o }));
10
+ const u = t("OBSERVATIONS_RECORDED_BY", {
11
+ provider: s.provider
12
+ }), m = e.display, b = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = l ? `${l}-${b}-${m}-${a}-${c}` : `${b}-${m}-${a}-${c}`;
13
+ return /* @__PURE__ */ d(
14
+ w,
15
+ {
16
+ header: s.header,
17
+ value: n,
18
+ info: u,
19
+ id: y,
20
+ testId: y,
21
+ ariaLabel: y
22
+ },
23
+ `obs-${e.id}`
24
+ );
25
+ }, ee = (e, c, a, l, t, s) => /* @__PURE__ */ d(
26
+ N,
27
+ {
28
+ title: e.display,
29
+ id: `grouped-obs-${e.display}-${l}`,
30
+ open: a,
31
+ children: e.members?.map(
32
+ (o, r) => D(o, r, t, s, c)
33
+ )
34
+ },
35
+ `grouped-obs-${e.id}`
36
+ ), te = ({
37
+ groupedData: e,
38
+ title: c = ""
39
+ }) => {
40
+ const { t: a } = S(), l = (t, s, o) => {
41
+ const r = V(t.encounterDetails, a);
42
+ return /* @__PURE__ */ $(
43
+ N,
44
+ {
45
+ title: r,
46
+ id: `encounter-${t.encounterId}`,
47
+ open: s,
48
+ children: [
49
+ t.observations.map(
50
+ (n, u) => D(n, u, o, c, a)
51
+ ),
52
+ t.groupedObservations.map(
53
+ (n, u) => ee(
54
+ n,
55
+ a,
56
+ s,
57
+ u,
58
+ o,
59
+ c
60
+ )
61
+ )
62
+ ]
63
+ },
64
+ `encounter-${t.encounterId}`
65
+ );
66
+ };
67
+ return /* @__PURE__ */ d(
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: e.map(
74
+ (t, s) => l(t, s === 0, s)
75
+ )
76
+ }
77
+ );
78
+ }, se = "_observations_kfbhq_1", oe = "_title_kfbhq_12", I = {
79
+ observations: se,
80
+ title: oe
81
+ }, re = (e) => ["conceptUuid", e], ae = (e, c) => ["observations", e, ...c], ue = ({ config: e }) => {
82
+ const c = e, { conceptNames: a = [], conceptUuid: l = [] } = c, t = Z(/* @__PURE__ */ new Set()), s = M(), { addNotification: o } = G(), { t: r } = S(), n = W({
83
+ queries: a.map((i) => ({
84
+ queryKey: re(i),
85
+ queryFn: () => j(i),
86
+ enabled: !!i
87
+ }))
88
+ });
89
+ _(() => {
90
+ n.forEach((i, v) => {
91
+ if (i.isError && !t.current.has(v)) {
92
+ const L = a[v];
93
+ o({
94
+ title: r("ERROR_DEFAULT_TITLE"),
95
+ message: r("ERROR_FETCHING_CONCEPT", { conceptName: L }),
96
+ type: "error"
97
+ }), t.current.add(v);
98
+ } else i.isError || t.current.delete(v);
99
+ });
100
+ }, [n, a]);
101
+ const u = O(() => n.map((i) => i.data?.uuid).filter((i) => !!i), [n]), m = O(() => [.../* @__PURE__ */ new Set([...u, ...l])], [u, l]), p = O(() => a.length === 0 ? !0 : n.every((i) => !i.isLoading), [n, a.length]), {
102
+ data: b,
103
+ isLoading: y,
104
+ isError: h
105
+ } = X({
106
+ queryKey: ae(s, m),
107
+ queryFn: () => H(s, m),
108
+ enabled: !!s && m.length > 0 && p
109
+ });
110
+ _(() => {
111
+ h && o({
112
+ title: r("ERROR_DEFAULT_TITLE"),
113
+ message: r("ERROR_FETCHING_OBSERVATIONS"),
114
+ type: "error"
115
+ });
116
+ }, [h]);
117
+ const g = O(() => {
118
+ if (!b) return [];
119
+ const i = P(b), v = J(i);
120
+ return Y(v);
121
+ }, [b]), U = [
122
+ { key: "name", header: "name" },
123
+ { key: "value", header: "value" },
124
+ { key: "form", header: "form" }
125
+ ], R = y || !p, T = h && p, B = (!b || b.entry?.length === 0 || m.length === 0) && p, C = T ? r("ERROR_FETCHING_OBSERVATIONS") : null, A = B ? r("NO_OBSERVATIONS_FOUND") : void 0, F = g.length > 0 && !R && !T, f = c.titleTranslationKey, E = f ? r(f) : "";
126
+ return /* @__PURE__ */ $(
127
+ "div",
128
+ {
129
+ id: "observations",
130
+ "data-testid": f ? `observations-${E}` : "observations",
131
+ "aria-label": "observations-aria-label",
132
+ className: I.observations,
133
+ children: [
134
+ /* @__PURE__ */ d(
135
+ x,
136
+ {
137
+ id: "observations-title",
138
+ testId: f ? `observations-title-${E}` : "observations-title",
139
+ title: E,
140
+ className: I.title,
141
+ children: /* @__PURE__ */ d("p", { children: E })
142
+ }
143
+ ),
144
+ F ? /* @__PURE__ */ d(te, { groupedData: g, title: E }) : /* @__PURE__ */ d(
145
+ z,
146
+ {
147
+ headers: U,
148
+ rows: [],
149
+ ariaLabel: r("OBSERVATIONS"),
150
+ loading: R,
151
+ errorStateMessage: C,
152
+ emptyStateMessage: A,
153
+ dataTestId: "observations-table"
154
+ }
155
+ )
156
+ ]
157
+ }
158
+ );
159
+ };
160
+ export {
161
+ re as conceptUuidQueryKeys,
162
+ ue as default,
163
+ ae as observationsQueryKeys
164
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4OrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmOrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -1,3 +1,10 @@
1
+ export declare enum ServiceRequestStatus {
2
+ Active = "active",
3
+ Completed = "completed",
4
+ Revoked = "revoked",
5
+ Unknown = "unknown"
6
+ }
7
+ export declare const STATUS_TRANSLATION_MAP: Record<ServiceRequestStatus, string>;
1
8
  export interface ServiceRequestViewModel {
2
9
  id: string;
3
10
  testName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/models.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAKvE,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}