@gemina/elements 0.12.0 → 0.13.1
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/chat.cjs +1 -1
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/{chunk-4HKLI46J.js → chunk-6KHHCUSJ.js} +2 -2
- package/dist/{chunk-I5APRZ3B.js → chunk-A5PZTHDE.js} +218 -22
- package/dist/chunk-A5PZTHDE.js.map +1 -0
- package/dist/{chunk-Z3OLTR2S.js → chunk-X5TSIIUP.js} +2 -2
- package/dist/{chunk-Z3OLTR2S.js.map → chunk-X5TSIIUP.js.map} +1 -1
- package/dist/index.cjs +217 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/verification.cjs +217 -21
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-I5APRZ3B.js.map +0 -1
- /package/dist/{chunk-4HKLI46J.js.map → chunk-6KHHCUSJ.js.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
VERSION,
|
|
3
3
|
httpStatus,
|
|
4
4
|
readErrorEnvelope
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-X5TSIIUP.js";
|
|
6
6
|
|
|
7
7
|
// src/verification/index.tsx
|
|
8
8
|
import { useCallback as useCallback3, useEffect as useEffect3, useId as useId2, useMemo, useRef as useRef3, useState as useState3 } from "react";
|
|
@@ -830,6 +830,101 @@ function pruneEmptyAddedRows(plannedTables, edits) {
|
|
|
830
830
|
// src/verification/form.tsx
|
|
831
831
|
import React from "react";
|
|
832
832
|
|
|
833
|
+
// src/verification/review-filter.ts
|
|
834
|
+
function isHighConfidence(confidence) {
|
|
835
|
+
return (confidence?.level ?? "").toLowerCase() === "high";
|
|
836
|
+
}
|
|
837
|
+
var NOTHING_HIDDEN = {
|
|
838
|
+
fields: /* @__PURE__ */ new Set(),
|
|
839
|
+
rows: /* @__PURE__ */ new Set()
|
|
840
|
+
};
|
|
841
|
+
var unplannedRowKey = (tablePointer, index) => `${tablePointer}/${index}`;
|
|
842
|
+
function forEachFieldUnit(classified, visit) {
|
|
843
|
+
for (const header of classified.headers) visit(header.pointer, header.confidence);
|
|
844
|
+
for (const list of classified.simpleLists) {
|
|
845
|
+
for (const item of list.items) visit(item.pointer, item.confidence);
|
|
846
|
+
}
|
|
847
|
+
for (const entity of classified.entities) {
|
|
848
|
+
for (const item of entity.items) {
|
|
849
|
+
for (const cell of Object.values(item)) visit(cell.pointer, cell.confidence);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
function forEachRowUnit(tables, plannedTables, visit) {
|
|
854
|
+
const confidenceOf = (row) => {
|
|
855
|
+
const meta = row?.[ROW_META_KEY];
|
|
856
|
+
return meta?.confidence ?? null;
|
|
857
|
+
};
|
|
858
|
+
for (const table of tables) {
|
|
859
|
+
const planned = plannedTables.get(table.pointer);
|
|
860
|
+
if (planned) {
|
|
861
|
+
for (const row of planned) {
|
|
862
|
+
const { source } = row.entry;
|
|
863
|
+
visit(row.entry.id, source === null ? null : confidenceOf(table.rows[source]), source === null);
|
|
864
|
+
}
|
|
865
|
+
continue;
|
|
866
|
+
}
|
|
867
|
+
table.rows.forEach((row, index) => {
|
|
868
|
+
visit(unplannedRowKey(table.pointer, index), confidenceOf(row), false);
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
function computeHidden(input) {
|
|
873
|
+
const {
|
|
874
|
+
classified,
|
|
875
|
+
tables,
|
|
876
|
+
plannedTables,
|
|
877
|
+
cellViews,
|
|
878
|
+
bindingIndex,
|
|
879
|
+
edits,
|
|
880
|
+
pairErrors,
|
|
881
|
+
suppressed
|
|
882
|
+
} = input;
|
|
883
|
+
const fields = /* @__PURE__ */ new Set();
|
|
884
|
+
const rows = /* @__PURE__ */ new Set();
|
|
885
|
+
const touched = (editKey) => edits.has(editKey) || pairErrors.has(editKey);
|
|
886
|
+
const editKeysByRow = /* @__PURE__ */ new Map();
|
|
887
|
+
for (const view of cellViews) {
|
|
888
|
+
const list = editKeysByRow.get(view.rowKey);
|
|
889
|
+
if (list) list.push(view.editKey);
|
|
890
|
+
else editKeysByRow.set(view.rowKey, [view.editKey]);
|
|
891
|
+
}
|
|
892
|
+
forEachFieldUnit(classified, (pointer, confidence) => {
|
|
893
|
+
if (suppressed.has(pointer) || !isHighConfidence(confidence)) return;
|
|
894
|
+
const editKey = bindingIndex.get(pointer)?.key.raw;
|
|
895
|
+
if (editKey === void 0 || touched(editKey)) return;
|
|
896
|
+
fields.add(pointer);
|
|
897
|
+
});
|
|
898
|
+
forEachRowUnit(tables, plannedTables, (rowKey, confidence, added) => {
|
|
899
|
+
if (added || !isHighConfidence(confidence)) return;
|
|
900
|
+
if ((editKeysByRow.get(rowKey) ?? []).some(touched)) return;
|
|
901
|
+
rows.add(rowKey);
|
|
902
|
+
});
|
|
903
|
+
if (fields.size === 0 && rows.size === 0) return NOTHING_HIDDEN;
|
|
904
|
+
return { fields, rows };
|
|
905
|
+
}
|
|
906
|
+
function countUnits(classified, tables, plannedTables, suppressed) {
|
|
907
|
+
let total = 0;
|
|
908
|
+
forEachFieldUnit(classified, (pointer) => {
|
|
909
|
+
if (!suppressed.has(pointer)) total += 1;
|
|
910
|
+
});
|
|
911
|
+
forEachRowUnit(tables, plannedTables, () => {
|
|
912
|
+
total += 1;
|
|
913
|
+
});
|
|
914
|
+
return total;
|
|
915
|
+
}
|
|
916
|
+
function hasAnyConfidence(classified, tables, plannedTables) {
|
|
917
|
+
let found = false;
|
|
918
|
+
forEachFieldUnit(classified, (_pointer, confidence) => {
|
|
919
|
+
if (confidence?.level) found = true;
|
|
920
|
+
});
|
|
921
|
+
if (found) return true;
|
|
922
|
+
forEachRowUnit(tables, plannedTables, (_rowKey, confidence) => {
|
|
923
|
+
if (confidence?.level) found = true;
|
|
924
|
+
});
|
|
925
|
+
return found;
|
|
926
|
+
}
|
|
927
|
+
|
|
833
928
|
// src/verification/tip.tsx
|
|
834
929
|
import {
|
|
835
930
|
cloneElement,
|
|
@@ -1852,13 +1947,15 @@ function FieldPair(props) {
|
|
|
1852
1947
|
}
|
|
1853
1948
|
function HeaderSection(props) {
|
|
1854
1949
|
const { headers, simpleLists, shared } = props;
|
|
1855
|
-
|
|
1950
|
+
const visibleHeaders = headers.filter((field) => !shared.hidden.fields.has(field.pointer));
|
|
1951
|
+
const visibleLists = simpleLists.map((list) => ({ ...list, items: list.items.filter((item) => !shared.hidden.fields.has(item.pointer)) })).filter((list) => list.items.length > 0);
|
|
1952
|
+
if (visibleHeaders.length === 0 && visibleLists.length === 0) {
|
|
1856
1953
|
return null;
|
|
1857
1954
|
}
|
|
1858
1955
|
return /* @__PURE__ */ jsxs3("section", { className: "gemina-verification__section", "aria-label": "Details", children: [
|
|
1859
1956
|
/* @__PURE__ */ jsx3("div", { className: "gemina-verification__section-header", children: "Details" }),
|
|
1860
1957
|
/* @__PURE__ */ jsxs3("dl", { className: "gemina-verification__dl", children: [
|
|
1861
|
-
|
|
1958
|
+
visibleHeaders.map((field) => /* @__PURE__ */ jsx3(
|
|
1862
1959
|
FieldPair,
|
|
1863
1960
|
{
|
|
1864
1961
|
label: formatLabel(field.key),
|
|
@@ -1868,7 +1965,7 @@ function HeaderSection(props) {
|
|
|
1868
1965
|
},
|
|
1869
1966
|
field.pointer
|
|
1870
1967
|
)),
|
|
1871
|
-
|
|
1968
|
+
visibleLists.map((list) => /* @__PURE__ */ jsxs3(React.Fragment, { children: [
|
|
1872
1969
|
/* @__PURE__ */ jsx3("dt", { className: "gemina-verification__dt", children: /* @__PURE__ */ jsx3("span", { children: formatLabel(list.key) }) }),
|
|
1873
1970
|
/* @__PURE__ */ jsx3("dd", { className: "gemina-verification__dd", children: /* @__PURE__ */ jsx3("ul", { className: "gemina-verification__list", children: list.items.map((item, index) => {
|
|
1874
1971
|
const binding = shared.bindingIndex.get(item.pointer);
|
|
@@ -1904,16 +2001,19 @@ function HeaderSection(props) {
|
|
|
1904
2001
|
}
|
|
1905
2002
|
function EntitySection(props) {
|
|
1906
2003
|
const { entity, shared } = props;
|
|
2004
|
+
const visibleItems = entity.items.map((item) => Object.fromEntries(
|
|
2005
|
+
Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
|
|
2006
|
+
)).filter((item) => Object.keys(item).length > 0);
|
|
1907
2007
|
const label = formatLabel(entity.key);
|
|
1908
2008
|
const singular = label.replace(/s$/, "");
|
|
1909
2009
|
return /* @__PURE__ */ jsxs3("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
1910
2010
|
/* @__PURE__ */ jsxs3("div", { className: "gemina-verification__section-header", children: [
|
|
1911
2011
|
label,
|
|
1912
2012
|
" (",
|
|
1913
|
-
|
|
2013
|
+
visibleItems.length,
|
|
1914
2014
|
")"
|
|
1915
2015
|
] }),
|
|
1916
|
-
/* @__PURE__ */ jsx3("div", { className: "gemina-verification__section-body", children:
|
|
2016
|
+
/* @__PURE__ */ jsx3("div", { className: "gemina-verification__section-body", children: visibleItems.map((item, itemIndex) => /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card", children: [
|
|
1917
2017
|
/* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card-header", children: [
|
|
1918
2018
|
singular,
|
|
1919
2019
|
" ",
|
|
@@ -1968,7 +2068,7 @@ function TableRowView(props) {
|
|
|
1968
2068
|
return { classified, binding, editKey: binding?.key.raw };
|
|
1969
2069
|
};
|
|
1970
2070
|
const firstRect = rects.length > 0 ? rects[0] : null;
|
|
1971
|
-
const showControls = planned !== void 0 && tablePointer !== void 0 && !readOnly;
|
|
2071
|
+
const showControls = planned !== void 0 && tablePointer !== void 0 && !readOnly && !shared.filterOn;
|
|
1972
2072
|
const rowLevel = (row?.[ROW_META_KEY]?.confidence?.level ?? "").toLowerCase();
|
|
1973
2073
|
const rowClass = rowLevel === "low" || rowLevel === "medium" ? `gemina-verification__row--${rowLevel}` : void 0;
|
|
1974
2074
|
return /* @__PURE__ */ jsxs3("tr", { onClick: handleRowClick, className: rowClass, children: [
|
|
@@ -2017,7 +2117,7 @@ function TableRowView(props) {
|
|
|
2017
2117
|
] });
|
|
2018
2118
|
}
|
|
2019
2119
|
function areRowPropsEqual(prev, next) {
|
|
2020
|
-
if (prev.row !== next.row || prev.rowIndex !== next.rowIndex || prev.columns !== next.columns || prev.tableLabel !== next.tableLabel || prev.hasCoords !== next.hasCoords || prev.hasRowConfidence !== next.hasRowConfidence || prev.planned !== next.planned || prev.tablePointer !== next.tablePointer || prev.shared.bindingIndex !== next.shared.bindingIndex || prev.shared.onEdit !== next.shared.onEdit || prev.shared.onFlash !== next.shared.onFlash || prev.shared.readOnly !== next.shared.readOnly) {
|
|
2120
|
+
if (prev.row !== next.row || prev.rowIndex !== next.rowIndex || prev.columns !== next.columns || prev.tableLabel !== next.tableLabel || prev.hasCoords !== next.hasCoords || prev.hasRowConfidence !== next.hasRowConfidence || prev.planned !== next.planned || prev.tablePointer !== next.tablePointer || prev.shared.bindingIndex !== next.shared.bindingIndex || prev.shared.onEdit !== next.shared.onEdit || prev.shared.onFlash !== next.shared.onFlash || prev.shared.readOnly !== next.shared.readOnly || prev.shared.filterOn !== next.shared.filterOn) {
|
|
2021
2121
|
return false;
|
|
2022
2122
|
}
|
|
2023
2123
|
if (prev.shared.edits === next.shared.edits) {
|
|
@@ -2105,7 +2205,11 @@ function TableSection(props) {
|
|
|
2105
2205
|
}).length,
|
|
2106
2206
|
[table.rows]
|
|
2107
2207
|
);
|
|
2108
|
-
const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly;
|
|
2208
|
+
const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly && !shared.filterOn;
|
|
2209
|
+
const visiblePlanned = planned?.map((plannedRow, position) => ({ plannedRow, position })).filter(({ plannedRow }) => !shared.hidden.rows.has(plannedRow.entry.id));
|
|
2210
|
+
const visibleRowIndices = planned ? [] : table.rows.map((_row, index) => index).filter((index) => !shared.hidden.rows.has(unplannedRowKey(table.pointer, index)));
|
|
2211
|
+
const visibleCount = visiblePlanned ? visiblePlanned.length : visibleRowIndices.length;
|
|
2212
|
+
const allHidden = visibleCount === 0 && rowCount > 0;
|
|
2109
2213
|
return /* @__PURE__ */ jsxs3("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
2110
2214
|
/* @__PURE__ */ jsxs3("div", { className: "gemina-verification__section-header", children: [
|
|
2111
2215
|
/* @__PURE__ */ jsxs3("span", { children: [
|
|
@@ -2121,7 +2225,11 @@ function TableSection(props) {
|
|
|
2121
2225
|
/* @__PURE__ */ jsx3(ConfidenceDot, { confidence: table.overallConfidence })
|
|
2122
2226
|
] }) : null
|
|
2123
2227
|
] }),
|
|
2124
|
-
|
|
2228
|
+
allHidden ? /* @__PURE__ */ jsxs3("p", { className: "gemina-verification__all-scored", children: [
|
|
2229
|
+
"All ",
|
|
2230
|
+
rowCount,
|
|
2231
|
+
" rows scored high"
|
|
2232
|
+
] }) : /* @__PURE__ */ jsx3("div", { className: "gemina-verification__table-wrap", children: /* @__PURE__ */ jsxs3("table", { className: "gemina-verification__table", children: [
|
|
2125
2233
|
/* @__PURE__ */ jsx3("thead", { children: /* @__PURE__ */ jsxs3("tr", { children: [
|
|
2126
2234
|
hasCoords ? /* @__PURE__ */ jsx3("th", { "aria-label": "Show row on document" }) : null,
|
|
2127
2235
|
hasRowConfidence ? /* @__PURE__ */ jsx3("th", { "aria-label": "Row confidence" }) : null,
|
|
@@ -2134,7 +2242,7 @@ function TableSection(props) {
|
|
|
2134
2242
|
) }, column)),
|
|
2135
2243
|
showControls ? /* @__PURE__ */ jsx3("th", { "aria-label": "Row actions" }) : null
|
|
2136
2244
|
] }) }),
|
|
2137
|
-
/* @__PURE__ */ jsx3("tbody", { children:
|
|
2245
|
+
/* @__PURE__ */ jsx3("tbody", { children: visiblePlanned ? visiblePlanned.map(({ plannedRow, position }) => /* @__PURE__ */ jsx3(
|
|
2138
2246
|
TableRow,
|
|
2139
2247
|
{
|
|
2140
2248
|
row: plannedRow.entry.source === null ? void 0 : table.rows[plannedRow.entry.source],
|
|
@@ -2148,10 +2256,10 @@ function TableSection(props) {
|
|
|
2148
2256
|
tablePointer: mutable.pointer
|
|
2149
2257
|
},
|
|
2150
2258
|
plannedRow.entry.id
|
|
2151
|
-
)) :
|
|
2259
|
+
)) : visibleRowIndices.map((rowIndex) => /* @__PURE__ */ jsx3(
|
|
2152
2260
|
TableRow,
|
|
2153
2261
|
{
|
|
2154
|
-
row,
|
|
2262
|
+
row: table.rows[rowIndex],
|
|
2155
2263
|
rowIndex,
|
|
2156
2264
|
columns,
|
|
2157
2265
|
tableLabel: label,
|
|
@@ -2222,7 +2330,9 @@ function VerificationForm(props) {
|
|
|
2222
2330
|
rowMutableTables,
|
|
2223
2331
|
plannedTables,
|
|
2224
2332
|
onAddRow,
|
|
2225
|
-
onRemoveRow
|
|
2333
|
+
onRemoveRow,
|
|
2334
|
+
hidden,
|
|
2335
|
+
filterOn
|
|
2226
2336
|
} = props;
|
|
2227
2337
|
const { tables: promotedTables, suppressed } = React.useMemo(
|
|
2228
2338
|
() => withEmptyMutableTables(classified, rowMutableTables ?? NO_TABLES),
|
|
@@ -2238,7 +2348,9 @@ function VerificationForm(props) {
|
|
|
2238
2348
|
rowMutableTables: rowMutableTables ?? NO_TABLES,
|
|
2239
2349
|
plannedTables: plannedTables ?? NO_PLANNED,
|
|
2240
2350
|
onAddRow: onAddRow ?? NOOP_ROW,
|
|
2241
|
-
onRemoveRow: onRemoveRow ?? NOOP_ROW
|
|
2351
|
+
onRemoveRow: onRemoveRow ?? NOOP_ROW,
|
|
2352
|
+
hidden: hidden ?? NOTHING_HIDDEN,
|
|
2353
|
+
filterOn: filterOn ?? false
|
|
2242
2354
|
};
|
|
2243
2355
|
return (
|
|
2244
2356
|
// A real, labeled <form> (role "form" landmark): AT users can jump
|
|
@@ -2806,6 +2918,11 @@ var VERIFICATION_CSS = `
|
|
|
2806
2918
|
}
|
|
2807
2919
|
.gemina-verification__footer {
|
|
2808
2920
|
display: flex;
|
|
2921
|
+
/* Wraps because the review filter adds two more items to this row, and at
|
|
2922
|
+
320 the four together overflow: Submit was pushed 28px past the inline
|
|
2923
|
+
start and clipped. Measured RTL, where the overflow runs the other way
|
|
2924
|
+
and a scrollWidth-minus-clientWidth check on the document never sees it. */
|
|
2925
|
+
flex-wrap: wrap;
|
|
2809
2926
|
align-items: center;
|
|
2810
2927
|
gap: 10px;
|
|
2811
2928
|
padding-block-start: 12px;
|
|
@@ -2822,6 +2939,41 @@ var VERIFICATION_CSS = `
|
|
|
2822
2939
|
cursor: pointer;
|
|
2823
2940
|
}
|
|
2824
2941
|
.gemina-verification__submit:disabled { opacity: 0.5; cursor: default; }
|
|
2942
|
+
/* The review filter is a VIEW MODE, not an action, so it stays quiet: an
|
|
2943
|
+
outline control in the muted color, next to the one loud thing in the
|
|
2944
|
+
footer. Turning it on fills it from the same accent token \u2014 the state has
|
|
2945
|
+
to be unmistakable, because the form is hiding content while it is on. */
|
|
2946
|
+
.gemina-verification__review-filter {
|
|
2947
|
+
font: inherit;
|
|
2948
|
+
font-size: 12px;
|
|
2949
|
+
padding: 4px 12px;
|
|
2950
|
+
border-radius: var(--gemina-verification-radius);
|
|
2951
|
+
border: 1px solid var(--gemina-verification-border);
|
|
2952
|
+
background: transparent;
|
|
2953
|
+
color: var(--gemina-verification-muted);
|
|
2954
|
+
cursor: pointer;
|
|
2955
|
+
}
|
|
2956
|
+
.gemina-verification__review-filter:hover {
|
|
2957
|
+
color: var(--gemina-verification-accent);
|
|
2958
|
+
border-color: var(--gemina-verification-accent);
|
|
2959
|
+
}
|
|
2960
|
+
.gemina-verification__review-filter[aria-checked='true'] {
|
|
2961
|
+
background: var(--gemina-verification-accent);
|
|
2962
|
+
border-color: var(--gemina-verification-accent);
|
|
2963
|
+
color: var(--gemina-verification-accent-fg);
|
|
2964
|
+
}
|
|
2965
|
+
/* Stands in for a table's grid when every row of it scored high. Muted and
|
|
2966
|
+
unemphatic on purpose \u2014 it reports an absence, it is not a finding. */
|
|
2967
|
+
.gemina-verification__filter-count {
|
|
2968
|
+
font-size: 12px;
|
|
2969
|
+
color: var(--gemina-verification-muted);
|
|
2970
|
+
}
|
|
2971
|
+
.gemina-verification__all-scored {
|
|
2972
|
+
margin: 0;
|
|
2973
|
+
padding: 12px;
|
|
2974
|
+
color: var(--gemina-verification-muted);
|
|
2975
|
+
font-size: 13px;
|
|
2976
|
+
}
|
|
2825
2977
|
.gemina-verification__retry {
|
|
2826
2978
|
font: inherit;
|
|
2827
2979
|
font-size: 12px;
|
|
@@ -3179,6 +3331,7 @@ function GeminaVerification(props) {
|
|
|
3179
3331
|
const [imageUrl, setImageUrl] = useState3(null);
|
|
3180
3332
|
const [flashRects, setFlashRects] = useState3(null);
|
|
3181
3333
|
const [stacked, setStacked] = useState3(false);
|
|
3334
|
+
const [filterOn, setFilterOn] = useState3(false);
|
|
3182
3335
|
const rootRef = useRef3(null);
|
|
3183
3336
|
const mountedRef = useRef3(false);
|
|
3184
3337
|
const loadSeqRef = useRef3(0);
|
|
@@ -3255,6 +3408,7 @@ function GeminaVerification(props) {
|
|
|
3255
3408
|
rowMutableTables: readRowMutableTables(view.meta.validationFeedback?.rowMutableTables)
|
|
3256
3409
|
});
|
|
3257
3410
|
setEdits(NO_EDITS);
|
|
3411
|
+
setFilterOn(false);
|
|
3258
3412
|
setRowPlans(seedRowPlans(readRowMutableTables(view.meta.validationFeedback?.rowMutableTables), view.values));
|
|
3259
3413
|
const url = view.document.imageUrl;
|
|
3260
3414
|
setImageUrl(typeof url === "string" && url.length > 0 ? url : null);
|
|
@@ -3316,19 +3470,19 @@ function GeminaVerification(props) {
|
|
|
3316
3470
|
return map;
|
|
3317
3471
|
}, [bindings]);
|
|
3318
3472
|
const unmatched = useMemo(() => {
|
|
3319
|
-
const
|
|
3473
|
+
const rendered2 = /* @__PURE__ */ new Set();
|
|
3320
3474
|
for (const field of classified.headers) {
|
|
3321
|
-
|
|
3475
|
+
rendered2.add(field.pointer);
|
|
3322
3476
|
}
|
|
3323
3477
|
for (const list of classified.simpleLists) {
|
|
3324
3478
|
for (const item of list.items) {
|
|
3325
|
-
|
|
3479
|
+
rendered2.add(item.pointer);
|
|
3326
3480
|
}
|
|
3327
3481
|
}
|
|
3328
3482
|
for (const entity of classified.entities) {
|
|
3329
3483
|
for (const item of entity.items) {
|
|
3330
3484
|
for (const cell of Object.values(item)) {
|
|
3331
|
-
|
|
3485
|
+
rendered2.add(cell.pointer);
|
|
3332
3486
|
}
|
|
3333
3487
|
}
|
|
3334
3488
|
}
|
|
@@ -3336,12 +3490,12 @@ function GeminaVerification(props) {
|
|
|
3336
3490
|
for (const row of table.rows) {
|
|
3337
3491
|
for (const [key, cell] of Object.entries(row)) {
|
|
3338
3492
|
if (key !== ROW_META_KEY) {
|
|
3339
|
-
|
|
3493
|
+
rendered2.add(cell.pointer);
|
|
3340
3494
|
}
|
|
3341
3495
|
}
|
|
3342
3496
|
}
|
|
3343
3497
|
}
|
|
3344
|
-
return bindings.filter((binding) => !
|
|
3498
|
+
return bindings.filter((binding) => !rendered2.has(binding.fieldPointer));
|
|
3345
3499
|
}, [classified, bindings]);
|
|
3346
3500
|
const overlayRects = useMemo(() => {
|
|
3347
3501
|
const rects = [];
|
|
@@ -3506,6 +3660,32 @@ function GeminaVerification(props) {
|
|
|
3506
3660
|
});
|
|
3507
3661
|
}, []);
|
|
3508
3662
|
const pairErrors = useMemo(() => unitSizePairErrors(cellViews, edits), [cellViews, edits]);
|
|
3663
|
+
const rendered = useMemo(
|
|
3664
|
+
() => withEmptyMutableTables(classified, loaded?.rowMutableTables ?? []),
|
|
3665
|
+
[classified, loaded?.rowMutableTables]
|
|
3666
|
+
);
|
|
3667
|
+
const canFilter = useMemo(
|
|
3668
|
+
() => hasAnyConfidence(classified, rendered.tables, plannedTables),
|
|
3669
|
+
[classified, rendered, plannedTables]
|
|
3670
|
+
);
|
|
3671
|
+
const hidden = useMemo(
|
|
3672
|
+
() => filterOn && canFilter ? computeHidden({
|
|
3673
|
+
classified,
|
|
3674
|
+
tables: rendered.tables,
|
|
3675
|
+
plannedTables,
|
|
3676
|
+
cellViews,
|
|
3677
|
+
bindingIndex,
|
|
3678
|
+
edits,
|
|
3679
|
+
pairErrors,
|
|
3680
|
+
suppressed: rendered.suppressed
|
|
3681
|
+
}) : NOTHING_HIDDEN,
|
|
3682
|
+
[filterOn, canFilter, classified, rendered, plannedTables, cellViews, bindingIndex, edits, pairErrors]
|
|
3683
|
+
);
|
|
3684
|
+
const totalUnits = useMemo(
|
|
3685
|
+
() => countUnits(classified, rendered.tables, plannedTables, rendered.suppressed) + unmatched.length,
|
|
3686
|
+
[classified, rendered, plannedTables, unmatched]
|
|
3687
|
+
);
|
|
3688
|
+
const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
|
|
3509
3689
|
const invalidCount = useMemo(() => {
|
|
3510
3690
|
const rowLevel = pairErrors.size;
|
|
3511
3691
|
if (edits.size === 0) {
|
|
@@ -3678,6 +3858,8 @@ function GeminaVerification(props) {
|
|
|
3678
3858
|
onFlash: handleFlash,
|
|
3679
3859
|
pairErrors,
|
|
3680
3860
|
rowMutableTables: loaded?.rowMutableTables,
|
|
3861
|
+
hidden,
|
|
3862
|
+
filterOn,
|
|
3681
3863
|
plannedTables,
|
|
3682
3864
|
onAddRow: handleAddRow,
|
|
3683
3865
|
onRemoveRow: handleRemoveRow
|
|
@@ -3706,6 +3888,20 @@ function GeminaVerification(props) {
|
|
|
3706
3888
|
),
|
|
3707
3889
|
/* @__PURE__ */ jsxs4("div", { className: "gemina-verification__footer", children: [
|
|
3708
3890
|
!alreadyValidated && (invalidCount > 0 ? /* @__PURE__ */ jsx4("div", { className: "gemina-verification__attention", "aria-live": "polite", children: invalidCount === 1 ? "1 field needs attention" : `${invalidCount} fields need attention` }) : /* @__PURE__ */ jsx4("div", { className: "gemina-verification__progress", "aria-live": "polite", children: `${submission.confirmed} confirmed \xB7 ${submission.corrected} corrected` })),
|
|
3891
|
+
canFilter && /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
3892
|
+
/* @__PURE__ */ jsx4(
|
|
3893
|
+
"button",
|
|
3894
|
+
{
|
|
3895
|
+
type: "button",
|
|
3896
|
+
role: "switch",
|
|
3897
|
+
"aria-checked": filterOn,
|
|
3898
|
+
className: "gemina-verification__review-filter",
|
|
3899
|
+
onClick: () => setFilterOn((on) => !on),
|
|
3900
|
+
children: "Hide high-confidence fields"
|
|
3901
|
+
}
|
|
3902
|
+
),
|
|
3903
|
+
filterOn && /* @__PURE__ */ jsx4("span", { className: "gemina-verification__filter-count", "aria-live": "polite", children: `Showing ${visibleUnits} of ${totalUnits}` })
|
|
3904
|
+
] }),
|
|
3709
3905
|
/* @__PURE__ */ jsx4(
|
|
3710
3906
|
"button",
|
|
3711
3907
|
{
|
|
@@ -3821,4 +4017,4 @@ function GeminaVerification(props) {
|
|
|
3821
4017
|
export {
|
|
3822
4018
|
GeminaVerification
|
|
3823
4019
|
};
|
|
3824
|
-
//# sourceMappingURL=chunk-
|
|
4020
|
+
//# sourceMappingURL=chunk-A5PZTHDE.js.map
|