@bahmni/widgets 0.0.1-dev.451 → 0.0.1-dev.453

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,64 +1,64 @@
1
- import { jsx as n, jsxs as V, Fragment as ie } from "react/jsx-runtime";
2
- import { u as de, b as le, c as me, $ as ce, D as ue, d as fe, l as be, W as he, e as Ne, f as ye, J as Oe, s as ge, g as q, k as $, L as Te, H as x, h as pe, i as Ee, F as Ie, O as Fe, C as Ae } from "./index-dPWUm6Oh.js";
3
- import { useQueryClient as ve, useQuery as F } from "@tanstack/react-query";
4
- import { useState as G, useMemo as i, useCallback as d } from "react";
5
- import { useTranslation as _e } from "react-i18next";
6
- const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
1
+ import { jsx as n, jsxs as x, Fragment as ie } from "react/jsx-runtime";
2
+ import { u as de, c as le, j as me, C as ce, k as ue, l as fe, m as Ne, Q as be, n as he, o as ye, J as Oe, i as ge, _ as q, P as V, N as Te, x as $, q as pe, s as Ee, W as Ie, O as Fe, t as Ae } from "./index-ClqkhB6j.js";
3
+ import { useQueryClient as _e, useQuery as F } from "@tanstack/react-query";
4
+ import { useState as j, useMemo as i, useCallback as d } from "react";
5
+ import { useTranslation as ve } from "react-i18next";
6
+ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
7
7
  formsTableBody: Re,
8
- modalHeading: Le,
8
+ modalHeading: Ce,
9
9
  customAccordianItem: De
10
- }, Ce = "startConsultation", ke = ({
10
+ }, Le = "startConsultation", ke = ({
11
11
  episodeOfCareUuids: A,
12
12
  encounterUuids: m,
13
- config: j,
14
- disableActions: z = !1,
15
- activeEncounterUuid: b = null
13
+ config: G,
14
+ disableActions: Q = !1,
15
+ activeEncounterUuid: N = null
16
16
  }) => {
17
- const { t: o } = _e(), c = de(), [O, v] = G(!1), [a, _] = G(null), {
18
- numberOfVisits: K,
19
- hideThumbnail: Q = !1,
20
- forms: h
21
- } = j ?? {}, W = le(
17
+ const { t: o } = ve(), c = de(), [O, _] = j(!1), [a, v] = j(null), {
18
+ numberOfVisits: z,
19
+ hideThumbnail: K = !1,
20
+ forms: b
21
+ } = G ?? {}, W = le(
22
22
  Ae.EDIT_OBSERVATIONS
23
- ), { userPrivileges: N } = me(), g = W && !z && !!b, R = ce(
23
+ ), { userPrivileges: h } = me(), g = W && !Q && !!N, R = ce(
24
24
  A,
25
25
  m
26
- ), J = ve(), {
27
- data: L = [],
26
+ ), J = _e(), {
27
+ data: C = [],
28
28
  isLoading: D,
29
- isError: C,
29
+ isError: L,
30
30
  error: Y,
31
31
  refetch: X
32
32
  } = F({
33
33
  queryKey: ["forms", c, A],
34
- queryFn: () => ue(c, void 0, K),
34
+ queryFn: () => ue(c, void 0, z),
35
35
  enabled: !!c && !R
36
36
  }), S = i(() => {
37
- let e = L;
37
+ let e = C;
38
38
  return m && m.length > 0 && (e = e.filter(
39
- (s) => m.includes(s.encounterUuid)
40
- )), Array.isArray(h) && h.length > 0 && (e = e.filter(
41
- (s) => h.some((t) => t.toLowerCase() === s.formName.toLowerCase())
39
+ (t) => m.includes(t.encounterUuid)
40
+ )), Array.isArray(b) && b.length > 0 && (e = e.filter(
41
+ (t) => b.some((s) => s.toLowerCase() === t.formName.toLowerCase())
42
42
  )), e;
43
- }, [L, m, h]), { data: B = [] } = F({
43
+ }, [C, m, b]), { data: B = [] } = F({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => fe()
46
46
  }), M = d(
47
47
  (e) => {
48
- const s = B.find(
48
+ const t = B.find(
49
49
  (r) => r.name.toLowerCase() === e.toLowerCase()
50
50
  );
51
- if (!s?.privileges || s.privileges.length === 0) return !0;
52
- if (!N || N.length === 0) return !1;
53
- const t = new Set(N.map((r) => r.name));
54
- return s.privileges.some(
55
- (r) => t.has(r.privilegeName) && r.editable
51
+ if (!t?.privileges || t.privileges.length === 0) return !0;
52
+ if (!h || h.length === 0) return !1;
53
+ const s = new Set(h.map((r) => r.name));
54
+ return t.privileges.some(
55
+ (r) => s.has(r.privilegeName) && r.editable
56
56
  );
57
57
  },
58
- [B, N]
58
+ [B, h]
59
59
  ), u = d(
60
- (e) => !b || e.encounterUuid !== b ? !1 : M(e.formName),
61
- [b, M]
60
+ (e) => !N || e.encounterUuid !== N ? !1 : M(e.formName),
61
+ [N, M]
62
62
  ), {
63
63
  data: T,
64
64
  isLoading: Z,
@@ -66,16 +66,16 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
66
66
  error: p
67
67
  } = F({
68
68
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
69
- queryFn: () => be(a.encounterUuid),
69
+ queryFn: () => Ne(a.encounterUuid),
70
70
  enabled: !!a?.encounterUuid && O
71
71
  });
72
- he(
72
+ be(
73
73
  (e) => {
74
74
  e.patientUUID === c && (X(), J.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
75
75
  },
76
76
  [c]
77
77
  );
78
- const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((s) => s.resource?.resourceType === "Observation").map((s) => s.resource).filter((s) => Ne(s) ? ye(s)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), se = i(() => {
78
+ const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => he(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), te = i(() => {
79
79
  if (p)
80
80
  return Oe(p).message;
81
81
  }, [p]), f = i(
@@ -87,8 +87,8 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
87
87
  ), w = i(
88
88
  () => [...f, { key: "actions", header: o("ACTIONS") }],
89
89
  [f, o]
90
- ), te = d(
91
- (e) => g && e.some((t) => u(t)) ? w : f,
90
+ ), se = d(
91
+ (e) => g && e.some((s) => u(s)) ? w : f,
92
92
  [g, u, w, f]
93
93
  ), oe = f, ae = i(
94
94
  () => [
@@ -96,38 +96,38 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
96
96
  { key: "recordedBy", sortable: !0 }
97
97
  ],
98
98
  []
99
- ), H = i(() => {
99
+ ), U = i(() => {
100
100
  const e = S.reduce(
101
- (t, r) => {
101
+ (s, r) => {
102
102
  const l = r.formName;
103
- t[l] ??= [];
103
+ s[l] ??= [];
104
104
  const I = r.providers.map((ne) => ne.providerName).filter(Boolean).join(", ");
105
- return t[l].push({
105
+ return s[l].push({
106
106
  id: r.encounterUuid,
107
107
  formName: r.formName,
108
108
  recordedOn: ge(r.encounterDateTime, o, !0).formattedResult,
109
109
  recordedBy: I ?? "--",
110
110
  encounterDateTime: r.encounterDateTime,
111
111
  encounterUuid: r.encounterUuid
112
- }), t;
112
+ }), s;
113
113
  },
114
114
  {}
115
115
  );
116
116
  return Object.entries(e).map(
117
- ([t, r]) => ({
118
- formName: t,
117
+ ([s, r]) => ({
118
+ formName: s,
119
119
  records: r.sort(
120
120
  (l, I) => I.encounterDateTime - l.encounterDateTime
121
121
  )
122
122
  })
123
- ).sort((t, r) => t.formName.localeCompare(r.formName));
123
+ ).sort((s, r) => s.formName.localeCompare(r.formName));
124
124
  }, [S, o]), k = d((e) => {
125
- _(e), v(!0);
126
- }, []), U = d(() => {
127
- v(!1), _(null);
125
+ v(e), _(!0);
126
+ }, []), H = d(() => {
127
+ _(!1), v(null);
128
128
  }, []), E = d((e) => {
129
129
  globalThis.dispatchEvent(
130
- new CustomEvent(Ce, {
130
+ new CustomEvent(Le, {
131
131
  detail: {
132
132
  editOnly: "observationForms",
133
133
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -138,8 +138,8 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
138
138
  })
139
139
  );
140
140
  }, []), P = d(
141
- (e, s) => {
142
- switch (s) {
141
+ (e, t) => {
142
+ switch (t) {
143
143
  case "recordedOn":
144
144
  return /* @__PURE__ */ n(Te, { onClick: () => k(e), children: e.recordedOn });
145
145
  case "recordedBy":
@@ -153,7 +153,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
153
153
  size: "sm",
154
154
  testId: `edit-form-${e.encounterUuid}`,
155
155
  onClick: () => E(e),
156
- children: /* @__PURE__ */ n($, {})
156
+ children: /* @__PURE__ */ n(V, {})
157
157
  }
158
158
  ) : null;
159
159
  default:
@@ -162,31 +162,31 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
162
162
  },
163
163
  [k, E, u, o]
164
164
  );
165
- return /* @__PURE__ */ V(ie, { children: [
166
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || C || H.length === 0 || R ? /* @__PURE__ */ n(
167
- x,
165
+ return /* @__PURE__ */ x(ie, { children: [
166
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || U.length === 0 || R ? /* @__PURE__ */ n(
167
+ $,
168
168
  {
169
169
  headers: oe,
170
170
  ariaLabel: o("FORMS_HEADING"),
171
171
  rows: [],
172
172
  loading: D,
173
- errorStateMessage: C ? Y?.message : void 0,
173
+ errorStateMessage: L ? Y?.message : void 0,
174
174
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
175
175
  renderCell: P,
176
176
  className: y.formsTableBody,
177
177
  dataTestId: "forms-table"
178
178
  }
179
- ) : /* @__PURE__ */ n(pe, { align: "start", children: H.map((e, s) => {
180
- const { formName: t, records: r } = e, l = te(r);
179
+ ) : /* @__PURE__ */ n(pe, { align: "start", children: U.map((e, t) => {
180
+ const { formName: s, records: r } = e, l = se(r);
181
181
  return /* @__PURE__ */ n(
182
182
  Ee,
183
183
  {
184
- title: t,
184
+ title: s,
185
185
  className: y.customAccordianItem,
186
- testId: `accordian-title-${t}`,
187
- open: s === 0,
186
+ testId: `accordian-title-${s}`,
187
+ open: t === 0,
188
188
  children: /* @__PURE__ */ n(
189
- x,
189
+ $,
190
190
  {
191
191
  headers: l,
192
192
  ariaLabel: o("FORMS_HEADING"),
@@ -197,11 +197,11 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
197
197
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
198
198
  renderCell: P,
199
199
  className: y.formsTableBody,
200
- dataTestId: `forms-table-${t}`
200
+ dataTestId: `forms-table-${s}`
201
201
  }
202
202
  )
203
203
  },
204
- t
204
+ s
205
205
  );
206
206
  }) }) }),
207
207
  O && a && /* @__PURE__ */ n(
@@ -210,8 +210,8 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
210
210
  id: "modalIdForActionAreaLayout",
211
211
  portalId: "main-display-area",
212
212
  open: O,
213
- onRequestClose: U,
214
- modalHeading: /* @__PURE__ */ V("div", { className: y.modalHeading, children: [
213
+ onRequestClose: H,
214
+ modalHeading: /* @__PURE__ */ x("div", { className: y.modalHeading, children: [
215
215
  /* @__PURE__ */ n("span", { children: a.formName }),
216
216
  g && u(a) && /* @__PURE__ */ n(
217
217
  q,
@@ -221,9 +221,9 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
221
221
  size: "sm",
222
222
  testId: `edit-form-modal-${a.encounterUuid}`,
223
223
  onClick: () => {
224
- U(), E(a);
224
+ H(), E(a);
225
225
  },
226
- children: /* @__PURE__ */ n($, {})
226
+ children: /* @__PURE__ */ n(V, {})
227
227
  }
228
228
  )
229
229
  ] }),
@@ -237,10 +237,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
237
237
  observations: re,
238
238
  isLoading: Z,
239
239
  isError: ee,
240
- errorMessage: se,
240
+ errorMessage: te,
241
241
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
242
242
  testIdPrefix: a.formName,
243
- hideThumbnail: Q,
243
+ hideThumbnail: K,
244
244
  formName: a.formName
245
245
  }
246
246
  )
@@ -1,18 +1,18 @@
1
- import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
- import { j as H, S as U, t as G, B as j, s as z, m as P, R as x, Z as W, o as Z, u as J, a as Y, p as X, $ as ee, q as se, r as te, W as re, v as ae, w as oe, x as ne, y as ie, U as ce, H as le } from "./index-dPWUm6Oh.js";
1
+ import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
+ import { w as q, I as F, y as x, G as z, i as H, z as P, A as j, B as X, F as J, u as W, b as Y, D as Z, C as ee, E as se, H as te, Q as re, K as ae, L as oe, M as ne, R as ie, X as ce, x as le } from "./index-ClqkhB6j.js";
3
3
  import { useQueries as de, useQuery as ue } from "@tanstack/react-query";
4
- import { useRef as pe, useEffect as C, useMemo as I } from "react";
4
+ import { useRef as pe, useEffect as C, useMemo as T } from "react";
5
5
  import { useTranslation as w } from "react-i18next";
6
6
  const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", ye = "Observations-module_secondary__14nuS", y = {
7
7
  observations: be,
8
8
  title: me,
9
9
  wrapper: ve,
10
10
  secondary: ye
11
- }, F = (t, l, n, c, u, r) => {
12
- const a = G(t, l, u), e = a.value, p = j(e);
11
+ }, U = (t, l, n, c, u, r) => {
12
+ const a = x(t, l, u), e = a.value, p = z(e);
13
13
  let o = e;
14
14
  p === "Image" && (o = /* @__PURE__ */ i(
15
- x,
15
+ j,
16
16
  {
17
17
  imageSrc: e,
18
18
  alt: e,
@@ -20,19 +20,19 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
20
20
  hideThumbnail: r
21
21
  }
22
22
  )), p === "Video" && (o = /* @__PURE__ */ i(
23
- W,
23
+ X,
24
24
  {
25
25
  id: `${e}-video`,
26
26
  videoSrc: e,
27
27
  hideThumbnail: r
28
28
  }
29
- )), p === "PDF" && (o = /* @__PURE__ */ i(Z, { id: `${e}-pdf`, src: e }));
30
- const b = /* @__PURE__ */ S("div", { className: y.wrapper, children: [
29
+ )), p === "PDF" && (o = /* @__PURE__ */ i(J, { id: `${e}-pdf`, src: e }));
30
+ const b = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
31
31
  /* @__PURE__ */ i("span", { children: a.header.display }),
32
32
  a.header.referenceRange && /* @__PURE__ */ i("span", { className: y.secondary, children: a.header.referenceRange })
33
33
  ] }), d = u("OBSERVATIONS_RECORDED_BY", {
34
34
  provider: a.provider
35
- }), m = t.effectiveDateTime ? z(t.effectiveDateTime, u, !0).formattedResult : void 0, _ = /* @__PURE__ */ S("div", { className: y.wrapper, children: [
35
+ }), m = t.effectiveDateTime ? H(t.effectiveDateTime, u, !0).formattedResult : void 0, _ = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
36
36
  /* @__PURE__ */ i("span", { children: d }),
37
37
  m && /* @__PURE__ */ i("span", { className: y.secondary, children: m })
38
38
  ] }), v = t.display, g = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = c ? `${c}-${g}-${v}-${n}-${l}` : `${g}-${v}-${n}-${l}`;
@@ -49,13 +49,13 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
49
49
  `obs-${t.id}`
50
50
  );
51
51
  }, fe = (t, l, n, c, u, r, a) => /* @__PURE__ */ i(
52
- U,
52
+ F,
53
53
  {
54
54
  title: t.display,
55
55
  id: `grouped-obs-${t.display}-${c}`,
56
56
  open: n,
57
57
  children: t.members?.map(
58
- (e, p) => F(
58
+ (e, p) => U(
59
59
  e,
60
60
  p,
61
61
  u,
@@ -72,16 +72,16 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
72
72
  hideThumbnail: n
73
73
  }) => {
74
74
  const { t: c } = w(), u = (r, a, e) => {
75
- const p = H(r.encounterDetails, c);
76
- return /* @__PURE__ */ S(
77
- U,
75
+ const p = q(r.encounterDetails, c);
76
+ return /* @__PURE__ */ N(
77
+ F,
78
78
  {
79
79
  title: p,
80
80
  id: `encounter-${r.encounterId}`,
81
81
  open: a,
82
82
  children: [
83
83
  r.observations.map(
84
- (o, b) => F(
84
+ (o, b) => U(
85
85
  o,
86
86
  b,
87
87
  e,
@@ -123,7 +123,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
123
123
  ...l,
124
124
  n,
125
125
  c
126
- ], Se = ({
126
+ ], Ne = ({
127
127
  config: t,
128
128
  episodeOfCareUuids: l,
129
129
  encounterUuids: n
@@ -133,10 +133,10 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
133
133
  conceptUuid: r = [],
134
134
  hideThumbnail: a = !1,
135
135
  scope: e = "all"
136
- } = c, p = pe(/* @__PURE__ */ new Set()), o = J(), { addNotification: b } = Y(), { t: d } = w(), m = de({
136
+ } = c, p = pe(/* @__PURE__ */ new Set()), o = W(), { addNotification: b } = Y(), { t: d } = w(), m = de({
137
137
  queries: u.map((s) => ({
138
138
  queryKey: Ee(s),
139
- queryFn: () => X(s),
139
+ queryFn: () => Z(s),
140
140
  enabled: !!s
141
141
  }))
142
142
  });
@@ -148,14 +148,14 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
148
148
  type: "error"
149
149
  }), p.current.add(0)) : !s && R && p.current.clear();
150
150
  }, [m, b, d]);
151
- const _ = I(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = I(() => [.../* @__PURE__ */ new Set([..._, ...r])], [_, r]), f = I(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), g = e === "latest" || e === "latest-encounter", O = ee(
151
+ const _ = T(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = T(() => [.../* @__PURE__ */ new Set([..._, ...r])], [_, r]), f = T(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), g = e === "latest" || e === "latest-encounter", O = ee(
152
152
  l,
153
153
  n
154
154
  ), {
155
155
  data: E,
156
156
  isLoading: V,
157
- isError: N,
158
- refetch: B
157
+ isError: S,
158
+ refetch: D
159
159
  } = ue({
160
160
  queryKey: he(
161
161
  o,
@@ -178,17 +178,17 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
178
178
  (s) => {
179
179
  s.patientUUID === o && s.updatedConcepts.size > 0 && [...s.updatedConcepts.keys()].some(
180
180
  ($) => v.includes($)
181
- ) && B();
181
+ ) && D();
182
182
  },
183
- [o, B]
183
+ [o, D]
184
184
  ), C(() => {
185
- N && b({
185
+ S && b({
186
186
  title: d("ERROR_DEFAULT_TITLE"),
187
187
  message: d("ERROR_FETCHING_OBSERVATIONS"),
188
188
  type: "error"
189
189
  });
190
- }, [N]);
191
- const D = I(() => {
190
+ }, [S]);
191
+ const A = T(() => {
192
192
  if (!E) return [];
193
193
  let s = ae(E);
194
194
  e === "latest-encounter" && (s = oe(s));
@@ -198,12 +198,12 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
198
198
  { key: "name", header: "name" },
199
199
  { key: "value", header: "value" },
200
200
  { key: "form", header: "form" }
201
- ], A = V || !f, L = N && f, M = (!E || E.entry?.length === 0 || v.length === 0) && f, q = L ? d("ERROR_FETCHING_OBSERVATIONS") : null, Q = M ? d("NO_OBSERVATIONS_FOUND") : void 0, k = D.length > 0 && !A && !L, T = c.titleTranslationKey, h = T ? d(T) : "";
202
- return /* @__PURE__ */ S(
201
+ ], B = V || !f, L = S && f, M = (!E || E.entry?.length === 0 || v.length === 0) && f, Q = L ? d("ERROR_FETCHING_OBSERVATIONS") : null, G = M ? d("NO_OBSERVATIONS_FOUND") : void 0, k = A.length > 0 && !B && !L, I = c.titleTranslationKey, h = I ? d(I) : "";
202
+ return /* @__PURE__ */ N(
203
203
  "div",
204
204
  {
205
205
  id: "observations",
206
- "data-testid": T ? `observations-${h}` : "observations",
206
+ "data-testid": I ? `observations-${h}` : "observations",
207
207
  "aria-label": "observations-aria-label",
208
208
  className: y.observations,
209
209
  children: [
@@ -211,7 +211,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
211
211
  ce,
212
212
  {
213
213
  id: "observations-title",
214
- testId: T ? `observations-title-${h}` : "observations-title",
214
+ testId: I ? `observations-title-${h}` : "observations-title",
215
215
  title: h,
216
216
  className: y.title,
217
217
  children: /* @__PURE__ */ i("p", { children: h })
@@ -220,7 +220,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
220
220
  k ? /* @__PURE__ */ i(
221
221
  Oe,
222
222
  {
223
- groupedData: D,
223
+ groupedData: A,
224
224
  title: h,
225
225
  hideThumbnail: a
226
226
  }
@@ -230,9 +230,9 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
230
230
  headers: K,
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
- loading: A,
234
- errorStateMessage: q,
235
- emptyStateMessage: Q ?? d("NO_OBSERVATIONS_AVAILABLE"),
233
+ loading: B,
234
+ errorStateMessage: Q,
235
+ emptyStateMessage: G ?? d("NO_OBSERVATIONS_AVAILABLE"),
236
236
  dataTestId: "observations-table"
237
237
  }
238
238
  )
@@ -242,6 +242,6 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
242
242
  };
243
243
  export {
244
244
  Ee as conceptUuidQueryKeys,
245
- Se as default,
245
+ Ne as default,
246
246
  he as observationsQueryKeys
247
247
  };
@@ -1,2 +1,13 @@
1
- export declare function printViaIframe(html: string): Promise<void>;
1
+ export interface PrintViaIframeOptions {
2
+ focus?: boolean;
3
+ container?: HTMLElement | null;
4
+ signal?: AbortSignal;
5
+ }
6
+ export declare function printViaIframe(html: string, { focus, container, signal }?: PrintViaIframeOptions): Promise<void>;
7
+ export interface PrintPdfOptions {
8
+ container?: HTMLElement | null;
9
+ focus?: boolean;
10
+ signal?: AbortSignal;
11
+ }
12
+ export declare function printPdfViaIframe(url: string, { container, focus, signal }?: PrintPdfOptions): Promise<void>;
2
13
  //# sourceMappingURL=printViaIframe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"printViaIframe.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/printViaIframe.ts"],"names":[],"mappings":"AAiEA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhE"}
1
+ {"version":3,"file":"printViaIframe.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/printViaIframe.ts"],"names":[],"mappings":"AAmEA,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,EAAE,KAAY,EAAE,SAAS,EAAE,MAAM,EAAE,GAAE,qBAA0B,GAC9D,OAAO,CAAC,IAAI,CAAC,CAoCf;AAgDD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,EAAE,SAAS,EAAE,KAAY,EAAE,MAAM,EAAE,GAAE,eAAoB,GACxD,OAAO,CAAC,IAAI,CAAC,CAoCf"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAKtC,OAAO,EAAE,mBAAmB,EAAmB,MAAM,UAAU,CAAC;AAYhE,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsNxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,OAAO,EAGL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAyNlB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+IxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export { DocumentUpload } from './DocumentUpload';
2
2
  export { renderDocumentTile } from './renderDocumentTile';
3
- export { getDefaultDocumentType, revokeDocumentPreview } from './utils';
3
+ export { createEmptyDocumentEntry, getDefaultDocumentType, isDocumentEntryEmpty, revokeDocumentPreview, } from './utils';
4
4
  export type { DocumentTileData } from './renderDocumentTile';
5
- export type { DocumentUploadProps, PendingDocument } from './models';
5
+ export type { DocumentEntry, DocumentEntryErrors, DocumentUploadConfig, DocumentUploadProps, PendingDocument, } from './models';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documentUpload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,UAAU,CAAC"}
@@ -5,20 +5,35 @@ export interface PendingDocument {
5
5
  url: string;
6
6
  fileName: string;
7
7
  contentType: string;
8
+ uploadedUrl?: string;
9
+ status?: 'uploading' | 'uploaded' | 'error';
10
+ error?: string;
11
+ }
12
+ export interface DocumentEntryErrors {
13
+ documentType?: string;
14
+ documentId?: string;
15
+ files?: string;
16
+ }
17
+ export interface DocumentEntry {
18
+ id: string;
8
19
  documentType: DocumentType | null;
20
+ documentId: string;
9
21
  note: string;
10
- isNoteVisible: boolean;
11
- uploadedUrl?: string;
22
+ files: PendingDocument[];
23
+ errors: DocumentEntryErrors;
24
+ }
25
+ export interface DocumentUploadConfig {
26
+ attributes?: Array<{
27
+ name: string;
28
+ required?: boolean;
29
+ }>;
30
+ metadata?: Record<string, unknown>;
12
31
  }
13
- /**
14
- * Controlled: the consumer owns the pending documents and saving them. The widget only selects,
15
- * edits and discards them, so it holds no state a remount could lose.
16
- */
17
32
  export interface DocumentUploadProps {
18
- documents: PendingDocument[];
19
- onDocumentsChange: (documents: PendingDocument[]) => void;
20
- documentTypes?: DocumentType[];
21
- defaultOption?: string | null;
33
+ documents: DocumentEntry[];
34
+ onDocumentsChange: (documents: DocumentEntry[]) => void;
35
+ config?: DocumentUploadConfig;
36
+ documentsTitle?: string;
22
37
  isSaving?: boolean;
23
38
  }
24
39
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/documentUpload/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,iBAAiB,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC1D,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/documentUpload/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,iBAAiB,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IACxD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1,9 @@
1
+ export interface FileSelectionOptions {
2
+ supportedFileTypes?: string[];
3
+ maxFileSizeMb?: number;
4
+ }
5
+ export declare const useFileSelection: ({ supportedFileTypes, maxFileSizeMb, }?: FileSelectionOptions) => {
6
+ accept: string[];
7
+ selectFiles: (files: File[]) => File[];
8
+ };
9
+ //# sourceMappingURL=useFileSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFileSelection.d.ts","sourceRoot":"","sources":["../../src/documentUpload/useFileSelection.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,eAAO,MAAM,gBAAgB,GAAI,yCAG9B,oBAAyB;;yBAqBhB,IAAI,EAAE,KAAG,IAAI,EAAE;CAwC1B,CAAC"}
@@ -1,8 +1,12 @@
1
1
  import { DocumentType } from '@bahmni/services';
2
- import { PendingDocument } from './models';
2
+ import { DocumentEntry, PendingDocument } from './models';
3
3
  export declare const isAcceptedFileType: (mimeType: string) => boolean;
4
- /** The configured default option when it is one of the types, otherwise the first type. */
5
4
  export declare const getDefaultDocumentType: (documentTypes: DocumentType[], defaultOption?: string | null) => DocumentType | null;
6
- /** Releases the local preview of a pending document once it is saved or discarded. */
7
5
  export declare const revokeDocumentPreview: (document: PendingDocument) => void;
6
+ export declare const exceedsMaxFileSize: (file: File, maxFileSizeMb: number | undefined) => boolean;
7
+ export declare const toDottedExtension: (extension: string) => string;
8
+ export declare const hasSupportedExtension: (fileName: string, supportedFileTypes: string[]) => boolean;
9
+ export declare const formatFileTypes: (dottedExtensions: string[], locale: string) => string;
10
+ export declare const createEmptyDocumentEntry: () => DocumentEntry;
11
+ export declare const isDocumentEntryEmpty: (entry: DocumentEntry) => boolean;
8
12
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documentUpload/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,OAGtB,CAAC;AAEjC,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,GACjC,eAAe,YAAY,EAAE,EAC7B,gBAAgB,MAAM,GAAG,IAAI,KAC5B,YAAY,GAAG,IAMZ,CAAC;AAEP,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,GAAI,UAAU,eAAe,SAI9D,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documentUpload/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE/D,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,OAGtB,CAAC;AAEjC,eAAO,MAAM,sBAAsB,GACjC,eAAe,YAAY,EAAE,EAC7B,gBAAgB,MAAM,GAAG,IAAI,KAC5B,YAAY,GAAG,IAMZ,CAAC;AAEP,eAAO,MAAM,qBAAqB,GAAI,UAAU,eAAe,SAI9D,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,IAAI,EACV,eAAe,MAAM,GAAG,SAAS,KAChC,OACkE,CAAC;AAEtE,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,KAAG,MACG,CAAC;AAE1D,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,EAChB,oBAAoB,MAAM,EAAE,KAC3B,OAOF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,kBAAkB,MAAM,EAAE,EAC1B,QAAQ,MAAM,KACb,MAGA,CAAC;AAEJ,eAAO,MAAM,wBAAwB,QAAO,aAO1C,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAAI,OAAO,aAAa,KAAG,OAIlC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwBhD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8RzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAMN,MAAM,OAAO,CAAC;AAGf,OAAO,EAAsB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsDpE,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAygBzC,CAAC;AAEF,eAAe,cAAc,CAAC"}