@medplum/react 2.0.20 → 2.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +51 -29
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.min.cjs +1 -1
- package/dist/esm/AppShell/AppShell.mjs +2 -2
- package/dist/esm/AppShell/AppShell.mjs.map +1 -1
- package/dist/esm/AppShell/Header.mjs +1 -1
- package/dist/esm/AppShell/Header.mjs.map +1 -1
- package/dist/esm/AppShell/HeaderSearchInput.mjs +1 -1
- package/dist/esm/AppShell/HeaderSearchInput.mjs.map +1 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +2 -1
- package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
- package/dist/esm/GoogleButton/GoogleButton.mjs +2 -2
- package/dist/esm/GoogleButton/GoogleButton.mjs.map +1 -1
- package/dist/esm/MedplumProvider/MedplumProvider.mjs +8 -0
- package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +1 -1
- package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs +1 -1
- package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
- package/dist/esm/Timeline/Timeline.mjs +2 -1
- package/dist/esm/Timeline/Timeline.mjs.map +1 -1
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +11 -5
- package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
- package/dist/esm/auth/SignInForm.mjs +8 -4
- package/dist/esm/auth/SignInForm.mjs.map +1 -1
- package/dist/esm/index.min.mjs +1 -1
- package/dist/esm/utils/date.mjs +9 -6
- package/dist/esm/utils/date.mjs.map +1 -1
- package/dist/types/AppShell/Header.d.ts +2 -0
- package/dist/types/AppShell/HeaderSearchInput.d.ts +1 -0
- package/dist/types/Timeline/Timeline.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/utils/date.mjs
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
function sortByDateAndPriority(resources, timelineResource) {
|
|
7
7
|
resources.sort((a, b) => {
|
|
8
|
-
const priority1 = getPriorityScore(a);
|
|
9
|
-
const priority2 = getPriorityScore(b);
|
|
8
|
+
const priority1 = getPriorityScore(a, timelineResource);
|
|
9
|
+
const priority2 = getPriorityScore(b, timelineResource);
|
|
10
10
|
if (priority1 > priority2) {
|
|
11
11
|
return 1;
|
|
12
12
|
}
|
|
@@ -16,10 +16,13 @@ function sortByDateAndPriority(resources, timelineResource) {
|
|
|
16
16
|
return getTime(a, timelineResource) - getTime(b, timelineResource);
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function getPriorityScore(resource) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function getPriorityScore(resource, timelineResource) {
|
|
20
|
+
if (!isSameResourceType(resource, timelineResource)) {
|
|
21
|
+
// Only use priority if not the primary resource of a timeline view.
|
|
22
|
+
const priority = resource.priority;
|
|
23
|
+
if (typeof priority === 'string') {
|
|
24
|
+
return { stat: 4, asap: 3, urgent: 2 }[priority] || 0;
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
return 0;
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.mjs","sources":["../../../src/utils/date.ts"],"sourcesContent":["import { Resource } from '@medplum/fhirtypes';\n\n/**\n * Sorts an array of resources in place by meta.lastUpdated ascending.\n * @param resources Array of resources.\n * @param timelineResource Optional primary resource of a timeline view. If specified, the primary resource will be sorted by meta.lastUpdated descending.\n */\nexport function sortByDateAndPriority(resources: Resource[], timelineResource?: Resource): void {\n resources.sort((a: Resource, b: Resource): number => {\n const priority1 = getPriorityScore(a);\n const priority2 = getPriorityScore(b);\n if (priority1 > priority2) {\n return 1;\n }\n if (priority1 < priority2) {\n return -1;\n }\n return getTime(a, timelineResource) - getTime(b, timelineResource);\n });\n}\n\nfunction getPriorityScore(resource: Resource): number {\n const priority = (resource as any).priority;\n
|
|
1
|
+
{"version":3,"file":"date.mjs","sources":["../../../src/utils/date.ts"],"sourcesContent":["import { Resource } from '@medplum/fhirtypes';\n\n/**\n * Sorts an array of resources in place by meta.lastUpdated ascending.\n * @param resources Array of resources.\n * @param timelineResource Optional primary resource of a timeline view. If specified, the primary resource will be sorted by meta.lastUpdated descending.\n */\nexport function sortByDateAndPriority(resources: Resource[], timelineResource?: Resource): void {\n resources.sort((a: Resource, b: Resource): number => {\n const priority1 = getPriorityScore(a, timelineResource);\n const priority2 = getPriorityScore(b, timelineResource);\n if (priority1 > priority2) {\n return 1;\n }\n if (priority1 < priority2) {\n return -1;\n }\n return getTime(a, timelineResource) - getTime(b, timelineResource);\n });\n}\n\nfunction getPriorityScore(resource: Resource, timelineResource: Resource | undefined): number {\n if (!isSameResourceType(resource, timelineResource)) {\n // Only use priority if not the primary resource of a timeline view.\n\n const priority = (resource as any).priority;\n if (typeof priority === 'string') {\n return { stat: 4, asap: 3, urgent: 2 }[priority] || 0;\n }\n }\n return 0;\n}\n\nfunction getTime(resource: Resource, timelineResource: Resource | undefined): number {\n if (!isSameResourceType(resource, timelineResource)) {\n // Only use special case timestamps if not the primary resource of a timeline view.\n\n if (resource.resourceType === 'Communication' && resource.sent) {\n return new Date(resource.sent).getTime();\n }\n\n if (\n (resource.resourceType === 'DiagnosticReport' ||\n resource.resourceType === 'Media' ||\n resource.resourceType === 'Observation') &&\n resource.issued\n ) {\n return new Date(resource.issued).getTime();\n }\n\n if (resource.resourceType === 'DocumentReference' && resource.date) {\n return new Date(resource.date).getTime();\n }\n }\n\n const dateTime = resource.meta?.lastUpdated;\n if (!dateTime) {\n return 0;\n }\n return new Date(dateTime).getTime();\n}\n\nfunction isSameResourceType(a: Resource, b: Resource | undefined): boolean {\n return !!b && a.resourceType === b.resourceType && a.id ===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AAO,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AAC1C,SAAA;AAED,QAAA,IACE,CAAC,QAAQ,CAAC,YAAY,KAAK,kBAAkB;YAC3C,QAAQ,CAAC,YAAY,KAAK,OAAO;AACjC,YAAA,QAAQ,CAAC,YAAY,KAAK,aAAa;YACzC,QAAQ,CAAC,MAAM,EACf;YACA,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;AAC5C,SAAA;QAED,IAAI,QAAQ,CAAC,YAAY,KAAK,mBAAmB,IAAI,QAAQ,CAAC,IAAI,EAAE;YAClE,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AAC1C,SAAA;AACF,KAAA;AAED,IAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC5C,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,CAAC,CAAC;AACV,KAAA;IACD,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,kBAAkB,CAAC,CAAW,EAAE,CAAuB,EAAA;AAC9D,IAAA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AACnE;;;;"}
|
|
@@ -3,5 +3,6 @@ import { Patient, ServiceRequest } from '@medplum/fhirtypes';
|
|
|
3
3
|
export type HeaderSearchTypes = Patient | ServiceRequest;
|
|
4
4
|
export interface HeaderSearchInputProps {
|
|
5
5
|
pathname?: string;
|
|
6
|
+
searchParams?: URLSearchParams;
|
|
6
7
|
}
|
|
7
8
|
export declare function HeaderSearchInput(props: HeaderSearchInputProps): JSX.Element;
|