Delete buttons
LogIn Page Fix fix Multiplisity Ids fixVizibility to Child Items
This commit is contained in:
parent
498f690f22
commit
853be683a8
|
@ -9,9 +9,9 @@ export interface SingleAutoCompleteConfiguration {
|
|||
// Load and present items from start, without user query. Default: true.
|
||||
loadDataOnStart?: boolean;
|
||||
// Static or initial items.
|
||||
initialItems?: (data?:any) => Observable<any[]>;
|
||||
initialItems?: (data?: any) => Observable<any[]>;
|
||||
// Data retrieval function
|
||||
filterFn?: (searchQuery: string, data?:any) => Observable<any[]>;
|
||||
filterFn?: (searchQuery: string, data?: any) => Observable<any[]>;
|
||||
// Property formating for input
|
||||
displayFn?: (item: any) => string;
|
||||
// Property formating for dropdown
|
||||
|
@ -22,4 +22,6 @@ export interface SingleAutoCompleteConfiguration {
|
|||
subtitleFn?: (item: any) => string;
|
||||
//Extra data passed to query function
|
||||
extraData?: any;
|
||||
// Callback to intercept value assignment based on item selection
|
||||
valueAssign?: (selectedItem: any) => any;
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ export class SingleAutoCompleteComponent implements OnInit, MatFormFieldControl<
|
|||
}
|
||||
|
||||
_optionSelected(event: MatAutocompleteSelectedEvent) {
|
||||
this._setValue(event.option.value);
|
||||
this._setValue(this.configuration.valueAssign ? this.configuration.valueAssign(event.option.value) : event.option.value);
|
||||
this.stateChanges.next();
|
||||
this.optionSelected.emit(event.option.value);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
<mat-error *ngIf="form.get('multiplicity').get('max').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' |
|
||||
translate}}</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="col">
|
||||
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.ORDER' | translate}}"
|
||||
[formControl]="this.form.get('ordinal')">
|
||||
|
@ -51,7 +50,7 @@
|
|||
[formControl]="this.form.get('extendedDescription')"></textarea>
|
||||
</mat-form-field>
|
||||
<app-dataset-profile-editor-field-component class="col-12" *ngIf="!isComposite" [form]="form.get('fields').get(''+0)"
|
||||
[showOrdinal]="false" [showMultiplicity]="false" [indexPath]="indexPath + 'f' + 0"></app-dataset-profile-editor-field-component>
|
||||
[showOrdinal]="false" [indexPath]="indexPath + 'f' + 0"></app-dataset-profile-editor-field-component>
|
||||
</div>
|
||||
<div *ngIf="isComposite" class="row">
|
||||
<h4 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.SUB-FIELDS-TITLE' |
|
||||
|
@ -61,7 +60,7 @@
|
|||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>{{i + 1}}. {{getFieldTile(field, i)}}</mat-panel-title>
|
||||
<div class="row">
|
||||
<button mat-icon-button type="button" class="btn btn-sm col-auto" style="margin-right:0.7em;" (click)="DeleteField(i);">
|
||||
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteField(i);">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
.full-width{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.deleteBtn{
|
||||
margin-right:0.7em;
|
||||
}
|
|
@ -35,18 +35,6 @@
|
|||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row">
|
||||
<mat-checkbox class="col" *ngIf="showMultiplicity" [(ngModel)]="isFieldMultiplicityEnabled" (ngModelChange)="onIsFieldMultiplicityEnabledChange(isFieldMultiplicityEnabled)">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.MULTIPLICITY-CHECKBOX'
|
||||
| translate}}</mat-checkbox>
|
||||
<mat-form-field class="col" *ngIf="showMultiplicity && isFieldMultiplicityEnabled">
|
||||
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.MULTIPLICITY-MIN' | translate}}"
|
||||
[formControl]="this.form.get('multiplicity').get('min')">
|
||||
</mat-form-field>
|
||||
<mat-form-field class="col" *ngIf="showMultiplicity && isFieldMultiplicityEnabled">
|
||||
<input matInput type="number" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.MULTIPLICITY-MAX' | translate}}"
|
||||
[formControl]="this.form.get('multiplicity').get('max')">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="row" [ngSwitch]="form.get('viewStyle').get('renderStyle').value">
|
||||
<app-dataset-profile-editor-combo-box-field-component *ngSwitchCase="viewStyleEnum.ComboBox" class="col-12" [form]="form"></app-dataset-profile-editor-combo-box-field-component>
|
||||
<app-dataset-profile-editor-radio-box-field-component *ngSwitchCase="viewStyleEnum.RadioBox" class="col-12" [form]="form"></app-dataset-profile-editor-radio-box-field-component>
|
||||
|
|
|
@ -22,7 +22,6 @@ import { RuleEditorModel } from '../../../admin/rule-editor-model';
|
|||
export class DatasetProfileEditorFieldComponent extends BaseComponent implements OnInit {
|
||||
|
||||
@Input() form: FormGroup;
|
||||
@Input() showMultiplicity = true;
|
||||
@Input() showOrdinal = true;
|
||||
@Input() indexPath: string;
|
||||
validationTypeEnum = ValidationType;
|
||||
|
@ -35,7 +34,7 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
|
||||
ngOnInit() {
|
||||
if (this.form.get('multiplicity')) {
|
||||
if (this.form.get('multiplicity').value.min > 1 || this.form.get('multiplicity').value.max > 1) {
|
||||
if (this.form.get('multiplicity').value.min > 1 && this.form.get('multiplicity').value.max > 1) {
|
||||
this.isFieldMultiplicityEnabled = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<mat-card class="field-card" *ngFor="let fieldControl of form.get('fieldSets')['controls'] let i=index;">
|
||||
<div class="row">
|
||||
<mat-card-title class="col">{{i + 1}}. {{getFieldTile(fieldControl, i)}}</mat-card-title>
|
||||
<button mat-icon-button type="button" class="btn btn-sm col-auto" style="margin-right:0.7em;" (click)="deleteFieldSet(i);">
|
||||
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="deleteFieldSet(i);">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
<app-dataset-profile-editor-composite-field-component class="col-12" [form]="fieldControl" [indexPath]="indexPath + 'cf' + i"></app-dataset-profile-editor-composite-field-component>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<mat-panel-title>{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</mat-panel-title>
|
||||
<div class="row">
|
||||
<!-- <span class="col">{{i + 1}}. {{form.get('sections').get(''+i).get('title').value}}</span> -->
|
||||
<button mat-icon-button type="button" class="btn btn-sm col-auto" style="margin-right:0.7em;" (click)="DeleteSectionInSection(i);">
|
||||
<button mat-icon-button type="button" class="deleteBtn col-auto" (click)="DeleteSectionInSection(i);">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
margin-bottom: 1em;
|
||||
}
|
||||
}
|
||||
.deleteBtn{
|
||||
margin-right:0.7em;
|
||||
}
|
|
@ -43,10 +43,12 @@ export class LoginService extends BaseService {
|
|||
|
||||
|
||||
public onLogInSuccess(loginResponse: any, returnUrl: string) {
|
||||
this.zone.run(() => {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-LOGIN'), SnackBarNotificationLevel.Success);
|
||||
if (this.authService.current().culture) { this.cultureService.cultureSelected(this.authService.current().culture); }
|
||||
const redirectUrl = returnUrl || '/';
|
||||
this.router.navigate([redirectUrl]);
|
||||
});
|
||||
}
|
||||
|
||||
public onLogInError(errorMessage: string) {
|
||||
|
|
|
@ -4,25 +4,25 @@
|
|||
<div *ngIf="form.get('fields').length === 1 && this.visibilityRulesService.checkElementVisibility(form.get('fields')['controls'][0].get('id').value)"
|
||||
class="col-12">
|
||||
<div class="row">
|
||||
<h5 *ngIf="form.get('title').value" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
||||
<h5 *ngIf="form.get('title').value && !isChild" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
||||
{{form.get('title').value}}
|
||||
<!-- <a *ngIf="this.markForConsiderationService.exists(compositeField)" (click)="markForConsideration()" style="cursor: pointer">
|
||||
Mark For Consideration
|
||||
</a> -->
|
||||
</h5>
|
||||
<h6 *ngIf="form.get('description').value">{{form.get('description').value}}</h6>
|
||||
<h6 *ngIf="form.get('extendedDescription').value" class="col-12">
|
||||
<h6 *ngIf="form.get('description').value && !isChild">{{form.get('description').value}}</h6>
|
||||
<h6 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12">
|
||||
<i>{{form.get('extendedDescription').value}}</i>
|
||||
</h6>
|
||||
<app-form-field class="col-12" [form]="form.get('fields')['controls'][0]" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
<app-form-field class="col-12" [form]="form.get('fields')['controls'][0]" [datasetProfileId]="datasetProfileId" [isChild]="isChild"></app-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="form.get('fields').length > 1" class="col-12">
|
||||
<div class="row">
|
||||
<h5 *ngIf="form.get('title').value" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
||||
<h5 *ngIf="form.get('title').value && !isChild" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
||||
{{form.get('title').value}}</h5>
|
||||
<h5 *ngIf="form.get('description').value" class="col-12">{{form.get('description').value}}</h5>
|
||||
<h5 *ngIf="form.get('extendedDescription').value" class="col-12">
|
||||
<h5 *ngIf="form.get('description').value && !isChild" class="col-12">{{form.get('description').value}}</h5>
|
||||
<h5 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12">
|
||||
<i>{{form.get('extendedDescription').value}}</i>
|
||||
</h5>
|
||||
<div *ngFor="let fieldFormGroup of form.get('fields')['controls']; let i = index;" class="col-12">
|
||||
|
@ -34,10 +34,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<app-form-field [form]="fieldFormGroup" class="col-12" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
<app-form-field [form]="fieldFormGroup" class="col-12" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
|
||||
<div *ngIf="fieldFormGroup" class="col-12">
|
||||
<div *ngFor="let multipleField of fieldFormGroup.get('multiplicityItems')['controls']; let j = index" class="row">
|
||||
<app-form-field class="col-12" [form]="multipleField" [datasetProfileId]="datasetProfileId"></app-form-field>
|
||||
<app-form-field class="col-12" [form]="multipleField" [datasetProfileId]="datasetProfileId"[isChild]="true"></app-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ export class FormCompositeFieldComponent {
|
|||
|
||||
@Input() datasetProfileId: String;
|
||||
@Input() form: FormGroup;
|
||||
@Input() isChild: Boolean =false;
|
||||
|
||||
constructor(
|
||||
public visibilityRulesService: VisibilityRulesService,
|
||||
|
@ -23,9 +24,9 @@ export class FormCompositeFieldComponent {
|
|||
}
|
||||
|
||||
addMultipleField(fieldIndex: number) {
|
||||
// const field: DatasetDescriptionFieldEditorModel = this.compositeField.fields[fieldIndex].cloneForMultiplicity(fieldIndex, '');
|
||||
// this.compositeField.fields[fieldIndex].multiplicityItems.push(field);
|
||||
// (<FormArray>(this.form.get('fields').get('' + fieldIndex).get('multiplicityItems'))).push(field.buildForm());
|
||||
const compositeFieldToBeCloned = (this.form.get('compositeFields').get('' + fieldIndex) as FormGroup).getRawValue();
|
||||
const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned);
|
||||
(<FormArray>(this.form.get('compositeFields').get('' + fieldIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
||||
}
|
||||
|
||||
// markForConsideration() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div *ngIf="form && this.visibilityRulesService.checkElementVisibility(this.form.get('id').value)" [id]="this.form.get('id').value"
|
||||
[formGroup]="form" [ngSwitch]="this.form.get('viewStyle').value.renderStyle" class="dynamic-form-field row">
|
||||
|
||||
<h5 *ngIf="this.form.get('title').value">{{this.form.get('title').value}}</h5>
|
||||
<h5 *ngIf="this.form.get('title').value && !isChild">{{this.form.get('title').value}}</h5>
|
||||
|
||||
<h5 *ngIf="this.form.get('description').value" class="col-12">{{this.form.get('description').value}}</h5>
|
||||
<h5 *ngIf="this.form.get('extendedDescription').value" class="col-12"><i>{{this.form.get('extendedDescription').value}}</i></h5>
|
||||
<h5 *ngIf="this.form.get('description').value && !isChild" class="col-12">{{this.form.get('description').value}}</h5>
|
||||
<h5 *ngIf="this.form.get('extendedDescription').value && !isChild" class="col-12"><i>{{this.form.get('extendedDescription').value}}</i></h5>
|
||||
|
||||
<mat-form-field *ngSwitchCase="datasetProfileFieldViewStyleEnum.FreeText" class="col-12">
|
||||
<input matInput formControlName="value" placeholder="{{form.get('data').value.label}}" [required]="form.get('validationRequired').value">
|
||||
|
|
|
@ -20,6 +20,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
// @Input() field: Field;
|
||||
@Input() form: FormGroup;
|
||||
@Input() datasetProfileId: String;
|
||||
@Input() isChild: Boolean =false;
|
||||
|
||||
// change: Subscription;
|
||||
// trackByFn = (index, item) => item ? item['id'] : null;
|
||||
|
@ -42,7 +43,8 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
filterFn: this.searchFromAutocomplete.bind(this),
|
||||
initialItems: (extraData) => this.searchFromAutocomplete(''),
|
||||
displayFn: (item) => item['label'],
|
||||
titleFn: (item) => item['label']
|
||||
titleFn: (item) => item['label'],
|
||||
valueAssign: (item) => JSON.stringify(item)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
Add one more fieldset +
|
||||
</button>
|
||||
</div>
|
||||
<app-form-composite-field class="col-12" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId"></app-form-composite-field>
|
||||
<app-form-composite-field class="col-12" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId" [isChild]="false"></app-form-composite-field>
|
||||
<div *ngIf="compositeFieldFormGroup" class="col-12">
|
||||
<div class="row">
|
||||
<app-form-composite-field class="col-12" *ngFor="let multipleCompositeFieldFormGroup of compositeFieldFormGroup.get('multiplicityItems')['controls']; let j = index"
|
||||
[form]="multipleCompositeFieldFormGroup" [datasetProfileId]="datasetProfileId"></app-form-composite-field>
|
||||
[form]="multipleCompositeFieldFormGroup" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-composite-field>
|
||||
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12" [formGroup]="compositeFieldFormGroup">
|
||||
<input matInput formControlName="commentFieldValue" placeholder="comment">
|
||||
</mat-form-field>
|
||||
|
|
|
@ -35,7 +35,7 @@ export class FormSectionComponent implements OnInit {
|
|||
|
||||
addMultipleField(fieldsetIndex: number) {
|
||||
const compositeFieldToBeCloned = (this.form.get('compositeFields').get('' + fieldsetIndex) as FormGroup).getRawValue();
|
||||
const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned, fieldsetIndex);
|
||||
const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned);
|
||||
(<FormArray>(this.form.get('compositeFields').get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import { Page } from "../../../core/model/dataset-profile-definition/page";
|
|||
import { Rule } from "../../../core/model/dataset-profile-definition/rule";
|
||||
import { Section } from "../../../core/model/dataset-profile-definition/section";
|
||||
import { ViewStyle } from "../../../core/model/dataset-profile-definition/view-style";
|
||||
import { Guid } from "../../../common/types/guid";
|
||||
|
||||
export class DatasetDescriptionFormEditorModel extends BaseFormModel {
|
||||
|
||||
|
@ -108,7 +109,7 @@ export class DatasetDescriptionSectionEditorModel extends BaseFormModel {
|
|||
formGroup.addControl('description', new FormControl({ value: this.description, disabled: true }));
|
||||
formGroup.addControl('numbering', new FormControl({ value: this.numbering, disabled: true }));
|
||||
formGroup.addControl('title', new FormControl({ value: this.title, disabled: true }));
|
||||
formGroup.addControl('id', new FormControl({ value: this.title, disabled: true }));
|
||||
formGroup.addControl('id', new FormControl({ value: this.title, disabled: false }));
|
||||
return formGroup;
|
||||
}
|
||||
}
|
||||
|
@ -183,11 +184,11 @@ export class DatasetDescriptionCompositeFieldEditorModel extends BaseFormModel {
|
|||
// return newItem;
|
||||
// }
|
||||
|
||||
cloneForMultiplicity(item: CompositeField, index: number): DatasetDescriptionCompositeFieldEditorModel {
|
||||
cloneForMultiplicity(item: CompositeField): DatasetDescriptionCompositeFieldEditorModel {
|
||||
const newItem: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel();
|
||||
newItem.id = 'multiple_' + item.id + '_' + index;
|
||||
newItem.id = 'multiple_' + item.id + '_' + Guid.create();
|
||||
item.fields.forEach((field, index) => {
|
||||
newItem.fields.push(new DatasetDescriptionFieldEditorModel().cloneForMultiplicity(field, index, newItem.id + '_'));
|
||||
newItem.fields.push(new DatasetDescriptionFieldEditorModel().cloneForMultiplicity(field, newItem.id + '_'));
|
||||
});
|
||||
newItem.ordinal = item.ordinal;
|
||||
return newItem;
|
||||
|
@ -240,7 +241,7 @@ export class DatasetDescriptionFieldEditorModel extends BaseFormModel {
|
|||
|
||||
const formGroup = this.formBuilder.group({
|
||||
value: [this.value, this.validationRequired === true ? Validators.required : null],
|
||||
id: [{ value: this.id, disabled: true }],
|
||||
id: [{ value: this.id, disabled: false }],
|
||||
viewStyle: [{ value: this.viewStyle, disabled: true }],
|
||||
data: [{ value: this.data, disabled: true }],
|
||||
validationRequired: [{ value: this.validationRequired, disabled: true }],
|
||||
|
@ -274,10 +275,10 @@ export class DatasetDescriptionFieldEditorModel extends BaseFormModel {
|
|||
|
||||
// return newItem;
|
||||
// }
|
||||
cloneForMultiplicity(item: Field, index: number, idPath: string): DatasetDescriptionFieldEditorModel {
|
||||
cloneForMultiplicity(item: Field,idPath: string): DatasetDescriptionFieldEditorModel {
|
||||
const newItem: DatasetDescriptionFieldEditorModel = new DatasetDescriptionFieldEditorModel();
|
||||
|
||||
newItem.id = idPath ? idPath + index : 'multiple_' + item.id + '_' + index;
|
||||
newItem.id = idPath ? idPath + Guid.create() : 'multiple_' + item.id + '_' + Guid.create();
|
||||
newItem.title = item.title;
|
||||
newItem.description = item.description;
|
||||
newItem.extendedDescription = item.extendedDescription;
|
||||
|
|
Loading…
Reference in New Issue