Merge remote-tracking branch 'origin/new-theme' into new-theme

This commit is contained in:
argirok 2022-06-06 12:24:53 +03:00
commit d170d81db1
6 changed files with 57 additions and 50 deletions

View File

@ -25,7 +25,7 @@
<tr *ngFor="let selectedField of selectedFields; let i = index"> <tr *ngFor="let selectedField of selectedFields; let i = index">
<td> <td>
<div class="uk-grid uk-flex-middle uk-child-width-1-2@m uk-child-width-1-1"> <div class="uk-grid uk-flex-middle uk-child-width-1-2@m uk-child-width-1-1">
<div input [(value)]="selectedField.id" inputClass="border-bottom" [tooltip]="true" <div input [(value)]="selectedField.id" inputClass="border-bottom"
[options]="fieldIdsOptions" (valueChange)="fieldIdsChanged(i,selectedField.id)" type="select"></div> [options]="fieldIdsOptions" (valueChange)="fieldIdsChanged(i,selectedField.id)" type="select"></div>
<div input *ngIf="selectedField.id != 'q'" [(value)]="selectedField.includes" inputClass="border-bottom" [options]="getNotOperators(selectedField)" type="select"></div> <div input *ngIf="selectedField.id != 'q'" [(value)]="selectedField.includes" inputClass="border-bottom" [options]="getNotOperators(selectedField)" type="select"></div>
<div *ngIf="selectedField.id == 'q'">includes</div> <div *ngIf="selectedField.id == 'q'">includes</div>

View File

@ -276,17 +276,17 @@
<div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging)"> <div *ngIf="(searchUtils.status !== errorCodes.LOADING || !loadPaging)">
<ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container> <ng-container *ngTemplateOutlet="selected_filters_pills;"></ng-container>
</div> </div>
<div *ngIf="availablePageOptions.length > 0 || sort || searchUtils.totalResults > searchUtils.size || <div *ngIf="searchUtils.totalResults > 10 || sort || searchUtils.totalResults > searchUtils.size ||
(!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)" (!loadPaging && oldTotalResults > searchUtils.size && searchUtils.status == errorCodes.LOADING)"
class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-margin-medium-top" uk-grid> class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-margin-medium-top" uk-grid>
<div> <div>
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<div *ngIf="availablePageOptions.length > 0" class="uk-width-small uk-margin-right"> <div *ngIf="searchUtils.totalResults > 10" class="uk-width-small uk-margin-right">
<div input type="select" placeholder="Results per page" inputClass="flat x-small" <div input type="select" placeholder="Results per page" inputClass="flat x-small"
[options]="availablePageOptions" [(value)]="searchUtils.size" [disabled]="disabled" [options]="pageOptions" [(value)]="searchUtils.size" [disabled]="disabled"
(valueChange)="sizeChanged($event)"></div> (valueChange)="sizeChanged($event)"></div>
</div> </div>
<search-sorting *ngIf="sort" <search-sorting *ngIf="sort && searchUtils.totalResults > 0"
[entityType]="entityType" [sortBy]="searchUtils.sortBy" [entityType]="entityType" [sortBy]="searchUtils.sortBy"
(sortByChange)="sortByChanged($event)" (sortByChange)="sortByChanged($event)"
[isDisabled]="disabled"> [isDisabled]="disabled">

View File

@ -1701,8 +1701,4 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
} }
return totalPages; return totalPages;
} }
get availablePageOptions() {
return this.pageOptions.filter(option => option < this.searchUtils.totalResults);
}
} }

View File

@ -6,8 +6,8 @@
[class.uk-disabled]="!hasPermission(result)"> [class.uk-disabled]="!hasPermission(result)">
<div> <div>
<div *ngIf="type === 'community' && result.isSubscribed" <div *ngIf="type === 'community' && result.isSubscribed"
class="uk-alert-primary uk-padding-small uk-position-top-left uk-text-center"> class="uk-text-background uk-text-center uk-position-top-left uk-padding-small uk-text-uppercase uk-text-bold">
<span>Subscribed</span> <span>Member</span>
</div> </div>
<div *ngIf="type === 'community' && result.status === 'manager'" <div *ngIf="type === 'community' && result.status === 'manager'"
class="uk-position-top-right uk-margin-top uk-margin-right uk-flex uk-flex-column uk-flex-middle"> class="uk-position-top-right uk-margin-top uk-margin-right uk-flex uk-flex-column uk-flex-middle">

View File

@ -1,45 +1,55 @@
import {Component, Input, Output, EventEmitter} from '@angular/core'; import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Option} from "../../sharedComponents/input/input.component";
@Component({ @Component({
selector: 'search-sorting', selector: 'search-sorting',
template: ` template: `
<div class="uk-width-small"> <div *ngIf="options" class="uk-width-small">
<div input *ngIf="(entityType != 'community' && entityType != 'stakeholder' )" <div input
type="select" placeholder="Sort by" inputClass="flat x-small" type="select" placeholder="Sort by" inputClass="flat x-small"
[options]="optionsA" [(value)]="sortBy" [disabled]="isDisabled" [options]="options" [(value)]="sortBy" [disabled]="isDisabled"
(valueChange)="sortByChanged()"></div> (valueChange)="sortByChanged()"></div>
</div>
<div input *ngIf="(entityType == 'community' || entityType == 'stakeholder')" `
type="select" placeholder="Sort by" inputClass="flat x-small"
[options]="optionsB" [(value)]="sortBy" [disabled]="isDisabled"
(valueChange)="sortByChanged()"></div>
</div>
`
}) })
export class SearchSortingComponent { export class SearchSortingComponent {
@Input() isDisabled: boolean = false; @Input() isDisabled: boolean = false;
@Input() sortBy: string = ''; @Input() sortBy: string = '';
@Input() entityType: string = ''; @Input() entityType: string = '';
@Output() sortByChange = new EventEmitter(); @Output() sortByChange = new EventEmitter();
public optionsA = [ public options: Option[];
{value: '', label: 'Relevance'}, private generalOptions = [
{value: 'resultdateofacceptance,descending', label: 'Date (most recent)'}, {value: '', label: 'Relevance'},
{value: 'resultdateofacceptance,ascending', label: 'Date (least recent)'}, {value: 'resultdateofacceptance,descending', label: 'Date (most recent)'},
]; {value: 'resultdateofacceptance,ascending', label: 'Date (least recent)'},
public optionsB = [ ];
{value: '', label: 'Title'}, private communityOptions = [
{value: 'creationdate,descending', label: 'Creation Date (most recent)'}, {value: '', label: 'Title'},
{value: 'creationdate,ascending', label: 'Creation Date (least recent)'}, {value: 'creationdate,descending', label: 'Creation Date (most recent)'},
]; {value: 'creationdate,ascending', label: 'Creation Date (least recent)'},
];
private stakeholderOptions = [
constructor () {} {value: '', label: 'Name'},
{value: 'creationdate,descending', label: 'Creation Date (most recent)'},
ngOnInit() {} {value: 'creationdate,ascending', label: 'Creation Date (least recent)'},
];
sortByChanged() { constructor() {
this.sortByChange.emit(this.sortBy); }
ngOnInit() {
if (this.entityType === 'community') {
this.options = this.communityOptions;
} else if (this.entityType === 'stakeholder') {
this.options = this.stakeholderOptions;
} else {
this.options = this.generalOptions;
} }
}
sortByChanged() {
this.sortByChange.emit(this.sortBy);
}
} }

View File

@ -57,7 +57,7 @@ declare var UIkit;
<label>{{placeholderInfo.label}} <sup *ngIf="required">*</sup></label> <label>{{placeholderInfo.label}} <sup *ngIf="required">*</sup></label>
</div> </div>
<div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'" <div class="uk-flex" [class.uk-flex-middle]="type !== 'textarea'"
[attr.uk-tooltip]="(tooltip && !focused && type !== 'chips')?('title: ' + getLabel(formControl.value) + '; delay: 500'):null"> [attr.uk-tooltip]="(tooltip && !focused && type !== 'chips' && type !== 'textarea')?('title: ' + getLabel(formControl.value) + '; delay: 500; pos: bottom-left'):null">
<ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'"> <ng-template [ngIf]="type === 'text' || type === 'URL' || type === 'logoURL'">
<input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint" <input #input class="input" [attr.placeholder]="placeholderInfo?.static?placeholderInfo.label:hint"
[formControl]="formAsControl" [class.uk-text-truncate]="!focused"> [formControl]="formAsControl" [class.uk-text-truncate]="!focused">
@ -194,13 +194,13 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
@Input() value: any | any[]; @Input() value: any | any[];
@Output() valueChange = new EventEmitter<any | any[]>(); @Output() valueChange = new EventEmitter<any | any[]>();
@Input() hint: string; @Input() hint: string;
@Input() tooltip: boolean = false;
/** Text */ /** Text */
@ViewChild('input') input: ElementRef; @ViewChild('input') input: ElementRef;
/** Textarea options */ /** Textarea options */
@ViewChild('textArea') textArea: ElementRef; @ViewChild('textArea') textArea: ElementRef;
@Input('rows') rows: number = 3; @Input('rows') rows: number = 3;
/** Select | Autocomplete | chips available options */ /** Select | Autocomplete | chips available options */
@Input() tooltip: boolean = false;
@Input() selectArrow: string = 'arrow_drop_down'; @Input() selectArrow: string = 'arrow_drop_down';
@Input() selectedIndex: number = 0; @Input() selectedIndex: number = 0;
@Input() selectable: boolean = false; @Input() selectable: boolean = false;
@ -263,6 +263,7 @@ export class InputComponent implements OnInit, OnDestroy, AfterViewInit, OnChang
this.icon = this.selectArrow; this.icon = this.selectArrow;
} }
this.selectable = true; this.selectable = true;
this.tooltip = true;
} }
} }