@bahmni/clinical-app 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.
Files changed (39) hide show
  1. package/dist/{ConsultationPage-CSuJ2AyA.js → ConsultationPage-vHHPzU51.js} +3211 -3045
  2. package/dist/DocumentsTable-DH1dnlXy-CDnlgcKX.js +439 -0
  3. package/dist/{FormsTable-BkZ7CAhs-B75t4NlN.js → FormsTable-B8Zxjboo-Cy7HqC-X.js} +83 -83
  4. package/dist/{LNWAZHJI-Ck7o7Ghg.js → LNWAZHJI-C9KEv1sp.js} +7 -7
  5. package/dist/{MWZ6AO7Z-CpoFA_gI.js → MWZ6AO7Z-Dm1CN6bk.js} +7 -7
  6. package/dist/{Observations-ByaPCQhx-CndOctkY.js → Observations-BzjjSeWg-Cz9cdvoF.js} +41 -41
  7. package/dist/{YPM2AS64-D6_BOozD.js → YPM2AS64-CQ9n9BRd.js} +138 -138
  8. package/dist/components/consultationPad/index.d.ts.map +1 -1
  9. package/dist/components/consultationPad/services.d.ts.map +1 -1
  10. package/dist/components/consultationPad/utils.d.ts +1 -0
  11. package/dist/components/consultationPad/utils.d.ts.map +1 -1
  12. package/dist/components/forms/documents/DocumentsForm.d.ts +8 -0
  13. package/dist/components/forms/documents/DocumentsForm.d.ts.map +1 -0
  14. package/dist/components/forms/documents/__tests__/__mocks__/documentsMocks.d.ts +24 -0
  15. package/dist/components/forms/documents/__tests__/__mocks__/documentsMocks.d.ts.map +1 -0
  16. package/dist/components/forms/documents/constants.d.ts +7 -0
  17. package/dist/components/forms/documents/constants.d.ts.map +1 -0
  18. package/dist/components/forms/documents/index.d.ts +2 -0
  19. package/dist/components/forms/documents/index.d.ts.map +1 -0
  20. package/dist/components/forms/documents/models.d.ts +21 -0
  21. package/dist/components/forms/documents/models.d.ts.map +1 -0
  22. package/dist/components/forms/documents/store.d.ts +4 -0
  23. package/dist/components/forms/documents/store.d.ts.map +1 -0
  24. package/dist/components/forms/documents/utils.d.ts +8 -0
  25. package/dist/components/forms/documents/utils.d.ts.map +1 -0
  26. package/dist/components/forms/index.d.ts.map +1 -1
  27. package/dist/components/forms/models.d.ts +5 -7
  28. package/dist/components/forms/models.d.ts.map +1 -1
  29. package/dist/components/forms/observations/ObservationFormsContainer.d.ts.map +1 -1
  30. package/dist/{hook-Bfvw3hcE.js → hook-BxtXi8AK.js} +3 -3
  31. package/dist/{index-DfwaWuXc.js → index--F6xmSTj.js} +12 -12
  32. package/dist/{index-B4nadjEE.js → index-DJGrR7ms.js} +16 -16
  33. package/dist/{index-CFA4g7FG.js → index-DLVbdIhb.js} +59390 -67202
  34. package/dist/index.css +1 -1
  35. package/dist/index.js +2 -2
  36. package/dist/locales/locale_en.json +30 -0
  37. package/dist/locales/locale_es.json +30 -0
  38. package/package.json +1 -1
  39. package/dist/DocumentsTable-cTYcbFbC-gO9nbYh4.js +0 -227
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cX as c } from "./index-CFA4g7FG.js";
1
+ import { d9 as i } from "./index-DLVbdIhb.js";
2
2
  export {
3
- c as ClinicalApp
3
+ i as ClinicalApp
4
4
  };
@@ -137,6 +137,36 @@
137
137
  "CONDITION_TABLE_DURATION": "Duration",
138
138
  "CONDITION_TABLE_NOT_AVAILABLE": "Not available",
139
139
  "CONDITION_TABLE_RECORDED_BY": "Recorded By",
140
+ "DOCUMENTS_ADDED_DOCUMENT_TYPE": "Added document type",
141
+ "DOCUMENTS_ADD_ACTION": "Add document",
142
+ "DOCUMENTS_ADD_MORE": "Add more",
143
+ "DOCUMENTS_ADD_NOTE": "Add note",
144
+ "DOCUMENTS_ATTACHMENT_COUNTER": "Attachment {{current}} of {{total}}",
145
+ "DOCUMENTS_DOCUMENT_ID_LABEL": "Document ID",
146
+ "DOCUMENTS_DOCUMENT_TYPE_LABEL": "Document type",
147
+ "DOCUMENTS_DOCUMENT_TYPE_PLACEHOLDER": "Choose an option",
148
+ "DOCUMENTS_ERROR_INVALID_CONFIGURATION": "Documents control is not configured correctly.",
149
+ "DOCUMENTS_ERROR_LOADING_DOCUMENT_TYPES": "Unable to load the document types.",
150
+ "DOCUMENTS_INPUT_CONTROL_LABEL": "Documents",
151
+ "DOCUMENTS_LOADING_ATTACHMENT": "Loading attachment…",
152
+ "DOCUMENTS_NOT_SAVED_MESSAGE": "Some documents could not be uploaded, so they were not saved with this consultation. Add them again from the patient's documents.",
153
+ "DOCUMENTS_NOT_SAVED_TITLE": "Documents not saved",
154
+ "DOCUMENTS_NOTE_PLACEHOLDER": "Add a note about this document",
155
+ "DOCUMENTS_PRINT_ALL": "Print all",
156
+ "DOCUMENTS_PRINT_ATTACHMENT": "Print attachment {{index}}",
157
+ "DOCUMENTS_SELECT_DOCUMENT_TYPE": "Select a document type",
158
+ "DOCUMENTS_UPLOAD_A_DOCUMENT": "Please upload a document",
159
+ "DOCUMENTS_UPLOAD_TITLE": "Upload documents",
160
+ "DOCUMENT_UPLOAD_BUTTON": "Upload",
161
+ "DOCUMENT_UPLOAD_FAILED_TITLE": "Upload failed",
162
+ "DOCUMENT_UPLOAD_INVALID_TYPE_MESSAGE": "Please upload a file in the accepted file format",
163
+ "DOCUMENT_UPLOAD_INVALID_TYPE_TITLE": "Unsupported file type",
164
+ "DOCUMENT_UPLOAD_MAX_SIZE": "Max file size is {{size}}MB.",
165
+ "DOCUMENT_UPLOAD_REMOVE_FILE": "Remove",
166
+ "DOCUMENT_UPLOAD_SIZE_EXCEEDED_MESSAGE": "Please upload a file in accepted file size",
167
+ "DOCUMENT_UPLOAD_SIZE_EXCEEDED_TITLE": "File too large",
168
+ "DOCUMENT_UPLOAD_SUPPORTED_TYPES_LIST": "Supported file types are {{types}}.",
169
+ "DOCUMENT_UPLOAD_TITLE": "Upload files",
140
170
  "EDIT_ENCOUNTER_MESSAGE": "Edited an encounter for patient",
141
171
  "EDIT_OBSERVATION_FORM": "Edit",
142
172
  "EDIT_OBSERVATION_FORM_TITLE": "Edit Observation Form",
@@ -146,6 +146,36 @@
146
146
  "CONDITION_TABLE_DURATION": "Duración",
147
147
  "CONDITION_TABLE_NOT_AVAILABLE": "No disponible",
148
148
  "CONDITION_TABLE_RECORDED_BY": "Grabado Por",
149
+ "DOCUMENTS_ADDED_DOCUMENT_TYPE": "Tipo de documento agregado",
150
+ "DOCUMENTS_ADD_ACTION": "Agregar documento",
151
+ "DOCUMENTS_ADD_MORE": "Agregar más",
152
+ "DOCUMENTS_ADD_NOTE": "Agregar nota",
153
+ "DOCUMENTS_ATTACHMENT_COUNTER": "Adjunto {{current}} de {{total}}",
154
+ "DOCUMENTS_DOCUMENT_ID_LABEL": "ID del documento",
155
+ "DOCUMENTS_DOCUMENT_TYPE_LABEL": "Tipo de documento",
156
+ "DOCUMENTS_DOCUMENT_TYPE_PLACEHOLDER": "Elija una opción",
157
+ "DOCUMENTS_ERROR_INVALID_CONFIGURATION": "El control de documentos no está configurado correctamente.",
158
+ "DOCUMENTS_ERROR_LOADING_DOCUMENT_TYPES": "No se pueden cargar los tipos de documento.",
159
+ "DOCUMENTS_INPUT_CONTROL_LABEL": "Documentos",
160
+ "DOCUMENTS_LOADING_ATTACHMENT": "Cargando adjunto…",
161
+ "DOCUMENTS_NOT_SAVED_MESSAGE": "No se pudieron subir algunos documentos, por lo que no se guardaron con esta consulta. Vuelva a agregarlos desde los documentos del paciente.",
162
+ "DOCUMENTS_NOT_SAVED_TITLE": "Documentos no guardados",
163
+ "DOCUMENTS_NOTE_PLACEHOLDER": "Agregue una nota sobre este documento",
164
+ "DOCUMENTS_PRINT_ALL": "Imprimir todo",
165
+ "DOCUMENTS_PRINT_ATTACHMENT": "Imprimir adjunto {{index}}",
166
+ "DOCUMENTS_SELECT_DOCUMENT_TYPE": "Seleccione un tipo de documento",
167
+ "DOCUMENTS_UPLOAD_A_DOCUMENT": "Suba un documento",
168
+ "DOCUMENTS_UPLOAD_TITLE": "Subir documentos",
169
+ "DOCUMENT_UPLOAD_BUTTON": "Subir",
170
+ "DOCUMENT_UPLOAD_FAILED_TITLE": "Error al subir",
171
+ "DOCUMENT_UPLOAD_INVALID_TYPE_MESSAGE": "Suba un archivo en un formato admitido",
172
+ "DOCUMENT_UPLOAD_INVALID_TYPE_TITLE": "Tipo de archivo no admitido",
173
+ "DOCUMENT_UPLOAD_MAX_SIZE": "El tamaño máximo del archivo es {{size}} MB.",
174
+ "DOCUMENT_UPLOAD_REMOVE_FILE": "Quitar",
175
+ "DOCUMENT_UPLOAD_SIZE_EXCEEDED_MESSAGE": "Suba un archivo con un tamaño admitido",
176
+ "DOCUMENT_UPLOAD_SIZE_EXCEEDED_TITLE": "Archivo demasiado grande",
177
+ "DOCUMENT_UPLOAD_SUPPORTED_TYPES_LIST": "Los tipos de archivo admitidos son {{types}}.",
178
+ "DOCUMENT_UPLOAD_TITLE": "Subir archivos",
149
179
  "EDIT_ENCOUNTER_MESSAGE": "Editó un encuentro para el paciente",
150
180
  "EDIT_OBSERVATION_FORM": "Editar",
151
181
  "EDIT_OBSERVATION_FORM_TITLE": "Editar formulario de observación",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/clinical-app",
3
- "version": "0.0.1-dev.451",
3
+ "version": "0.0.1-dev.453",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,227 +0,0 @@
1
- import { jsx as d, jsxs as h, Fragment as Y } from "react/jsx-runtime";
2
- import { d as x, u as G, z as J, J as W, Y as X, h as Z, I as ee, a as te } from "./index-CFA4g7FG.js";
3
- import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as _, useEffect as D, useMemo as p } from "react";
5
- const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", de = "DocumentsTable-module_documentViewerContainer__F5m8D", re = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", r = {
6
- documentsTableBody: ne,
7
- viewAttachmentsLink: oe,
8
- documentViewerContainer: de,
9
- attachmentItem: re,
10
- attachmentCounter: se,
11
- attachmentError: me,
12
- documentIframe: ce,
13
- documentImage: le
14
- }, ue = {
15
- documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
16
- documentType: "DOCUMENTS_TYPE",
17
- uploadedOn: "DOCUMENTS_UPLOADED_ON",
18
- uploadedBy: "DOCUMENTS_UPLOADED_BY",
19
- attachments: "DOCUMENTS_ATTACHMENTS"
20
- };
21
- function R(a) {
22
- return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
- }
24
- function ie(a, E) {
25
- return a.map((s) => ({
26
- key: s,
27
- header: E(ue[s])
28
- }));
29
- }
30
- const Te = [
31
- "documentIdentifier",
32
- "documentType",
33
- "attachments",
34
- "uploadedOn",
35
- "uploadedBy"
36
- ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ie = ({ config: a, encounterUuids: E }) => {
37
- const [s, w] = l(!1), [o, U] = l(
38
- null
39
- ), [$, O] = l(
40
- /* @__PURE__ */ new Set()
41
- ), g = x(), { t: n } = G(), { addNotification: L } = J(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = _((e) => {
42
- U(e), w(!0);
43
- }, []), H = _(() => {
44
- w(!1), U(null), O(/* @__PURE__ */ new Set());
45
- }, []), v = _((e) => {
46
- O((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: q, isError: y, error: b } = ae({
48
- queryKey: [
49
- "documents",
50
- g,
51
- E,
52
- f,
53
- u
54
- ],
55
- enabled: !!g,
56
- queryFn: () => W(
57
- g,
58
- E,
59
- u,
60
- f
61
- )
62
- });
63
- D(() => {
64
- i && A(i.total);
65
- }, [i]), D(() => {
66
- C(1), A(void 0);
67
- }, [g]), D(() => {
68
- y && L({
69
- title: n("ERROR_DEFAULT_TITLE"),
70
- message: b?.message ?? "",
71
- type: "error"
72
- });
73
- }, [y, b, L, n]), D(() => {
74
- const e = new AbortController();
75
- return (async () => {
76
- if (!s || !o) return;
77
- const t = /* @__PURE__ */ new Set(), m = B(o);
78
- for (let c = 0; c < m.length; c++) {
79
- const S = R(m[c].url);
80
- try {
81
- (await fetch(S, {
82
- method: "HEAD",
83
- signal: e.signal
84
- })).ok || t.add(c);
85
- } catch (N) {
86
- N instanceof Error && N.name !== "AbortError" && t.add(c);
87
- }
88
- }
89
- e.signal.aborted || O(t);
90
- })(), () => e.abort();
91
- }, [s, o]);
92
- const z = _(
93
- (e, t) => {
94
- t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
- },
96
- [u]
97
- ), I = p(
98
- () => a?.fields ?? Te,
99
- [a?.fields]
100
- ), j = p(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = p(() => ie(I, n), [I, n]), K = p(
101
- () => I.map((e) => ({
102
- key: e,
103
- sortable: e !== "attachments"
104
- })),
105
- [I]
106
- ), T = p(
107
- () => o ? B(o) : [],
108
- [o]
109
- ), Q = _(
110
- (e, t) => {
111
- switch (t) {
112
- case "documentIdentifier":
113
- return /* @__PURE__ */ d("span", { children: e.documentIdentifier });
114
- case "documentType":
115
- return e.documentType ?? n("DOCUMENTS_NOT_AVAILABLE");
116
- case "uploadedOn":
117
- return Z(
118
- e.uploadedOn,
119
- n,
120
- !0
121
- ).formattedResult || n("DOCUMENTS_NOT_AVAILABLE");
122
- case "uploadedBy":
123
- return e.uploadedBy ?? n("DOCUMENTS_NOT_AVAILABLE");
124
- case "attachments":
125
- return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ d(
126
- X,
127
- {
128
- onClick: () => M(e),
129
- className: r.viewAttachmentsLink,
130
- "data-testid": `view-attachments-${e.id}`,
131
- children: n("DOCUMENTS_VIEW_ATTACHMENTS")
132
- }
133
- ) : "--";
134
- default:
135
- return null;
136
- }
137
- },
138
- [M, n]
139
- );
140
- return /* @__PURE__ */ h(Y, { children: [
141
- /* @__PURE__ */ d("div", { "data-testid": "documents-table", children: /* @__PURE__ */ d(
142
- ee,
143
- {
144
- headers: P,
145
- ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: j,
147
- loading: q,
148
- errorStateMessage: y ? b?.message : null,
149
- sortable: K,
150
- emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: Q,
152
- className: r.documentsTableBody,
153
- dataTestId: "documents-table",
154
- pageSize: u,
155
- totalItems: F,
156
- page: f,
157
- onPageChange: z
158
- }
159
- ) }),
160
- s && o && /* @__PURE__ */ d(
161
- te,
162
- {
163
- id: "modalIdForActionAreaLayout",
164
- portalId: "main-display-area",
165
- open: s,
166
- onRequestClose: H,
167
- modalHeading: o.documentIdentifier,
168
- passiveModal: !0,
169
- size: "lg",
170
- testId: "document-view-modal",
171
- children: /* @__PURE__ */ d("div", { className: r.documentViewerContainer, children: T.map((e, t) => {
172
- const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), N = $.has(t);
173
- return m === "#" || N ? /* @__PURE__ */ h(
174
- "div",
175
- {
176
- className: r.attachmentError,
177
- "data-testid": `attachment-error-${t}`,
178
- children: [
179
- T.length > 1 && /* @__PURE__ */ h("p", { className: r.attachmentCounter, children: [
180
- t + 1,
181
- "/",
182
- T.length
183
- ] }),
184
- /* @__PURE__ */ d("p", { children: n("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
185
- ]
186
- },
187
- `${o.id}-${e.url}`
188
- ) : /* @__PURE__ */ h(
189
- "div",
190
- {
191
- className: r.attachmentItem,
192
- "data-testid": `attachment-item-${t}`,
193
- children: [
194
- T.length > 1 && /* @__PURE__ */ h("p", { className: r.attachmentCounter, children: [
195
- t + 1,
196
- "/",
197
- T.length
198
- ] }),
199
- S ? /* @__PURE__ */ d(
200
- "img",
201
- {
202
- src: m,
203
- alt: o.documentIdentifier,
204
- className: r.documentImage,
205
- onError: () => v(t)
206
- }
207
- ) : /* @__PURE__ */ d(
208
- "iframe",
209
- {
210
- src: c ? `${m}#toolbar=0` : m,
211
- className: r.documentIframe,
212
- title: o.documentIdentifier,
213
- onError: () => v(t)
214
- }
215
- )
216
- ]
217
- },
218
- `${o.id}-${e.url}`
219
- );
220
- }) })
221
- }
222
- )
223
- ] });
224
- };
225
- export {
226
- Ie as default
227
- };