@openmrs/esm-react-utils 6.3.1-pre.3105 → 6.3.1-pre.3106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/ComponentContext.d.ts +1 -0
- package/dist/ConfigurableLink.d.ts +6 -3
- package/dist/ConfigurableLink.js +6 -0
- package/dist/ExtensionSlot.d.ts +28 -18
- package/dist/ExtensionSlot.js +17 -0
- package/dist/useAttachments.d.ts +1 -1
- package/dist/useEmrConfiguration.d.ts +1 -1
- package/dist/useExtensionInternalStore.d.ts +1 -1
- package/dist/useExtensionStore.d.ts +1 -1
- package/dist/useFhirFetchAll.d.ts +1 -0
- package/dist/useFhirInfinite.d.ts +1 -0
- package/dist/useFhirPagination.d.ts +3 -1
- package/dist/useLayoutType.d.ts +1 -1
- package/dist/useOnClickOutside.d.ts +1 -0
- package/dist/useOpenmrsPagination.d.ts +3 -2
- package/dist/useOpenmrsSWR.d.ts +1 -1
- package/dist/usePatient.d.ts +1 -0
- package/dist/useStore.d.ts +1 -1
- package/package.json +12 -12
- package/src/ConfigurableLink.tsx +6 -3
- package/src/ExtensionSlot.tsx +30 -20
- package/src/useVisit.ts +1 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -5,14 +5,17 @@ import { type TemplateParams } from '@openmrs/esm-navigation';
|
|
|
5
5
|
* @noInheritDoc
|
|
6
6
|
*/
|
|
7
7
|
export interface ConfigurableLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
8
|
-
/** The target path or URL. Supports interpolation. See [[navigate]] */
|
|
9
8
|
to: string;
|
|
10
|
-
/** A dictionary of values to interpolate into the URL, in addition to the default keys `openmrsBase` and `openmrsSpaBase`. */
|
|
11
9
|
templateParams?: TemplateParams;
|
|
12
|
-
/** A callback to be called just before navigation occurs */
|
|
13
10
|
onBeforeNavigate?: (event: MouseEvent) => void;
|
|
14
11
|
}
|
|
15
12
|
/**
|
|
16
13
|
* A React link component which calls [[navigate]] when clicked
|
|
14
|
+
*
|
|
15
|
+
* @param to The target path or URL. Supports interpolation. See [[navigate]]
|
|
16
|
+
* @param templateParams: A dictionary of values to interpolate into the URL, in addition to the default keys `openmrsBase` and `openmrsSpaBase`.
|
|
17
|
+
* @param onBeforeNavigate A callback to be called just before navigation occurs
|
|
18
|
+
* @param children Inline elements within the link
|
|
19
|
+
* @param otherProps Any other valid props for an <a> tag except `href` and `onClick`
|
|
17
20
|
*/
|
|
18
21
|
export declare function ConfigurableLink({ to, templateParams, onBeforeNavigate, children, ...otherProps }: PropsWithChildren<ConfigurableLinkProps>): React.JSX.Element;
|
package/dist/ConfigurableLink.js
CHANGED
|
@@ -25,6 +25,12 @@ function handleClick(event, to, templateParams, onBeforeNavigate) {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* A React link component which calls [[navigate]] when clicked
|
|
28
|
+
*
|
|
29
|
+
* @param to The target path or URL. Supports interpolation. See [[navigate]]
|
|
30
|
+
* @param templateParams: A dictionary of values to interpolate into the URL, in addition to the default keys `openmrsBase` and `openmrsSpaBase`.
|
|
31
|
+
* @param onBeforeNavigate A callback to be called just before navigation occurs
|
|
32
|
+
* @param children Inline elements within the link
|
|
33
|
+
* @param otherProps Any other valid props for an <a> tag except `href` and `onClick`
|
|
28
34
|
*/ export function ConfigurableLink({ to, templateParams, onBeforeNavigate, children, ...otherProps }) {
|
|
29
35
|
useEffect(()=>{
|
|
30
36
|
if (otherProps.href) {
|
package/dist/ExtensionSlot.d.ts
CHANGED
|
@@ -2,34 +2,44 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { type AssignedExtension } from '@openmrs/esm-extensions';
|
|
4
4
|
export interface ExtensionSlotBaseProps {
|
|
5
|
-
/** The name of the extension slot */
|
|
6
5
|
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* The name of the extension slot
|
|
9
|
-
* @deprecated Use `name`
|
|
10
|
-
*/
|
|
6
|
+
/** @deprecated Use `name` */
|
|
11
7
|
extensionSlotName?: string;
|
|
12
|
-
/**
|
|
13
|
-
* An optional function for filtering or otherwise modifying
|
|
14
|
-
* the list of extensions that will be rendered.
|
|
15
|
-
*/
|
|
16
8
|
select?: (extensions: Array<AssignedExtension>) => Array<AssignedExtension>;
|
|
17
|
-
|
|
18
|
-
*Only works if no children are provided*. Passes data
|
|
19
|
-
* through as props to the extensions that are mounted here. If `ExtensionSlot`
|
|
20
|
-
* has children, you must pass the state through the `state` param of the
|
|
21
|
-
* `Extension` component.
|
|
22
|
-
*/
|
|
23
|
-
state?: Record<string | number | symbol, unknown>;
|
|
9
|
+
state?: Record<string, unknown>;
|
|
24
10
|
}
|
|
25
|
-
export interface
|
|
26
|
-
|
|
11
|
+
export interface OldExtensionSlotBaseProps {
|
|
12
|
+
name?: string;
|
|
13
|
+
/** @deprecated Use `name` */
|
|
14
|
+
extensionSlotName: string;
|
|
15
|
+
select?: (extensions: Array<AssignedExtension>) => Array<AssignedExtension>;
|
|
16
|
+
state?: Record<string, unknown>;
|
|
27
17
|
}
|
|
18
|
+
export type ExtensionSlotProps = (OldExtensionSlotBaseProps | ExtensionSlotBaseProps) & Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
19
|
+
children?: React.ReactNode | ((extension: AssignedExtension, state?: Record<string, unknown>) => React.ReactNode);
|
|
20
|
+
};
|
|
28
21
|
/**
|
|
29
22
|
* An [extension slot](https://o3-docs.openmrs.org/docs/extension-system).
|
|
30
23
|
* A place with a name. Extensions that get connected to that name
|
|
31
24
|
* will be rendered into this.
|
|
32
25
|
*
|
|
26
|
+
* @param props.name The name of the extension slot
|
|
27
|
+
* @param props.select An optional function for filtering or otherwise modifying
|
|
28
|
+
* the list of extensions that will be rendered.
|
|
29
|
+
* @param props.state *Only works if no children are provided*. Passes data
|
|
30
|
+
* through as props to the extensions that are mounted here. If `ExtensionSlot`
|
|
31
|
+
* has children, you must pass the state through the `state` param of the
|
|
32
|
+
* `Extension` component.
|
|
33
|
+
* @param props.children There are two different ways to use `ExtensionSlot`
|
|
34
|
+
* children.
|
|
35
|
+
* - Passing a `ReactNode`, the "normal" way. The child must contain the component
|
|
36
|
+
* `Extension`. Whatever is passed as the child will be rendered once per extension.
|
|
37
|
+
* See the first example below.
|
|
38
|
+
* - Passing a function, the "render props" way. The child must be a function
|
|
39
|
+
* which takes a [[ConnectedExtension]] as argument and returns a `ReactNode`.
|
|
40
|
+
* the resulting react node must contain the component `Extension`. It will
|
|
41
|
+
* be run for each extension. See the second example below.
|
|
42
|
+
*
|
|
33
43
|
* @example
|
|
34
44
|
* Passing a react node as children
|
|
35
45
|
*
|
package/dist/ExtensionSlot.js
CHANGED
|
@@ -10,6 +10,23 @@ function defaultSelect(extensions) {
|
|
|
10
10
|
* A place with a name. Extensions that get connected to that name
|
|
11
11
|
* will be rendered into this.
|
|
12
12
|
*
|
|
13
|
+
* @param props.name The name of the extension slot
|
|
14
|
+
* @param props.select An optional function for filtering or otherwise modifying
|
|
15
|
+
* the list of extensions that will be rendered.
|
|
16
|
+
* @param props.state *Only works if no children are provided*. Passes data
|
|
17
|
+
* through as props to the extensions that are mounted here. If `ExtensionSlot`
|
|
18
|
+
* has children, you must pass the state through the `state` param of the
|
|
19
|
+
* `Extension` component.
|
|
20
|
+
* @param props.children There are two different ways to use `ExtensionSlot`
|
|
21
|
+
* children.
|
|
22
|
+
* - Passing a `ReactNode`, the "normal" way. The child must contain the component
|
|
23
|
+
* `Extension`. Whatever is passed as the child will be rendered once per extension.
|
|
24
|
+
* See the first example below.
|
|
25
|
+
* - Passing a function, the "render props" way. The child must be a function
|
|
26
|
+
* which takes a [[ConnectedExtension]] as argument and returns a `ReactNode`.
|
|
27
|
+
* the resulting react node must contain the component `Extension`. It will
|
|
28
|
+
* be run for each extension. See the second example below.
|
|
29
|
+
*
|
|
13
30
|
* @example
|
|
14
31
|
* Passing a react node as children
|
|
15
32
|
*
|
package/dist/useAttachments.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare function useAttachments(patientUuid: string, includeEncounterless
|
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
data: AttachmentResponse[];
|
|
6
6
|
error: any;
|
|
7
|
-
mutate: import("swr").KeyedMutator<FetchResponse<{
|
|
7
|
+
mutate: import("swr/dist/_internal").KeyedMutator<FetchResponse<{
|
|
8
8
|
results: Array<AttachmentResponse>;
|
|
9
9
|
}>>;
|
|
10
10
|
isValidating: boolean;
|
|
@@ -91,7 +91,7 @@ export interface EmrApiConfigurationResponse {
|
|
|
91
91
|
export declare function useEmrConfiguration(): {
|
|
92
92
|
emrConfiguration: EmrApiConfigurationResponse | undefined;
|
|
93
93
|
isLoadingEmrConfiguration: boolean;
|
|
94
|
-
mutateEmrConfiguration: import("swr").KeyedMutator<FetchResponse<EmrApiConfigurationResponse>>;
|
|
94
|
+
mutateEmrConfiguration: import("swr/dist/_internal").KeyedMutator<FetchResponse<EmrApiConfigurationResponse>>;
|
|
95
95
|
errorFetchingEmrConfiguration: Error | undefined;
|
|
96
96
|
};
|
|
97
97
|
export {};
|
|
@@ -5,5 +5,5 @@ import type { ExtensionInternalStore } from '@openmrs/esm-extensions';
|
|
|
5
5
|
export declare const useExtensionInternalStore: {
|
|
6
6
|
(): ExtensionInternalStore;
|
|
7
7
|
<A extends import("./useStore").Actions<ExtensionInternalStore>>(actions: A): ExtensionInternalStore & import("./useStore").BoundActions<ExtensionInternalStore, A>;
|
|
8
|
-
<
|
|
8
|
+
<A_1 extends import("./useStore").Actions<ExtensionInternalStore>>(actions?: A_1 | undefined): ExtensionInternalStore & import("./useStore").BoundActions<ExtensionInternalStore, A_1>;
|
|
9
9
|
};
|
|
@@ -3,5 +3,5 @@ import { type ExtensionStore } from '@openmrs/esm-extensions';
|
|
|
3
3
|
export declare const useExtensionStore: {
|
|
4
4
|
(): ExtensionStore;
|
|
5
5
|
<A extends import("./useStore").Actions<ExtensionStore>>(actions: A): ExtensionStore & import("./useStore").BoundActions<ExtensionStore, A>;
|
|
6
|
-
<
|
|
6
|
+
<A_1 extends import("./useStore").Actions<ExtensionStore>>(actions?: A_1 | undefined): ExtensionStore & import("./useStore").BoundActions<ExtensionStore, A_1>;
|
|
7
7
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="fhir" />
|
|
2
|
+
/// <reference types="react" />
|
|
1
3
|
/** @module @category UI */
|
|
2
4
|
import { type FetchResponse } from '@openmrs/esm-api';
|
|
3
5
|
import { type ServerPaginationHandlers, type UseServerPaginationOptions } from './useOpenmrsPagination';
|
|
@@ -21,7 +23,7 @@ import { type ServerPaginationHandlers, type UseServerPaginationOptions } from '
|
|
|
21
23
|
*/
|
|
22
24
|
export declare function useFhirPagination<T extends fhir.ResourceBase>(url: string | URL, pageSize: number, options?: UseServerPaginationOptions<fhir.Bundle>): {
|
|
23
25
|
error: any;
|
|
24
|
-
mutate: import("swr").KeyedMutator<FetchResponse<fhir.Bundle>>;
|
|
26
|
+
mutate: import("swr/dist/_internal").KeyedMutator<FetchResponse<fhir.Bundle>>;
|
|
25
27
|
isValidating: boolean;
|
|
26
28
|
isLoading: boolean;
|
|
27
29
|
data: T[] | undefined;
|
package/dist/useLayoutType.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type LayoutType = 'phone' | 'tablet' | 'small-desktop' | 'large-desktop';
|
|
2
2
|
export declare function useLayoutType(): LayoutType;
|
|
3
|
-
export declare const isDesktop: (layout: LayoutType) =>
|
|
3
|
+
export declare const isDesktop: (layout: LayoutType) => boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/** @module @category UI */
|
|
2
3
|
import { type FetchResponse } from '@openmrs/esm-api';
|
|
3
4
|
import { type SWRConfiguration } from 'swr';
|
|
@@ -54,7 +55,7 @@ export interface UseServerPaginationOptions<R> {
|
|
|
54
55
|
*/
|
|
55
56
|
export declare function useOpenmrsPagination<T>(url: string | URL, pageSize: number, options?: UseServerPaginationOptions<OpenMRSPaginatedResponse<T>>): {
|
|
56
57
|
error: any;
|
|
57
|
-
mutate: import("swr").KeyedMutator<FetchResponse<OpenMRSPaginatedResponse<T>>>;
|
|
58
|
+
mutate: import("swr/dist/_internal").KeyedMutator<FetchResponse<OpenMRSPaginatedResponse<T>>>;
|
|
58
59
|
isValidating: boolean;
|
|
59
60
|
isLoading: boolean;
|
|
60
61
|
data: T[] | undefined;
|
|
@@ -80,7 +81,7 @@ export interface ServerPaginationHandlers<T, R> {
|
|
|
80
81
|
}
|
|
81
82
|
export declare function useServerPagination<T, R>(url: string | URL, pageSize: number, serverPaginationHandlers: ServerPaginationHandlers<T, R>, options?: UseServerPaginationOptions<R>): {
|
|
82
83
|
error: any;
|
|
83
|
-
mutate: import("swr").KeyedMutator<FetchResponse<R>>;
|
|
84
|
+
mutate: import("swr/dist/_internal").KeyedMutator<FetchResponse<R>>;
|
|
84
85
|
isValidating: boolean;
|
|
85
86
|
isLoading: boolean;
|
|
86
87
|
data: T[] | undefined;
|
package/dist/useOpenmrsSWR.d.ts
CHANGED
|
@@ -47,4 +47,4 @@ export type UseOpenmrsSWROptions = {
|
|
|
47
47
|
* @param options An object of optional parameters to provide, including a {@link FetchConfig} object
|
|
48
48
|
* to pass to {@link openmrsFetch} or options to pass to SWR
|
|
49
49
|
*/
|
|
50
|
-
export declare function useOpenmrsSWR<DataType = any, ErrorType = any>(key: Key, options?: UseOpenmrsSWROptions): import("swr").SWRResponse<FetchResponse<DataType>, ErrorType, SWRConfiguration<FetchResponse<DataType>, ErrorType, import("swr").BareFetcher<FetchResponse<DataType>>> | undefined>;
|
|
50
|
+
export declare function useOpenmrsSWR<DataType = any, ErrorType = any>(key: Key, options?: UseOpenmrsSWROptions): import("swr/dist/_internal").SWRResponse<FetchResponse<DataType>, ErrorType, SWRConfiguration<FetchResponse<DataType>, ErrorType, import("swr/dist/_internal").BareFetcher<FetchResponse<DataType>>> | undefined>;
|
package/dist/usePatient.d.ts
CHANGED
package/dist/useStore.d.ts
CHANGED
|
@@ -25,6 +25,6 @@ declare function useStoreWithActions<T, A extends Actions<T>>(store: StoreApi<T>
|
|
|
25
25
|
declare function createUseStore<T>(store: StoreApi<T>): {
|
|
26
26
|
(): T;
|
|
27
27
|
<A extends Actions<T>>(actions: A): T & BoundActions<T, A>;
|
|
28
|
-
<
|
|
28
|
+
<A_1 extends Actions<T>>(actions?: A_1 | undefined): T & BoundActions<T, A_1>;
|
|
29
29
|
};
|
|
30
30
|
export { createUseStore, useStore, useStoreWithActions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-react-utils",
|
|
3
|
-
"version": "6.3.1-pre.
|
|
3
|
+
"version": "6.3.1-pre.3106",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "React utilities for OpenMRS.",
|
|
6
6
|
"type": "module",
|
|
@@ -78,17 +78,17 @@
|
|
|
78
78
|
"swr": "2.x"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@openmrs/esm-api": "6.3.1-pre.
|
|
82
|
-
"@openmrs/esm-config": "6.3.1-pre.
|
|
83
|
-
"@openmrs/esm-context": "6.3.1-pre.
|
|
84
|
-
"@openmrs/esm-emr-api": "6.3.1-pre.
|
|
85
|
-
"@openmrs/esm-error-handling": "6.3.1-pre.
|
|
86
|
-
"@openmrs/esm-extensions": "6.3.1-pre.
|
|
87
|
-
"@openmrs/esm-feature-flags": "6.3.1-pre.
|
|
88
|
-
"@openmrs/esm-globals": "6.3.1-pre.
|
|
89
|
-
"@openmrs/esm-navigation": "6.3.1-pre.
|
|
90
|
-
"@openmrs/esm-state": "6.3.1-pre.
|
|
91
|
-
"@openmrs/esm-utils": "6.3.1-pre.
|
|
81
|
+
"@openmrs/esm-api": "6.3.1-pre.3106",
|
|
82
|
+
"@openmrs/esm-config": "6.3.1-pre.3106",
|
|
83
|
+
"@openmrs/esm-context": "6.3.1-pre.3106",
|
|
84
|
+
"@openmrs/esm-emr-api": "6.3.1-pre.3106",
|
|
85
|
+
"@openmrs/esm-error-handling": "6.3.1-pre.3106",
|
|
86
|
+
"@openmrs/esm-extensions": "6.3.1-pre.3106",
|
|
87
|
+
"@openmrs/esm-feature-flags": "6.3.1-pre.3106",
|
|
88
|
+
"@openmrs/esm-globals": "6.3.1-pre.3106",
|
|
89
|
+
"@openmrs/esm-navigation": "6.3.1-pre.3106",
|
|
90
|
+
"@openmrs/esm-state": "6.3.1-pre.3106",
|
|
91
|
+
"@openmrs/esm-utils": "6.3.1-pre.3106",
|
|
92
92
|
"@swc/cli": "^0.7.7",
|
|
93
93
|
"@swc/core": "^1.11.29",
|
|
94
94
|
"concurrently": "^9.1.2",
|
package/src/ConfigurableLink.tsx
CHANGED
|
@@ -35,16 +35,19 @@ function handleClick(
|
|
|
35
35
|
* @noInheritDoc
|
|
36
36
|
*/
|
|
37
37
|
export interface ConfigurableLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
38
|
-
/** The target path or URL. Supports interpolation. See [[navigate]] */
|
|
39
38
|
to: string;
|
|
40
|
-
/** A dictionary of values to interpolate into the URL, in addition to the default keys `openmrsBase` and `openmrsSpaBase`. */
|
|
41
39
|
templateParams?: TemplateParams;
|
|
42
|
-
/** A callback to be called just before navigation occurs */
|
|
43
40
|
onBeforeNavigate?: (event: MouseEvent) => void;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
/**
|
|
47
44
|
* A React link component which calls [[navigate]] when clicked
|
|
45
|
+
*
|
|
46
|
+
* @param to The target path or URL. Supports interpolation. See [[navigate]]
|
|
47
|
+
* @param templateParams: A dictionary of values to interpolate into the URL, in addition to the default keys `openmrsBase` and `openmrsSpaBase`.
|
|
48
|
+
* @param onBeforeNavigate A callback to be called just before navigation occurs
|
|
49
|
+
* @param children Inline elements within the link
|
|
50
|
+
* @param otherProps Any other valid props for an <a> tag except `href` and `onClick`
|
|
48
51
|
*/
|
|
49
52
|
export function ConfigurableLink({
|
|
50
53
|
to,
|
package/src/ExtensionSlot.tsx
CHANGED
|
@@ -6,33 +6,26 @@ import { Extension } from './Extension';
|
|
|
6
6
|
import { useExtensionSlot } from './useExtensionSlot';
|
|
7
7
|
|
|
8
8
|
export interface ExtensionSlotBaseProps {
|
|
9
|
-
/** The name of the extension slot */
|
|
10
9
|
name: string;
|
|
11
|
-
/**
|
|
12
|
-
* The name of the extension slot
|
|
13
|
-
* @deprecated Use `name`
|
|
14
|
-
*/
|
|
10
|
+
/** @deprecated Use `name` */
|
|
15
11
|
extensionSlotName?: string;
|
|
16
|
-
/**
|
|
17
|
-
* An optional function for filtering or otherwise modifying
|
|
18
|
-
* the list of extensions that will be rendered.
|
|
19
|
-
*/
|
|
20
12
|
select?: (extensions: Array<AssignedExtension>) => Array<AssignedExtension>;
|
|
21
|
-
|
|
22
|
-
*Only works if no children are provided*. Passes data
|
|
23
|
-
* through as props to the extensions that are mounted here. If `ExtensionSlot`
|
|
24
|
-
* has children, you must pass the state through the `state` param of the
|
|
25
|
-
* `Extension` component.
|
|
26
|
-
*/
|
|
27
|
-
state?: Record<string | number | symbol, unknown>;
|
|
13
|
+
state?: Record<string, unknown>;
|
|
28
14
|
}
|
|
29
15
|
|
|
30
|
-
export interface
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
export interface OldExtensionSlotBaseProps {
|
|
17
|
+
name?: string;
|
|
18
|
+
/** @deprecated Use `name` */
|
|
19
|
+
extensionSlotName: string;
|
|
20
|
+
select?: (extensions: Array<AssignedExtension>) => Array<AssignedExtension>;
|
|
21
|
+
state?: Record<string, unknown>;
|
|
34
22
|
}
|
|
35
23
|
|
|
24
|
+
export type ExtensionSlotProps = (OldExtensionSlotBaseProps | ExtensionSlotBaseProps) &
|
|
25
|
+
Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
26
|
+
children?: React.ReactNode | ((extension: AssignedExtension, state?: Record<string, unknown>) => React.ReactNode);
|
|
27
|
+
};
|
|
28
|
+
|
|
36
29
|
function defaultSelect(extensions: Array<AssignedExtension>) {
|
|
37
30
|
return extensions;
|
|
38
31
|
}
|
|
@@ -42,6 +35,23 @@ function defaultSelect(extensions: Array<AssignedExtension>) {
|
|
|
42
35
|
* A place with a name. Extensions that get connected to that name
|
|
43
36
|
* will be rendered into this.
|
|
44
37
|
*
|
|
38
|
+
* @param props.name The name of the extension slot
|
|
39
|
+
* @param props.select An optional function for filtering or otherwise modifying
|
|
40
|
+
* the list of extensions that will be rendered.
|
|
41
|
+
* @param props.state *Only works if no children are provided*. Passes data
|
|
42
|
+
* through as props to the extensions that are mounted here. If `ExtensionSlot`
|
|
43
|
+
* has children, you must pass the state through the `state` param of the
|
|
44
|
+
* `Extension` component.
|
|
45
|
+
* @param props.children There are two different ways to use `ExtensionSlot`
|
|
46
|
+
* children.
|
|
47
|
+
* - Passing a `ReactNode`, the "normal" way. The child must contain the component
|
|
48
|
+
* `Extension`. Whatever is passed as the child will be rendered once per extension.
|
|
49
|
+
* See the first example below.
|
|
50
|
+
* - Passing a function, the "render props" way. The child must be a function
|
|
51
|
+
* which takes a [[ConnectedExtension]] as argument and returns a `ReactNode`.
|
|
52
|
+
* the resulting react node must contain the component `Extension`. It will
|
|
53
|
+
* be run for each extension. See the second example below.
|
|
54
|
+
*
|
|
45
55
|
* @example
|
|
46
56
|
* Passing a react node as children
|
|
47
57
|
*
|
package/src/useVisit.ts
CHANGED
|
@@ -83,13 +83,7 @@ export function useVisit(patientUuid: string, representation = defaultVisitCusto
|
|
|
83
83
|
if (!retroIsValidating) {
|
|
84
84
|
// if the current visit happened to be active but it just got ended (inactive), remove the
|
|
85
85
|
// visit from context
|
|
86
|
-
if (
|
|
87
|
-
previousCurrentVisit.current &&
|
|
88
|
-
currentVisit &&
|
|
89
|
-
previousCurrentVisit.current.uuid === currentVisit.uuid &&
|
|
90
|
-
!previousCurrentVisit.current.stopDatetime &&
|
|
91
|
-
currentVisit.stopDatetime
|
|
92
|
-
) {
|
|
86
|
+
if (previousCurrentVisit.current && currentVisit && previousCurrentVisit.current.uuid === currentVisit.uuid && !previousCurrentVisit.current.stopDatetime && currentVisit.stopDatetime) {
|
|
93
87
|
setVisitContext(null);
|
|
94
88
|
}
|
|
95
89
|
previousCurrentVisit.current = currentVisit;
|