@bahmni/widgets 0.0.1-dev.110 → 0.0.1-dev.111

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, O as X, x as Z, L as ee, M as re, A as oe, i as te, a as ae, J as $, e as ne, t as se, K as ce, b as de, d as x, s as me } from "./index-DnRlH7sS.js";
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-C1xlT_ZV.js";
3
3
  import { useQuery as g } from "@tanstack/react-query";
4
- import { useState as U, useMemo as b, useCallback as N } from "react";
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", Re = "_memberValue_1pd36_94", De = "_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", 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 = {
8
8
  formsTableBody: ue,
9
9
  customAccordianItem: pe,
10
10
  formContent: _e,
@@ -18,14 +18,14 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
18
18
  groupMembers: Le,
19
19
  memberRow: Ae,
20
20
  memberLabel: Oe,
21
- memberValue: Re,
22
- abnormalValue: De,
21
+ memberValue: De,
22
+ abnormalValue: Re,
23
23
  commentSection: Ce,
24
24
  commentText: Fe,
25
25
  nestedGroup: Te,
26
26
  nestedGroupLabel: ve,
27
27
  nestedGroupMembers: Ee
28
- }, we = "ABNORMAL", q = (e) => {
28
+ }, we = "ABNORMAL", x = (e) => {
29
29
  const s = e.concept?.units, c = e.concept?.lowNormal, o = e.concept?.hiNormal, l = c != null, i = o != null, p = l && i ? ` (${c} - ${o})` : l ? ` (>${c})` : i ? ` (<${o})` : "", a = e.interpretation && e.interpretation.toUpperCase() === we;
30
30
  return { units: s, rangeString: p, isAbnormal: a };
31
31
  }, k = ({
@@ -52,7 +52,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
52
52
  `${a.concept.uuid}`
53
53
  )) })
54
54
  ] });
55
- const { units: l, rangeString: i, isAbnormal: p } = q(e);
55
+ const { units: l, rangeString: i, isAbnormal: p } = x(e);
56
56
  return /* @__PURE__ */ _(
57
57
  "div",
58
58
  {
@@ -88,11 +88,11 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
88
88
  ]
89
89
  }
90
90
  );
91
- }, Be = ({
91
+ }, Ie = ({
92
92
  observation: e,
93
93
  index: s
94
94
  }) => {
95
- const c = e.groupMembers && e.groupMembers.length > 0, { units: o, rangeString: l, isAbnormal: i } = q(e);
95
+ const c = e.groupMembers && e.groupMembers.length > 0, { units: o, rangeString: l, isAbnormal: i } = x(e);
96
96
  return /* @__PURE__ */ _(
97
97
  "div",
98
98
  {
@@ -147,23 +147,23 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
147
147
  },
148
148
  `${e.concept.uuid}-${s}`
149
149
  );
150
- }, qe = ({
150
+ }, xe = ({
151
151
  episodeOfCareUuids: e,
152
152
  encounterUuids: s,
153
153
  config: c
154
154
  }) => {
155
- const { t: o } = ie(), l = W(), [i, p] = U(!1), [a, O] = U(null), H = c?.numberOfVisits, R = X(
155
+ const { t: o } = ie(), l = W(), [i, p] = q(!1), [a, O] = q(null), j = c?.numberOfVisits, D = X(
156
156
  e,
157
157
  s
158
158
  ), {
159
159
  data: y = [],
160
- isLoading: D,
160
+ isLoading: R,
161
161
  isError: C,
162
- error: K
162
+ error: H
163
163
  } = g({
164
164
  queryKey: ["forms", l, e],
165
- queryFn: () => Z(l, void 0, H),
166
- enabled: !!l && !R
165
+ queryFn: () => Z(l, void 0, j),
166
+ enabled: !!l && !D
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({
@@ -176,8 +176,8 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
176
176
  if (a)
177
177
  return v(a.formName);
178
178
  }, [a, v]), {
179
- data: Ie,
180
- isLoading: P,
179
+ data: Be,
180
+ isLoading: K,
181
181
  error: E
182
182
  } = g({
183
183
  queryKey: ["formMetadata", M],
@@ -185,15 +185,15 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
185
185
  enabled: !!M && i
186
186
  }), {
187
187
  data: L,
188
- isLoading: j,
188
+ isLoading: P,
189
189
  error: w
190
190
  } = g({
191
191
  queryKey: ["formsEncounter", a?.encounterUuid],
192
192
  queryFn: () => oe(a.encounterUuid, !0),
193
193
  enabled: !!a?.encounterUuid && i
194
- }), B = b(() => !L?.observations || !a?.formName ? [] : L.observations.filter(
194
+ }), I = b(() => !L?.observations || !a?.formName ? [] : L.observations.filter(
195
195
  (u) => "formFieldPath" in u && typeof u.formFieldPath == "string" && u.formFieldPath.includes(a.formName)
196
- ), [L?.observations, a?.formName]), I = b(
196
+ ), [L?.observations, a?.formName]), B = b(
197
197
  () => [
198
198
  { key: "recordedOn", header: o("FORM_RECORDED_ON") },
199
199
  { key: "recordedBy", header: o("FORM_RECORDED_BY") }
@@ -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: D || C || V.length === 0 || R ? /* @__PURE__ */ t(
251
+ /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: R || C || V.length === 0 || D ? /* @__PURE__ */ t(
252
252
  $,
253
253
  {
254
- headers: I,
254
+ headers: B,
255
255
  ariaLabel: o("FORMS_HEADING"),
256
256
  rows: [],
257
- loading: D,
258
- errorStateMessage: C ? K?.message : void 0,
257
+ loading: R,
258
+ errorStateMessage: C ? H?.message : void 0,
259
259
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
260
260
  renderCell: G,
261
261
  className: r.formsTableBody,
@@ -273,7 +273,7 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
273
273
  children: /* @__PURE__ */ t(
274
274
  $,
275
275
  {
276
- headers: I,
276
+ headers: B,
277
277
  ariaLabel: o("FORMS_HEADING"),
278
278
  rows: m,
279
279
  loading: !1,
@@ -301,8 +301,8 @@ 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: P || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : E ? /* @__PURE__ */ t("div", { children: x(E).message ?? o("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: x(w).message ?? o("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ t("div", { className: r.formDetailsContainer, children: B.map((n, u) => /* @__PURE__ */ t(
305
- Be,
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(
305
+ Ie,
306
306
  {
307
307
  observation: n,
308
308
  index: u
@@ -316,5 +316,5 @@ const ue = "_formsTableBody_1pd36_1", pe = "_customAccordianItem_1pd36_6", _e =
316
316
  ] });
317
317
  };
318
318
  export {
319
- qe as default
319
+ xe as default
320
320
  };
@@ -1,9 +1,9 @@
1
1
  import { jsx as l, jsxs as T } from "react/jsx-runtime";
2
- import { f as B, g as $, l as L, h as F, C as x, z as k, u as q, j as Q, H as G, R as H, k as K, J as P } from "./index-DnRlH7sS.js";
3
- import { useQueries as j, useQuery as J } from "@tanstack/react-query";
4
- import { useRef as Y, useEffect as R, useMemo as m } from "react";
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-C1xlT_ZV.js";
3
+ import { useQueries as Y, useQuery as j } from "@tanstack/react-query";
4
+ import { useRef as z, useEffect as R, useMemo as m } from "react";
5
5
  import { useTranslation as _ } from "react-i18next";
6
- const z = "normal", W = "http://terminology.hl7.org/CodeSystem/referencerange-meaning", X = "A", Z = "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation", ee = (e, t) => e?.date ? B(e.date, t).formattedResult : t("DATE_ERROR_PARSE"), te = (e) => {
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) => {
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 z = "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 === Z && n.code === X
36
+ (n) => n.system === X && n.code === Z
37
37
  )
38
38
  );
39
39
  }
@@ -49,7 +49,7 @@ function se(e) {
49
49
  if (o && o.length > 0) {
50
50
  const a = o.find(
51
51
  (u) => u.type?.coding?.some(
52
- (p) => p.system === W && p.code === z
52
+ (p) => p.system === W && p.code === J
53
53
  )
54
54
  );
55
55
  a && (a.low || a.high) && (i.referenceRange = {
@@ -155,9 +155,9 @@ function ce(e) {
155
155
  });
156
156
  }
157
157
  const N = (e, t, n) => {
158
- const r = re(e, t), o = r.value, s = L(o);
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(k, { id: `${o}-video`, videoSrc: 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 }));
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,7 +222,7 @@ 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 = Y(/* @__PURE__ */ new Set()), s = q(), { addNotification: i } = Q(), { t: a } = _(), u = j({
225
+ const t = e, { conceptNames: n = [], conceptUuid: r = [] } = t, o = z(/* @__PURE__ */ new Set()), s = Q(), { addNotification: i } = k(), { t: a } = _(), u = Y({
226
226
  queries: n.map((c) => ({
227
227
  queryKey: fe(c),
228
228
  queryFn: () => G(c),
@@ -232,10 +232,10 @@ const N = (e, t, n) => {
232
232
  R(() => {
233
233
  u.forEach((c, d) => {
234
234
  if (c.isError && !o.current.has(d)) {
235
- const U = n[d];
235
+ const L = n[d];
236
236
  i({
237
237
  title: a("ERROR_DEFAULT_TITLE"),
238
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: U }),
238
+ message: a("ERROR_FETCHING_CONCEPT", { conceptName: L }),
239
239
  type: "error"
240
240
  }), o.current.add(d);
241
241
  } else c.isError || o.current.delete(d);
@@ -243,11 +243,11 @@ 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: D,
246
+ isLoading: A,
247
247
  isError: h
248
- } = J({
248
+ } = j({
249
249
  queryKey: ge(s, f),
250
- queryFn: () => H(s, f),
250
+ queryFn: () => K(s, f),
251
251
  enabled: !!s && f.length > 0 && g
252
252
  });
253
253
  R(() => {
@@ -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]), A = [
264
+ }, [v]), D = [
265
265
  { key: "name", header: "name" },
266
266
  { key: "value", header: "value" },
267
267
  { key: "form", header: "form" }
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;
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;
269
269
  return /* @__PURE__ */ T(
270
270
  "div",
271
271
  {
@@ -275,7 +275,7 @@ const N = (e, t, n) => {
275
275
  className: S.observations,
276
276
  children: [
277
277
  /* @__PURE__ */ l(
278
- K,
278
+ P,
279
279
  {
280
280
  id: "observations-title",
281
281
  testId: "observations-title-test-id",
@@ -285,9 +285,9 @@ const N = (e, t, n) => {
285
285
  }
286
286
  ),
287
287
  M ? /* @__PURE__ */ l(de, { groupedData: E }) : /* @__PURE__ */ l(
288
- P,
288
+ H,
289
289
  {
290
- headers: A,
290
+ headers: D,
291
291
  rows: [],
292
292
  ariaLabel: a("OBSERVATIONS"),
293
293
  loading: y,
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
- export declare const allergiesQueryKeys: (patientUUID: string) => readonly ["allergies", string];
3
2
  /**
4
3
  * Component to display patient allergies using SortableDataTable
5
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AllergiesTable.d.ts","sourceRoot":"","sources":["../../src/allergies/AllergiesTable.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAW5D,eAAO,MAAM,kBAAkB,GAAI,aAAa,MAAM,mCACjB,CAAC;AAiBtC;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAqI3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"AllergiesTable.d.ts","sourceRoot":"","sources":["../../src/allergies/AllergiesTable.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAyB5D;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAmI3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { default as React } from 'react';
2
- export declare const conditionsQueryKeys: (patientUUID: string) => readonly ["conditions", string];
3
2
  /**
4
3
  * Component to display patient conditions using SortableDataTable
5
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ConditionsTable.d.ts","sourceRoot":"","sources":["../../src/conditions/ConditionsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAQ5D,eAAO,MAAM,mBAAmB,GAAI,aAAa,MAAM,oCACjB,CAAC;AAUvC;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAgH5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ConditionsTable.d.ts","sourceRoot":"","sources":["../../src/conditions/ConditionsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAe5D;;GAEG;AACH,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EA8G5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,2 +1,2 @@
1
- export { default as ConditionsTable, conditionsQueryKeys, } from './ConditionsTable';
1
+ export { default as ConditionsTable } from './ConditionsTable';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,mBAAmB,GACpB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosesTable.d.ts","sourceRoot":"","sources":["../../src/diagnoses/DiagnosesTable.tsx"],"names":[],"mappings":"AAQA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAIpD;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA0E3B,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DiagnosesTable.d.ts","sourceRoot":"","sources":["../../src/diagnoses/DiagnosesTable.tsx"],"names":[],"mappings":"AAWA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAK/D;;GAEG;AACH,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EA6G3B,CAAC;AAEF,eAAe,cAAc,CAAC"}