@medplum/react 0.9.30 → 0.9.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cjs/auth/AuthenticationForm.d.ts +14 -0
  2. package/dist/cjs/auth/ChooseProfileForm.d.ts +8 -0
  3. package/dist/cjs/auth/NewProjectForm.d.ts +7 -0
  4. package/dist/cjs/auth/NewUserForm.d.ts +10 -0
  5. package/dist/cjs/auth/RegisterForm.d.ts +12 -0
  6. package/dist/cjs/{SignInForm.d.ts → auth/SignInForm.d.ts} +1 -1
  7. package/dist/cjs/index.d.ts +2 -2
  8. package/dist/cjs/index.js +671 -648
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/index.min.js +1 -1
  11. package/dist/cjs/index.min.js.map +1 -1
  12. package/dist/cjs/styles.css +197 -197
  13. package/dist/esm/MedplumLink.js +29 -14
  14. package/dist/esm/MedplumLink.js.map +1 -1
  15. package/dist/esm/ResourceHistoryTable.js +15 -11
  16. package/dist/esm/ResourceHistoryTable.js.map +1 -1
  17. package/dist/esm/ResourceTimeline.js +3 -1
  18. package/dist/esm/ResourceTimeline.js.map +1 -1
  19. package/dist/esm/auth/AuthenticationForm.d.ts +14 -0
  20. package/dist/esm/auth/AuthenticationForm.js +67 -0
  21. package/dist/esm/auth/AuthenticationForm.js.map +1 -0
  22. package/dist/esm/auth/ChooseProfileForm.d.ts +8 -0
  23. package/dist/esm/auth/ChooseProfileForm.js +32 -0
  24. package/dist/esm/auth/ChooseProfileForm.js.map +1 -0
  25. package/dist/esm/auth/NewProjectForm.d.ts +7 -0
  26. package/dist/esm/auth/NewProjectForm.js +42 -0
  27. package/dist/esm/auth/NewProjectForm.js.map +1 -0
  28. package/dist/esm/auth/NewUserForm.d.ts +10 -0
  29. package/dist/esm/auth/NewUserForm.js +87 -0
  30. package/dist/esm/auth/NewUserForm.js.map +1 -0
  31. package/dist/esm/auth/RegisterForm.d.ts +12 -0
  32. package/dist/esm/auth/RegisterForm.js +39 -0
  33. package/dist/esm/auth/RegisterForm.js.map +1 -0
  34. package/dist/esm/{SignInForm.d.ts → auth/SignInForm.d.ts} +1 -1
  35. package/dist/esm/auth/SignInForm.js +52 -0
  36. package/dist/esm/auth/SignInForm.js.map +1 -0
  37. package/dist/esm/index.d.ts +2 -2
  38. package/dist/esm/index.js +2 -2
  39. package/dist/esm/index.min.js +1 -1
  40. package/dist/esm/index.min.js.map +1 -1
  41. package/dist/esm/styles.css +197 -197
  42. package/package.json +16 -18
  43. package/dist/cjs/RegisterForm.d.ts +0 -18
  44. package/dist/esm/RegisterForm.d.ts +0 -18
  45. package/dist/esm/RegisterForm.js +0 -121
  46. package/dist/esm/RegisterForm.js.map +0 -1
  47. package/dist/esm/SignInForm.js +0 -167
  48. package/dist/esm/SignInForm.js.map +0 -1
@@ -172,6 +172,203 @@ select.medplum-select:disabled {
172
172
  box-shadow: 0 0 0 2px var(--medplum-blue-200);
173
173
  }
174
174
 
175
+ .medplum-document {
176
+ margin: 20px auto 6px auto;
177
+ padding: 10px;
178
+ clear: both;
179
+ text-align: center;
180
+ }
181
+
182
+ .medplum-document article {
183
+ background-color: var(--medplum-surface);
184
+ max-width: 900px;
185
+ margin: 8px auto 16px auto;
186
+ padding: 15px 25px;
187
+ text-align: left;
188
+ border: 0.1px solid var(--medplum-gray-300);
189
+ border-radius: 8px;
190
+ box-shadow: 0 1px 3px 0 var(--medplum-shadow);
191
+ }
192
+
193
+ .medplum-document h1,
194
+ .medplum-document h2,
195
+ .medplum-document h3 {
196
+ margin: 12px 0;
197
+ }
198
+
199
+ .medplum-document p,
200
+ .medplum-document li {
201
+ line-height: 175%;
202
+ margin: 8px 0;
203
+ }
204
+
205
+ @media (max-width: 700px) {
206
+ .medplum-document {
207
+ margin: 10px auto 6px auto;
208
+ padding: 6px;
209
+ }
210
+
211
+ .medplum-document article {
212
+ padding: 6px 12px;
213
+ }
214
+ }
215
+
216
+ .medplum-document img,
217
+ .medplum-document video {
218
+ width: 100%;
219
+ }
220
+
221
+ .medplum-document textarea {
222
+ margin: 0;
223
+ min-height: 100px;
224
+ width: 100%;
225
+ }
226
+
227
+ fieldset.medplum-form-section {
228
+ border: 0;
229
+ margin: 6px 0 12px 0;
230
+ padding: 2px 0 8px 0;
231
+ }
232
+
233
+ fieldset.medplum-form-section > label,
234
+ fieldset.medplum-form-section > legend {
235
+ display: block;
236
+ margin: 1px 0 3px 0;
237
+ line-height: 1.75;
238
+ font-weight: 500;
239
+ }
240
+
241
+ fieldset.medplum-form-section > p {
242
+ margin: 1px 0 4px 0;
243
+ padding: 1px 0 4px 0;
244
+ line-height: 1.75;
245
+ }
246
+
247
+ .medplum-signin-buttons {
248
+ display: flex;
249
+ justify-content: space-between;
250
+ line-height: 32px;
251
+ }
252
+
253
+ .medplum-signin-buttons > div {
254
+ display: flex;
255
+ align-items: center;
256
+ }
257
+
258
+ .medplum-signin-buttons a {
259
+ font-size: 12px;
260
+ margin-right: 16px;
261
+ }
262
+
263
+ .medplum-signin-buttons label {
264
+ font-size: 12px;
265
+ }
266
+
267
+ .medplum-signin-google-container {
268
+ padding: 20px 0 10px 0;
269
+ margin: 20px 0 10px 0;
270
+ height: 70px;
271
+ text-align: center;
272
+ display: flex;
273
+ align-items: center;
274
+ justify-content: center;
275
+ }
276
+
277
+ .medplum-signin-separator {
278
+ padding: 12px 0;
279
+ margin: 12px 0;
280
+ overflow: hidden;
281
+ text-align: center;
282
+ font-size: var(--medplum-font-small);
283
+ }
284
+
285
+ .medplum-signin-separator::before,
286
+ .medplum-signin-separator::after {
287
+ background-color: var(--medplum-gray-400);
288
+ content: '';
289
+ display: inline-block;
290
+ height: 0.1px;
291
+ position: relative;
292
+ vertical-align: middle;
293
+ width: 50%;
294
+ }
295
+
296
+ .medplum-signin-separator::before {
297
+ right: 0.5em;
298
+ margin-left: -50%;
299
+ }
300
+
301
+ .medplum-signin-separator::after {
302
+ left: 0.5em;
303
+ margin-right: -50%;
304
+ }
305
+
306
+ .medplum-left {
307
+ text-align: left;
308
+ }
309
+
310
+ .medplum-center {
311
+ text-align: center;
312
+ }
313
+
314
+ .medplum-right {
315
+ text-align: right;
316
+ }
317
+
318
+ .medplum-avatar {
319
+ padding: 0;
320
+ width: 32px;
321
+ height: 32px;
322
+ min-width: 32px;
323
+ min-height: 32px;
324
+ line-height: 32px;
325
+ user-select: none;
326
+ border-radius: 50%;
327
+ overflow: hidden;
328
+ text-align: center;
329
+ color: var(--medplum-surface);
330
+ background-color: var(--medplum-gray-500);
331
+ font-size: 18px;
332
+ }
333
+
334
+ .medplum-avatar img {
335
+ width: 100%;
336
+ height: 100%;
337
+ object-fit: cover;
338
+ }
339
+
340
+ .medplum-avatar.xsmall {
341
+ width: 20px;
342
+ height: 20px;
343
+ min-width: 20px;
344
+ min-height: 20px;
345
+ line-height: 20px;
346
+ font-size: 10px;
347
+ }
348
+
349
+ .medplum-avatar.small {
350
+ width: 24px;
351
+ height: 24px;
352
+ min-width: 24px;
353
+ min-height: 24px;
354
+ line-height: 24px;
355
+ font-size: 11px;
356
+ }
357
+
358
+ .medplum-avatar.large {
359
+ width: 56px;
360
+ height: 56px;
361
+ min-width: 56px;
362
+ min-height: 56px;
363
+ line-height: 56px;
364
+ font-size: 28px;
365
+ }
366
+
367
+ .medplum-avatar > a {
368
+ color: var(--medplum-surface);
369
+ text-decoration: none;
370
+ }
371
+
175
372
  .medplum-autocomplete-container {
176
373
  border: 0.1px solid var(--medplum-gray-300);
177
374
  border-radius: 3px;
@@ -306,60 +503,6 @@ select.medplum-select:disabled {
306
503
  color: var(--medplum-gray-500);
307
504
  }
308
505
 
309
- .medplum-avatar {
310
- padding: 0;
311
- width: 32px;
312
- height: 32px;
313
- min-width: 32px;
314
- min-height: 32px;
315
- line-height: 32px;
316
- user-select: none;
317
- border-radius: 50%;
318
- overflow: hidden;
319
- text-align: center;
320
- color: var(--medplum-surface);
321
- background-color: var(--medplum-gray-500);
322
- font-size: 18px;
323
- }
324
-
325
- .medplum-avatar img {
326
- width: 100%;
327
- height: 100%;
328
- object-fit: cover;
329
- }
330
-
331
- .medplum-avatar.xsmall {
332
- width: 20px;
333
- height: 20px;
334
- min-width: 20px;
335
- min-height: 20px;
336
- line-height: 20px;
337
- font-size: 10px;
338
- }
339
-
340
- .medplum-avatar.small {
341
- width: 24px;
342
- height: 24px;
343
- min-width: 24px;
344
- min-height: 24px;
345
- line-height: 24px;
346
- font-size: 11px;
347
- }
348
-
349
- .medplum-avatar.large {
350
- width: 56px;
351
- height: 56px;
352
- min-width: 56px;
353
- min-height: 56px;
354
- line-height: 56px;
355
- font-size: 28px;
356
- }
357
-
358
- .medplum-avatar > a {
359
- color: var(--medplum-surface);
360
- text-decoration: none;
361
- }
362
-
363
506
  .medplum-checkbox-form-section {
364
507
  display: flex;
365
508
  justify-content: space-between;
@@ -378,26 +521,6 @@ select.medplum-select:disabled {
378
521
  font-weight: 500;
379
522
  }
380
523
 
381
- fieldset.medplum-form-section {
382
- border: 0;
383
- margin: 6px 0 12px 0;
384
- padding: 2px 0 8px 0;
385
- }
386
-
387
- fieldset.medplum-form-section > label,
388
- fieldset.medplum-form-section > legend {
389
- display: block;
390
- margin: 1px 0 3px 0;
391
- line-height: 1.75;
392
- font-weight: 500;
393
- }
394
-
395
- fieldset.medplum-form-section > p {
396
- margin: 1px 0 4px 0;
397
- padding: 1px 0 4px 0;
398
- line-height: 1.75;
399
- }
400
-
401
524
  dl.medplum-description-list {
402
525
  display: grid;
403
526
  grid-template-columns: 30% 70%;
@@ -816,58 +939,6 @@ table.medplum-diff-table td {
816
939
  margin-right: 4px;
817
940
  }
818
941
 
819
- .medplum-document {
820
- margin: 20px auto 6px auto;
821
- padding: 10px;
822
- clear: both;
823
- text-align: center;
824
- }
825
-
826
- .medplum-document article {
827
- background-color: var(--medplum-surface);
828
- max-width: 900px;
829
- margin: 8px auto 16px auto;
830
- padding: 15px 25px;
831
- text-align: left;
832
- border: 0.1px solid var(--medplum-gray-300);
833
- border-radius: 8px;
834
- box-shadow: 0 1px 3px 0 var(--medplum-shadow);
835
- }
836
-
837
- .medplum-document h1,
838
- .medplum-document h2,
839
- .medplum-document h3 {
840
- margin: 12px 0;
841
- }
842
-
843
- .medplum-document p,
844
- .medplum-document li {
845
- line-height: 175%;
846
- margin: 8px 0 16px 0;
847
- }
848
-
849
- @media (max-width: 700px) {
850
- .medplum-document {
851
- margin: 10px auto 6px auto;
852
- padding: 6px;
853
- }
854
-
855
- .medplum-document article {
856
- padding: 6px 12px;
857
- }
858
- }
859
-
860
- .medplum-document img,
861
- .medplum-document video {
862
- width: 100%;
863
- }
864
-
865
- .medplum-document textarea {
866
- margin: 0;
867
- min-height: 100px;
868
- width: 100%;
869
- }
870
-
871
942
  .medplum-search-control {
872
943
  max-width: 100%;
873
944
  overflow: auto;
@@ -1374,77 +1445,6 @@ div.medplum-nav-menu-container {
1374
1445
  color: var(--medplum-blue-500);
1375
1446
  }
1376
1447
 
1377
- .medplum-signin-buttons {
1378
- display: flex;
1379
- justify-content: space-between;
1380
- line-height: 32px;
1381
- }
1382
-
1383
- .medplum-signin-buttons > div {
1384
- display: flex;
1385
- align-items: center;
1386
- }
1387
-
1388
- .medplum-signin-buttons a {
1389
- font-size: 12px;
1390
- margin-right: 16px;
1391
- }
1392
-
1393
- .medplum-signin-buttons label {
1394
- font-size: 12px;
1395
- }
1396
-
1397
- .medplum-signin-google-container {
1398
- padding: 20px 0 10px 0;
1399
- margin: 20px 0 10px 0;
1400
- height: 70px;
1401
- text-align: center;
1402
- display: flex;
1403
- align-items: center;
1404
- justify-content: center;
1405
- }
1406
-
1407
- .medplum-signin-separator {
1408
- padding: 12px 0;
1409
- margin: 12px 0;
1410
- overflow: hidden;
1411
- text-align: center;
1412
- font-size: var(--medplum-font-small);
1413
- }
1414
-
1415
- .medplum-signin-separator::before,
1416
- .medplum-signin-separator::after {
1417
- background-color: var(--medplum-gray-400);
1418
- content: '';
1419
- display: inline-block;
1420
- height: 0.1px;
1421
- position: relative;
1422
- vertical-align: middle;
1423
- width: 50%;
1424
- }
1425
-
1426
- .medplum-signin-separator::before {
1427
- right: 0.5em;
1428
- margin-left: -50%;
1429
- }
1430
-
1431
- .medplum-signin-separator::after {
1432
- left: 0.5em;
1433
- margin-right: -50%;
1434
- }
1435
-
1436
- .medplum-left {
1437
- text-align: left;
1438
- }
1439
-
1440
- .medplum-center {
1441
- text-align: center;
1442
- }
1443
-
1444
- .medplum-right {
1445
- text-align: right;
1446
- }
1447
-
1448
1448
  .medplum-status {
1449
1449
  padding: 1px 6px;
1450
1450
  font-size: 80%;
@@ -4,20 +4,9 @@ import { killEvent } from './utils/dom.js';
4
4
 
5
5
  function MedplumLink(props) {
6
6
  const navigate = useNavigate();
7
- let href = '#';
8
- if (props.to) {
9
- if (typeof props.to === 'string') {
10
- href = props.to;
11
- }
12
- else if ('resourceType' in props.to) {
13
- href = `/${props.to.resourceType}/${props.to.id}`;
14
- }
15
- else if ('reference' in props.to) {
16
- href = `/${props.to.reference}`;
17
- }
18
- if (props.suffix) {
19
- href += '/' + props.suffix;
20
- }
7
+ let href = getHref(props.to);
8
+ if (props.suffix) {
9
+ href += '/' + props.suffix;
21
10
  }
22
11
  return (React.createElement("a", { href: href, id: props.id, "aria-label": props.label, "data-testid": props.testid || 'link', className: props.className, onClick: (e) => {
23
12
  killEvent(e);
@@ -29,6 +18,32 @@ function MedplumLink(props) {
29
18
  }
30
19
  } }, props.children));
31
20
  }
21
+ function getHref(to) {
22
+ if (to) {
23
+ if (typeof to === 'string') {
24
+ return getStringHref(to);
25
+ }
26
+ else if ('resourceType' in to) {
27
+ return getResourceHref(to);
28
+ }
29
+ else if ('reference' in to) {
30
+ return getReferenceHref(to);
31
+ }
32
+ }
33
+ return '#';
34
+ }
35
+ function getStringHref(to) {
36
+ if (to.startsWith('http://') || to.startsWith('https://') || to.startsWith('/')) {
37
+ return to;
38
+ }
39
+ return '/' + to;
40
+ }
41
+ function getResourceHref(to) {
42
+ return `/${to.resourceType}/${to.id}`;
43
+ }
44
+ function getReferenceHref(to) {
45
+ return `/${to.reference}`;
46
+ }
32
47
 
33
48
  export { MedplumLink };
34
49
  //# sourceMappingURL=MedplumLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MedplumLink.js","sources":["../../src/MedplumLink.tsx"],"sourcesContent":["import { Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { killEvent } from './utils/dom';\n\nexport interface MedplumLinkProps {\n to?: Resource | Reference | string;\n suffix?: string;\n label?: string;\n id?: string;\n testid?: string;\n className?: string;\n onClick?: () => void;\n children: React.ReactNode;\n}\n\nexport function MedplumLink(props: MedplumLinkProps): JSX.Element {\n const navigate = useNavigate();\n\n let href = '#';\n if (props.to) {\n if (typeof props.to === 'string') {\n href = props.to;\n } else if ('resourceType' in props.to) {\n href = `/${props.to.resourceType}/${props.to.id}`;\n } else if ('reference' in props.to) {\n href = `/${props.to.reference}`;\n }\n\n if (props.suffix) {\n href += '/' + props.suffix;\n }\n }\n\n return (\n <a\n href={href}\n id={props.id}\n aria-label={props.label}\n data-testid={props.testid || 'link'}\n className={props.className}\n onClick={(e: React.SyntheticEvent) => {\n killEvent(e);\n if (props.onClick) {\n props.onClick();\n } else if (props.to) {\n navigate(href);\n }\n }}\n >\n {props.children}\n </a>\n );\n}\n"],"names":[],"mappings":";;;;AAgBM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,IAAI,IAAI,GAAG,GAAG,CAAC;IACf,IAAI,KAAK,CAAC,EAAE,EAAE;AACZ,QAAA,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,EAAE;AAChC,YAAA,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;AACjB,SAAA;AAAM,aAAA,IAAI,cAAc,IAAI,KAAK,CAAC,EAAE,EAAE;AACrC,YAAA,IAAI,GAAG,CAAA,CAAA,EAAI,KAAK,CAAC,EAAE,CAAC,YAAY,CAAI,CAAA,EAAA,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;AACnD,SAAA;AAAM,aAAA,IAAI,WAAW,IAAI,KAAK,CAAC,EAAE,EAAE;YAClC,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC;AACjC,SAAA;QAED,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,YAAA,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;AAC5B,SAAA;AACF,KAAA;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,KAAK,CAAC,EAAE,EACA,YAAA,EAAA,KAAK,CAAC,KAAK,EAAA,aAAA,EACV,KAAK,CAAC,MAAM,IAAI,MAAM,EACnC,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,CAAC,CAAuB,KAAI;YACnC,SAAS,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,KAAK,CAAC,OAAO,EAAE;gBACjB,KAAK,CAAC,OAAO,EAAE,CAAC;AACjB,aAAA;iBAAM,IAAI,KAAK,CAAC,EAAE,EAAE;gBACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChB,aAAA;AACH,SAAC,IAEA,KAAK,CAAC,QAAQ,CACb,EACJ;AACJ;;;;"}
1
+ {"version":3,"file":"MedplumLink.js","sources":["../../src/MedplumLink.tsx"],"sourcesContent":["import { Reference, Resource } from '@medplum/fhirtypes';\nimport React from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { killEvent } from './utils/dom';\n\nexport interface MedplumLinkProps {\n to?: Resource | Reference | string;\n suffix?: string;\n label?: string;\n id?: string;\n testid?: string;\n className?: string;\n onClick?: () => void;\n children: React.ReactNode;\n}\n\nexport function MedplumLink(props: MedplumLinkProps): JSX.Element {\n const navigate = useNavigate();\n\n let href = getHref(props.to);\n if (props.suffix) {\n href += '/' + props.suffix;\n }\n\n return (\n <a\n href={href}\n id={props.id}\n aria-label={props.label}\n data-testid={props.testid || 'link'}\n className={props.className}\n onClick={(e: React.SyntheticEvent) => {\n killEvent(e);\n if (props.onClick) {\n props.onClick();\n } else if (props.to) {\n navigate(href);\n }\n }}\n >\n {props.children}\n </a>\n );\n}\n\nfunction getHref(to: Resource | Reference | string | undefined): string {\n if (to) {\n if (typeof to === 'string') {\n return getStringHref(to);\n } else if ('resourceType' in to) {\n return getResourceHref(to);\n } else if ('reference' in to) {\n return getReferenceHref(to);\n }\n }\n return '#';\n}\n\nfunction getStringHref(to: string): string {\n if (to.startsWith('http://') || to.startsWith('https://') || to.startsWith('/')) {\n return to;\n }\n return '/' + to;\n}\n\nfunction getResourceHref(to: Resource): string {\n return `/${to.resourceType}/${to.id}`;\n}\n\nfunction getReferenceHref(to: Reference): string {\n return `/${to.reference}`;\n}\n"],"names":[],"mappings":";;;;AAgBM,SAAU,WAAW,CAAC,KAAuB,EAAA;AACjD,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,IAAI,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,EAAE;AAChB,QAAA,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;AAC5B,KAAA;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EACE,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,KAAK,CAAC,EAAE,EACA,YAAA,EAAA,KAAK,CAAC,KAAK,EAAA,aAAA,EACV,KAAK,CAAC,MAAM,IAAI,MAAM,EACnC,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,OAAO,EAAE,CAAC,CAAuB,KAAI;YACnC,SAAS,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,KAAK,CAAC,OAAO,EAAE;gBACjB,KAAK,CAAC,OAAO,EAAE,CAAC;AACjB,aAAA;iBAAM,IAAI,KAAK,CAAC,EAAE,EAAE;gBACnB,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChB,aAAA;AACH,SAAC,IAEA,KAAK,CAAC,QAAQ,CACb,EACJ;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,EAA6C,EAAA;AAC5D,IAAA,IAAI,EAAE,EAAE;AACN,QAAA,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;AAC1B,YAAA,OAAO,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1B,SAAA;aAAM,IAAI,cAAc,IAAI,EAAE,EAAE;AAC/B,YAAA,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;AAC5B,SAAA;aAAM,IAAI,WAAW,IAAI,EAAE,EAAE;AAC5B,YAAA,OAAO,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAC7B,SAAA;AACF,KAAA;AACD,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,EAAU,EAAA;IAC/B,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AAC/E,QAAA,OAAO,EAAE,CAAC;AACX,KAAA;IACD,OAAO,GAAG,GAAG,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,EAAY,EAAA;IACnC,OAAO,CAAA,CAAA,EAAI,EAAE,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE,CAAA,CAAE,CAAC;AACxC,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAA;AACrC,IAAA,OAAO,CAAI,CAAA,EAAA,EAAE,CAAC,SAAS,EAAE,CAAC;AAC5B;;;;"}
@@ -1,4 +1,4 @@
1
- import { formatDateTime } from '@medplum/core';
1
+ import { formatDateTime, normalizeErrorString } from '@medplum/core';
2
2
  import React, { useState, useEffect } from 'react';
3
3
  import { MedplumLink } from './MedplumLink.js';
4
4
  import { useMedplum } from './MedplumProvider.js';
@@ -25,19 +25,23 @@ function ResourceHistoryTable(props) {
25
25
  React.createElement("th", null, "Author"),
26
26
  React.createElement("th", null, "Date"),
27
27
  React.createElement("th", null, "Version"))),
28
- React.createElement("tbody", null, (_a = value.entry) === null || _a === void 0 ? void 0 : _a.map((entry) => {
29
- var _a, _b;
30
- return (React.createElement(HistoryRow, { key: (_b = (_a = entry.resource) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.versionId, version: entry.resource }));
31
- }))));
28
+ React.createElement("tbody", null, (_a = value.entry) === null || _a === void 0 ? void 0 : _a.map((entry, index) => (React.createElement(HistoryRow, { key: 'entry-' + index, entry: entry }))))));
32
29
  }
33
30
  function HistoryRow(props) {
34
31
  var _a, _b, _c;
35
- return (React.createElement("tr", null,
36
- React.createElement("td", null,
37
- React.createElement(ResourceBadge, { value: (_a = props.version.meta) === null || _a === void 0 ? void 0 : _a.author, link: true })),
38
- React.createElement("td", null, formatDateTime((_b = props.version.meta) === null || _b === void 0 ? void 0 : _b.lastUpdated)),
39
- React.createElement("td", null,
40
- React.createElement(MedplumLink, { to: getVersionUrl(props.version) }, (_c = props.version.meta) === null || _c === void 0 ? void 0 : _c.versionId))));
32
+ const { response, resource } = props.entry;
33
+ if (resource) {
34
+ return (React.createElement("tr", null,
35
+ React.createElement("td", null,
36
+ React.createElement(ResourceBadge, { value: (_a = resource.meta) === null || _a === void 0 ? void 0 : _a.author, link: true })),
37
+ React.createElement("td", null, formatDateTime((_b = resource.meta) === null || _b === void 0 ? void 0 : _b.lastUpdated)),
38
+ React.createElement("td", null,
39
+ React.createElement(MedplumLink, { to: getVersionUrl(resource) }, (_c = resource.meta) === null || _c === void 0 ? void 0 : _c.versionId))));
40
+ }
41
+ else {
42
+ return (React.createElement("tr", null,
43
+ React.createElement("td", { colSpan: 3 }, normalizeErrorString(response === null || response === void 0 ? void 0 : response.outcome))));
44
+ }
41
45
  }
42
46
  function getVersionUrl(resource) {
43
47
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceHistoryTable.js","sources":["../../src/ResourceHistoryTable.tsx"],"sourcesContent":["import { formatDateTime } from '@medplum/core';\nimport { Bundle, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from './MedplumLink';\nimport { useMedplum } from './MedplumProvider';\nimport { ResourceBadge } from './ResourceBadge';\nimport './Table.css';\n\nexport interface ResourceHistoryTableProps {\n history?: Bundle;\n resourceType?: string;\n id?: string;\n}\n\nexport function ResourceHistoryTable(props: ResourceHistoryTableProps): JSX.Element {\n const medplum = useMedplum();\n const [value, setValue] = useState<Bundle | undefined>(props.history);\n\n useEffect(() => {\n if (!props.history && props.resourceType && props.id) {\n medplum\n .readHistory(props.resourceType as ResourceType, props.id)\n .then(setValue)\n .catch(console.log);\n }\n }, [medplum, props.history, props.resourceType, props.id]);\n\n if (!value) {\n return <div>Loading...</div>;\n }\n\n return (\n <table className=\"medplum-table\">\n <thead>\n <tr>\n <th>Author</th>\n <th>Date</th>\n <th>Version</th>\n </tr>\n </thead>\n <tbody>\n {value.entry?.map((entry) => (\n <HistoryRow key={entry.resource?.meta?.versionId} version={entry.resource as Resource} />\n ))}\n </tbody>\n </table>\n );\n}\n\ninterface HistoryRowProps {\n version: Resource;\n}\n\nfunction HistoryRow(props: HistoryRowProps): JSX.Element {\n return (\n <tr>\n <td>\n <ResourceBadge value={props.version.meta?.author} link={true} />\n </td>\n <td>{formatDateTime(props.version.meta?.lastUpdated)}</td>\n <td>\n <MedplumLink to={getVersionUrl(props.version)}>{props.version.meta?.versionId}</MedplumLink>\n </td>\n </tr>\n );\n}\n\nfunction getVersionUrl(resource: Resource): string {\n return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;\n}\n"],"names":[],"mappings":";;;;;;AAcM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,OAAO,GAAG,UAAU,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a,UAAA,EAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAS,EAAE,CAAC;AACzF;;;;"}
1
+ {"version":3,"file":"ResourceHistoryTable.js","sources":["../../src/ResourceHistoryTable.tsx"],"sourcesContent":["import { formatDateTime, normalizeErrorString } from '@medplum/core';\nimport { Bundle, BundleEntry, Resource, ResourceType } from '@medplum/fhirtypes';\nimport React, { useEffect, useState } from 'react';\nimport { MedplumLink } from './MedplumLink';\nimport { useMedplum } from './MedplumProvider';\nimport { ResourceBadge } from './ResourceBadge';\nimport './Table.css';\n\nexport interface ResourceHistoryTableProps {\n history?: Bundle;\n resourceType?: string;\n id?: string;\n}\n\nexport function ResourceHistoryTable(props: ResourceHistoryTableProps): JSX.Element {\n const medplum = useMedplum();\n const [value, setValue] = useState<Bundle | undefined>(props.history);\n\n useEffect(() => {\n if (!props.history && props.resourceType && props.id) {\n medplum\n .readHistory(props.resourceType as ResourceType, props.id)\n .then(setValue)\n .catch(console.log);\n }\n }, [medplum, props.history, props.resourceType, props.id]);\n\n if (!value) {\n return <div>Loading...</div>;\n }\n\n return (\n <table className=\"medplum-table\">\n <thead>\n <tr>\n <th>Author</th>\n <th>Date</th>\n <th>Version</th>\n </tr>\n </thead>\n <tbody>\n {value.entry?.map((entry, index) => (\n <HistoryRow key={'entry-' + index} entry={entry} />\n ))}\n </tbody>\n </table>\n );\n}\n\ninterface HistoryRowProps {\n entry: BundleEntry;\n}\n\nfunction HistoryRow(props: HistoryRowProps): JSX.Element {\n const { response, resource } = props.entry;\n if (resource) {\n return (\n <tr>\n <td>\n <ResourceBadge value={resource.meta?.author} link={true} />\n </td>\n <td>{formatDateTime(resource.meta?.lastUpdated)}</td>\n <td>\n <MedplumLink to={getVersionUrl(resource)}>{resource.meta?.versionId}</MedplumLink>\n </td>\n </tr>\n );\n } else {\n return (\n <tr>\n <td colSpan={3}>{normalizeErrorString(response?.outcome)}</td>\n </tr>\n );\n }\n}\n\nfunction getVersionUrl(resource: Resource): string {\n return `/${resource.resourceType}/${resource.id}/_history/${resource.meta?.versionId}`;\n}\n"],"names":[],"mappings":";;;;;;AAcM,SAAU,oBAAoB,CAAC,KAAgC,EAAA;;AACnE,IAAA,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;AAC7B,IAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAqB,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtE,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,EAAE,EAAE;YACpD,OAAO;iBACJ,WAAW,CAAC,KAAK,CAAC,YAA4B,EAAE,KAAK,CAAC,EAAE,CAAC;iBACzD,IAAI,CAAC,QAAQ,CAAC;AACd,iBAAA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACvB,SAAA;AACH,KAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3D,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,8CAAqB,CAAC;AAC9B,KAAA;AAED,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAC,eAAe,EAAA;AAC9B,QAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA;AACE,YAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA;gBACE,KAAe,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,QAAA,CAAA;gBACf,KAAa,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,MAAA,CAAA;AACb,gBAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA,EAAA,SAAA,CAAgB,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AAe,CAC/E,CACF,EACL;AACH,KAAA;AAAM,SAAA;AACL,QAAA,QACE,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,IAAA;AACE,YAAA,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,OAAO,EAAE,CAAC,EAAG,EAAA,oBAAoB,CAAC,QAAQ,KAAA,IAAA,IAAR,QAAQ,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAR,QAAQ,CAAE,OAAO,CAAC,CAAM,CAC3D,EACL;AACH,KAAA;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAkB,EAAA;;AACvC,IAAA,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAA,CAAA,EAAI,QAAQ,CAAC,EAAE,CAAa,UAAA,EAAA,CAAA,EAAA,GAAA,QAAQ,CAAC,IAAI,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAS,EAAE,CAAC;AACzF;;;;"}
@@ -57,7 +57,9 @@ function ResourceTimeline(props) {
57
57
  }
58
58
  if (bundle.entry) {
59
59
  for (const entry of bundle.entry) {
60
- newItems.push(entry.resource);
60
+ if (entry.resource) {
61
+ newItems.push(entry.resource);
62
+ }
61
63
  }
62
64
  }
63
65
  }