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