@bahmni/widgets 0.0.1-dev.333 → 0.0.1-dev.334
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/{DocumentsTable-CVLDm1ld.js → DocumentsTable-NywEycWy.js} +1 -1
- package/dist/{FormsTable-FpRK2ZFq.js → FormsTable-CaEwK3-q.js} +88 -90
- package/dist/{Observations-DDuq0ing.js → Observations-CtJ_g_-p.js} +1 -1
- package/dist/forms/utils.d.ts +10 -0
- package/dist/forms/utils.d.ts.map +1 -1
- package/dist/{index-Cvg_wxJX.js → index-iRMlne97.js} +2881 -2872
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -21
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { u as W, a as Z, z as X, Z as J, i as x, j as ee, P as te } from "./index-
|
|
2
|
+
import { u as W, a as Z, z as X, Z as J, i as x, j as ee, P as te } from "./index-iRMlne97.js";
|
|
3
3
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
4
4
|
import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
|
|
5
5
|
import { useTranslation as ae } from "react-i18next";
|
|
@@ -1,81 +1,79 @@
|
|
|
1
1
|
import { jsx as i, jsxs as oe, Fragment as te } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { useState as
|
|
2
|
+
import { u as se, c as ae, T as ne, _ as de, v as ie, o as ce, M as le, e as me, q as U, i as ue, Z as fe, j as k, b as ye, R as be, P as pe, O as ge } from "./index-iRMlne97.js";
|
|
3
|
+
import { useQueryClient as he, useQuery as b } from "@tanstack/react-query";
|
|
4
|
+
import { useState as j, useMemo as d, useCallback as p } from "react";
|
|
5
5
|
import { useTranslation as Fe } from "react-i18next";
|
|
6
|
-
const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs",
|
|
6
|
+
const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs", O = {
|
|
7
7
|
formsTableBody: Ne,
|
|
8
8
|
customAccordianItem: Oe
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
encounterUuids: c,
|
|
14
|
-
config: g
|
|
9
|
+
}, Te = ({
|
|
10
|
+
episodeOfCareUuids: v,
|
|
11
|
+
encounterUuids: l,
|
|
12
|
+
config: H
|
|
15
13
|
}) => {
|
|
16
|
-
const { t: n } = Fe(),
|
|
14
|
+
const { t: n } = Fe(), m = se(), [f, M] = j(!1), [a, E] = j(null), {
|
|
17
15
|
numberOfVisits: P,
|
|
18
16
|
hideThumbnail: w = !1,
|
|
19
|
-
forms:
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
),
|
|
24
|
-
data:
|
|
25
|
-
isLoading:
|
|
26
|
-
isError:
|
|
17
|
+
forms: y
|
|
18
|
+
} = H ?? {}, _ = ae(
|
|
19
|
+
v,
|
|
20
|
+
l
|
|
21
|
+
), x = he(), {
|
|
22
|
+
data: I = [],
|
|
23
|
+
isLoading: T,
|
|
24
|
+
isError: A,
|
|
27
25
|
error: K,
|
|
28
26
|
refetch: V
|
|
29
27
|
} = b({
|
|
30
|
-
queryKey: ["forms",
|
|
31
|
-
queryFn: () =>
|
|
32
|
-
enabled: !!
|
|
33
|
-
}),
|
|
34
|
-
let e =
|
|
35
|
-
return
|
|
36
|
-
(o) =>
|
|
37
|
-
)), Array.isArray(
|
|
38
|
-
(o) =>
|
|
28
|
+
queryKey: ["forms", m, v],
|
|
29
|
+
queryFn: () => ne(m, void 0, P),
|
|
30
|
+
enabled: !!m && !_
|
|
31
|
+
}), D = d(() => {
|
|
32
|
+
let e = I;
|
|
33
|
+
return l && l.length > 0 && (e = e.filter(
|
|
34
|
+
(o) => l.includes(o.encounterUuid)
|
|
35
|
+
)), Array.isArray(y) && y.length > 0 && (e = e.filter(
|
|
36
|
+
(o) => y.some((r) => r.toLowerCase() === o.formName.toLowerCase())
|
|
39
37
|
)), e;
|
|
40
|
-
}, [
|
|
38
|
+
}, [I, l, y]), { data: B = [] } = b({
|
|
41
39
|
queryKey: ["observationForms"],
|
|
42
|
-
queryFn: () =>
|
|
43
|
-
}),
|
|
44
|
-
(e) =>
|
|
45
|
-
[
|
|
46
|
-
),
|
|
40
|
+
queryFn: () => de()
|
|
41
|
+
}), R = p(
|
|
42
|
+
(e) => B.find((r) => r.name === e)?.uuid,
|
|
43
|
+
[B]
|
|
44
|
+
), g = d(() => {
|
|
47
45
|
if (a)
|
|
48
|
-
return
|
|
49
|
-
}, [a,
|
|
50
|
-
data:
|
|
46
|
+
return R(a.formName);
|
|
47
|
+
}, [a, R]), {
|
|
48
|
+
data: c,
|
|
51
49
|
isLoading: $,
|
|
52
50
|
isError: z,
|
|
53
|
-
error:
|
|
51
|
+
error: h
|
|
54
52
|
} = b({
|
|
55
|
-
queryKey: ["formMetadata",
|
|
56
|
-
queryFn: () =>
|
|
57
|
-
enabled: !!
|
|
53
|
+
queryKey: ["formMetadata", g],
|
|
54
|
+
queryFn: () => ie(g),
|
|
55
|
+
enabled: !!g && f
|
|
58
56
|
}), {
|
|
59
|
-
data:
|
|
57
|
+
data: F,
|
|
60
58
|
isLoading: G,
|
|
61
59
|
isError: Q,
|
|
62
|
-
error:
|
|
60
|
+
error: N
|
|
63
61
|
} = b({
|
|
64
62
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
65
|
-
queryFn: () =>
|
|
66
|
-
enabled: !!a?.encounterUuid &&
|
|
63
|
+
queryFn: () => ce(a.encounterUuid),
|
|
64
|
+
enabled: !!a?.encounterUuid && f
|
|
67
65
|
});
|
|
68
|
-
|
|
66
|
+
le(
|
|
69
67
|
(e) => {
|
|
70
|
-
e.patientUUID ===
|
|
68
|
+
e.patientUUID === m && e.updatedConcepts.size > 0 && (V(), x.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
71
69
|
},
|
|
72
|
-
[
|
|
70
|
+
[m]
|
|
73
71
|
);
|
|
74
|
-
const Z = d(() => !
|
|
75
|
-
const r =
|
|
72
|
+
const Z = d(() => !F?.entry || !a?.formName ? [] : F.entry.filter((o) => o.resource?.resourceType === "Observation").map((o) => o.resource).filter((o) => {
|
|
73
|
+
const r = me(o);
|
|
76
74
|
return !r || r.includes(a.formName);
|
|
77
|
-
}), [
|
|
78
|
-
if (!
|
|
75
|
+
}), [F, a?.formName]), Y = d(() => {
|
|
76
|
+
if (!c?.schema) return;
|
|
79
77
|
const e = [], o = (r) => {
|
|
80
78
|
(r ?? []).forEach((t) => {
|
|
81
79
|
const s = t;
|
|
@@ -83,28 +81,28 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
83
81
|
});
|
|
84
82
|
};
|
|
85
83
|
return o(
|
|
86
|
-
|
|
84
|
+
c.schema.controls ?? []
|
|
87
85
|
), e.length > 0 ? e : void 0;
|
|
88
|
-
}, [
|
|
89
|
-
if (!
|
|
86
|
+
}, [c]), J = d(() => {
|
|
87
|
+
if (!c?.schema) return;
|
|
90
88
|
const e = {}, o = (r, t) => {
|
|
91
89
|
for (const s of r)
|
|
92
90
|
if (s.type === "section") {
|
|
93
|
-
const
|
|
94
|
-
o(s.controls ?? [],
|
|
91
|
+
const u = s.label?.value ?? "Section";
|
|
92
|
+
o(s.controls ?? [], u);
|
|
95
93
|
} else
|
|
96
94
|
s.id != null && t && (e[String(s.id)] = t), s.controls && o(s.controls, t);
|
|
97
95
|
};
|
|
98
96
|
return o(
|
|
99
|
-
|
|
97
|
+
c.schema.controls ?? [],
|
|
100
98
|
null
|
|
101
99
|
), Object.keys(e).length > 0 ? e : void 0;
|
|
102
|
-
}, [
|
|
100
|
+
}, [c]), W = d(() => {
|
|
101
|
+
if (h)
|
|
102
|
+
return U(h).message;
|
|
103
103
|
if (N)
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
return j(v).message;
|
|
107
|
-
}, [N, v]), C = d(
|
|
104
|
+
return U(N).message;
|
|
105
|
+
}, [h, N]), L = d(
|
|
108
106
|
() => [
|
|
109
107
|
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
110
108
|
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
@@ -116,17 +114,17 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
116
114
|
{ key: "recordedBy", sortable: !0 }
|
|
117
115
|
],
|
|
118
116
|
[]
|
|
119
|
-
),
|
|
120
|
-
const e =
|
|
117
|
+
), C = d(() => {
|
|
118
|
+
const e = D.reduce(
|
|
121
119
|
(r, t) => {
|
|
122
120
|
const s = t.formName;
|
|
123
121
|
r[s] ??= [];
|
|
124
|
-
const
|
|
122
|
+
const u = t.providers.map((re) => re.providerName).filter(Boolean).join(", ");
|
|
125
123
|
return r[s].push({
|
|
126
124
|
id: t.encounterUuid,
|
|
127
125
|
formName: t.formName,
|
|
128
126
|
recordedOn: ue(t.encounterDateTime, n, !0).formattedResult,
|
|
129
|
-
recordedBy:
|
|
127
|
+
recordedBy: u ?? "--",
|
|
130
128
|
encounterDateTime: t.encounterDateTime,
|
|
131
129
|
encounterUuid: t.encounterUuid
|
|
132
130
|
}), r;
|
|
@@ -137,15 +135,15 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
137
135
|
([r, t]) => ({
|
|
138
136
|
formName: r,
|
|
139
137
|
records: t.sort(
|
|
140
|
-
(s,
|
|
138
|
+
(s, u) => u.encounterDateTime - s.encounterDateTime
|
|
141
139
|
)
|
|
142
140
|
})
|
|
143
141
|
).sort((r, t) => r.formName.localeCompare(t.formName));
|
|
144
|
-
}, [
|
|
145
|
-
|
|
146
|
-
}, []), ee =
|
|
147
|
-
M(!1),
|
|
148
|
-
}, []),
|
|
142
|
+
}, [D, n]), q = p((e) => {
|
|
143
|
+
E(e), M(!0);
|
|
144
|
+
}, []), ee = p(() => {
|
|
145
|
+
M(!1), E(null);
|
|
146
|
+
}, []), S = p(
|
|
149
147
|
(e, o) => {
|
|
150
148
|
switch (o) {
|
|
151
149
|
case "recordedOn":
|
|
@@ -159,40 +157,40 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
159
157
|
[q]
|
|
160
158
|
);
|
|
161
159
|
return /* @__PURE__ */ oe(te, { children: [
|
|
162
|
-
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children:
|
|
160
|
+
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: T || A || C.length === 0 || _ ? /* @__PURE__ */ i(
|
|
163
161
|
k,
|
|
164
162
|
{
|
|
165
|
-
headers:
|
|
163
|
+
headers: L,
|
|
166
164
|
ariaLabel: n("FORMS_HEADING"),
|
|
167
165
|
rows: [],
|
|
168
|
-
loading:
|
|
169
|
-
errorStateMessage:
|
|
166
|
+
loading: T,
|
|
167
|
+
errorStateMessage: A ? K?.message : void 0,
|
|
170
168
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
171
|
-
renderCell:
|
|
172
|
-
className:
|
|
169
|
+
renderCell: S,
|
|
170
|
+
className: O.formsTableBody,
|
|
173
171
|
dataTestId: "forms-table"
|
|
174
172
|
}
|
|
175
|
-
) : /* @__PURE__ */ i(ye, { align: "start", children:
|
|
173
|
+
) : /* @__PURE__ */ i(ye, { align: "start", children: C.map((e, o) => {
|
|
176
174
|
const { formName: r, records: t } = e;
|
|
177
175
|
return /* @__PURE__ */ i(
|
|
178
|
-
|
|
176
|
+
be,
|
|
179
177
|
{
|
|
180
178
|
title: r,
|
|
181
|
-
className:
|
|
179
|
+
className: O.customAccordianItem,
|
|
182
180
|
testId: `accordian-title-${r}`,
|
|
183
181
|
open: o === 0,
|
|
184
182
|
children: /* @__PURE__ */ i(
|
|
185
183
|
k,
|
|
186
184
|
{
|
|
187
|
-
headers:
|
|
185
|
+
headers: L,
|
|
188
186
|
ariaLabel: n("FORMS_HEADING"),
|
|
189
187
|
rows: t,
|
|
190
188
|
loading: !1,
|
|
191
189
|
errorStateMessage: "",
|
|
192
190
|
sortable: X,
|
|
193
191
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
194
|
-
renderCell:
|
|
195
|
-
className:
|
|
192
|
+
renderCell: S,
|
|
193
|
+
className: O.formsTableBody,
|
|
196
194
|
dataTestId: `forms-table-${r}`
|
|
197
195
|
}
|
|
198
196
|
)
|
|
@@ -200,12 +198,12 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
200
198
|
r
|
|
201
199
|
);
|
|
202
200
|
}) }) }),
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
f && a && /* @__PURE__ */ i(
|
|
202
|
+
pe,
|
|
205
203
|
{
|
|
206
204
|
id: "modalIdForActionAreaLayout",
|
|
207
205
|
portalId: "main-display-area",
|
|
208
|
-
open:
|
|
206
|
+
open: f,
|
|
209
207
|
onRequestClose: ee,
|
|
210
208
|
modalHeading: a.formName,
|
|
211
209
|
modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
|
|
@@ -213,7 +211,7 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
213
211
|
size: "md",
|
|
214
212
|
testId: "form-details-modal",
|
|
215
213
|
children: /* @__PURE__ */ i(
|
|
216
|
-
|
|
214
|
+
ge,
|
|
217
215
|
{
|
|
218
216
|
observations: Z,
|
|
219
217
|
isLoading: $ || G,
|
|
@@ -231,5 +229,5 @@ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_cu
|
|
|
231
229
|
] });
|
|
232
230
|
};
|
|
233
231
|
export {
|
|
234
|
-
|
|
232
|
+
Te as default
|
|
235
233
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as d, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import { f as H, J as D, t as K, s as V, F as k, X as w,
|
|
2
|
+
import { f as H, J as D, t as K, s as V, F as k, X as w, d as j, Q as q, u as G, a as P, g as z, h as J, M as X, k as Y, l as W, m as Z, n as x, j as ee } from "./index-iRMlne97.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
4
|
import { useRef as oe, useEffect as S, useMemo as g } from "react";
|
|
5
5
|
import { useTranslation as U } from "react-i18next";
|
package/dist/forms/utils.d.ts
CHANGED
|
@@ -5,4 +5,14 @@ import { Observation } from 'fhir/r4';
|
|
|
5
5
|
* @returns formFieldPath string or undefined
|
|
6
6
|
*/
|
|
7
7
|
export declare const extractFormFieldPath: (observation: Observation | undefined) => string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Extract the form name from an observation's form-namespace-path extension.
|
|
10
|
+
*
|
|
11
|
+
* The path value is `{namespace}^{formName}.{version}/{fieldPath}`
|
|
12
|
+
* (e.g. `Bahmni^Vitals.1/10-0`) or `{formName}.{version}/{fieldPath}`
|
|
13
|
+
* (e.g. `Vitals.1/1-0`). Returns the bare form name (e.g. `Vitals`), stripping
|
|
14
|
+
* a single trailing `.{version}` segment (OpenMRS form versions are integers),
|
|
15
|
+
* or undefined if the value is absent/malformed.
|
|
16
|
+
*/
|
|
17
|
+
export declare const extractFormName: (observation: Observation | undefined) => string | undefined;
|
|
8
18
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/forms/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,WAAW,GAAG,SAAS,KACnC,MAAM,GAAG,SAQX,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/forms/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,aAAa,WAAW,GAAG,SAAS,KACnC,MAAM,GAAG,SAQX,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAC1B,aAAa,WAAW,GAAG,SAAS,KACnC,MAAM,GAAG,SAYX,CAAC"}
|