@bahmni/widgets 0.0.1-dev.105 → 0.0.1-dev.107

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,10 +1,10 @@
1
1
  import { jsxs as p, jsx as e, Fragment as z } from "react/jsx-runtime";
2
- import { u as Q, _ as Y, b as J, E as W, h as X, i as Z, S as ee, V as I, a as re, f as oe, A as ae, z as te, c as V, s as ne } from "./index-BwOAdUc7.js";
2
+ import { u as Q, _ as Y, b as J, E as W, h as X, i as Z, R as ee, x as S, a as re, d as oe, A as ae, y as te, c as x, s as ne } from "./index-DMwP4u7j.js";
3
3
  import { useQuery as f } from "@tanstack/react-query";
4
- import { useState as x, useMemo as u, useCallback as g } from "react";
4
+ import { useState as V, useMemo as u, useCallback as g } from "react";
5
5
  import { createPortal as se } from "react-dom";
6
6
  import { useTranslation as ce } from "react-i18next";
7
- const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie = "_formContent_ua0cn_18", le = "_formDetailsContainer_ua0cn_25", ue = "_observation_ua0cn_30", pe = "_groupContainer_ua0cn_39", _e = "_rowContainer_ua0cn_43", be = "_groupLabel_ua0cn_48", fe = "_rowLabel_ua0cn_58", ge = "_rowValue_ua0cn_67", he = "_groupMembers_ua0cn_75", Ne = "_memberRow_ua0cn_81", ye = "_memberLabel_ua0cn_86", Me = "_memberValue_ua0cn_94", Le = "_commentSection_ua0cn_102", Oe = "_commentText_ua0cn_108", ve = "_nestedGroup_ua0cn_117", Ce = "_nestedGroupLabel_ua0cn_124", De = "_nestedGroupMembers_ua0cn_133", o = {
7
+ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie = "_formContent_ua0cn_18", le = "_formDetailsContainer_ua0cn_25", ue = "_observation_ua0cn_30", pe = "_groupContainer_ua0cn_39", _e = "_rowContainer_ua0cn_43", be = "_groupLabel_ua0cn_48", fe = "_rowLabel_ua0cn_58", ge = "_rowValue_ua0cn_67", he = "_groupMembers_ua0cn_75", ye = "_memberRow_ua0cn_81", Ne = "_memberLabel_ua0cn_86", Me = "_memberValue_ua0cn_94", Le = "_commentSection_ua0cn_102", Oe = "_commentText_ua0cn_108", Re = "_nestedGroup_ua0cn_117", ve = "_nestedGroupLabel_ua0cn_124", Ce = "_nestedGroupMembers_ua0cn_133", o = {
8
8
  formsTableBody: de,
9
9
  customAccordianItem: me,
10
10
  formContent: ie,
@@ -16,14 +16,14 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
16
16
  rowLabel: fe,
17
17
  rowValue: ge,
18
18
  groupMembers: he,
19
- memberRow: Ne,
20
- memberLabel: ye,
19
+ memberRow: ye,
20
+ memberLabel: Ne,
21
21
  memberValue: Me,
22
22
  commentSection: Le,
23
23
  commentText: Oe,
24
- nestedGroup: ve,
25
- nestedGroupLabel: Ce,
26
- nestedGroupMembers: De
24
+ nestedGroup: Re,
25
+ nestedGroupLabel: ve,
26
+ nestedGroupMembers: Ce
27
27
  }, U = ({
28
28
  member: r,
29
29
  depth: m = 0
@@ -57,7 +57,7 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
57
57
  ]
58
58
  }
59
59
  );
60
- }, Re = ({
60
+ }, De = ({
61
61
  observation: r,
62
62
  index: m
63
63
  }) => {
@@ -92,29 +92,29 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
92
92
  },
93
93
  `${r.concept.uuid}-${m}`
94
94
  );
95
- }, Se = ({
95
+ }, Ie = ({
96
96
  episodeOfCareUuids: r,
97
97
  encounterUuids: m,
98
98
  config: i
99
99
  }) => {
100
- const { t: a } = ce(), l = Q(), [_, L] = x(!1), [n, O] = x(null), $ = i?.numberOfVisits, {
100
+ const { t: a } = ce(), l = Q(), [_, L] = V(!1), [n, O] = V(null), $ = i?.numberOfVisits, {
101
101
  data: h = [],
102
- isLoading: v,
103
- isError: C,
102
+ isLoading: R,
103
+ isError: v,
104
104
  error: q
105
105
  } = f({
106
106
  queryKey: ["forms", l, r],
107
107
  queryFn: () => Y(l, void 0, $),
108
108
  enabled: !!l
109
- }), D = u(() => !m || m.length === 0 ? h : h.filter(
109
+ }), C = u(() => !m || m.length === 0 ? h : h.filter(
110
110
  (t) => m.includes(t.encounterUuid)
111
- ), [h, m]), { data: R = [] } = f({
111
+ ), [h, m]), { data: D = [] } = f({
112
112
  queryKey: ["observationForms"],
113
113
  queryFn: J
114
114
  }), A = g(
115
- (t) => R.find((c) => c.name === t)?.uuid,
116
- [R]
117
- ), N = u(() => {
115
+ (t) => D.find((c) => c.name === t)?.uuid,
116
+ [D]
117
+ ), y = u(() => {
118
118
  if (n)
119
119
  return A(n.formName);
120
120
  }, [n, A]), {
@@ -122,20 +122,20 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
122
122
  isLoading: k,
123
123
  error: F
124
124
  } = f({
125
- queryKey: ["formMetadata", N],
126
- queryFn: () => W(N),
127
- enabled: !!N && _
125
+ queryKey: ["formMetadata", y],
126
+ queryFn: () => W(y),
127
+ enabled: !!y && _
128
128
  }), {
129
- data: y,
129
+ data: N,
130
130
  isLoading: H,
131
131
  error: w
132
132
  } = f({
133
133
  queryKey: ["formsEncounter", n?.encounterUuid],
134
134
  queryFn: () => X(n.encounterUuid, !0),
135
135
  enabled: !!n?.encounterUuid && _
136
- }), T = u(() => !y?.observations || !n?.formName ? [] : y.observations.filter(
136
+ }), T = u(() => !N?.observations || !n?.formName ? [] : N.observations.filter(
137
137
  (d) => "formFieldPath" in d && typeof d.formFieldPath == "string" && d.formFieldPath.includes(n.formName)
138
- ), [y?.observations, n?.formName]), E = u(
138
+ ), [N?.observations, n?.formName]), E = u(
139
139
  () => [
140
140
  { key: "recordedOn", header: a("FORM_RECORDED_ON") },
141
141
  { key: "recordedBy", header: a("FORM_RECORDED_BY") }
@@ -148,7 +148,7 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
148
148
  ],
149
149
  []
150
150
  ), B = u(() => {
151
- const t = D.reduce(
151
+ const t = C.reduce(
152
152
  (c, s) => {
153
153
  const b = s.formName;
154
154
  c[b] ??= [];
@@ -172,11 +172,11 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
172
172
  )
173
173
  })
174
174
  ).sort((c, s) => c.formName.localeCompare(s.formName));
175
- }, [D, a]), G = g((t) => {
175
+ }, [C, a]), G = g((t) => {
176
176
  O(t), L(!0);
177
177
  }, []), j = g(() => {
178
178
  L(!1), O(null);
179
- }, []), S = g(
179
+ }, []), I = g(
180
180
  (t, d) => {
181
181
  switch (d) {
182
182
  case "recordedOn":
@@ -190,16 +190,16 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
190
190
  [G]
191
191
  );
192
192
  return /* @__PURE__ */ p(z, { children: [
193
- /* @__PURE__ */ e("div", { "data-testid": "forms-table", children: v || C || B.length === 0 ? /* @__PURE__ */ e(
194
- I,
193
+ /* @__PURE__ */ e("div", { "data-testid": "forms-table", children: R || v || B.length === 0 ? /* @__PURE__ */ e(
194
+ S,
195
195
  {
196
196
  headers: E,
197
197
  ariaLabel: a("FORMS_HEADING"),
198
198
  rows: [],
199
- loading: v,
200
- errorStateMessage: C ? q?.message : void 0,
199
+ loading: R,
200
+ errorStateMessage: v ? q?.message : void 0,
201
201
  emptyStateMessage: a("FORMS_UNAVAILABLE"),
202
- renderCell: S,
202
+ renderCell: I,
203
203
  className: o.formsTableBody,
204
204
  "data-testid": "sortable-data-table"
205
205
  }
@@ -213,7 +213,7 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
213
213
  testId: "accordian-table-title",
214
214
  open: d === 0,
215
215
  children: /* @__PURE__ */ e(
216
- I,
216
+ S,
217
217
  {
218
218
  headers: E,
219
219
  ariaLabel: a("FORMS_HEADING"),
@@ -222,7 +222,7 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
222
222
  errorStateMessage: "",
223
223
  sortable: P,
224
224
  emptyStateMessage: a("FORMS_UNAVAILABLE"),
225
- renderCell: S,
225
+ renderCell: I,
226
226
  className: o.formsTableBody,
227
227
  "data-testid": "sortable-data-table"
228
228
  }
@@ -242,8 +242,8 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
242
242
  passiveModal: !0,
243
243
  size: "md",
244
244
  testId: "form-details-modal",
245
- children: /* @__PURE__ */ e("div", { className: o.formContent, children: k || H ? /* @__PURE__ */ e(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ e("div", { children: V(F).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ e("div", { children: V(w).message ?? a("ERROR_FETCHING_FORM_DATA") }) : T.length > 0 ? /* @__PURE__ */ e("div", { className: o.formDetailsContainer, children: T.map((t, d) => /* @__PURE__ */ e(
246
- Re,
245
+ children: /* @__PURE__ */ e("div", { className: o.formContent, children: k || H ? /* @__PURE__ */ e(te, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ e("div", { children: x(F).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ e("div", { children: x(w).message ?? a("ERROR_FETCHING_FORM_DATA") }) : T.length > 0 ? /* @__PURE__ */ e("div", { className: o.formDetailsContainer, children: T.map((t, d) => /* @__PURE__ */ e(
246
+ De,
247
247
  {
248
248
  observation: t,
249
249
  index: d
@@ -257,5 +257,5 @@ const de = "_formsTableBody_ua0cn_1", me = "_customAccordianItem_ua0cn_6", ie =
257
257
  ] });
258
258
  };
259
259
  export {
260
- Se as default
260
+ Ie as default
261
261
  };
@@ -75313,7 +75313,7 @@ const NGe = [
75313
75313
  },
75314
75314
  {
75315
75315
  type: "forms",
75316
- component: w1(() => import("./FormsTable-BkEYszLa.js"))
75316
+ component: w1(() => import("./FormsTable-COl06FGn.js"))
75317
75317
  }
75318
75318
  ];
75319
75319
  class Xr {
@@ -75374,34 +75374,34 @@ export {
75374
75374
  aYe as M,
75375
75375
  EWe as N,
75376
75376
  tJe as P,
75377
- yYe as R,
75378
- Vke as S,
75377
+ Vke as R,
75378
+ nJe as S,
75379
75379
  xGe as U,
75380
- Qr as V,
75380
+ rGe as V,
75381
75381
  eJe as _,
75382
75382
  Ai as a,
75383
75383
  XGe as b,
75384
75384
  tr as c,
75385
- LWe as d,
75386
- Oce as e,
75387
- _i as f,
75388
- nJe as g,
75385
+ _i as d,
75386
+ LWe as e,
75387
+ Oce as f,
75388
+ yYe as g,
75389
75389
  JGe as h,
75390
75390
  Cr as i,
75391
- rGe as j,
75392
- bGe as k,
75393
- hn as l,
75394
- rJe as m,
75395
- oJe as n,
75396
- aJe as o,
75397
- sJe as p,
75398
- lJe as q,
75391
+ bGe as j,
75392
+ hn as k,
75393
+ rJe as l,
75394
+ oJe as m,
75395
+ aJe as n,
75396
+ sJe as o,
75397
+ lJe as p,
75398
+ cJe as q,
75399
75399
  iJe as r,
75400
75400
  GGe as s,
75401
- cJe as t,
75401
+ dJe as t,
75402
75402
  C1 as u,
75403
- dJe as v,
75404
- uJe as w,
75405
- hJe as x,
75406
- Eke as z
75403
+ uJe as v,
75404
+ hJe as w,
75405
+ Qr as x,
75406
+ Eke as y
75407
75407
  };