@eka-care/medical-records-ui 1.0.19 → 1.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/index.js +64 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1336,7 +1336,8 @@ var EMPTY = {
|
|
|
1336
1336
|
status: "loading",
|
|
1337
1337
|
files: [],
|
|
1338
1338
|
vitals: [],
|
|
1339
|
-
hasSmartReport: false
|
|
1339
|
+
hasSmartReport: false,
|
|
1340
|
+
isHtml: false
|
|
1340
1341
|
};
|
|
1341
1342
|
function useRecordPreview(documentId) {
|
|
1342
1343
|
const { bid, patientId } = useSdk();
|
|
@@ -1355,16 +1356,19 @@ function useRecordPreview(documentId) {
|
|
|
1355
1356
|
try {
|
|
1356
1357
|
const res = await getCore().describeDocument({ documentId, bid, patientId, preferenceType: "HTML" });
|
|
1357
1358
|
if (cancelled) return;
|
|
1358
|
-
const
|
|
1359
|
+
const rawFiles = _nullishCoalesce(res.files, () => ( []));
|
|
1360
|
+
const files = rawFiles.filter((f) => f.asset_url).map((f) => ({ url: f.asset_url, kind: classifyFile(f.file_type) }));
|
|
1361
|
+
const isHtml = (_nullishCoalesce(_optionalChain([rawFiles, 'access', _24 => _24[0], 'optionalAccess', _25 => _25.file_type]), () => ( ""))).toUpperCase() === "HTML";
|
|
1359
1362
|
const vitals = res.smart_report ? parseVitals(res.smart_report) : [];
|
|
1360
1363
|
setData({
|
|
1361
1364
|
status: "loaded",
|
|
1362
1365
|
files,
|
|
1363
1366
|
vitals,
|
|
1364
|
-
hasSmartReport: res.smart_report != null
|
|
1367
|
+
hasSmartReport: res.smart_report != null,
|
|
1368
|
+
isHtml
|
|
1365
1369
|
});
|
|
1366
1370
|
} catch (e3) {
|
|
1367
|
-
if (!cancelled) setData({ status: "error", files: [], vitals: [], hasSmartReport: false });
|
|
1371
|
+
if (!cancelled) setData({ status: "error", files: [], vitals: [], hasSmartReport: false, isHtml: false });
|
|
1368
1372
|
}
|
|
1369
1373
|
})();
|
|
1370
1374
|
return () => {
|
|
@@ -1449,7 +1453,7 @@ function resolveContentType(file) {
|
|
|
1449
1453
|
if (t === "image/jpeg" || t === "image/jpg" || t === "image/png" || t === "application/pdf") {
|
|
1450
1454
|
return t;
|
|
1451
1455
|
}
|
|
1452
|
-
const ext = _optionalChain([file, 'access',
|
|
1456
|
+
const ext = _optionalChain([file, 'access', _26 => _26.name, 'access', _27 => _27.split, 'call', _28 => _28("."), 'access', _29 => _29.pop, 'call', _30 => _30(), 'optionalAccess', _31 => _31.toLowerCase, 'call', _32 => _32()]);
|
|
1453
1457
|
if (ext === "pdf") return "application/pdf";
|
|
1454
1458
|
if (ext === "png") return "image/png";
|
|
1455
1459
|
if (ext === "jpg" || ext === "jpeg") return "image/jpeg";
|
|
@@ -1488,12 +1492,12 @@ function useUploadConnection() {
|
|
|
1488
1492
|
patientId
|
|
1489
1493
|
});
|
|
1490
1494
|
const queue = store.getState().uploadQueue;
|
|
1491
|
-
if (res.message === "queued_offline" || !_optionalChain([res, 'access',
|
|
1495
|
+
if (res.message === "queued_offline" || !_optionalChain([res, 'access', _33 => _33.batch_response, 'optionalAccess', _34 => _34.length])) {
|
|
1492
1496
|
throw new Error("No internet connection. Your upload will retry automatically when you're back online.");
|
|
1493
1497
|
}
|
|
1494
1498
|
localIds.forEach((id, i) => {
|
|
1495
|
-
const documentId = _nullishCoalesce(_optionalChain([res, 'access',
|
|
1496
|
-
const errorDetails = _optionalChain([res, 'access',
|
|
1499
|
+
const documentId = _nullishCoalesce(_optionalChain([res, 'access', _35 => _35.batch_response, 'optionalAccess', _36 => _36[i], 'optionalAccess', _37 => _37.document_id]), () => ( ""));
|
|
1500
|
+
const errorDetails = _optionalChain([res, 'access', _38 => _38.batch_response, 'optionalAccess', _39 => _39[i], 'optionalAccess', _40 => _40.error_details]);
|
|
1497
1501
|
if (errorDetails) {
|
|
1498
1502
|
queue.markFailed(id);
|
|
1499
1503
|
} else {
|
|
@@ -1535,7 +1539,7 @@ function useDenialList(environment) {
|
|
|
1535
1539
|
const hubUrl = _nullishCoalesce(HUB_URLS[_nullishCoalesce(environment, () => ( "prod"))], () => ( HUB_URLS.prod));
|
|
1536
1540
|
const url = `${hubUrl}/onboarding/5/configuration/?config_keys=denial_list&format=json`;
|
|
1537
1541
|
fetch(url, { signal: controller.signal }).then((res) => res.json()).then((data) => {
|
|
1538
|
-
const list = _optionalChain([data, 'optionalAccess',
|
|
1542
|
+
const list = _optionalChain([data, 'optionalAccess', _41 => _41.denial_list]);
|
|
1539
1543
|
if (Array.isArray(list)) setDenialList(list);
|
|
1540
1544
|
}).catch(() => {
|
|
1541
1545
|
});
|
|
@@ -1561,7 +1565,7 @@ function useRecordsStatus(store) {
|
|
|
1561
1565
|
return _zustand.useStore.call(void 0, store, (s) => s.records.status);
|
|
1562
1566
|
}
|
|
1563
1567
|
function useThumbnailUrl(store, id) {
|
|
1564
|
-
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access',
|
|
1568
|
+
return _zustand.useStore.call(void 0, store, (s) => _nullishCoalesce(_optionalChain([s, 'access', _42 => _42.records, 'access', _43 => _43.byId, 'access', _44 => _44[id], 'optionalAccess', _45 => _45.thumbnailUrl]), () => ( null)));
|
|
1565
1569
|
}
|
|
1566
1570
|
function useIsSelected(store, id) {
|
|
1567
1571
|
return _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.has(id));
|
|
@@ -1716,7 +1720,7 @@ function FilterPopover({ onClose }) {
|
|
|
1716
1720
|
let hasOther = false;
|
|
1717
1721
|
const options = [];
|
|
1718
1722
|
for (const id of ids) {
|
|
1719
|
-
const code = _optionalChain([byId, 'access',
|
|
1723
|
+
const code = _optionalChain([byId, 'access', _46 => _46[id], 'optionalAccess', _47 => _47.typeCode]);
|
|
1720
1724
|
if (!code) continue;
|
|
1721
1725
|
const label = labelOf(code);
|
|
1722
1726
|
if (label === "Other") {
|
|
@@ -1903,7 +1907,7 @@ function RecordsToolbar({
|
|
|
1903
1907
|
if (!filterOpen) return;
|
|
1904
1908
|
const onDown = (e) => {
|
|
1905
1909
|
const t = e.target;
|
|
1906
|
-
if (_optionalChain([t, 'access',
|
|
1910
|
+
if (_optionalChain([t, 'access', _48 => _48.closest, 'optionalCall', _49 => _49("[data-mr-portal]")])) return;
|
|
1907
1911
|
if (filterRef.current && !filterRef.current.contains(t)) setFilterOpen(false);
|
|
1908
1912
|
};
|
|
1909
1913
|
document.addEventListener("mousedown", onDown);
|
|
@@ -1919,7 +1923,7 @@ function RecordsToolbar({
|
|
|
1919
1923
|
if (isRefreshing) return;
|
|
1920
1924
|
setIsRefreshing(true);
|
|
1921
1925
|
try {
|
|
1922
|
-
await _optionalChain([onRefresh, 'optionalCall',
|
|
1926
|
+
await _optionalChain([onRefresh, 'optionalCall', _50 => _50()]);
|
|
1923
1927
|
} finally {
|
|
1924
1928
|
setIsRefreshing(false);
|
|
1925
1929
|
}
|
|
@@ -1946,7 +1950,7 @@ function RecordsToolbar({
|
|
|
1946
1950
|
store.getState().filters.setType(id === ALL ? null : id);
|
|
1947
1951
|
};
|
|
1948
1952
|
const scrollBy = (delta) => {
|
|
1949
|
-
_optionalChain([scrollRef, 'access',
|
|
1953
|
+
_optionalChain([scrollRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.scrollBy, 'call', _53 => _53({ left: delta, behavior: "smooth" })]);
|
|
1950
1954
|
};
|
|
1951
1955
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-records-toolbar", children: [
|
|
1952
1956
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-toolbar-filter", ref: filterRef, children: [
|
|
@@ -1959,7 +1963,7 @@ function RecordsToolbar({
|
|
|
1959
1963
|
"aria-expanded": filterOpen,
|
|
1960
1964
|
onClick: () => {
|
|
1961
1965
|
setFilterOpen((o) => !o);
|
|
1962
|
-
_optionalChain([onFilter, 'optionalCall',
|
|
1966
|
+
_optionalChain([onFilter, 'optionalCall', _54 => _54()]);
|
|
1963
1967
|
},
|
|
1964
1968
|
children: [
|
|
1965
1969
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Filter, { size: 16, "aria-hidden": true, color: "var(--mr-primary)" }),
|
|
@@ -1986,7 +1990,7 @@ function RecordsToolbar({
|
|
|
1986
1990
|
{
|
|
1987
1991
|
id: ALL,
|
|
1988
1992
|
label: "All Records",
|
|
1989
|
-
count: _optionalChain([filteredIds, 'optionalAccess',
|
|
1993
|
+
count: _optionalChain([filteredIds, 'optionalAccess', _55 => _55.length]),
|
|
1990
1994
|
active: activeType == null,
|
|
1991
1995
|
onSelect: selectType
|
|
1992
1996
|
}
|
|
@@ -2229,8 +2233,8 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2229
2233
|
}
|
|
2230
2234
|
const onDown = (e) => {
|
|
2231
2235
|
const t = e.target;
|
|
2232
|
-
if (_optionalChain([fieldRef, 'access',
|
|
2233
|
-
if (_optionalChain([t, 'access',
|
|
2236
|
+
if (_optionalChain([fieldRef, 'access', _56 => _56.current, 'optionalAccess', _57 => _57.contains, 'call', _58 => _58(t)]) || _optionalChain([menuRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.contains, 'call', _61 => _61(t)])) return;
|
|
2237
|
+
if (_optionalChain([t, 'access', _62 => _62.closest, 'optionalCall', _63 => _63("[data-mr-portal]")])) return;
|
|
2234
2238
|
setMenuPos(null);
|
|
2235
2239
|
};
|
|
2236
2240
|
const onResize = () => setMenuPos(null);
|
|
@@ -2401,7 +2405,7 @@ function CasePicker({ selected, onChange, mode = "dropdown" }) {
|
|
|
2401
2405
|
onClick: () => open ? setMenuPos(null) : place(),
|
|
2402
2406
|
children: [
|
|
2403
2407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Search, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon" }),
|
|
2404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-case-picker__field-value" : "mr-case-picker__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess',
|
|
2408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-case-picker__field-value" : "mr-case-picker__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _64 => _64.name]), () => ( "Search or select case\u2026")) }),
|
|
2405
2409
|
selected ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 14, "aria-hidden": true, className: "mr-case-picker__field-icon", onClick: (e) => {
|
|
2406
2410
|
e.stopPropagation();
|
|
2407
2411
|
onChange(null);
|
|
@@ -2617,7 +2621,7 @@ var TagChip = _react.memo.call(void 0, function TagChip2({ label, removable, onR
|
|
|
2617
2621
|
"aria-label": `Remove ${label}`,
|
|
2618
2622
|
onClick: (e) => {
|
|
2619
2623
|
e.stopPropagation();
|
|
2620
|
-
_optionalChain([onRemove, 'optionalCall',
|
|
2624
|
+
_optionalChain([onRemove, 'optionalCall', _65 => _65()]);
|
|
2621
2625
|
},
|
|
2622
2626
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 12, "aria-hidden": true })
|
|
2623
2627
|
}
|
|
@@ -2656,7 +2660,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2656
2660
|
bitmapRef.current = null;
|
|
2657
2661
|
} else {
|
|
2658
2662
|
const ctx2d = canvas.getContext("2d");
|
|
2659
|
-
_optionalChain([ctx2d, 'optionalAccess',
|
|
2663
|
+
_optionalChain([ctx2d, 'optionalAccess', _66 => _66.drawImage, 'call', _67 => _67(bitmap, 0, 0)]);
|
|
2660
2664
|
bitmap.close();
|
|
2661
2665
|
bitmapRef.current = null;
|
|
2662
2666
|
}
|
|
@@ -2685,8 +2689,8 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2685
2689
|
}
|
|
2686
2690
|
const dpr = typeof window === "undefined" ? 1 : window.devicePixelRatio || 1;
|
|
2687
2691
|
const box = wrapRef.current;
|
|
2688
|
-
const boxW = size || _optionalChain([box, 'optionalAccess',
|
|
2689
|
-
const boxH = size || _optionalChain([box, 'optionalAccess',
|
|
2692
|
+
const boxW = size || _optionalChain([box, 'optionalAccess', _68 => _68.clientWidth]) || probe.width;
|
|
2693
|
+
const boxH = size || _optionalChain([box, 'optionalAccess', _69 => _69.clientHeight]) || probe.height;
|
|
2690
2694
|
const boxRatio = boxW > 0 && boxH > 0 ? boxW / boxH : probe.width / probe.height;
|
|
2691
2695
|
const srcRatio = probe.width / probe.height;
|
|
2692
2696
|
let sw = probe.width;
|
|
@@ -2721,7 +2725,7 @@ var Thumbnail = _react.memo.call(void 0, function Thumbnail2({ url, size, alt })
|
|
|
2721
2725
|
return () => {
|
|
2722
2726
|
cancelled = true;
|
|
2723
2727
|
controller.abort();
|
|
2724
|
-
_optionalChain([bitmapRef, 'access',
|
|
2728
|
+
_optionalChain([bitmapRef, 'access', _70 => _70.current, 'optionalAccess', _71 => _71.close, 'call', _72 => _72()]);
|
|
2725
2729
|
bitmapRef.current = null;
|
|
2726
2730
|
};
|
|
2727
2731
|
}, [url, size]);
|
|
@@ -2811,8 +2815,8 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2811
2815
|
if (!open) return;
|
|
2812
2816
|
const onDown = (e) => {
|
|
2813
2817
|
const node = e.target;
|
|
2814
|
-
if (_optionalChain([triggerRef, 'access',
|
|
2815
|
-
if (_optionalChain([node, 'access',
|
|
2818
|
+
if (_optionalChain([triggerRef, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.contains, 'call', _75 => _75(node)]) || _optionalChain([menuRef, 'access', _76 => _76.current, 'optionalAccess', _77 => _77.contains, 'call', _78 => _78(node)])) return;
|
|
2819
|
+
if (_optionalChain([node, 'access', _79 => _79.closest, 'optionalCall', _80 => _80("[data-mr-portal]")])) return;
|
|
2816
2820
|
close();
|
|
2817
2821
|
};
|
|
2818
2822
|
const onKey = (e) => {
|
|
@@ -2855,7 +2859,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2855
2859
|
"data-mr-portal": true,
|
|
2856
2860
|
style: { top: coords.top, bottom: coords.bottom, right: coords.right },
|
|
2857
2861
|
onClick: (e) => e.stopPropagation(),
|
|
2858
|
-
children: _optionalChain([activeItem, 'optionalAccess',
|
|
2862
|
+
children: _optionalChain([activeItem, 'optionalAccess', _81 => _81.subPanel]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-overflow-subpanel", children: [
|
|
2859
2863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-overflow-subpanel__back", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2860
2864
|
"button",
|
|
2861
2865
|
{
|
|
@@ -2880,7 +2884,7 @@ function OverflowMenu({ items, "aria-label": ariaLabel = "More options" }) {
|
|
|
2880
2884
|
if (item.subPanel) {
|
|
2881
2885
|
setActiveSubPanel(item.key);
|
|
2882
2886
|
} else if (item.onSelect) {
|
|
2883
|
-
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access',
|
|
2887
|
+
const triggerRect = _nullishCoalesce(_optionalChain([triggerRef, 'access', _82 => _82.current, 'optionalAccess', _83 => _83.getBoundingClientRect, 'call', _84 => _84()]), () => ( new DOMRect()));
|
|
2884
2888
|
close();
|
|
2885
2889
|
item.onSelect(triggerRect);
|
|
2886
2890
|
}
|
|
@@ -3008,8 +3012,8 @@ function AddToContextSubPanel({
|
|
|
3008
3012
|
}
|
|
3009
3013
|
const onDown = (e) => {
|
|
3010
3014
|
const t = e.target;
|
|
3011
|
-
if (_optionalChain([fieldRef, 'access',
|
|
3012
|
-
if (_optionalChain([t, 'access',
|
|
3015
|
+
if (_optionalChain([fieldRef, 'access', _85 => _85.current, 'optionalAccess', _86 => _86.contains, 'call', _87 => _87(t)]) || _optionalChain([dropRef, 'access', _88 => _88.current, 'optionalAccess', _89 => _89.contains, 'call', _90 => _90(t)])) return;
|
|
3016
|
+
if (_optionalChain([t, 'access', _91 => _91.closest, 'optionalCall', _92 => _92("[data-mr-portal]")])) return;
|
|
3013
3017
|
setDropPos(null);
|
|
3014
3018
|
};
|
|
3015
3019
|
document.addEventListener("mousedown", onDown);
|
|
@@ -3019,10 +3023,10 @@ function AddToContextSubPanel({
|
|
|
3019
3023
|
if (!selected) return;
|
|
3020
3024
|
try {
|
|
3021
3025
|
await editRecord(recordId, { cases: [selected] });
|
|
3022
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3026
|
+
_optionalChain([onToast, 'optionalCall', _93 => _93(`Moved to ${_nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _94 => _94.name]), () => ( "care context"))}`, "success")]);
|
|
3023
3027
|
onClose();
|
|
3024
3028
|
} catch (e4) {
|
|
3025
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3029
|
+
_optionalChain([onToast, 'optionalCall', _95 => _95("Failed to add to care context", "error")]);
|
|
3026
3030
|
}
|
|
3027
3031
|
};
|
|
3028
3032
|
const handleCreate = async () => {
|
|
@@ -3033,10 +3037,10 @@ function AddToContextSubPanel({
|
|
|
3033
3037
|
const occurred_at = newDate ? Math.floor((/* @__PURE__ */ new Date(newDate + "T00:00:00")).getTime() / 1e3) : void 0;
|
|
3034
3038
|
const id = await createCase({ display_name: name, type: newType, occurred_at });
|
|
3035
3039
|
await editRecord(recordId, { cases: [id] });
|
|
3036
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3040
|
+
_optionalChain([onToast, 'optionalCall', _96 => _96(`Created and added to "${name}"`, "success")]);
|
|
3037
3041
|
onClose();
|
|
3038
3042
|
} catch (e5) {
|
|
3039
|
-
_optionalChain([onToast, 'optionalCall',
|
|
3043
|
+
_optionalChain([onToast, 'optionalCall', _97 => _97("Failed to create care context", "error")]);
|
|
3040
3044
|
} finally {
|
|
3041
3045
|
setSaving(false);
|
|
3042
3046
|
}
|
|
@@ -3052,7 +3056,7 @@ function AddToContextSubPanel({
|
|
|
3052
3056
|
className: `mr-ctx-subpanel__field${dropOpen ? " mr-ctx-subpanel__field--open" : ""}`,
|
|
3053
3057
|
onClick: () => dropOpen ? setDropPos(null) : openDrop(),
|
|
3054
3058
|
children: [
|
|
3055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-ctx-subpanel__field-value" : "mr-ctx-subpanel__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess',
|
|
3059
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: selectedCase ? "mr-ctx-subpanel__field-value" : "mr-ctx-subpanel__field-placeholder", children: _nullishCoalesce(_optionalChain([selectedCase, 'optionalAccess', _98 => _98.name]), () => ( "Search or select")) }),
|
|
3056
3060
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronsUpDown, { size: 16, "aria-hidden": true, className: "mr-ctx-subpanel__field-chevron" })
|
|
3057
3061
|
]
|
|
3058
3062
|
}
|
|
@@ -3410,8 +3414,8 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3410
3414
|
const thumbnailUrl = useThumbnailUrl2(id);
|
|
3411
3415
|
const pendingSelected = useIsSelected2(id);
|
|
3412
3416
|
const pendingCount = _zustand.useStore.call(void 0, store, (s) => s.selection.recordIds.size);
|
|
3413
|
-
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3414
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3417
|
+
const attachedCount = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _99 => _99.size]), () => ( 0));
|
|
3418
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _100 => _100.has, 'call', _101 => _101(id)]), () => ( false));
|
|
3415
3419
|
const checked = pendingSelected || attached;
|
|
3416
3420
|
const attachDisabled = attachedCount >= maxSelectable && !attached;
|
|
3417
3421
|
const selectDisabled = attachedCount + pendingCount >= maxSelectable && !checked;
|
|
@@ -3422,14 +3426,14 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3422
3426
|
);
|
|
3423
3427
|
const handleSelect = _react.useCallback.call(void 0, () => {
|
|
3424
3428
|
if (attached) {
|
|
3425
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3429
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _102 => _102(id)]);
|
|
3426
3430
|
} else {
|
|
3427
3431
|
store.getState().selection.toggleRecord(id, pendingLimit);
|
|
3428
3432
|
}
|
|
3429
3433
|
}, [store, id, pendingLimit, attached, onRemoveAttachment]);
|
|
3430
3434
|
const handleAddToContext = _react.useCallback.call(void 0, () => {
|
|
3431
3435
|
if (attached) {
|
|
3432
|
-
void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3436
|
+
void _optionalChain([onRemoveAttachment, 'optionalCall', _103 => _103(id)]);
|
|
3433
3437
|
} else {
|
|
3434
3438
|
const r = store.getState().records.byId[id];
|
|
3435
3439
|
if (r && onAttachToContext) void onAttachToContext([{ documentId: id, name: r.title }]);
|
|
@@ -3459,7 +3463,7 @@ function useRecordItem({ id, selectionMode, maxSelectable }) {
|
|
|
3459
3463
|
[store, id, bid, patientId, onCopyToNote]
|
|
3460
3464
|
);
|
|
3461
3465
|
const handleDelete = _react.useCallback.call(void 0, () => {
|
|
3462
|
-
_optionalChain([onRequestDelete, 'optionalCall',
|
|
3466
|
+
_optionalChain([onRequestDelete, 'optionalCall', _104 => _104(id)]);
|
|
3463
3467
|
}, [onRequestDelete, id]);
|
|
3464
3468
|
if (!record) return null;
|
|
3465
3469
|
return {
|
|
@@ -3664,7 +3668,7 @@ function RecordsGrid({
|
|
|
3664
3668
|
const headerRefs = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
3665
3669
|
_react.useEffect.call(void 0, () => {
|
|
3666
3670
|
if (!scrollToKey) return;
|
|
3667
|
-
_optionalChain([headerRefs, 'access',
|
|
3671
|
+
_optionalChain([headerRefs, 'access', _105 => _105.current, 'access', _106 => _106.get, 'call', _107 => _107(scrollToKey), 'optionalAccess', _108 => _108.scrollIntoView, 'call', _109 => _109({ behavior: "smooth", block: "start" })]);
|
|
3668
3672
|
}, [scrollToKey]);
|
|
3669
3673
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-records-grid", children: sections.map((section, i) => {
|
|
3670
3674
|
const showMonth = showMonths && (i === 0 || sections[i - 1].monthKey !== section.monthKey);
|
|
@@ -3965,12 +3969,12 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3965
3969
|
const { attachedIds, onAttachToContext, onRemoveAttachment, onCopyToNote } = useRecordsActions();
|
|
3966
3970
|
const [smartOpen, setSmartOpen] = _react.useState.call(void 0, true);
|
|
3967
3971
|
if (!record) return null;
|
|
3968
|
-
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3969
|
-
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess',
|
|
3972
|
+
const attached = _nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _110 => _110.has, 'call', _111 => _111(recordId)]), () => ( false));
|
|
3973
|
+
const attachFull = !attached && (_nullishCoalesce(_optionalChain([attachedIds, 'optionalAccess', _112 => _112.size]), () => ( 0))) >= MAX_CONTEXT_ATTACHMENTS;
|
|
3970
3974
|
const handleAttach = () => {
|
|
3971
3975
|
if (attachFull) return;
|
|
3972
|
-
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall',
|
|
3973
|
-
else void _optionalChain([onAttachToContext, 'optionalCall',
|
|
3976
|
+
if (attached) void _optionalChain([onRemoveAttachment, 'optionalCall', _113 => _113(recordId)]);
|
|
3977
|
+
else void _optionalChain([onAttachToContext, 'optionalCall', _114 => _114([{ documentId: recordId, name: record.title }])]);
|
|
3974
3978
|
};
|
|
3975
3979
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-record-preview", children: [
|
|
3976
3980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "header", { className: "mr-record-preview__header", children: [
|
|
@@ -3998,13 +4002,13 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
3998
4002
|
children: "Show smart report"
|
|
3999
4003
|
}
|
|
4000
4004
|
),
|
|
4001
|
-
|
|
4005
|
+
preview.isHtml && onCopyToNote && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4002
4006
|
"button",
|
|
4003
4007
|
{
|
|
4004
4008
|
type: "button",
|
|
4005
4009
|
className: "mr-record-preview__copy-btn",
|
|
4006
4010
|
onClick: async (e) => {
|
|
4007
|
-
const url = _optionalChain([preview, 'access',
|
|
4011
|
+
const url = _optionalChain([preview, 'access', _115 => _115.files, 'access', _116 => _116[0], 'optionalAccess', _117 => _117.url]);
|
|
4008
4012
|
if (!url) return;
|
|
4009
4013
|
const res = await fetch(url);
|
|
4010
4014
|
const html = await res.text();
|
|
@@ -4046,12 +4050,12 @@ function RecordPreview({ recordId, onBack }) {
|
|
|
4046
4050
|
] })
|
|
4047
4051
|
] }),
|
|
4048
4052
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mr-record-preview__body", children: [
|
|
4049
|
-
preview.status === "loading" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-record-preview__loading", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { variant: "card" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-doc-viewer__status", children: "Loading viewer\u2026" }), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4053
|
+
preview.status === "loading" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-record-preview__loading", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { variant: "card" }) }) : preview.isHtml && preview.files.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-doc-viewer__status", style: { color: "var(--mr-muted-foreground)" }, children: "Document not available for this record." }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Suspense, { fallback: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-doc-viewer__status", children: "Loading viewer\u2026" }), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4050
4054
|
DocumentViewer,
|
|
4051
4055
|
{
|
|
4052
4056
|
files: preview.files,
|
|
4053
4057
|
title: record.title,
|
|
4054
|
-
isHtml:
|
|
4058
|
+
isHtml: preview.isHtml
|
|
4055
4059
|
}
|
|
4056
4060
|
) }),
|
|
4057
4061
|
preview.hasSmartReport && smartOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4123,7 +4127,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4123
4127
|
}));
|
|
4124
4128
|
onClose();
|
|
4125
4129
|
void onUpload(items).then(() => {
|
|
4126
|
-
_optionalChain([onSuccess, 'optionalCall',
|
|
4130
|
+
_optionalChain([onSuccess, 'optionalCall', _118 => _118(items.length > 1 ? `${items.length} records uploaded` : "Record uploaded")]);
|
|
4127
4131
|
}).catch((e) => {
|
|
4128
4132
|
onError(e instanceof Error ? e.message : "Upload failed. Please try again.");
|
|
4129
4133
|
});
|
|
@@ -4131,7 +4135,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4131
4135
|
const onDrop = (e) => {
|
|
4132
4136
|
e.preventDefault();
|
|
4133
4137
|
setDragging(false);
|
|
4134
|
-
if (_optionalChain([e, 'access',
|
|
4138
|
+
if (_optionalChain([e, 'access', _119 => _119.dataTransfer, 'access', _120 => _120.files, 'optionalAccess', _121 => _121.length])) addFiles(e.dataTransfer.files);
|
|
4135
4139
|
};
|
|
4136
4140
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mr-upload-modal", role: "presentation", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4137
4141
|
"div",
|
|
@@ -4157,7 +4161,7 @@ function UploadModal({ onUpload, onError, onSuccess, onClose }) {
|
|
|
4157
4161
|
] }),
|
|
4158
4162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", className: "mr-upload-modal__close", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { size: 18, "aria-hidden": true }) })
|
|
4159
4163
|
] }),
|
|
4160
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access',
|
|
4164
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", className: "mr-upload-dropzone", onClick: () => _optionalChain([inputRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.click, 'call', _124 => _124()]), children: [
|
|
4161
4165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Upload, { size: 20, "aria-hidden": true }) }),
|
|
4162
4166
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__title", children: "Drop files here or click to browse" }),
|
|
4163
4167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "mr-upload-dropzone__hint", children: "PDF, JPG, PNG \xB7 up to 25 MB each \xB7 multiple files supported" })
|
|
@@ -4298,7 +4302,7 @@ function useRecordSections(tab, ids) {
|
|
|
4298
4302
|
return caseIds.map((caseId) => {
|
|
4299
4303
|
const c = casesById[caseId];
|
|
4300
4304
|
if (!c) return null;
|
|
4301
|
-
const recordIds = ids.filter((id) => _optionalChain([byId, 'access',
|
|
4305
|
+
const recordIds = ids.filter((id) => _optionalChain([byId, 'access', _125 => _125[id], 'optionalAccess', _126 => _126.cases, 'access', _127 => _127.includes, 'call', _128 => _128(caseId)]));
|
|
4302
4306
|
const type = (_nullishCoalesce(c.typeCode, () => ( ""))).toUpperCase();
|
|
4303
4307
|
return {
|
|
4304
4308
|
key: caseId,
|
|
@@ -4461,7 +4465,7 @@ function useRecordsView({
|
|
|
4461
4465
|
if (records.length && onAttachManyToContext) void onAttachManyToContext(records);
|
|
4462
4466
|
}, [store, onAttachManyToContext]);
|
|
4463
4467
|
const openUpload = _react.useCallback.call(void 0, () => {
|
|
4464
|
-
_optionalChain([onUpload, 'optionalCall',
|
|
4468
|
+
_optionalChain([onUpload, 'optionalCall', _129 => _129()]);
|
|
4465
4469
|
setUploadOpen(true);
|
|
4466
4470
|
}, [onUpload]);
|
|
4467
4471
|
const requestDelete = _react.useCallback.call(void 0, (id) => setDeleteTargetId(id), []);
|
|
@@ -4474,11 +4478,11 @@ function useRecordsView({
|
|
|
4474
4478
|
setDeleting(true);
|
|
4475
4479
|
try {
|
|
4476
4480
|
await deleteRecord(deleteTargetId);
|
|
4477
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4481
|
+
_optionalChain([onToast, 'optionalCall', _130 => _130(`${_nullishCoalesce(_optionalChain([target, 'optionalAccess', _131 => _131.title]), () => ( "Record"))} deleted`, "success")]);
|
|
4478
4482
|
setDeleteTargetId(null);
|
|
4479
4483
|
} catch (e) {
|
|
4480
4484
|
const msg = e instanceof Error ? e.message : "Delete failed";
|
|
4481
|
-
_optionalChain([onToast, 'optionalCall',
|
|
4485
|
+
_optionalChain([onToast, 'optionalCall', _132 => _132(`Could not delete record. ${msg}`, "error")]);
|
|
4482
4486
|
} finally {
|
|
4483
4487
|
setDeleting(false);
|
|
4484
4488
|
}
|
|
@@ -4616,8 +4620,8 @@ function RecordsView({
|
|
|
4616
4620
|
UploadModal,
|
|
4617
4621
|
{
|
|
4618
4622
|
onUpload: upload,
|
|
4619
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4620
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4623
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _133 => _133(msg, "error")]),
|
|
4624
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _134 => _134(msg, "success")]),
|
|
4621
4625
|
onClose: () => setUploadOpen(false)
|
|
4622
4626
|
}
|
|
4623
4627
|
)
|
|
@@ -4711,8 +4715,8 @@ function RecordsView({
|
|
|
4711
4715
|
UploadModal,
|
|
4712
4716
|
{
|
|
4713
4717
|
onUpload: upload,
|
|
4714
|
-
onError: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4715
|
-
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall',
|
|
4718
|
+
onError: (msg) => _optionalChain([onToast, 'optionalCall', _135 => _135(msg, "error")]),
|
|
4719
|
+
onSuccess: (msg) => _optionalChain([onToast, 'optionalCall', _136 => _136(msg, "success")]),
|
|
4716
4720
|
onClose: () => setUploadOpen(false)
|
|
4717
4721
|
}
|
|
4718
4722
|
)
|