@bahmni/widgets 0.0.1-dev.430 → 0.0.1-dev.433

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,5 +1,5 @@
1
1
  import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
2
- import { u as W, a as X, s as J, V as Z, m as x, b as ee, F as te } from "./index-8DwKY7zc.js";
2
+ import { u as W, a as X, i as J, V as Z, w as x, b as ee, F as te } from "./index-BWaIKbxC.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";
@@ -35,14 +35,14 @@ const Te = [
35
35
  "uploadedOn",
36
36
  "uploadedBy"
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
- const [d, L] = l(!1), [s, U] = l(
38
+ const [d, M] = l(!1), [s, L] = l(
39
39
  null
40
40
  ), [V, A] = l(
41
41
  /* @__PURE__ */ new Set()
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
- U(e), L(!0);
42
+ ), E = W(), { t: o } = ae(), { addNotification: U } = X(), P = Number(n?.pageSize) || 5, [N, C] = l(1), [u, $] = l(P), [k, O] = l(void 0), v = _((e) => {
43
+ L(e), M(!0);
44
44
  }, []), z = _(() => {
45
- L(!1), U(null), A(/* @__PURE__ */ new Set());
45
+ M(!1), L(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), F = _((e) => {
47
47
  A((t) => new Set(t).add(e));
48
48
  }, []), { data: i, isLoading: H, isError: S, error: b } = ne({
@@ -66,12 +66,12 @@ const Te = [
66
66
  }, [i]), I(() => {
67
67
  C(1), O(void 0);
68
68
  }, [E]), I(() => {
69
- S && w({
69
+ S && U({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
71
  message: b?.message ?? "",
72
72
  type: "error"
73
73
  });
74
- }, [S, b, w, o]), I(() => {
74
+ }, [S, b, U, o]), I(() => {
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
77
  if (!d || !s) return;
@@ -83,8 +83,8 @@ const Te = [
83
83
  method: "HEAD",
84
84
  signal: e.signal
85
85
  })).ok || a.add(m);
86
- } catch (M) {
87
- M instanceof Error && M.name !== "AbortError" && a.add(m);
86
+ } catch (w) {
87
+ w instanceof Error && w.name !== "AbortError" && a.add(m);
88
88
  }
89
89
  }
90
90
  e.signal.aborted || A(a);
@@ -1,12 +1,12 @@
1
1
  import { jsx as n, jsxs as P, Fragment as ie } from "react/jsx-runtime";
2
- import { u as de, c as le, d as me, L as ce, x as ue, I as fe, p as be, J as he, e as Ne, f as ye, G as Oe, m as ge, C as q, B as x, V as pe, b as G, r as Te, g as Ie, F as Ee, O as Fe, h as Ae } from "./index-8DwKY7zc.js";
2
+ import { u as de, c as le, d as me, U as ce, M as ue, x as fe, y as be, Z as he, e as ye, f as Ne, G as Oe, w as ge, C as q, B as x, V as Te, b as G, r as pe, g as Ee, F as Ie, O as Fe, h as Ae } from "./index-BWaIKbxC.js";
3
3
  import { useQueryClient as _e, useQuery as F } from "@tanstack/react-query";
4
4
  import { useState as $, useMemo as i, useCallback as d } from "react";
5
5
  import { useTranslation as Re } from "react-i18next";
6
- const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
6
+ const ve = "FormsTable-module_formsTableBody__SvGha", De = "FormsTable-module_modalHeading__wnTmA", Le = "FormsTable-module_customAccordianItem__isszs", N = {
7
7
  formsTableBody: ve,
8
- modalHeading: Le,
9
- customAccordianItem: De
8
+ modalHeading: De,
9
+ customAccordianItem: Le
10
10
  }, Ce = "startConsultation", He = ({
11
11
  episodeOfCareUuids: A,
12
12
  encounterUuids: m,
@@ -18,52 +18,52 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
18
18
  numberOfVisits: K,
19
19
  hideThumbnail: Q = !1,
20
20
  forms: h
21
- } = j ?? {}, J = le(
21
+ } = j ?? {}, Z = le(
22
22
  Ae.EDIT_OBSERVATIONS
23
- ), { userPrivileges: N } = me(), g = J && !z && !!b, v = ce(
23
+ ), { userPrivileges: y } = me(), g = Z && !z && !!b, v = ce(
24
24
  A,
25
25
  m
26
26
  ), W = _e(), {
27
- data: L = [],
28
- isLoading: D,
27
+ data: D = [],
28
+ isLoading: L,
29
29
  isError: C,
30
30
  error: Y,
31
- refetch: X
31
+ refetch: J
32
32
  } = F({
33
33
  queryKey: ["forms", c, A],
34
34
  queryFn: () => ue(c, void 0, K),
35
35
  enabled: !!c && !v
36
36
  }), B = i(() => {
37
- let e = L;
37
+ let e = D;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (t) => m.includes(t.encounterUuid)
40
40
  )), Array.isArray(h) && h.length > 0 && (e = e.filter(
41
41
  (t) => h.some((s) => s.toLowerCase() === t.formName.toLowerCase())
42
42
  )), e;
43
- }, [L, m, h]), { data: S = [] } = F({
43
+ }, [D, m, h]), { data: M = [] } = F({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => fe()
46
- }), M = d(
46
+ }), S = d(
47
47
  (e) => {
48
- const t = S.find(
48
+ const t = M.find(
49
49
  (r) => r.name.toLowerCase() === e.toLowerCase()
50
50
  );
51
51
  if (!t?.privileges || t.privileges.length === 0) return !0;
52
- if (!N || N.length === 0) return !1;
53
- const s = new Set(N.map((r) => r.name));
52
+ if (!y || y.length === 0) return !1;
53
+ const s = new Set(y.map((r) => r.name));
54
54
  return t.privileges.some(
55
55
  (r) => s.has(r.privilegeName) && r.editable
56
56
  );
57
57
  },
58
- [S, N]
58
+ [M, y]
59
59
  ), u = d(
60
- (e) => !b || e.encounterUuid !== b ? !1 : M(e.formName),
61
- [b, M]
60
+ (e) => !b || e.encounterUuid !== b ? !1 : S(e.formName),
61
+ [b, S]
62
62
  ), {
63
- data: p,
64
- isLoading: Z,
63
+ data: T,
64
+ isLoading: X,
65
65
  isError: ee,
66
- error: T
66
+ error: p
67
67
  } = F({
68
68
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
69
69
  queryFn: () => be(a.encounterUuid),
@@ -71,14 +71,14 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
71
71
  });
72
72
  he(
73
73
  (e) => {
74
- e.patientUUID === c && (X(), W.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
+ e.patientUUID === c && (J(), W.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
75
75
  },
76
76
  [c]
77
77
  );
78
- const re = i(() => !p?.entry || !a?.formName ? [] : p.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => Ne(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [p, a?.formName]), te = i(() => {
79
- if (T)
80
- return Oe(T).message;
81
- }, [T]), f = i(
78
+ const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => ye(t) ? Ne(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), te = i(() => {
79
+ if (p)
80
+ return Oe(p).message;
81
+ }, [p]), f = i(
82
82
  () => [
83
83
  { key: "recordedOn", header: o("RECORDED_ON") },
84
84
  { key: "recordedBy", header: o("RECORDED_BY") }
@@ -101,12 +101,12 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
101
101
  (s, r) => {
102
102
  const l = r.formName;
103
103
  s[l] ??= [];
104
- const E = r.providers.map((ne) => ne.providerName).filter(Boolean).join(", ");
104
+ const I = r.providers.map((ne) => ne.providerName).filter(Boolean).join(", ");
105
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
- recordedBy: E ?? "--",
109
+ recordedBy: I ?? "--",
110
110
  encounterDateTime: r.encounterDateTime,
111
111
  encounterUuid: r.encounterUuid
112
112
  }), s;
@@ -117,7 +117,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
117
117
  ([s, r]) => ({
118
118
  formName: s,
119
119
  records: r.sort(
120
- (l, E) => E.encounterDateTime - l.encounterDateTime
120
+ (l, I) => I.encounterDateTime - l.encounterDateTime
121
121
  )
122
122
  })
123
123
  ).sort((s, r) => s.formName.localeCompare(r.formName));
@@ -125,7 +125,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
125
125
  R(e), _(!0);
126
126
  }, []), V = d(() => {
127
127
  _(!1), R(null);
128
- }, []), I = d((e) => {
128
+ }, []), E = d((e) => {
129
129
  globalThis.dispatchEvent(
130
130
  new CustomEvent(Ce, {
131
131
  detail: {
@@ -141,7 +141,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
141
141
  (e, t) => {
142
142
  switch (t) {
143
143
  case "recordedOn":
144
- return /* @__PURE__ */ n(pe, { onClick: () => H(e), children: e.recordedOn });
144
+ return /* @__PURE__ */ n(Te, { onClick: () => H(e), children: e.recordedOn });
145
145
  case "recordedBy":
146
146
  return e.recordedBy;
147
147
  case "actions":
@@ -152,7 +152,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
152
152
  kind: "ghost",
153
153
  size: "sm",
154
154
  testId: `edit-form-${e.encounterUuid}`,
155
- onClick: () => I(e),
155
+ onClick: () => E(e),
156
156
  children: /* @__PURE__ */ n(x, {})
157
157
  }
158
158
  ) : null;
@@ -160,29 +160,29 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
160
160
  return null;
161
161
  }
162
162
  },
163
- [H, I, u, o]
163
+ [H, E, u, o]
164
164
  );
165
165
  return /* @__PURE__ */ P(ie, { children: [
166
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || C || U.length === 0 || v ? /* @__PURE__ */ n(
166
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || C || U.length === 0 || v ? /* @__PURE__ */ n(
167
167
  G,
168
168
  {
169
169
  headers: oe,
170
170
  ariaLabel: o("FORMS_HEADING"),
171
171
  rows: [],
172
- loading: D,
172
+ loading: L,
173
173
  errorStateMessage: C ? Y?.message : void 0,
174
174
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
175
175
  renderCell: k,
176
- className: y.formsTableBody,
176
+ className: N.formsTableBody,
177
177
  dataTestId: "forms-table"
178
178
  }
179
- ) : /* @__PURE__ */ n(Te, { align: "start", children: U.map((e, t) => {
179
+ ) : /* @__PURE__ */ n(pe, { align: "start", children: U.map((e, t) => {
180
180
  const { formName: s, records: r } = e, l = se(r);
181
181
  return /* @__PURE__ */ n(
182
- Ie,
182
+ Ee,
183
183
  {
184
184
  title: s,
185
- className: y.customAccordianItem,
185
+ className: N.customAccordianItem,
186
186
  testId: `accordian-title-${s}`,
187
187
  open: t === 0,
188
188
  children: /* @__PURE__ */ n(
@@ -196,7 +196,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
196
196
  sortable: ae,
197
197
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
198
198
  renderCell: k,
199
- className: y.formsTableBody,
199
+ className: N.formsTableBody,
200
200
  dataTestId: `forms-table-${s}`
201
201
  }
202
202
  )
@@ -205,13 +205,13 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
205
205
  );
206
206
  }) }) }),
207
207
  O && a && /* @__PURE__ */ n(
208
- Ee,
208
+ Ie,
209
209
  {
210
210
  id: "modalIdForActionAreaLayout",
211
211
  portalId: "main-display-area",
212
212
  open: O,
213
213
  onRequestClose: V,
214
- modalHeading: /* @__PURE__ */ P("div", { className: y.modalHeading, children: [
214
+ modalHeading: /* @__PURE__ */ P("div", { className: N.modalHeading, children: [
215
215
  /* @__PURE__ */ n("span", { children: a.formName }),
216
216
  g && u(a) && /* @__PURE__ */ n(
217
217
  q,
@@ -221,7 +221,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
221
221
  size: "sm",
222
222
  testId: `edit-form-modal-${a.encounterUuid}`,
223
223
  onClick: () => {
224
- V(), I(a);
224
+ V(), E(a);
225
225
  },
226
226
  children: /* @__PURE__ */ n(x, {})
227
227
  }
@@ -235,7 +235,7 @@ const ve = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
235
235
  Fe,
236
236
  {
237
237
  observations: re,
238
- isLoading: Z,
238
+ isLoading: X,
239
239
  isError: ee,
240
240
  errorMessage: te,
241
241
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
@@ -1,18 +1,18 @@
1
1
  import { jsx as i, jsxs as S } from "react/jsx-runtime";
2
- import { i as G, D as F, t as j, j as z, m as H, k as J, T as P, R as x, S as Y, u as W, a as X, M as Z, L as ee, l as se, n as te, J as re, o as ae, q as oe, v as ne, w as ie, y as ce, b as le } from "./index-8DwKY7zc.js";
2
+ import { j as z, D as C, t as G, l as j, w as H, k as P, T as Z, R as x, S as J, u as Y, a as W, m as X, U as ee, n as se, p as te, Z as re, o as ae, q as oe, s as ne, v as ie, z as ce, b as le } from "./index-BWaIKbxC.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 U, useMemo as I } 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
- }, U = (t, l, n, c, u, r) => {
12
- const a = j(t, l, u), e = a.value, p = z(e);
11
+ }, F = (t, l, n, c, u, r) => {
12
+ const a = G(t, l, u), e = a.value, p = j(e);
13
13
  let o = e;
14
14
  p === "Image" && (o = /* @__PURE__ */ i(
15
- P,
15
+ Z,
16
16
  {
17
17
  imageSrc: e,
18
18
  alt: e,
@@ -26,7 +26,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
26
26
  videoSrc: e,
27
27
  hideThumbnail: r
28
28
  }
29
- )), p === "PDF" && (o = /* @__PURE__ */ i(Y, { id: `${e}-pdf`, src: e }));
29
+ )), p === "PDF" && (o = /* @__PURE__ */ i(J, { id: `${e}-pdf`, src: e }));
30
30
  const b = /* @__PURE__ */ S("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 })
@@ -37,7 +37,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
37
37
  m && /* @__PURE__ */ i("span", { className: y.secondary, children: m })
38
38
  ] }), v = t.display, T = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = c ? `${c}-${T}-${v}-${n}-${l}` : `${T}-${v}-${n}-${l}`;
39
39
  return /* @__PURE__ */ i(
40
- J,
40
+ P,
41
41
  {
42
42
  header: b,
43
43
  value: o,
@@ -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
- F,
52
+ C,
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) => U(
58
+ (e, p) => F(
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 = G(r.encounterDetails, c);
75
+ const p = z(r.encounterDetails, c);
76
76
  return /* @__PURE__ */ S(
77
- F,
77
+ C,
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) => U(
84
+ (o, b) => F(
85
85
  o,
86
86
  b,
87
87
  e,
@@ -133,14 +133,14 @@ 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 = W(), { addNotification: b } = X(), { t: d } = w(), m = de({
136
+ } = c, p = pe(/* @__PURE__ */ new Set()), o = Y(), { addNotification: b } = W(), { t: d } = w(), m = de({
137
137
  queries: u.map((s) => ({
138
138
  queryKey: he(s),
139
- queryFn: () => Z(s),
139
+ queryFn: () => X(s),
140
140
  enabled: !!s
141
141
  }))
142
142
  });
143
- C(() => {
143
+ U(() => {
144
144
  const s = m.some(($) => $.isError), R = p.current.size > 0;
145
145
  s && !R ? (b({
146
146
  title: d("ERROR_DEFAULT_TITLE"),
@@ -181,24 +181,24 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
181
181
  ) && D();
182
182
  },
183
183
  [o, D]
184
- ), C(() => {
184
+ ), U(() => {
185
185
  N && b({
186
186
  title: d("ERROR_DEFAULT_TITLE"),
187
187
  message: d("ERROR_FETCHING_OBSERVATIONS"),
188
188
  type: "error"
189
189
  });
190
190
  }, [N]);
191
- const L = I(() => {
191
+ const A = I(() => {
192
192
  if (!h) return [];
193
193
  let s = ae(h);
194
194
  e === "latest-encounter" && (s = oe(s));
195
195
  const R = ne(s);
196
196
  return ie(R);
197
- }, [h, e]), M = [
197
+ }, [h, e]), K = [
198
198
  { key: "name", header: "name" },
199
199
  { key: "value", header: "value" },
200
200
  { key: "form", header: "form" }
201
- ], A = V || !f, B = N && f, K = (!h || h.entry?.length === 0 || v.length === 0) && f, k = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, q = K ? d("NO_OBSERVATIONS_FOUND") : void 0, Q = L.length > 0 && !A && !B, g = c.titleTranslationKey, E = g ? d(g) : "";
201
+ ], L = V || !f, B = N && f, M = (!h || h.entry?.length === 0 || v.length === 0) && f, k = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, q = M ? d("NO_OBSERVATIONS_FOUND") : void 0, Q = A.length > 0 && !L && !B, g = c.titleTranslationKey, E = g ? d(g) : "";
202
202
  return /* @__PURE__ */ S(
203
203
  "div",
204
204
  {
@@ -220,17 +220,17 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
220
220
  Q ? /* @__PURE__ */ i(
221
221
  Oe,
222
222
  {
223
- groupedData: L,
223
+ groupedData: A,
224
224
  title: E,
225
225
  hideThumbnail: a
226
226
  }
227
227
  ) : /* @__PURE__ */ i(
228
228
  le,
229
229
  {
230
- headers: M,
230
+ headers: K,
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
- loading: A,
233
+ loading: L,
234
234
  errorStateMessage: k,
235
235
  emptyStateMessage: q ?? d("NO_OBSERVATIONS_AVAILABLE"),
236
236
  dataTestId: "observations-table"
@@ -0,0 +1,10 @@
1
+ import { CategoryPicker } from './categoryPickers/types';
2
+ export interface CategorySelectionModalProps<TItem> {
3
+ open: boolean;
4
+ picker: CategoryPicker<TItem>;
5
+ context: Record<string, string>;
6
+ onSelect: (item: TItem) => void;
7
+ onCancel: () => void;
8
+ }
9
+ export declare function CategorySelectionModal<TItem>({ open, picker, context, onSelect, onCancel, }: CategorySelectionModalProps<TItem>): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=CategorySelectionModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategorySelectionModal.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/CategorySelectionModal.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D,MAAM,WAAW,2BAA2B,CAAC,KAAK;IAChD,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,EAC5C,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,2BAA2B,CAAC,KAAK,CAAC,2CAqFpC"}
@@ -1,9 +1,5 @@
1
- export interface PrintOption {
2
- translationKey: string;
3
- templateId: string;
4
- shortcutKey?: string;
5
- privileges?: string[];
6
- }
1
+ import { PrintOption } from './categoryPickers/types';
2
+ export type { PrintOption };
7
3
  interface DocumentPrintButtonProps {
8
4
  printOptions?: PrintOption[];
9
5
  renderContext: Record<string, string>;
@@ -16,5 +12,4 @@ interface DocumentPrintButtonProps {
16
12
  iconLabel?: string;
17
13
  }
18
14
  export declare const DocumentPrintButton: ({ printOptions, renderContext, renderData, getRenderData, size, disabled, "data-testid": dataTestId, iconOnly, iconLabel, }: DocumentPrintButtonProps) => import("react/jsx-runtime").JSX.Element | null;
19
- export {};
20
15
  //# sourceMappingURL=DocumentPrintButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentPrintButton.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/DocumentPrintButton.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,UAAU,wBAAwB;IAChC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,GAAI,6HAUjC,wBAAwB,mDA2G1B,CAAC"}
1
+ {"version":3,"file":"DocumentPrintButton.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/DocumentPrintButton.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3E,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,UAAU,wBAAwB;IAChC,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,GAAI,6HAUjC,wBAAwB,mDAuI1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { EncounterWithVisit } from '@bahmni/services';
2
+ import { CategoryPicker } from './types';
3
+ export declare const prescriptionEncounterPicker: CategoryPicker<EncounterWithVisit>;
4
+ //# sourceMappingURL=prescriptionEncounterPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prescriptionEncounterPicker.d.ts","sourceRoot":"","sources":["../../../src/documentPrintButton/categoryPickers/prescriptionEncounterPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAe9C,eAAO,MAAM,2BAA2B,EAAE,cAAc,CAAC,kBAAkB,CA8C1E,CAAC"}
@@ -0,0 +1,24 @@
1
+ export interface PrintOption {
2
+ translationKey: string;
3
+ templateId: string;
4
+ shortcutKey?: string;
5
+ privileges?: string[];
6
+ category?: string;
7
+ }
8
+ export interface PrintPayload {
9
+ context: Record<string, string>;
10
+ data?: Record<string, unknown>;
11
+ }
12
+ export interface CategoryPicker<TItem> {
13
+ heading: string;
14
+ emptyStateMessage: string;
15
+ fetchItems: (context: Record<string, string>) => Promise<TItem[]>;
16
+ getItemKey: (item: TItem) => string;
17
+ renderItem: (item: TItem, t: (key: string) => string) => {
18
+ primary: string;
19
+ secondary?: string;
20
+ };
21
+ resolveSelection: (item: TItem, context: Record<string, string>) => PrintPayload;
22
+ }
23
+ export declare const categoryPickers: Record<string, CategoryPicker<unknown> | undefined>;
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/documentPrintButton/categoryPickers/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAClE,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,MAAM,CAAC;IACpC,UAAU,EAAE,CACV,IAAI,EAAE,KAAK,EACX,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,KACvB;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,gBAAgB,EAAE,CAChB,IAAI,EAAE,KAAK,EACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC5B,YAAY,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,MAAM,EACN,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,CAGpC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { CategoryPicker, PrintOption } from './categoryPickers/types';
2
+ export interface PrintTemplateContext {
3
+ renderData?: Record<string, unknown>;
4
+ getRenderData?: (templateId: string) => Promise<Record<string, unknown>>;
5
+ setIsPrinting: (isPrinting: boolean) => void;
6
+ }
7
+ export interface PrintOptionHandlerContext extends PrintTemplateContext {
8
+ renderContext: Record<string, string>;
9
+ openPicker: (picker: CategoryPicker<unknown>, option: PrintOption) => void;
10
+ }
11
+ export interface PrintOptionHandler {
12
+ trigger: (option: PrintOption, ctx: PrintOptionHandlerContext) => void;
13
+ }
14
+ export declare function printTemplate(option: PrintOption, renderContext: Record<string, string>, ctx: PrintTemplateContext, extraData?: Record<string, unknown>): Promise<void>;
15
+ export declare const directPrintHandler: PrintOptionHandler;
16
+ export declare const categoryPickerHandler: (picker: CategoryPicker<unknown>) => PrintOptionHandler;
17
+ export declare function getHandlerFor(option: PrintOption): PrintOptionHandler;
18
+ //# sourceMappingURL=printOptionHandlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"printOptionHandlers.d.ts","sourceRoot":"","sources":["../../src/documentPrintButton/printOptionHandlers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3E,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5E;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAC;CACxE;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,GAAG,EAAE,oBAAoB,EACzB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,QAAQ,cAAc,CAAC,OAAO,CAAC,KAC9B,kBAED,CAAC;AAUH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,kBAAkB,CAOrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAcA,OAAO,KAMN,MAAM,OAAO,CAAC;AAMf,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAYlB,eAAO,MAAM,cAAc,+FA2WzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAcA,OAAO,KAMN,MAAM,OAAO,CAAC;AAMf,OAAO,EAGL,iBAAiB,EACjB,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAYlB,eAAO,MAAM,cAAc,+FA6WzB,CAAC;AAEH,eAAe,cAAc,CAAC"}