Merge remote-tracking branch 'origin/dmp-refactoring' into dmp-refactoring
This commit is contained in:
commit
e4c4c1811d
|
@ -21,7 +21,7 @@ public enum DmpUserRole implements DatabaseEnum<Short> {
|
|||
@Override
|
||||
@JsonValue
|
||||
public Short getValue() {
|
||||
return value;
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private static final Map<Short, DmpUserRole> map = EnumUtils.getEnumValueMap(DmpUserRole.class);
|
||||
|
|
|
@ -14,7 +14,7 @@ public class PropertyDefinitionFieldSetItem {
|
|||
private Integer ordinal;
|
||||
|
||||
public Map<String, Field> getFields() {
|
||||
return fields;
|
||||
return this.fields;
|
||||
}
|
||||
|
||||
public void setFields(Map<String, Field> fields) {
|
||||
|
@ -22,7 +22,7 @@ public class PropertyDefinitionFieldSetItem {
|
|||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
return this.comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
|
@ -30,7 +30,7 @@ public class PropertyDefinitionFieldSetItem {
|
|||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
return this.ordinal;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
|
|
|
@ -422,10 +422,10 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
List<FieldEntity> issuedFieldEntities = definition.getAllField().stream().filter(x -> x.getSchematics() != null && x.getSchematics().contains("rda.dataset.issued")).toList();
|
||||
if (!this.conventionService.isListNullOrEmpty(issuedFieldEntities)) {
|
||||
String issuedIdNode = issuedFieldEntities.getFirst().getId();
|
||||
String issuedValue = this.conventionService.isNullOrEmpty(issuedIdNode) ? null : description.getProperties().getFieldSets().values().stream().map(PropertyDefinitionFieldSet::getItems).flatMap(List::stream)
|
||||
.filter(x -> x.getFields() != null && x.getFields().containsKey(issuedIdNode)).map(x -> x.getFields().get(issuedIdNode).getTextValue()).filter(Objects::nonNull).findFirst().orElse(null);
|
||||
Instant issuedValue = this.conventionService.isNullOrEmpty(issuedIdNode) ? null : description.getProperties().getFieldSets().values().stream().map(PropertyDefinitionFieldSet::getItems).flatMap(List::stream)
|
||||
.filter(x -> x.getFields() != null && x.getFields().containsKey(issuedIdNode)).map(x -> x.getFields().get(issuedIdNode).getDateValue()).filter(Objects::nonNull).findFirst().orElse(null);
|
||||
|
||||
if (!this.conventionService.isNullOrEmpty(issuedValue)) {
|
||||
if (issuedValue != null) {
|
||||
List<FieldSetEntity> licStartFieldSetsEntities = definition.getAllFieldSets().stream().filter(x -> x.getAllField() != null && x.getAllField().stream().anyMatch(y -> y.getSchematics() != null && y.getSchematics().contains("rda.dataset.distribution.license.start_date"))).toList();
|
||||
for (FieldSetEntity licStartFieldSetEntity : licStartFieldSetsEntities) {
|
||||
List<FieldEntity> licStartEntities = licStartFieldSetEntity.getAllField().stream().filter(x -> x.getSchematics() != null && x.getSchematics().contains("rda.dataset.distribution.license.start_date")).toList();
|
||||
|
@ -433,7 +433,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
this.ensureFieldSetEntity(description, licStartFieldSetEntity);
|
||||
|
||||
for (FieldEntity licStartDateNode : licStartEntities) {
|
||||
description.getProperties().getFieldSets().get(licStartFieldSetEntity.getId()).getItems().getFirst().getFields().put(licStartDateNode.getId(), this.buildPropertyDefinitionFieldItemValue(descriptionReferences,licStartDateNode, semanticTarget, issuedValue, type));
|
||||
description.getProperties().getFieldSets().get(licStartFieldSetEntity.getId()).getItems().getFirst().getFields().put(licStartDateNode.getId(), this.buildPropertyDefinitionFieldItemValue(descriptionReferences,licStartDateNode, semanticTarget, issuedValue.toString(), type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
if (fieldEntity == null || fieldEntity.getData() == null || fieldEntity.getData().getFieldType() == null || this.conventionService.isNullOrEmpty(value)) return field;
|
||||
try{
|
||||
switch (fieldEntity.getData().getFieldType()){
|
||||
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> field.setTextValue(value.toLowerCase(Locale.ROOT));
|
||||
case FREE_TEXT, TEXT_AREA, RICH_TEXT_AREA, RADIO_BOX -> field.setTextValue(value);
|
||||
case CHECK_BOX, BOOLEAN_DECISION ->{
|
||||
if (!this.conventionService.isNullOrEmpty(value)) {
|
||||
field.setBooleanValue("true".equals(value.trim().toLowerCase(Locale.ROOT)));
|
||||
|
|
|
@ -12,7 +12,7 @@ export class DefaultUserLocaleTimezoneLookup extends Lookup {
|
|||
|
||||
export class DefaultUserLocaleCultureLookup extends Lookup {
|
||||
like: string;
|
||||
selectedItem: CultureInfo;
|
||||
selectedItem: string;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
|
|
@ -40,18 +40,42 @@ export class DefaultUserLocaleService {
|
|||
return timezones;
|
||||
}
|
||||
|
||||
queryCulture(q: DefaultUserLocaleCultureLookup): Observable<CultureInfo[]> {
|
||||
queryCulture(q: DefaultUserLocaleCultureLookup) {
|
||||
let cultures = of(this.cultureService.getCultureValues().sort((x, y) => x.displayName.localeCompare(y.displayName)));
|
||||
|
||||
if (q.like) {
|
||||
let likeValue = q.like.toLowerCase();
|
||||
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
||||
let filteredItems = items.filter(i => this.getCultureDisplayFn(i).toLowerCase().includes(likeValue));
|
||||
let filteredItems = items.filter(i => {
|
||||
const displayValue = `${i?.displayName} - ${i?.nativeName}`;
|
||||
if (displayValue.toLowerCase().includes(likeValue)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (filteredItems != null && filteredItems?.length > 0) return filteredItems;
|
||||
else return null;
|
||||
}));
|
||||
}
|
||||
|
||||
if (q.selectedItem) {
|
||||
let selectedItemValue = q.selectedItem.toLowerCase();
|
||||
cultures = cultures.pipe(map((items: CultureInfo[]) => {
|
||||
let selected = items.find(i => {
|
||||
if (i.name.toLowerCase().includes(selectedItemValue)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (selected != null) {
|
||||
return [selected];
|
||||
}
|
||||
else return null;
|
||||
}));
|
||||
}
|
||||
|
||||
return cultures;
|
||||
}
|
||||
|
||||
|
@ -63,7 +87,7 @@ export class DefaultUserLocaleService {
|
|||
initialItems: (data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(searchQuery)),
|
||||
getSelectedItem: (selectedItem: string) => this.queryTimezone(this.buildTimezoneAutocompleteLookup(null, selectedItem)),
|
||||
displayFn: (item: string) => this.timezoneInfoDisplayPipe.transform(item),
|
||||
displayFn: (item: string) => this.getTimezoneDisplayFn(item),
|
||||
titleFn: (item: string) => this.timezoneInfoDisplayPipe.transform(item),
|
||||
valueAssign: (item: string) => item,
|
||||
};
|
||||
|
@ -76,17 +100,21 @@ export class DefaultUserLocaleService {
|
|||
return lookup;
|
||||
}
|
||||
|
||||
getTimezoneDisplayFn(value: any) {
|
||||
return Array.isArray(value) ? this.timezoneInfoDisplayPipe.transform(value[0]) : this.timezoneInfoDisplayPipe.transform(value);
|
||||
}
|
||||
|
||||
|
||||
singleCultureAutocompleteConfiguration: SingleAutoCompleteConfiguration = {
|
||||
initialItems: (data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(null)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.queryCulture(this.buildCultureAutocompleteLookup(searchQuery)),
|
||||
getSelectedItem: (selectedItem: CultureInfo) => this.queryCulture(this.buildCultureAutocompleteLookup(null, selectedItem)),
|
||||
displayFn: (item: CultureInfo) => this.getCultureDisplayFn(item),
|
||||
titleFn: (item: CultureInfo) => this.getCultureDisplayFn(item),
|
||||
getSelectedItem: (selectedItem: string) =>this.queryCulture(this.buildCultureAutocompleteLookup(null, selectedItem)),
|
||||
displayFn: (item: any) => this.getCultureDisplayFn(item),
|
||||
titleFn: (item: CultureInfo) => this.getCultureTitleFn(item),
|
||||
valueAssign: (item: CultureInfo) => item.name,
|
||||
};
|
||||
|
||||
private buildCultureAutocompleteLookup(like?: string, selectedItem?: CultureInfo): DefaultUserLocaleCultureLookup {
|
||||
private buildCultureAutocompleteLookup(like?: string, selectedItem?: string): DefaultUserLocaleCultureLookup {
|
||||
const lookup: DefaultUserLocaleCultureLookup = new DefaultUserLocaleCultureLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
if (like) { lookup.like = like; }
|
||||
|
@ -94,7 +122,15 @@ export class DefaultUserLocaleService {
|
|||
return lookup;
|
||||
}
|
||||
|
||||
private getCultureDisplayFn(culture: CultureInfo): string {
|
||||
private getCultureTitleFn(culture: any): string {
|
||||
return `${culture?.displayName} - ${culture?.nativeName}`;
|
||||
}
|
||||
|
||||
private getCultureDisplayFn(culture: any): string {
|
||||
if (Array.isArray(culture)) {
|
||||
return this.getCultureTitleFn(culture[0]);
|
||||
} else {
|
||||
return this.getCultureTitleFn(culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<ng-container >
|
||||
|
||||
<span class="table-entry"
|
||||
(click)="onScrollStarted(entry); toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry);"
|
||||
(click)="toggleExpand(idx);navigateToFieldSet(entry, $event); onEntrySelected(entry);"
|
||||
[ngStyle]="calculateStyle(entry)"
|
||||
[ngClass]="calculateClass(entry)"
|
||||
>
|
||||
|
|
|
@ -153,6 +153,7 @@ export class TableOfContentsInternal implements OnInit, OnDestroy {
|
|||
|
||||
navigateToFieldSet(entry: ToCEntry, event) {
|
||||
if (entry.type === ToCEntryType.FieldSet) {
|
||||
this.onScrollStarted(entry);
|
||||
|
||||
const fieldSetId = entry.id;
|
||||
const element = document.getElementById(fieldSetId);
|
||||
|
|
|
@ -210,7 +210,7 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
|||
|
||||
const options = {
|
||||
root: null,
|
||||
rootMargin: '-38% 0px -60% 0px',
|
||||
rootMargin: '20% 0px -30% 0px',
|
||||
threshold: 0
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,6 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
|||
}
|
||||
|
||||
entries.forEach(ie => {
|
||||
if (this.isScrolling) return;
|
||||
|
||||
if (ie.isIntersecting) {
|
||||
try {
|
||||
if(!this.isScrolling) {
|
||||
|
@ -229,6 +227,8 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
|||
if (this.visibilityRulesService.isVisibleMap[target_id] ?? true) {
|
||||
this.onToCentrySelected(this._findTocEntryById(target_id, this.tocentries));
|
||||
}
|
||||
} else {
|
||||
console.log('cannot scroll');
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
|
@ -445,10 +445,12 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
|
|||
}
|
||||
|
||||
onScrollStarted(entry: ToCEntry) {
|
||||
this.console.log('started');
|
||||
this.isScrolling = true;
|
||||
}
|
||||
|
||||
onScrollFinished(entry: ToCEntry) {
|
||||
this.console.log('finished');
|
||||
this.isScrolling = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<mat-error *ngIf="form.hasError('backendError')">{{form.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-hint *ngIf="hint" align="start">{{hint}}</mat-hint>
|
||||
<mat-hint *ngIf="hint" align="end">
|
||||
<mat-hint align="end">
|
||||
<span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} </span>
|
||||
<span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span>
|
||||
</mat-hint>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<mat-error *ngIf="form.hasError('backendError')">{{form.getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="form.hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
|
||||
<mat-hint *ngIf="hint" align="start">{{hint}}</mat-hint>
|
||||
<mat-hint *ngIf="hint" align="end">
|
||||
<mat-hint align="end">
|
||||
<span *ngIf="!form.disabled" class="not-found">{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} </span>
|
||||
<span *ngIf="!form.disabled" class="insert-manually" (click)="addReference($event)">{{'REFERENCE-FIELD.ACTIONS.INSERT-MANUALLY' | translate}}</span>
|
||||
</mat-hint>
|
||||
|
|
Loading…
Reference in New Issue