@eka-care/medical-records-ui 1.0.16 → 1.0.19
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 +38 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -334,7 +334,7 @@ function createDocumentTypeLabelResolver(types) {
|
|
|
334
334
|
for (const t of _nullishCoalesce(types, () => ( []))) {
|
|
335
335
|
if (t.id && t.display_name) fromConfig.set(t.id, t.display_name);
|
|
336
336
|
}
|
|
337
|
-
return (code) => _nullishCoalesce(_nullishCoalesce(fromConfig.get(code), () => ( STATIC_LABELS[code])), () => (
|
|
337
|
+
return (code) => _nullishCoalesce(_nullishCoalesce(fromConfig.get(code), () => ( STATIC_LABELS[code])), () => ( "Other"));
|
|
338
338
|
}
|
|
339
339
|
|
|
340
340
|
// src/components/icons/EmptyRecordsIcon.tsx
|
|
@@ -1467,10 +1467,9 @@ function useUploadConnection() {
|
|
|
1467
1467
|
return id;
|
|
1468
1468
|
});
|
|
1469
1469
|
const batchRequests = items.map((it) => ({
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
...it.tags && it.tags.length ? { tg: it.tags } : {},
|
|
1470
|
+
documentType: it.documentType,
|
|
1471
|
+
documentDate: Math.floor(it.documentDateMs / 1e3),
|
|
1472
|
+
...it.tags && it.tags.length ? { tags: it.tags } : {},
|
|
1474
1473
|
...it.caseIds && it.caseIds.length ? { cases: it.caseIds } : {},
|
|
1475
1474
|
files: [
|
|
1476
1475
|
{
|
|
@@ -1596,8 +1595,15 @@ function useCasesStatus(store) {
|
|
|
1596
1595
|
|
|
1597
1596
|
|
|
1598
1597
|
// src/helpers/recordFilter.ts
|
|
1599
|
-
|
|
1600
|
-
|
|
1598
|
+
var OTHER_TYPE_SENTINEL = "__other__";
|
|
1599
|
+
function recordMatchesFilters(r, filters, { skipType = false, labelOf } = {}) {
|
|
1600
|
+
if (!skipType && filters.type) {
|
|
1601
|
+
if (filters.type === OTHER_TYPE_SENTINEL) {
|
|
1602
|
+
if (!labelOf || labelOf(r.typeCode) !== "Other") return false;
|
|
1603
|
+
} else if (r.typeCode !== filters.type) {
|
|
1604
|
+
return false;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1601
1607
|
const search = filters.search.trim().toLowerCase();
|
|
1602
1608
|
if (search && !r.title.toLowerCase().includes(search)) return false;
|
|
1603
1609
|
if (filters.documentDateFrom != null && r.createdAtEpoch < filters.documentDateFrom) return false;
|
|
@@ -1612,14 +1618,14 @@ function recordMatchesFilters(r, filters, { skipType = false } = {}) {
|
|
|
1612
1618
|
}
|
|
1613
1619
|
|
|
1614
1620
|
// src/stores/selectors/filteredSelectors.ts
|
|
1615
|
-
function useFilteredRecordIds(store) {
|
|
1621
|
+
function useFilteredRecordIds(store, labelOf) {
|
|
1616
1622
|
const ids = _zustand.useStore.call(void 0, store, (s) => s.records.ids);
|
|
1617
1623
|
const byId = _zustand.useStore.call(void 0, store, (s) => s.records.byId);
|
|
1618
1624
|
const filters = _zustand.useStore.call(void 0, store, (s) => s.filters);
|
|
1619
1625
|
return _react.useMemo.call(void 0, () => {
|
|
1620
1626
|
const filtered = ids.filter((id) => {
|
|
1621
1627
|
const r = byId[id];
|
|
1622
|
-
return r ? recordMatchesFilters(r, filters) : false;
|
|
1628
|
+
return r ? recordMatchesFilters(r, filters, { labelOf }) : false;
|
|
1623
1629
|
});
|
|
1624
1630
|
const dir = filters.sortDir === "asc" ? 1 : -1;
|
|
1625
1631
|
const sorted = [...filtered].sort((a, b) => {
|
|
@@ -1664,7 +1670,8 @@ function useCasesStatus2() {
|
|
|
1664
1670
|
return useCasesStatus(useSdk().store);
|
|
1665
1671
|
}
|
|
1666
1672
|
function useFilteredRecordIds2() {
|
|
1667
|
-
|
|
1673
|
+
const { store, labelOf } = useSdk();
|
|
1674
|
+
return useFilteredRecordIds(store, labelOf);
|
|
1668
1675
|
}
|
|
1669
1676
|
|
|
1670
1677
|
// src/views/RecordsView/FilterPopover.tsx
|
|
@@ -1706,7 +1713,22 @@ function FilterPopover({ onClose }) {
|
|
|
1706
1713
|
const ids = _zustand.useStore.call(void 0, store, (s) => s.records.ids);
|
|
1707
1714
|
const typeOptions = _react.useMemo.call(void 0, () => {
|
|
1708
1715
|
const seen = /* @__PURE__ */ new Set();
|
|
1709
|
-
|
|
1716
|
+
let hasOther = false;
|
|
1717
|
+
const options = [];
|
|
1718
|
+
for (const id of ids) {
|
|
1719
|
+
const code = _optionalChain([byId, 'access', _44 => _44[id], 'optionalAccess', _45 => _45.typeCode]);
|
|
1720
|
+
if (!code) continue;
|
|
1721
|
+
const label = labelOf(code);
|
|
1722
|
+
if (label === "Other") {
|
|
1723
|
+
hasOther = true;
|
|
1724
|
+
continue;
|
|
1725
|
+
}
|
|
1726
|
+
if (seen.has(code)) continue;
|
|
1727
|
+
seen.add(code);
|
|
1728
|
+
options.push({ value: code, label });
|
|
1729
|
+
}
|
|
1730
|
+
if (hasOther) options.push({ value: OTHER_TYPE_SENTINEL, label: "Other" });
|
|
1731
|
+
return options;
|
|
1710
1732
|
}, [ids, byId, labelOf]);
|
|
1711
1733
|
const [docType, setDocType] = _react.useState.call(void 0, _nullishCoalesce(filters.type, () => ( "")));
|
|
1712
1734
|
const [docPreset, setDocPreset] = _react.useState.call(void 0, filters.documentDatePreset);
|
|
@@ -1908,14 +1930,15 @@ function RecordsToolbar({
|
|
|
1908
1930
|
for (const id of ids) {
|
|
1909
1931
|
const r = byId[id];
|
|
1910
1932
|
if (!r) continue;
|
|
1911
|
-
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
1933
|
+
const key = labelOf(r.typeCode) === "Other" ? OTHER_TYPE_SENTINEL : r.typeCode;
|
|
1934
|
+
if (!counts.has(key)) counts.set(key, 0);
|
|
1935
|
+
if (recordMatchesFilters(r, filters, { skipType: true, labelOf })) {
|
|
1936
|
+
counts.set(key, (_nullishCoalesce(counts.get(key), () => ( 0))) + 1);
|
|
1914
1937
|
}
|
|
1915
1938
|
}
|
|
1916
1939
|
return [...counts.entries()].map(([code, count]) => ({
|
|
1917
1940
|
code,
|
|
1918
|
-
label: labelOf(code),
|
|
1941
|
+
label: code === OTHER_TYPE_SENTINEL ? "Other" : labelOf(code),
|
|
1919
1942
|
count
|
|
1920
1943
|
}));
|
|
1921
1944
|
}, [ids, byId, labelOf, filters]);
|