table view fixes
This commit is contained in:
parent
e5af155b31
commit
a3c92bb087
|
@ -73,7 +73,6 @@ public final class Permission {
|
||||||
//Dmp
|
//Dmp
|
||||||
public static String BrowseDmp = "BrowseDmp";
|
public static String BrowseDmp = "BrowseDmp";
|
||||||
public static String EditDmp = "EditDmp";
|
public static String EditDmp = "EditDmp";
|
||||||
public static String ReviewDmp = "ReviewDmp";
|
|
||||||
public static String NewDmp = "NewDmp";
|
public static String NewDmp = "NewDmp";
|
||||||
public static String DepositDmp = "DepositDmp";
|
public static String DepositDmp = "DepositDmp";
|
||||||
public static String DeleteDmp = "DeleteDmp";
|
public static String DeleteDmp = "DeleteDmp";
|
||||||
|
|
|
@ -10,9 +10,8 @@ export enum DescriptionTemplateFieldType {
|
||||||
RICH_TEXT_AREA = "richTextarea",
|
RICH_TEXT_AREA = "richTextarea",
|
||||||
UPLOAD = "upload",
|
UPLOAD = "upload",
|
||||||
DATE_PICKER = "datePicker",
|
DATE_PICKER = "datePicker",
|
||||||
EXTERNAL_DATASETS = "externalDatasets",
|
|
||||||
REFERENCE_TYPES = "referenceTypes",
|
|
||||||
TAGS = "tags",
|
TAGS = "tags",
|
||||||
|
REFERENCE_TYPES = "referenceTypes",
|
||||||
DATASET_IDENTIFIER = "datasetIdentifier",
|
DATASET_IDENTIFIER = "datasetIdentifier",
|
||||||
VALIDATION = "validation"
|
VALIDATION = "validation"
|
||||||
}
|
}
|
|
@ -99,6 +99,7 @@ export interface DescriptionFieldPersist {
|
||||||
textListValue: string[];
|
textListValue: string[];
|
||||||
dateValue: Date;
|
dateValue: Date;
|
||||||
references: ReferencePersist[];
|
references: ReferencePersist[];
|
||||||
|
reference: ReferencePersist;
|
||||||
externalIdentifier?: DescriptionExternalIdentifierPersist;
|
externalIdentifier?: DescriptionExternalIdentifierPersist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@ import { DatePipe } from "@angular/common";
|
||||||
import { Pipe, PipeTransform } from "@angular/core";
|
import { Pipe, PipeTransform } from "@angular/core";
|
||||||
import { DescriptionTemplateFieldType } from "../common/enum/description-template-field-type";
|
import { DescriptionTemplateFieldType } from "../common/enum/description-template-field-type";
|
||||||
import { Reference } from "../model/reference/reference";
|
import { Reference } from "../model/reference/reference";
|
||||||
|
import { DescriptionTemplateField, DescriptionTemplateRadioBoxData, DescriptionTemplateReferenceTypeData, DescriptionTemplateSelectData } from "../model/description-template/description-template";
|
||||||
|
import { DescriptionFieldPersist } from "../model/description/description";
|
||||||
|
import { Observable, of } from "rxjs";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: 'fieldValue'
|
name: 'fieldValue'
|
||||||
|
@ -11,54 +14,62 @@ export class FieldValuePipe implements PipeTransform {
|
||||||
constructor(private date: DatePipe) {
|
constructor(private date: DatePipe) {
|
||||||
}
|
}
|
||||||
|
|
||||||
transform(controlValue: any): string | null {
|
transform(controlValue: DescriptionFieldPersist, field: DescriptionTemplateField): Observable<string> {
|
||||||
let value = controlValue?.value;
|
if (field?.data?.fieldType && controlValue) {
|
||||||
let renderStyle = controlValue?.viewStyle?.renderStyle;
|
switch (field.data.fieldType) {
|
||||||
if (renderStyle && value) {
|
|
||||||
switch (renderStyle) {
|
|
||||||
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
|
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
|
||||||
return value == 'true' ? 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' : 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO';
|
return of(controlValue.textValue == 'true' ? 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' : 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO');
|
||||||
case DescriptionTemplateFieldType.CHECK_BOX:
|
case DescriptionTemplateFieldType.CHECK_BOX:
|
||||||
return value ? 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' : 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO';
|
return of(controlValue.textValue == 'true' ? 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.YES' : 'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.BOOLEAN-DECISION.NO');
|
||||||
case DescriptionTemplateFieldType.RADIO_BOX:
|
case DescriptionTemplateFieldType.RADIO_BOX: {
|
||||||
if (value && controlValue.data.options) {
|
const data = <DescriptionTemplateRadioBoxData>field.data;
|
||||||
return controlValue.data.options.find(option => option.value === value).label;
|
if (data?.options) {
|
||||||
|
return of(data.options?.find(option => option.value === controlValue.textValue)?.label);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case DescriptionTemplateFieldType.DATE_PICKER:
|
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||||
return this.date.transform(controlValue.value, 'dd/MM/yyyy');
|
return of(this.date.transform(controlValue.dateValue, 'dd/MM/yyyy'));
|
||||||
case DescriptionTemplateFieldType.FREE_TEXT:
|
case DescriptionTemplateFieldType.FREE_TEXT:
|
||||||
return value;
|
return of(controlValue.textValue);
|
||||||
case DescriptionTemplateFieldType.SELECT:
|
case DescriptionTemplateFieldType.SELECT: {
|
||||||
if (value && controlValue.data.options && !controlValue.data.multipleSelect) {
|
const data = <DescriptionTemplateSelectData>field.data;
|
||||||
return controlValue.data.options.find(option => value == option.value).label;
|
if (data?.options && !data?.multipleSelect) {
|
||||||
} else if (value && controlValue.data.options && controlValue.data.multipleSelect) {
|
return of(data.options?.find(option => controlValue.textValue == option.value)?.label);
|
||||||
return controlValue.data.options.filter(option => value.includes(option.value)).map(option => option.label).join(',');
|
} else if (data?.options && data?.multipleSelect) {
|
||||||
|
return of(data?.options?.filter(option => controlValue.textListValue.includes(option.value)).map(option => option.label).join(','));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case DescriptionTemplateFieldType.RICH_TEXT_AREA:
|
case DescriptionTemplateFieldType.RICH_TEXT_AREA:
|
||||||
if (value) {
|
if (controlValue.textValue) {
|
||||||
return value.replace(/ /g, ' ').replace(/(\r\n|\n|\r| +(?= ))|\s\s+/gm, " ").replace(/<[^>]*>/g, '');
|
return of(controlValue.textValue.replace(/ /g, ' ').replace(/(\r\n|\n|\r| +(?= ))|\s\s+/gm, " ").replace(/<[^>]*>/g, ''));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DescriptionTemplateFieldType.TEXT_AREA:
|
case DescriptionTemplateFieldType.TEXT_AREA:
|
||||||
return value;
|
return of(controlValue.textValue);
|
||||||
case DescriptionTemplateFieldType.REFERENCE_TYPES:
|
case DescriptionTemplateFieldType.REFERENCE_TYPES: {
|
||||||
return (value as Reference)?.label;
|
const data = <DescriptionTemplateReferenceTypeData>field.data;
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
if (!data?.multipleSelect && controlValue.reference) {
|
||||||
case DescriptionTemplateFieldType.TAGS:
|
return of(controlValue.reference?.label);
|
||||||
return this.parseJson(value);
|
} else if (data?.multipleSelect && controlValue.references) {
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
|
return of(controlValue.references.map(option => option.label).join(','));
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
}
|
||||||
return this.parseJson(value, 'label');
|
break;
|
||||||
|
}
|
||||||
|
// case DescriptionTemplateFieldType.TAGS:
|
||||||
|
// return this.parseJson(value);
|
||||||
|
// case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
|
||||||
|
// case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||||
|
// return this.parseJson(value, 'label');
|
||||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
|
||||||
case DescriptionTemplateFieldType.VALIDATION:
|
case DescriptionTemplateFieldType.VALIDATION:
|
||||||
if (value && value.identifier) {
|
if (controlValue.externalIdentifier?.identifier) {
|
||||||
return value.identifier;
|
return of(controlValue.externalIdentifier?.identifier);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return of(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -154,7 +154,7 @@ export class EnumUtils {
|
||||||
case DescriptionTemplateFieldType.RICH_TEXT_AREA: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RICH-TEXT-AREA');
|
case DescriptionTemplateFieldType.RICH_TEXT_AREA: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RICH-TEXT-AREA');
|
||||||
case DescriptionTemplateFieldType.UPLOAD: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.UPLOAD');
|
case DescriptionTemplateFieldType.UPLOAD: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.UPLOAD');
|
||||||
case DescriptionTemplateFieldType.DATE_PICKER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATE-PICKER');
|
case DescriptionTemplateFieldType.DATE_PICKER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATE-PICKER');
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-DATASETS');
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-DATASETS');
|
||||||
case DescriptionTemplateFieldType.TAGS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TAGS');
|
case DescriptionTemplateFieldType.TAGS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.TAGS');
|
||||||
case DescriptionTemplateFieldType.REFERENCE_TYPES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.REFERENCE-TYPES');
|
case DescriptionTemplateFieldType.REFERENCE_TYPES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.REFERENCE-TYPES');
|
||||||
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATASET-IDENTIFIER');
|
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.DATASET-IDENTIFIER');
|
||||||
|
|
|
@ -562,15 +562,15 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
|
||||||
field.data = data;
|
field.data = data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
|
||||||
const data: DescriptionTemplateExternalDatasetData = {
|
// const data: DescriptionTemplateExternalDatasetData = {
|
||||||
label: '',
|
// label: '',
|
||||||
multipleSelect: false,
|
// multipleSelect: false,
|
||||||
fieldType: type
|
// fieldType: type
|
||||||
}
|
// }
|
||||||
field.data = data;
|
// field.data = data;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case DescriptionTemplateFieldType.UPLOAD: {
|
case DescriptionTemplateFieldType.UPLOAD: {
|
||||||
const data: DescriptionTemplateUploadData = {
|
const data: DescriptionTemplateUploadData = {
|
||||||
label: '',
|
label: '',
|
||||||
|
|
|
@ -170,15 +170,15 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
|
||||||
field.data = data;
|
field.data = data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
|
||||||
const data: DescriptionTemplateExternalDatasetData = {
|
// const data: DescriptionTemplateExternalDatasetData = {
|
||||||
label: '',
|
// label: '',
|
||||||
multipleSelect: false,
|
// multipleSelect: false,
|
||||||
fieldType: type
|
// fieldType: type
|
||||||
}
|
// }
|
||||||
field.data = data;
|
// field.data = data;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case DescriptionTemplateFieldType.UPLOAD: {
|
case DescriptionTemplateFieldType.UPLOAD: {
|
||||||
const data: DescriptionTemplateUploadData = {
|
const data: DescriptionTemplateUploadData = {
|
||||||
label: '',
|
label: '',
|
||||||
|
|
|
@ -802,8 +802,8 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
|
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS:
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||||
return new DescriptionTemplateLabelAndMultiplicityDataEditorModel(this.validationErrorModel);
|
return new DescriptionTemplateLabelAndMultiplicityDataEditorModel(this.validationErrorModel);
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||||
return new DescriptionTemplateExternalDatasetDataEditorModel(this.validationErrorModel);
|
// return new DescriptionTemplateExternalDatasetDataEditorModel(this.validationErrorModel);
|
||||||
case DescriptionTemplateFieldType.UPLOAD:
|
case DescriptionTemplateFieldType.UPLOAD:
|
||||||
return new DescriptionTemplateUploadDataEditorModel(this.validationErrorModel);
|
return new DescriptionTemplateUploadDataEditorModel(this.validationErrorModel);
|
||||||
}
|
}
|
||||||
|
@ -862,12 +862,12 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
|
||||||
rootPath: `${rootPath}data.`,
|
rootPath: `${rootPath}data.`,
|
||||||
validationErrorModel: validationErrorModel
|
validationErrorModel: validationErrorModel
|
||||||
});
|
});
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||||
DescriptionTemplateExternalDatasetDataEditorModel.reapplyValidators({
|
// DescriptionTemplateExternalDatasetDataEditorModel.reapplyValidators({
|
||||||
formGroup: formGroup?.get('data') as UntypedFormGroup,
|
// formGroup: formGroup?.get('data') as UntypedFormGroup,
|
||||||
rootPath: `${rootPath}data.`,
|
// rootPath: `${rootPath}data.`,
|
||||||
validationErrorModel: validationErrorModel
|
// validationErrorModel: validationErrorModel
|
||||||
});
|
// });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -723,9 +723,9 @@ export class DescriptionFieldIndicator {
|
||||||
case DescriptionTemplateFieldType.DATE_PICKER:
|
case DescriptionTemplateFieldType.DATE_PICKER:
|
||||||
this.type = "dateValue";
|
this.type = "dateValue";
|
||||||
break;
|
break;
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||||
this.type = "";
|
// this.type = "";
|
||||||
break;
|
// break;
|
||||||
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:
|
||||||
if (multipleSelect) this.type = "textListValue";
|
if (multipleSelect) this.type = "textListValue";
|
||||||
else this.type = "textValue"
|
else this.type = "textValue"
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<tr *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true">
|
<tr *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true">
|
||||||
<td *ngFor="let field of fieldSet.fields;" class="text-wrap">
|
<td *ngFor="let field of fieldSet.fields;" class="text-wrap">
|
||||||
<ng-container *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true">
|
<ng-container *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value] ?? true">
|
||||||
{{fieldSetItemPropertiesControl.get('fields').get(field.id).get('value').getRawValue()}}
|
{{ fieldSetItemPropertiesControl.get('fields')?.get(field.id)?.getRawValue() | fieldValue: field | async }}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
|
|
@ -130,17 +130,17 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
|
||||||
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
|
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
|
||||||
|
|
||||||
switch (this.field?.data?.fieldType) {
|
switch (this.field?.data?.fieldType) {
|
||||||
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
// case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
|
||||||
//TODO: refactor
|
// //TODO: refactor
|
||||||
// this.multipleReferenceAutoCompleteConfiguration = {
|
// // this.multipleReferenceAutoCompleteConfiguration = {
|
||||||
// filterFn: this.filterOrganisations.bind(this),
|
// // filterFn: this.filterOrganisations.bind(this),
|
||||||
// initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
// // initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
||||||
// displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
// // displayFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||||
// titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
// // titleFn: (item) => { try { return typeof (item) == 'string' ? JSON.parse(item)['name'] : item.name } catch { return '' } },
|
||||||
// subtitleFn: (item) => { try { return item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) } catch { return '' } },
|
// // subtitleFn: (item) => { try { return item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE')) } catch { return '' } },
|
||||||
// valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
// // valueAssign: (item) => { try { return typeof (item) == 'string' ? item : JSON.stringify(item) } catch { return '' } }
|
||||||
// };
|
// // };
|
||||||
break;
|
// break;
|
||||||
case DescriptionTemplateFieldType.TAGS:
|
case DescriptionTemplateFieldType.TAGS:
|
||||||
this.tagsAutoCompleteConfiguration = {
|
this.tagsAutoCompleteConfiguration = {
|
||||||
filterFn: this.filterTags.bind(this),
|
filterFn: this.filterTags.bind(this),
|
||||||
|
|
Loading…
Reference in New Issue