@bahmni/widgets 0.0.1-dev.115 → 0.0.1-dev.117

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 _, jsx as t, Fragment as Y } from "react/jsx-runtime";
2
- import { c as h, u as W, I as X, U as Z, q as ee, j as re, D as oe, a as te, i as ae, J as $, e as ne, t as se, K as ce, b as de, d as U, o as me } from "./index-CJakYuEL.js";
2
+ import { c as h, u as W, C as X, F as Z, q as ee, U as re, I as oe, l as te, i as ae, J as $, e as ne, t as se, K as ce, a as de, b as U, d as me } from "./index-D-YpLeDp.js";
3
3
  import { useQuery as g } from "@tanstack/react-query";
4
4
  import { useState as q, useMemo as b, useCallback as N } from "react";
5
5
  import { createPortal as le } from "react-dom";
6
6
  import { useTranslation as ie } from "react-i18next";
7
- const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", fe = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", Ne = "_rowContainer_1pd36_43", he = "_groupLabel_1pd36_48", ye = "_rowLabel_1pd36_58", Me = "_rowValue_1pd36_67", Le = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Oe = "_memberLabel_1pd36_86", De = "_memberValue_1pd36_94", Re = "_abnormalValue_1pd36_102", Ce = "_commentSection_1pd36_110", Fe = "_commentText_1pd36_116", Te = "_nestedGroup_1pd36_125", ve = "_nestedGroupLabel_1pd36_132", Ee = "_nestedGroupMembers_1pd36_141", r = {
7
+ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e = "_formContent_1pd36_18", be = "_formDetailsContainer_1pd36_25", fe = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", Ne = "_rowContainer_1pd36_43", he = "_groupLabel_1pd36_48", ye = "_rowLabel_1pd36_58", Me = "_rowValue_1pd36_67", Le = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Oe = "_memberLabel_1pd36_86", Re = "_memberValue_1pd36_94", Ce = "_abnormalValue_1pd36_102", De = "_commentSection_1pd36_110", Fe = "_commentText_1pd36_116", Te = "_nestedGroup_1pd36_125", ve = "_nestedGroupLabel_1pd36_132", Ee = "_nestedGroupMembers_1pd36_141", r = {
8
8
  formsTableBody: ue,
9
9
  customAccordianItem: pe,
10
10
  formContent: _e,
@@ -18,9 +18,9 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
18
18
  groupMembers: Le,
19
19
  memberRow: Ae,
20
20
  memberLabel: Oe,
21
- memberValue: De,
22
- abnormalValue: Re,
23
- commentSection: Ce,
21
+ memberValue: Re,
22
+ abnormalValue: Ce,
23
+ commentSection: De,
24
24
  commentText: Fe,
25
25
  nestedGroup: Te,
26
26
  nestedGroupLabel: ve,
@@ -152,18 +152,18 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
152
152
  encounterUuids: s,
153
153
  config: c
154
154
  }) => {
155
- const { t: o } = ie(), l = W(), [i, p] = q(!1), [a, O] = q(null), j = c?.numberOfVisits, D = X(
155
+ const { t: o } = ie(), l = W(), [i, p] = q(!1), [a, O] = q(null), H = c?.numberOfVisits, R = X(
156
156
  e,
157
157
  s
158
158
  ), {
159
159
  data: y = [],
160
- isLoading: R,
161
- isError: C,
162
- error: H
160
+ isLoading: C,
161
+ isError: D,
162
+ error: K
163
163
  } = g({
164
164
  queryKey: ["forms", l, e],
165
- queryFn: () => Z(l, void 0, j),
166
- enabled: !!l && !D
165
+ queryFn: () => Z(l, void 0, H),
166
+ enabled: !!l && !R
167
167
  }), F = b(() => !s || s.length === 0 ? y : y.filter(
168
168
  (n) => s.includes(n.encounterUuid)
169
169
  ), [y, s]), { data: T = [] } = g({
@@ -177,7 +177,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
177
177
  return v(a.formName);
178
178
  }, [a, v]), {
179
179
  data: Be,
180
- isLoading: K,
180
+ isLoading: P,
181
181
  error: E
182
182
  } = g({
183
183
  queryKey: ["formMetadata", M],
@@ -185,7 +185,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
185
185
  enabled: !!M && i
186
186
  }), {
187
187
  data: L,
188
- isLoading: P,
188
+ isLoading: j,
189
189
  error: w
190
190
  } = g({
191
191
  queryKey: ["formsEncounter", a?.encounterUuid],
@@ -248,14 +248,14 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
248
248
  [S]
249
249
  );
250
250
  return /* @__PURE__ */ _(Y, { children: [
251
- /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: R || C || V.length === 0 || D ? /* @__PURE__ */ t(
251
+ /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || D || V.length === 0 || R ? /* @__PURE__ */ t(
252
252
  $,
253
253
  {
254
254
  headers: B,
255
255
  ariaLabel: o("FORMS_HEADING"),
256
256
  rows: [],
257
- loading: R,
258
- errorStateMessage: C ? H?.message : void 0,
257
+ loading: C,
258
+ errorStateMessage: D ? K?.message : void 0,
259
259
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
260
260
  renderCell: G,
261
261
  className: r.formsTableBody,
@@ -301,7 +301,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
301
301
  passiveModal: !0,
302
302
  size: "md",
303
303
  testId: "form-details-modal",
304
- children: /* @__PURE__ */ t("div", { className: r.formContent, children: K || P ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ t("div", { children: U(E).message ?? o("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? o("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: r.formDetailsContainer, children: I.map((n, u) => /* @__PURE__ */ t(
304
+ children: /* @__PURE__ */ t("div", { className: r.formContent, children: P || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ t("div", { children: U(E).message ?? o("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? o("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: r.formDetailsContainer, children: I.map((n, u) => /* @__PURE__ */ t(
305
305
  Ie,
306
306
  {
307
307
  observation: n,
@@ -1,9 +1,9 @@
1
1
  import { jsx as l, jsxs as T } from "react/jsx-runtime";
2
- import { Z as U, L as $, h as B, s as F, C as x, z as q, u as Q, f as k, W as G, A as K, R as P, J as H } from "./index-CJakYuEL.js";
2
+ import { f as U, L as $, p as B, s as F, g as x, z as G, u as q, h as Q, G as k, O as K, R as P, J as H } from "./index-D-YpLeDp.js";
3
3
  import { useQueries as Y, useQuery as j } from "@tanstack/react-query";
4
4
  import { useRef as z, useEffect as R, useMemo as m } from "react";
5
5
  import { useTranslation as _ } from "react-i18next";
6
- const J = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", Z = "A", X = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ee = (e, t) => e?.date ? U(e.date, t).formattedResult : t("DATE_ERROR_PARSE"), te = (e) => {
6
+ const J = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", X = "A", Z = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ee = (e, t) => e?.date ? U(e.date, t).formattedResult : t("DATE_ERROR_PARSE"), te = (e) => {
7
7
  const { value: t, unit: n } = e.observationValue;
8
8
  return n ? `${t} ${n}` : String(t);
9
9
  }, ne = (e) => {
@@ -33,7 +33,7 @@ const J = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-me
33
33
  function oe(e) {
34
34
  return !e.interpretation || e.interpretation.length === 0 ? !1 : e.interpretation.some(
35
35
  (t) => t.coding?.some(
36
- (n) => n.system === X && n.code === Z
36
+ (n) => n.system === Z && n.code === X
37
37
  )
38
38
  );
39
39
  }
@@ -157,7 +157,7 @@ function ce(e) {
157
157
  const N = (e, t, n) => {
158
158
  const r = re(e, t), o = r.value, s = B(o);
159
159
  let i = o;
160
- s === "Image" && (i = /* @__PURE__ */ l(x, { imageSrc: o, alt: o, id: `${o}-img` })), s === "Video" && (i = /* @__PURE__ */ l(q, { id: `${o}-video`, videoSrc: o }));
160
+ s === "Image" && (i = /* @__PURE__ */ l(x, { imageSrc: o, alt: o, id: `${o}-img` })), s === "Video" && (i = /* @__PURE__ */ l(G, { id: `${o}-video`, videoSrc: o }));
161
161
  const a = n("OBSERVATIONS_RECORDED_BY", {
162
162
  provider: r.provider
163
163
  }), u = e.observationValue?.isAbnormal ? `abnormal-obs-${e.id}` : `obs-${e.id}`;
@@ -222,10 +222,10 @@ const N = (e, t, n) => {
222
222
  observations: pe,
223
223
  title: ve
224
224
  }, fe = (e) => ["conceptUuid", e], ge = (e, t) => ["observations", e, ...t], Oe = ({ config: e }) => {
225
- const t = e, { conceptNames: n = [], conceptUuid: r = [] } = t, o = z(/* @__PURE__ */ new Set()), s = Q(), { addNotification: i } = k(), { t: a } = _(), u = Y({
225
+ const t = e, { conceptNames: n = [], conceptUuid: r = [] } = t, o = z(/* @__PURE__ */ new Set()), s = q(), { addNotification: i } = Q(), { t: a } = _(), u = Y({
226
226
  queries: n.map((c) => ({
227
227
  queryKey: fe(c),
228
- queryFn: () => G(c),
228
+ queryFn: () => k(c),
229
229
  enabled: !!c
230
230
  }))
231
231
  });
@@ -243,7 +243,7 @@ const N = (e, t, n) => {
243
243
  }, [u, n]);
244
244
  const p = m(() => u.map((c) => c.data?.uuid).filter((c) => !!c), [u]), f = m(() => [.../* @__PURE__ */ new Set([...p, ...r])], [p, r]), g = m(() => n.length === 0 ? !0 : u.every((c) => !c.isLoading), [u, n.length]), {
245
245
  data: v,
246
- isLoading: A,
246
+ isLoading: D,
247
247
  isError: h
248
248
  } = j({
249
249
  queryKey: ge(s, f),
@@ -261,11 +261,11 @@ const N = (e, t, n) => {
261
261
  if (!v) return [];
262
262
  const c = ae(v), d = ue(c);
263
263
  return ce(d);
264
- }, [v]), D = [
264
+ }, [v]), A = [
265
265
  { key: "name", header: "name" },
266
266
  { key: "value", header: "value" },
267
267
  { key: "form", header: "form" }
268
- ], y = A || !g, O = h && g, w = (!v || v.entry?.length === 0 || f.length === 0) && g, C = O ? a("ERROR_FETCHING_OBSERVATIONS") : null, V = w ? a("NO_OBSERVATIONS_FOUND") : void 0, M = E.length > 0 && !y && !O;
268
+ ], y = D || !g, O = h && g, w = (!v || v.entry?.length === 0 || f.length === 0) && g, C = O ? a("ERROR_FETCHING_OBSERVATIONS") : null, V = w ? a("NO_OBSERVATIONS_FOUND") : void 0, M = E.length > 0 && !y && !O;
269
269
  return /* @__PURE__ */ T(
270
270
  "div",
271
271
  {
@@ -287,7 +287,7 @@ const N = (e, t, n) => {
287
287
  M ? /* @__PURE__ */ l(de, { groupedData: E }) : /* @__PURE__ */ l(
288
288
  H,
289
289
  {
290
- headers: D,
290
+ headers: A,
291
291
  rows: [],
292
292
  ariaLabel: a("OBSERVATIONS"),
293
293
  loading: y,
@@ -71641,32 +71641,30 @@ const Ki = (t, e) => t?.length === 0 ? !1 : e?.length === 0, BWe = async () => {
71641
71641
  const r = await e.json();
71642
71642
  if (!r.resources || r.resources.length === 0)
71643
71643
  throw new Error(`No resources found for form ${t}`);
71644
- const n = JSON.parse(r.resources[0].value), a = yd();
71645
- let i = { labels: {}, concepts: {} };
71646
- if (n && typeof n == "object" && "translationsUrl" in n && typeof n.translationsUrl == "string")
71647
- try {
71648
- const s = n.name ?? r.name, l = r.uuid ?? n.uuid, d = n.version ?? r.version ?? "1", h = RWe(
71649
- s,
71650
- l,
71651
- d,
71644
+ const n = JSON.parse(r.resources[0].value), a = yd(), i = r.name ?? n.name, s = r.uuid ?? n.uuid, l = r.version ?? n.version ?? "1", d = r.published ?? !1;
71645
+ let h = { labels: {}, concepts: {} };
71646
+ if (n && typeof n == "object" && "translationsUrl" in n && typeof n.translationsUrl == "string") {
71647
+ const f = RWe(
71648
+ i,
71649
+ s,
71650
+ l,
71651
+ a
71652
+ ), w = await fetch(f);
71653
+ if (w.ok) {
71654
+ const E = await w.json();
71655
+ h = jBe(
71656
+ E,
71652
71657
  a
71653
- ), f = await fetch(h);
71654
- if (f.ok) {
71655
- const w = await f.json();
71656
- i = jBe(
71657
- w,
71658
- a
71659
- );
71660
- }
71661
- } catch {
71658
+ );
71662
71659
  }
71660
+ }
71663
71661
  return {
71664
- uuid: r.uuid,
71665
- name: r.name,
71666
- version: r.version,
71667
- published: r.published,
71662
+ uuid: s,
71663
+ name: i,
71664
+ version: l,
71665
+ published: d,
71668
71666
  schema: n,
71669
- translations: i
71667
+ translations: h
71670
71668
  };
71671
71669
  }, SJe = async (t, e, r) => {
71672
71670
  const n = SWe(t, r), a = await er(n);
@@ -75658,11 +75656,11 @@ const BJe = () => {
75658
75656
  },
75659
75657
  {
75660
75658
  type: "forms",
75661
- component: o1(() => import("./FormsTable-p73D2vYO.js"))
75659
+ component: o1(() => import("./FormsTable-Cd8ZplAR.js"))
75662
75660
  },
75663
75661
  {
75664
75662
  type: "observations",
75665
- component: o1(() => import("./Observations-FgHEt53Y.js"))
75663
+ component: o1(() => import("./Observations-DCBKlvuY.js"))
75666
75664
  }
75667
75665
  ];
75668
75666
  class Xr {
@@ -75714,47 +75712,47 @@ const PJe = (t) => {
75714
75712
  Xr.getInstance().reset();
75715
75713
  };
75716
75714
  export {
75717
- OJe as A,
75715
+ cKe as A,
75718
75716
  Wce as B,
75719
- uJe as C,
75720
- LJe as D,
75717
+ Ki as C,
75718
+ WKe as D,
75721
75719
  PJe as E,
75722
- jJe as F,
75723
- ZGe as G,
75724
- FJe as H,
75725
- Ki as I,
75720
+ SJe as F,
75721
+ TJe as G,
75722
+ jJe as H,
75723
+ LJe as I,
75726
75724
  Qr as J,
75727
75725
  D2 as K,
75728
75726
  dJe as L,
75729
75727
  DYe as M,
75730
75728
  YWe as N,
75731
- qJe as O,
75729
+ OJe as O,
75732
75730
  $Je as P,
75733
- UJe as Q,
75731
+ FJe as Q,
75734
75732
  Use as R,
75735
75733
  IJe as S,
75736
- WJe as T,
75737
- SJe as U,
75734
+ qJe as T,
75735
+ RJe as U,
75738
75736
  TGe as V,
75739
- TJe as W,
75740
- KJe as X,
75741
- _Je as Z,
75742
- _r as a,
75743
- Cke as b,
75737
+ UJe as W,
75738
+ WJe as X,
75739
+ KJe as Y,
75740
+ Cke as a,
75741
+ wr as b,
75744
75742
  Lle as c,
75745
- wr as d,
75743
+ qFe as d,
75746
75744
  T2 as e,
75747
- O1 as f,
75748
- cKe as g,
75749
- CJe as h,
75745
+ _Je as f,
75746
+ uJe as g,
75747
+ O1 as h,
75750
75748
  Oke as i,
75751
- RJe as j,
75752
- ZKe as k,
75753
- WKe as l,
75754
- YYe as m,
75755
- aGe as n,
75756
- qFe as o,
75757
- XGe as p,
75749
+ ZKe as j,
75750
+ YYe as k,
75751
+ _r as l,
75752
+ aGe as m,
75753
+ ZGe as n,
75754
+ XGe as o,
75755
+ CJe as p,
75758
75756
  DJe as q,
75759
75757
  kJe as r,
75760
75758
  Vke as s,
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { B as t, x as s, g as r, k as o, l as n, G as g, n as l, M as c, N as P, r as d, P as v, p as T, m as b, S as f, w as W, V as u, T as A, Q as m, F as p, H as C, O as S, E as y, X as N, y as U, f as h, u as x, v as D } from "./index-CJakYuEL.js";
1
+ import { B as t, x as s, A as o, j as r, D as n, n as g, m as l, M as c, N as P, r as d, P as v, o as T, k as b, S as W, w as A, V as f, X as u, W as m, H as C, Q as S, T as h, E as p, Y as y, y as D, h as N, u as U, v as x } from "./index-D-YpLeDp.js";
2
2
  import "react";
3
3
  export {
4
4
  t as ActivePractitionerContext,
5
5
  s as ActivePractitionerProvider,
6
- r as AllergiesTable,
7
- o as ConditionsTable,
6
+ o as AllergiesTable,
7
+ r as ConditionsTable,
8
8
  n as DiagnosesTable,
9
9
  g as GenericServiceRequestTable,
10
10
  l as LabInvestigation,
@@ -14,18 +14,18 @@ export {
14
14
  v as PatientDetails,
15
15
  T as PatientProgramsTable,
16
16
  b as RadiologyInvestigationTable,
17
- f as SearchPatient,
18
- W as UserPrivilegeProvider,
19
- u as VitalFlowSheet,
20
- A as getAllWidgetConfigs,
17
+ W as SearchPatient,
18
+ A as UserPrivilegeProvider,
19
+ f as VitalFlowSheet,
20
+ u as getAllWidgetConfigs,
21
21
  m as getAllWidgetTypes,
22
- p as getWidget,
23
- C as getWidgetConfig,
24
- S as hasWidget,
25
- y as registerWidget,
26
- N as resetWidgetRegistry,
27
- U as useActivePractitioner,
28
- h as useNotification,
29
- x as usePatientUUID,
30
- D as useUserPrivilege
22
+ C as getWidget,
23
+ S as getWidgetConfig,
24
+ h as hasWidget,
25
+ p as registerWidget,
26
+ y as resetWidgetRegistry,
27
+ D as useActivePractitioner,
28
+ N as useNotification,
29
+ U as usePatientUUID,
30
+ x as useUserPrivilege
31
31
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/widgets",
3
- "version": "0.0.1-dev.115",
3
+ "version": "0.0.1-dev.117",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",