mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ADF-3930] Can't load more results in Copy/Move dialog (#4247)
* fix unrelated failing test improve type definition add set get filtering node selector fix directive highlight fix minor problem style breadcrumb small refactoring problem documentlist * fix lint style * fix html node * fix test
This commit is contained in:
@@ -414,7 +414,7 @@
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 1.12em;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
|
||||
/* visible content */
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
/* tslint:disable:no-input-rename */
|
||||
|
||||
import { Directive, ElementRef, Input, Renderer2 } from '@angular/core';
|
||||
import { Directive, ElementRef, Input, Renderer2, AfterViewChecked } from '@angular/core';
|
||||
import { HighlightTransformService, HighlightTransformResult } from '../services/highlight-transform.service';
|
||||
|
||||
@Directive({
|
||||
selector: '[adf-highlight]'
|
||||
})
|
||||
export class HighlightDirective {
|
||||
export class HighlightDirective implements AfterViewChecked {
|
||||
|
||||
/** Class selector for highlightable elements. */
|
||||
@Input('adf-highlight-selector')
|
||||
@@ -40,7 +40,12 @@ export class HighlightDirective {
|
||||
constructor(
|
||||
private el: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
private highlightTransformService: HighlightTransformService) { }
|
||||
private highlightTransformService: HighlightTransformService) {
|
||||
}
|
||||
|
||||
ngAfterViewChecked() {
|
||||
this.highlight();
|
||||
}
|
||||
|
||||
public highlight(search = this.search, selector = this.selector, classToApply = this.classToApply) {
|
||||
if (search && selector) {
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('InfinitePaginationComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
component.loadMore.subscribe((newPagination: Pagination) => {
|
||||
expect(newPagination.skipCount).toBe(0);
|
||||
expect(newPagination.skipCount).toBe(10);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -166,8 +166,8 @@ describe('InfinitePaginationComponent', () => {
|
||||
component.onLoadMore();
|
||||
|
||||
expect(spyTarget).toHaveBeenCalledWith({
|
||||
maxItems: 444 + 25,
|
||||
skipCount: 0,
|
||||
maxItems: 444,
|
||||
skipCount: 25,
|
||||
totalItems: 888,
|
||||
hasMoreItems: true,
|
||||
merge: true
|
||||
@@ -182,8 +182,8 @@ describe('InfinitePaginationComponent', () => {
|
||||
component.onLoadMore();
|
||||
|
||||
expect(spyTarget).toHaveBeenCalledWith({
|
||||
maxItems: 444 + component.pageSize,
|
||||
skipCount: 0,
|
||||
maxItems: 444,
|
||||
skipCount: 7,
|
||||
totalItems: 888,
|
||||
hasMoreItems: true,
|
||||
merge: true
|
||||
|
||||
@@ -87,12 +87,11 @@ export class InfinitePaginationComponent implements OnInit, OnDestroy, Paginatio
|
||||
}
|
||||
|
||||
onLoadMore() {
|
||||
this.pagination.skipCount = 0;
|
||||
this.pagination.maxItems = this.pagination.maxItems + this.pageSize;
|
||||
this.pagination.skipCount += this.pageSize;
|
||||
this.pagination.merge = true;
|
||||
this.loadMore.next(this.pagination);
|
||||
|
||||
if (this.pagination.maxItems >= this.pagination.totalItems) {
|
||||
if (this.pagination.skipCount >= this.pagination.totalItems || !this.pagination.hasMoreItems) {
|
||||
this.pagination.hasMoreItems = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,10 +45,11 @@ export class HighlightTransformService {
|
||||
}).join('|');
|
||||
|
||||
const regex = new RegExp(pattern, 'gi');
|
||||
result = text.replace(regex, (match) => {
|
||||
result = text.replace(/<[^>]+>/g, '').replace(regex, (match) => {
|
||||
isMatching = true;
|
||||
return `<span class="${wrapperClass}">${match}</span>`;
|
||||
});
|
||||
|
||||
return { text: result, changed: isMatching };
|
||||
} else {
|
||||
return { text: result, changed: isMatching };
|
||||
|
||||
Reference in New Issue
Block a user