@bahmni/widgets 0.0.1-dev.106 → 0.0.1-dev.108

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 { d as s, C as t, g as o, G as r, j as g, M as n, N as l, m as d, P as c, k as P, R as v, S as b, U as T, V as u, e as W, x as f, w as y, q as m, t as C, v as S, r as U, y as p, n as A, l as N, u as R, o as h } from "./index-Dvpa5LYh.js";
1
+ import { f as s, C as t, D as o, G as r, L as g, M as n, N as l, m as d, P as c, k as P, j as v, S as b, U as T, V as f, g as u, z as W, w as m, q as y, t as C, v as S, r as U, B as p, n as A, l as D, u as N, o as h } from "./index-BaqvPC9o.js";
2
2
  import "react";
3
3
  export {
4
4
  s as AllergiesTable,
@@ -14,17 +14,17 @@ export {
14
14
  v as RadiologyInvestigationTable,
15
15
  b as SearchPatient,
16
16
  T as UserPrivilegeProvider,
17
- u as VitalFlowSheet,
18
- W as conditionsQueryKeys,
19
- f as getAllWidgetConfigs,
20
- y as getAllWidgetTypes,
21
- m as getWidget,
17
+ f as VitalFlowSheet,
18
+ u as conditionsQueryKeys,
19
+ W as getAllWidgetConfigs,
20
+ m as getAllWidgetTypes,
21
+ y as getWidget,
22
22
  C as getWidgetConfig,
23
23
  S as hasWidget,
24
24
  U as registerWidget,
25
25
  p as resetWidgetRegistry,
26
26
  A as useActivePractitioner,
27
- N as useNotification,
28
- R as usePatientUUID,
27
+ D as useNotification,
28
+ N as usePatientUUID,
29
29
  h as useUserPrivilege
30
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/widgets",
3
- "version": "0.0.1-dev.106",
3
+ "version": "0.0.1-dev.108",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,261 +0,0 @@
1
- import { jsxs as p, jsx as e, Fragment as z } from "react/jsx-runtime";
2
- import { u as Q, _ as Y, b as J, E as W, h as X, i as Z, D as ee, L as S, f as re, p as oe, A as ae, a as te, c as V, s as ne } from "./index-Dvpa5LYh.js";
3
- import { useQuery as f } from "@tanstack/react-query";
4
- import { useState as x, useMemo as u, useCallback as g } from "react";
5
- import { createPortal as se } from "react-dom";
6
- import { useTranslation as ce } from "react-i18next";
7
- const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie = "_formContent_ua0cn_18", le = "_formDetailsContainer_ua0cn_25", ue = "_observation_ua0cn_30", pe = "_groupContainer_ua0cn_39", _e = "_rowContainer_ua0cn_43", be = "_groupLabel_ua0cn_48", fe = "_rowLabel_ua0cn_58", ge = "_rowValue_ua0cn_67", he = "_groupMembers_ua0cn_75", Ne = "_memberRow_ua0cn_81", ye = "_memberLabel_ua0cn_86", Me = "_memberValue_ua0cn_94", Le = "_commentSection_ua0cn_102", De = "_commentText_ua0cn_108", Oe = "_nestedGroup_ua0cn_117", ve = "_nestedGroupLabel_ua0cn_124", Ce = "_nestedGroupMembers_ua0cn_133", o = {
8
- formsTableBody: de,
9
- customAccordianItem: me,
10
- formContent: ie,
11
- formDetailsContainer: le,
12
- observation: ue,
13
- groupContainer: pe,
14
- rowContainer: _e,
15
- groupLabel: be,
16
- rowLabel: fe,
17
- rowValue: ge,
18
- groupMembers: he,
19
- memberRow: Ne,
20
- memberLabel: ye,
21
- memberValue: Me,
22
- commentSection: Le,
23
- commentText: De,
24
- nestedGroup: Oe,
25
- nestedGroupLabel: ve,
26
- nestedGroupMembers: Ce
27
- }, U = ({
28
- member: r,
29
- depth: m = 0
30
- }) => {
31
- const i = r.groupMembers && r.groupMembers.length > 0, a = r.conceptNameToDisplay ?? r.concept?.shortName ?? r.concept?.name;
32
- return i ? /* @__PURE__ */ p("div", { className: o.nestedGroup, children: [
33
- /* @__PURE__ */ e(
34
- "div",
35
- {
36
- className: o.nestedGroupLabel,
37
- style: { paddingLeft: `${m * 16}px` },
38
- children: a
39
- }
40
- ),
41
- /* @__PURE__ */ e("div", { className: o.nestedGroupMembers, children: r.groupMembers?.map((l, _) => /* @__PURE__ */ e(
42
- U,
43
- {
44
- member: l,
45
- depth: m + 1
46
- },
47
- `${l.concept.uuid}`
48
- )) })
49
- ] }) : /* @__PURE__ */ p(
50
- "div",
51
- {
52
- className: o.memberRow,
53
- style: { paddingLeft: `${m * 16}px` },
54
- children: [
55
- /* @__PURE__ */ e("p", { className: o.memberLabel, children: a }),
56
- /* @__PURE__ */ e("p", { className: o.memberValue, children: r.valueAsString })
57
- ]
58
- }
59
- );
60
- }, Re = ({
61
- observation: r,
62
- index: m
63
- }) => {
64
- const i = r.groupMembers && r.groupMembers.length > 0;
65
- return /* @__PURE__ */ p(
66
- "div",
67
- {
68
- className: o.observation,
69
- children: [
70
- /* @__PURE__ */ p(
71
- "div",
72
- {
73
- className: i ? o.groupContainer : o.rowContainer,
74
- children: [
75
- /* @__PURE__ */ e("p", { className: i ? o.groupLabel : o.rowLabel, children: r.conceptNameToDisplay }),
76
- i ? /* @__PURE__ */ e("div", { className: o.groupMembers, children: r.groupMembers?.map((a, l) => /* @__PURE__ */ e(
77
- U,
78
- {
79
- member: a,
80
- depth: 0
81
- },
82
- `${a.concept.uuid}`
83
- )) }) : /* @__PURE__ */ e("p", { className: o.rowValue, children: r.valueAsString })
84
- ]
85
- }
86
- ),
87
- r.comment && /* @__PURE__ */ e("div", { className: o.commentSection, children: /* @__PURE__ */ p("span", { className: o.commentText, children: [
88
- r.comment,
89
- r.providers?.[0]?.name && ` - by ${r.providers[0].name}`
90
- ] }) })
91
- ]
92
- },
93
- `${r.concept.uuid}-${m}`
94
- );
95
- }, Ie = ({
96
- episodeOfCareUuids: r,
97
- encounterUuids: m,
98
- config: i
99
- }) => {
100
- const { t: a } = ce(), l = Q(), [_, L] = x(!1), [n, D] = x(null), $ = i?.numberOfVisits, {
101
- data: h = [],
102
- isLoading: O,
103
- isError: v,
104
- error: q
105
- } = f({
106
- queryKey: ["forms", l, r],
107
- queryFn: () => Y(l, void 0, $),
108
- enabled: !!l
109
- }), C = u(() => !m || m.length === 0 ? h : h.filter(
110
- (t) => m.includes(t.encounterUuid)
111
- ), [h, m]), { data: R = [] } = f({
112
- queryKey: ["observationForms"],
113
- queryFn: J
114
- }), A = g(
115
- (t) => R.find((c) => c.name === t)?.uuid,
116
- [R]
117
- ), N = u(() => {
118
- if (n)
119
- return A(n.formName);
120
- }, [n, A]), {
121
- data: Ae,
122
- isLoading: k,
123
- error: F
124
- } = f({
125
- queryKey: ["formMetadata", N],
126
- queryFn: () => W(N),
127
- enabled: !!N && _
128
- }), {
129
- data: y,
130
- isLoading: H,
131
- error: w
132
- } = f({
133
- queryKey: ["formsEncounter", n?.encounterUuid],
134
- queryFn: () => X(n.encounterUuid, !0),
135
- enabled: !!n?.encounterUuid && _
136
- }), T = u(() => !y?.observations || !n?.formName ? [] : y.observations.filter(
137
- (d) => "formFieldPath" in d && typeof d.formFieldPath == "string" && d.formFieldPath.includes(n.formName)
138
- ), [y?.observations, n?.formName]), E = u(
139
- () => [
140
- { key: "recordedOn", header: a("FORM_RECORDED_ON") },
141
- { key: "recordedBy", header: a("FORM_RECORDED_BY") }
142
- ],
143
- [a]
144
- ), P = u(
145
- () => [
146
- { key: "recordedOn", sortable: !0 },
147
- { key: "recordedBy", sortable: !0 }
148
- ],
149
- []
150
- ), B = u(() => {
151
- const t = C.reduce(
152
- (c, s) => {
153
- const b = s.formName;
154
- c[b] ??= [];
155
- const M = s.providers.map((K) => K.providerName).filter(Boolean).join(", ");
156
- return c[b].push({
157
- id: s.encounterUuid,
158
- formName: s.formName,
159
- recordedOn: Z(s.encounterDateTime, a, ne).formattedResult,
160
- recordedBy: M ?? "--",
161
- encounterDateTime: s.encounterDateTime,
162
- encounterUuid: s.encounterUuid
163
- }), c;
164
- },
165
- {}
166
- );
167
- return Object.entries(t).map(
168
- ([c, s]) => ({
169
- formName: c,
170
- records: s.sort(
171
- (b, M) => M.encounterDateTime - b.encounterDateTime
172
- )
173
- })
174
- ).sort((c, s) => c.formName.localeCompare(s.formName));
175
- }, [C, a]), G = g((t) => {
176
- D(t), L(!0);
177
- }, []), j = g(() => {
178
- L(!1), D(null);
179
- }, []), I = g(
180
- (t, d) => {
181
- switch (d) {
182
- case "recordedOn":
183
- return /* @__PURE__ */ e(ee, { onClick: () => G(t), children: t.recordedOn });
184
- case "recordedBy":
185
- return t.recordedBy;
186
- default:
187
- return null;
188
- }
189
- },
190
- [G]
191
- );
192
- return /* @__PURE__ */ p(z, { children: [
193
- /* @__PURE__ */ e("div", { "data-testid": "forms-table", children: O || v || B.length === 0 ? /* @__PURE__ */ e(
194
- S,
195
- {
196
- headers: E,
197
- ariaLabel: a("FORMS_HEADING"),
198
- rows: [],
199
- loading: O,
200
- errorStateMessage: v ? q?.message : void 0,
201
- emptyStateMessage: a("FORMS_UNAVAILABLE"),
202
- renderCell: I,
203
- className: o.formsTableBody,
204
- "data-testid": "sortable-data-table"
205
- }
206
- ) : /* @__PURE__ */ e(re, { align: "start", children: B.map((t, d) => {
207
- const { formName: c, records: s } = t;
208
- return /* @__PURE__ */ e(
209
- oe,
210
- {
211
- title: c,
212
- className: o.customAccordianItem,
213
- testId: "accordian-table-title",
214
- open: d === 0,
215
- children: /* @__PURE__ */ e(
216
- S,
217
- {
218
- headers: E,
219
- ariaLabel: a("FORMS_HEADING"),
220
- rows: s,
221
- loading: !1,
222
- errorStateMessage: "",
223
- sortable: P,
224
- emptyStateMessage: a("FORMS_UNAVAILABLE"),
225
- renderCell: I,
226
- className: o.formsTableBody,
227
- "data-testid": "sortable-data-table"
228
- }
229
- )
230
- },
231
- c
232
- );
233
- }) }) }),
234
- _ && n && se(
235
- /* @__PURE__ */ e(
236
- ae,
237
- {
238
- open: _,
239
- onRequestClose: j,
240
- modalHeading: n.formName,
241
- modalLabel: `${n.recordedOn} | ${n.recordedBy}`,
242
- passiveModal: !0,
243
- size: "md",
244
- testId: "form-details-modal",
245
- children: /* @__PURE__ */ e("div", { className: o.formContent, children: k || H ? /* @__PURE__ */ e(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ e("div", { children: V(F).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ e("div", { children: V(w).message ?? a("ERROR_FETCHING_FORM_DATA") }) : T.length > 0 ? /* @__PURE__ */ e("div", { className: o.formDetailsContainer, children: T.map((t, d) => /* @__PURE__ */ e(
246
- Re,
247
- {
248
- observation: t,
249
- index: d
250
- },
251
- `${t.concept.uuid}`
252
- )) }) : /* @__PURE__ */ e("div", { children: a("NO_FORM_DATA_AVAILABLE") }) })
253
- }
254
- ),
255
- document.getElementById("actionAreaLayout") ?? document.body
256
- )
257
- ] });
258
- };
259
- export {
260
- Ie as default
261
- };