Merge branch 'AdminTemplateRedesign' into WizardDescriptionRefactor
This commit is contained in:
commit
41a1aeaf1f
|
@ -1,7 +1,8 @@
|
|||
import { AutoCompleteSingleData } from "@app/core/model/dataset-profile-definition/field-data/field-data";
|
||||
import { BaseCriteria } from "../base-criteria";
|
||||
|
||||
export class DatasetExternalAutocompleteCriteria extends BaseCriteria {
|
||||
public profileID: String;
|
||||
public fieldID: String;
|
||||
public autocompleteOptions: any;
|
||||
public autocompleteOptions: AutoCompleteSingleData;
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { DatasetExternalAutocompleteCriteria } from '../../query/dataset/daatset-external-autocomplete-criteria';
|
||||
import { RequestItem } from '../../query/request-item';
|
||||
import { DatasetProfileService } from '../dataset-profile/dataset-profile.service';
|
||||
import { ConfigurationService } from '../configuration/configuration.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class DatasetExternalAutocompleteService {
|
||||
|
@ -27,4 +28,14 @@ export class DatasetExternalAutocompleteService {
|
|||
return this.httpClient.post(this.configurationService.server + 'search/autocomplete', lookUpItem);
|
||||
}
|
||||
|
||||
queryApi(requestItem: RequestItem<DatasetExternalAutocompleteCriteria>):Observable<any>{ //TODO
|
||||
|
||||
return of([
|
||||
{
|
||||
label:'Preview not supported yet',
|
||||
source:''
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
|
@ -203,9 +203,17 @@
|
|||
</mat-radio-group>
|
||||
</div> -->
|
||||
<div class="col-12" *ngIf="showPreview">
|
||||
<app-form-field [form]="previewForm" *ngIf="previewForm">
|
||||
<ng-container *ngIf="viewType === viewTypeEnum.Other else regularField">
|
||||
<app-form-field [form]="previewForm" *ngIf="previewForm" [autocompleteOptions]="form.get('data').get('autoCompleteSingleDataList').getRawValue()">
|
||||
|
||||
</app-form-field>
|
||||
</app-form-field>
|
||||
</ng-container>
|
||||
|
||||
<ng-template #regularField>
|
||||
<app-form-field [form]="previewForm" *ngIf="previewForm">
|
||||
|
||||
</app-form-field>
|
||||
</ng-template>
|
||||
</div>
|
||||
<div class="col-12" *ngIf="!this.form.get('viewStyle').get('renderStyle').value">
|
||||
<em>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<div class="row" [id]="idprefix+form.get('id').value">
|
||||
<div id="topofcontainer"></div>
|
||||
<div class="row" [id]="idprefix+form.get('id').value">
|
||||
|
||||
<!-- SECTION INFO -->
|
||||
<mat-card style="margin-bottom: 2em; padding: 2em;" class="col-12" >
|
||||
|
@ -58,7 +59,6 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- COPIA -->
|
||||
<!-- <div class="row"> -->
|
||||
|
||||
|
|
|
@ -106,10 +106,7 @@ export class DatasetProfileEditorSectionFieldSetComponent extends BaseComponent
|
|||
this.numbering = this.tocentry.numbering;
|
||||
this._selectedFieldSetId = null;
|
||||
|
||||
let el = this.myElement.nativeElement.querySelector("#"+this.idprefix+this.tocentry.id);
|
||||
if(el){
|
||||
el.scrollIntoView({behavior: "smooth"});
|
||||
}
|
||||
this._scrollToElement(this.tocentry.id);
|
||||
}else if(this.tocentry.type === ToCEntryType.FieldSet){
|
||||
this.form = this.tocentry.form.parent.parent;
|
||||
const numberingArray = this.tocentry.numbering.split('.');
|
||||
|
@ -118,23 +115,39 @@ export class DatasetProfileEditorSectionFieldSetComponent extends BaseComponent
|
|||
this.numbering = numberingArray.join('.');
|
||||
}
|
||||
this.selectedFieldSetId = this.tocentry.id;
|
||||
//scroll to fieldset
|
||||
// setTimeout(() => {
|
||||
// const element = document.getElementById(this.selectedFieldSetId);
|
||||
// element.scrollTop = element.scrollHeight;
|
||||
// }, 2000);
|
||||
|
||||
let el = this.myElement.nativeElement.querySelector("#"+this.idprefix+this.selectedFieldSetId);
|
||||
// let el = this.myElement.nativeElement.getElementbyId (this.selectedFieldSetId);
|
||||
|
||||
if(el){
|
||||
el.scrollIntoView({behavior: "smooth"});
|
||||
}
|
||||
this._scrollToElement(this.selectedFieldSetId);
|
||||
}else{//scroll on top
|
||||
window.scrollTo({top:0, behavior:'smooth'});
|
||||
this._scrollOnTop();
|
||||
}
|
||||
}
|
||||
|
||||
private _scrollToElement(id: string){
|
||||
let el = this.myElement.nativeElement.querySelector("#"+this.idprefix+id);
|
||||
// let el = this.myElement.nativeElement.getElementbyId (this.selectedFieldSetId);
|
||||
|
||||
if(el){
|
||||
|
||||
setTimeout(() => {
|
||||
const el = this.myElement.nativeElement.querySelector("#"+this.idprefix+id);
|
||||
if(el){
|
||||
el.scrollIntoView({behavior: "smooth"});
|
||||
}
|
||||
}, 300);
|
||||
}else{
|
||||
this._scrollOnTop();
|
||||
}
|
||||
|
||||
}
|
||||
private _scrollOnTop(){
|
||||
setTimeout(() => {
|
||||
const el = this.myElement.nativeElement.querySelector('#topofcontainer');
|
||||
if(el){
|
||||
el.scrollIntoView({behavior:'smooth'})
|
||||
}
|
||||
},200);
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
|
||||
this.initialize();
|
||||
|
|
|
@ -192,8 +192,6 @@
|
|||
<div class="row sticky-top" style="top : 2em;">
|
||||
<dataset-profile-table-of-contents class="toc-pane-container col"
|
||||
[links]="toCEntries"
|
||||
(stepFound)="onStepFound($event)"
|
||||
(currentLinks)="getLinks($event)"
|
||||
(itemClick)="displayItem($event)"
|
||||
(newEntry)="addNewEntry($event)"
|
||||
(createEntry) = "addNewEntry($event)"
|
||||
|
@ -203,6 +201,59 @@
|
|||
(dataNeedsRefresh)="onDataNeedsRefresh()"
|
||||
[colorizeInvalid]="colorizeInvalid">
|
||||
</dataset-profile-table-of-contents>
|
||||
|
||||
|
||||
|
||||
<div class="col-12 mt-4">
|
||||
<div class="row justify-content-end">
|
||||
<!-- SAVE BUTTON -->
|
||||
<div class="col-6 d-flex justify-content-end">
|
||||
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
</div>
|
||||
<!-- <div class="col-6 d-flex justify-content-end" *ngIf="!viewOnly">
|
||||
<ng-container *ngIf="true">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
</ng-container>
|
||||
|
||||
-->
|
||||
|
||||
<!-- <button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='onSubmit()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.SAVE' |
|
||||
translate}}</button>
|
||||
<button mat-raised-button class="col-auto" color="primary" type="button col-auto"
|
||||
(click)='finalize()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.FINALIZE' |
|
||||
translate}}</button> -->
|
||||
<!-- </div> -->
|
||||
<!-- SAVE BUTTON WHEN FINALIZED-->
|
||||
<!-- <div class="col-6 d-flex" *ngIf="showUpdateButton()">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='updateFinalized()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE' |
|
||||
translate}}</button>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- DELETE BUTTON -->
|
||||
<!-- <div class="col-12 d-flex justify-content-end" *ngIf="!isNew">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button color="primary" (click)="delete()">
|
||||
<mat-icon>delete</mat-icon>{{'DATASET-PROFILE-EDITOR.ACTIONS.DELETE' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -404,7 +455,7 @@
|
|||
<!-- SAVE BUTTON -->
|
||||
<div class="col-6 d-flex" *ngIf="!viewOnly">
|
||||
<div class="row mt-4">
|
||||
<ng-container *ngIf="true">
|
||||
<ng-container *ngIf="false">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
|
@ -423,9 +474,11 @@
|
|||
<!-- SAVE BUTTON WHEN FINALIZED-->
|
||||
<div class="col-6 d-flex" *ngIf="showUpdateButton()">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
<ng-container *ngIf="false">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='checkFormValidation()'
|
||||
[disabled]="form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.VALIDATE' | translate}}</button>
|
||||
</ng-container>
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto"
|
||||
(click)='updateFinalized()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE' |
|
||||
translate}}</button>
|
||||
|
|
|
@ -478,10 +478,6 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
this.links = currentLinks;
|
||||
}
|
||||
|
||||
linkToScroll: LinkToScroll;
|
||||
onStepFound(linkToScroll: LinkToScroll) {
|
||||
this.linkToScroll = linkToScroll;
|
||||
}
|
||||
|
||||
datasetWizardModel: DatasetWizardEditorModel;
|
||||
formGroup: FormGroup;
|
||||
|
@ -1532,13 +1528,13 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
|
||||
switch(keyError){
|
||||
case EditorCustomValidatorsEnum.atLeastOneSectionInPage:
|
||||
errmess.push('Each section must have at least one subsection');
|
||||
errmess.push( this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.FORM-VALIDATION.ERROR-MESSAGES.PAGE-MUST-HAVE-SECTION'));
|
||||
break;
|
||||
case EditorCustomValidatorsEnum.emptyArray:
|
||||
errmess.push(numbering+" needs more information.")
|
||||
errmess.push(numbering+this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.FORM-VALIDATION.ERROR-MESSAGES.NEEDS-MORE-INFORMATION'))
|
||||
break;
|
||||
case EditorCustomValidatorsEnum.sectionMustHaveOneChild:
|
||||
errmess.push(numbering+" must have either subsection or input sets.")
|
||||
errmess.push(numbering+this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.FORM-VALIDATION.ERROR-MESSAGES.MUST-HAVE-SECTION-OR-FIELDSET'))
|
||||
break;
|
||||
default:
|
||||
if (typeof errors[keyError] === 'boolean') {
|
||||
|
@ -1610,10 +1606,10 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
result.forEach(err=>{
|
||||
// console.log(err);
|
||||
if(err.key){
|
||||
errmess.push(`Missing ${err.key}` );
|
||||
errmess.push(`${this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.FORM-VALIDATION.ERROR-MESSAGES.MISSING')} ${err.key}` );
|
||||
}else{
|
||||
|
||||
errmess.push('Make sure you provide a section and a subsection');
|
||||
errmess.push(this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.FORM-VALIDATION.ERROR-MESSAGES.PROVIDE-PAGE-AND-SECTION'));
|
||||
}
|
||||
// errmess.push(...this._buildErrorMessage(err.errors,"", err.key) );
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
|
||||
<span style="cursor: pointer;" (click)="deleteEntry(parentLink)"
|
||||
[hidden]="!(!viewOnly && (itemSelected?.id == parentLink?.id))"
|
||||
[hidden]="!(!viewOnly && (itemSelected?.id == parentLink?.id) && (parentLink?.type != tocEntryType.FieldSet))"
|
||||
>
|
||||
<mat-icon style="font-size: 1.4em;">delete</mat-icon>
|
||||
</span>
|
||||
|
|
|
@ -239,7 +239,7 @@ export class DatasetProfileTableOfContentsInternalSection extends BaseComponent
|
|||
if(!this.colorizeInvalid) return false;
|
||||
|
||||
const form = this.parentLink.form;
|
||||
if(!form || form.valid || !form.touched) return false;
|
||||
if((!form || form.valid || !form.touched) && this.parentLink.type !== this.tocEntryType.Page) return false;
|
||||
|
||||
const allFieldsAreTouched = this.allFieldsAreTouched(form);
|
||||
|
||||
|
@ -248,11 +248,20 @@ export class DatasetProfileTableOfContentsInternalSection extends BaseComponent
|
|||
|
||||
if(form.errors && allFieldsAreTouched) return true;
|
||||
|
||||
//check if page has sections
|
||||
if(this.parentLink.type === this.tocEntryType.Page && allFieldsAreTouched){
|
||||
const rootForm = form.root;
|
||||
if(rootForm){
|
||||
const sections = rootForm.get('sections') as FormArray;
|
||||
if(!sections.controls.find(section=>section.get('page').value === this.parentLink.id)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//checking form controls if have errors
|
||||
//checking first child form controls if have errors
|
||||
let hasErrors = false;
|
||||
|
||||
if(allFieldsAreTouched){
|
||||
if(form instanceof FormGroup){
|
||||
const formGroup = form as FormGroup;
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
<div class="">
|
||||
<!-- <div class="docs-toc-heading">Contents</div> -->
|
||||
<!-- <nav> -->
|
||||
<!-- <a [href]="_rootUrl + '#' + link.id" -->
|
||||
|
||||
<h3 id="guide-steps">{{'DMP-EDITOR.STEPPER.USER-GUIDE' | translate}}</h3>
|
||||
<div class="scroll-container" id="style-2">
|
||||
<!-- <span *ngFor="let link of links; let i = index" (click)="toggle(link); goToStep(link)" class="docs-level-{{link.type}} docs-link mt-0" [class.docs-active]="link.active">
|
||||
<span *ngIf="link.show" class="link-name"><span [class.selected]="link.selected && isActive">{{link.name}}</span></span>
|
||||
</span> -->
|
||||
|
||||
<app-dataset-profile-table-of-contents-internal-section [links]="links" (itemClick)="itemClicked($event)"
|
||||
(newEntry)="addNewEntry($event)" (removeEntry)="deleteEntry($event)"
|
||||
(createFooEntry)="createNewEntry($event)"
|
||||
|
@ -23,12 +18,8 @@
|
|||
[parentRootId]="ROOT_ID"
|
||||
style="padding-right: 1em;"
|
||||
[colorizeInvalid]="colorizeInvalid"
|
||||
></app-dataset-profile-table-of-contents-internal-section>
|
||||
>
|
||||
</app-dataset-profile-table-of-contents-internal-section>
|
||||
|
||||
<!-- <span *ngFor="let link of links; let i = index" (click)="toggle(link); goToStep(link);" class="docs-link mt-0">
|
||||
<span class="link-name" (click)="itemClicked(link)"><span>{{link.label}}</span></span>
|
||||
<dataset-profile-table-of-contents *ngIf="link.subEntries" [links]="link.subEntries" (itemClick)="propagateClickToParent($event, link)"></dataset-profile-table-of-contents>
|
||||
</span> -->
|
||||
<!-- </nav> -->
|
||||
</div>
|
||||
</div>
|
|
@ -9,6 +9,7 @@ import { Foo, ToCEntry, ToCEntryType } from './table-of-contents-entry';
|
|||
import { DragulaService } from 'ng2-dragula';
|
||||
import { FormArray } from '@angular/forms';
|
||||
import { MatSnackBar, MatSnackBarConfig } from '@angular/material';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
export interface Link {
|
||||
/* id of the section*/
|
||||
|
@ -35,17 +36,13 @@ export interface Link {
|
|||
export class DatasetProfileTableOfContents extends BaseComponent implements OnInit {
|
||||
|
||||
@Input() links: ToCEntry[];
|
||||
container: string;
|
||||
headerSelectors = '.toc-page-header, .toc-section-header, .toc-compositeField-header';
|
||||
@Output() stepFound = new EventEmitter<LinkToScroll>();
|
||||
@Output() currentLinks = new EventEmitter<Link[]>();
|
||||
|
||||
@Output() itemClick = new EventEmitter<ToCEntry>();
|
||||
@Output() newEntry = new EventEmitter<ToCEntry>();
|
||||
@Output() removeEntry = new EventEmitter<ToCEntry>();
|
||||
|
||||
|
||||
@Output() createEntry = new EventEmitter<Foo>();
|
||||
@Output() createEntry = new EventEmitter<Foo>();//TODO
|
||||
|
||||
@Output() dataNeedsRefresh = new EventEmitter<void>();
|
||||
|
||||
|
@ -64,11 +61,6 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
|
||||
@Input() viewOnly: boolean;
|
||||
|
||||
subscription: Subscription;
|
||||
linksSubject: Subject<HTMLElement[]> = new Subject<HTMLElement[]>();
|
||||
|
||||
@Input() isActive: boolean;
|
||||
show: boolean = false;
|
||||
isDragging: boolean = false;
|
||||
draggingItemId: string = null;
|
||||
|
@ -77,11 +69,14 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
DRAGULA_ITEM_ID_PREFIX="table_item_id_";
|
||||
ROOT_ID: string = "ROOT_ID";//no special meaning
|
||||
private _dragStartedAt;
|
||||
|
||||
|
||||
constructor(
|
||||
@Inject(DOCUMENT) private _document: Document,
|
||||
private dragulaService: DragulaService,
|
||||
private snackbar: MatSnackBar
|
||||
private snackbar: MatSnackBar,
|
||||
private language: TranslateService
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -96,6 +91,25 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
const drake = dragula.drake;
|
||||
|
||||
drake.on('drop', (el, target, source,sibling)=>{
|
||||
|
||||
if(this._dragStartedAt){
|
||||
const timeNow = new Date().getTime();
|
||||
|
||||
if(timeNow - this._dragStartedAt> 600){
|
||||
console.log('timenow: ', timeNow);
|
||||
console.log('timestarted', this._dragStartedAt);
|
||||
this._dragStartedAt = null;
|
||||
|
||||
}else{
|
||||
this.dataNeedsRefresh.emit();// even though the data is not changed the TABLE DRAG may has changed
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
this.dataNeedsRefresh.emit();// even though the data is not changed the TABLE DRAG may has changed
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
const elementId = (el.id as string).replace(this.DRAGULA_ITEM_ID_PREFIX,'');
|
||||
const targetId = target.id as string;
|
||||
const sourceId = source.id as string;
|
||||
|
@ -123,7 +137,8 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
switch(element.type){
|
||||
case ToCEntryType.FieldSet:
|
||||
if(targetContainer.type != this.tocEntryType.Section){
|
||||
const message = 'Fieldset can only be child of Subsections';
|
||||
// const message = 'Fieldset can only be child of Subsections';
|
||||
const message = this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.FIELDSET-MUST-HAVE-PARENT-SECTION');
|
||||
console.error(message);
|
||||
this.notifyUser(message)
|
||||
this.dataNeedsRefresh.emit();
|
||||
|
@ -132,7 +147,8 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
//check if target container has no sections
|
||||
if((targetContainer.form.get('sections') as FormArray).length){
|
||||
const message = 'Cannot have inputs and sections on the same level';
|
||||
// const message = 'Cannot have inputs and sections on the same level';
|
||||
const message = this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');
|
||||
this.notifyUser(message);
|
||||
console.error(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
|
@ -207,7 +223,8 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
if(targetContainer.type == ToCEntryType.Section){
|
||||
if((targetContainer.form.get('fieldSets')as FormArray).length){
|
||||
const message = 'Cannot have inputs and sections on the same level';
|
||||
// const message = 'Cannot have inputs and sections on the same level';
|
||||
const message = this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.INPUT-SECTION-SAME-LEVEL');;
|
||||
this.notifyUser(message);
|
||||
console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
|
@ -341,7 +358,8 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
targetSectionsArray.push(sectionForm);
|
||||
|
||||
}else{
|
||||
const message = 'Drag not support to specific container';
|
||||
// const message = 'Drag not support to specific container';
|
||||
const message = this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.DRAG-NOT-SUPPORTED');
|
||||
this.notifyUser(message);
|
||||
console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
|
@ -354,7 +372,8 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
break;
|
||||
case ToCEntryType.Page:
|
||||
if(targetId != this.ROOT_ID){
|
||||
const message = 'A page element can only be at top level';
|
||||
// const message = 'A page element can only be at top level';
|
||||
const message = this.language.instant('DATASET-PROFILE-EDITOR.STEPS.FORM.TABLE-OF-CONTENTS.ERROR-MESSAGES.PAGE-ELEMENT-ONLY-TOP-LEVEL');
|
||||
this.notifyUser(message);
|
||||
console.info(message);
|
||||
this.dataNeedsRefresh.emit();
|
||||
|
@ -432,6 +451,7 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
|
||||
drake.on('drag',(el,source)=>{
|
||||
this._dragStartedAt = new Date().getTime();
|
||||
console.log('drag fired');
|
||||
this.isDragging = true;
|
||||
this.draggingItemId = (el.id as string).replace(this.DRAGULA_ITEM_ID_PREFIX, '');
|
||||
|
@ -490,116 +510,14 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
//emit value every 500ms
|
||||
// const source = interval(500);
|
||||
// this.subscription = source.subscribe(val => {
|
||||
// const headers = Array.from(this._document.querySelectorAll(this.headerSelectors)) as HTMLElement[];
|
||||
// this.linksSubject.next(headers);
|
||||
// });
|
||||
|
||||
// if (!this.links || this.links.length === 0) {
|
||||
// this.linksSubject.asObservable()
|
||||
// .pipe(distinctUntilChanged((p: HTMLElement[], q: HTMLElement[]) => JSON.stringify(p) == JSON.stringify(q)))
|
||||
// .subscribe(headers => {
|
||||
// const links: Array<Link> = [];
|
||||
|
||||
// if (headers.length) {
|
||||
// let page;
|
||||
// let section;
|
||||
// let show
|
||||
// for (const header of headers) {
|
||||
// let name;
|
||||
// let id;
|
||||
// if (header.classList.contains('toc-page-header')) { // deprecated after removing stepper
|
||||
// name = header.innerText.trim().replace(/^link/, '');
|
||||
// id = header.id;
|
||||
// page = header.id.split('_')[1];
|
||||
// section = undefined;
|
||||
// show = true;
|
||||
// } else if (header.classList.contains('toc-section-header')) {
|
||||
// name = header.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue.trim().replace(/^link/, '');
|
||||
// id = header.id;
|
||||
// page = header.id.split('.')[1];
|
||||
// section = header.id;
|
||||
// if (header.id.split('.')[4]) { show = false; }
|
||||
// else { show = true; }
|
||||
// } else if (header.classList.contains('toc-compositeField-header')) {
|
||||
// name = (header.childNodes[0]).nodeValue.trim().replace(/^link/, '');
|
||||
// id = header.id;
|
||||
// // id = header.parentElement.parentElement.parentElement.id;
|
||||
// show = false;
|
||||
// }
|
||||
// const { top } = header.getBoundingClientRect();
|
||||
// links.push({
|
||||
// name,
|
||||
// id,
|
||||
// type: header.tagName.toLowerCase(),
|
||||
// top: top,
|
||||
// active: false,
|
||||
// page: page,
|
||||
// section: section,
|
||||
// show: show,
|
||||
// selected: false
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// this.links = links;
|
||||
// // Initialize selected for button next on dataset wizard component editor
|
||||
// this.links.length > 0 ? this.links[0].selected = true : null;
|
||||
// })
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
// if (!this.isActive && this.links && this.links.length > 0) {
|
||||
// this.links.forEach(link => {
|
||||
// link.selected = false;
|
||||
// })
|
||||
// this.links[0].selected = true;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
goToStep(link: Link) {
|
||||
// this.stepFound.emit({
|
||||
// page: link.page,
|
||||
// section: link.section
|
||||
// });
|
||||
// this.currentLinks.emit(this.links);
|
||||
|
||||
// setTimeout(() => {
|
||||
// const target = document.getElementById(link.id);
|
||||
// target.scrollIntoView(true);
|
||||
|
||||
// var scrolledY = window.scrollY;
|
||||
// if (scrolledY) {
|
||||
// window.scroll(0, scrolledY - 70);
|
||||
// }
|
||||
// }, 500);
|
||||
}
|
||||
|
||||
toggle(headerLink: Link) {
|
||||
// const headerPage = +headerLink.name.split(" ", 1);
|
||||
// let innerPage;
|
||||
// for (const link of this.links) {
|
||||
// link.selected = false;
|
||||
// if (link.type === 'mat-expansion-panel') {
|
||||
// innerPage = +link.name.split(".", 1)[0];
|
||||
// if (isNaN(innerPage)) { innerPage = +link.name.split(" ", 1) }
|
||||
// } else if (link.type === 'h5') {
|
||||
// innerPage = +link.name.split(".", 1)[0];
|
||||
// }
|
||||
// if (headerPage === innerPage && (link.type !== 'mat-expansion-panel' || (link.type === 'mat-expansion-panel' && link.id.split(".")[4]))) {
|
||||
// link.show = !link.show;
|
||||
// }
|
||||
// }
|
||||
// headerLink.selected = true;
|
||||
}
|
||||
|
||||
// getIndex(link: Link): number {
|
||||
// return +link.id.split("_", 2)[1];
|
||||
// }
|
||||
|
||||
|
||||
itemClicked(item: ToCEntry){
|
||||
//leaf node
|
||||
|
@ -639,12 +557,3 @@ export class DatasetProfileTableOfContents extends BaseComponent implements OnIn
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export interface LinkToScroll {
|
||||
page: number;
|
||||
section: number;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|||
import { DatasetIdModel } from '@app/core/model/dataset/dataset-id.model';
|
||||
import { LocalFetchModel } from '@app/core/model/local-fetch/local-fetch.model';
|
||||
import { CurrencyService } from '@app/core/services/currency/currency.service';
|
||||
import { AutoCompleteSingleData } from '@app/core/model/dataset-profile-definition/field-data/field-data';
|
||||
|
||||
@Component({
|
||||
selector: 'app-form-field',
|
||||
|
@ -46,7 +47,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
@Input() form: FormGroup;
|
||||
@Input() datasetProfileId: any;
|
||||
@Input() isChild: Boolean = false;
|
||||
@Input() autocompleteOptions: any;
|
||||
@Input() autocompleteOptions: AutoCompleteSingleData;
|
||||
|
||||
// change: Subscription;
|
||||
// trackByFn = (index, item) => item ? item['id'] : null;
|
||||
|
@ -289,6 +290,10 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
|||
throw "Could not load autocomplete options.";
|
||||
}
|
||||
autocompleteRequestItem.criteria.like = query;
|
||||
|
||||
if(this.autocompleteOptions){
|
||||
return this.datasetExternalAutocompleteService.queryApi(autocompleteRequestItem);
|
||||
}
|
||||
return this.datasetExternalAutocompleteService.queryAutocomplete(autocompleteRequestItem);
|
||||
}
|
||||
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "If Value is",
|
||||
"RULE-THEN": "then show Field With Id"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "If Value is",
|
||||
"RULE-THEN": "then show Field With Id"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "Si el valor es",
|
||||
"RULE-THEN": "entonces muestra el campo con identificación"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "Εάν η τιμή είναι",
|
||||
"RULE-THEN": "τότε δείξε το Πεδίο με ταυτοποίηση"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "Se Valor é",
|
||||
"RULE-THEN": "então mostrar Campo com o Id"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "If Value is",
|
||||
"RULE-THEN": "then show Field With Id"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "Ako je vrednost",
|
||||
"RULE-THEN": "tada prikazati polje sa Id"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
|
@ -465,6 +465,23 @@
|
|||
"RULE-IF": "Eğer değer",
|
||||
"RULE-THEN": "sonra alanı kimliği ile göster"
|
||||
}
|
||||
},
|
||||
"FORM-VALIDATION":{
|
||||
"ERROR-MESSAGES":{
|
||||
"PAGE-MUST-HAVE-SECTION": "Each section must have at least one subsection.",
|
||||
"NEEDS-MORE-INFORMATION": " needs more information.",
|
||||
"MUST-HAVE-SECTION-OR-FIELDSET": " must have either subsection or input set.",
|
||||
"MISSING":"Missing",
|
||||
"PROVIDE-PAGE-AND-SECTION":"Make sure you provide a section and a subsection"
|
||||
}
|
||||
},
|
||||
"TABLE-OF-CONTENTS":{
|
||||
"ERROR-MESSAGES":{
|
||||
"FIELDSET-MUST-HAVE-PARENT-SECTION":"Input set can only be child of subsection.",
|
||||
"INPUT-SECTION-SAME-LEVEL": "Cannot have input set and section on the same level.",
|
||||
"DRAG-NOT-SUPPORTED":"Drag n drop of subsection not supported to target container.",
|
||||
"PAGE-ELEMENT-ONLY-TOP-LEVEL": "Section elements can only be at top level"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TOOLKIT": {
|
||||
|
|
Loading…
Reference in New Issue