@noatgnu/cupcake-vanilla 1.2.2 → 1.2.4

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.
@@ -1812,10 +1812,8 @@ class ChunkedUploadService extends BaseApiService {
1812
1812
  }
1813
1813
  const hasher = new jsSHA('SHA-256', 'ARRAYBUFFER');
1814
1814
  const arrayBufferPromise = request.file.arrayBuffer();
1815
- arrayBufferPromise.then(arrayBuffer => {
1815
+ return from(arrayBufferPromise).pipe(switchMap((arrayBuffer) => {
1816
1816
  hasher.update(arrayBuffer);
1817
- });
1818
- return from(arrayBufferPromise).pipe(switchMap(() => {
1819
1817
  const hash = hasher.getHash('HEX');
1820
1818
  formData.append('sha256', hash);
1821
1819
  if (request.uploadSessionId) {
@@ -4553,7 +4551,7 @@ class ColumnEditModal {
4553
4551
  name: ['', [Validators.required, Validators.minLength(1)]],
4554
4552
  type: [ColumnType.CHARACTERISTICS, Validators.required],
4555
4553
  value: [''],
4556
- ontologyType: ['0'], // Default to 'None' (index 0)
4554
+ ontologyType: ['0'],
4557
4555
  enableTypeahead: [false],
4558
4556
  mandatory: [false],
4559
4557
  hidden: [false],
@@ -4574,11 +4572,14 @@ class ColumnEditModal {
4574
4572
  }
4575
4573
  populateForm() {
4576
4574
  if (this.column) {
4575
+ const ontologyTypeIndex = this.column.ontologyType
4576
+ ? this.ontologyTypes.findIndex(o => o.value === this.column.ontologyType)
4577
+ : 0;
4577
4578
  this.editForm.patchValue({
4578
4579
  name: this.column.name,
4579
4580
  type: this.getCorrectedColumnType(this.column.name, this.column.type),
4580
4581
  value: this.column.value || '',
4581
- ontologyType: this.column.ontologyType || '',
4582
+ ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
4582
4583
  enableTypeahead: this.column.enableTypeahead || false,
4583
4584
  mandatory: this.column.mandatory || false,
4584
4585
  hidden: this.column.hidden || false,
@@ -4595,12 +4596,14 @@ class ColumnEditModal {
4595
4596
  }
4596
4597
  if (this.editForm.valid) {
4597
4598
  this.isLoading.set(true);
4598
- const formValue = this.editForm.getRawValue(); // getRawValue() includes disabled controls
4599
+ const formValue = this.editForm.getRawValue();
4600
+ const ontologyTypeIndex = parseInt(formValue.ontologyType);
4601
+ const ontologyTypeValue = ontologyTypeIndex > 0 ? this.ontologyTypes[ontologyTypeIndex]?.value : undefined;
4599
4602
  const columnData = {
4600
4603
  name: formValue.name,
4601
4604
  type: formValue.type,
4602
4605
  value: formValue.value || '',
4603
- ontologyType: formValue.ontologyType || null,
4606
+ ontologyType: ontologyTypeValue,
4604
4607
  enableTypeahead: formValue.enableTypeahead || false,
4605
4608
  mandatory: formValue.mandatory || false,
4606
4609
  hidden: formValue.hidden || false,
@@ -4641,7 +4644,7 @@ class ColumnEditModal {
4641
4644
  }
4642
4645
  get hasOntologyType() {
4643
4646
  const ontologyTypeIndex = this.editForm.get('ontologyType')?.value;
4644
- return !!(ontologyTypeIndex && ontologyTypeIndex !== '0'); // '0' is the 'None' option
4647
+ return !!(ontologyTypeIndex && ontologyTypeIndex !== '0');
4645
4648
  }
4646
4649
  get hasTypeaheadEnabled() {
4647
4650
  return this.hasOntologyType && this.editForm.get('enableTypeahead')?.value === true;
@@ -4726,11 +4729,14 @@ class ColumnEditModal {
4726
4729
  this.editForm.get('name')?.enable();
4727
4730
  this.editForm.get('type')?.enable();
4728
4731
  // Auto-fill form with template data
4732
+ const ontologyTypeIndex = template.ontologyType
4733
+ ? this.ontologyTypes.findIndex(o => o.value === template.ontologyType)
4734
+ : 0;
4729
4735
  this.editForm.patchValue({
4730
4736
  name: template.columnName,
4731
4737
  type: template.columnType,
4732
4738
  value: template.defaultValue || '',
4733
- ontologyType: template.ontologyType || '',
4739
+ ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
4734
4740
  enableTypeahead: template.enableTypeahead || false,
4735
4741
  mandatory: false,
4736
4742
  hidden: false,
@@ -4761,7 +4767,7 @@ class ColumnEditModal {
4761
4767
  name: '',
4762
4768
  type: ColumnType.CHARACTERISTICS,
4763
4769
  value: '',
4764
- ontologyType: '',
4770
+ ontologyType: '0',
4765
4771
  enableTypeahead: false,
4766
4772
  mandatory: false,
4767
4773
  hidden: false,
@@ -4788,11 +4794,15 @@ class ColumnEditModal {
4788
4794
  // Enable controls to update values, then disable again
4789
4795
  this.editForm.get('name')?.enable();
4790
4796
  this.editForm.get('type')?.enable();
4797
+ const ontologyTypeValue = this.getDefaultOntologyTypeForColumn(column.name);
4798
+ const ontologyTypeIndex = ontologyTypeValue
4799
+ ? this.ontologyTypes.findIndex(o => o.value === ontologyTypeValue)
4800
+ : 0;
4791
4801
  this.editForm.patchValue({
4792
4802
  name: column.name,
4793
4803
  type: column.type,
4794
4804
  value: '',
4795
- ontologyType: this.getDefaultOntologyTypeForColumn(column.name),
4805
+ ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
4796
4806
  enableTypeahead: this.shouldEnableTypeaheadForColumn(column.name),
4797
4807
  mandatory: this.isColumnMandatory(column.name),
4798
4808
  hidden: false,
@@ -4885,13 +4895,16 @@ class ColumnEditModal {
4885
4895
  // Enable controls to update values, then disable again
4886
4896
  this.editForm.get('name')?.enable();
4887
4897
  this.editForm.get('type')?.enable();
4898
+ const ontologyTypeIndex = template.ontologyType
4899
+ ? this.ontologyTypes.findIndex(o => o.value === template.ontologyType)
4900
+ : 0;
4888
4901
  this.editForm.patchValue({
4889
4902
  name: template.columnName,
4890
4903
  type: template.columnType,
4891
- value: currentValue, // Preserve current value
4892
- ontologyType: template.ontologyType || '',
4904
+ value: currentValue,
4905
+ ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
4893
4906
  enableTypeahead: template.enableTypeahead || false,
4894
- mandatory: this.editForm.get('mandatory')?.value || false, // Preserve current settings
4907
+ mandatory: this.editForm.get('mandatory')?.value || false,
4895
4908
  hidden: this.editForm.get('hidden')?.value || false,
4896
4909
  readonly: this.editForm.get('readonly')?.value || false,
4897
4910
  notApplicable: this.editForm.get('notApplicable')?.value || false
@@ -4926,7 +4939,7 @@ class ColumnEditModal {
4926
4939
  // Reset ontology type when disabling advanced mode
4927
4940
  if (!this.showAdvancedMode()) {
4928
4941
  this.editForm.patchValue({
4929
- ontologyType: '0', // Reset to 'None'
4942
+ ontologyType: '0',
4930
4943
  enableTypeahead: false
4931
4944
  });
4932
4945
  this.selectedOntologyConfig = null;