@bahmni/widgets 0.0.1-dev.281 → 0.0.1-dev.282

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,71 +1,71 @@
1
1
  import { jsx as r, jsxs as T, Fragment as X } from "react/jsx-runtime";
2
- import { u as Y, a as W, y as J, X as Z, O as x, b as ee, I as te } from "./index-DCPifDyd.js";
2
+ import { u as Y, a as W, y as J, X as Z, O as x, b as ee, I as te } from "./index-FhPWvTDE.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
- import { useState as m, useCallback as _, useEffect as g, useMemo as p } from "react";
4
+ import { useState as l, useCallback as _, useEffect as g, useMemo as p } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
6
- const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3", le = "DocumentsTable-module_attachmentError__RI4U2", me = "DocumentsTable-module_documentIframe__ptq5I", ie = "DocumentsTable-module_documentImage__KQVgS", c = {
6
+ const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", le = "DocumentsTable-module_documentIframe__ptq5I", ue = "DocumentsTable-module_documentImage__KQVgS", c = {
7
7
  documentsTableBody: oe,
8
8
  viewAttachmentsLink: se,
9
9
  documentViewerContainer: re,
10
10
  attachmentItem: ce,
11
11
  attachmentCounter: de,
12
- attachmentError: le,
13
- documentIframe: me,
14
- documentImage: ie
15
- }, ue = {
12
+ attachmentError: me,
13
+ documentIframe: le,
14
+ documentImage: ue
15
+ }, ie = {
16
16
  documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
17
17
  documentType: "DOCUMENTS_TYPE",
18
18
  uploadedOn: "DOCUMENTS_UPLOADED_ON",
19
19
  uploadedBy: "DOCUMENTS_UPLOADED_BY",
20
- action: "DOCUMENTS_ACTION"
20
+ attachments: "DOCUMENTS_ATTACHMENTS"
21
21
  };
22
22
  function B(n) {
23
23
  return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
24
24
  }
25
- function he(n, f) {
25
+ function he(n, E) {
26
26
  return n.map((d) => ({
27
27
  key: d,
28
- header: f(ue[d])
28
+ header: E(ie[d])
29
29
  }));
30
30
  }
31
31
  const Te = [
32
32
  "documentIdentifier",
33
33
  "documentType",
34
+ "attachments",
34
35
  "uploadedOn",
35
- "uploadedBy",
36
- "action"
37
- ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], ge = ({ config: n, encounterUuids: f }) => {
38
- const [d, M] = m(!1), [s, U] = m(
36
+ "uploadedBy"
37
+ ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], ge = ({ config: n, encounterUuids: E }) => {
38
+ const [d, L] = l(!1), [s, U] = l(
39
39
  null
40
- ), [P, A] = m(
40
+ ), [P, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
- ), E = Y(), { t: o } = ae(), { addNotification: w } = W(), V = Number(n?.pageSize) || 5, [N, O] = m(1), [i, $] = m(V), [k, C] = m(void 0), v = _((e) => {
43
- U(e), M(!0);
42
+ ), f = Y(), { t: o } = ae(), { addNotification: w } = W(), V = Number(n?.pageSize) || 5, [N, O] = l(1), [u, $] = l(V), [k, C] = l(void 0), v = _((e) => {
43
+ U(e), L(!0);
44
44
  }, []), z = _(() => {
45
- M(!1), U(null), A(/* @__PURE__ */ new Set());
45
+ L(!1), U(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), R = _((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: u, isLoading: H, isError: S, error: y } = ne({
48
+ }, []), { data: i, isLoading: H, isError: S, error: y } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
- E,
52
51
  f,
52
+ E,
53
53
  N,
54
- i
54
+ u
55
55
  ],
56
- enabled: !!E,
56
+ enabled: !!f,
57
57
  queryFn: () => J(
58
- E,
59
58
  f,
60
- i,
59
+ E,
60
+ u,
61
61
  N
62
62
  )
63
63
  });
64
64
  g(() => {
65
- u && C(u.total);
66
- }, [u]), g(() => {
65
+ i && C(i.total);
66
+ }, [i]), g(() => {
67
67
  O(1), C(void 0);
68
- }, [E]), g(() => {
68
+ }, [f]), g(() => {
69
69
  S && w({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
71
  message: y?.message ?? "",
@@ -76,15 +76,15 @@ const Te = [
76
76
  return (async () => {
77
77
  if (!d || !s) return;
78
78
  const a = /* @__PURE__ */ new Set(), I = F(s);
79
- for (let l = 0; l < I.length; l++) {
80
- const b = B(I[l].url);
79
+ for (let m = 0; m < I.length; m++) {
80
+ const b = B(I[m].url);
81
81
  try {
82
82
  (await fetch(b, {
83
83
  method: "HEAD",
84
84
  signal: e.signal
85
- })).ok || a.add(l);
86
- } catch (L) {
87
- L instanceof Error && L.name !== "AbortError" && a.add(l);
85
+ })).ok || a.add(m);
86
+ } catch (M) {
87
+ M instanceof Error && M.name !== "AbortError" && a.add(m);
88
88
  }
89
89
  }
90
90
  e.signal.aborted || A(a);
@@ -92,16 +92,16 @@ const Te = [
92
92
  }, [d, s]);
93
93
  const q = _(
94
94
  (e, t) => {
95
- t !== i ? ($(t), O(1), C(void 0)) : O(e);
95
+ t !== u ? ($(t), O(1), C(void 0)) : O(e);
96
96
  },
97
- [i]
97
+ [u]
98
98
  ), D = p(
99
99
  () => n?.fields ?? Te,
100
100
  [n?.fields]
101
- ), j = p(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), K = p(() => he(D, o), [D, o]), G = p(
101
+ ), j = p(() => [...i?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [i]), K = p(() => he(D, o), [D, o]), G = p(
102
102
  () => D.map((e) => ({
103
103
  key: e,
104
- sortable: e !== "action"
104
+ sortable: e !== "attachments"
105
105
  })),
106
106
  [D]
107
107
  ), h = p(
@@ -122,7 +122,7 @@ const Te = [
122
122
  ).formattedResult || o("DOCUMENTS_NOT_AVAILABLE");
123
123
  case "uploadedBy":
124
124
  return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
125
- case "action":
125
+ case "attachments":
126
126
  return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ r(
127
127
  Z,
128
128
  {
@@ -152,7 +152,7 @@ const Te = [
152
152
  renderCell: Q,
153
153
  className: c.documentsTableBody,
154
154
  dataTestId: "documents-table",
155
- pageSize: i,
155
+ pageSize: u,
156
156
  totalItems: k,
157
157
  page: N,
158
158
  onPageChange: q
@@ -170,7 +170,7 @@ const Te = [
170
170
  size: "lg",
171
171
  testId: "document-view-modal",
172
172
  children: /* @__PURE__ */ r("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
173
- const a = B(e.url), I = e.contentType?.toLowerCase().includes("pdf"), l = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
173
+ const a = B(e.url), I = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), b = P.has(t);
174
174
  return a === "#" || b ? /* @__PURE__ */ T(
175
175
  "div",
176
176
  {
@@ -197,7 +197,7 @@ const Te = [
197
197
  "/",
198
198
  h.length
199
199
  ] }),
200
- l ? /* @__PURE__ */ r(
200
+ m ? /* @__PURE__ */ r(
201
201
  "img",
202
202
  {
203
203
  src: a,
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
2
- import { K as re, u as te, x as oe, Q as ae, W as se, J as ne, L as de, d as ie, M as U, O as me, X as le, b as x, c as ce, e as ue, I as fe, f as ye } from "./index-DCPifDyd.js";
2
+ import { K as re, u as te, x as oe, Q as ae, W as se, J as ne, L as de, d as ie, M as U, O as me, X as le, b as x, c as ce, e as ue, I as fe, f as ye } from "./index-FhPWvTDE.js";
3
3
  import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
4
4
  import { useState as k, useMemo as d, useCallback as b } from "react";
5
5
  import { useTranslation as pe } from "react-i18next";
@@ -1,5 +1,5 @@
1
1
  import { jsx as l, jsxs as U } from "react/jsx-runtime";
2
- import { g as K, h as C, t as V, i as Q, j as k, p as q, k as G, l as P, u as j, a as H, U as z, N as J, d as Y, m as W, n as X, s as Z, o as x, b as ee } from "./index-DCPifDyd.js";
2
+ import { g as K, h as C, t as V, i as Q, j as k, p as q, k as G, l as P, u as j, a as H, U as z, N as J, d as Y, m as W, n as X, s as Z, o as x, b as ee } from "./index-FhPWvTDE.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
4
  import { useRef as oe, useEffect as N, useMemo as g } from "react";
5
5
  import { useTranslation as D } from "react-i18next";
@@ -93255,7 +93255,7 @@ const dHt = [
93255
93255
  },
93256
93256
  {
93257
93257
  type: "patientDocuments",
93258
- component: B1(() => import("./DocumentsTable-hMQu-BO-.js"))
93258
+ component: B1(() => import("./DocumentsTable-_t5Q-fgi.js"))
93259
93259
  },
93260
93260
  {
93261
93261
  type: "flowSheet",
@@ -93263,7 +93263,7 @@ const dHt = [
93263
93263
  },
93264
93264
  {
93265
93265
  type: "forms",
93266
- component: B1(() => import("./FormsTable-DxqsW2QC.js"))
93266
+ component: B1(() => import("./FormsTable-Dr7LvEY-.js"))
93267
93267
  },
93268
93268
  {
93269
93269
  type: "labOrders",
@@ -93271,7 +93271,7 @@ const dHt = [
93271
93271
  },
93272
93272
  {
93273
93273
  type: "observations",
93274
- component: B1(() => import("./Observations-DfkGMngf.js"))
93274
+ component: B1(() => import("./Observations-DGtRQbJf.js"))
93275
93275
  },
93276
93276
  {
93277
93277
  type: "ordersControl",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a4 as t, a2 as s, A as o, a1 as r, q as n, a0 as g, r as l, C as c, v as P, D as d, G as v, F as C, B as T, ae as b, ag as f, ah as u, w as A, T as m, Y as p, f as I, P as R, E as S, H as D, z as L, R as W, S as y, $ as N, V as U, a6 as h, a5 as x, ac as H, ab as E, a8 as G, a9 as O, aa as V, a7 as _, ad as q, a3 as w, _ as z, af as B, a as F, u as M, Z as k } from "./index-DCPifDyd.js";
1
+ import { a4 as t, a2 as s, A as o, a1 as r, q as n, a0 as g, r as l, C as c, v as P, D as d, G as v, F as C, B as T, ae as b, ag as f, ah as u, w as A, T as m, Y as p, f as I, P as R, E as S, H as D, z as L, R as W, S as y, $ as N, V as U, a6 as h, a5 as x, ac as H, ab as E, a8 as G, a9 as O, aa as V, a7 as _, ad as q, a3 as w, _ as z, af as B, a as F, u as M, Z as k } from "./index-FhPWvTDE.js";
2
2
  import "react";
3
3
  export {
4
4
  t as ActivePractitionerContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/widgets",
3
- "version": "0.0.1-dev.281",
3
+ "version": "0.0.1-dev.282",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",