@noatgnu/cupcake-vanilla 1.2.1 → 1.2.3
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.
|
@@ -4553,7 +4553,7 @@ class ColumnEditModal {
|
|
|
4553
4553
|
name: ['', [Validators.required, Validators.minLength(1)]],
|
|
4554
4554
|
type: [ColumnType.CHARACTERISTICS, Validators.required],
|
|
4555
4555
|
value: [''],
|
|
4556
|
-
ontologyType: ['0'],
|
|
4556
|
+
ontologyType: ['0'],
|
|
4557
4557
|
enableTypeahead: [false],
|
|
4558
4558
|
mandatory: [false],
|
|
4559
4559
|
hidden: [false],
|
|
@@ -4574,11 +4574,14 @@ class ColumnEditModal {
|
|
|
4574
4574
|
}
|
|
4575
4575
|
populateForm() {
|
|
4576
4576
|
if (this.column) {
|
|
4577
|
+
const ontologyTypeIndex = this.column.ontologyType
|
|
4578
|
+
? this.ontologyTypes.findIndex(o => o.value === this.column.ontologyType)
|
|
4579
|
+
: 0;
|
|
4577
4580
|
this.editForm.patchValue({
|
|
4578
4581
|
name: this.column.name,
|
|
4579
4582
|
type: this.getCorrectedColumnType(this.column.name, this.column.type),
|
|
4580
4583
|
value: this.column.value || '',
|
|
4581
|
-
ontologyType:
|
|
4584
|
+
ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
|
|
4582
4585
|
enableTypeahead: this.column.enableTypeahead || false,
|
|
4583
4586
|
mandatory: this.column.mandatory || false,
|
|
4584
4587
|
hidden: this.column.hidden || false,
|
|
@@ -4595,12 +4598,14 @@ class ColumnEditModal {
|
|
|
4595
4598
|
}
|
|
4596
4599
|
if (this.editForm.valid) {
|
|
4597
4600
|
this.isLoading.set(true);
|
|
4598
|
-
const formValue = this.editForm.getRawValue();
|
|
4601
|
+
const formValue = this.editForm.getRawValue();
|
|
4602
|
+
const ontologyTypeIndex = parseInt(formValue.ontologyType);
|
|
4603
|
+
const ontologyTypeValue = ontologyTypeIndex > 0 ? this.ontologyTypes[ontologyTypeIndex]?.value : undefined;
|
|
4599
4604
|
const columnData = {
|
|
4600
4605
|
name: formValue.name,
|
|
4601
4606
|
type: formValue.type,
|
|
4602
4607
|
value: formValue.value || '',
|
|
4603
|
-
ontologyType:
|
|
4608
|
+
ontologyType: ontologyTypeValue,
|
|
4604
4609
|
enableTypeahead: formValue.enableTypeahead || false,
|
|
4605
4610
|
mandatory: formValue.mandatory || false,
|
|
4606
4611
|
hidden: formValue.hidden || false,
|
|
@@ -4641,7 +4646,7 @@ class ColumnEditModal {
|
|
|
4641
4646
|
}
|
|
4642
4647
|
get hasOntologyType() {
|
|
4643
4648
|
const ontologyTypeIndex = this.editForm.get('ontologyType')?.value;
|
|
4644
|
-
return !!(ontologyTypeIndex && ontologyTypeIndex !== '0');
|
|
4649
|
+
return !!(ontologyTypeIndex && ontologyTypeIndex !== '0');
|
|
4645
4650
|
}
|
|
4646
4651
|
get hasTypeaheadEnabled() {
|
|
4647
4652
|
return this.hasOntologyType && this.editForm.get('enableTypeahead')?.value === true;
|
|
@@ -4726,11 +4731,14 @@ class ColumnEditModal {
|
|
|
4726
4731
|
this.editForm.get('name')?.enable();
|
|
4727
4732
|
this.editForm.get('type')?.enable();
|
|
4728
4733
|
// Auto-fill form with template data
|
|
4734
|
+
const ontologyTypeIndex = template.ontologyType
|
|
4735
|
+
? this.ontologyTypes.findIndex(o => o.value === template.ontologyType)
|
|
4736
|
+
: 0;
|
|
4729
4737
|
this.editForm.patchValue({
|
|
4730
4738
|
name: template.columnName,
|
|
4731
4739
|
type: template.columnType,
|
|
4732
4740
|
value: template.defaultValue || '',
|
|
4733
|
-
ontologyType:
|
|
4741
|
+
ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
|
|
4734
4742
|
enableTypeahead: template.enableTypeahead || false,
|
|
4735
4743
|
mandatory: false,
|
|
4736
4744
|
hidden: false,
|
|
@@ -4761,7 +4769,7 @@ class ColumnEditModal {
|
|
|
4761
4769
|
name: '',
|
|
4762
4770
|
type: ColumnType.CHARACTERISTICS,
|
|
4763
4771
|
value: '',
|
|
4764
|
-
ontologyType: '',
|
|
4772
|
+
ontologyType: '0',
|
|
4765
4773
|
enableTypeahead: false,
|
|
4766
4774
|
mandatory: false,
|
|
4767
4775
|
hidden: false,
|
|
@@ -4788,11 +4796,15 @@ class ColumnEditModal {
|
|
|
4788
4796
|
// Enable controls to update values, then disable again
|
|
4789
4797
|
this.editForm.get('name')?.enable();
|
|
4790
4798
|
this.editForm.get('type')?.enable();
|
|
4799
|
+
const ontologyTypeValue = this.getDefaultOntologyTypeForColumn(column.name);
|
|
4800
|
+
const ontologyTypeIndex = ontologyTypeValue
|
|
4801
|
+
? this.ontologyTypes.findIndex(o => o.value === ontologyTypeValue)
|
|
4802
|
+
: 0;
|
|
4791
4803
|
this.editForm.patchValue({
|
|
4792
4804
|
name: column.name,
|
|
4793
4805
|
type: column.type,
|
|
4794
4806
|
value: '',
|
|
4795
|
-
ontologyType:
|
|
4807
|
+
ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
|
|
4796
4808
|
enableTypeahead: this.shouldEnableTypeaheadForColumn(column.name),
|
|
4797
4809
|
mandatory: this.isColumnMandatory(column.name),
|
|
4798
4810
|
hidden: false,
|
|
@@ -4885,13 +4897,16 @@ class ColumnEditModal {
|
|
|
4885
4897
|
// Enable controls to update values, then disable again
|
|
4886
4898
|
this.editForm.get('name')?.enable();
|
|
4887
4899
|
this.editForm.get('type')?.enable();
|
|
4900
|
+
const ontologyTypeIndex = template.ontologyType
|
|
4901
|
+
? this.ontologyTypes.findIndex(o => o.value === template.ontologyType)
|
|
4902
|
+
: 0;
|
|
4888
4903
|
this.editForm.patchValue({
|
|
4889
4904
|
name: template.columnName,
|
|
4890
4905
|
type: template.columnType,
|
|
4891
|
-
value: currentValue,
|
|
4892
|
-
ontologyType:
|
|
4906
|
+
value: currentValue,
|
|
4907
|
+
ontologyType: ontologyTypeIndex >= 0 ? ontologyTypeIndex.toString() : '0',
|
|
4893
4908
|
enableTypeahead: template.enableTypeahead || false,
|
|
4894
|
-
mandatory: this.editForm.get('mandatory')?.value || false,
|
|
4909
|
+
mandatory: this.editForm.get('mandatory')?.value || false,
|
|
4895
4910
|
hidden: this.editForm.get('hidden')?.value || false,
|
|
4896
4911
|
readonly: this.editForm.get('readonly')?.value || false,
|
|
4897
4912
|
notApplicable: this.editForm.get('notApplicable')?.value || false
|
|
@@ -4926,7 +4941,7 @@ class ColumnEditModal {
|
|
|
4926
4941
|
// Reset ontology type when disabling advanced mode
|
|
4927
4942
|
if (!this.showAdvancedMode()) {
|
|
4928
4943
|
this.editForm.patchValue({
|
|
4929
|
-
ontologyType: '0',
|
|
4944
|
+
ontologyType: '0',
|
|
4930
4945
|
enableTypeahead: false
|
|
4931
4946
|
});
|
|
4932
4947
|
this.selectedOntologyConfig = null;
|