@bahmni/widgets 0.0.1-dev.152 → 0.0.1-dev.155

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 { Y as t, W as s, w as o, y as r, C as n, z as g, G as l, E as P, M as c, N as d, Q as v, P as T, I as b, K as W, B as m, R as p, S as A, U as f, F as u, a3 as C, a2 as R, $ as y, a0 as I, a1 as S, Z as U, a4 as D, X as N, m as h, u as w, T as x } from "./index-CImzN7Zl.js";
1
+ import { Y as t, W as s, x as o, y as r, z as n, E as g, I as l, L as P, M as c, O as d, Q as v, P as T, J as b, K as W, G as p, F as A, S as f, U as m, V as u, a4 as y, a3 as C, a0 as I, a1 as R, a2 as S, Z as U, a5 as D, X as h, q as x, u as N, T as q } from "./index-veQFQARd.js";
2
2
  import "react";
3
3
  export {
4
4
  t as ActivePractitionerContext,
@@ -15,20 +15,20 @@ export {
15
15
  T as PatientDetails,
16
16
  b as PatientProgramsTable,
17
17
  W as ProgramDetails,
18
- m as RadiologyInvestigationReport,
19
- p as RadiologyInvestigationTable,
20
- A as SearchPatient,
21
- f as UserPrivilegeProvider,
18
+ p as RadiologyInvestigationReport,
19
+ A as RadiologyInvestigationTable,
20
+ f as SearchPatient,
21
+ m as UserPrivilegeProvider,
22
22
  u as VitalFlowSheet,
23
- C as getAllWidgetConfigs,
24
- R as getAllWidgetTypes,
25
- y as getWidget,
26
- I as getWidgetConfig,
23
+ y as getAllWidgetConfigs,
24
+ C as getAllWidgetTypes,
25
+ I as getWidget,
26
+ R as getWidgetConfig,
27
27
  S as hasWidget,
28
28
  U as registerWidget,
29
29
  D as resetWidgetRegistry,
30
- N as useActivePractitioner,
31
- h as useNotification,
32
- w as usePatientUUID,
33
- x as useUserPrivilege
30
+ h as useActivePractitioner,
31
+ x as useNotification,
32
+ N as usePatientUUID,
33
+ q as useUserPrivilege
34
34
  };
@@ -1,3 +1,5 @@
1
1
  export { default as Observations } from './Observations';
2
2
  export type { ObservationConfig } from './Observations';
3
+ export { extractObservationsFromBundle } from './utils';
4
+ export type { ExtractedObservationsResult } from './models';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AACxD,YAAY,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/observations/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,SAAS,CAAC;AACpE,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,UAAU,CAAC;AASlB,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,gBAAgB,GAAG,SAAS,EAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,KACzB,MAMF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,aAAa,oBAAoB,KAChC,MAOF,CAAC;AAoDF,eAAO,MAAM,6BAA6B,GACxC,aAAa,oBAAoB,EACjC,OAAO,MAAM;;;;;CAQd,CAAC;AAiKF,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,GACtC,2BAA2B,CAuC7B;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,2BAA2B,GAClC,uBAAuB,EAAE,CA8C3B;AAED,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,uBAAuB,EAAE,GACtC,uBAAuB,EAAE,CAW3B"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/observations/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,SAAS,CAAC;AACpE,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,UAAU,CAAC;AASlB,eAAO,MAAM,oBAAoB,GAC/B,kBAAkB,gBAAgB,GAAG,SAAS,EAC9C,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,KACzB,MAMF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,aAAa,oBAAoB,KAChC,MAOF,CAAC;AAoDF,eAAO,MAAM,6BAA6B,GACxC,aAAa,oBAAoB,EACjC,OAAO,MAAM;;;;;CAQd,CAAC;AAqLF,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC,GACtC,2BAA2B,CAuC7B;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,2BAA2B,GAClC,uBAAuB,EAAE,CA8C3B;AAED,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,uBAAuB,EAAE,GACtC,uBAAuB,EAAE,CAW3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/widgets",
3
- "version": "0.0.1-dev.152",
3
+ "version": "0.0.1-dev.155",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,368 +0,0 @@
1
- import { jsxs as b, jsx as a, Fragment as X } from "react/jsx-runtime";
2
- import { c as M, u as Z, o as ee, h as te, f as re, p as oe, a as ae, A as se, g as ne, b as ce, J as q, L as de, H as le, d as me, t as ie, e as H, l as ue } from "./index-CImzN7Zl.js";
3
- import { useQueryClient as pe, useQuery as h } from "@tanstack/react-query";
4
- import { useState as k, useMemo as g, useCallback as y } from "react";
5
- import { useTranslation as be } from "react-i18next";
6
- const _e = "_formsTableBody_1pd36_1", fe = "_customAccordianItem_1pd36_6", ge = "_formContent_1pd36_18", Ne = "_formDetailsContainer_1pd36_25", $e = "_observation_1pd36_30", he = "_groupContainer_1pd36_39", ye = "_rowContainer_1pd36_43", Me = "_groupLabel_1pd36_48", Le = "_rowLabel_1pd36_58", Ae = "_rowValue_1pd36_67", De = "_groupMembers_1pd36_75", Te = "_memberRow_1pd36_81", Oe = "_memberLabel_1pd36_86", Re = "_memberValue_1pd36_94", Ce = "_abnormalValue_1pd36_102", we = "_commentSection_1pd36_110", Fe = "_commentText_1pd36_116", ve = "_nestedGroup_1pd36_125", Ee = "_nestedGroupLabel_1pd36_132", Ie = "_nestedGroupMembers_1pd36_141", o = {
7
- formsTableBody: _e,
8
- customAccordianItem: fe,
9
- formContent: ge,
10
- formDetailsContainer: Ne,
11
- observation: $e,
12
- groupContainer: he,
13
- rowContainer: ye,
14
- groupLabel: Me,
15
- rowLabel: Le,
16
- rowValue: Ae,
17
- groupMembers: De,
18
- memberRow: Te,
19
- memberLabel: Oe,
20
- memberValue: Re,
21
- abnormalValue: Ce,
22
- commentSection: we,
23
- commentText: Fe,
24
- nestedGroup: ve,
25
- nestedGroupLabel: Ee,
26
- nestedGroupMembers: Ie
27
- }, Be = "ABNORMAL", P = (e) => {
28
- const n = e.concept?.units, d = e.concept?.lowNormal, t = e.concept?.hiNormal, i = d != null, c = t != null, l = i && c ? ` (${d} - ${t})` : i ? ` (>${d})` : c ? ` (<${t})` : "", r = e.interpretation && e.interpretation.toUpperCase() === Be;
29
- return { units: n, rangeString: l, isAbnormal: r };
30
- }, K = ({
31
- member: e,
32
- depth: n = 0,
33
- memberIndex: d = 0,
34
- formName: t = ""
35
- }) => {
36
- const i = e.groupMembers && e.groupMembers.length > 0, c = e.conceptNameToDisplay ?? e.concept?.shortName ?? e.concept?.name, l = t ? `${t}-` : "";
37
- if (i)
38
- return /* @__PURE__ */ b(
39
- "div",
40
- {
41
- className: o.nestedGroup,
42
- "data-testid": `${l}obs-nested-group-${c}-${d}`,
43
- children: [
44
- /* @__PURE__ */ a(
45
- "div",
46
- {
47
- className: o.nestedGroupLabel,
48
- "data-testid": `${l}obs-nested-group-label-${c}-${d}`,
49
- style: { paddingLeft: `${n * 16}px` },
50
- children: c
51
- }
52
- ),
53
- /* @__PURE__ */ a(
54
- "div",
55
- {
56
- className: o.nestedGroupMembers,
57
- "data-testid": `${l}obs-nested-group-members-${c}-${d}`,
58
- children: e.groupMembers?.map((N, L) => /* @__PURE__ */ a(
59
- K,
60
- {
61
- member: N,
62
- depth: n + 1,
63
- memberIndex: L,
64
- formName: t
65
- },
66
- `${N.concept.uuid}`
67
- ))
68
- }
69
- )
70
- ]
71
- }
72
- );
73
- const { units: r, rangeString: _, isAbnormal: f } = P(e);
74
- return /* @__PURE__ */ b(
75
- "div",
76
- {
77
- className: o.memberRow,
78
- "data-testid": `${l}obs-member-row-${c}-${d}`,
79
- style: { paddingLeft: `${n * 16}px` },
80
- children: [
81
- /* @__PURE__ */ b(
82
- "p",
83
- {
84
- className: M(
85
- o.memberLabel,
86
- f ? o.abnormalValue : ""
87
- ),
88
- "data-testid": `${l}obs-member-label-${c}-${d}`,
89
- children: [
90
- c,
91
- _
92
- ]
93
- }
94
- ),
95
- /* @__PURE__ */ b(
96
- "p",
97
- {
98
- className: M(
99
- o.memberValue,
100
- f ? o.abnormalValue : ""
101
- ),
102
- "data-testid": `${l}obs-member-value-${c}-${d}`,
103
- children: [
104
- e.valueAsString,
105
- r && ` ${r}`
106
- ]
107
- }
108
- )
109
- ]
110
- }
111
- );
112
- }, Ve = ({
113
- observation: e,
114
- index: n,
115
- formName: d = ""
116
- }) => {
117
- const t = e.groupMembers && e.groupMembers.length > 0, { units: i, rangeString: c, isAbnormal: l } = P(e), r = d ? `${d}-` : "";
118
- return /* @__PURE__ */ b(
119
- "div",
120
- {
121
- className: o.observation,
122
- "data-testid": `${r}observation-item-${e.conceptNameToDisplay}-${n}`,
123
- children: [
124
- /* @__PURE__ */ b(
125
- "div",
126
- {
127
- className: t ? o.groupContainer : o.rowContainer,
128
- "data-testid": `${r}observation-container-${e.conceptNameToDisplay}-${n}`,
129
- children: [
130
- /* @__PURE__ */ b(
131
- "p",
132
- {
133
- className: M(
134
- t ? o.groupLabel : o.rowLabel,
135
- !t && l ? o.abnormalValue : ""
136
- ),
137
- "data-testid": `${r}observation-label-${e.conceptNameToDisplay}-${n}`,
138
- children: [
139
- e.conceptNameToDisplay,
140
- !t && c && /* @__PURE__ */ a("span", { className: o.rangeInfo, children: c })
141
- ]
142
- }
143
- ),
144
- t ? /* @__PURE__ */ a(
145
- "div",
146
- {
147
- className: o.groupMembers,
148
- "data-testid": `${r}observation-group-members-${e.conceptNameToDisplay}-${n}`,
149
- children: e.groupMembers?.map((_, f) => /* @__PURE__ */ a(
150
- K,
151
- {
152
- member: _,
153
- depth: 0,
154
- memberIndex: f,
155
- formName: d
156
- },
157
- `${_.concept.uuid}`
158
- ))
159
- }
160
- ) : /* @__PURE__ */ b(
161
- "p",
162
- {
163
- className: M(
164
- o.rowValue,
165
- l ? o.abnormalValue : ""
166
- ),
167
- "data-testid": `${r}observation-value-${e.conceptNameToDisplay}-${n}`,
168
- children: [
169
- e.valueAsString,
170
- i && ` ${i}`
171
- ]
172
- }
173
- )
174
- ]
175
- }
176
- ),
177
- e.comment && /* @__PURE__ */ a(
178
- "div",
179
- {
180
- className: o.commentSection,
181
- "data-testid": `${r}observation-comment-${e.conceptNameToDisplay}-${n}`,
182
- children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
183
- e.comment,
184
- e.providers?.[0]?.name && ` - by ${e.providers[0].name}`
185
- ] })
186
- }
187
- )
188
- ]
189
- },
190
- `${e.concept.uuid}-${n}`
191
- );
192
- }, Pe = ({
193
- episodeOfCareUuids: e,
194
- encounterUuids: n,
195
- config: d
196
- }) => {
197
- const { t } = be(), i = Z(), [c, l] = k(!1), [r, _] = k(null), f = d?.numberOfVisits, N = ee(
198
- e,
199
- n
200
- ), L = pe(), {
201
- data: A = [],
202
- isLoading: R,
203
- isError: C,
204
- error: j,
205
- refetch: Q
206
- } = h({
207
- queryKey: ["forms", i, e],
208
- queryFn: () => te(i, void 0, f),
209
- enabled: !!i && !N
210
- }), w = g(() => !n || n.length === 0 ? A : A.filter(
211
- (s) => n.includes(s.encounterUuid)
212
- ), [A, n]), { data: F = [] } = h({
213
- queryKey: ["observationForms"],
214
- queryFn: () => re()
215
- }), v = y(
216
- (s) => F.find((m) => m.name === s)?.uuid,
217
- [F]
218
- ), D = g(() => {
219
- if (r)
220
- return v(r.formName);
221
- }, [r, v]), {
222
- data: Se,
223
- isLoading: z,
224
- error: E
225
- } = h({
226
- queryKey: ["formMetadata", D],
227
- queryFn: () => oe(D),
228
- enabled: !!D && c
229
- }), {
230
- data: T,
231
- isLoading: J,
232
- error: I
233
- } = h({
234
- queryKey: ["formsEncounter", r?.encounterUuid],
235
- queryFn: () => ae(r.encounterUuid, !0),
236
- enabled: !!r?.encounterUuid && c
237
- });
238
- se(
239
- (s) => {
240
- s.patientUUID === i && s.updatedConcepts.size > 0 && (Q(), L.invalidateQueries({ queryKey: ["formsEncounter"] }));
241
- },
242
- [i]
243
- );
244
- const B = g(() => !T?.observations || !r?.formName ? [] : T.observations.filter(
245
- (p) => "formFieldPath" in p && typeof p.formFieldPath == "string" && p.formFieldPath.includes(r.formName)
246
- ), [T?.observations, r?.formName]), V = g(
247
- () => [
248
- { key: "recordedOn", header: t("FORM_RECORDED_ON") },
249
- { key: "recordedBy", header: t("FORM_RECORDED_BY") }
250
- ],
251
- [t]
252
- ), x = g(
253
- () => [
254
- { key: "recordedOn", sortable: !0 },
255
- { key: "recordedBy", sortable: !0 }
256
- ],
257
- []
258
- ), S = g(() => {
259
- const s = w.reduce(
260
- (m, u) => {
261
- const $ = u.formName;
262
- m[$] ??= [];
263
- const O = u.providers.map((W) => W.providerName).filter(Boolean).join(", ");
264
- return m[$].push({
265
- id: u.encounterUuid,
266
- formName: u.formName,
267
- recordedOn: ne(u.encounterDateTime, t, ue).formattedResult,
268
- recordedBy: O ?? "--",
269
- encounterDateTime: u.encounterDateTime,
270
- encounterUuid: u.encounterUuid
271
- }), m;
272
- },
273
- {}
274
- );
275
- return Object.entries(s).map(
276
- ([m, u]) => ({
277
- formName: m,
278
- records: u.sort(
279
- ($, O) => O.encounterDateTime - $.encounterDateTime
280
- )
281
- })
282
- ).sort((m, u) => m.formName.localeCompare(u.formName));
283
- }, [w, t]), G = y((s) => {
284
- _(s), l(!0);
285
- }, []), Y = y(() => {
286
- l(!1), _(null);
287
- }, []), U = y(
288
- (s, p) => {
289
- switch (p) {
290
- case "recordedOn":
291
- return /* @__PURE__ */ a(ce, { onClick: () => G(s), children: s.recordedOn });
292
- case "recordedBy":
293
- return s.recordedBy;
294
- default:
295
- return null;
296
- }
297
- },
298
- [G]
299
- );
300
- return /* @__PURE__ */ b(X, { children: [
301
- /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: R || C || S.length === 0 || N ? /* @__PURE__ */ a(
302
- q,
303
- {
304
- headers: V,
305
- ariaLabel: t("FORMS_HEADING"),
306
- rows: [],
307
- loading: R,
308
- errorStateMessage: C ? j?.message : void 0,
309
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
310
- renderCell: U,
311
- className: o.formsTableBody,
312
- dataTestId: "forms-table"
313
- }
314
- ) : /* @__PURE__ */ a(de, { align: "start", children: S.map((s, p) => {
315
- const { formName: m, records: u } = s;
316
- return /* @__PURE__ */ a(
317
- le,
318
- {
319
- title: m,
320
- className: o.customAccordianItem,
321
- testId: `accordian-title-${m}`,
322
- open: p === 0,
323
- children: /* @__PURE__ */ a(
324
- q,
325
- {
326
- headers: V,
327
- ariaLabel: t("FORMS_HEADING"),
328
- rows: u,
329
- loading: !1,
330
- errorStateMessage: "",
331
- sortable: x,
332
- emptyStateMessage: t("FORMS_UNAVAILABLE"),
333
- renderCell: U,
334
- className: o.formsTableBody,
335
- dataTestId: `forms-table-${m}`
336
- }
337
- )
338
- },
339
- m
340
- );
341
- }) }) }),
342
- c && r && /* @__PURE__ */ a(
343
- me,
344
- {
345
- id: "modalIdForActionAreaLayout",
346
- open: c,
347
- onRequestClose: Y,
348
- modalHeading: r.formName,
349
- modalLabel: `${r.recordedOn} | ${r.recordedBy}`,
350
- passiveModal: !0,
351
- size: "md",
352
- testId: "form-details-modal",
353
- children: /* @__PURE__ */ a("div", { className: o.formContent, children: z || J ? /* @__PURE__ */ a(ie, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ a("div", { children: H(E).message ?? t("ERROR_FETCHING_FORM_METADATA") }) : I ? /* @__PURE__ */ a("div", { children: H(I).message ?? t("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: B.map((s, p) => /* @__PURE__ */ a(
354
- Ve,
355
- {
356
- observation: s,
357
- index: p,
358
- formName: r.formName
359
- },
360
- `${s.concept.uuid}`
361
- )) }) : /* @__PURE__ */ a("div", { children: t("NO_FORM_DATA_AVAILABLE") }) })
362
- }
363
- )
364
- ] });
365
- };
366
- export {
367
- Pe as default
368
- };