@bahmni/widgets 0.0.1-dev.144 → 0.0.1-dev.145

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.
@@ -1,9 +1,9 @@
1
- import { jsxs as b, jsx as a, Fragment as Y } from "react/jsx-runtime";
2
- import { c as L, u as J, Q as W, o as Z, s as ee, a as te, X as re, l as oe, b as ae, K as U, g as se, M as ne, p as ce, d as de, e as q, f as le } from "./index-DCdaPdMj.js";
1
+ import { jsxs as b, jsx as o, Fragment as Y } from "react/jsx-runtime";
2
+ import { c as L, u as J, a as W, p as Z, d as ee, f as te, s as re, m as ae, l as oe, K as U, g as se, M as ne, b as de, X as ce, e as q, h as le } from "./index-CJl-px0B.js";
3
3
  import { useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as k, useMemo as g, useCallback as M } from "react";
5
5
  import { useTranslation as me } from "react-i18next";
6
- const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", _e = "_observation_1pd36_30", fe = "_groupContainer_1pd36_39", ge = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", he = "_rowValue_1pd36_67", ye = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Le = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Te = "_abnormalValue_1pd36_102", Ae = "_commentSection_1pd36_110", Oe = "_commentText_1pd36_116", Re = "_nestedGroup_1pd36_125", Ce = "_nestedGroupLabel_1pd36_132", Fe = "_nestedGroupMembers_1pd36_141", o = {
6
+ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", _e = "_observation_1pd36_30", fe = "_groupContainer_1pd36_39", ge = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", he = "_rowValue_1pd36_67", ye = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Le = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Te = "_abnormalValue_1pd36_102", Ae = "_commentSection_1pd36_110", Oe = "_commentText_1pd36_116", Re = "_nestedGroup_1pd36_125", we = "_nestedGroupLabel_1pd36_132", Ce = "_nestedGroupMembers_1pd36_141", a = {
7
7
  formsTableBody: ie,
8
8
  customAccordianItem: ue,
9
9
  formContent: pe,
@@ -22,15 +22,15 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
22
22
  commentSection: Ae,
23
23
  commentText: Oe,
24
24
  nestedGroup: Re,
25
- nestedGroupLabel: Ce,
26
- nestedGroupMembers: Fe
27
- }, ve = "ABNORMAL", P = (e) => {
28
- const s = e.concept?.units, d = e.concept?.lowNormal, t = e.concept?.hiNormal, u = d != null, n = t != null, l = u && n ? ` (${d} - ${t})` : u ? ` (>${d})` : n ? ` (<${t})` : "", r = e.interpretation && e.interpretation.toUpperCase() === ve;
25
+ nestedGroupLabel: we,
26
+ nestedGroupMembers: Ce
27
+ }, Fe = "ABNORMAL", P = (e) => {
28
+ const s = e.concept?.units, c = e.concept?.lowNormal, t = e.concept?.hiNormal, u = c != null, n = t != null, l = u && n ? ` (${c} - ${t})` : u ? ` (>${c})` : n ? ` (<${t})` : "", r = e.interpretation && e.interpretation.toUpperCase() === Fe;
29
29
  return { units: s, rangeString: l, isAbnormal: r };
30
30
  }, H = ({
31
31
  member: e,
32
32
  depth: s = 0,
33
- memberIndex: d = 0,
33
+ memberIndex: c = 0,
34
34
  formName: t = ""
35
35
  }) => {
36
36
  const u = e.groupMembers && e.groupMembers.length > 0, n = e.conceptNameToDisplay ?? e.concept?.shortName ?? e.concept?.name, l = t ? `${t}-` : "";
@@ -38,24 +38,24 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
38
38
  return /* @__PURE__ */ b(
39
39
  "div",
40
40
  {
41
- className: o.nestedGroup,
42
- "data-testid": `${l}obs-nested-group-${n}-${d}`,
41
+ className: a.nestedGroup,
42
+ "data-testid": `${l}obs-nested-group-${n}-${c}`,
43
43
  children: [
44
- /* @__PURE__ */ a(
44
+ /* @__PURE__ */ o(
45
45
  "div",
46
46
  {
47
- className: o.nestedGroupLabel,
48
- "data-testid": `${l}obs-nested-group-label-${n}-${d}`,
47
+ className: a.nestedGroupLabel,
48
+ "data-testid": `${l}obs-nested-group-label-${n}-${c}`,
49
49
  style: { paddingLeft: `${s * 16}px` },
50
50
  children: n
51
51
  }
52
52
  ),
53
- /* @__PURE__ */ a(
53
+ /* @__PURE__ */ o(
54
54
  "div",
55
55
  {
56
- className: o.nestedGroupMembers,
57
- "data-testid": `${l}obs-nested-group-members-${n}-${d}`,
58
- children: e.groupMembers?.map((N, $) => /* @__PURE__ */ a(
56
+ className: a.nestedGroupMembers,
57
+ "data-testid": `${l}obs-nested-group-members-${n}-${c}`,
58
+ children: e.groupMembers?.map((N, $) => /* @__PURE__ */ o(
59
59
  H,
60
60
  {
61
61
  member: N,
@@ -74,18 +74,18 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
74
74
  return /* @__PURE__ */ b(
75
75
  "div",
76
76
  {
77
- className: o.memberRow,
78
- "data-testid": `${l}obs-member-row-${n}-${d}`,
77
+ className: a.memberRow,
78
+ "data-testid": `${l}obs-member-row-${n}-${c}`,
79
79
  style: { paddingLeft: `${s * 16}px` },
80
80
  children: [
81
81
  /* @__PURE__ */ b(
82
82
  "p",
83
83
  {
84
84
  className: L(
85
- o.memberLabel,
86
- f ? o.abnormalValue : ""
85
+ a.memberLabel,
86
+ f ? a.abnormalValue : ""
87
87
  ),
88
- "data-testid": `${l}obs-member-label-${n}-${d}`,
88
+ "data-testid": `${l}obs-member-label-${n}-${c}`,
89
89
  children: [
90
90
  n,
91
91
  _
@@ -96,10 +96,10 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
96
96
  "p",
97
97
  {
98
98
  className: L(
99
- o.memberValue,
100
- f ? o.abnormalValue : ""
99
+ a.memberValue,
100
+ f ? a.abnormalValue : ""
101
101
  ),
102
- "data-testid": `${l}obs-member-value-${n}-${d}`,
102
+ "data-testid": `${l}obs-member-value-${n}-${c}`,
103
103
  children: [
104
104
  e.valueAsString,
105
105
  r && ` ${r}`
@@ -109,50 +109,50 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
109
109
  ]
110
110
  }
111
111
  );
112
- }, we = ({
112
+ }, ve = ({
113
113
  observation: e,
114
114
  index: s,
115
- formName: d = ""
115
+ formName: c = ""
116
116
  }) => {
117
- const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = P(e), r = d ? `${d}-` : "";
117
+ const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = P(e), r = c ? `${c}-` : "";
118
118
  return /* @__PURE__ */ b(
119
119
  "div",
120
120
  {
121
- className: o.observation,
121
+ className: a.observation,
122
122
  "data-testid": `${r}observation-item-${e.conceptNameToDisplay}-${s}`,
123
123
  children: [
124
124
  /* @__PURE__ */ b(
125
125
  "div",
126
126
  {
127
- className: t ? o.groupContainer : o.rowContainer,
127
+ className: t ? a.groupContainer : a.rowContainer,
128
128
  "data-testid": `${r}observation-container-${e.conceptNameToDisplay}-${s}`,
129
129
  children: [
130
130
  /* @__PURE__ */ b(
131
131
  "p",
132
132
  {
133
133
  className: L(
134
- t ? o.groupLabel : o.rowLabel,
135
- !t && l ? o.abnormalValue : ""
134
+ t ? a.groupLabel : a.rowLabel,
135
+ !t && l ? a.abnormalValue : ""
136
136
  ),
137
137
  "data-testid": `${r}observation-label-${e.conceptNameToDisplay}-${s}`,
138
138
  children: [
139
139
  e.conceptNameToDisplay,
140
- !t && n && /* @__PURE__ */ a("span", { className: o.rangeInfo, children: n })
140
+ !t && n && /* @__PURE__ */ o("span", { className: a.rangeInfo, children: n })
141
141
  ]
142
142
  }
143
143
  ),
144
- t ? /* @__PURE__ */ a(
144
+ t ? /* @__PURE__ */ o(
145
145
  "div",
146
146
  {
147
- className: o.groupMembers,
147
+ className: a.groupMembers,
148
148
  "data-testid": `${r}observation-group-members-${e.conceptNameToDisplay}-${s}`,
149
- children: e.groupMembers?.map((_, f) => /* @__PURE__ */ a(
149
+ children: e.groupMembers?.map((_, f) => /* @__PURE__ */ o(
150
150
  H,
151
151
  {
152
152
  member: _,
153
153
  depth: 0,
154
154
  memberIndex: f,
155
- formName: d
155
+ formName: c
156
156
  },
157
157
  `${_.concept.uuid}`
158
158
  ))
@@ -161,8 +161,8 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
161
161
  "p",
162
162
  {
163
163
  className: L(
164
- o.rowValue,
165
- l ? o.abnormalValue : ""
164
+ a.rowValue,
165
+ l ? a.abnormalValue : ""
166
166
  ),
167
167
  "data-testid": `${r}observation-value-${e.conceptNameToDisplay}-${s}`,
168
168
  children: [
@@ -174,12 +174,12 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
174
174
  ]
175
175
  }
176
176
  ),
177
- e.comment && /* @__PURE__ */ a(
177
+ e.comment && /* @__PURE__ */ o(
178
178
  "div",
179
179
  {
180
- className: o.commentSection,
180
+ className: a.commentSection,
181
181
  "data-testid": `${r}observation-comment-${e.conceptNameToDisplay}-${s}`,
182
- children: /* @__PURE__ */ b("span", { className: o.commentText, children: [
182
+ children: /* @__PURE__ */ b("span", { className: a.commentText, children: [
183
183
  e.comment,
184
184
  e.providers?.[0]?.name && ` - by ${e.providers[0].name}`
185
185
  ] })
@@ -192,9 +192,9 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
192
192
  }, Ue = ({
193
193
  episodeOfCareUuids: e,
194
194
  encounterUuids: s,
195
- config: d
195
+ config: c
196
196
  }) => {
197
- const { t } = me(), u = J(), [n, l] = k(!1), [r, _] = k(null), f = d?.numberOfVisits, N = W(
197
+ const { t } = me(), u = J(), [n, l] = k(!1), [r, _] = k(null), f = c?.numberOfVisits, N = W(
198
198
  e,
199
199
  s
200
200
  ), {
@@ -206,28 +206,28 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
206
206
  queryKey: ["forms", u, e],
207
207
  queryFn: () => Z(u, void 0, f),
208
208
  enabled: !!u && !N
209
- }), C = g(() => !s || s.length === 0 ? $ : $.filter(
210
- (c) => s.includes(c.encounterUuid)
211
- ), [$, s]), { data: F = [] } = y({
209
+ }), w = g(() => !s || s.length === 0 ? $ : $.filter(
210
+ (d) => s.includes(d.encounterUuid)
211
+ ), [$, s]), { data: C = [] } = y({
212
212
  queryKey: ["observationForms"],
213
213
  queryFn: () => ee()
214
- }), v = M(
215
- (c) => F.find((m) => m.name === c)?.uuid,
216
- [F]
214
+ }), F = M(
215
+ (d) => C.find((m) => m.name === d)?.uuid,
216
+ [C]
217
217
  ), D = g(() => {
218
218
  if (r)
219
- return v(r.formName);
220
- }, [r, v]), {
219
+ return F(r.formName);
220
+ }, [r, F]), {
221
221
  data: Ee,
222
222
  isLoading: j,
223
- error: w
223
+ error: v
224
224
  } = y({
225
225
  queryKey: ["formMetadata", D],
226
226
  queryFn: () => te(D),
227
227
  enabled: !!D && n
228
228
  }), {
229
229
  data: T,
230
- isLoading: Q,
230
+ isLoading: X,
231
231
  error: E
232
232
  } = y({
233
233
  queryKey: ["formsEncounter", r?.encounterUuid],
@@ -241,22 +241,22 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
241
241
  { key: "recordedBy", header: t("FORM_RECORDED_BY") }
242
242
  ],
243
243
  [t]
244
- ), X = g(
244
+ ), x = g(
245
245
  () => [
246
246
  { key: "recordedOn", sortable: !0 },
247
247
  { key: "recordedBy", sortable: !0 }
248
248
  ],
249
249
  []
250
250
  ), V = g(() => {
251
- const c = C.reduce(
251
+ const d = w.reduce(
252
252
  (m, i) => {
253
253
  const h = i.formName;
254
254
  m[h] ??= [];
255
- const A = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
255
+ const A = i.providers.map((Q) => Q.providerName).filter(Boolean).join(", ");
256
256
  return m[h].push({
257
257
  id: i.encounterUuid,
258
258
  formName: i.formName,
259
- recordedOn: oe(i.encounterDateTime, t, le).formattedResult,
259
+ recordedOn: ae(i.encounterDateTime, t, le).formattedResult,
260
260
  recordedBy: A ?? "--",
261
261
  encounterDateTime: i.encounterDateTime,
262
262
  encounterUuid: i.encounterUuid
@@ -264,7 +264,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
264
264
  },
265
265
  {}
266
266
  );
267
- return Object.entries(c).map(
267
+ return Object.entries(d).map(
268
268
  ([m, i]) => ({
269
269
  formName: m,
270
270
  records: i.sort(
@@ -272,17 +272,17 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
272
272
  )
273
273
  })
274
274
  ).sort((m, i) => m.formName.localeCompare(i.formName));
275
- }, [C, t]), S = M((c) => {
276
- _(c), l(!0);
277
- }, []), x = M(() => {
275
+ }, [w, t]), S = M((d) => {
276
+ _(d), l(!0);
277
+ }, []), z = M(() => {
278
278
  l(!1), _(null);
279
279
  }, []), G = M(
280
- (c, p) => {
280
+ (d, p) => {
281
281
  switch (p) {
282
282
  case "recordedOn":
283
- return /* @__PURE__ */ a(ae, { onClick: () => S(c), children: c.recordedOn });
283
+ return /* @__PURE__ */ o(oe, { onClick: () => S(d), children: d.recordedOn });
284
284
  case "recordedBy":
285
- return c.recordedBy;
285
+ return d.recordedBy;
286
286
  default:
287
287
  return null;
288
288
  }
@@ -290,7 +290,7 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
290
290
  [S]
291
291
  );
292
292
  return /* @__PURE__ */ b(Y, { children: [
293
- /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R || V.length === 0 || N ? /* @__PURE__ */ a(
293
+ /* @__PURE__ */ o("div", { "data-testid": "forms-table", children: O || R || V.length === 0 || N ? /* @__PURE__ */ o(
294
294
  U,
295
295
  {
296
296
  headers: B,
@@ -300,19 +300,19 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
300
300
  errorStateMessage: R ? K?.message : void 0,
301
301
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
302
302
  renderCell: G,
303
- className: o.formsTableBody,
303
+ className: a.formsTableBody,
304
304
  dataTestId: "forms-table"
305
305
  }
306
- ) : /* @__PURE__ */ a(se, { align: "start", children: V.map((c, p) => {
307
- const { formName: m, records: i } = c;
308
- return /* @__PURE__ */ a(
306
+ ) : /* @__PURE__ */ o(se, { align: "start", children: V.map((d, p) => {
307
+ const { formName: m, records: i } = d;
308
+ return /* @__PURE__ */ o(
309
309
  ne,
310
310
  {
311
311
  title: m,
312
- className: o.customAccordianItem,
312
+ className: a.customAccordianItem,
313
313
  testId: `accordian-title-${m}`,
314
314
  open: p === 0,
315
- children: /* @__PURE__ */ a(
315
+ children: /* @__PURE__ */ o(
316
316
  U,
317
317
  {
318
318
  headers: B,
@@ -320,10 +320,10 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
320
320
  rows: i,
321
321
  loading: !1,
322
322
  errorStateMessage: "",
323
- sortable: X,
323
+ sortable: x,
324
324
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
325
325
  renderCell: G,
326
- className: o.formsTableBody,
326
+ className: a.formsTableBody,
327
327
  dataTestId: `forms-table-${m}`
328
328
  }
329
329
  )
@@ -331,26 +331,26 @@ const ie = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe =
331
331
  m
332
332
  );
333
333
  }) }) }),
334
- n && r && /* @__PURE__ */ a(
335
- ce,
334
+ n && r && /* @__PURE__ */ o(
335
+ de,
336
336
  {
337
337
  id: "modalIdForActionAreaLayout",
338
338
  open: n,
339
- onRequestClose: x,
339
+ onRequestClose: z,
340
340
  modalHeading: r.formName,
341
341
  modalLabel: `${r.recordedOn} | ${r.recordedBy}`,
342
342
  passiveModal: !0,
343
343
  size: "md",
344
344
  testId: "form-details-modal",
345
- children: /* @__PURE__ */ a("div", { className: o.formContent, children: j || Q ? /* @__PURE__ */ a(de, { width: "100%", lineCount: 3 }) : w ? /* @__PURE__ */ a("div", { children: q(w).message ?? t("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ a("div", { children: q(E).message ?? t("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: I.map((c, p) => /* @__PURE__ */ a(
346
- we,
345
+ children: /* @__PURE__ */ o("div", { className: a.formContent, children: j || X ? /* @__PURE__ */ o(ce, { width: "100%", lineCount: 3 }) : v ? /* @__PURE__ */ o("div", { children: q(v).message ?? t("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ o("div", { children: q(E).message ?? t("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ o("div", { className: a.formDetailsContainer, children: I.map((d, p) => /* @__PURE__ */ o(
346
+ ve,
347
347
  {
348
- observation: c,
348
+ observation: d,
349
349
  index: p,
350
350
  formName: r.formName
351
351
  },
352
- `${c.concept.uuid}`
353
- )) }) : /* @__PURE__ */ a("div", { children: t("NO_FORM_DATA_AVAILABLE") }) })
352
+ `${d.concept.uuid}`
353
+ )) }) : /* @__PURE__ */ o("div", { children: t("NO_FORM_DATA_AVAILABLE") }) })
354
354
  }
355
355
  )
356
356
  ] });
@@ -1,5 +1,5 @@
1
1
  import { jsx as v, jsxs as _ } from "react/jsx-runtime";
2
- import { h as F, L as N, R as K, z as k, H as q, V as Q, u as G, i as H, j as P, k as x, T as j, K as Y } from "./index-DCdaPdMj.js";
2
+ import { i as F, L as N, I as K, z as k, H as q, V as Q, u as G, j as H, k as P, t as x, T as j, K as Y } from "./index-CJl-px0B.js";
3
3
  import { useQueries as z, useQuery as J } from "@tanstack/react-query";
4
4
  import { useRef as W, useEffect as S, useMemo as y } from "react";
5
5
  import { useTranslation as A } from "react-i18next";