description template fixes
This commit is contained in:
parent
db68644eff
commit
76d1d50850
|
@ -47,6 +47,7 @@ import { InAppNotificationService } from './services/inapp-notification/inapp-no
|
||||||
import { NotificationService } from './services/notification/notification-service';
|
import { NotificationService } from './services/notification/notification-service';
|
||||||
import { SemanticsService } from './services/semantic/semantics.service';
|
import { SemanticsService } from './services/semantic/semantics.service';
|
||||||
import { PrefillingSourceService } from './services/prefilling-source/prefilling-source.service';
|
import { PrefillingSourceService } from './services/prefilling-source/prefilling-source.service';
|
||||||
|
import { VisibilityRulesService } from '@app/ui/description/editor/description-form/visibility-rules/visibility-rules.service';
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
// This is shared module that provides all the services. Its imported only once on the AppModule.
|
||||||
|
@ -112,7 +113,8 @@ export class CoreServiceModule {
|
||||||
InAppNotificationService,
|
InAppNotificationService,
|
||||||
NotificationService,
|
NotificationService,
|
||||||
SemanticsService,
|
SemanticsService,
|
||||||
PrefillingSourceService
|
PrefillingSourceService,
|
||||||
|
VisibilityRulesService
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<div class="row" *ngFor="let ruleFormGroup of form['controls'] let i=index;" [formGroup]="ruleFormGroup">
|
<div class="row" *ngFor="let ruleFormGroup of form['controls'] let i=index;" [formGroup]="ruleFormGroup">
|
||||||
<span class="col-auto align-self-center">{{i + 1}}</span>
|
<span class="col-auto align-self-center">{{i + 1}}</span>
|
||||||
|
|
||||||
<app-description-template-editor-default-value-component class="col align-self-center" [fieldType]="fieldTypeForCheck" [form]="ruleFormGroup.get('value')" [formArrayOptions]="formArrayOptionsForCheck" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.RULE.FIELDS.RULE-IF'| translate}}" required="true"></app-description-template-editor-default-value-component>
|
<app-description-template-editor-default-value-component *ngIf="isTextType(fieldTypeForCheck)" class="col align-self-center" [fieldType]="fieldTypeForCheck" [form]="ruleFormGroup.get('textValue')" [formArrayOptions]="formArrayOptionsForCheck" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.RULE.FIELDS.RULE-IF'| translate}}" required="true"></app-description-template-editor-default-value-component>
|
||||||
|
<app-description-template-editor-default-value-component *ngIf="isDateType(fieldTypeForCheck)" class="col align-self-center" [fieldType]="fieldTypeForCheck" [form]="ruleFormGroup.get('dateValue')" [formArrayOptions]="formArrayOptionsForCheck" placeHolder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.RULE.FIELDS.RULE-IF'| translate}}" required="true"></app-description-template-editor-default-value-component>
|
||||||
|
|
||||||
<!-- SELECTION -->
|
<!-- SELECTION -->
|
||||||
<mat-form-field class="col align-self-center">
|
<mat-form-field class="col align-self-center">
|
||||||
|
|
|
@ -39,6 +39,30 @@ export class DescriptionTemplateEditorRuleComponent implements OnInit {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isTextType(type: DescriptionTemplateFieldType){
|
||||||
|
return type == DescriptionTemplateFieldType.FREE_TEXT || type == DescriptionTemplateFieldType.CHECK_BOX ||
|
||||||
|
type == DescriptionTemplateFieldType.TEXT_AREA || type == DescriptionTemplateFieldType.RICH_TEXT_AREA ||
|
||||||
|
type == DescriptionTemplateFieldType.BOOLEAN_DECISION || type == DescriptionTemplateFieldType.RADIO_BOX ||
|
||||||
|
type == DescriptionTemplateFieldType.CURRENCY || type == DescriptionTemplateFieldType.SELECT;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTextListType(type: DescriptionTemplateFieldType){
|
||||||
|
return type == DescriptionTemplateFieldType.TAGS || type == DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS ||
|
||||||
|
type == DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
isDateType(type: DescriptionTemplateFieldType){
|
||||||
|
return type == DescriptionTemplateFieldType.DATE_PICKER;
|
||||||
|
}
|
||||||
|
|
||||||
|
isReferenceType(type: DescriptionTemplateFieldType){
|
||||||
|
return type == DescriptionTemplateFieldType.REFERENCE_TYPES;
|
||||||
|
}
|
||||||
|
|
||||||
|
isExternalIdentifierType(type: DescriptionTemplateFieldType){
|
||||||
|
return type == DescriptionTemplateFieldType.VALIDATION || type == DescriptionTemplateFieldType.DATASET_IDENTIFIER;;
|
||||||
|
}
|
||||||
|
|
||||||
targetValidation() {
|
targetValidation() {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,9 +139,9 @@
|
||||||
<!-- <mat-form-field>
|
<!-- <mat-form-field>
|
||||||
<input matInput #email placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS'| translate}}" (focus)="onUserFieldFocus()" (blur)="onUserFieldBlur()" (keyup.enter)="addUser(email)">
|
<input matInput #email placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS'| translate}}" (focus)="onUserFieldFocus()" (blur)="onUserFieldBlur()" (keyup.enter)="addUser(email)">
|
||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
<mat-form-field class="full-width basic-info-input">
|
<mat-form-field class="full-width basic-info-input" *ngIf="!formGroup.disabled">
|
||||||
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}</mat-label>
|
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}</mat-label>
|
||||||
<app-single-auto-complete [disabled]="formGroup.disabled" [required]="false" [formControl]="userFormControl" (optionSelected)="addUser($event)" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}" [configuration]="userService.singleAutocompleteConfiguration">
|
<app-single-auto-complete [required]="false" [formControl]="userFormControl" (optionSelected)="addUser($event)" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}" [configuration]="userService.singleAutocompleteConfiguration">
|
||||||
</app-single-auto-complete>
|
</app-single-auto-complete>
|
||||||
<mat-error *ngIf="formGroup.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
<mat-error *ngIf="formGroup.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -951,7 +951,7 @@ export class DescriptionTemplateRuleEditorModel implements DescriptionTemplateRu
|
||||||
validationErrorModel
|
validationErrorModel
|
||||||
});
|
});
|
||||||
|
|
||||||
['target', 'value'].forEach(keyField => {
|
['target', 'textValue', 'textListValue', 'dateValue'].forEach(keyField => {
|
||||||
const control = formGroup?.get(keyField);
|
const control = formGroup?.get(keyField);
|
||||||
control?.clearValidators();
|
control?.clearValidators();
|
||||||
control?.addValidators(context.getValidation(keyField).validators);
|
control?.addValidators(context.getValidation(keyField).validators);
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!fieldSet?.multiplicity?.tableView" class="col-12">
|
<div *ngIf="!fieldSet?.multiplicity?.tableView" class="col-12">
|
||||||
<div class="row" *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls">
|
<div class="row" *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls">
|
||||||
<div class="col" *ngIf="visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
<div class="col" *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
|
<div *ngFor="let field of fieldSet.fields; let i = index;" class="col-12 compositeField">
|
||||||
<ng-container *ngIf="visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
<ng-container *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5>
|
<h5 *ngIf="placeholderTitle" class="col-auto font-weight-bold">{{field.label}}</h5>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,9 +48,9 @@
|
||||||
<th class="actions"></th>
|
<th class="actions"></th>
|
||||||
</tr>
|
</tr>
|
||||||
<ng-container *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls; let j = index">
|
<ng-container *ngFor="let fieldSetItemPropertiesControl of propertiesFormGroup?.get('items')?.controls; let j = index">
|
||||||
<tr *ngIf="visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
<tr *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[fieldSet.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
||||||
<td *ngFor="let field of fieldSet.fields;" class="text-wrap">
|
<td *ngFor="let field of fieldSet.fields;" class="text-wrap">
|
||||||
<ng-container *ngIf="visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
<ng-container *ngIf="visibilityRulesService && visibilityRulesService.isVisibleMap[field.id + '_' + fieldSetItemPropertiesControl.get('ordinal').value]">
|
||||||
{{fieldSetItemPropertiesControl.get('fields').get(field.id).get('value').getRawValue()}}
|
{{fieldSetItemPropertiesControl.get('fields').get(field.id).get('value').getRawValue()}}
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class DescriptionFormAnnotationService extends BaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCount(anchor: string) {
|
public getCount(anchor: string) {
|
||||||
if (this.annotationsPerAnchor.has(anchor)) {
|
if (this.annotationsPerAnchor != null && this.annotationsPerAnchor.has(anchor)) {
|
||||||
return this.annotationsPerAnchor.get(anchor);
|
return this.annotationsPerAnchor.get(anchor);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue