@bahmni/widgets 0.0.1-dev.123 → 0.0.1-dev.124

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,10 +1,10 @@
1
1
  import { jsxs as b, jsx as a, Fragment as Q } from "react/jsx-runtime";
2
- import { c as D, u as Y, C as W, F as Z, q as ee, U as te, D as re, J as oe, l as ae, K as U, a as se, m as ne, p as ce, X as de, b as q, o as le } from "./index-DTRv9Pr9.js";
2
+ import { c as L, u as Y, L as W, H as Z, F as ee, V as te, k as re, J as oe, l as ae, K as U, a as se, m as ne, p as ce, X as de, b as k, o as le } from "./index-BWeanlvf.js";
3
3
  import { useQuery as h } from "@tanstack/react-query";
4
- import { useState as P, useMemo as g, useCallback as M } from "react";
4
+ import { useState as q, useMemo as g, useCallback as M } from "react";
5
5
  import { createPortal as me } from "react-dom";
6
6
  import { useTranslation as ie } from "react-i18next";
7
- const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be = "_formContent_1pd36_18", _e = "_formDetailsContainer_1pd36_25", fe = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", Ne = "_rowContainer_1pd36_43", $e = "_groupLabel_1pd36_48", ye = "_rowLabel_1pd36_58", he = "_rowValue_1pd36_67", Me = "_groupMembers_1pd36_75", De = "_memberRow_1pd36_81", Le = "_memberLabel_1pd36_86", Te = "_memberValue_1pd36_94", Ae = "_abnormalValue_1pd36_102", Oe = "_commentSection_1pd36_110", Re = "_commentText_1pd36_116", Ce = "_nestedGroup_1pd36_125", Fe = "_nestedGroupLabel_1pd36_132", ve = "_nestedGroupMembers_1pd36_141", o = {
7
+ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be = "_formContent_1pd36_18", _e = "_formDetailsContainer_1pd36_25", fe = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", Ne = "_rowContainer_1pd36_43", $e = "_groupLabel_1pd36_48", ye = "_rowLabel_1pd36_58", he = "_rowValue_1pd36_67", Me = "_groupMembers_1pd36_75", Le = "_memberRow_1pd36_81", De = "_memberLabel_1pd36_86", Te = "_memberValue_1pd36_94", Ae = "_abnormalValue_1pd36_102", Oe = "_commentSection_1pd36_110", Re = "_commentText_1pd36_116", Fe = "_nestedGroup_1pd36_125", Ce = "_nestedGroupLabel_1pd36_132", ve = "_nestedGroupMembers_1pd36_141", o = {
8
8
  formsTableBody: ue,
9
9
  customAccordianItem: pe,
10
10
  formContent: be,
@@ -16,19 +16,19 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
16
16
  rowLabel: ye,
17
17
  rowValue: he,
18
18
  groupMembers: Me,
19
- memberRow: De,
20
- memberLabel: Le,
19
+ memberRow: Le,
20
+ memberLabel: De,
21
21
  memberValue: Te,
22
22
  abnormalValue: Ae,
23
23
  commentSection: Oe,
24
24
  commentText: Re,
25
- nestedGroup: Ce,
26
- nestedGroupLabel: Fe,
25
+ nestedGroup: Fe,
26
+ nestedGroupLabel: Ce,
27
27
  nestedGroupMembers: ve
28
- }, we = "ABNORMAL", k = (e) => {
28
+ }, we = "ABNORMAL", H = (e) => {
29
29
  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() === we;
30
30
  return { units: s, rangeString: l, isAbnormal: r };
31
- }, H = ({
31
+ }, P = ({
32
32
  member: e,
33
33
  depth: s = 0,
34
34
  memberIndex: d = 0,
@@ -57,7 +57,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
57
57
  className: o.nestedGroupMembers,
58
58
  "data-testid": `${l}obs-nested-group-members-${n}-${d}`,
59
59
  children: e.groupMembers?.map((N, $) => /* @__PURE__ */ a(
60
- H,
60
+ P,
61
61
  {
62
62
  member: N,
63
63
  depth: s + 1,
@@ -71,7 +71,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
71
71
  ]
72
72
  }
73
73
  );
74
- const { units: r, rangeString: _, isAbnormal: f } = k(e);
74
+ const { units: r, rangeString: _, isAbnormal: f } = H(e);
75
75
  return /* @__PURE__ */ b(
76
76
  "div",
77
77
  {
@@ -82,7 +82,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
82
82
  /* @__PURE__ */ b(
83
83
  "p",
84
84
  {
85
- className: D(
85
+ className: L(
86
86
  o.memberLabel,
87
87
  f ? o.abnormalValue : ""
88
88
  ),
@@ -96,7 +96,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
96
96
  /* @__PURE__ */ b(
97
97
  "p",
98
98
  {
99
- className: D(
99
+ className: L(
100
100
  o.memberValue,
101
101
  f ? o.abnormalValue : ""
102
102
  ),
@@ -115,7 +115,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
115
115
  index: s,
116
116
  formName: d = ""
117
117
  }) => {
118
- const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = k(e), r = d ? `${d}-` : "";
118
+ const t = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: n, isAbnormal: l } = H(e), r = d ? `${d}-` : "";
119
119
  return /* @__PURE__ */ b(
120
120
  "div",
121
121
  {
@@ -131,7 +131,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
131
131
  /* @__PURE__ */ b(
132
132
  "p",
133
133
  {
134
- className: D(
134
+ className: L(
135
135
  t ? o.groupLabel : o.rowLabel,
136
136
  !t && l ? o.abnormalValue : ""
137
137
  ),
@@ -148,7 +148,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
148
148
  className: o.groupMembers,
149
149
  "data-testid": `${r}observation-group-members-${e.conceptNameToDisplay}-${s}`,
150
150
  children: e.groupMembers?.map((_, f) => /* @__PURE__ */ a(
151
- H,
151
+ P,
152
152
  {
153
153
  member: _,
154
154
  depth: 0,
@@ -161,7 +161,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
161
161
  ) : /* @__PURE__ */ b(
162
162
  "p",
163
163
  {
164
- className: D(
164
+ className: L(
165
165
  o.rowValue,
166
166
  l ? o.abnormalValue : ""
167
167
  ),
@@ -190,12 +190,12 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
190
190
  },
191
191
  `${e.concept.uuid}-${s}`
192
192
  );
193
- }, Pe = ({
193
+ }, qe = ({
194
194
  episodeOfCareUuids: e,
195
195
  encounterUuids: s,
196
196
  config: d
197
197
  }) => {
198
- const { t } = ie(), u = Y(), [n, l] = P(!1), [r, _] = P(null), f = d?.numberOfVisits, N = W(
198
+ const { t } = ie(), u = Y(), [n, l] = q(!1), [r, _] = q(null), f = d?.numberOfVisits, N = W(
199
199
  e,
200
200
  s
201
201
  ), {
@@ -207,25 +207,25 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
207
207
  queryKey: ["forms", u, e],
208
208
  queryFn: () => Z(u, void 0, f),
209
209
  enabled: !!u && !N
210
- }), C = g(() => !s || s.length === 0 ? $ : $.filter(
210
+ }), F = g(() => !s || s.length === 0 ? $ : $.filter(
211
211
  (c) => s.includes(c.encounterUuid)
212
- ), [$, s]), { data: F = [] } = h({
212
+ ), [$, s]), { data: C = [] } = h({
213
213
  queryKey: ["observationForms"],
214
214
  queryFn: ee
215
215
  }), v = M(
216
- (c) => F.find((m) => m.name === c)?.uuid,
217
- [F]
218
- ), L = g(() => {
216
+ (c) => C.find((m) => m.name === c)?.uuid,
217
+ [C]
218
+ ), D = g(() => {
219
219
  if (r)
220
220
  return v(r.formName);
221
221
  }, [r, v]), {
222
- data: Be,
222
+ data: Ve,
223
223
  isLoading: j,
224
224
  error: w
225
225
  } = h({
226
- queryKey: ["formMetadata", L],
227
- queryFn: () => te(L),
228
- enabled: !!L && n
226
+ queryKey: ["formMetadata", D],
227
+ queryFn: () => te(D),
228
+ enabled: !!D && n
229
229
  }), {
230
230
  data: T,
231
231
  isLoading: J,
@@ -234,9 +234,9 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
234
234
  queryKey: ["formsEncounter", r?.encounterUuid],
235
235
  queryFn: () => re(r.encounterUuid, !0),
236
236
  enabled: !!r?.encounterUuid && n
237
- }), B = g(() => !T?.observations || !r?.formName ? [] : T.observations.filter(
237
+ }), V = g(() => !T?.observations || !r?.formName ? [] : T.observations.filter(
238
238
  (p) => "formFieldPath" in p && typeof p.formFieldPath == "string" && p.formFieldPath.includes(r.formName)
239
- ), [T?.observations, r?.formName]), I = g(
239
+ ), [T?.observations, r?.formName]), B = g(
240
240
  () => [
241
241
  { key: "recordedOn", header: t("FORM_RECORDED_ON") },
242
242
  { key: "recordedBy", header: t("FORM_RECORDED_BY") }
@@ -248,8 +248,8 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
248
248
  { key: "recordedBy", sortable: !0 }
249
249
  ],
250
250
  []
251
- ), V = g(() => {
252
- const c = C.reduce(
251
+ ), I = g(() => {
252
+ const c = F.reduce(
253
253
  (m, i) => {
254
254
  const y = i.formName;
255
255
  m[y] ??= [];
@@ -273,7 +273,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
273
273
  )
274
274
  })
275
275
  ).sort((m, i) => m.formName.localeCompare(i.formName));
276
- }, [C, t]), S = M((c) => {
276
+ }, [F, t]), S = M((c) => {
277
277
  _(c), l(!0);
278
278
  }, []), x = M(() => {
279
279
  l(!1), _(null);
@@ -291,10 +291,10 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
291
291
  [S]
292
292
  );
293
293
  return /* @__PURE__ */ b(Q, { children: [
294
- /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R || V.length === 0 || N ? /* @__PURE__ */ a(
294
+ /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: O || R || I.length === 0 || N ? /* @__PURE__ */ a(
295
295
  U,
296
296
  {
297
- headers: I,
297
+ headers: B,
298
298
  ariaLabel: t("FORMS_HEADING"),
299
299
  rows: [],
300
300
  loading: O,
@@ -304,7 +304,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
304
304
  className: o.formsTableBody,
305
305
  dataTestId: "forms-table"
306
306
  }
307
- ) : /* @__PURE__ */ a(se, { align: "start", children: V.map((c, p) => {
307
+ ) : /* @__PURE__ */ a(se, { align: "start", children: I.map((c, p) => {
308
308
  const { formName: m, records: i } = c;
309
309
  return /* @__PURE__ */ a(
310
310
  ne,
@@ -316,7 +316,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
316
316
  children: /* @__PURE__ */ a(
317
317
  U,
318
318
  {
319
- headers: I,
319
+ headers: B,
320
320
  ariaLabel: t("FORMS_HEADING"),
321
321
  rows: i,
322
322
  loading: !1,
@@ -344,7 +344,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
344
344
  passiveModal: !0,
345
345
  size: "md",
346
346
  testId: "form-details-modal",
347
- children: /* @__PURE__ */ a("div", { className: o.formContent, children: j || J ? /* @__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") }) : B.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: B.map((c, p) => /* @__PURE__ */ a(
347
+ children: /* @__PURE__ */ a("div", { className: o.formContent, children: j || J ? /* @__PURE__ */ a(de, { width: "100%", lineCount: 3 }) : w ? /* @__PURE__ */ a("div", { children: k(w).message ?? t("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ a("div", { children: k(E).message ?? t("ERROR_FETCHING_FORM_DATA") }) : V.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: V.map((c, p) => /* @__PURE__ */ a(
348
348
  Ee,
349
349
  {
350
350
  observation: c,
@@ -360,5 +360,5 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", be =
360
360
  ] });
361
361
  };
362
362
  export {
363
- Pe as default
363
+ qe as default
364
364
  };
@@ -1,8 +1,8 @@
1
1
  import { jsx as v, jsxs as _ } from "react/jsx-runtime";
2
- import { Y as F, H as A, d as K, L as q, e as H, V as Q, u as k, f as G, g as P, A as x, S as Y, K as j } from "./index-DTRv9Pr9.js";
2
+ import { Y as F, d as N, e as K, f as q, g as H, h as Q, u as k, i as G, j as P, I as x, S as Y, K as j } from "./index-BWeanlvf.js";
3
3
  import { useQueries as z, useQuery as J } from "@tanstack/react-query";
4
4
  import { useRef as W, useEffect as T, useMemo as y } from "react";
5
- import { useTranslation as N } from "react-i18next";
5
+ import { useTranslation as A } from "react-i18next";
6
6
  const X = "normal", Z = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", ee = "A", te = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ne = (e, n) => e?.date ? F(e.date, n).formattedResult : n("DATE_ERROR_PARSE"), re = (e) => {
7
7
  if (!e.observationValue?.value)
8
8
  return "";
@@ -198,7 +198,7 @@ const w = (e, n, t, s, r) => {
198
198
  `obs-${e.id}`
199
199
  );
200
200
  }, ve = (e, n, t, s, r, o) => /* @__PURE__ */ v(
201
- A,
201
+ N,
202
202
  {
203
203
  title: e.display,
204
204
  id: `grouped-obs-${e.display}-${s}`,
@@ -212,10 +212,10 @@ const w = (e, n, t, s, r) => {
212
212
  groupedData: e,
213
213
  title: n = ""
214
214
  }) => {
215
- const { t } = N(), s = (r, o, i) => {
215
+ const { t } = A(), s = (r, o, i) => {
216
216
  const a = ne(r.encounterDetails, t);
217
217
  return /* @__PURE__ */ _(
218
- A,
218
+ N,
219
219
  {
220
220
  title: a,
221
221
  id: `encounter-${r.encounterId}`,
@@ -254,7 +254,7 @@ const w = (e, n, t, s, r) => {
254
254
  observations: fe,
255
255
  title: ge
256
256
  }, me = (e) => ["conceptUuid", e], be = (e, n) => ["observations", e, ...n], $e = ({ config: e }) => {
257
- const n = e, { conceptNames: t = [], conceptUuid: s = [] } = n, r = W(/* @__PURE__ */ new Set()), o = k(), { addNotification: i } = G(), { t: a } = N(), u = z({
257
+ const n = e, { conceptNames: t = [], conceptUuid: s = [] } = n, r = W(/* @__PURE__ */ new Set()), o = k(), { addNotification: i } = G(), { t: a } = A(), u = z({
258
258
  queries: t.map((l) => ({
259
259
  queryKey: me(l),
260
260
  queryFn: () => P(l),
@@ -264,10 +264,10 @@ const w = (e, n, t, s, r) => {
264
264
  T(() => {
265
265
  u.forEach((l, g) => {
266
266
  if (l.isError && !r.current.has(g)) {
267
- const U = t[g];
267
+ const L = t[g];
268
268
  i({
269
269
  title: a("ERROR_DEFAULT_TITLE"),
270
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: U }),
270
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: L }),
271
271
  type: "error"
272
272
  }), r.current.add(g);
273
273
  } else l.isError || r.current.delete(g);
@@ -297,7 +297,7 @@ const w = (e, n, t, s, r) => {
297
297
  { key: "name", header: "name" },
298
298
  { key: "value", header: "value" },
299
299
  { key: "form", header: "form" }
300
- ], $ = m || !p, S = E && p, V = (!f || f.entry?.length === 0 || d.length === 0) && p, B = S ? a("ERROR_FETCHING_OBSERVATIONS") : null, L = V ? a("NO_OBSERVATIONS_FOUND") : void 0, M = R.length > 0 && !$ && !S, h = n.titleTranslationKey, b = h ? a(h) : "";
300
+ ], $ = m || !p, S = E && p, V = (!f || f.entry?.length === 0 || d.length === 0) && p, B = S ? a("ERROR_FETCHING_OBSERVATIONS") : null, M = V ? a("NO_OBSERVATIONS_FOUND") : void 0, U = R.length > 0 && !$ && !S, h = n.titleTranslationKey, b = h ? a(h) : "";
301
301
  return /* @__PURE__ */ _(
302
302
  "div",
303
303
  {
@@ -316,7 +316,7 @@ const w = (e, n, t, s, r) => {
316
316
  children: /* @__PURE__ */ v("p", { children: b })
317
317
  }
318
318
  ),
319
- M ? /* @__PURE__ */ v(pe, { groupedData: R, title: b }) : /* @__PURE__ */ v(
319
+ U ? /* @__PURE__ */ v(pe, { groupedData: R, title: b }) : /* @__PURE__ */ v(
320
320
  j,
321
321
  {
322
322
  headers: C,
@@ -324,7 +324,7 @@ const w = (e, n, t, s, r) => {
324
324
  ariaLabel: a("OBSERVATIONS"),
325
325
  loading: $,
326
326
  errorStateMessage: B,
327
- emptyStateMessage: L,
327
+ emptyStateMessage: M,
328
328
  dataTestId: "observations-table"
329
329
  }
330
330
  )
@@ -1 +1 @@
1
- {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8NrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"GenericServiceRequestTable.d.ts","sourceRoot":"","sources":["../../src/genericServiceRequest/GenericServiceRequestTable.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,eAAO,MAAM,8BAA8B,GACzC,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAiB,MAAM,EAAE,6EAEoD,CAAC;AAehF;;;GAGG;AACH,QAAA,MAAM,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4OrD,CAAC;AAEF,eAAe,0BAA0B,CAAC"}