- clearCurrentUser
- createAttachment
- deleteAttachmentPermanently
- fetchCurrentPatient
- getAttachmentByUuid
- getAttachments
- getCurrentUser
- getLocations
- getLoggedInUser
- getSessionLocation
- getSessionStore
- getVisitStore
- getVisitTypes
- getVisitsForPatient
- makeUrl
- openmrsFetch
- openmrsObservableFetch
- refetchCurrentUser
- saveVisit
- setCurrentVisit
- setSessionLocation
- setUserLanguage
- setUserProperties
- toLocationObject
- toVisitTypeObject
- updateVisit
- useAttachments
- useEmrConfiguration
- useLocations
- usePatient
- usePrimaryIdentifierCode
- useSession
- useVisit
- useVisitTypes
- userHasAccess
- OpenmrsAppContext
- getContext
- registerContext
- subscribeToContext
- unregisterContext
- updateContext
- useAppContext
- useDefineAppContext
- convertToLocaleCalendar
- formatDate
- formatDatetime
- formatTime
- getDefaultCalendar
- isOmrsDateStrict
- isOmrsDateToday
- parseDate
- registerDefaultCalendar
- toDateObjectStrict
- toOmrsIsoString
- ExtensionSlot
- attach
- detach
- detachAll
- getAssignedExtensions
- getExtensionNameFromId
- getExtensionStore
- renderExtension
- useAssignedExtensionIds
- useAssignedExtensions
- useConnectedExtensions
- useExtensionSlotMeta
- useExtensionSlotStore
- useExtensionStore
- useRenderableExtensions
- beginEditSynchronizationItem
- canBeginEditSynchronizationItemsOfType
- deleteSynchronizationItem
- generateOfflineUuid
- getCurrentOfflineMode
- getDynamicOfflineDataEntries
- getDynamicOfflineDataEntriesFor
- getDynamicOfflineDataHandlers
- getFullSynchronizationItems
- getFullSynchronizationItemsFor
- getOfflinePatientDataStore
- getSynchronizationItem
- getSynchronizationItems
- isOfflineUuid
- messageOmrsServiceWorker
- putDynamicOfflineData
- putDynamicOfflineDataFor
- queueSynchronizationItem
- registerOfflinePatientHandler
- removeDynamicOfflineData
- removeDynamicOfflineDataFor
- setupDynamicOfflineDataHandler
- setupOfflineSync
- subscribeConnectivity
- subscribeConnectivityChanged
- subscribePrecacheStaticDependencies
- syncAllDynamicOfflineData
- syncDynamicOfflineData
- syncOfflinePatientData
- useConnectivity
- WorkspaceContainer
- compile
- evaluate
- evaluateAsBoolean
- evaluateAsBooleanAsync
- evaluateAsNumber
- evaluateAsNumberAsync
- evaluateAsType
- evaluateAsTypeAsync
- evaluateAsync
- extractVariableNames
- getLocale
- isOnline
- useFhirFetchAll
- useFhirInfinite
- CustomOverflowMenu
- PatientBannerActionsMenu
- PatientBannerContactDetails
- PatientBannerPatientIdentifiers
- PatientBannerPatientInfo
- PatientBannerToggleContactDetailsButton
- PatientPhoto
- getFhirServerPaginationHandlers
- isDesktop
- setLeftNav
- showActionableNotification
- showModal
- showNotification
- showSnackbar
- showToast
- subscribeActionableNotificationShown
- subscribeNotificationShown
- subscribeSnackbarShown
- subscribeToastShown
- unsetLeftNav
- useBodyScrollLock
- useFhirPagination
- useLayoutType
- useLeftNavStore
- useOnClickOutside
- useOpenmrsFetchAll
- useOpenmrsInfinite
- useOpenmrsPagination
- usePagination
- usePatientPhoto
- age
- canAccessStorage
- displayName
- formatPatientName
- formattedName
- getDefaultsFromConfigSchema
- getPatientName
- isVersionSatisfied
- retry
- selectPreferredName
- shallowEqual
- useAbortController
- useDebounce
- useOpenmrsSWR
Ƭ CurrentPatient: fhir.Patient
| FetchResponse
<fhir.Patient
>
packages/framework/esm-api/src/shared-api-objects/current-patient.ts:6
Ƭ LoadedSessionStore: Object
Name | Type |
---|---|
loaded |
true |
session |
Session |
packages/framework/esm-api/src/shared-api-objects/current-user.ts:11
Ƭ NullablePatient: fhir.Patient
| null
packages/framework/esm-react-utils/src/usePatient.ts:6
Ƭ PatientUuid: string
| null
packages/framework/esm-api/src/shared-api-objects/current-patient.ts:20
Ƭ SessionStore: LoadedSessionStore
| UnloadedSessionStore
packages/framework/esm-api/src/shared-api-objects/current-user.ts:9
Ƭ UnloadedSessionStore: Object
Name | Type |
---|---|
loaded |
false |
session |
null |
packages/framework/esm-api/src/shared-api-objects/current-user.ts:16
Ƭ ContextCallback<T
>: (state
: Readonly
<T
> | null
| undefined
) => void
Name | Type |
---|---|
T |
extends Object = {} |
▸ (state
): void
Name | Type |
---|---|
state |
Readonly <T > | null | undefined |
void
packages/framework/esm-context/src/context.ts:89
Ƭ DateInput: string
| number
| Date
packages/framework/esm-utils/src/dates/date-util.ts:27
Ƭ FormatDateMode: "standard"
| "wide"
packages/framework/esm-utils/src/dates/date-util.ts:101
Ƭ FormatDateOptions: Object
Name | Type | Description |
---|---|---|
calendar? |
string |
The calendar to use when formatting this date. |
day |
boolean |
Whether to include the day number |
locale? |
string |
The locale to use when formatting this date |
mode |
FormatDateMode |
- standard : "03 Feb 2022" - wide : "03 — Feb — 2022" |
month |
boolean |
Whether to include the month number |
noToday |
boolean |
Disables the special handling of dates that are today. If false (the default), then dates that are today will be formatted as "Today" in the locale language. If true, then dates that are today will be formatted the same as all other dates. |
numberingSystem? |
string |
The unicode numbering system to use |
time |
boolean | "for today" |
Whether the time should be included in the output always (true ), never (false ), or only when the input date is today (for today ). |
year |
boolean |
Whether to include the year |
packages/framework/esm-utils/src/dates/date-util.ts:103
Ƭ ExtensionProps: React.HTMLAttributes
<HTMLDivElement
> & { state?
: Record
<string
, unknown
> }
packages/framework/esm-react-utils/src/Extension.tsx:7
Ƭ ExtensionSlotProps: OldExtensionSlotBaseProps
| ExtensionSlotBaseProps
& Omit
<React.HTMLAttributes
<HTMLDivElement
>, "children"
> & { children?
: React.ReactNode
| (extension
: AssignedExtension
, state?
: Record
<string
, unknown
>) => React.ReactNode
}
packages/framework/esm-react-utils/src/ExtensionSlot.tsx:24
Ƭ TemplateParams: Object
▪ [key: string
]: string
packages/framework/esm-navigation/src/navigation/navigate.ts:10
Ƭ KnownOmrsServiceWorkerMessages: OnImportMapChangedMessage
| ClearDynamicRoutesMessage
| RegisterDynamicRouteMessage
packages/framework/esm-offline/src/service-worker-messaging.ts:41
Ƭ OfflineMode: "on"
| "off"
| "unavailable"
packages/framework/esm-offline/src/mode.ts:34
Ƭ OmrsOfflineCachingStrategy: "network-only-or-cache-only"
| "network-first"
cache-or-network
: The default strategy, equal to the absence of this header. The SW attempts to resolve the request via the network, but falls back to the cache if required. The service worker decides the strategy to be used.network-first
: See https://developers.google.com/web/tools/workbox/modules/workbox-strategies#network_first_network_falling_back_to_cache.
packages/framework/esm-offline/src/service-worker-http-headers.ts:15
Ƭ OmrsOfflineHttpHeaderNames: keyof OmrsOfflineHttpHeaders
packages/framework/esm-offline/src/service-worker-http-headers.ts:40
Ƭ OmrsOfflineHttpHeaders: Object
Defines the keys of the custom headers which can be appended to an HTTP request. HTTP requests with these headers are handled in a special way by the SPA's service worker.
Name | Type | Description |
---|---|---|
x-omrs-offline-caching-strategy? |
OmrsOfflineCachingStrategy |
Instructs the service worker to use a specific caching strategy for this request. |
x-omrs-offline-response-body? |
string |
If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the body in this header. |
x-omrs-offline-response-status? |
`${number}` | If the client is offline and the request cannot be read from the cache (i.e. if there is no way to receive any kind of data for this request), the service worker will return a response with the status code defined in this header. |
packages/framework/esm-offline/src/service-worker-http-headers.ts:21
Ƭ ConfigValue: string
| number
| boolean
| void
| any
[] | object
packages/framework/esm-config/src/types.ts:46
Ƭ DateInputValue: CalendarDate
| CalendarDateTime
| ZonedDateTime
| DayjsConfigType
A type for any of the acceptable date formats
packages/framework/esm-styleguide/src/datepicker/index.tsx:93
Ƭ DefaultEvaluateReturnType: string
| number
| boolean
| Date
| null
| undefined
The valid return types for evaluate()
and evaluateAsync()
packages/framework/esm-expression-evaluator/src/evaluator.ts:31
Ƭ ExtensionDefinition: { featureFlag?
: string
; meta?
: { [k: string]
: unknown
; } ; name
: string
; offline?
: boolean
; online?
: boolean
; order?
: number
; privileges?
: string
| string
[] ; slot?
: string
; slots?
: string
[] } & { component
: string
} | { component?
: never
}
A definition of an extension as extracted from an app's routes.json
packages/framework/esm-globals/src/types.ts:182
Ƭ IconProps: Object
Name | Type |
---|---|
className? |
Argument |
fill? |
string |
size? |
number |
packages/framework/esm-styleguide/src/icons/icons.tsx:7
Ƭ ModalDefinition: { name
: string
} & { component
: string
} | { component?
: never
}
A definition of a modal as extracted from an app's routes.json
packages/framework/esm-globals/src/types.ts:247
Ƭ NameUse: "usual"
| "official"
| "temp"
| "nickname"
| "anonymous"
| "old"
| "maiden"
packages/framework/esm-globals/src/types.ts:422
Ƭ OpenmrsRoutes: Record
<string
, OpenmrsAppRoutes
>
This interfaces describes the format of the overall rotues.json loaded by the app shell. Basically, this is the same as the app routes, with each routes definition keyed by the app's name
packages/framework/esm-globals/src/types.ts:413
Ƭ PageDefinition: { component
: string
; featureFlag?
: string
; offline?
: boolean
; online?
: boolean
; order?
: number
} & { route
: string
| boolean
; routeRegex?
: never
} | { route?
: never
; routeRegex
: string
}
A definition of a page extracted from an app's routes.json
packages/framework/esm-globals/src/types.ts:121
Ƭ PictogramProps: Object
Name | Type |
---|---|
className? |
Argument |
size? |
number |
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:7
Ƭ ProvidedConfig: Object
Name | Type |
---|---|
config |
Config |
source |
string |
packages/framework/esm-config/src/types.ts:68
Ƭ SpaEnvironment: "production"
| "development"
| "test"
packages/framework/esm-globals/src/types.ts:76
Ƭ SvgIconProps: Object
Name | Type |
---|---|
icon |
string |
iconProps |
IconProps |
packages/framework/esm-styleguide/src/icons/icons.tsx:795
Ƭ SvgPictogramProps: Object
Name | Type | Description |
---|---|---|
pictogram |
string |
the id of the pictogram |
pictogramProps |
PictogramProps |
properties when using the pictogram |
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:102
Ƭ UpdateVisitPayload: Partial
<NewVisitPayload
> & {}
packages/framework/esm-api/src/types/visit-resource.ts:18
Ƭ Validator: (value
: any
) => void
| string
▸ (value
): void
| string
Name | Type |
---|---|
value |
any |
void
| string
packages/framework/esm-config/src/types.ts:75
Ƭ ValidatorFunction: (value
: any
) => boolean
▸ (value
): boolean
Name | Type |
---|---|
value |
any |
boolean
packages/framework/esm-config/src/types.ts:73
Ƭ VariablesMap: Object
An object containing the variable to use when evaluating this expression
▪ [key: string
]: string
| number
| boolean
| Function
| RegExp
| object
| null
| VariablesMap
| VariablesMap
[]
packages/framework/esm-expression-evaluator/src/evaluator.ts:26
Ƭ WorkspaceDefinition: { canHide?
: boolean
; canMaximize?
: boolean
; groups
: string
[] ; name
: string
; preferredWindowSize?
: WorkspaceWindowState
; title
: string
; type
: string
; width?
: "narrow"
| "wider"
| "extra-wide"
} & { component
: string
} | { component?
: never
}
A definition of a workspace as extracted from an app's routes.json
packages/framework/esm-globals/src/types.ts:281
Ƭ WorkspaceWindowState: "maximized"
| "hidden"
| "normal"
packages/framework/esm-globals/src/types.ts:276
Ƭ ActionFunction<T
>: (state
: T
, ...args
: any
[]) => Partial
<T
>
Name |
---|
T |
▸ (state
, ...args
): Partial
<T
>
Name | Type |
---|---|
state |
T |
...args |
any [] |
Partial
<T
>
packages/framework/esm-react-utils/src/useStore.ts:6
Ƭ Actions<T
>: (store
: StoreApi
<T
>) => Record
<string
, ActionFunction
<T
>> | Record
<string
, ActionFunction
<T
>>
Name |
---|
T |
packages/framework/esm-react-utils/src/useStore.ts:7
Ƭ BoundActions: Object
▪ [key: string
]: (...args
: any
[]) => void
packages/framework/esm-react-utils/src/useStore.ts:10
Ƭ CoreTranslationKey: keyof typeof coreTranslations
packages/framework/esm-translations/src/index.ts:53
Ƭ ActionableNotificationType: "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt"
packages/framework/esm-styleguide/src/notifications/actionable-notification.component.tsx:24
Ƭ InlineNotificationType: "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt"
packages/framework/esm-styleguide/src/notifications/notification.component.tsx:22
Ƭ LayoutType: "phone"
| "tablet"
| "small-desktop"
| "large-desktop"
packages/framework/esm-react-utils/src/useLayoutType.ts:4
Ƭ PageHeaderProps: XOR
<PageHeaderWrapperProps
, PageHeaderContentProps
>
packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:30
Ƭ SnackbarType: "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt"
packages/framework/esm-styleguide/src/snackbars/snackbar.component.tsx:29
Ƭ ToastType: "error"
| "info"
| "info-square"
| "success"
| "warning"
| "warning-alt"
packages/framework/esm-styleguide/src/toasts/toast.component.tsx:23
Ƭ ArgumentsTuple: [any
, ...unknown[]]
packages/framework/esm-react-utils/src/useOpenmrsSWR.ts:8
Ƭ Key: string
| ArgumentsTuple
| undefined
| null
packages/framework/esm-react-utils/src/useOpenmrsSWR.ts:9
Ƭ UseOpenmrsSWROptions: Object
Name | Type |
---|---|
abortController? |
AbortController |
fetchInit? |
FetchConfig |
swrConfig? |
SWRConfiguration |
url? |
string | (key : Key ) => string |
packages/framework/esm-react-utils/src/useOpenmrsSWR.ts:10
• Const
UserHasAccess: React.FC
<UserHasAccessProps
>
A React component that renders its children only if the current user exists and has the privilege(s)
specified by the privilege
prop. This can be used not to render certain components when the user
doesn't have the permission to use this.
Note that for top-level extensions (i.e., the component that's the root of the extension), you don't need to use this component. Instead, when registering the extension, declare the required privileges as part of the extension registration. This is for use deeper in extensions or other components where a separate permission check might be needed.
This can also be used to hide components when the current user is not logged in.
example
<Form>
<UserHasAccess privilege='Form Finallizer'>
<Checkbox id="finalize-form" value={formFinalized} onChange={handleChange} />
</UserHasAccess>
</Form>
param
Either a string for a single required privilege or an array of strings for a
set of required privileges. Note that sets of required privileges must all be matched.
param
What to render if the user does not have access or if the user is not currently
logged in. If not provided, nothing will be rendered
param
The children to be rendered only if the user is logged in and has the required
privileges.
packages/framework/esm-react-utils/src/UserHasAccess.tsx:40
• Const
attachmentUrl: string
packages/framework/esm-api/src/attachments.ts:5
• Const
defaultVisitCustomRepresentation: string
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:30
• Const
fhirBaseUrl: "/ws/fhir2/R4"
packages/framework/esm-api/src/openmrs-fetch.ts:10
• Const
getStartedVisit: BehaviorSubject
<null
| VisitItem
>
deprecated
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:113
• Const
restBaseUrl: "/ws/rest/v1"
packages/framework/esm-api/src/openmrs-fetch.ts:9
• Const
sessionEndpoint: string
packages/framework/esm-api/src/openmrs-fetch.ts:11
• Const
validators: Object
Name | Type |
---|---|
inRange |
(min : number , max : number ) => Validator |
isUrl |
Validator |
isUrlWithTemplateParameters |
(allowedTemplateParameters : string [] | readonly string []) => Validator |
oneOf |
(allowedValues : any [] | readonly any []) => Validator |
packages/framework/esm-config/src/validators/validators.ts:65
• Const
Extension: React.FC
<ExtensionProps
>
Represents the position in the DOM where each extension within an extension slot is rendered.
Renders once for each extension attached to that extension slot.
Usage of this component must have an ancestor <ExtensionSlot>
,
and must only be used once within that <ExtensionSlot>
.
packages/framework/esm-react-utils/src/Extension.tsx:20
• Const
offlineUuidPrefix: "OFFLINE+"
packages/framework/esm-offline/src/uuid.ts:4
• Const
omrsOfflineCachingStrategyHttpHeaderName: "x-omrs-offline-caching-strategy"
packages/framework/esm-offline/src/service-worker-http-headers.ts:5
• Const
omrsOfflineResponseBodyHttpHeaderName: "x-omrs-offline-response-body"
packages/framework/esm-offline/src/service-worker-http-headers.ts:3
• Const
omrsOfflineResponseStatusHttpHeaderName: "x-omrs-offline-response-status"
packages/framework/esm-offline/src/service-worker-http-headers.ts:4
• Const
ActivityIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:15
• Const
AddIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:23
• Const
AllergiesIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>> = WarningIcon
packages/framework/esm-styleguide/src/icons/icons.tsx:727
• Const
AppointmentsPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:12
• Const
ArrowDownIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:31
• Const
ArrowLeftIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:39
• Const
ArrowRightIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:47
• Const
ArrowUpIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:55
• Const
AttachmentIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>> = DocumentAttachmentIcon
packages/framework/esm-styleguide/src/icons/icons.tsx:732
• Const
BabyIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:63
• Const
CalendarHeatMapIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:71
• Const
CalendarIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:79
• Const
CaretDownIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:87
• Const
CaretLeftIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:95
• Const
CaretRightIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:103
• Const
CaretUpIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:111
• Const
ChartAverageIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:135
• Const
CheckmarkFilledIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:119
• Const
CheckmarkOutlineIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:127
• Const
ChemistryIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:143
• Const
ChevronDownIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:151
• Const
ChevronLeftIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:159
• Const
ChevronRightIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:167
• Const
ChevronUpIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:175
• Const
CloseFilledIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:183
• Const
CloseIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:199
• Const
CloseOutlineIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:191
• Const
ConditionsIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>> = ListCheckedIcon
Conditions
Note this is an alias for ListCheckedIcon
packages/framework/esm-styleguide/src/icons/icons.tsx:739
• Const
DiagnosisTags: React.FC
<DiagnosisTagsProps
>
This component takes a list of diagnoses and displays them as Carbon tags, with colors configured base on whether the diagnoses are primary or secondary.
packages/framework/esm-styleguide/src/diagnosis-tags/diagnosis-tags.component.tsx:16
• Const
DocumentAttachmentIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:207
• Const
DocumentIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:215
• Const
DownloadIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:223
• Const
DrugOrderIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:231
• Const
EditIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:239
• Const
ErrorState: React.FC
<ErrorStateProps
>
packages/framework/esm-styleguide/src/error-state/error-state.component.tsx:12
• Const
EventScheduleIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:247
• Const
EventsIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:255
• Const
GenderFemaleIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:263
• Const
GenderMaleIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:270
• Const
GenderOtherIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:277
• Const
GenderUnknownIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:284
• Const
GenericOrderTypeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:292
• Const
GroupAccessIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:308
• Const
GroupIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:300
• Const
HomePictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:18
• Const
HospitalBedIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:316
• Const
Icon: MemoExoticComponent
<ForwardRefExoticComponent
<SvgIconProps
& RefAttributes
<SVGSVGElement
>>>
This is a utility type for custom icons that use the svg-sprite-loader to bundle custom icons
packages/framework/esm-styleguide/src/icons/icons.tsx:803
• Const
ImageMedicalIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:324
• Const
InPatientPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:24
• Const
InformationFilledIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:348
• Const
InformationIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:340
• Const
InformationSquareIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:356
• Const
InventoryManagementIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:332
• Const
LabOrderIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:364
• Const
LaboratoryPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:30
• Const
ListCheckedIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:372
• Const
LocationIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:380
• Const
LocationPicker: React.FC
<LocationPickerProps
>
packages/framework/esm-styleguide/src/location-picker/location-picker.component.tsx:15
• Const
MaterialOrderIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:388
• Const
MaximizeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:396
• Const
MaybeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<{ fallback?
: ReactNode
; icon
: string
} & IconProps
& RefAttributes
<SVGSVGElement
>>>
This is a utility component that takes an icon
and renders it if the sprite for the icon
is available. The goal is to make it easier to conditionally render configuration-specified icons.
example
<MaybeIcon icon='omrs-icon-baby' className={styles.myIconStyles} />
packages/framework/esm-styleguide/src/icons/icons.tsx:762
• Const
MaybePictogram: MemoExoticComponent
<ForwardRefExoticComponent
<{ fallback?
: ReactNode
; pictogram
: string
} & PictogramProps
& RefAttributes
<SVGSVGElement
>>>
This is a utility component that takes an pictogram
and render it if the sprite for the pictogram
is available. The goal is to make it easier to conditionally render configuration-specified pictograms.
example
<MaybePictogram pictogram='omrs-icon-baby' className={styles.myPictogramStyles} />
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:69
• Const
MedicationIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:404
• Const
MessageQueueIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:412
• Const
MicroscopeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:420
• Const
MoneyIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Billing
packages/framework/esm-styleguide/src/icons/icons.tsx:429
• Const
MotherIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:437
• Const
MovementIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:445
• Const
OpenmrsDatePicker: ForwardRefExoticComponent
<OpenmrsDatePickerProps
& RefAttributes
<HTMLDivElement
>>
A date picker component to select a single date. Based on React Aria, but styled to look like Carbon.
packages/framework/esm-styleguide/src/datepicker/index.tsx:598
• Const
OverflowMenuHorizontalIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:453
• Const
OverflowMenuVerticalIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:461
• Const
PasswordIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:684
• Const
PatientListsPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:36
• Const
PedestrianFamilyIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:469
• Const
PenIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:477
• Const
PharmacyPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:42
• Const
Pictogram: MemoExoticComponent
<ForwardRefExoticComponent
<SvgPictogramProps
& RefAttributes
<SVGSVGElement
>>>
This is a utility type for custom pictograms. Please maintain alphabetical order when adding new pictograms for readability.
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:112
• Const
PrinterIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:485
• Const
ProcedureOrderIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:493
• Const
ProgramsIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:501
• Const
RadiologyIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>> = ImageMedicalIcon
packages/framework/esm-styleguide/src/icons/icons.tsx:744
• Const
ReferralOrderIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:509
• Const
RegistrationPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:48
• Const
RenderIfValueIsTruthy: React.FC
<PropsWithChildren
<{ fallback?
: React.ReactNode
; value
: unknown
}>>
A really simple component that renders its children if the prop named value
has a truthy value
example
<RenderIfValueIsTruthy value={variable}>
<Component value={variable} />
</RenderIfValueIsTruthy>
param
The value to check whether or not its truthy
param
What to render if the value is not truthy. If not specified, nothing will be rendered
param
The components to render if the value
is truthy
packages/framework/esm-react-utils/src/RenderIfValueIsTruthy.tsx:17
• Const
RenewIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:517
• Const
ReportIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:525
• Const
ResetIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:533
• Const
SaveIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:549
• Const
SearchIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:557
• Const
ServiceQueuesPictogram: MemoExoticComponent
<ForwardRefExoticComponent
<PictogramProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/pictograms/pictograms.tsx:54
• Const
ShoppingCartAddItemIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>> = ShoppingCartArrowDownIcon
Used as a button to add an item to the Order basket from a search
Note this is an alias for ShoppingCartArrowDownIcon
packages/framework/esm-styleguide/src/icons/icons.tsx:751
• Const
ShoppingCartArrowDownIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Used as a button to add an item to the Order basket from a search
packages/framework/esm-styleguide/src/icons/icons.tsx:583
• Const
ShoppingCartIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Order Basket, the UI to enter Orders for Medications, Referrals, Labs, Procedures and more
packages/framework/esm-styleguide/src/icons/icons.tsx:574
• Const
StickyNoteAddIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Used as action button to open ward in-patient note workspace
packages/framework/esm-styleguide/src/icons/icons.tsx:592
• Const
SwitcherIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:565
• Const
SyringeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:600
• Const
TableIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:617
• Const
TableOfContentsIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Used as a button to add an item to the Order basket from a search
packages/framework/esm-styleguide/src/icons/icons.tsx:609
• Const
TimeIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
Lab investigations
packages/framework/esm-styleguide/src/icons/icons.tsx:626
• Const
ToolsIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:634
• Const
TranslateIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:541
• Const
TrashCanIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:642
• Const
TreeViewAltIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:650
• Const
UserAvatarIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
User of OpenMRS e.g. My Account
packages/framework/esm-styleguide/src/icons/icons.tsx:659
• Const
UserFollowIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:667
• Const
UserIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:692
• Const
UserXrayIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
UserXray Icon
UserXrayIcon
is also used for imaging orders
packages/framework/esm-styleguide/src/icons/icons.tsx:678
• Const
ViewIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:708
• Const
ViewOffIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:700
• Const
WarningIcon: MemoExoticComponent
<ForwardRefExoticComponent
<IconProps
& RefAttributes
<SVGSVGElement
>>>
packages/framework/esm-styleguide/src/icons/icons.tsx:716
• Const
backendDependencies: Object
Name | Type |
---|---|
fhir2 |
string |
webservices.rest |
string |
packages/framework/esm-api/src/openmrs-backend-dependencies.ts:1
• Const
LeftNavMenu: ForwardRefExoticComponent
<SideNavProps
& RefAttributes
<HTMLElement
>>
This component renders the left nav in desktop mode. It's also used to render the same nav when the hamburger menu is clicked on in tablet mode. See side-menu-panel.component.tsx
Use of this component by anything other than (where isChildOfHeader == false) is deprecated; it simply renders nothing.
packages/framework/esm-styleguide/src/left-nav/index.tsx:53
• Const
PageHeader: React.FC
<PageHeaderProps
>
The page header is typically located at the top of a dashboard. It includes a pictogram on the left,
the name of the dashboard or page, and the implementationName
from the configuration, which is typically
the name of the clinic or the authority that is using the implementation. It can also include interactive
content on the right-hand side. It can be used in two ways:
- Alone, in order to render just the page header, with no content on the right side:
example
<PageHeader title="My Dashboard" illustration={<Illustration />} />
- Wrapped around the PageHeaderContent component, in order to render the page header on the left and some other content on the right side:
example
<PageHeader>
<PageHeaderContent title="My Dashboard" illustration={<Illustration />} />
<Button>Click me</Button>
</PageHeader>
packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:58
• Const
PageHeaderContent: React.FC
<PageHeaderContentProps
>
The PageHeaderContent component should be used inside the PageHeader component. It is used if the page header should include some content on the right side, in addition to the pictogram and the name of the page. If only the page header is needed, without any additional content, the PageHeader component can be used on its own, and the PageHeaderContent component is not needed.
example
<PageHeader>
<PageHeaderContent title="My Dashboard" illustration={<Illustration />} />
<Button>Click me</Button>
</PageHeader>
packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:90
• Const
ResponsiveWrapper: React.FC
<ResponsiveWrapperProps
>
ResponsiveWrapper enables a responsive behavior for the component its wraps, providing a different rendering based on the current layout type. On desktop, it renders the children as is, while on a tablet, it wraps them in a Carbon Layer https://react.carbondesignsystem.com/?path=/docs/components-layer--overview component. This provides a light background for form inputs on tablets, in accordance with the design requirements.
packages/framework/esm-styleguide/src/responsive-wrapper/responsive-wrapper.component.tsx:15
• Const
ActionMenuButton: React.FC
<ActionMenuButtonProps
>
▸ clearCurrentUser(): void
void
packages/framework/esm-api/src/shared-api-objects/current-user.ts:177
▸ createAttachment(patientUuid
, fileToUpload
): Promise
<FetchResponse
<any
>>
Name | Type |
---|---|
patientUuid |
string |
fileToUpload |
UploadedFile |
Promise
<FetchResponse
<any
>>
packages/framework/esm-api/src/attachments.ts:19
▸ deleteAttachmentPermanently(attachmentUuid
, abortController
): Promise
<FetchResponse
<any
>>
Name | Type |
---|---|
attachmentUuid |
string |
abortController |
AbortController |
Promise
<FetchResponse
<any
>>
packages/framework/esm-api/src/attachments.ts:38
▸ fetchCurrentPatient(patientUuid
, fetchInit?
, includeOfflinePatients?
): Promise
<fhir.Patient
| null
>
Name | Type | Default value |
---|---|---|
patientUuid |
PatientUuid |
undefined |
fetchInit? |
FetchConfig |
undefined |
includeOfflinePatients |
boolean |
true |
Promise
<fhir.Patient
| null
>
packages/framework/esm-api/src/shared-api-objects/current-patient.ts:22
▸ getAttachmentByUuid(attachmentUuid
, abortController
): Promise
<FetchResponse
<any
>>
Name | Type |
---|---|
attachmentUuid |
string |
abortController |
AbortController |
Promise
<FetchResponse
<any
>>
packages/framework/esm-api/src/attachments.ts:7
▸ getAttachments(patientUuid
, includeEncounterless
, abortController
): Promise
<FetchResponse
<any
>>
Name | Type |
---|---|
patientUuid |
string |
includeEncounterless |
boolean |
abortController |
AbortController |
Promise
<FetchResponse
<any
>>
packages/framework/esm-api/src/attachments.ts:13
▸ getCurrentUser(): Observable
<Session
>
The getCurrentUser function returns an observable that produces zero or more values, over time. It will produce zero values by default if the user is not logged in. And it will provide a first value when the logged in user is fetched from the server. Subsequent values will be produced whenever the user object is updated.
Observable
<Session
>
An Observable that produces zero or more values (as
described above). The values produced will be a user object (if
includeAuthStatus
is set to false
) or an object with a session
and authenticated property (if includeAuthStatus
is set to true
).
import { getCurrentUser } from '@openmrs/esm-api'
const subscription = getCurrentUser().subscribe(
user => console.log(user)
)
subscription.unsubscribe()
getCurrentUser({includeAuthStatus: true}).subscribe(
data => console.log(data.authenticated)
)
Otherwise your code will continue getting updates to the user object even after the UI component is gone from the screen. This is a memory leak and source of bugs.
packages/framework/esm-api/src/shared-api-objects/current-user.ts:66
▸ getCurrentUser(opts
): Observable
<Session
>
Name | Type |
---|---|
opts |
Object |
opts.includeAuthStatus |
true |
Observable
<Session
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:67
▸ getCurrentUser(opts
): Observable
<LoggedInUser
>
Name | Type |
---|---|
opts |
Object |
opts.includeAuthStatus |
false |
Observable
<LoggedInUser
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:68
▸ getLocations(tagUuidOrName?
, query?
): Observable
<Location
[]>
Name | Type | Default value |
---|---|---|
tagUuidOrName |
null | string |
null |
query |
null | string |
null |
Observable
<Location
[]>
packages/framework/esm-api/src/shared-api-objects/location.ts:14
▸ getLoggedInUser(): Promise
<LoggedInUser
>
Promise
<LoggedInUser
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:201
▸ getSessionLocation(): Promise
<undefined
| SessionLocation
>
Promise
<undefined
| SessionLocation
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:219
▸ getSessionStore(): StoreApi
<SessionStore
>
StoreApi
<SessionStore
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:93
▸ getVisitStore(): StoreApi
<VisitStoreState
>
StoreApi
<VisitStoreState
>
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:47
▸ getVisitTypes(): Observable
<VisitType
[]>
Observable
<VisitType
[]>
packages/framework/esm-api/src/shared-api-objects/visit-type.ts:15
▸ getVisitsForPatient(patientUuid
, abortController
, v?
): Promise
<FetchResponse
<{ results
: Visit
[] }>>
deprecated
Use the useVisit
hook instead.
Name | Type |
---|---|
patientUuid |
string |
abortController |
AbortController |
v? |
string |
Promise
<FetchResponse
<{ results
: Visit
[] }>>
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:96
▸ makeUrl(path
): string
Append path
to the OpenMRS SPA base.
makeUrl('/foo/bar');
// => '/openmrs/foo/bar'
Name | Type |
---|---|
path |
string |
string
packages/framework/esm-api/src/openmrs-fetch.ts:23
▸ openmrsFetch<T
>(path
, fetchInit?
): Promise
<FetchResponse
<T
>>
The openmrsFetch function is a wrapper around the browser's built-in fetch function, with extra handling for OpenMRS-specific API behaviors, such as request headers, authentication, authorization, and the API urls.
Name | Type |
---|---|
T |
any |
Name | Type | Description |
---|---|---|
path |
string |
A string url to make the request to. Note that the openmrs base url (by default /openmrs ) will be automatically prepended to the URL, so there is no need to include it. |
fetchInit |
FetchConfig |
A fetch init object. Note that the body property does not need to be JSON.stringify() ed because openmrsFetch will do that for you. |
Promise
<FetchResponse
<T
>>
A Promise
that resolves with a Response object.
Note that the openmrs version of the Response object has already
downloaded the HTTP response body as json, and has an additional
data
property with the HTTP response json as a javascript object.
import { openmrsFetch } from '@openmrs/esm-api'
const abortController = new AbortController();
openmrsFetch(`${restBaseUrl}/session', {signal: abortController.signal})
.then(response => {
console.log(response.data.authenticated)
})
.catch(err => {
console.error(err.status);
})
abortController.abort();
openmrsFetch(`${restBaseUrl}/session', {
method: 'POST',
body: {
username: 'hi',
password: 'there',
}
})
To cancel a network request, use an AbortController. It is best practice to cancel your network requests when the user navigates away from a page while the request is pending request, to free up memory and network resources and to prevent race conditions.
packages/framework/esm-api/src/openmrs-fetch.ts:83
▸ openmrsObservableFetch<T
>(url
, fetchInit?
): Observable
<FetchResponse
<T
>>
The openmrsObservableFetch function is a wrapper around openmrsFetch that returns an Observable instead of a promise. It exists in case using an Observable is preferred or more convenient than a promise.
Name |
---|
T |
Name | Type | Description |
---|---|---|
url |
string |
See openmrsFetch |
fetchInit |
FetchConfig |
See openmrsFetch |
Observable
<FetchResponse
<T
>>
An Observable that produces exactly one Response object. The response object is exactly the same as for openmrsFetch.
import { openmrsObservableFetch } from '@openmrs/esm-api'
const subscription = openmrsObservableFetch(`${restBaseUrl}/session').subscribe(
response => console.log(response.data),
err => {throw err},
() => console.log('finished')
)
subscription.unsubscribe()
To cancel the network request, simply call subscription.unsubscribe();
packages/framework/esm-api/src/openmrs-fetch.ts:271
▸ refetchCurrentUser(username?
, password?
): Promise
<SessionStore
>
The refetchCurrentUser
function causes a network request to redownload
the user. All subscribers to the current user will be notified of the
new users once the new version of the user object is downloaded.
Name | Type |
---|---|
username? |
string |
password? |
string |
Promise
<SessionStore
>
The same observable as returned by getCurrentUser.
import { refetchCurrentUser } from '@openmrs/esm-api'
refetchCurrentUser()
packages/framework/esm-api/src/shared-api-objects/current-user.ts:163
▸ saveVisit(payload
, abortController
): Promise
<FetchResponse
<Visit
>>
Name | Type |
---|---|
payload |
NewVisitPayload |
abortController |
AbortController |
Promise
<FetchResponse
<Visit
>>
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:71
▸ setCurrentVisit(patientUuid
, visitUuid
): void
Name | Type |
---|---|
patientUuid |
string |
visitUuid |
string |
void
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:51
▸ setSessionLocation(locationUuid
, abortController
): Promise
<any
>
Name | Type |
---|---|
locationUuid |
string |
abortController |
AbortController |
Promise
<any
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:228
▸ setUserLanguage(data
): void
Name | Type |
---|---|
data |
Session |
void
packages/framework/esm-api/src/shared-api-objects/current-user.ts:116
▸ setUserProperties(userUuid
, userProperties
, abortController?
): Promise
<SessionStore
>
Name | Type |
---|---|
userUuid |
string |
userProperties |
Object |
abortController? |
AbortController |
Promise
<SessionStore
>
packages/framework/esm-api/src/shared-api-objects/current-user.ts:241
▸ toLocationObject(openmrsRestForm
): Location
Name | Type |
---|---|
openmrsRestForm |
any |
packages/framework/esm-api/src/shared-api-objects/location.ts:7
▸ toVisitTypeObject(openmrsRestForm
): VisitType
Name | Type |
---|---|
openmrsRestForm |
any |
packages/framework/esm-api/src/shared-api-objects/visit-type.ts:7
▸ updateVisit(uuid
, payload
, abortController
): Promise
<FetchResponse
<any
>>
Name | Type |
---|---|
uuid |
string |
payload |
Partial <NewVisitPayload > |
abortController |
AbortController |
Promise
<FetchResponse
<any
>>
packages/framework/esm-api/src/shared-api-objects/visit-utils.ts:82
▸ useAttachments(patientUuid
, includeEncounterless
): Object
Name | Type |
---|---|
patientUuid |
string |
includeEncounterless |
boolean |
Object
Name | Type |
---|---|
data |
AttachmentResponse [] |
error |
any |
isLoading |
boolean |
isValidating |
boolean |
mutate |
KeyedMutator <FetchResponse <{ results : AttachmentResponse [] }>> |
packages/framework/esm-react-utils/src/useAttachments.ts:6
▸ useEmrConfiguration(): Object
React hook for fetching and managing OpenMRS EMR configuration
Object
Object containing:
- emrConfiguration: EmrApiConfigurationResponse | undefined - The EMR configuration data
- isLoadingEmrConfiguration: boolean - Loading state indicator
- mutateEmrConfiguration: Function - SWR's mutate function for manual revalidation
- errorFetchingEmrConfiguration: Error | undefined - Error object if request fails
Name | Type |
---|---|
emrConfiguration |
undefined | EmrApiConfigurationResponse |
errorFetchingEmrConfiguration |
undefined | Error |
isLoadingEmrConfiguration |
boolean |
mutateEmrConfiguration |
KeyedMutator <FetchResponse <EmrApiConfigurationResponse >> |
packages/framework/esm-react-utils/src/useEmrConfiguration.ts:158
▸ useLocations(tagUuidOrName?
, query?
): Location
[]
Name | Type | Default value |
---|---|---|
tagUuidOrName |
null | string |
null |
query |
null | string |
null |
Location
[]
packages/framework/esm-react-utils/src/useLocations.tsx:6
▸ usePatient(patientUuid?
): Object
This React hook returns a patient object. If the patientUuid
is provided
as a parameter, then the patient for that UUID is returned. If the parameter
is not provided, the patient UUID is obtained from the current route, and
a route listener is set up to update the patient whenever the route changes.
Name | Type |
---|---|
patientUuid? |
string |
Object
Name | Type |
---|---|
error |
undefined | null | Error |
isLoading |
boolean |
patient |
undefined | NullablePatient |
patientUuid |
null | string |
packages/framework/esm-react-utils/src/usePatient.ts:19
▸ usePrimaryIdentifierCode(): Object
Object
Name | Type |
---|---|
error |
Error | undefined |
isLoading |
boolean |
primaryIdentifierCode |
string | undefined |
packages/framework/esm-react-utils/src/usePrimaryIdentifierResource.ts:13
▸ useSession(): Session
Gets the current user session information. Returns an object with
property authenticated
== false
if the user is not logged in.
Uses Suspense. This hook will always either return a Session object
or throw for Suspense. It will never return null
/undefined
.
Current user session information
packages/framework/esm-react-utils/src/useSession.ts:17
▸ useVisit(patientUuid
, representation?
): VisitReturnType
This React hook returns visit information if the patient UUID is not null. There are potentially two relevant visits at a time: "active" and "current".
The active visit is the most recent visit without an end date. The presence of an active visit generally means that the patient is in the facility.
The current visit is the active visit, unless a retrospective visit has been selected.
If there is no active visit and no selected retrospective visit, then there is no
current visit. If there is no active visit but there is a retrospective visit, then
the retrospective visit is the current visit. currentVisitIsRetrospective
tells you
whether the current visit is a retrospective visit.
The active visit and current visit require two separate API calls. error
contains
the error from either one, if there is an error. isValidating
is true if either
API call is in progress. mutate
refreshes the data from both API calls.
Name | Type | Default value | Description |
---|---|---|---|
patientUuid |
string |
undefined |
Unique patient identifier string |
representation |
string |
defaultVisitCustomRepresentation |
The custom representation of the visit |
packages/framework/esm-react-utils/src/useVisit.ts:42
▸ useVisitTypes(): VisitType
[]
packages/framework/esm-react-utils/src/useVisitTypes.ts:6
▸ userHasAccess(requiredPrivilege
, user
): boolean
Name | Type |
---|---|
requiredPrivilege |
string | string [] |
user |
Object |
user.privileges |
Privilege [] |
user.roles |
Role [] |
boolean
packages/framework/esm-api/src/shared-api-objects/current-user.ts:184
▸ filterBreadcrumbs(list
, path
): BreadcrumbRegistration
[]
Name | Type |
---|---|
list |
BreadcrumbRegistration [] |
path |
string |
packages/framework/esm-navigation/src/breadcrumbs/filter.ts:34
▸ getBreadcrumbs(): BreadcrumbRegistration
[]
packages/framework/esm-navigation/src/breadcrumbs/db.ts:32
▸ getBreadcrumbsFor(path
): BreadcrumbRegistration
[]
Name | Type |
---|---|
path |
string |
packages/framework/esm-navigation/src/breadcrumbs/filter.ts:54
▸ registerBreadcrumb(breadcrumb
): void
Name | Type |
---|---|
breadcrumb |
BreadcrumbSettings |
void
packages/framework/esm-navigation/src/breadcrumbs/db.ts:18
▸ registerBreadcrumbs(breadcrumbs
): void
Name | Type |
---|---|
breadcrumbs |
BreadcrumbSettings [] |
void
packages/framework/esm-navigation/src/breadcrumbs/db.ts:22
▸ defineConfigSchema(moduleName
, schema
): void
This defines a configuration schema for a module. The schema tells the configuration system how the module can be configured. It specifies what makes configuration valid or invalid.
See Configuration System for more information about defining a config schema.
Name | Type | Description |
---|---|---|
moduleName |
string |
Name of the module the schema is being defined for. Generally should be the one in which the defineConfigSchema call takes place. |
schema |
ConfigSchema |
The config schema for the module |
void
packages/framework/esm-config/src/module-config/module-config.ts:165
▸ defineExtensionConfigSchema(extensionName
, schema
): void
This defines a configuration schema for an extension. When a schema is defined for an extension, that extension will receive the configuration corresponding to that schema, rather than the configuration corresponding to the module in which it is defined.
The schema tells the configuration system how the module can be configured. It specifies what makes configuration valid or invalid.
See Configuration System for more information about defining a config schema.
Name | Type | Description |
---|---|---|
extensionName |
string |
Name of the extension the schema is being defined for. Should match the name of one of the extensions entries being returned by setupOpenMRS . |
schema |
ConfigSchema |
The config schema for the extension |
void
packages/framework/esm-config/src/module-config/module-config.ts:241
▸ getConfig<T
>(moduleName
): Promise
<T
>
A promise-based way to access the config as soon as it is fully loaded. If it is already loaded, resolves the config in its present state.
This is a useful function if you need to get the config in the course of the execution of a function.
Name | Type |
---|---|
T |
Record <string , any > |
Name | Type | Description |
---|---|---|
moduleName |
string |
The name of the module for which to look up the config |
Promise
<T
>
packages/framework/esm-config/src/module-config/module-config.ts:274
▸ provide(config
, sourceName?
): void
Name | Type | Default value |
---|---|---|
config |
Config |
undefined |
sourceName |
string |
'provided' |
void
packages/framework/esm-config/src/module-config/module-config.ts:258
▸ useConfig<T
>(options?
): T
Use this React Hook to obtain your module's configuration.
Name | Type |
---|---|
T |
Record <string , any > |
Name | Type | Description |
---|---|---|
options? |
UseConfigOptions |
Additional options that can be passed to useConfig() |
T
packages/framework/esm-react-utils/src/useConfig.ts:139
▸ inRange(min
, max
): Validator
Verifies that the value is between the provided minimum and maximum
Name | Type | Description |
---|---|---|
min |
number |
Minimum acceptable value |
max |
number |
Maximum acceptable value |
packages/framework/esm-config/src/validators/validators.ts:10
▸ isUrl(value
): string
| void
Verifies that a string contains only the default URL template parameters.
category
Navigation
Name | Type |
---|---|
value |
any |
string
| void
packages/framework/esm-config/src/validators/validators.ts:52
▸ isUrlWithTemplateParameters(allowedTemplateParameters
): Validator
Verifies that a string contains only the default URL template
parameters, plus any specified in allowedTemplateParameters
.
category
Navigation
Name | Type | Description |
---|---|---|
allowedTemplateParameters |
string [] | readonly string [] |
To be added to openmrsBase and openmrsSpaBase |
packages/framework/esm-config/src/validators/validators.ts:21
▸ oneOf(allowedValues
): Validator
Verifies that the value is one of the allowed options.
Name | Type | Description |
---|---|---|
allowedValues |
any [] | readonly any [] |
The list of allowable values |
packages/framework/esm-config/src/validators/validators.ts:58
▸ validator(validationFunction
, message
): Validator
Constructs a custom validator.
{
foo: {
_default: 0,
_validators: [
validator(val => val >= 0, "Must not be negative.")
]
}
}
Name | Type | Description |
---|---|---|
validationFunction |
ValidatorFunction |
Takes the configured value as input. Returns true if it is valid, false otherwise. |
message |
string | (value : any ) => string |
A string message that explains why the value is invalid. Can also be a function that takes the value as input and returns a string. |
A validator ready for use in a config schema
packages/framework/esm-config/src/validators/validator.ts:25
▸ OpenmrsAppContext<T
>(__namedParameters
): null
OpenmrsAppContext is a simple React component meant to function similarly to React's Context, but built on top of the OpenmrsAppContext.
example
<OpenmrsAppContext namespace="something" value={{ key: "1234" }} />
Notes on usage: Unlike a proper React context where the value is limited to the subtree under the
context component, the OpenmrsAppContext
is inherently global in scope. That means that all applications
will see the values that you set for the namespace if they load the value of the namespace.
Name | Type |
---|---|
T |
extends Object |
Name | Type |
---|---|
__namedParameters |
OpenmrsAppContextProps <T > |
null
packages/framework/esm-react-utils/src/OpenmrsContext.ts:24
▸ getContext<T
>(namespace
): Readonly
<T
> | null
Returns an immutable version of the state of the namespace as it is currently
Name | Type | Description |
---|---|---|
T |
extends Object = {} |
The type of the value stored in the namespace |
Name | Type | Description |
---|---|---|
namespace |
string |
The namespace to load properties from |
Readonly
<T
> | null
packages/framework/esm-context/src/context.ts:54
▸ registerContext<T
>(namespace
, initialValue?
): void
Used by callers to register a new namespace in the application context. Attempting to register an already-registered namespace will display a warning and make no modifications to the state.
Name | Type |
---|---|
T |
extends Object = {} |
Name | Type | Default value | Description |
---|---|---|---|
namespace |
string |
undefined |
the namespace to register |
initialValue |
T |
nothing |
the initial value of the namespace |
void
packages/framework/esm-context/src/context.ts:29
▸ subscribeToContext<T
>(namespace
, callback
): () => void
Subscribes to updates of a given namespace. Note that the returned object is immutable.
Name | Type |
---|---|
T |
extends Object = {} |
Name | Type | Description |
---|---|---|
namespace |
string |
the namespace to subscribe to |
callback |
ContextCallback <T > |
a function invoked with the current context whenever |
fn
A function to unsubscribe from the context
▸ (): void
void
packages/framework/esm-context/src/context.ts:98
▸ unregisterContext(namespace
): void
Used by caller to unregister a namespace in the application context. Unregistering a namespace will remove the namespace and all associated data.
Name | Type |
---|---|
namespace |
string |
void
packages/framework/esm-context/src/context.ts:45
▸ updateContext<T
>(namespace
, update
): void
Updates a namespace in the global context. If the namespace does not exist, it is registered.
Name | Type |
---|---|
T |
extends Object = {} |
Name | Type |
---|---|
namespace |
string |
update |
(state : T ) => T |
void
packages/framework/esm-context/src/context.ts:78
▸ useAppContext<T
>(namespace
): Readonly
<T
> | undefined
This hook is used to access a namespace within the overall AppContext, so that a component can use any shared contextual values. A selector may be provided to further restrict the properties returned from the namespace.
example
// load a full namespace
const patientContext = useAppContext<PatientContext>('patient');
example
// loads part of a namespace
const patientName = useAppContext<PatientContext, string | undefined>('patient', (state) => state.display);
Name | Type | Description |
---|---|---|
T |
extends Object = {} |
The type of the value stored in the namespace |
Name | Type | Description |
---|---|---|
namespace |
string |
The namespace to load properties from |
Readonly
<T
> | undefined
packages/framework/esm-react-utils/src/useAppContext.ts:26
▸ useDefineAppContext<T
>(namespace
, value?
): (update
: (state
: T
) => T
) => void
This hook is used to register a namespace in the AppContext. The component that registers the namespace is responsible for updating the value associated with the namespace. The namespace will be automatically removed when the component using this hook is unmounted.
example
const { data: patient } = useSWR(`/ws/rest/v1/patient/${patientUuid}`, openmrsFetch);
useDefineAppContext<PatientContext>('patient', patient ?? null);
example
const { data: patient } = useSWR(`/ws/rest/v1/patient/${patientUuid}`, openmrsFetch);
const updatePatient = useDefineAppContext<PatientContext>('patient', patient ?? null);
updatePatient((patient) => {
patient.name = 'Hector';
return patient;
})
Note that the AppContext does not allow the storing of undefined values in a namespace. Use null
instead.
Name | Type | Description |
---|---|---|
T |
extends Object |
The type of the value of the namespace |
Name | Type | Description |
---|---|---|
namespace |
string |
The name of the namespace in the application context. Note that the namespace must be unique among currently registered namespaces in the application context. |
value? |
T |
The value to associate with this namespace. Updating the value property will update the namespace value. |
fn
A function which can be used to update the state associated with the namespace
▸ (update
): void
Name | Type |
---|---|
update |
(state : T ) => T |
void
packages/framework/esm-react-utils/src/useDefineAppContext.ts:37
▸ convertToLocaleCalendar(date
, locale
): CalendarDate
| CalendarDateTime
| ZonedDateTime
Converts a calendar date to the equivalent locale calendar date.
Name | Type |
---|---|
date |
CalendarDate | CalendarDateTime | ZonedDateTime |
locale |
string | Locale |
CalendarDate
| CalendarDateTime
| ZonedDateTime
CalendarDate
packages/framework/esm-utils/src/dates/date-util.ts:348
▸ formatDate(date
, options?
): string
Formats the input date according to the current locale and the given options.
Default options:
- mode: "standard",
- time: "for today",
- day: true,
- month: true,
- year: true
- noToday: false
If the date is today then "Today" is produced (in the locale language).
This behavior can be disabled with noToday: true
.
When time is included, it is appended with a comma and a space. This
agrees with the output of Date.prototype.toLocaleString
for most
locales.
Name | Type |
---|---|
date |
Date |
options? |
Partial <FormatDateOptions > |
string
packages/framework/esm-utils/src/dates/date-util.ts:237
▸ formatDatetime(date
, options?
): string
Formats the input into a string showing the date and time, according
to the current locale. The mode
parameter is as described for
formatDate
.
This is created by concatenating the results of formatDate
and formatTime
with a comma and space. This agrees with the
output of Date.prototype.toLocaleString
for most locales.
Name | Type |
---|---|
date |
Date |
options? |
Partial <Omit <FormatDateOptions , "time" >> |
string
packages/framework/esm-utils/src/dates/date-util.ts:340
▸ formatTime(date
): string
Formats the input as a time, according to the current locale. 12-hour or 24-hour clock depends on locale.
Name | Type |
---|---|
date |
Date |
string
packages/framework/esm-utils/src/dates/date-util.ts:324
▸ getDefaultCalendar(locale
): undefined
| string
Retrieves the default calendar for the specified locale if any.
Name | Type | Description |
---|---|---|
locale |
undefined | string | Locale |
the locale to look-up |
undefined
| string
packages/framework/esm-utils/src/dates/date-util.ts:211
▸ isOmrsDateStrict(omrsPayloadString
): boolean
This function checks whether a date string is the OpenMRS ISO format. The format should be YYYY-MM-DDTHH:mm:ss.SSSZZ
Name | Type |
---|---|
omrsPayloadString |
string |
boolean
packages/framework/esm-utils/src/dates/date-util.ts:35
▸ isOmrsDateToday(date
): boolean
Name | Type | Description |
---|---|---|
date |
DateInput |
Checks if the provided date is today. |
boolean
packages/framework/esm-utils/src/dates/date-util.ts:64
▸ parseDate(dateString
): Date
Utility function to parse an arbitrary string into a date.
Uses dayjs(dateString)
.
Name | Type |
---|---|
dateString |
string |
Date
packages/framework/esm-utils/src/dates/date-util.ts:97
▸ registerDefaultCalendar(locale
, calendar
): void
Provides the name of the calendar to associate, as a default, with the given base locale.
example
registerDefaultCalendar('en', 'buddhist') // sets the default calendar for the 'en' locale to Buddhist.
Name | Type | Description |
---|---|---|
locale |
string |
the locale to register this calendar for |
calendar |
string |
the calendar to use for this registration |
void
packages/framework/esm-utils/src/dates/date-util.ts:202
▸ toDateObjectStrict(omrsDateString
): Date
| null
Converts the object to a date object if it is an OpenMRS ISO date time string. Otherwise returns null.
Name | Type |
---|---|
omrsDateString |
string |
Date
| null
packages/framework/esm-utils/src/dates/date-util.ts:72
▸ toOmrsIsoString(date
, toUTC?
): string
Formats the input to OpenMRS ISO format: "YYYY-MM-DDTHH:mm:ss.SSSZZ".
Name | Type | Default value |
---|---|---|
date |
DateInput |
undefined |
toUTC |
boolean |
false |
string
packages/framework/esm-utils/src/dates/date-util.ts:83
▸ importDynamic<T
>(jsPackage
, share?
, options?
): Promise
<T
>
Loads the named export from a named package. This might be used like:
const { someComponent } = importDynamic("@openmrs/esm-template-app")
Name | Type |
---|---|
T |
any |
Name | Type | Default value | Description |
---|---|---|---|
jsPackage |
string |
undefined |
The package to load the export from. |
share |
string |
'./start' |
Indicates the name of the shared module; this is an advanced feature if the package you are loading doesn't use the default OpenMRS shared module name "./start". |
options? |
Object |
undefined |
Additional options to control loading this script. |
options.importMap? |
ImportMap |
undefined |
|
options.maxLoadingTime? |
number |
undefined |
Promise
<T
>
packages/framework/esm-dynamic-loading/src/dynamic-loading.ts:37
▸ createErrorHandler(): (incomingErr
: any
) => void
fn
▸ (incomingErr
): void
Name | Type |
---|---|
incomingErr |
any |
void
packages/framework/esm-error-handling/src/index.ts:30
▸ reportError(err
): void
Name | Type |
---|---|
err |
any |
void
packages/framework/esm-error-handling/src/index.ts:23
▸ ExtensionSlot(__namedParameters
): Element
An extension slot. A place with a name. Extensions that get connected to that name will be rendered into this.
example
Passing a react node as children
<ExtensionSlot name="Foo">
<div style={{ width: 10rem }}>
<Extension />
</div>
</ExtensionSlot>
example
Passing a function as children
<ExtensionSlot name="Bar">
{(extension) => (
<h1>{extension.name}</h1>
<div style={{ color: extension.meta.color }}>
<Extension />
</div>
)}
</ExtensionSlot>
Name | Type |
---|---|
__namedParameters |
ExtensionSlotProps |
Element
packages/framework/esm-react-utils/src/ExtensionSlot.tsx:81
▸ attach(slotName
, extensionId
): void
Attach an extension to an extension slot.
This will cause the extension to be rendered into the specified
extension slot, unless it is removed by configuration. Using
attach
is an alternative to specifying the slot
or slots
in the extension declaration.
It is particularly useful when creating a slot into which you want to render an existing extension. This enables you to do so without modifying the extension's declaration, which may be impractical or inappropriate, for example if you are writing a module for a specific implementation.
Name | Type | Description |
---|---|---|
slotName |
string |
a name uniquely identifying the slot |
extensionId |
string |
an extension name, with an optional #-suffix to distinguish it from other instances of the same extension attached to the same slot. |
void
packages/framework/esm-extensions/src/extensions.ts:212
▸ detach(extensionSlotName
, extensionId
): void
deprecated
Avoid using this. Extension attachments should be considered declarative.
Name | Type |
---|---|
extensionSlotName |
string |
extensionId |
string |
void
packages/framework/esm-extensions/src/extensions.ts:245
▸ detachAll(extensionSlotName
): void
deprecated
Avoid using this. Extension attachments should be considered declarative.
Name | Type |
---|---|
extensionSlotName |
string |
void
packages/framework/esm-extensions/src/extensions.ts:269
▸ getAssignedExtensions(slotName
): AssignedExtension
[]
Gets the list of extensions assigned to a given slot
Name | Type | Description |
---|---|---|
slotName |
string |
The slot to load the assigned extensions for |
An array of extensions assigned to the named slot
packages/framework/esm-extensions/src/extensions.ts:396
▸ getExtensionNameFromId(extensionId
): string
Given an extension ID, which is a string uniquely identifying an instance of an extension within an extension slot, this returns the extension name.
example
getExtensionNameFromId("foo#bar")
--> "foo"
getExtensionNameFromId("baz")
--> "baz"
Name | Type |
---|---|
extensionId |
string |
string
packages/framework/esm-extensions/src/extensions.ts:160
▸ getExtensionStore(): StoreApi
<ExtensionStore
>
This returns a store that modules can use to get information about the state of the extension system.
StoreApi
<ExtensionStore
>
packages/framework/esm-extensions/src/store.ts:125
▸ renderExtension(domElement
, extensionSlotName
, extensionSlotModuleName
, extensionId
, renderFunction?
, additionalProps?
): Promise
<Parcel
| null
>
Mounts into a DOM node (representing an extension slot) a lazy-loaded component from any frontend module that registered an extension component for this slot.
Name | Type |
---|---|
domElement |
HTMLElement |
extensionSlotName |
string |
extensionSlotModuleName |
string |
extensionId |
string |
renderFunction |
(application : ParcelConfig <CustomProps >) => ParcelConfig <CustomProps > |
additionalProps |
Record <string , any > |
Promise
<Parcel
| null
>
packages/framework/esm-extensions/src/render.ts:18
▸ useAssignedExtensionIds(slotName
): string
[]
Gets the assigned extension ids for a given extension slot name. Does not consider if offline or online.
deprecated
Use useAssignedExtensions
Name | Type | Description |
---|---|---|
slotName |
string |
The name of the slot to get the assigned IDs for. |
string
[]
packages/framework/esm-react-utils/src/useAssignedExtensionIds.ts:13
▸ useAssignedExtensions(slotName
): AssignedExtension
[]
Gets the assigned extensions for a given extension slot name.
Name | Type | Description |
---|---|---|
slotName |
string |
The name of the slot to get the assigned extensions for. |
packages/framework/esm-react-utils/src/useAssignedExtensions.ts:8
▸ useConnectedExtensions(slotName
): ConnectedExtension
[]
Gets the assigned extension for a given extension slot name.
deprecated
Use useAssignedExtensions instead
Name | Type | Description |
---|---|---|
slotName |
string |
The name of the slot to get the assigned extensions for. |
packages/framework/esm-react-utils/src/useConnectedExtensions.ts:10
▸ useExtensionSlotMeta<T
>(extensionSlotName
): Object
Extract meta data from all extension for a given extension slot.
Name | Type |
---|---|
T |
ExtensionMeta |
Name | Type |
---|---|
extensionSlotName |
string |
Object
packages/framework/esm-react-utils/src/useExtensionSlotMeta.ts:10
▸ useExtensionSlotStore(slot
): ExtensionSlotState
Name | Type |
---|---|
slot |
string |
packages/framework/esm-react-utils/src/useExtensionSlotStore.ts:5
▸ useExtensionStore(): T
T
packages/framework/esm-react-utils/src/useExtensionStore.ts:5
▸ useExtensionStore(actions
): T
& BoundActions
Name | Type |
---|---|
actions |
Actions <ExtensionStore > |
T
& BoundActions
packages/framework/esm-react-utils/src/useExtensionStore.ts:5
▸ useExtensionStore(actions?
): T
& BoundActions
Name | Type |
---|---|
actions? |
Actions <ExtensionStore > |
T
& BoundActions
packages/framework/esm-react-utils/src/useExtensionStore.ts:5
▸ useRenderableExtensions(name
): React.FC
<Pick
<ExtensionProps
, "state"
>>[]
This is an advanced hook for use-cases where its useful to use the extension system,
but not the ExtensionSlot
component's rendering of extensions. Use of this hook
should be avoided if possible.
Functionally, this hook is very similar to the ExtensionSlot
component, but whereas
an ExtensionSlot
renders a DOM tree of extensions bound to the slot, this hook simply
returns the extensions as an array of React components that can be wired into a component
however makes sense.
example
const extensions = useRenderableExtensions('my-extension-slot');
return (
<>
{extensions.map((Ext, index) => (
<React.Fragment key={index}>
<Ext state={{key: 'value'}} />
</React.Fragment>
))}
</>
)
Name | Type | Description |
---|---|---|
name |
string |
The name of the extension slot |
React.FC
<Pick
<ExtensionProps
, "state"
>>[]
packages/framework/esm-react-utils/src/useRenderableExtensions.tsx:31
▸ getFeatureFlag(flagName
): boolean
Use this function to access the current value of the feature flag
If you are using React, use useFeatureFlag
instead.
Name | Type |
---|---|
flagName |
string |
boolean
packages/framework/esm-feature-flags/src/feature-flags.ts:71
▸ registerFeatureFlag(flagName
, label
, description
): void
This function creates a feature flag. Call it in top-level code anywhere. It will not reset whether the flag is enabled or not, so it's safe to call it multiple times. Once a feature flag is created, it will appear with a toggle in the Implementer Tools. It can then be used to turn on or off features in the code.
Name | Type | Description |
---|---|---|
flagName |
string |
A code-friendly name for the flag, which will be used to reference it in code |
label |
string |
A human-friendly name which will be displayed in the Implementer Tools |
description |
string |
An explanation of what the flag does, which will be displayed in the Implementer Tools |
void
packages/framework/esm-feature-flags/src/feature-flags.ts:54
▸ useFeatureFlag(flagName
): boolean
Use this function to tell whether a feature flag is toggled on or off.
Example:
import { useFeatureFlag } from "@openmrs/esm-react-utils";
export function MyComponent() {
const isMyFeatureFlagOn = useFeatureFlag("my-feature-flag");
return <>{isMyFeatureFlagOn && <ExperimentalFeature />}</>;
}
Name | Type |
---|---|
flagName |
string |
boolean
packages/framework/esm-react-utils/src/useFeatureFlag.ts:19
▸ getAsyncExtensionLifecycle<T
>(lazy
, options
): () => Promise
<any
>
deprecated
Use getAsyncLifecycle instead.
Name |
---|
T |
Name | Type |
---|---|
lazy |
() => Promise <{ default : ComponentType <T > }> |
options |
ComponentDecoratorOptions |
fn
▸ (): Promise
<any
>
Promise
<any
>
packages/framework/esm-react-utils/src/getLifecycle.ts:32
▸ getAsyncLifecycle<T
>(lazy
, options
): () => Promise
<any
>
Name |
---|
T |
Name | Type |
---|---|
lazy |
() => Promise <{ default : ComponentType <T > }> |
options |
ComponentDecoratorOptions |
fn
▸ (): Promise
<any
>
Promise
<any
>
packages/framework/esm-react-utils/src/getLifecycle.ts:18
▸ getLifecycle<T
>(Component
, options
): any
Name |
---|
T |
Name | Type |
---|---|
Component |
ComponentType <T > |
options |
ComponentDecoratorOptions |
any
packages/framework/esm-react-utils/src/getLifecycle.ts:10
▸ getSyncLifecycle<T
>(Component
, options
): () => Promise
<any
>
Name |
---|
T |
Name | Type |
---|---|
Component |
ComponentType <T > |
options |
ComponentDecoratorOptions |
fn
▸ (): Promise
<any
>
Promise
<any
>
packages/framework/esm-react-utils/src/getLifecycle.ts:25
▸ ConfigurableLink(__namedParameters
): Element
A React link component which calls navigate when clicked
Name | Type |
---|---|
__namedParameters |
PropsWithChildren <ConfigurableLinkProps > |
Element
packages/framework/esm-react-utils/src/ConfigurableLink.tsx:53
▸ getHistory(): string
[]
Returns a list of URLs representing the history of the current window session.
string
[]
packages/framework/esm-navigation/src/history/history.ts:47
▸ goBackInHistory(toUrl:
): void
Rolls back the history to the specified point and navigates to that URL.
Name | Type | Description |
---|---|---|
toUrl: |
Object |
The URL in the history to navigate to. History after that index will be deleted. If the URL is not found in the history, an error will be thrown. |
toUrl:.toUrl |
string |
void
packages/framework/esm-navigation/src/history/history.ts:58
▸ interpolateString(template
, params
): string
Interpolates values of params
into the template
string.
Example usage:
interpolateString("test ${one} ${two} 3", {
one: "1",
two: "2",
}); // will return "test 1 2 3"
interpolateString("test ok", { one: "1", two: "2" }) // will return "test ok"
Name | Type | Description |
---|---|---|
template |
string |
With optional params wrapped in ${ } |
params |
Object |
Values to interpolate into the string template |
string
packages/framework/esm-navigation/src/navigation/interpolate-string.ts:60
▸ interpolateUrl(template
, additionalParams?
): string
Interpolates a string with openmrsBase and openmrsSpaBase.
Useful for accepting ${openmrsBase}
or ${openmrsSpaBase}
plus additional template
parameters in configurable URLs.
Example usage:
interpolateUrl("test ${openmrsBase} ${openmrsSpaBase} ok");
// will return "test /openmrs /openmrs/spa ok"
interpolateUrl("${openmrsSpaBase}/patient/${patientUuid}", {
patientUuid: "4fcb7185-c6c9-450f-8828-ccae9436bd82",
}); // will return "/openmrs/spa/patient/4fcb7185-c6c9-450f-8828-ccae9436bd82"
This can be used in conjunction with the navigate
function like so
navigate({
to: interpolateUrl(
"${openmrsSpaBase}/patient/${patientUuid}",
{ patientUuid: patient.uuid }
)
}); // will navigate to "/openmrs/spa/patient/4fcb7185-c6c9-450f-8828-ccae9436bd82"
Name | Type | Description |
---|---|---|
template |
string |
A string to interpolate |
additionalParams? |
Object |
Additional values to interpolate into the string template |
string
packages/framework/esm-navigation/src/navigation/interpolate-string.ts:36
▸ navigate(to
): void
Calls location.assign
for non-SPA paths and navigateToUrl for SPA paths
@example
const config = useConfig();
const submitHandler = () => {
navigate({ to: config.links.submitSuccess });
};
@example
navigate({ to: "/some/path" }); // => window.location.assign("/some/path")
navigate({ to: "https://single-spa.js.org/" }); // => window.location.assign("https://single-spa.js.org/")
navigate({ to: "${openmrsBase}/some/path" }); // => window.location.assign("/openmrs/some/path")
navigate({ to: "/openmrs/spa/foo/page" }); // => navigateToUrl("/openmrs/spa/foo/page")
navigate({ to: "${openmrsSpaBase}/bar/page" }); // => navigateToUrl("/openmrs/spa/bar/page")
navigate({ to: "/${openmrsSpaBase}/baz/page" }) // => navigateToUrl("/openmrs/spa/baz/page")
navigate({ to: "https://o3.openmrs.org/${openmrsSpaBase}/qux/page" }); // => navigateToUrl("/openmrs/spa/qux/page")
if `window.location.origin` == "https://o3.openmrs.org", else will use window.location.assign
Name | Type | Description |
---|---|---|
to |
NavigateOptions |
The target path or URL. Supports templating with 'openmrsBase', 'openmrsSpaBase', and any additional template parameters defined in templateParams . For example, ${openmrsSpaBase}/home will resolve to /openmrs/spa/home for implementations using the standard OpenMRS and SPA base paths. If templateParams contains { foo: "bar" } , then the URL ${openmrsBase}/${foo} will become /openmrs/bar . |
void
packages/framework/esm-navigation/src/navigation/navigate.ts:49
▸ beginEditSynchronizationItem(id
): Promise
<void
>
Triggers an edit flow for the given synchronization item. If this is not possible, throws an error.
Name | Type | Description |
---|---|---|
id |
number |
The ID of the synchronization item to be edited. |
Promise
<void
>
packages/framework/esm-offline/src/sync.ts:330
▸ canBeginEditSynchronizationItemsOfType(type
): boolean
Returns whether editing synchronization items of the given type is supported by the currently registered synchronization handlers.
Name | Type | Description |
---|---|---|
type |
string |
The identifying type of the synchronization item which should be edited. |
boolean
packages/framework/esm-offline/src/sync.ts:320
▸ deleteSynchronizationItem(id
): Promise
<void
>
Deletes a queued up sync item with the given ID.
Name | Type | Description |
---|---|---|
id |
number |
The ID of the synchronization item to be deleted. |
Promise
<void
>
packages/framework/esm-offline/src/sync.ts:350
▸ generateOfflineUuid(): string
Generates a UUID-like string which is used for uniquely identifying objects while offline.
string
packages/framework/esm-offline/src/uuid.ts:7
▸ getCurrentOfflineMode(): OfflineModeResult
packages/framework/esm-offline/src/mode.ts:45
▸ getDynamicOfflineDataEntries<T
>(type?
): Promise
<T
[]>
Returns all DynamicOfflineData entries which registered for the currently logged in user. Optionally returns only entries of a given type.
Name | Type |
---|---|
T |
extends DynamicOfflineData |
Name | Type | Description |
---|---|---|
type? |
string |
The type of the entries to be returned. If undefined , returns all types. |
Promise
<T
[]>
packages/framework/esm-offline/src/dynamic-offline-data.ts:128
▸ getDynamicOfflineDataEntriesFor<T
>(userId
, type?
): Promise
<T
[]>
Returns all DynamicOfflineData entries which registered for the given user. Optionally returns only entries of a given type.
Name | Type |
---|---|
T |
extends DynamicOfflineData |
Name | Type | Description |
---|---|---|
userId |
string |
The ID of the user whose entries are to be retrieved. |
type? |
string |
The type of the entries to be returned. If undefined , returns all types. |
Promise
<T
[]>
packages/framework/esm-offline/src/dynamic-offline-data.ts:139
▸ getDynamicOfflineDataHandlers(): DynamicOfflineDataHandler
[]
Returns all handlers which have been setup using the setupDynamicOfflineDataHandler function.
packages/framework/esm-offline/src/dynamic-offline-data.ts:104
▸ getFullSynchronizationItems<T
>(type?
): Promise
<SyncItem
<T
>[]>
Returns all currently queued up sync items of the currently signed in user.
Name |
---|
T |
Name | Type | Description |
---|---|---|
type? |
string |
The identifying type of the synchronization items to be returned. |
Promise
<SyncItem
<T
>[]>
packages/framework/esm-offline/src/sync.ts:302
▸ getFullSynchronizationItemsFor<T
>(userId
, type?
): Promise
<SyncItem
<T
>[]>
Returns all currently queued up sync items of a given user.
Name |
---|
T |
Name | Type | Description |
---|---|---|
userId |
string |
The ID of the user whose synchronization items should be returned. |
type? |
string |
The identifying type of the synchronization items to be returned.. |
Promise
<SyncItem
<T
>[]>
packages/framework/esm-offline/src/sync.ts:281
▸ getOfflinePatientDataStore(): StoreApi
<OfflinePatientDataSyncStore
>
deprecated
Will be removed once all modules have been migrated to the new dynamic offline data API.
StoreApi
<OfflinePatientDataSyncStore
>
packages/framework/esm-offline/src/offline-patient-data.ts:39
▸ getSynchronizationItem<T
>(id
): Promise
<SyncItem
<T
> | undefined
>
Returns a queued sync item with the given ID or undefined
if no such item exists.
Name | Type |
---|---|
T |
any |
Name | Type | Description |
---|---|---|
id |
number |
The ID of the requested sync item. |
Promise
<SyncItem
<T
> | undefined
>
packages/framework/esm-offline/src/sync.ts:311
▸ getSynchronizationItems<T
>(type?
): Promise
<T
[]>
Returns the content of all currently queued up sync items of the currently signed in user.
Name |
---|
T |
Name | Type | Description |
---|---|---|
type? |
string |
The identifying type of the synchronization items to be returned. |
Promise
<T
[]>
packages/framework/esm-offline/src/sync.ts:293
▸ isOfflineUuid(uuid
): boolean
Checks whether the given string has the format of an offline UUID generated by generateOfflineUuid
Name | Type |
---|---|
uuid |
string |
boolean
packages/framework/esm-offline/src/uuid.ts:12
▸ messageOmrsServiceWorker(message
): Promise
<MessageServiceWorkerResult
<any
>>
Sends the specified message to the application's service worker.
Name | Type | Description |
---|---|---|
message |
KnownOmrsServiceWorkerMessages |
The message to be sent. |
Promise
<MessageServiceWorkerResult
<any
>>
A promise which completes when the message has been successfully processed by the Service Worker.
packages/framework/esm-offline/src/service-worker-messaging.ts:11
▸ putDynamicOfflineData(type
, identifier
): Promise
<void
>
Declares that dynamic offline data of the given type with the given identifier should be made available offline for the currently logged in user.
Name | Type | Description |
---|---|---|
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
identifier |
string |
The identifier of the offline data. See DynamicOfflineData for details. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:157
▸ putDynamicOfflineDataFor(userId
, type
, identifier
): Promise
<void
>
Declares that dynamic offline data of the given type with the given identifier should be made available offline for the user with the given ID.
Name | Type | Description |
---|---|---|
userId |
string |
The ID of the user for whom the dynamic offline data should be made available. |
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
identifier |
string |
The identifier of the offline data. See DynamicOfflineData for details. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:169
▸ queueSynchronizationItem<T
>(type
, content
, descriptor?
): Promise
<number
>
Enqueues a new item in the sync queue and associates the item with the currently signed in user.
Name |
---|
T |
Name | Type | Description |
---|---|---|
type |
string |
The identifying type of the synchronization item. |
content |
T |
The actual data to be synchronized. |
descriptor? |
QueueItemDescriptor |
An optional descriptor providing additional metadata about the sync item. |
Promise
<number
>
packages/framework/esm-offline/src/sync.ts:261
▸ registerOfflinePatientHandler(identifier
, handler
): void
deprecated
Will be removed once all modules have been migrated to the new dynamic offline data API.
Name | Type |
---|---|
identifier |
string |
handler |
OfflinePatientDataSyncHandler |
void
packages/framework/esm-offline/src/offline-patient-data.ts:45
▸ removeDynamicOfflineData(type
, identifier
): Promise
<void
>
Declares that dynamic offline data of the given type with the given identifier no longer needs to be available offline for the currently logged in user.
Name | Type | Description |
---|---|---|
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
identifier |
string |
The identifier of the offline data. See DynamicOfflineData for details. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:201
▸ removeDynamicOfflineDataFor(userId
, type
, identifier
): Promise
<void
>
Declares that dynamic offline data of the given type with the given identifier no longer needs to be available offline for the user with the given ID.
Name | Type | Description |
---|---|---|
userId |
string |
The ID of the user who doesn't require the specified offline data. |
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
identifier |
string |
The identifier of the offline data. See DynamicOfflineData for details. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:213
▸ setupDynamicOfflineDataHandler(handler
): void
Sets up a handler for synchronizing dynamic offline data. See DynamicOfflineDataHandler for details.
Name | Type | Description |
---|---|---|
handler |
DynamicOfflineDataHandler |
The handler to be setup. |
void
packages/framework/esm-offline/src/dynamic-offline-data.ts:113
▸ setupOfflineSync<T
>(type
, dependsOn
, process
, options?
): void
Registers a new synchronization handler which is able to synchronize data of a specific type.
Name |
---|
T |
Name | Type | Description |
---|---|---|
type |
string |
The identifying type of the synchronization items which can be handled by this handler. |
dependsOn |
string [] |
An array of other sync item types which must be synchronized before this handler can synchronize its own data. Items of these types are effectively dependencies of the data synchronized by this handler. |
process |
ProcessSyncItem <T > |
A function which, when invoked, performs the actual client-server synchronization of the given item (which is the actual data to be synchronized). |
options |
SetupOfflineSyncOptions <T > |
Additional options which can optionally be provided when setting up a synchronization callback for a specific synchronization item type. |
void
packages/framework/esm-offline/src/sync.ts:365
▸ subscribeConnectivity(cb
): () => void
Name | Type |
---|---|
cb |
(ev : ConnectivityChangedEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:23
▸ subscribeConnectivityChanged(cb
): () => void
Name | Type |
---|---|
cb |
(ev : ConnectivityChangedEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:12
▸ subscribePrecacheStaticDependencies(cb
): () => void
Name | Type |
---|---|
cb |
(data : PrecacheStaticDependenciesEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:37
▸ syncAllDynamicOfflineData(type
, abortSignal?
): Promise
<void
>
Synchronizes all offline data entries of the given type for the currently logged in user.
Name | Type | Description |
---|---|---|
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
abortSignal? |
AbortSignal |
An {@link AbortSignal} which can be used to cancel the operation. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:241
▸ syncDynamicOfflineData(type
, identifier
, abortSignal?
): Promise
<void
>
Synchronizes a single offline data entry of the given type for the currently logged in user.
Name | Type | Description |
---|---|---|
type |
string |
The type of the offline data. See DynamicOfflineData for details. |
identifier |
string |
The identifier of the offline data. See DynamicOfflineData for details. |
abortSignal? |
AbortSignal |
An {@link AbortSignal} which can be used to cancel the operation. |
Promise
<void
>
packages/framework/esm-offline/src/dynamic-offline-data.ts:254
▸ syncOfflinePatientData(patientUuid
): Promise
<void
>
deprecated
Will be removed once all modules have been migrated to the new dynamic offline data API.
Name | Type |
---|---|
patientUuid |
string |
Promise
<void
>
packages/framework/esm-offline/src/offline-patient-data.ts:62
▸ useConnectivity(): boolean
boolean
packages/framework/esm-react-utils/src/useConnectivity.ts:6
▸ WorkspaceContainer(__namedParameters
): Element
Use this component to render the workspace window in an app such as the patient chart, or a workspace overlay in an app such as the clinic dashboard. This allows workspaces to be opened on the page where this component is mounted. This component must not be mounted multiple times on the same page. If there are multiple apps on a page, only one of those apps should use this component—it "hosts" the workspaces.
Workspaces may be opened with the launchWorkspace function from @openmrs/esm-framework
(among other options).
The overlay
prop determines whether the workspace is rendered as an overlay or a window.
When a workspace window is opened, the other content on the screen will be pushed to the left.
When an overlay is opened, it will cover other content on the screen.
The context key is a string that appears in the URL, which defines the pages on which workspaces
are valid. If the URL changes in a way such that it no longer contains the context key, then
all workspaces will be closed. This ensures that, for example, workspaces on the home page do
not stay open when the user transitions to the patient dashboard; and also that workspaces do
not stay open when the user navigates to a different patient. The context key must be a valid
sub-path of the URL, with no initial or trailing slash. So if the URL is
https://example.com/patient/123/foo
, then patient
and patient/123
and 123/foo
are valid
context keys, but patient/12
and pati
are not.
An extension slot is provided in the workspace header. Its name is derived from the featureName
of
the top-level component in which it is defined (feature names are generally provided in the lifecycle
functions in an app's index.ts
file). The slot is named workspace-header-${featureName}-slot
.
For the patient chart, this is workspace-header-patient-chart-slot
.
This component also provides the Siderail and Bottom Nav.
To use this, pass the showSiderailAndBottomNav
prop. The Siderail is rendered on the right side of the screen
on desktop, and the Bottom Nav is rendered at the bottom of the screen on tablet or mobile. The sidebar/bottom-nav
menu provides an extension slot, to which buttons are attached as extensions. The slot
derives its name from the featureName
of the top-level component in which this WorkspaceContainer
appears (feature names are generally provided in the lifecycle functions in an app's index.ts
file).
The slot is named action-menu-${featureName}-items-slot
. For the patient chart, this is
action-menu-patient-chart-items-slot
.
This component also provides everything needed for workspace notifications to be rendered.
Name | Type |
---|---|
__namedParameters |
WorkspaceContainerProps |
Element
packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:68
▸ compile(expression
): jsep.Expression
compile()
is a companion function for use with {@link evaluate()} and the various evaluateAs*()
functions.
It processes an expression string into the resulting AST that is executed by those functions. This is useful if
you have an expression that will need to be evaluated mulitple times, potentially with different values, as the
lexing and parsing steps can be skipped by using the AST object returned from this.
The returned AST is intended to be opaque to client applications, but, of course, it is possible to manipulate the AST before passing it back to {@link evaluate()}, if desired. This might be useful if, for example, certain values are known to be constant.
Name | Type | Description |
---|---|---|
expression |
string |
The expression to be parsed |
jsep.Expression
An executable AST representation of the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:323
▸ evaluate(expression
, variables?
): DefaultEvaluateReturnType
evaluate()
implements a relatively safe version of eval()
that is limited to evaluating synchronous
Javascript expressions. This allows us to safely add features that depend on user-supplied code without
polluting the global namespace or needing to support eval()
and the like.
By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined. Other values will result in an error.
example
// shouldDisplayOptionalData will be false
const shouldDisplayOptionalData = evaluate('!isEmpty(array)', {
array: [],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
})
Since this only implements the expression lanaguage part of Javascript, there is no support for assigning values, creating functions, or creating objects, so the following will throw an error:
example
evaluate('var a = 1; a');
In addition to string expressions, evaluate()
can use an existing jsep.Expression
, such as that returned
from the compile()
function. The goal here is to support cases where the same expression will be evaluated
multiple times, possibly with different variables, e.g.,
example
const expr = compile('isEmpty(array)');
// then we use it like
evaluate(expr, {
array: [],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
));
evaluate(expr, {
array: ['value'],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
));
This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.
The variables
parameter should be used to supply any variables or functions that should be in-scope for
the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but
any non-global values will need to be passed as a variable. Note that expressions do not have any access to
the variables in the scope in which they were defined unless they are supplied here.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:96
▸ evaluateAsBoolean(expression
, variables?
): Boolean
evaluateAsBoolean()
is a variant of {@link evaluate()} which only supports boolean results. Useful
if valid expression must return boolean values.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
Boolean
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:179
▸ evaluateAsBooleanAsync(expression
, variables?
): Promise
<Boolean
>
evaluateAsBooleanAsync()
is a variant of {@link evaluateAsync()} which only supports boolean results. Useful
if valid expression must return boolean values.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
Promise
<Boolean
>
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:192
▸ evaluateAsNumber(expression
, variables?
): number
evaluateAsNumber()
is a variant of {@link evaluate()} which only supports number results. Useful
if valid expression must return numeric values.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
number
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:205
▸ evaluateAsNumberAsync(expression
, variables?
): Promise
<number
>
evaluateAsNumberAsync()
is a variant of {@link evaluateAsync()} which only supports number results. Useful
if valid expression must return numeric values.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
Promise
<number
>
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:218
▸ evaluateAsType<T
>(expression
, variables?
, typePredicate
): T
evaluateAsType()
is a type-safe version of {@link evaluate()} which returns a result if the result
passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on
context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard
to ensure that only number or boolean results are returned.
Name |
---|
T |
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
typePredicate |
(result : unknown ) => result is T |
A type predicate which asserts that the result value matches one of the expected results. |
T
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:235
▸ evaluateAsTypeAsync<T
>(expression
, variables?
, typePredicate
): Promise
<T
>
evaluateAsTypeAsync()
is a type-safe version of {@link evaluateAsync()} which returns a result if the result
passes a custom type predicate. The main use-case for this is to narrow the return types allowed based on
context, e.g., if the expected result should be a number or boolean, you can supply a custom type-guard
to ensure that only number or boolean results are returned.
Name |
---|
T |
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
typePredicate |
(result : unknown ) => result is T |
A type predicate which asserts that the result value matches one of the expected results. |
Promise
<T
>
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:277
▸ evaluateAsync(expression
, variables?
): Promise
<DefaultEvaluateReturnType
>
evaluateAsync()
implements a relatively safe version of eval()
that can evaluate Javascript expressions
that use Promises. This allows us to safely add features that depend on user-supplied code without
polluting the global namespace or needing to support eval()
and the like.
By default it supports any expression that evalutes to a string, number, boolean, Date, null, or undefined. Other values will result in an error.
example
// shouldDisplayOptionalData will be false
const shouldDisplayOptionalData = await evaluateAsync('Promise.resolve(!isEmpty(array))', {
array: [],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
})
Since this only implements the expression lanaguage part of Javascript, there is no support for assigning values, creating functions, or creating objects, so the following will throw an error:
example
evaluateAsync('var a = 1; a');
In addition to string expressions, evaluate()
can use an existing jsep.Expression
, such as that returned
from the compile()
function. The goal here is to support cases where the same expression will be evaluated
multiple times, possibly with different variables, e.g.,
example
const expr = compile('Promise.resolve(isEmpty(array))');
// then we use it like
evaluateAsync(expr, {
array: [],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
));
evaluateAsync(expr, {
array: ['value'],
isEmpty(arr: unknown) {
return Array.isArray(arr) && arr.length === 0;
}
));
This saves the overhead of parsing the expression everytime and simply allows us to evaluate it.
The variables
parameter should be used to supply any variables or functions that should be in-scope for
the evaluation. A very limited number of global objects, like NaN and Infinity are always available, but
any non-global values will need to be passed as a variable. Note that expressions do not have any access to
the variables in the scope in which they were defined unless they are supplied here.
Note: evaluateAsync()
currently only supports Promise-based asynchronous flows and does not support
the await
keyword.
Name | Type | Description |
---|---|---|
expression |
string | Expression |
The expression to evaluate, either as a string or pre-parsed expression |
variables |
VariablesMap |
Optional object which contains any variables, functions, etc. that will be available to the expression. |
Promise
<DefaultEvaluateReturnType
>
The result of evaluating the expression
packages/framework/esm-expression-evaluator/src/evaluator.ts:166
▸ extractVariableNames(expression
): string
[]
extractVariableNames()
is a companion function for evaluate()
and evaluateAsync()
which extracts the
names of all unbound identifiers used in the expression. The idea is to be able to extract all of the names
of variables that will need to be supplied in order to correctly process the expression.
example
// variables will be ['isEmpty', 'array']
const variables = extractVariableNames('!isEmpty(array)')
An identifier is considered "unbound" if it is not a reference to the property of an object, is not defined as a parameter to an inline arrow function, and is not a global value. E.g.,
example
// variables will be ['obj']
const variables = extractVariableNames('obj.prop()')
example
// variables will be ['arr', 'needle']
const variables = extractVariableNames('arr.filter(v => v === needle)')
example
// variables will be ['myVar']
const variables = extractVariableNames('new String(myVar)')
Note that because this expression evaluator uses a restricted definition of "global" there are some Javascript globals that will be reported as a unbound expression. This is expected because the evaluator will still fail on these expressions.
Name | Type |
---|---|
expression |
string | Expression |
string
[]
packages/framework/esm-expression-evaluator/src/extractor.ts:44
▸ getLocale(): string
Returns the current locale of the application.
string
string
packages/framework/esm-utils/src/get-locale.ts:5
▸ isOnline(online?
): boolean
Name | Type |
---|---|
online? |
boolean |
boolean
packages/framework/esm-utils/src/is-online.ts:3
▸ useFhirFetchAll<T
>(url
, options?
): UseServerInfiniteReturnObject
<T
, fhir.Bundle
>
This hook handles fetching results from all pages of a paginated FHIR REST endpoint, making multiple requests
as needed.
This function is the FHIR counterpart of useOpenmrsPagination
.
see
useFhirPagination
see
useFhirInfinite
see
`useOpenmrsFetchAll``
Name | Type |
---|---|
T |
extends ResourceBase |
Name | Type | Description |
---|---|---|
url |
any |
The URL of the paginated rest endpoint. Similar to useSWRInfinite, this param can be null to disable fetching. |
options |
UseServerFetchAllOptions <Bundle > |
The options object |
UseServerInfiniteReturnObject
<T
, fhir.Bundle
>
a UseFhirInfiniteReturnObject object
packages/framework/esm-react-utils/src/useFhirFetchAll.ts:19
▸ useFhirInfinite<T
>(url
, options?
): UseServerInfiniteReturnObject
<T
, fhir.Bundle
>
Fhir REST endpoints that return a list of objects, are server-side paginated. The server limits the max number of results being returned, and multiple requests are needed to get the full data set if its size exceeds this limit.
This function is the FHIR counterpart of useOpenmrsInfinite
.
see
useFhirPagination
see
useFhirFetchAll
see
useOpenmrsInfinite
Name | Type |
---|---|
T |
extends ResourceBase |
Name | Type | Description |
---|---|---|
url |
string | URL |
The URL of the paginated rest endpoint. Similar to useSWRInfinite, this param can be null to disable fetching. |
options |
UseServerInfiniteOptions <Bundle > |
The options object |
UseServerInfiniteReturnObject
<T
, fhir.Bundle
>
a UseServerInfiniteReturnObject object
packages/framework/esm-react-utils/src/useFhirInfinite.ts:24
▸ createGlobalStore<T
>(name
, initialState
): StoreApi
<T
>
Creates a Zustand store.
Name |
---|
T |
Name | Type | Description |
---|---|---|
name |
string |
A name by which the store can be looked up later. Must be unique across the entire application. |
initialState |
T |
An object which will be the initial state of the store. |
StoreApi
<T
>
The newly created store.
packages/framework/esm-state/src/state.ts:30
▸ createUseStore<T
>(store
): () => T
(actions
: Actions
<T
>) => T
& BoundActions
(actions?
: Actions
<T
>) => T
& BoundActions
Whenever possible, use useStore(yourStore)
instead. This function is for creating a
custom hook for a specific store.
Name |
---|
T |
Name | Type |
---|---|
store |
StoreApi <T > |
fn
▸ (): T
T
▸ (actions
): T
& BoundActions
Name | Type |
---|---|
actions |
Actions <T > |
T
& BoundActions
▸ (actions?
): T
& BoundActions
Name | Type |
---|---|
actions? |
Actions <T > |
T
& BoundActions
packages/framework/esm-react-utils/src/useStore.ts:63
▸ getGlobalStore<T
>(name
, fallbackState?
): StoreApi
<T
>
Returns the existing store named name
,
or creates a new store named name
if none exists.
Name |
---|
T |
Name | Type | Description |
---|---|---|
name |
string |
The name of the store to look up. |
fallbackState? |
T |
The initial value of the new store if no store named name exists. |
StoreApi
<T
>
The found or newly created store.
packages/framework/esm-state/src/state.ts:92
▸ subscribeTo<T
, U
>(store
, handle
): () => void
Name | Type |
---|---|
T |
T |
U |
T |
Name | Type |
---|---|
store |
StoreApi <T > |
handle |
(state : T ) => void |
fn
▸ (): void
category
Store
void
packages/framework/esm-state/src/state.ts:109
▸ subscribeTo<T
, U
>(store
, select
, handle
): () => void
Name |
---|
T |
U |
Name | Type |
---|---|
store |
StoreApi <T > |
select |
(state : T ) => U |
handle |
(subState : U ) => void |
fn
▸ (): void
category
Store
void
packages/framework/esm-state/src/state.ts:110
▸ useStore<T
, U
>(store
): T
Name |
---|
T |
U |
Name | Type |
---|---|
store |
StoreApi <T > |
T
packages/framework/esm-react-utils/src/useStore.ts:36
▸ useStore<T
, U
>(store
, select
): U
Name |
---|
T |
U |
Name | Type |
---|---|
store |
StoreApi <T > |
select |
(state : T ) => U |
U
packages/framework/esm-react-utils/src/useStore.ts:37
▸ useStore<T
, U
>(store
, select
, actions
): T
& BoundActions
Name |
---|
T |
U |
Name | Type |
---|---|
store |
StoreApi <T > |
select |
undefined |
actions |
Actions <T > |
T
& BoundActions
packages/framework/esm-react-utils/src/useStore.ts:38
▸ useStore<T
, U
>(store
, select
, actions
): U
& BoundActions
Name |
---|
T |
U |
Name | Type |
---|---|
store |
StoreApi <T > |
select |
(state : T ) => U |
actions |
Actions <T > |
U
& BoundActions
packages/framework/esm-react-utils/src/useStore.ts:39
▸ useStoreWithActions<T
>(store
, actions
): T
& BoundActions
Name |
---|
T |
Name | Type | Description |
---|---|---|
store |
StoreApi <T > |
A zustand store |
actions |
Actions <T > |
T
& BoundActions
packages/framework/esm-react-utils/src/useStore.ts:55
▸ getCoreTranslation(key
, defaultText?
, options?
): string
Use this function to obtain a translation from the core translations. This is a way to avoid having to define common translations in your app, and to ensure that translations are consistent across different apps. This function is also used to obtain translations in the framework and app shell.
The complete set of core translations is available on the CoreTranslationKey
type. Providing an
invalid key to this function will result in a type error.
Name | Type | Description |
---|---|---|
key |
"error" | "change" | "close" | "other" | "Clinic" | "actions" | "address" | "age" | "cancel" | "confirm" | "contactAdministratorIfIssuePersists" | "contactDetails" | "errorCopy" | "female" | "loading" | "male" | "patientIdentifierSticker" | "patientLists" | "print" | "printError" | "printErrorExplainer" | "printIdentifierSticker" | "printing" | "relationships" | "resetOverrides" | "save" | "scriptLoadingFailed" | "scriptLoadingError" | "seeMoreLists" | "sex" | "showLess" | "showMore" | "toggleDevTools" | "unknown" | "closeAllOpenedWorkspaces" | "closingAllWorkspacesPromptBody" | "closingAllWorkspacesPromptTitle" | "discard" | "hide" | "maximize" | "minimize" | "openAnyway" | "unsavedChangesInOpenedWorkspace" | "unsavedChangesInWorkspace" | "unsavedChangesTitleText" | "workspaceHeader" | "address1" | "address2" | "address3" | "address4" | "address5" | "address6" | "city" | "cityVillage" | "country" | "countyDistrict" | "district" | "postalCode" | "state" | "stateProvince" |
- |
defaultText? |
string |
- |
options? |
Omit <TOptions <StringMap >, "defaultValue" | "ns" > |
Object passed to the i18next t function. See https://www.i18next.com/translation-function/essentials#overview-options for more information. ns and defaultValue are already set and may not be used. |
string
packages/framework/esm-translations/src/index.ts:66
▸ translateFrom(moduleName
, key
, fallback?
, options?
): string
This function is for getting a translation from a specific module. Use this only if the translation is neither in the app making the call, nor in the core translations. This function is useful, for example, in libraries that are used by multiple apps, since libraries can't define their own translations.
Translations within the current app should be accessed with the i18next API, using
useTranslation
and t
as usual. Core translations should be accessed with the
getCoreTranslation function.
IMPORTANT: This function creates a hidden dependency on the module. Worse yet, it creates
a dependency specifically on that module's translation keys, which are often regarded as
"implementation details" and therefore may be volatile. Also note that this function DOES NOT
load the module's translations if they have not already been loaded via useTranslation
.
This function should therefore be avoided when possible.
Name | Type | Description |
---|---|---|
moduleName |
string |
The module to get the translation from, e.g. '@openmrs/esm-login-app' |
key |
string |
The i18next translation key |
fallback? |
string |
Fallback text for if the lookup fails |
options? |
Omit <TOptions <StringMap >, "defaultValue" | "ns" > |
Options object passed to the i18next t function. See https://www.i18next.com/translation-function/essentials#overview-options for more information. ns and defaultValue are already set and may not be used. |
string
The translated text as a string
packages/framework/esm-translations/src/index.ts:40
▸ CustomOverflowMenu(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
CustomOverflowMenuProps |
Element
packages/framework/esm-styleguide/src/custom-overflow-menu/custom-overflow-menu.component.tsx:13
▸ PatientBannerActionsMenu(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
PatientBannerActionsMenuProps |
Element
▸ PatientBannerContactDetails(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
ContactDetailsProps |
Element
▸ PatientBannerPatientIdentifiers(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
PatientBannerPatientIdentifiersProps |
Element
▸ PatientBannerPatientInfo(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
PatientBannerPatientInfoProps |
Element
▸ PatientBannerToggleContactDetailsButton(__namedParameters
): Element
Name | Type |
---|---|
__namedParameters |
PatientBannerToggleContactDetailsButtonProps |
Element
▸ PatientPhoto(__namedParameters
): Element
A component which displays the patient photo https://zeroheight.com/23a080e38/p/6663f3-patient-header. If there is no photo, it will display a generated avatar. The default size is 56px.
Name | Type |
---|---|
__namedParameters |
PatientPhotoProps |
Element
packages/framework/esm-styleguide/src/patient-photo/patient-photo.component.tsx:21
▸ getFhirServerPaginationHandlers<T
>(): FhirServerPaginationHandlers
<T
>
Name |
---|
T |
FhirServerPaginationHandlers
<T
>
packages/framework/esm-react-utils/src/useFhirPagination.ts:36
▸ isDesktop(layout
): boolean
Name | Type |
---|---|
layout |
LayoutType |
boolean
packages/framework/esm-react-utils/src/useLayoutType.ts:40
▸ setLeftNav(__namedParameters
): void
Name | Type |
---|---|
__namedParameters |
SetLeftNavParams |
void
packages/framework/esm-styleguide/src/left-nav/index.tsx:31
▸ showActionableNotification(notification
): void
Displays an actionable notification in the UI.
Name | Type | Description |
---|---|---|
notification |
ActionableNotificationDescriptor |
The description of the notification to display. |
void
packages/framework/esm-styleguide/src/notifications/index.tsx:85
▸ showModal(modalName
, props?
, onClose?
): () => void
Shows a modal dialog.
The modal must have been registered by name. This should be done in the routes.json
file of the
app that defines the modal. Note that both the <ModalHeader>
and <ModalBody>
should be at the
top level of the modal component (wrapped in a React.Fragment), or else the content of the modal
body might not vertical-scroll properly.
Name | Type | Description |
---|---|---|
modalName |
string |
The name of the modal to show. |
props |
ModalProps |
The optional props to provide to the modal. |
onClose |
() => void |
The optional callback to call when the modal is closed. |
fn
The dispose function to force closing the modal dialog.
▸ (): void
void
packages/framework/esm-styleguide/src/modals/index.tsx:213
▸ showNotification(notification
): void
Displays an inline notification in the UI.
Name | Type | Description |
---|---|---|
notification |
NotificationDescriptor |
The description of the notification to display. |
void
packages/framework/esm-styleguide/src/notifications/index.tsx:43
▸ showSnackbar(snackbar
): void
Displays a snack bar notification in the UI.
Name | Type | Description |
---|---|---|
snackbar |
SnackbarDescriptor |
The description of the snack bar to display. |
void
packages/framework/esm-styleguide/src/snackbars/index.tsx:32
▸ showToast(toast
): void
Displays a toast notification in the UI.
Name | Type | Description |
---|---|---|
toast |
ToastDescriptor |
The description of the toast to display. |
void
packages/framework/esm-styleguide/src/toasts/index.tsx:36
▸ subscribeActionableNotificationShown(cb
): () => void
Name | Type |
---|---|
cb |
(data : ShowActionableNotificationEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:111
▸ subscribeNotificationShown(cb
): () => void
Name | Type |
---|---|
cb |
(data : ShowNotificationEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:104
▸ subscribeSnackbarShown(cb
): () => void
Name | Type |
---|---|
cb |
(data : ShowSnackbarEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:125
▸ subscribeToastShown(cb
): () => void
Name | Type |
---|---|
cb |
(data : ShowToastEvent ) => void |
fn
▸ (): void
void
packages/framework/esm-globals/src/events.ts:118
▸ unsetLeftNav(name
): void
Name | Type |
---|---|
name |
any |
void
packages/framework/esm-styleguide/src/left-nav/index.tsx:35
▸ useBodyScrollLock(active
): void
Name | Type |
---|---|
active |
boolean |
void
packages/framework/esm-react-utils/src/useBodyScrollLock.ts:4
▸ useFhirPagination<T
>(url
, pageSize
, options?
): Object
Fhir REST endpoints that return a list of objects, are server-side paginated. The server limits the max number of results being returned, and multiple requests are needed to get the full data set if its size exceeds this limit.
This function is the FHIR counterpart of useOpenmrsPagination
.
see
`useOpenmrsPagination
see
useFhirInfinite
see
useFhirFetchAll
see
usePagination
for pagination of client-side data`
Name | Type |
---|---|
T |
extends ResourceBase |
Name | Type | Description |
---|---|---|
url |
string | URL |
The URL of the paginated rest endpoint. which will be overridden and manipulated by the goTo* callbacks |
pageSize |
number |
The number of results to return per page / fetch. |
options |
UseServerPaginationOptions <Bundle > |
The options object |
Object
Name | Type | Description |
---|---|---|
currentPage |
number |
- |
currentPageSize |
MutableRefObject <number > |
- |
data |
undefined | T [] |
|
error |
any |
The error object thrown by the fetcher function. |
goTo |
(page : number ) => void |
- |
goToNext |
() => void |
- |
goToPrevious |
() => void |
- |
isLoading |
boolean |
- |
isValidating |
boolean |
- |
mutate |
KeyedMutator <FetchResponse <Bundle >> |
- |
paginated |
boolean |
|
showNextButton |
boolean |
|
showPreviousButton |
boolean |
|
totalCount |
number |
|
totalPages |
number |
- |
packages/framework/esm-react-utils/src/useFhirPagination.ts:27
▸ useLayoutType(): LayoutType
packages/framework/esm-react-utils/src/useLayoutType.ts:26
▸ useLeftNavStore(): LeftNavStore
LeftNavStore
packages/framework/esm-styleguide/src/left-nav/index.tsx:41
▸ useOnClickOutside<T
>(handler
, active?
): RefObject
<T
>
Name | Type |
---|---|
T |
extends HTMLElement <T > = HTMLElement |
Name | Type | Default value |
---|---|---|
handler |
(event : MouseEvent ) => void |
undefined |
active |
boolean |
true |
RefObject
<T
>
packages/framework/esm-react-utils/src/useOnClickOutside.ts:4
▸ useOpenmrsFetchAll<T
>(url
, options?
): UseServerInfiniteReturnObject
<T
, OpenMRSPaginatedResponse
<T
>>
Most OpenMRS REST endpoints that return a list of objects, such as getAll or search, are server-side paginated. This hook handles fetching results from all pages of a paginated OpenMRS REST endpoint, making multiple requests as needed.
see
useOpenmrsPagination
see
useOpenmrsInfinite
see
useFhirFetchAll
Name |
---|
T |
Name | Type | Description |
---|---|---|
url |
string | URL |
The URL of the paginated OpenMRS REST endpoint. Note that the limit GET param can be set to specify the page size; if not set, the page size defaults to the webservices.rest.maxResultsDefault value defined server-side. Similar to useSWRInfinite, this param can be null to disable fetching. |
options |
UseServerFetchAllOptions <OpenMRSPaginatedResponse <T >> |
The options object |
UseServerInfiniteReturnObject
<T
, OpenMRSPaginatedResponse
<T
>>
a UseOpenmrsInfiniteReturnObject object
packages/framework/esm-react-utils/src/useOpenmrsFetchAll.ts:40
▸ useOpenmrsInfinite<T
>(url
, options?
): UseServerInfiniteReturnObject
<T
, OpenMRSPaginatedResponse
<T
>>
Most REST endpoints that return a list of objects, such as getAll or search, are server-side paginated. The server limits the max number of results being returned, and multiple requests are needed to get the full data set if its size exceeds this limit. The max number of results per request is configurable server-side with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassian.net/wiki/spaces/docs/pages/25469882/REST+Module
This hook fetches data from a paginated rest endpoint, initially by fetching the first page of the results.
It provides a callback to load data from subsequent pages as needed. This hook is intended to serve UIs that
provide infinite loading / scrolling of results. Unlike useOpenmrsPagination
, this hook does not allow random access
(and lazy-loading) of any arbitrary page; rather, it fetches pages sequentially starting form the initial page, and the next page
is fetched by calling loadMore
. See: https://swr.vercel.app/docs/pagination#useswrinfinite
see
useOpenmrsPagination
see
useOpenmrsFetchAll
see
useFhirInfinite
Name |
---|
T |
Name | Type | Description |
---|---|---|
url |
string | URL |
The URL of the paginated rest endpoint. Note that the limit GET param can be set to specify the page size; if not set, the page size defaults to the webservices.rest.maxResultsDefault value defined server-side. Similar to useSWRInfinite, this param can be null to disable fetching. |
options |
UseServerInfiniteOptions <OpenMRSPaginatedResponse <T >> |
The options object |
UseServerInfiniteReturnObject
<T
, OpenMRSPaginatedResponse
<T
>>
a UseServerInfiniteReturnObject object
packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:103
▸ useOpenmrsPagination<T
>(url
, pageSize
, options?
): Object
Most OpenMRS REST endpoints that return a list of objects, such as getAll or search, are server-side paginated. The server limits the max number of results being returned, and multiple requests are needed to get the full data set if its size exceeds this limit. The max number of results per request is configurable server-side with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassian.net/wiki/spaces/docs/pages/25469882/REST+Module
For any UI that displays a paginated view of the full data set, we MUST handle the server-side pagination properly, or else the UI does not correctly display the full data set. This hook does that by providing callback functions for navigating to different pages of the results, and lazy-loads the data on each page as needed.
Note that this hook is not suitable for use for situations that require client-side sorting or filtering of the data set. In that case, all data must be loaded onto client-side first.
see
useOpenmrsInfinite
see
useOpenmrsFetchAll
see
usePagination
for pagination of client-side data`
see
`useFhirPagination``
Name |
---|
T |
Name | Type | Description |
---|---|---|
url |
string | URL |
The URL of the paginated rest endpoint. \ It should be populated with any needed GET params, except limit , startIndex or totalCount , which will be overridden and manipulated by the goTo* callbacks. Similar to useSWR, this param can be null to disable fetching. |
pageSize |
number |
The number of results to return per page / fetch. Note that this value MUST NOT exceed "webservices.rest.maxResultsAbsolute", which should be reasonably high by default (1000). |
options |
UseServerPaginationOptions <OpenMRSPaginatedResponse <T >> |
The options object |
Object
Name | Type | Description |
---|---|---|
currentPage |
number |
- |
currentPageSize |
MutableRefObject <number > |
- |
data |
undefined | T [] |
|
error |
any |
The error object thrown by the fetcher function. |
goTo |
(page : number ) => void |
- |
goToNext |
() => void |
- |
goToPrevious |
() => void |
- |
isLoading |
boolean |
- |
isValidating |
boolean |
- |
mutate |
KeyedMutator <FetchResponse <OpenMRSPaginatedResponse <T >>> |
- |
paginated |
boolean |
|
showNextButton |
boolean |
|
showPreviousButton |
boolean |
|
totalCount |
number |
|
totalPages |
number |
- |
packages/framework/esm-react-utils/src/useOpenmrsPagination.ts:59
▸ usePagination<T
>(data?
, resultsPerPage?
): Object
Use this hook to paginate data that already exists on the client side. Note that if the data is obtained from server-side, the caller must handle server-side pagination manually.
see
useServerPagination
for hook that automatically manages server-side pagination.
see
useServerInfinite
for hook to get all data loaded onto the client-side
Name |
---|
T |
Name | Type | Default value |
---|---|---|
data |
T [] |
[] |
resultsPerPage |
number |
defaultResultsPerPage |
Object
Name | Type |
---|---|
currentPage |
number |
goTo |
(page : number ) => void |
goToNext |
() => void |
goToPrevious |
() => void |
paginated |
boolean |
results |
T [] |
showNextButton |
boolean |
showPreviousButton |
boolean |
totalPages |
number |
packages/framework/esm-react-utils/src/usePagination.ts:15
▸ usePatientPhoto(patientUuid
): UsePatientPhotoResult
Name | Type |
---|---|
patientUuid |
string |
packages/framework/esm-styleguide/src/patient-photo/usePatientPhoto.ts:30
▸ age(birthDate
, currentDate?
): string
| null
Gets a human readable and locale supported representation of a person's age, given their birthDate, The representation logic follows the guideline here: https://webarchive.nationalarchives.gov.uk/ukgwa/20160921162509mp_/http://systems.digital.nhs.uk/data/cui/uig/patben.pdf (See Tables 7 and 8)
Name | Type | Description |
---|---|---|
birthDate |
undefined | null | string | number | Date | Dayjs |
The birthDate. If birthDate is null, returns null. |
currentDate |
undefined | null | string | number | Date | Dayjs |
Optional. If provided, calculates the age of the person at the provided currentDate (instead of now). |
string
| null
A human-readable string version of the age.
packages/framework/esm-utils/src/age-helpers.ts:16
▸ canAccessStorage(storage?
): boolean
Simple utility function to determine if an object implementing the WebStorage API
is actually available. Useful for testing the availability of localStorage
or
sessionStorage
.
Name | Type | Default value | Description |
---|---|---|---|
storage |
Storage |
window.localStorage |
The WebStorage API object to check. Defaults to localStorage . |
boolean
True if the WebStorage API object is able to be accessed, false otherwise
packages/framework/esm-utils/src/storage.ts:11
▸ displayName(patient
): string
deprecated
Use getPatientName
Name | Type |
---|---|
patient |
Patient |
string
packages/framework/esm-utils/src/patient-helpers.ts:20
▸ formatPatientName(name
): string
Get a formatted display string for an FHIR name.
Name | Type | Description |
---|---|---|
name |
undefined | HumanName |
The name to be formatted. |
string
The formatted display name or an empty string if name is undefined.
packages/framework/esm-utils/src/patient-helpers.ts:29
▸ formattedName(name
): string
deprecated
Use formatPatientName
Name | Type |
---|---|
name |
undefined | HumanName |
string
packages/framework/esm-utils/src/patient-helpers.ts:35
▸ getDefaultsFromConfigSchema<T
>(schema
): T
Given a config schema, this returns an object like is returned by useConfig
with all default values.
This should be used in tests and not in production code.
If all you need is the default values in your tests, these are returned by
default from the useConfig
/getConfig
mock. This function is useful if you
need to override some of the default values.
Name | Type |
---|---|
T |
Record <string , any > |
Name | Type |
---|---|
schema |
any |
T
packages/framework/esm-utils/src/test-helpers.ts:13
▸ getPatientName(patient
): string
Gets the formatted display name for a patient.
The display name will be taken from the patient's 'usual' name, or may fall back to the patient's 'official' name.
Name | Type | Description |
---|---|---|
patient |
Patient |
The patient details in FHIR format. |
string
The patient's display name or an empty string if name is not present.
packages/framework/esm-utils/src/patient-helpers.ts:14
▸ isVersionSatisfied(requiredVersion
, installedVersion
): boolean
Name | Type |
---|---|
requiredVersion |
string |
installedVersion |
string |
boolean
packages/framework/esm-utils/src/version.ts:22
▸ retry<T
>(fn
, options?
): Promise
<T
>
Executes the specified function and retries executing on failure with a custom backoff strategy defined by the options.
If not configured otherwise, this function uses the following default options:
- Retries 5 times beyond the initial attempt.
- Uses an exponential backoff starting with an initial delay of 1000ms.
throws
Rethrows the final error of running fn
when the function stops retrying.
Name |
---|
T |
Name | Type | Description |
---|---|---|
fn |
() => Promise <T > |
The function to be executed and retried on failure. |
options |
RetryOptions |
Additional options which configure the retry behavior. |
Promise
<T
>
The result of successfully executing fn
.
packages/framework/esm-utils/src/retry.ts:40
▸ selectPreferredName(patient
, ...preferredNames
): fhir.HumanName
| undefined
Select the preferred name from the collection of names associated with a patient.
Names may be specified with a usage such as 'usual', 'official', 'nickname', 'maiden', etc. A name with no usage specified is treated as the 'usual' name.
The chosen name will be selected according to the priority order of preferredNames
,
example
// normal use case; prefer usual name, fallback to official name
displayNameByUsage(patient, 'usual', 'official')
example
// prefer usual name over nickname, fallback to official name
displayNameByUsage(patient, 'usual', 'nickname', 'official')
Name | Type | Description |
---|---|---|
patient |
Patient |
The patient from whom a name will be selected. |
...preferredNames |
NameUse [] |
Optional ordered sequence of preferred name usages; defaults to 'usual' if not specified. |
fhir.HumanName
| undefined
the preferred name for the patient, or undefined if no acceptable name could be found.
packages/framework/esm-utils/src/patient-helpers.ts:57
▸ shallowEqual(a
, b
): boolean
Checks whether two objects are equal, using a shallow comparison, similar to React.
In essence, shallowEquals ensures two objects have the same own properties and that the values of these are equal (===) to each other.
Name | Type | Description |
---|---|---|
a |
unknown |
The first value to compare |
b |
unknown |
The second value to compare |
boolean
true if the objects are shallowly equal to each other
packages/framework/esm-utils/src/shallowEqual.ts:13
▸ useAbortController(): AbortController
beta
This hook creates an AbortController that lasts either until the previous AbortController is aborted or until the component unmounts. This can be used to ensure that all fetch requests are cancelled when a component is unmounted.
example
import { useAbortController } from "@openmrs/esm-framework";
function MyComponent() {
const abortController = useAbortController();
const { data } = useSWR(key, (key) => openmrsFetch(key, { signal: abortController.signal }));
return (
// render something with data
);
}
AbortController
packages/framework/esm-react-utils/src/useAbortController.ts:25
▸ useDebounce<T
>(value
, delay?
): T
This hook debounces a state variable. That state variable can then be used as the value of a controlled input, while the return value of this hook is used for making a request.
example
import { useDebounce } from "@openmrs/esm-framework";
function MyComponent() {
const [searchTerm, setSearchTerm] = useState('');
const debouncedSearchTerm = useDebounce(searchTerm);
const swrResult = useSWR(`/api/search?q=${debouncedSearchTerm}`)
return (
<Search
labelText={t('search', 'Search')}
onChange={(e) => setSearchTerm(e.target.value)}
value={searchTerm}
/>
)
}
Name |
---|
T |
Name | Type | Default value | Description |
---|---|---|---|
value |
T |
undefined |
The value that will be used to set debounceValue |
delay |
number |
300 |
The number of milliseconds to wait before updating debounceValue |
T
The debounced value
packages/framework/esm-react-utils/src/useDebounce.ts:32
▸ useOpenmrsSWR<DataType
, ErrorType
>(key
, options?
): SWRResponse
<FetchResponse
<DataType
>, ErrorType
, undefined
| SWRConfiguration
<FetchResponse
<DataType
>, ErrorType
, BareFetcher
<FetchResponse
<DataType
>>>>
beta
This hook is intended to simplify using openmrsFetch in useSWR, while also ensuring that all useSWR usages properly use an abort controller, so that fetch requests are cancelled if the React component unmounts.
example
import { useOpenmrsSWR } from "@openmrs/esm-framework";
function MyComponent() {
const { data } = useOpenmrsSWR(key);
return (
// render something with data
);
}
Note that if you are using a complex SWR key you must provide a url function to the options parameter,
which translates the key into a URL to be sent to openmrsFetch()
example
import { useOpenmrsSWR } from "@openmrs/esm-framework";
function MyComponent() {
const { data } = useOpenmrsSWR(['key', 'url'], { url: (key) => key[1] });
return (
// render something with data
);
}
Name | Type |
---|---|
DataType |
any |
ErrorType |
any |
Name | Type | Description |
---|---|---|
key |
Key |
The SWR key to use |
options |
UseOpenmrsSWROptions |
An object of optional parameters to provide, including a FetchConfig object to pass to openmrsFetch or options to pass to SWR |
SWRResponse
<FetchResponse
<DataType
>, ErrorType
, undefined
| SWRConfiguration
<FetchResponse
<DataType
>, ErrorType
, BareFetcher
<FetchResponse
<DataType
>>>>
packages/framework/esm-react-utils/src/useOpenmrsSWR.ts:70
▸ closeWorkspace(name
, options?
): boolean
Function to close an opened workspace
Name | Type | Description |
---|---|---|
name |
string |
Workspace registration name |
options |
CloseWorkspaceOptions |
Options to close workspace |
boolean
packages/framework/esm-styleguide/src/workspaces/workspaces.ts:433
▸ launchWorkspace<T
>(name
, additionalProps?
): void
This launches a workspace by its name. The workspace must have been registered.
Workspaces should be registered in the routes.json
file.
For the workspace to appear, there must be either a <WorkspaceOverlay />
or
a <WorkspaceWindow />
component rendered.
The behavior of this function is as follows:
- If no workspaces are open, or if no other workspaces with the same type are open, it will be opened and focused.
- If a workspace with the same name is already open, it will be displayed/focused, if it was not already.
- If a workspace is launched and a workspace which cannot be hidden is already open, a confirmation modal will pop up warning about closing the currently open workspace.
- If another workspace with the same type is open, the workspace will be brought to the front and then a confirmation modal will pop up warning about closing the opened workspace
Note that this function just manipulates the workspace store. The UI logic is handled by the components that display workspaces.
Additional props can be passed to the workspace component being launched. Passing a
prop named workspaceTitle
will override the title of the workspace.
Name | Type |
---|---|
T |
extends object | DefaultWorkspaceProps = DefaultWorkspaceProps & { [key: string] : any ; } |
Name | Type | Description |
---|---|---|
name |
string |
The name of the workspace to launch |
additionalProps? |
Omit <T , keyof DefaultWorkspaceProps > & { workspaceTitle? : string } |
Props to pass to the workspace component being launched. Passing a prop named workspaceTitle will override the title of the workspace. |
void
packages/framework/esm-styleguide/src/workspaces/workspaces.ts:297
▸ launchWorkspaceGroup(groupName
, args
): void
Launches a workspace group with the specified name and configuration. If there are any open workspaces, it will first close them before launching the new workspace group.
example
launchWorkspaceGroup("myGroup", {
state: initialState,
onWorkspaceGroupLaunch: () => console.log("Workspace group launched"),
workspaceGroupCleanup: () => console.log("Cleaning up workspace group")
});
Name | Type | Description |
---|---|---|
groupName |
string |
The name of the workspace group to launch |
args |
LaunchWorkspaceGroupArg |
Configuration object for launching the workspace group |
void
packages/framework/esm-styleguide/src/workspaces/workspaces.ts:211
▸ navigateAndLaunchWorkspace(__namedParameters
): void
Use this function to navigate to a new page and launch a workspace on that page.
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.additionalProps? |
object |
__namedParameters.contextKey |
string |
__namedParameters.targetUrl |
string |
__namedParameters.workspaceName |
string |
void
packages/framework/esm-styleguide/src/workspaces/workspaces.ts:390
▸ useWorkspaces(): WorkspacesInfo
packages/framework/esm-styleguide/src/workspaces/workspaces.ts:544