@bahmni/widgets 0.0.1-dev.433 → 0.0.1-dev.434
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.
- package/dist/{DocumentsTable-CfnN4mI_.js → DocumentsTable-B_V_lnlV.js} +1 -1
- package/dist/{FormsTable-Dn8KhGQL.js → FormsTable-DAIj40w1.js} +1 -1
- package/dist/{Observations-CSOLAUYk.js → Observations-E6bLitO9.js} +1 -1
- package/dist/{index-BWaIKbxC.js → index-w0UB3Kd0.js} +21898 -21668
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -36
- package/dist/registry/widgetMap.d.ts.map +1 -1
- package/dist/visits/VisitsTable.d.ts +10 -0
- package/dist/visits/VisitsTable.d.ts.map +1 -0
- package/dist/visits/__tests__/__mocks__/visitMocks.d.ts +12 -0
- package/dist/visits/__tests__/__mocks__/visitMocks.d.ts.map +1 -0
- package/dist/visits/constants.d.ts +21 -0
- package/dist/visits/constants.d.ts.map +1 -0
- package/dist/visits/index.d.ts +2 -0
- package/dist/visits/index.d.ts.map +1 -0
- package/dist/visits/model.d.ts +12 -0
- package/dist/visits/model.d.ts.map +1 -0
- package/dist/visits/utils.d.ts +56 -0
- package/dist/visits/utils.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Encounter } from 'fhir/r4';
|
|
2
|
+
import { VisitViewModel } from '../../model';
|
|
3
|
+
export declare const mockActiveIpdEncounter: Encounter;
|
|
4
|
+
export declare const mockMultiDayIpdEncounter: Encounter;
|
|
5
|
+
export declare const mockOneDayOpdEncounter: Encounter;
|
|
6
|
+
export declare const mockEncounters: Encounter[];
|
|
7
|
+
export declare const mockActiveVisitChildEncounter: Encounter;
|
|
8
|
+
export declare const mockLaterActiveVisitChildEncounter: Encounter;
|
|
9
|
+
export declare const mockChildEncounters: Encounter[];
|
|
10
|
+
export declare const mockAllPatientEncounters: Encounter[];
|
|
11
|
+
export declare const mockVisitViewModel: VisitViewModel;
|
|
12
|
+
//# sourceMappingURL=visitMocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visitMocks.d.ts","sourceRoot":"","sources":["../../../../src/visits/__tests__/__mocks__/visitMocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsF7C,eAAO,MAAM,sBAAsB,WAKjC,CAAC;AAGH,eAAO,MAAM,wBAAwB,WAKnC,CAAC;AAGH,eAAO,MAAM,sBAAsB,WAKjC,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,SAAS,EAIrC,CAAC;AAQF,eAAO,MAAM,6BAA6B,WAKxC,CAAC;AAEH,eAAO,MAAM,kCAAkC,WAK7C,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,SAAS,EAS1C,CAAC;AAGF,eAAO,MAAM,wBAAwB,EAAE,SAAS,EAG/C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAOhC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Default number of most-recent visits shown when config.maximumNoOfVisits is unset (AC 7). */
|
|
2
|
+
export declare const DEFAULT_MAXIMUM_NO_OF_VISITS = 4;
|
|
3
|
+
/** Default visit-type display names treated as IPD when config.ipdVisitTypes is unset. */
|
|
4
|
+
export declare const DEFAULT_IPD_VISIT_TYPES: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Translation key for each configurable column. A field name absent from this
|
|
7
|
+
* map is passed to `t()` as-is, so a typo in config surfaces as a column
|
|
8
|
+
* headed by the raw key rather than being silently dropped.
|
|
9
|
+
*/
|
|
10
|
+
export declare const VISIT_FIELD_TRANSLATION_MAP: Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Columns shown when `config.fields` is unset — matches the design. `location`
|
|
13
|
+
* is deliberately excluded so it stays opt-in.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_VISIT_FIELDS: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Columns that are always rendered. `config.fields` may reorder them, but any
|
|
18
|
+
* it leaves out are prepended so a deployment cannot remove them.
|
|
19
|
+
*/
|
|
20
|
+
export declare const MANDATORY_VISIT_FIELDS: string[];
|
|
21
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/visits/constants.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK9D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAuC,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,sBAAsB,UAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visits/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flat view model derived from a FHIR visit Encounter, used by VisitsTable.
|
|
3
|
+
*/
|
|
4
|
+
export interface VisitViewModel {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly startDate: string;
|
|
7
|
+
readonly endDate: string | null;
|
|
8
|
+
readonly isActive: boolean;
|
|
9
|
+
readonly visitType: string;
|
|
10
|
+
readonly location: string | null;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/visits/model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Encounter } from 'fhir/r4';
|
|
2
|
+
import { VisitViewModel } from './model';
|
|
3
|
+
/**
|
|
4
|
+
* Maps each visit UUID to the login location the visit was created at.
|
|
5
|
+
*
|
|
6
|
+
* A visit's own `location` is the OpenMRS **Visit Location** (the facility, e.g.
|
|
7
|
+
* "Bahmni Hospital") — never the location chosen at login. The login location is
|
|
8
|
+
* carried by the visit's **child encounters**, which reference their parent via
|
|
9
|
+
* `partOf` (`Encounter/<visitUuid>`). So the per-visit login location has to be
|
|
10
|
+
* derived from those children rather than read off the visit.
|
|
11
|
+
*
|
|
12
|
+
* A visit can span several locations (e.g. registered in one ward, transferred
|
|
13
|
+
* to another), so the child encounter with the earliest `period.start` — the one
|
|
14
|
+
* recorded when the visit was started — is used. Encounters without a location
|
|
15
|
+
* are skipped. Input order is irrelevant: `getPatientEncounters()` sorts by
|
|
16
|
+
* `-_lastUpdated`, which changes whenever an old encounter is edited.
|
|
17
|
+
*
|
|
18
|
+
* @param encounters - All encounters for the patient (visits and their children)
|
|
19
|
+
* @returns Map of visit UUID to login location display name
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildVisitLocationMap(encounters: Encounter[]): Map<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Maps FHIR visit Encounters to a flat view model, sorted by `period.start`
|
|
24
|
+
* descending (most recent first) and capped to `maximumNoOfVisits`.
|
|
25
|
+
*
|
|
26
|
+
* `getVisits()` queries the FHIR server with `_sort=-_lastUpdated`, which is
|
|
27
|
+
* not the same as "most recent visits" (AC 6/7), so the ordering below must
|
|
28
|
+
* be applied client-side rather than relied upon from the server response.
|
|
29
|
+
*
|
|
30
|
+
* `location` is resolved from `locationByVisitId` (see `buildVisitLocationMap`)
|
|
31
|
+
* and is deliberately left null when the visit has no child encounter yet — the
|
|
32
|
+
* visit's own location would be the facility, not the login location, so falling
|
|
33
|
+
* back to it would reintroduce the wrong value.
|
|
34
|
+
*/
|
|
35
|
+
export declare function toVisitViewModels(encounters: Encounter[], maximumNoOfVisits?: number, locationByVisitId?: Map<string, string>): VisitViewModel[];
|
|
36
|
+
/**
|
|
37
|
+
* Formats a visit's date/time for display:
|
|
38
|
+
* - Active visits (no end date): start date + time (per design, the active
|
|
39
|
+
* visit is the only row that shows a time).
|
|
40
|
+
* - Completed, same-day visits: start date only (AC 3).
|
|
41
|
+
* - Completed, multi-day visits: "<start> to <end>" via the translatable
|
|
42
|
+
* VISIT_DATE_RANGE key (AC 4).
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatVisitDateRange(visit: VisitViewModel, t: (key: string, options?: Record<string, unknown>) => string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Translates a visit-type display name using the VISIT_TYPE_<SCREAMING_SNAKE>
|
|
47
|
+
* convention, falling back to the raw OpenMRS display name (AC 12).
|
|
48
|
+
*/
|
|
49
|
+
export declare function translateVisitType(visitType: string, t: (key: string, options?: Record<string, unknown>) => string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Whether a visit counts as an IPD visit for the purpose of showing the
|
|
52
|
+
* "View IPD Dashboard" link (AC 9/10), matched case-insensitively against
|
|
53
|
+
* config.ipdVisitTypes.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isIpdVisit(visitType: string, ipdVisitTypes: string[]): boolean;
|
|
56
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/visits/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,EAAE,GACtB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,EAAE,EACvB,iBAAiB,GAAE,MAAqC,EACxD,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,cAAc,EAAE,CAmBlB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,cAAc,EACrB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAC5D,MAAM,CAYR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,GAC5D,MAAM,CAKR;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAIT"}
|