@noatgnu/cupcake-vanilla 1.3.7 → 1.3.9

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.
@@ -4571,28 +4571,34 @@ class ColumnEditModal {
4571
4571
  }
4572
4572
  console.log('[Column] Looking for ontology match:', {
4573
4573
  ontologyType,
4574
- customFilters
4574
+ customFilters,
4575
+ keys: Object.keys(customFilters)
4575
4576
  });
4576
4577
  // Handle both wrapped and unwrapped formats
4577
- // Wrapped: {"ms_unique_vocabularies": {"term_type": "cell line"}}
4578
- // Unwrapped: {"term_type": "cell line"}
4579
- const actualFilters = customFilters[ontologyType] || customFilters;
4578
+ // Also handle camelCase from API vs snake_case in config
4579
+ // API returns: {"msUniqueVocabularies": {"termType": "cell line"}}
4580
+ // Config has: {"ms_unique_vocabularies": {"term_type": "cell line"}}
4581
+ // Convert ontologyType to camelCase to match API format
4582
+ const camelOntologyType = ontologyType.replace(/_([a-z])/g, (g) => g[1].toUpperCase());
4583
+ let actualFilters = customFilters[ontologyType] || customFilters[camelOntologyType] || customFilters;
4584
+ console.log('[Column] Actual filters after unwrapping:', actualFilters);
4580
4585
  const matchingIndex = this.ontologyTypes.findIndex(opt => {
4581
4586
  if (opt.value !== ontologyType)
4582
4587
  return false;
4583
4588
  if (!opt.customFilters)
4584
4589
  return false;
4585
- // Get the filter value from config (should be wrapped like {"ms_unique_vocabularies": {"term_type": "..."}})
4590
+ // Get the filter value from config (wrapped with snake_case key)
4586
4591
  const optFilterValue = opt.customFilters[ontologyType];
4587
4592
  if (!optFilterValue)
4588
4593
  return false;
4589
- const optFiltersJson = JSON.stringify(optFilterValue);
4590
- const templateFiltersJson = JSON.stringify(actualFilters);
4591
- const matches = optFiltersJson === templateFiltersJson;
4594
+ // Compare term_type values (handle both snake_case and camelCase)
4595
+ const optTermType = optFilterValue['term_type'];
4596
+ const actualTermType = actualFilters['term_type'] || actualFilters['termType'];
4597
+ const matches = optTermType === actualTermType;
4592
4598
  console.log('[Column] Comparing:', {
4593
4599
  label: opt.label,
4594
- optFilters: optFilterValue,
4595
- templateFilters: actualFilters,
4600
+ optTermType,
4601
+ actualTermType,
4596
4602
  matches
4597
4603
  });
4598
4604
  return matches;
@@ -4615,12 +4621,16 @@ class ColumnEditModal {
4615
4621
  this.isLoading.set(true);
4616
4622
  const formValue = this.editForm.getRawValue();
4617
4623
  const ontologyTypeIndex = parseInt(formValue.ontologyType);
4618
- const ontologyTypeValue = ontologyTypeIndex > 0 ? this.ontologyTypes[ontologyTypeIndex]?.value : undefined;
4624
+ const selectedOntology = ontologyTypeIndex > 0 ? this.ontologyTypes[ontologyTypeIndex] : null;
4625
+ const ontologyTypeValue = selectedOntology?.value;
4626
+ // Extract custom filters from the selected ontology config
4627
+ const customOntologyFilters = selectedOntology?.customFilters || {};
4619
4628
  const columnData = {
4620
4629
  name: formValue.name,
4621
4630
  type: formValue.type,
4622
4631
  value: formValue.value || '',
4623
4632
  ontologyType: ontologyTypeValue,
4633
+ customOntologyFilters: customOntologyFilters,
4624
4634
  enableTypeahead: formValue.enableTypeahead || false,
4625
4635
  mandatory: formValue.mandatory || false,
4626
4636
  hidden: formValue.hidden || false,