@bahmni/widgets 0.0.1-dev.403 → 0.0.1-dev.405

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.
Files changed (23) hide show
  1. package/dist/{DocumentsTable-Dzer5eOY.js → DocumentsTable-CGenAqfr.js} +4 -4
  2. package/dist/{FormsTable-CwXX7pm4.js → FormsTable-CWgke1-_.js} +15 -15
  3. package/dist/{Observations-00pOtH3y.js → Observations-lpTgbjJ8.js} +61 -61
  4. package/dist/{index-BqbZxHvD.js → index-DSanaOUz.js} +10357 -10205
  5. package/dist/index.css +1 -1
  6. package/dist/index.js +7 -7
  7. package/dist/search/commonSearch/CommonSearchWidget.d.ts.map +1 -1
  8. package/dist/search/commonSearch/__tests__/__mocks__/commonSearchWidgetMocks.d.ts.map +1 -1
  9. package/dist/search/commonSearch/__tests__/__mocks__/resultsTableMocks.d.ts +1 -0
  10. package/dist/search/commonSearch/__tests__/__mocks__/resultsTableMocks.d.ts.map +1 -1
  11. package/dist/search/commonSearch/__tests__/__mocks__/searchFormMocks.d.ts.map +1 -1
  12. package/dist/search/commonSearch/__tests__/__mocks__/searchSummaryMocks.d.ts.map +1 -1
  13. package/dist/search/commonSearch/__tests__/__mocks__/utilsMocks.d.ts.map +1 -1
  14. package/dist/search/commonSearch/components/ResultsTable.d.ts +13 -2
  15. package/dist/search/commonSearch/components/ResultsTable.d.ts.map +1 -1
  16. package/dist/search/commonSearch/constants.d.ts +1 -0
  17. package/dist/search/commonSearch/constants.d.ts.map +1 -1
  18. package/dist/search/commonSearch/models.d.ts +36 -1
  19. package/dist/search/commonSearch/models.d.ts.map +1 -1
  20. package/dist/search/commonSearch/schema.json.d.ts +6 -0
  21. package/dist/search/commonSearch/utils.d.ts +4 -2
  22. package/dist/search/commonSearch/utils.d.ts.map +1 -1
  23. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as T, Fragment as Q } from "react/jsx-runtime";
2
- import { u as W, a as X, L as J, m as Z, Y as x, b as ee, F as te } from "./index-BqbZxHvD.js";
2
+ import { u as W, a as X, L as J, V as Z, Y as x, b as ee, F as te } from "./index-DSanaOUz.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -37,9 +37,9 @@ const Te = [
37
37
  ], _e = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
38
38
  const [d, M] = l(!1), [s, U] = l(
39
39
  null
40
- ), [P, A] = l(
40
+ ), [V, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
- ), E = W(), { t: o } = ae(), { addNotification: w } = X(), V = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(V), [k, O] = l(void 0), v = _((e) => {
42
+ ), E = W(), { t: o } = ae(), { addNotification: w } = X(), P = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(P), [k, O] = l(void 0), v = _((e) => {
43
43
  U(e), M(!0);
44
44
  }, []), z = _(() => {
45
45
  M(!1), U(null), A(/* @__PURE__ */ new Set());
@@ -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 = R(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), y = P.has(t);
173
+ const a = R(e.url), g = e.contentType?.toLowerCase().includes("pdf"), m = (e.contentType?.toLowerCase().includes("image") ?? !1) || _e.test(e.url ?? ""), y = V.has(t);
174
174
  return a === "#" || y ? /* @__PURE__ */ T(
175
175
  "div",
176
176
  {
@@ -1,13 +1,13 @@
1
1
  import { jsx as i, jsxs as $, Fragment as ge } from "react/jsx-runtime";
2
- import { u as be, c as Oe, d as Ne, f as Ee, l as Te, i as ve, e as Fe, B as Ie, O as Ae, g as _e, h as Re, j as G, Y as De, C as K, k as z, m as Me, b as Y, r as Be, n as Le, F as Ce, o as Se, p as Ue } from "./index-BqbZxHvD.js";
2
+ import { u as be, c as Oe, d as Ne, f as Ee, l as Te, i as ve, e as Fe, B as Ie, O as Ae, g as _e, h as Re, j as G, Y as De, C as K, k as z, V as Me, b as Y, r as Be, m as Le, F as Ce, n as Se, o as Ue } from "./index-DSanaOUz.js";
3
3
  import { useQueryClient as ke, useQuery as E } from "@tanstack/react-query";
4
4
  import { useState as Q, useMemo as d, useCallback as c } from "react";
5
5
  import { useTranslation as we } from "react-i18next";
6
- const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", Pe = "FormsTable-module_customAccordianItem__isszs", T = {
6
+ const He = "FormsTable-module_formsTableBody__SvGha", Ve = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", T = {
7
7
  formsTableBody: He,
8
- modalHeading: qe,
9
- customAccordianItem: Pe
10
- }, Ve = "startConsultation", ze = ({
8
+ modalHeading: Ve,
9
+ customAccordianItem: qe
10
+ }, Pe = "startConsultation", ze = ({
11
11
  episodeOfCareUuids: D,
12
12
  encounterUuids: m,
13
13
  config: W,
@@ -135,19 +135,19 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
135
135
  { key: "recordedBy", header: n("RECORDED_BY") }
136
136
  ],
137
137
  [n]
138
- ), q = d(
138
+ ), V = d(
139
139
  () => [...h, { key: "actions", header: n("ACTIONS") }],
140
140
  [h, n]
141
141
  ), fe = c(
142
- (e) => v && e.some((o) => f(o)) ? q : h,
143
- [v, f, q, h]
142
+ (e) => v && e.some((o) => f(o)) ? V : h,
143
+ [v, f, V, h]
144
144
  ), he = h, pe = d(
145
145
  () => [
146
146
  { key: "recordedOn", sortable: !0 },
147
147
  { key: "recordedBy", sortable: !0 }
148
148
  ],
149
149
  []
150
- ), P = d(() => {
150
+ ), q = d(() => {
151
151
  const e = k.reduce(
152
152
  (o, t) => {
153
153
  const s = t.formName;
@@ -172,13 +172,13 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
172
172
  )
173
173
  })
174
174
  ).sort((o, t) => o.formName.localeCompare(t.formName));
175
- }, [k, n]), V = c((e) => {
175
+ }, [k, n]), P = c((e) => {
176
176
  B(e), M(!0);
177
177
  }, []), j = c(() => {
178
178
  M(!1), B(null);
179
179
  }, []), R = c((e) => {
180
180
  globalThis.dispatchEvent(
181
- new CustomEvent(Ve, {
181
+ new CustomEvent(Pe, {
182
182
  detail: {
183
183
  editOnly: "observationForms",
184
184
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -192,7 +192,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
192
192
  (e, r) => {
193
193
  switch (r) {
194
194
  case "recordedOn":
195
- return /* @__PURE__ */ i(Me, { onClick: () => V(e), children: e.recordedOn });
195
+ return /* @__PURE__ */ i(Me, { onClick: () => P(e), children: e.recordedOn });
196
196
  case "recordedBy":
197
197
  return e.recordedBy;
198
198
  case "actions":
@@ -211,10 +211,10 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
211
211
  return null;
212
212
  }
213
213
  },
214
- [V, R, f, n]
214
+ [P, R, f, n]
215
215
  );
216
216
  return /* @__PURE__ */ $(ge, { children: [
217
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || U || P.length === 0 || L ? /* @__PURE__ */ i(
217
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: S || U || q.length === 0 || L ? /* @__PURE__ */ i(
218
218
  Y,
219
219
  {
220
220
  headers: he,
@@ -227,7 +227,7 @@ const He = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
227
227
  className: T.formsTableBody,
228
228
  dataTestId: "forms-table"
229
229
  }
230
- ) : /* @__PURE__ */ i(Be, { align: "start", children: P.map((e, r) => {
230
+ ) : /* @__PURE__ */ i(Be, { align: "start", children: q.map((e, r) => {
231
231
  const { formName: o, records: t } = e, s = fe(t);
232
232
  return /* @__PURE__ */ i(
233
233
  Le,
@@ -1,30 +1,30 @@
1
1
  import { jsx as d, jsxs as D } from "react/jsx-runtime";
2
- import { q as M, z as C, t as w, V as Q, s as q, y as k, N as z, v as G, u as P, a as H, R as j, w as J, O as Y, x as W, A as X, D as Z, E as x, b as ee } from "./index-BqbZxHvD.js";
2
+ import { p as M, D as A, t as w, q as Q, s as q, T as k, R as G, S as P, u as z, a as H, v as j, w as J, O as Y, x as W, y as X, z as Z, A as x, b as ee } from "./index-DSanaOUz.js";
3
3
  import { useQueries as te, useQuery as se } from "@tanstack/react-query";
4
- import { useRef as oe, useEffect as N, useMemo as h } from "react";
5
- import { useTranslation as U } from "react-i18next";
6
- const A = (t, i, c, l, u, r) => {
7
- const s = w(t, i, u), o = s.value, a = Q(o);
4
+ import { useRef as oe, useEffect as $, useMemo as R } from "react";
5
+ import { useTranslation as C } from "react-i18next";
6
+ const U = (t, i, c, l, u, a) => {
7
+ const s = w(t, i, u), o = s.value, r = Q(o);
8
8
  let n = o;
9
- a === "Image" && (n = /* @__PURE__ */ d(
9
+ r === "Image" && (n = /* @__PURE__ */ d(
10
10
  k,
11
11
  {
12
12
  imageSrc: o,
13
13
  alt: o,
14
14
  id: `${o}-img`,
15
- hideThumbnail: r
15
+ hideThumbnail: a
16
16
  }
17
- )), a === "Video" && (n = /* @__PURE__ */ d(
18
- z,
17
+ )), r === "Video" && (n = /* @__PURE__ */ d(
18
+ G,
19
19
  {
20
20
  id: `${o}-video`,
21
21
  videoSrc: o,
22
- hideThumbnail: r
22
+ hideThumbnail: a
23
23
  }
24
- )), a === "PDF" && (n = /* @__PURE__ */ d(G, { id: `${o}-pdf`, src: o }));
24
+ )), r === "PDF" && (n = /* @__PURE__ */ d(P, { id: `${o}-pdf`, src: o }));
25
25
  const b = u("OBSERVATIONS_RECORDED_BY", {
26
26
  provider: s.provider
27
- }), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
27
+ }), p = t.display, m = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = l ? `${l}-${m}-${p}-${c}-${i}` : `${m}-${p}-${c}-${i}`;
28
28
  return /* @__PURE__ */ d(
29
29
  q,
30
30
  {
@@ -37,18 +37,18 @@ const A = (t, i, c, l, u, r) => {
37
37
  },
38
38
  `obs-${t.id}`
39
39
  );
40
- }, re = (t, i, c, l, u, r, s) => /* @__PURE__ */ d(
41
- C,
40
+ }, re = (t, i, c, l, u, a, s) => /* @__PURE__ */ d(
41
+ A,
42
42
  {
43
43
  title: t.display,
44
44
  id: `grouped-obs-${t.display}-${l}`,
45
45
  open: c,
46
46
  children: t.members?.map(
47
- (o, a) => A(
47
+ (o, r) => U(
48
48
  o,
49
- a,
50
- u,
51
49
  r,
50
+ u,
51
+ a,
52
52
  i,
53
53
  s
54
54
  )
@@ -60,17 +60,17 @@ const A = (t, i, c, l, u, r) => {
60
60
  title: i = "",
61
61
  hideThumbnail: c
62
62
  }) => {
63
- const { t: l } = U(), u = (r, s, o) => {
64
- const a = M(r.encounterDetails, l);
63
+ const { t: l } = C(), u = (a, s, o) => {
64
+ const r = M(a.encounterDetails, l);
65
65
  return /* @__PURE__ */ D(
66
- C,
66
+ A,
67
67
  {
68
- title: a,
69
- id: `encounter-${r.encounterId}`,
68
+ title: r,
69
+ id: `encounter-${a.encounterId}`,
70
70
  open: s,
71
71
  children: [
72
- r.observations.map(
73
- (n, b) => A(
72
+ a.observations.map(
73
+ (n, b) => U(
74
74
  n,
75
75
  b,
76
76
  o,
@@ -79,7 +79,7 @@ const A = (t, i, c, l, u, r) => {
79
79
  c
80
80
  )
81
81
  ),
82
- r.groupedObservations.map(
82
+ a.groupedObservations.map(
83
83
  (n, b) => re(
84
84
  n,
85
85
  l,
@@ -92,7 +92,7 @@ const A = (t, i, c, l, u, r) => {
92
92
  )
93
93
  ]
94
94
  },
95
- `encounter-${r.encounterId}`
95
+ `encounter-${a.encounterId}`
96
96
  );
97
97
  };
98
98
  return /* @__PURE__ */ d(
@@ -102,11 +102,11 @@ const A = (t, i, c, l, u, r) => {
102
102
  "data-testid": "obs-by-encounter-test-id",
103
103
  "aria-label": "obs-by-encounter-aria-label",
104
104
  children: t.map(
105
- (r, s) => u(r, s === 0, s)
105
+ (a, s) => u(a, s === 0, s)
106
106
  )
107
107
  }
108
108
  );
109
- }, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", S = {
109
+ }, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", N = {
110
110
  observations: ne,
111
111
  title: ie
112
112
  }, ce = (t) => ["conceptUuid", t], le = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
@@ -114,65 +114,65 @@ const A = (t, i, c, l, u, r) => {
114
114
  conceptNames: c = [],
115
115
  conceptUuid: l = [],
116
116
  hideThumbnail: u = !1
117
- } = i, r = oe(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = H(), { t: a } = U(), n = te({
117
+ } = i, a = oe(/* @__PURE__ */ new Set()), s = z(), { addNotification: o } = H(), { t: r } = C(), n = te({
118
118
  queries: c.map((e) => ({
119
119
  queryKey: ce(e),
120
120
  queryFn: () => j(e),
121
121
  enabled: !!e
122
122
  }))
123
123
  });
124
- N(() => {
124
+ $(() => {
125
125
  n.forEach((e, v) => {
126
- if (e.isError && !r.current.has(v)) {
127
- const g = c[v];
126
+ if (e.isError && !a.current.has(v)) {
127
+ const T = c[v];
128
128
  o({
129
- title: a("ERROR_DEFAULT_TITLE"),
130
- message: a("ERROR_FETCHING_CONCEPT", { conceptName: g }),
129
+ title: r("ERROR_DEFAULT_TITLE"),
130
+ message: r("ERROR_FETCHING_CONCEPT", { conceptName: T }),
131
131
  type: "error"
132
- }), r.current.add(v);
133
- } else e.isError || r.current.delete(v);
132
+ }), a.current.add(v);
133
+ } else e.isError || a.current.delete(v);
134
134
  });
135
135
  }, [n, c]);
136
- const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), y = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
- data: p,
136
+ const b = R(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), p = R(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), y = R(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
137
+ data: m,
138
138
  isLoading: f,
139
- isError: R,
140
- refetch: T
139
+ isError: h,
140
+ refetch: g
141
141
  } = se({
142
- queryKey: le(s, m),
143
- queryFn: () => J(s, m),
144
- enabled: !!s && m.length > 0 && y
142
+ queryKey: le(s, p),
143
+ queryFn: () => J(s, p),
144
+ enabled: !!s && p.length > 0 && y
145
145
  });
146
146
  Y(
147
147
  (e) => {
148
148
  e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
149
- (g) => m.includes(g)
150
- ) && T();
149
+ (T) => p.includes(T)
150
+ ) && g();
151
151
  },
152
- [s, T]
153
- ), N(() => {
154
- R && o({
155
- title: a("ERROR_DEFAULT_TITLE"),
156
- message: a("ERROR_FETCHING_OBSERVATIONS"),
152
+ [s, g]
153
+ ), $(() => {
154
+ h && o({
155
+ title: r("ERROR_DEFAULT_TITLE"),
156
+ message: r("ERROR_FETCHING_OBSERVATIONS"),
157
157
  type: "error"
158
158
  });
159
- }, [R]);
160
- const _ = h(() => {
161
- if (!p) return [];
162
- const e = W(p), v = X(e);
159
+ }, [h]);
160
+ const _ = R(() => {
161
+ if (!m) return [];
162
+ const e = W(m), v = X(e);
163
163
  return Z(v);
164
- }, [p]), B = [
164
+ }, [m]), B = [
165
165
  { key: "name", header: "name" },
166
166
  { key: "value", header: "value" },
167
167
  { key: "form", header: "form" }
168
- ], I = f || !y, $ = R && y, L = (!p || p.entry?.length === 0 || m.length === 0) && y, F = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, V = L ? a("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
168
+ ], I = f || !y, S = h && y, L = (!m || m.entry?.length === 0 || p.length === 0) && y, V = S ? r("ERROR_FETCHING_OBSERVATIONS") : null, F = L ? r("NO_OBSERVATIONS_FOUND") : void 0, K = _.length > 0 && !I && !S, O = i.titleTranslationKey, E = O ? r(O) : "";
169
169
  return /* @__PURE__ */ D(
170
170
  "div",
171
171
  {
172
172
  id: "observations",
173
173
  "data-testid": O ? `observations-${E}` : "observations",
174
174
  "aria-label": "observations-aria-label",
175
- className: S.observations,
175
+ className: N.observations,
176
176
  children: [
177
177
  /* @__PURE__ */ d(
178
178
  x,
@@ -180,7 +180,7 @@ const A = (t, i, c, l, u, r) => {
180
180
  id: "observations-title",
181
181
  testId: O ? `observations-title-${E}` : "observations-title",
182
182
  title: E,
183
- className: S.title,
183
+ className: N.title,
184
184
  children: /* @__PURE__ */ d("p", { children: E })
185
185
  }
186
186
  ),
@@ -196,10 +196,10 @@ const A = (t, i, c, l, u, r) => {
196
196
  {
197
197
  headers: B,
198
198
  rows: [],
199
- ariaLabel: a("OBSERVATIONS"),
199
+ ariaLabel: r("OBSERVATIONS"),
200
200
  loading: I,
201
- errorStateMessage: F,
202
- emptyStateMessage: V,
201
+ errorStateMessage: V,
202
+ emptyStateMessage: F ?? r("NO_OBSERVATIONS_AVAILABLE"),
203
203
  dataTestId: "observations-table"
204
204
  }
205
205
  )