@bahmni/widgets 0.0.1-dev.457 → 0.0.1-dev.459

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,18 +1,18 @@
1
1
  import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { r as G, s as F, t as x, v as z, e as H, w as P, F as j, y as W, z as Z, u as J, b as Y, B as X, L as ee, D as se, E as te, Z as re, G as ae, H as oe, I as ne, K as ie, Q as ce, x as le } from "./index-B4qp8zC7.js";
2
+ import { w as G, x as U, B as H, X as P, f as j, D as x, G as z, U as J, H as X, u as W, a as Y, I as Z, m as ee, J as se, K as te, r as re, M as ae, N as oe, P as ne, R as ie, g as ce, L as le } from "./index-BgKZQd55.js";
3
3
  import { useQueries as de, useQuery as ue } from "@tanstack/react-query";
4
4
  import { useRef as pe, useEffect as C, useMemo as I } from "react";
5
5
  import { useTranslation as w } from "react-i18next";
6
- const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", ye = "Observations-module_secondary__14nuS", y = {
6
+ const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", fe = "Observations-module_secondary__14nuS", f = {
7
7
  observations: be,
8
8
  title: me,
9
9
  wrapper: ve,
10
- secondary: ye
11
- }, U = (t, l, n, c, u, r) => {
12
- const a = x(t, l, u), e = a.value, p = z(e);
10
+ secondary: fe
11
+ }, F = (t, l, n, c, u, r) => {
12
+ const a = H(t, l, u), e = a.value, p = P(e);
13
13
  let o = e;
14
14
  p === "Image" && (o = /* @__PURE__ */ i(
15
- j,
15
+ z,
16
16
  {
17
17
  imageSrc: e,
18
18
  alt: e,
@@ -20,42 +20,42 @@ 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
+ J,
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__ */ N("div", { className: y.wrapper, children: [
29
+ )), p === "PDF" && (o = /* @__PURE__ */ i(X, { id: `${e}-pdf`, src: e }));
30
+ const b = /* @__PURE__ */ N("div", { className: f.wrapper, children: [
31
31
  /* @__PURE__ */ i("span", { children: a.header.display }),
32
- a.header.referenceRange && /* @__PURE__ */ i("span", { className: y.secondary, children: a.header.referenceRange })
32
+ a.header.referenceRange && /* @__PURE__ */ i("span", { className: f.secondary, children: a.header.referenceRange })
33
33
  ] }), d = u("OBSERVATIONS_RECORDED_BY", {
34
34
  provider: a.provider
35
- }), m = t.effectiveDateTime ? H(t.effectiveDateTime, u, !0).formattedResult : void 0, _ = /* @__PURE__ */ N("div", { className: y.wrapper, children: [
35
+ }), m = t.effectiveDateTime ? j(t.effectiveDateTime, u, !0).formattedResult : void 0, g = /* @__PURE__ */ N("div", { className: f.wrapper, children: [
36
36
  /* @__PURE__ */ i("span", { children: d }),
37
- m && /* @__PURE__ */ i("span", { className: y.secondary, children: m })
38
- ] }), v = t.display, g = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = c ? `${c}-${g}-${v}-${n}-${l}` : `${g}-${v}-${n}-${l}`;
37
+ m && /* @__PURE__ */ i("span", { className: f.secondary, children: m })
38
+ ] }), v = t.display, _ = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = c ? `${c}-${_}-${v}-${n}-${l}` : `${_}-${v}-${n}-${l}`;
39
39
  return /* @__PURE__ */ i(
40
- P,
40
+ x,
41
41
  {
42
42
  header: b,
43
43
  value: o,
44
- info: _,
44
+ info: g,
45
45
  id: O,
46
46
  testId: O,
47
47
  ariaLabel: O
48
48
  },
49
49
  `obs-${t.id}`
50
50
  );
51
- }, fe = (t, l, n, c, u, r, a) => /* @__PURE__ */ i(
52
- F,
51
+ }, ye = (t, l, n, c, u, r, a) => /* @__PURE__ */ i(
52
+ U,
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,
@@ -74,14 +74,14 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
74
74
  const { t: c } = w(), u = (r, a, e) => {
75
75
  const p = G(r.encounterDetails, c);
76
76
  return /* @__PURE__ */ N(
77
- F,
77
+ U,
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,
@@ -91,7 +91,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
91
91
  )
92
92
  ),
93
93
  r.groupedObservations.map(
94
- (o, b) => fe(
94
+ (o, b) => ye(
95
95
  o,
96
96
  c,
97
97
  a,
@@ -117,7 +117,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
117
117
  )
118
118
  }
119
119
  );
120
- }, Ee = (t) => ["conceptUuid", t], he = (t, l, n, c) => [
120
+ }, he = (t) => ["conceptUuid", t], Ee = (t, l, n, c) => [
121
121
  "observations",
122
122
  t,
123
123
  ...l,
@@ -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
- queryKey: Ee(s),
139
- queryFn: () => X(s),
138
+ queryKey: he(s),
139
+ queryFn: () => Z(s),
140
140
  enabled: !!s
141
141
  }))
142
142
  });
@@ -148,22 +148,22 @@ 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 g = I(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = I(() => [.../* @__PURE__ */ new Set([...g, ...r])], [g, r]), y = I(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), _ = e === "latest" || e === "latest-encounter", O = ee(
152
152
  l,
153
153
  n
154
154
  ), {
155
- data: E,
155
+ data: h,
156
156
  isLoading: V,
157
157
  isError: S,
158
158
  refetch: D
159
159
  } = ue({
160
- queryKey: he(
160
+ queryKey: Ee(
161
161
  o,
162
162
  v,
163
163
  n,
164
164
  e
165
165
  ),
166
- queryFn: () => g ? se(
166
+ queryFn: () => _ ? se(
167
167
  o,
168
168
  v,
169
169
  n
@@ -172,7 +172,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
172
172
  v,
173
173
  n
174
174
  ),
175
- enabled: !!o && v.length > 0 && f && !O
175
+ enabled: !!o && v.length > 0 && y && !O
176
176
  });
177
177
  re(
178
178
  (s) => {
@@ -189,39 +189,39 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
189
189
  });
190
190
  }, [S]);
191
191
  const L = I(() => {
192
- if (!E) return [];
193
- let s = ae(E);
192
+ if (!h) return [];
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
- }, [E, e]), K = [
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 = S && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, M = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, k = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = L.length > 0 && !A && !B, T = c.titleTranslationKey, h = T ? d(T) : "";
201
+ ], A = V || !y, B = S && y, M = (!h || h.entry?.length === 0 || v.length === 0) && y, k = B ? d("ERROR_FETCHING_OBSERVATIONS") : null, Q = M ? d("NO_OBSERVATIONS_FOUND") : void 0, q = L.length > 0 && !A && !B, T = c.titleTranslationKey, E = T ? d(T) : "";
202
202
  return /* @__PURE__ */ N(
203
203
  "div",
204
204
  {
205
205
  id: "observations",
206
- "data-testid": T ? `observations-${h}` : "observations",
206
+ "data-testid": T ? `observations-${E}` : "observations",
207
207
  "aria-label": "observations-aria-label",
208
- className: y.observations,
208
+ className: f.observations,
209
209
  children: [
210
210
  /* @__PURE__ */ i(
211
211
  ce,
212
212
  {
213
213
  id: "observations-title",
214
- testId: T ? `observations-title-${h}` : "observations-title",
215
- title: h,
216
- className: y.title,
217
- children: /* @__PURE__ */ i("p", { children: h })
214
+ testId: T ? `observations-title-${E}` : "observations-title",
215
+ title: E,
216
+ className: f.title,
217
+ children: /* @__PURE__ */ i("p", { children: E })
218
218
  }
219
219
  ),
220
220
  q ? /* @__PURE__ */ i(
221
221
  Oe,
222
222
  {
223
223
  groupedData: L,
224
- title: h,
224
+ title: E,
225
225
  hideThumbnail: a
226
226
  }
227
227
  ) : /* @__PURE__ */ i(
@@ -231,8 +231,8 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
231
231
  rows: [],
232
232
  ariaLabel: d("OBSERVATIONS"),
233
233
  loading: A,
234
- errorStateMessage: M,
235
- emptyStateMessage: k ?? d("NO_OBSERVATIONS_AVAILABLE"),
234
+ errorStateMessage: k,
235
+ emptyStateMessage: Q ?? d("NO_OBSERVATIONS_AVAILABLE"),
236
236
  dataTestId: "observations-table"
237
237
  }
238
238
  )
@@ -241,7 +241,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
241
241
  );
242
242
  };
243
243
  export {
244
- Ee as conceptUuidQueryKeys,
244
+ he as conceptUuidQueryKeys,
245
245
  Ne as default,
246
- he as observationsQueryKeys
246
+ Ee as observationsQueryKeys
247
247
  };
@@ -1 +1 @@
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
+ {"version":3,"file":"DocumentUpload.d.ts","sourceRoot":"","sources":["../../src/documentUpload/DocumentUpload.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAGpE,OAAO,EAGL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAkPlB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqKxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -35,5 +35,6 @@ export interface DocumentUploadProps {
35
35
  config?: DocumentUploadConfig;
36
36
  documentsTitle?: string;
37
37
  isSaving?: boolean;
38
+ defaultOption?: string | null;
38
39
  }
39
40
  //# 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,W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AAE,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;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface DocumentPreviewAttachment {
3
+ url: string;
4
+ contentType?: string;
5
+ }
6
+ export interface DocumentPreviewProps {
7
+ id: string;
8
+ title: string;
9
+ attachments: DocumentPreviewAttachment[];
10
+ }
11
+ /**
12
+ * One thumbnail per document. Opening it previews every attachment of the
13
+ * document, one below the other, instead of only the first file.
14
+ */
15
+ export declare const DocumentPreview: React.FC<DocumentPreviewProps>;
16
+ export default DocumentPreview;
17
+ //# sourceMappingURL=DocumentPreview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPreview.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentPreview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,yBAAyB,EAAE,CAAC;CAC1C;AAqCD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0E1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export { default as DocumentsTable } from './DocumentsTable';
2
+ export { DocumentPreview } from './DocumentPreview';
3
+ export type { DocumentPreviewAttachment, DocumentPreviewProps, } from './DocumentPreview';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}