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