gramene-search 2.42.0 → 2.43.0

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 CHANGED
@@ -16479,6 +16479,11 @@ const $4d0c2e01f58b53b1$var$EXPERIMENT_KEYS = [
16479
16479
  label: 'Organism'
16480
16480
  }
16481
16481
  ];
16482
+ // Value lists longer than this are truncated (selected values always shown)
16483
+ // behind a "show all" toggle so one huge type (e.g. sample id) doesn't bury
16484
+ // the rest of the panel.
16485
+ const $4d0c2e01f58b53b1$var$VALUE_LIMIT = 10;
16486
+ const $4d0c2e01f58b53b1$var$NO_FIELDS = [];
16482
16487
  // One record per expression field (one sample group within one study).
16483
16488
  // `props` is a flat map of property-key → value used for filtering and display.
16484
16489
  function $4d0c2e01f58b53b1$var$buildFieldRecords(taxon, studyIds, expressionStudies, expressionSamples, fieldCatalog, grameneMaps) {
@@ -16513,20 +16518,28 @@ function $4d0c2e01f58b53b1$var$buildFieldRecords(taxon, studyIds, expressionStud
16513
16518
  const taxName = grameneMaps && (grameneMaps[taxon_id] || grameneMaps[$4d0c2e01f58b53b1$var$speciesTaxonId(taxon_id)]);
16514
16519
  props['exp:organism'] = taxName && taxName.display_name || String(taxon_id);
16515
16520
  const usedFactorTypes = new Set();
16521
+ const factorLabels = [];
16516
16522
  (sample.factor || []).forEach((f)=>{
16517
16523
  props[`fac:${f.type}`] = f.label;
16518
16524
  factorTypes.add(f.type);
16519
16525
  usedFactorTypes.add(f.type);
16526
+ if (f.label) factorLabels.push(f.label);
16520
16527
  });
16528
+ let organ = null;
16521
16529
  (sample.characteristic || []).forEach((c)=>{
16530
+ if (c.type === 'organism part' && c.label) organ = c.label;
16522
16531
  if (usedFactorTypes.has(c.type)) return; // factor takes precedence
16523
16532
  props[`char:${c.type}`] = c.label;
16524
16533
  charTypes.add(c.type);
16525
16534
  });
16535
+ // Short, human-readable name for the field list (same precedence as the
16536
+ // plot's axis labels: factor values, then organism part, then group id).
16537
+ const sampleLabel = factorLabels.length ? factorLabels.join('; ') : organ || group;
16526
16538
  records.push({
16527
16539
  fieldName: fieldName,
16528
16540
  studyId: studyId,
16529
16541
  group: group,
16542
+ sampleLabel: sampleLabel,
16530
16543
  props: props
16531
16544
  });
16532
16545
  }
@@ -16557,17 +16570,53 @@ function $4d0c2e01f58b53b1$var$valueCounts(records, key, selections) {
16557
16570
  }
16558
16571
  return counts;
16559
16572
  }
16560
- function $4d0c2e01f58b53b1$var$labelForKey(key, tree) {
16573
+ function $4d0c2e01f58b53b1$var$typeInfoForKey(key, tree) {
16561
16574
  for (const grp of tree){
16562
- for (const t of grp.types)if (t.key === key) return t.label;
16575
+ for (const t of grp.types)if (t.key === key) return {
16576
+ label: t.label,
16577
+ groupLabel: grp.singular
16578
+ };
16563
16579
  }
16564
- return key;
16580
+ return {
16581
+ label: key,
16582
+ groupLabel: ''
16583
+ };
16584
+ }
16585
+ // Move focus among [data-nav] elements inside `root` with the arrow keys.
16586
+ function $4d0c2e01f58b53b1$var$moveFocus(root, dir) {
16587
+ const items = Array.from(root.querySelectorAll('[data-nav]'));
16588
+ if (items.length === 0) return;
16589
+ const idx = items.indexOf(document.activeElement);
16590
+ let next;
16591
+ if (dir === 'first') next = 0;
16592
+ else if (dir === 'last') next = items.length - 1;
16593
+ else if (idx === -1) next = 0;
16594
+ else next = Math.max(0, Math.min(items.length - 1, idx + dir));
16595
+ items[next].focus();
16596
+ if (items[next].scrollIntoView) items[next].scrollIntoView({
16597
+ block: 'nearest'
16598
+ });
16599
+ }
16600
+ function $4d0c2e01f58b53b1$var$navKeyDown(e) {
16601
+ const map = {
16602
+ ArrowDown: 1,
16603
+ ArrowUp: -1,
16604
+ Home: 'first',
16605
+ End: 'last'
16606
+ };
16607
+ if (!(e.key in map)) return;
16608
+ // Let Home/End keep their text-editing meaning inside the search box.
16609
+ if ((e.key === 'Home' || e.key === 'End') && e.target.tagName === 'INPUT' && e.target.type === 'text') return;
16610
+ e.preventDefault();
16611
+ $4d0c2e01f58b53b1$var$moveFocus(e.currentTarget, map[e.key]);
16565
16612
  }
16566
16613
  const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16567
16614
  const { fieldCatalog: fieldCatalog, exprViz: exprViz, expressionStudies: expressionStudies, expressionSamples: expressionSamples, grameneMaps: grameneMaps, doToggleExprVizFieldsModal: doToggleExprVizFieldsModal, doSetExprVizFields: doSetExprVizFields, doFetchExprVizFieldExistence: doFetchExprVizFieldExistence } = props;
16568
16615
  const taxon = Object.keys(exprViz.byTaxon).find((t)=>exprViz.byTaxon[t].fieldsModalOpen);
16569
16616
  const open = !!taxon;
16570
- const availableAttrs = taxon && exprViz.byTaxon[taxon] && exprViz.byTaxon[taxon].availableAttrs;
16617
+ const tabState = taxon && exprViz.byTaxon[taxon];
16618
+ const availableAttrs = tabState && tabState.availableAttrs;
16619
+ const currentFields = tabState && tabState.selectedFields || $4d0c2e01f58b53b1$var$NO_FIELDS;
16571
16620
  const studyIds = (0, $gXNCa$react.useMemo)(()=>{
16572
16621
  if (!taxon || !expressionStudies) return [];
16573
16622
  const list = expressionStudies[taxon] || expressionStudies[$4d0c2e01f58b53b1$var$speciesTaxonId(taxon)] || [];
@@ -16603,8 +16652,8 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16603
16652
  candidateFields,
16604
16653
  doFetchExprVizFieldExistence
16605
16654
  ]);
16606
- const fieldExistence = taxon && exprViz.byTaxon[taxon] && exprViz.byTaxon[taxon].fieldExistence;
16607
- const existenceStatus = taxon && exprViz.byTaxon[taxon] && exprViz.byTaxon[taxon].existenceStatus;
16655
+ const fieldExistence = tabState && tabState.fieldExistence;
16656
+ const existenceStatus = tabState && tabState.existenceStatus;
16608
16657
  // Once existence counts are loaded, drop fields with no data in the current
16609
16658
  // result set. Until then, render with the full candidate set so the modal
16610
16659
  // doesn't flash empty during the precheck.
@@ -16631,11 +16680,13 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16631
16680
  {
16632
16681
  group: 'experiment',
16633
16682
  label: 'Experiment',
16683
+ singular: 'Experiment',
16634
16684
  types: $4d0c2e01f58b53b1$var$EXPERIMENT_KEYS
16635
16685
  },
16636
16686
  {
16637
16687
  group: 'factors',
16638
16688
  label: 'Factors',
16689
+ singular: 'Factor',
16639
16690
  types: factorTypes.map((t)=>({
16640
16691
  key: `fac:${t}`,
16641
16692
  label: t
@@ -16644,6 +16695,7 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16644
16695
  {
16645
16696
  group: 'characteristics',
16646
16697
  label: 'Characteristics',
16698
+ singular: 'Characteristic',
16647
16699
  types: charTypes.map((t)=>({
16648
16700
  key: `char:${t}`,
16649
16701
  label: t
@@ -16653,18 +16705,22 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16653
16705
  factorTypes,
16654
16706
  charTypes
16655
16707
  ]);
16708
+ // selections: property key → Set of chosen values (AND across keys, OR within).
16656
16709
  const [selections, setSelections] = (0, $gXNCa$react.useState)({});
16657
- const [expandedKey, setExpandedKey] = (0, $gXNCa$react.useState)(null);
16710
+ const [expandedKeys, setExpandedKeys] = (0, $gXNCa$react.useState)(()=>new Set());
16711
+ const [showAllKeys, setShowAllKeys] = (0, $gXNCa$react.useState)(()=>new Set());
16658
16712
  const [collapsedGroups, setCollapsedGroups] = (0, $gXNCa$react.useState)({});
16659
16713
  const [valueSort, setValueSort] = (0, $gXNCa$react.useState)('count');
16660
- const [orderedSelectedKeys, setOrderedSelectedKeys] = (0, $gXNCa$react.useState)([]);
16661
16714
  const [searchQuery, setSearchQuery] = (0, $gXNCa$react.useState)('');
16715
+ // Per-field checkboxes. null = every field checked; otherwise the Set of
16716
+ // checked field names. Seeded from the tab's current selection on open.
16717
+ const [included, setIncluded] = (0, $gXNCa$react.useState)(null);
16718
+ const [seededFromCurrent, setSeededFromCurrent] = (0, $gXNCa$react.useState)(false);
16719
+ const searchRef = (0, $gXNCa$react.useRef)(null);
16662
16720
  const searchLc = searchQuery.trim().toLowerCase();
16663
16721
  const isSearching = searchLc.length > 0;
16664
16722
  // Distinct values per property type, ignoring the type's own selection but
16665
- // applying every other selected type. Counts shown next to a property type
16666
- // reflect "how many distinct values exist among the fields currently
16667
- // matching the rest of the filter."
16723
+ // applying every other selected type.
16668
16724
  const valueSetByKey = (0, $gXNCa$react.useMemo)(()=>{
16669
16725
  const allKeys = new Set();
16670
16726
  for (const r of records)for (const k of Object.keys(r.props))allKeys.add(k);
@@ -16685,8 +16741,7 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16685
16741
  ]);
16686
16742
  // Distinct values per property type across the unfiltered candidate set.
16687
16743
  // A type with a single value across every record can't discriminate (e.g.
16688
- // "Organism" when every field belongs to the same species), so we hide it
16689
- // from the property tree.
16744
+ // "Organism" when every field belongs to the same species), so we hide it.
16690
16745
  const totalValueCountByKey = (0, $gXNCa$react.useMemo)(()=>{
16691
16746
  const m = {};
16692
16747
  for (const r of records)for (const [k, v] of Object.entries(r.props)){
@@ -16702,36 +16757,58 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16702
16757
  (0, $gXNCa$react.useEffect)(()=>{
16703
16758
  if (open && taxon) {
16704
16759
  setSelections({});
16705
- setExpandedKey(null);
16760
+ setExpandedKeys(new Set());
16761
+ setShowAllKeys(new Set());
16706
16762
  setCollapsedGroups({});
16707
- setOrderedSelectedKeys([]);
16708
16763
  setSearchQuery('');
16764
+ const cur = exprViz.byTaxon[taxon] && exprViz.byTaxon[taxon].selectedFields || [];
16765
+ setIncluded(cur.length ? new Set(cur) : null);
16766
+ setSeededFromCurrent(cur.length > 0);
16709
16767
  }
16768
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16710
16769
  }, [
16711
16770
  open,
16712
16771
  taxon
16713
16772
  ]);
16714
- // Keep orderedSelectedKeys in sync with selections (preserves the order in
16715
- // which the user first selected each property type).
16716
- (0, $gXNCa$react.useEffect)(()=>{
16717
- setOrderedSelectedKeys((prev)=>{
16718
- const active = Object.keys(selections);
16719
- const activeSet = new Set(active);
16720
- const kept = prev.filter((k)=>activeSet.has(k));
16721
- const newOnes = active.filter((k)=>!prev.includes(k));
16722
- return [
16723
- ...kept,
16724
- ...newOnes
16725
- ];
16726
- });
16773
+ // Property keys with an active selection, in the order the user first
16774
+ // picked them (drives chip order and the extra field-list columns).
16775
+ // Derived synchronously so chips never lag a render behind the counts.
16776
+ const keyOrderRef = (0, $gXNCa$react.useRef)([]);
16777
+ const orderedSelectedKeys = (0, $gXNCa$react.useMemo)(()=>{
16778
+ const active = Object.keys(selections);
16779
+ const activeSet = new Set(active);
16780
+ const prev = keyOrderRef.current;
16781
+ const kept = prev.filter((k)=>activeSet.has(k));
16782
+ const next = [
16783
+ ...kept,
16784
+ ...active.filter((k)=>!kept.includes(k))
16785
+ ];
16786
+ keyOrderRef.current = next;
16787
+ return next;
16727
16788
  }, [
16728
16789
  selections
16729
16790
  ]);
16730
- const matchingFields = (0, $gXNCa$react.useMemo)(()=>records.filter((r)=>$4d0c2e01f58b53b1$var$fieldMatches(r, selections, null)), [
16791
+ // Fields already shown in the tab are listed first so they aren't buried
16792
+ // among unchecked candidates when the modal opens on an existing selection.
16793
+ // The order is fixed for the modal's lifetime (currentFields doesn't change
16794
+ // while it's open), so rows never jump when toggled.
16795
+ const matchingFields = (0, $gXNCa$react.useMemo)(()=>{
16796
+ const m = records.filter((r)=>$4d0c2e01f58b53b1$var$fieldMatches(r, selections, null));
16797
+ if (currentFields.length === 0) return m;
16798
+ const cur = new Set(currentFields);
16799
+ return [
16800
+ ...m.filter((r)=>cur.has(r.fieldName)),
16801
+ ...m.filter((r)=>!cur.has(r.fieldName))
16802
+ ];
16803
+ }, [
16731
16804
  records,
16732
- selections
16805
+ selections,
16806
+ currentFields
16733
16807
  ]);
16808
+ const isChecked = (f)=>included ? included.has(f) : true;
16809
+ const finalFields = matchingFields.filter((r)=>isChecked(r.fieldName));
16734
16810
  if (!open) return null;
16811
+ const close = ()=>doToggleExprVizFieldsModal(taxon, false);
16735
16812
  const toggleValue = (key, value)=>{
16736
16813
  setSelections((prev)=>{
16737
16814
  const next = {
@@ -16755,59 +16832,100 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16755
16832
  return next;
16756
16833
  });
16757
16834
  };
16835
+ const toggleSetMember = (setter, key, force)=>setter((prev)=>{
16836
+ const next = new Set(prev);
16837
+ const on = force === undefined ? !next.has(key) : force;
16838
+ if (on) next.add(key);
16839
+ else next.delete(key);
16840
+ return next;
16841
+ });
16758
16842
  const toggleGroup = (g)=>setCollapsedGroups((prev)=>({
16759
16843
  ...prev,
16760
16844
  [g]: !prev[g]
16761
16845
  }));
16762
- const renderValues = (key, typeLabelMatches)=>{
16846
+ const toggleField = (name)=>setIncluded((prev)=>{
16847
+ const next = new Set(prev || records.map((r)=>r.fieldName));
16848
+ if (next.has(name)) next.delete(name);
16849
+ else next.add(name);
16850
+ return next;
16851
+ });
16852
+ const setMatchingChecked = (on)=>setIncluded((prev)=>{
16853
+ const next = new Set(prev || records.map((r)=>r.fieldName));
16854
+ for (const r of matchingFields)if (on) next.add(r.fieldName);
16855
+ else next.delete(r.fieldName);
16856
+ return next;
16857
+ });
16858
+ const startOver = ()=>{
16859
+ setIncluded(null);
16860
+ setSeededFromCurrent(false);
16861
+ };
16862
+ const apply = ()=>{
16863
+ // Keep the existing column order for fields that stay selected; append
16864
+ // newly chosen fields in catalog order.
16865
+ const chosen = new Set(finalFields.map((r)=>r.fieldName));
16866
+ const kept = currentFields.filter((f)=>chosen.has(f));
16867
+ const keptSet = new Set(kept);
16868
+ const added = finalFields.map((r)=>r.fieldName).filter((f)=>!keptSet.has(f));
16869
+ doSetExprVizFields(taxon, [
16870
+ ...kept,
16871
+ ...added
16872
+ ]);
16873
+ close();
16874
+ };
16875
+ const onSearchKeyDown = (e)=>{
16876
+ if (e.key === 'Escape' && searchQuery) {
16877
+ e.preventDefault();
16878
+ e.stopPropagation(); // don't close the modal
16879
+ setSearchQuery('');
16880
+ }
16881
+ };
16882
+ // ---- Left panel: property types and their values ----------------------
16883
+ const renderValues = (key, typeLabelMatches, typeLabel)=>{
16763
16884
  const counts = $4d0c2e01f58b53b1$var$valueCounts(records, key, selections);
16764
16885
  let entries = Array.from(counts.entries());
16765
16886
  if (isSearching && !typeLabelMatches) entries = entries.filter(([v])=>String(v).toLowerCase().includes(searchLc));
16766
- if (valueSort === 'name') entries.sort((a, b)=>String(a[0]).localeCompare(String(b[0])));
16767
- else entries.sort((a, b)=>b[1] - a[1] || String(a[0]).localeCompare(String(b[0])));
16768
16887
  const sel = selections[key] || new Set();
16888
+ // Selected values first, then the chosen sort.
16889
+ entries.sort((a, b)=>{
16890
+ const sa = sel.has(a[0]) ? 0 : 1;
16891
+ const sb = sel.has(b[0]) ? 0 : 1;
16892
+ if (sa !== sb) return sa - sb;
16893
+ if (valueSort === 'name') return String(a[0]).localeCompare(String(b[0]), undefined, {
16894
+ numeric: true
16895
+ });
16896
+ return b[1] - a[1] || String(a[0]).localeCompare(String(b[0]), undefined, {
16897
+ numeric: true
16898
+ });
16899
+ });
16900
+ // Selected values whose count dropped to 0 under other filters still
16901
+ // need a visible row so they can be unchecked.
16902
+ for (const v of sel)if (!counts.has(v)) entries.unshift([
16903
+ v,
16904
+ 0
16905
+ ]);
16906
+ const showAll = showAllKeys.has(key) || isSearching;
16907
+ const limit = Math.max($4d0c2e01f58b53b1$var$VALUE_LIMIT, sel.size);
16908
+ const visible = showAll ? entries : entries.slice(0, limit);
16909
+ const hiddenCount = entries.length - visible.length;
16769
16910
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16770
16911
  className: "exprviz-tree-values",
16912
+ role: "group",
16913
+ "aria-label": `${typeLabel} values`,
16771
16914
  children: [
16772
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16773
- className: "exprviz-values-toolbar",
16774
- children: [
16775
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.ToggleButtonGroup), {
16776
- type: "radio",
16777
- name: `exprviz-vsort-${key}`,
16778
- size: "sm",
16779
- value: valueSort,
16780
- onChange: setValueSort,
16781
- children: [
16782
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.ToggleButton), {
16783
- id: `exprviz-vsort-name-${key}`,
16784
- value: "name",
16785
- variant: "outline-secondary",
16786
- children: "Name"
16787
- }),
16788
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.ToggleButton), {
16789
- id: `exprviz-vsort-count-${key}`,
16790
- value: "count",
16791
- variant: "outline-secondary",
16792
- children: "Count"
16793
- })
16794
- ]
16795
- }),
16796
- sel.size > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
16797
- size: "sm",
16798
- variant: "link",
16799
- onClick: ()=>clearTypeSelection(key),
16800
- children: "clear"
16801
- })
16802
- ]
16803
- }),
16804
- entries.map(([v, c])=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("label", {
16805
- className: "exprviz-tree-value",
16915
+ visible.map(([v, c])=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("label", {
16916
+ className: `exprviz-tree-value${sel.has(v) ? ' is-checked' : ''}`,
16806
16917
  children: [
16807
16918
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
16808
16919
  type: "checkbox",
16920
+ "data-nav": true,
16809
16921
  checked: sel.has(v),
16810
- onChange: ()=>toggleValue(key, v)
16922
+ onChange: ()=>toggleValue(key, v),
16923
+ onKeyDown: (e)=>{
16924
+ if (e.key === 'Enter') {
16925
+ e.preventDefault();
16926
+ toggleValue(key, v);
16927
+ }
16928
+ }
16811
16929
  }),
16812
16930
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16813
16931
  className: "exprviz-tree-value-label",
@@ -16823,25 +16941,190 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16823
16941
  entries.length === 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
16824
16942
  className: "exprviz-tree-empty",
16825
16943
  children: "No values"
16944
+ }),
16945
+ (hiddenCount > 0 || showAllKeys.has(key) && !isSearching && entries.length > limit) && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
16946
+ type: "button",
16947
+ "data-nav": true,
16948
+ className: "exprviz-link-btn exprviz-tree-more",
16949
+ onClick: ()=>toggleSetMember(setShowAllKeys, key),
16950
+ children: hiddenCount > 0 ? `Show all ${entries.length} values` : 'Show fewer'
16826
16951
  })
16827
16952
  ]
16828
16953
  });
16829
16954
  };
16955
+ const renderTree = ()=>propTree.map((grp)=>{
16956
+ const typeRows = grp.types.map((t)=>{
16957
+ // Hide property types that can't discriminate among the candidates:
16958
+ // zero values, or a single value shared by every record.
16959
+ const totalDistinct = totalValueCountByKey[t.key] && totalValueCountByKey[t.key].size || 0;
16960
+ if (totalDistinct < 2) return null;
16961
+ const numValues = valueSetByKey[t.key] && valueSetByKey[t.key].size || 0;
16962
+ const sel = selections[t.key];
16963
+ const selCount = sel ? sel.size : 0;
16964
+ if (numValues === 0 && selCount === 0) return null;
16965
+ const typeLabelMatches = isSearching && t.label.toLowerCase().includes(searchLc);
16966
+ if (isSearching && !typeLabelMatches) {
16967
+ const vset = valueSetByKey[t.key] || new Set();
16968
+ let matching = 0;
16969
+ for (const v of vset)if (String(v).toLowerCase().includes(searchLc)) matching++;
16970
+ if (matching === 0) return null;
16971
+ }
16972
+ const isExpanded = isSearching && !typeLabelMatches || expandedKeys.has(t.key);
16973
+ const valuesId = `exprviz-vals-${t.key.replace(/[^a-z0-9]/gi, '_')}`;
16974
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16975
+ className: `exprviz-tree-type${selCount > 0 ? ' is-active' : ''}`,
16976
+ children: [
16977
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("button", {
16978
+ type: "button",
16979
+ "data-nav": true,
16980
+ className: "exprviz-tree-type-header",
16981
+ "aria-expanded": isExpanded,
16982
+ "aria-controls": valuesId,
16983
+ onClick: ()=>toggleSetMember(setExpandedKeys, t.key, !isExpanded),
16984
+ onKeyDown: (e)=>{
16985
+ if (e.key === 'ArrowRight' && !isExpanded) {
16986
+ e.preventDefault();
16987
+ toggleSetMember(setExpandedKeys, t.key, true);
16988
+ } else if (e.key === 'ArrowLeft' && isExpanded) {
16989
+ e.preventDefault();
16990
+ toggleSetMember(setExpandedKeys, t.key, false);
16991
+ }
16992
+ },
16993
+ children: [
16994
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16995
+ className: "exprviz-tree-caret",
16996
+ "aria-hidden": "true",
16997
+ children: isExpanded ? "\u25BE" : "\u25B8"
16998
+ }),
16999
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17000
+ className: "exprviz-tree-type-label",
17001
+ children: t.label
17002
+ }),
17003
+ selCount > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17004
+ className: "exprviz-badge",
17005
+ children: [
17006
+ selCount,
17007
+ " selected"
17008
+ ]
17009
+ }),
17010
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17011
+ className: "exprviz-tree-type-count",
17012
+ title: `${numValues} distinct values`,
17013
+ children: numValues
17014
+ })
17015
+ ]
17016
+ }),
17017
+ !isExpanded && selCount > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
17018
+ className: "exprviz-tree-type-selsummary",
17019
+ title: Array.from(sel).join(', '),
17020
+ children: Array.from(sel).join(', ')
17021
+ }),
17022
+ isExpanded && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
17023
+ id: valuesId,
17024
+ children: renderValues(t.key, typeLabelMatches, t.label)
17025
+ })
17026
+ ]
17027
+ }, t.key);
17028
+ }).filter(Boolean);
17029
+ if (typeRows.length === 0) return null;
17030
+ const groupCollapsed = !isSearching && collapsedGroups[grp.group];
17031
+ const groupSel = grp.types.reduce((n, t)=>n + (selections[t.key] ? selections[t.key].size : 0), 0);
17032
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17033
+ className: "exprviz-tree-group",
17034
+ children: [
17035
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("button", {
17036
+ type: "button",
17037
+ "data-nav": true,
17038
+ className: "exprviz-tree-group-header",
17039
+ "aria-expanded": !groupCollapsed,
17040
+ onClick: ()=>toggleGroup(grp.group),
17041
+ onKeyDown: (e)=>{
17042
+ if (e.key === 'ArrowRight' && groupCollapsed) {
17043
+ e.preventDefault();
17044
+ toggleGroup(grp.group);
17045
+ } else if (e.key === 'ArrowLeft' && !groupCollapsed) {
17046
+ e.preventDefault();
17047
+ toggleGroup(grp.group);
17048
+ }
17049
+ },
17050
+ children: [
17051
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17052
+ className: "exprviz-tree-caret",
17053
+ "aria-hidden": "true",
17054
+ children: groupCollapsed ? "\u25B8" : "\u25BE"
17055
+ }),
17056
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17057
+ className: "exprviz-tree-group-label",
17058
+ children: grp.label
17059
+ }),
17060
+ groupSel > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17061
+ className: "exprviz-badge",
17062
+ children: groupSel
17063
+ }),
17064
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17065
+ className: "exprviz-tree-type-count",
17066
+ children: [
17067
+ typeRows.length,
17068
+ " ",
17069
+ typeRows.length === 1 ? 'type' : 'types'
17070
+ ]
17071
+ })
17072
+ ]
17073
+ }),
17074
+ !groupCollapsed && typeRows
17075
+ ]
17076
+ }, grp.group);
17077
+ }).filter(Boolean);
17078
+ const treeContent = renderTree();
17079
+ // ---- Summary chips ------------------------------------------------------
17080
+ const chips = [];
17081
+ for (const key of orderedSelectedKeys){
17082
+ const vals = selections[key];
17083
+ if (!vals) continue;
17084
+ const { label: label, groupLabel: groupLabel } = $4d0c2e01f58b53b1$var$typeInfoForKey(key, propTree);
17085
+ for (const v of vals)chips.push(/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17086
+ className: "exprviz-chip",
17087
+ children: [
17088
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17089
+ className: "exprviz-chip-type",
17090
+ children: [
17091
+ groupLabel,
17092
+ " \xb7 ",
17093
+ label,
17094
+ ":"
17095
+ ]
17096
+ }),
17097
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17098
+ className: "exprviz-chip-value",
17099
+ title: v,
17100
+ children: v
17101
+ }),
17102
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
17103
+ type: "button",
17104
+ className: "exprviz-chip-remove",
17105
+ "aria-label": `Remove filter ${label}: ${v}`,
17106
+ onClick: ()=>toggleValue(key, v),
17107
+ children: "\xd7"
17108
+ })
17109
+ ]
17110
+ }, `${key}\u0000${v}`));
17111
+ }
17112
+ const matchingChecked = finalFields.length;
17113
+ const uncheckedMatching = matchingFields.length - matchingChecked;
16830
17114
  return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Modal), {
16831
17115
  show: open,
16832
- onHide: ()=>doToggleExprVizFieldsModal(taxon, false),
17116
+ onHide: close,
16833
17117
  size: "xl",
16834
17118
  scrollable: true,
17119
+ className: "exprviz-fields-modal",
17120
+ onEntered: ()=>searchRef.current && searchRef.current.focus(),
16835
17121
  children: [
16836
17122
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Modal).Header, {
16837
17123
  closeButton: true,
16838
17124
  children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Modal).Title, {
17125
+ as: "h5",
16839
17126
  children: [
16840
- "Filter expression fields (",
16841
- matchingFields.length,
16842
- " of ",
16843
- records.length,
16844
- " match)",
17127
+ "Choose expression fields",
16845
17128
  existenceStatus === 'loading' && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16846
17129
  className: "exprviz-modal-loading",
16847
17130
  children: " \xb7 checking field availability\u2026"
@@ -16849,156 +17132,321 @@ const $4d0c2e01f58b53b1$var$FieldsModalCmp = (props)=>{
16849
17132
  ]
16850
17133
  })
16851
17134
  }),
16852
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Modal).Body, {
16853
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16854
- className: "exprviz-fields-layout",
16855
- children: [
16856
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16857
- className: "exprviz-tree",
16858
- children: [
16859
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
16860
- type: "text",
16861
- className: "exprviz-tree-search",
16862
- placeholder: "Search property types and values\u2026",
16863
- value: searchQuery,
16864
- onChange: (e)=>setSearchQuery(e.target.value)
16865
- }),
16866
- propTree.map((grp)=>{
16867
- const typeRows = grp.types.map((t)=>{
16868
- // Hide property types that can't discriminate among the
16869
- // candidates: zero values, or a single value shared by every
16870
- // record. The selection-aware count (valueSetByKey) is what
16871
- // we display; the unfiltered count gates visibility so a type
16872
- // doesn't pop in/out as the user clicks values.
16873
- const totalDistinct = totalValueCountByKey[t.key] && totalValueCountByKey[t.key].size || 0;
16874
- if (totalDistinct < 2) return null;
16875
- const numValues = valueSetByKey[t.key] && valueSetByKey[t.key].size || 0;
16876
- if (numValues === 0) return null;
16877
- const typeLabelMatches = isSearching && t.label.toLowerCase().includes(searchLc);
16878
- let matchingValueCount = numValues;
16879
- if (isSearching && !typeLabelMatches) {
16880
- const vset = valueSetByKey[t.key] || new Set();
16881
- matchingValueCount = 0;
16882
- for (const v of vset)if (String(v).toLowerCase().includes(searchLc)) matchingValueCount++;
16883
- if (matchingValueCount === 0) return null;
16884
- }
16885
- const sel = selections[t.key];
16886
- const selCount = sel ? sel.size : 0;
16887
- const isExpanded = isSearching ? !typeLabelMatches : expandedKey === t.key;
16888
- return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16889
- className: `exprviz-tree-type${selCount > 0 ? ' is-active' : ''}`,
16890
- children: [
16891
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16892
- className: "exprviz-tree-type-header",
16893
- onClick: ()=>setExpandedKey(isExpanded ? null : t.key),
16894
- children: [
16895
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16896
- className: "exprviz-tree-caret",
16897
- children: isExpanded ? "\u25BE" : "\u25B8"
16898
- }),
16899
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16900
- className: "exprviz-tree-type-label",
16901
- children: t.label
16902
- }),
16903
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16904
- className: "exprviz-tree-type-count",
16905
- children: selCount > 0 ? `${selCount}/${numValues}` : numValues
16906
- })
16907
- ]
16908
- }),
16909
- isExpanded && renderValues(t.key, typeLabelMatches)
16910
- ]
16911
- }, t.key);
16912
- }).filter(Boolean);
16913
- if (isSearching && typeRows.length === 0) return null;
16914
- const groupCollapsed = !isSearching && collapsedGroups[grp.group];
16915
- return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16916
- className: "exprviz-tree-group",
17135
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Modal).Body, {
17136
+ children: [
17137
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17138
+ className: "exprviz-summary",
17139
+ "aria-live": "polite",
17140
+ children: [
17141
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17142
+ className: "exprviz-summary-counts",
17143
+ children: [
17144
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("strong", {
17145
+ children: matchingChecked
17146
+ }),
17147
+ " of ",
17148
+ records.length,
17149
+ " fields will be shown",
17150
+ chips.length > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17151
+ className: "text-muted",
17152
+ children: [
17153
+ " \xb7 ",
17154
+ matchingFields.length,
17155
+ " match the filters"
17156
+ ]
17157
+ }),
17158
+ uncheckedMatching > 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17159
+ className: "text-muted",
17160
+ children: [
17161
+ " \xb7 ",
17162
+ uncheckedMatching,
17163
+ " unchecked"
17164
+ ]
17165
+ })
17166
+ ]
17167
+ }),
17168
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
17169
+ className: "exprviz-chips",
17170
+ children: chips.length > 0 ? /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactjsxruntime.Fragment), {
17171
+ children: [
17172
+ chips,
17173
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
17174
+ type: "button",
17175
+ className: "exprviz-link-btn",
17176
+ onClick: ()=>setSelections({}),
17177
+ children: "Clear all filters"
17178
+ })
17179
+ ]
17180
+ }) : /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17181
+ className: "text-muted exprviz-summary-hint",
17182
+ children: "No filters. Pick property values on the left to narrow the list."
17183
+ })
17184
+ }),
17185
+ seededFromCurrent && included && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17186
+ className: "exprviz-summary-seeded",
17187
+ children: [
17188
+ "Starting from your current selection of ",
17189
+ currentFields.length,
17190
+ " fields.",
17191
+ ' ',
17192
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
17193
+ type: "button",
17194
+ className: "exprviz-link-btn",
17195
+ onClick: startOver,
17196
+ children: "Start over with all fields"
17197
+ })
17198
+ ]
17199
+ })
17200
+ ]
17201
+ }),
17202
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17203
+ className: "exprviz-fields-layout",
17204
+ children: [
17205
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17206
+ className: "exprviz-tree-pane",
17207
+ children: [
17208
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17209
+ className: "exprviz-tree-toolbar",
16917
17210
  children: [
17211
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
17212
+ ref: searchRef,
17213
+ type: "search",
17214
+ className: "form-control form-control-sm exprviz-tree-search",
17215
+ placeholder: "Search properties and values\u2026",
17216
+ "aria-label": "Search property types and values",
17217
+ value: searchQuery,
17218
+ onChange: (e)=>setSearchQuery(e.target.value),
17219
+ onKeyDown: (e)=>{
17220
+ onSearchKeyDown(e);
17221
+ if (e.key === 'ArrowDown') {
17222
+ e.preventDefault();
17223
+ const tree = e.currentTarget.closest('.exprviz-tree-pane').querySelector('.exprviz-tree');
17224
+ if (tree) $4d0c2e01f58b53b1$var$moveFocus(tree, 'first');
17225
+ }
17226
+ }
17227
+ }),
16918
17228
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
16919
- className: "exprviz-tree-group-header",
16920
- onClick: ()=>toggleGroup(grp.group),
17229
+ className: "exprviz-tree-sort",
16921
17230
  children: [
16922
17231
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
16923
- className: "exprviz-tree-caret",
16924
- children: groupCollapsed ? "\u25B6" : "\u25BC"
17232
+ className: "text-muted",
17233
+ children: "Sort values"
16925
17234
  }),
16926
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("strong", {
16927
- children: grp.label
17235
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.ToggleButtonGroup), {
17236
+ type: "radio",
17237
+ name: "exprviz-vsort",
17238
+ size: "sm",
17239
+ value: valueSort,
17240
+ onChange: setValueSort,
17241
+ children: [
17242
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.ToggleButton), {
17243
+ id: "exprviz-vsort-count",
17244
+ value: "count",
17245
+ variant: "outline-secondary",
17246
+ children: "Count"
17247
+ }),
17248
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.ToggleButton), {
17249
+ id: "exprviz-vsort-name",
17250
+ value: "name",
17251
+ variant: "outline-secondary",
17252
+ children: "A\u2013Z"
17253
+ })
17254
+ ]
16928
17255
  })
16929
17256
  ]
17257
+ })
17258
+ ]
17259
+ }),
17260
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
17261
+ className: "exprviz-tree",
17262
+ onKeyDown: (e)=>{
17263
+ if (e.key === 'ArrowUp' && document.activeElement === e.currentTarget.querySelector('[data-nav]')) {
17264
+ e.preventDefault();
17265
+ searchRef.current && searchRef.current.focus();
17266
+ return;
17267
+ }
17268
+ $4d0c2e01f58b53b1$var$navKeyDown(e);
17269
+ },
17270
+ children: treeContent.length > 0 ? treeContent : /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
17271
+ className: "exprviz-tree-empty",
17272
+ children: isSearching ? `Nothing matches \u{201C}${searchQuery.trim()}\u{201D}.` : 'No properties to filter on.'
17273
+ })
17274
+ }),
17275
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17276
+ className: "exprviz-kbd-hint text-muted",
17277
+ children: [
17278
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17279
+ children: "\u2191"
16930
17280
  }),
16931
- !groupCollapsed && grp.types.length === 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
16932
- className: "exprviz-tree-empty",
16933
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
16934
- children: "(none)"
16935
- })
17281
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17282
+ children: "\u2193"
17283
+ }),
17284
+ " move \xb7 ",
17285
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17286
+ children: "\u2192"
17287
+ }),
17288
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17289
+ children: "\u2190"
17290
+ }),
17291
+ " open/close \xb7 ",
17292
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17293
+ children: "Space"
16936
17294
  }),
16937
- !groupCollapsed && typeRows
17295
+ " toggle \xb7 ",
17296
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("kbd", {
17297
+ children: "Esc"
17298
+ }),
17299
+ " clear search"
16938
17300
  ]
16939
- }, grp.group);
16940
- })
16941
- ]
16942
- }),
16943
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
16944
- className: "exprviz-fields-preview",
16945
- children: orderedSelectedKeys.length === 0 ? /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
16946
- className: "exprviz-fields-placeholder",
16947
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
16948
- children: "Select a property type to preview the property values for each matching field."
16949
- })
16950
- }) : /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("table", {
16951
- className: "exprviz-fields-table",
17301
+ })
17302
+ ]
17303
+ }),
17304
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17305
+ className: "exprviz-fields-preview",
16952
17306
  children: [
16953
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("thead", {
16954
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tr", {
16955
- children: orderedSelectedKeys.map((k)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
16956
- children: $4d0c2e01f58b53b1$var$labelForKey(k, propTree)
16957
- }, k))
16958
- })
16959
- }),
16960
- /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tbody", {
17307
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("div", {
17308
+ className: "exprviz-fields-preview-toolbar",
16961
17309
  children: [
16962
- matchingFields.map((f)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tr", {
16963
- title: f.fieldName,
16964
- children: orderedSelectedKeys.map((k)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
16965
- children: f.props[k] || ''
16966
- }, k))
16967
- }, f.fieldName)),
16968
- matchingFields.length === 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tr", {
16969
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
16970
- colSpan: orderedSelectedKeys.length,
16971
- children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
16972
- children: "No matching fields"
17310
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("strong", {
17311
+ children: [
17312
+ "Matching fields (",
17313
+ matchingFields.length,
17314
+ ")"
17315
+ ]
17316
+ }),
17317
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("span", {
17318
+ className: "exprviz-fields-preview-actions",
17319
+ children: [
17320
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
17321
+ type: "button",
17322
+ className: "exprviz-link-btn",
17323
+ disabled: uncheckedMatching === 0,
17324
+ onClick: ()=>setMatchingChecked(true),
17325
+ children: "Check all"
17326
+ }),
17327
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("button", {
17328
+ type: "button",
17329
+ className: "exprviz-link-btn",
17330
+ disabled: matchingChecked === 0,
17331
+ onClick: ()=>setMatchingChecked(false),
17332
+ children: "Uncheck all"
16973
17333
  })
16974
- })
17334
+ ]
16975
17335
  })
16976
17336
  ]
17337
+ }),
17338
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("div", {
17339
+ className: "exprviz-fields-preview-scroll",
17340
+ onKeyDown: $4d0c2e01f58b53b1$var$navKeyDown,
17341
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("table", {
17342
+ className: "exprviz-fields-table",
17343
+ children: [
17344
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("thead", {
17345
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
17346
+ children: [
17347
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
17348
+ className: "exprviz-fields-check",
17349
+ "aria-label": "Include"
17350
+ }),
17351
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
17352
+ children: "Sample"
17353
+ }),
17354
+ orderedSelectedKeys.filter((k)=>k !== 'exp:study').map((k)=>{
17355
+ const { label: label, groupLabel: groupLabel } = $4d0c2e01f58b53b1$var$typeInfoForKey(k, propTree);
17356
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
17357
+ className: "exprviz-col-filtered",
17358
+ title: `${groupLabel}: ${label}`,
17359
+ children: label
17360
+ }, k);
17361
+ }),
17362
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("th", {
17363
+ children: "Study"
17364
+ })
17365
+ ]
17366
+ })
17367
+ }),
17368
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tbody", {
17369
+ children: [
17370
+ matchingFields.map((f)=>{
17371
+ const checked = isChecked(f.fieldName);
17372
+ return /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)("tr", {
17373
+ title: f.fieldName,
17374
+ className: checked ? '' : 'is-unchecked',
17375
+ onClick: (e)=>{
17376
+ if (e.target.tagName !== 'INPUT') toggleField(f.fieldName);
17377
+ },
17378
+ children: [
17379
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
17380
+ className: "exprviz-fields-check",
17381
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("input", {
17382
+ type: "checkbox",
17383
+ "data-nav": true,
17384
+ checked: checked,
17385
+ "aria-label": `Include ${f.sampleLabel} (${f.props['exp:study']})`,
17386
+ onChange: ()=>toggleField(f.fieldName),
17387
+ onKeyDown: (e)=>{
17388
+ if (e.key === 'Enter') {
17389
+ e.preventDefault();
17390
+ toggleField(f.fieldName);
17391
+ }
17392
+ }
17393
+ })
17394
+ }),
17395
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
17396
+ className: "exprviz-fields-sample",
17397
+ children: f.sampleLabel
17398
+ }),
17399
+ orderedSelectedKeys.filter((k)=>k !== 'exp:study').map((k)=>/*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
17400
+ className: "exprviz-col-filtered",
17401
+ children: f.props[k] || ''
17402
+ }, k)),
17403
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
17404
+ className: "exprviz-fields-study",
17405
+ children: f.props['exp:study']
17406
+ })
17407
+ ]
17408
+ }, f.fieldName);
17409
+ }),
17410
+ matchingFields.length === 0 && /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("tr", {
17411
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("td", {
17412
+ colSpan: 3 + orderedSelectedKeys.length,
17413
+ children: /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("em", {
17414
+ children: "No fields match these filters."
17415
+ })
17416
+ })
17417
+ })
17418
+ ]
17419
+ })
17420
+ ]
17421
+ })
16977
17422
  })
16978
17423
  ]
16979
17424
  })
16980
- })
16981
- ]
16982
- })
17425
+ ]
17426
+ })
17427
+ ]
16983
17428
  }),
16984
17429
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Modal).Footer, {
16985
17430
  children: [
17431
+ /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)("span", {
17432
+ className: "me-auto text-muted small",
17433
+ children: currentFields.length > 0 ? `Currently showing ${currentFields.length} fields` : 'No fields selected yet'
17434
+ }),
16986
17435
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsx)((0, $gXNCa$reactbootstrap.Button), {
16987
17436
  variant: "secondary",
16988
- onClick: ()=>doToggleExprVizFieldsModal(taxon, false),
17437
+ onClick: close,
16989
17438
  children: "Cancel"
16990
17439
  }),
16991
17440
  /*#__PURE__*/ (0, $gXNCa$reactjsxruntime.jsxs)((0, $gXNCa$reactbootstrap.Button), {
16992
17441
  variant: "primary",
16993
- disabled: matchingFields.length === 0,
16994
- onClick: ()=>{
16995
- doSetExprVizFields(taxon, matchingFields.map((f)=>f.fieldName));
16996
- doToggleExprVizFieldsModal(taxon, false);
16997
- },
17442
+ disabled: matchingChecked === 0,
17443
+ onClick: apply,
16998
17444
  children: [
16999
17445
  "Apply (",
17000
- matchingFields.length,
17001
- " fields)"
17446
+ matchingChecked,
17447
+ " ",
17448
+ matchingChecked === 1 ? 'field' : 'fields',
17449
+ ")"
17002
17450
  ]
17003
17451
  })
17004
17452
  ]