@bahmni/widgets 0.0.1-dev.169 → 0.0.1-dev.171

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
1
  import { jsxs as b, jsx as d, Fragment as k } from "react/jsx-runtime";
2
- import { c as C, L as te, N as re, $ as ae, e as oe, A as se, u as ne, l as de, v as ie, g as le, y as ce, a as me, I as ue, b as pe, m as be, t as x, H as fe, C as _e, d as $e, o as ge, f as H, h as ye } from "./index-CDSi0jbD.js";
3
- import { useQueryClient as he, useQuery as O } from "@tanstack/react-query";
4
- import { useState as P, useMemo as h, useCallback as F } from "react";
2
+ import { c as C, x as te, N as re, $ as ae, e as oe, b as se, u as ne, p as de, d as ie, f as le, w as ce, g as me, L as ue, E as pe, h as be, t as U, H as fe, C as _e, m as $e, o as ge, i as H, l as he } from "./index-BBA52eg6.js";
3
+ import { useQueryClient as ye, useQuery as O } from "@tanstack/react-query";
4
+ import { useState as P, useMemo as y, useCallback as F } from "react";
5
5
  import { useTranslation as ve } from "react-i18next";
6
- const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", Me = "_groupContainer_1pd36_39", Re = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", De = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Ae = "_memberRow_1pd36_81", Ie = "_memberLabel_1pd36_86", Ee = "_memberValue_1pd36_94", Be = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", Ge = "_commentText_1pd36_116", qe = "_nestedGroup_1pd36_125", Ue = "_nestedGroupLabel_1pd36_132", xe = "_nestedGroupMembers_1pd36_141", o = {
6
+ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe = "_formContent_1pd36_18", Fe = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", Me = "_groupContainer_1pd36_39", Re = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", De = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ve = "_groupMembers_1pd36_75", Ee = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ie = "_memberValue_1pd36_94", Be = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", Ge = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", qe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
7
7
  formsTableBody: Ne,
8
8
  customAccordianItem: Le,
9
9
  formContent: Oe,
@@ -15,15 +15,15 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
15
15
  rowLabel: De,
16
16
  rowValue: Te,
17
17
  groupMembers: Ve,
18
- memberRow: Ae,
19
- memberLabel: Ie,
20
- memberValue: Ee,
18
+ memberRow: Ee,
19
+ memberLabel: Ae,
20
+ memberValue: Ie,
21
21
  abnormalValue: Be,
22
22
  commentSection: Se,
23
23
  commentText: Ge,
24
- nestedGroup: qe,
25
- nestedGroupLabel: Ue,
26
- nestedGroupMembers: xe
24
+ nestedGroup: xe,
25
+ nestedGroupLabel: qe,
26
+ nestedGroupMembers: Ue
27
27
  }, K = (e) => {
28
28
  const t = te(e);
29
29
  return t === "Image" ? /* @__PURE__ */ d(
@@ -81,7 +81,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
81
81
  ]
82
82
  }
83
83
  );
84
- const { units: p, rangeString: y, isAbnormal: f } = j(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
84
+ const { units: p, rangeString: h, isAbnormal: f } = j(e), _ = e.observationValue?.value?.toString(), $ = _ ? K(_) : null;
85
85
  return /* @__PURE__ */ b(k, { children: [
86
86
  /* @__PURE__ */ b(
87
87
  "div",
@@ -100,7 +100,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
100
100
  "data-testid": `${r}obs-member-label-${i}-${a}`,
101
101
  children: [
102
102
  i,
103
- y
103
+ h
104
104
  ]
105
105
  }
106
106
  ),
@@ -140,7 +140,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
140
140
  formName: a = "",
141
141
  comment: n
142
142
  }) => {
143
- const s = e.members && e.members.length > 0, { units: c, rangeString: i, isAbnormal: r } = j(e), p = a ? `${a}-` : "", y = e.observationValue?.value?.toString(), f = y ? K(y) : null;
143
+ const s = e.members && e.members.length > 0, { units: c, rangeString: i, isAbnormal: r } = j(e), p = a ? `${a}-` : "", h = e.observationValue?.value?.toString(), f = h ? K(h) : null;
144
144
  return /* @__PURE__ */ b(
145
145
  "div",
146
146
  {
@@ -253,10 +253,10 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
253
253
  encounterUuids: t,
254
254
  config: a
255
255
  }) => {
256
- const { t: n } = ve(), s = ne(), [c, i] = P(!1), [r, p] = P(null), y = a?.numberOfVisits, f = de(
256
+ const { t: n } = ve(), s = ne(), [c, i] = P(!1), [r, p] = P(null), h = a?.numberOfVisits, f = de(
257
257
  e,
258
258
  t
259
- ), _ = he(), {
259
+ ), _ = ye(), {
260
260
  data: $ = [],
261
261
  isLoading: v,
262
262
  isError: N,
@@ -264,27 +264,27 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
264
264
  refetch: W
265
265
  } = O({
266
266
  queryKey: ["forms", s, e],
267
- queryFn: () => ie(s, void 0, y),
267
+ queryFn: () => ie(s, void 0, h),
268
268
  enabled: !!s && !f
269
- }), T = h(() => !t || t.length === 0 ? $ : $.filter(
269
+ }), T = y(() => !t || t.length === 0 ? $ : $.filter(
270
270
  (l) => t.includes(l.encounterUuid)
271
271
  ), [$, t]), { data: V = [] } = O({
272
272
  queryKey: ["observationForms"],
273
273
  queryFn: () => le()
274
- }), A = F(
274
+ }), E = F(
275
275
  (l) => V.find((m) => m.name === l)?.uuid,
276
276
  [V]
277
- ), M = h(() => {
277
+ ), M = y(() => {
278
278
  if (r)
279
- return A(r.formName);
280
- }, [r, A]), { isLoading: Y, error: I } = O({
279
+ return E(r.formName);
280
+ }, [r, E]), { isLoading: Y, error: A } = O({
281
281
  queryKey: ["formMetadata", M],
282
282
  queryFn: () => ce(M),
283
283
  enabled: !!M && c
284
284
  }), {
285
285
  data: R,
286
286
  isLoading: J,
287
- error: E
287
+ error: I
288
288
  } = O({
289
289
  queryKey: ["formsEncounterFHIR", r?.encounterUuid],
290
290
  queryFn: () => me(r.encounterUuid),
@@ -296,22 +296,22 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
296
296
  },
297
297
  [s]
298
298
  );
299
- const B = h(() => !R || !r?.formName ? [] : je(
299
+ const B = y(() => !R || !r?.formName ? [] : je(
300
300
  R,
301
301
  r.formName
302
- ), [R, r?.formName]), S = h(
302
+ ), [R, r?.formName]), S = y(
303
303
  () => [
304
304
  { key: "recordedOn", header: n("FORM_RECORDED_ON") },
305
305
  { key: "recordedBy", header: n("FORM_RECORDED_BY") }
306
306
  ],
307
307
  [n]
308
- ), X = h(
308
+ ), X = y(
309
309
  () => [
310
310
  { key: "recordedOn", sortable: !0 },
311
311
  { key: "recordedBy", sortable: !0 }
312
312
  ],
313
313
  []
314
- ), G = h(() => {
314
+ ), G = y(() => {
315
315
  const l = T.reduce(
316
316
  (m, u) => {
317
317
  const L = u.formName;
@@ -320,7 +320,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
320
320
  return m[L].push({
321
321
  id: u.encounterUuid,
322
322
  formName: u.formName,
323
- recordedOn: pe(u.encounterDateTime, n, ye).formattedResult,
323
+ recordedOn: pe(u.encounterDateTime, n, he).formattedResult,
324
324
  recordedBy: w ?? "--",
325
325
  encounterDateTime: u.encounterDateTime,
326
326
  encounterUuid: u.encounterUuid
@@ -336,26 +336,26 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
336
336
  )
337
337
  })
338
338
  ).sort((m, u) => m.formName.localeCompare(u.formName));
339
- }, [T, n]), q = F((l) => {
339
+ }, [T, n]), x = F((l) => {
340
340
  p(l), i(!0);
341
341
  }, []), Z = F(() => {
342
342
  i(!1), p(null);
343
- }, []), U = F(
343
+ }, []), q = F(
344
344
  (l, g) => {
345
345
  switch (g) {
346
346
  case "recordedOn":
347
- return /* @__PURE__ */ d(be, { onClick: () => q(l), children: l.recordedOn });
347
+ return /* @__PURE__ */ d(be, { onClick: () => x(l), children: l.recordedOn });
348
348
  case "recordedBy":
349
349
  return l.recordedBy;
350
350
  default:
351
351
  return null;
352
352
  }
353
353
  },
354
- [q]
354
+ [x]
355
355
  );
356
356
  return /* @__PURE__ */ b(k, { children: [
357
357
  /* @__PURE__ */ d("div", { "data-testid": "forms-table", children: v || N || G.length === 0 || f ? /* @__PURE__ */ d(
358
- x,
358
+ U,
359
359
  {
360
360
  headers: S,
361
361
  ariaLabel: n("FORMS_HEADING"),
@@ -363,7 +363,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
363
363
  loading: v,
364
364
  errorStateMessage: N ? z?.message : void 0,
365
365
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
366
- renderCell: U,
366
+ renderCell: q,
367
367
  className: o.formsTableBody,
368
368
  dataTestId: "forms-table"
369
369
  }
@@ -377,7 +377,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
377
377
  testId: `accordian-title-${m}`,
378
378
  open: g === 0,
379
379
  children: /* @__PURE__ */ d(
380
- x,
380
+ U,
381
381
  {
382
382
  headers: S,
383
383
  ariaLabel: n("FORMS_HEADING"),
@@ -386,7 +386,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
386
386
  errorStateMessage: "",
387
387
  sortable: X,
388
388
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
389
- renderCell: U,
389
+ renderCell: q,
390
390
  className: o.formsTableBody,
391
391
  dataTestId: `forms-table-${m}`
392
392
  }
@@ -406,7 +406,7 @@ const Ne = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Oe =
406
406
  passiveModal: !0,
407
407
  size: "md",
408
408
  testId: "form-details-modal",
409
- children: /* @__PURE__ */ d("div", { className: o.formContent, children: Y || J ? /* @__PURE__ */ d(ge, { width: "100%", lineCount: 3 }) : I ? /* @__PURE__ */ d("div", { children: H(I).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ d("div", { children: H(E).message ?? n("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ d("div", { className: o.formDetailsContainer, children: B.map(({ obs: l, comment: g }, m) => /* @__PURE__ */ d(
409
+ children: /* @__PURE__ */ d("div", { className: o.formContent, children: Y || J ? /* @__PURE__ */ d(ge, { width: "100%", lineCount: 3 }) : A ? /* @__PURE__ */ d("div", { children: H(A).message ?? n("ERROR_FETCHING_FORM_METADATA") }) : I ? /* @__PURE__ */ d("div", { children: H(I).message ?? n("ERROR_FETCHING_FORM_DATA") }) : B.length > 0 ? /* @__PURE__ */ d("div", { className: o.formDetailsContainer, children: B.map(({ obs: l, comment: g }, m) => /* @__PURE__ */ d(
410
410
  He,
411
411
  {
412
412
  observation: l,
@@ -1,17 +1,17 @@
1
1
  import { jsx as d, jsxs as S } from "react/jsx-runtime";
2
- import { i as q, _ as C, j as w, L as M, k as V, N as K, $ as Q, u as G, n as j, p as H, q as P, I as z, e as Y, r as J, s as W, B as X, t as Z } from "./index-CDSi0jbD.js";
3
- import { useQueries as x, useQuery as ee } from "@tanstack/react-query";
4
- import { useRef as te, useEffect as $, useMemo as h } from "react";
2
+ import { j as q, _ as C, n as M, x as V, q as k, N as K, $ as Q, u as G, a as j, r as H, s as P, L as z, e as Y, v as x, y as J, B as W, t as X } from "./index-BBA52eg6.js";
3
+ import { useQueries as Z, useQuery as ee } from "@tanstack/react-query";
4
+ import { useRef as te, useEffect as I, useMemo as h } from "react";
5
5
  import { useTranslation as D } from "react-i18next";
6
6
  const U = (t, c, n, l, o) => {
7
- const s = w(t, c), r = s.value, a = M(r);
7
+ const s = M(t, c), r = s.value, a = V(r);
8
8
  let i = r;
9
9
  a === "Image" && (i = /* @__PURE__ */ d(K, { imageSrc: r, alt: r, id: `${r}-img` })), a === "Video" && (i = /* @__PURE__ */ d(Q, { id: `${r}-video`, videoSrc: r }));
10
10
  const u = o("OBSERVATIONS_RECORDED_BY", {
11
11
  provider: s.provider
12
12
  }), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${p}-${b}-${n}-${c}` : `${p}-${b}-${n}-${c}`;
13
13
  return /* @__PURE__ */ d(
14
- V,
14
+ k,
15
15
  {
16
16
  header: s.header,
17
17
  value: i,
@@ -79,14 +79,14 @@ const U = (t, c, n, l, o) => {
79
79
  observations: re,
80
80
  title: ae
81
81
  }, ne = (t) => ["conceptUuid", t], ie = (t, c) => ["observations", t, ...c], pe = ({ config: t }) => {
82
- const c = t, { conceptNames: n = [], conceptUuid: l = [] } = c, o = te(/* @__PURE__ */ new Set()), s = G(), { addNotification: r } = j(), { t: a } = D(), i = x({
82
+ const c = t, { conceptNames: n = [], conceptUuid: l = [] } = c, o = te(/* @__PURE__ */ new Set()), s = G(), { addNotification: r } = j(), { t: a } = D(), i = Z({
83
83
  queries: n.map((e) => ({
84
84
  queryKey: ne(e),
85
85
  queryFn: () => H(e),
86
86
  enabled: !!e
87
87
  }))
88
88
  });
89
- $(() => {
89
+ I(() => {
90
90
  i.forEach((e, m) => {
91
91
  if (e.isError && !o.current.has(m)) {
92
92
  const g = n[m];
@@ -115,7 +115,7 @@ const U = (t, c, n, l, o) => {
115
115
  ) && R();
116
116
  },
117
117
  [s, R]
118
- ), $(() => {
118
+ ), I(() => {
119
119
  O && r({
120
120
  title: a("ERROR_DEFAULT_TITLE"),
121
121
  message: a("ERROR_FETCHING_OBSERVATIONS"),
@@ -124,13 +124,13 @@ const U = (t, c, n, l, o) => {
124
124
  }, [O]);
125
125
  const T = h(() => {
126
126
  if (!p) return [];
127
- const e = Y(p), m = J(e);
128
- return W(m);
127
+ const e = Y(p), m = x(e);
128
+ return J(m);
129
129
  }, [p]), B = [
130
130
  { key: "name", header: "name" },
131
131
  { key: "value", header: "value" },
132
132
  { key: "form", header: "form" }
133
- ], I = f || !v, _ = O && v, L = (!p || p.entry?.length === 0 || b.length === 0) && v, A = _ ? a("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? a("NO_OBSERVATIONS_FOUND") : void 0, k = T.length > 0 && !I && !_, E = c.titleTranslationKey, y = E ? a(E) : "";
133
+ ], _ = f || !v, $ = O && v, L = (!p || p.entry?.length === 0 || b.length === 0) && v, A = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? a("NO_OBSERVATIONS_FOUND") : void 0, w = T.length > 0 && !_ && !$, E = c.titleTranslationKey, y = E ? a(E) : "";
134
134
  return /* @__PURE__ */ S(
135
135
  "div",
136
136
  {
@@ -140,7 +140,7 @@ const U = (t, c, n, l, o) => {
140
140
  className: N.observations,
141
141
  children: [
142
142
  /* @__PURE__ */ d(
143
- X,
143
+ W,
144
144
  {
145
145
  id: "observations-title",
146
146
  testId: E ? `observations-title-${y}` : "observations-title",
@@ -149,13 +149,13 @@ const U = (t, c, n, l, o) => {
149
149
  children: /* @__PURE__ */ d("p", { children: y })
150
150
  }
151
151
  ),
152
- k ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
- Z,
152
+ w ? /* @__PURE__ */ d(oe, { groupedData: T, title: y }) : /* @__PURE__ */ d(
153
+ X,
154
154
  {
155
155
  headers: B,
156
156
  rows: [],
157
157
  ariaLabel: a("OBSERVATIONS"),
158
- loading: I,
158
+ loading: _,
159
159
  errorStateMessage: A,
160
160
  emptyStateMessage: F,
161
161
  dataTestId: "observations-table"
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { WidgetProps } from '../registry/model';
3
+ declare const DocumentsTable: React.FC<WidgetProps>;
4
+ export default DocumentsTable;
5
+ //# sourceMappingURL=DocumentsTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiChD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyIzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const DOCUMENT_ICON_SIZE = 16;
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/documents/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as DocumentsTable } from './DocumentsTable';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function getFileTypeCategory(contentType?: string): 'pdf' | 'image' | 'document';
2
+ export declare function buildDocumentUrl(documentUrl: string): string;
3
+ export declare function createDocumentHeaders(fields: string[], t: (key: string) => string): Array<{
4
+ key: string;
5
+ header: string;
6
+ }>;
7
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documents/utils.ts"],"names":[],"mappings":"AAOA,wBAAgB,mBAAmB,CACjC,WAAW,CAAC,EAAE,MAAM,GACnB,KAAK,GAAG,OAAO,GAAG,UAAU,CAgB9B;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EAAE,EAChB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GACzB,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAKxC"}