mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Merge pull request #661 from Alfresco/dev-denys-657
#657 Enforce single-click navigation for mobile browsers
This commit is contained in:
commit
1b0f107d77
@ -492,35 +492,11 @@ describe('DocumentList', () => {
|
|||||||
expect(documentList.displayFolderContent).not.toHaveBeenCalled();
|
expect(documentList.displayFolderContent).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: move to data adapter
|
it('should enforce single-click on mobile browser', () => {
|
||||||
/*
|
spyOn(documentList, 'isMobile').and.returnValue(true);
|
||||||
it('should sort by dates up to ms', () => {
|
documentList.navigationMode = DocumentList.DOUBLE_CLICK_NAVIGATION;
|
||||||
let file1 = new FileNode();
|
documentList.ngOnInit();
|
||||||
file1.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 1);
|
expect(documentList.isMobile).toHaveBeenCalled();
|
||||||
|
expect(documentList.navigationMode).toBe(DocumentList.SINGLE_CLICK_NAVIGATION);
|
||||||
let file2 = new FileNode();
|
|
||||||
file2.entry['dateProp'] = new Date(2016, 6, 30, 13, 14, 2);
|
|
||||||
|
|
||||||
let page = new PageNode([file1, file2]);
|
|
||||||
|
|
||||||
// desc
|
|
||||||
documentList.sort(page, new ColumnSortingModel({
|
|
||||||
key: 'dateProp',
|
|
||||||
direction: 'desc'
|
|
||||||
}));
|
|
||||||
|
|
||||||
expect(page.list.entries[0]).toBe(file2);
|
|
||||||
expect(page.list.entries[1]).toBe(file1);
|
|
||||||
|
|
||||||
// asc
|
|
||||||
documentList.sort(page, new ColumnSortingModel({
|
|
||||||
key: 'dateProp',
|
|
||||||
direction: 'asc'
|
|
||||||
}));
|
|
||||||
|
|
||||||
expect(page.list.entries[0]).toBe(file1);
|
|
||||||
expect(page.list.entries[1]).toBe(file2);
|
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ export class DocumentList implements OnInit, AfterViewInit, AfterViewChecked, Af
|
|||||||
navigate: boolean = true;
|
navigate: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
navigationMode: string = 'dblclick'; // click|dblclick
|
navigationMode: string = DocumentList.DOUBLE_CLICK_NAVIGATION; // click|dblclick
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
thumbnails: boolean = false;
|
thumbnails: boolean = false;
|
||||||
@ -184,6 +184,11 @@ export class DocumentList implements OnInit, AfterViewInit, AfterViewChecked, Af
|
|||||||
this.data.thumbnails = this.thumbnails;
|
this.data.thumbnails = this.thumbnails;
|
||||||
this.data.maxItems = this.pageSize;
|
this.data.maxItems = this.pageSize;
|
||||||
this.contextActionHandler.subscribe(val => this.contextActionCallback(val));
|
this.contextActionHandler.subscribe(val => this.contextActionCallback(val));
|
||||||
|
|
||||||
|
// Automatically enforce single-click navigation for mobile browsers
|
||||||
|
if (this.isMobile()) {
|
||||||
|
this.navigationMode = DocumentList.SINGLE_CLICK_NAVIGATION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
@ -206,6 +211,10 @@ export class DocumentList implements OnInit, AfterViewInit, AfterViewChecked, Af
|
|||||||
if (componentHandler) {
|
if (componentHandler) {
|
||||||
componentHandler.upgradeAllRegistered();
|
componentHandler.upgradeAllRegistered();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isMobile(): boolean {
|
||||||
|
return !!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user