mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Update from master
# Conflicts: # ng2-components/ng2-alfresco-datatable/package.json # ng2-components/ng2-alfresco-documentlist/package.json
This commit is contained in:
commit
f54955b8eb
@ -17,6 +17,7 @@ before_install:
|
||||
- export CHROME_BIN=/usr/bin/google-chrome
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- cd ng2-components/ng2-alfresco-core; npm version patch; sed -i "s/0\\.0\\.0-PLACEHOLDER/^0.1.0/g" package.json; npm install; npm link
|
||||
|
||||
env:
|
||||
matrix:
|
||||
@ -29,7 +30,7 @@ env:
|
||||
- MODULE=ng2-alfresco-viewer
|
||||
|
||||
before_script:
|
||||
- cd ./ng2-components/$MODULE; npm install
|
||||
- cd ng2-components/$MODULE; npm version patch; sed -i "s/0\\.0\\.0-PLACEHOLDER/^0.1.0/g" package.json; npm install; npm link ng2-alfresco-core; npm run travis
|
||||
- ls -ltrh ./node_modules/
|
||||
script: npm run test
|
||||
# Send coverage data to Coveralls
|
||||
|
@ -76,13 +76,13 @@
|
||||
"flag-icon-css": "2.3.0",
|
||||
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"ng2-alfresco-core": "^0.1.36",
|
||||
"ng2-alfresco-datatable": "^0.1.12",
|
||||
"ng2-alfresco-documentlist": "^0.1.34",
|
||||
"ng2-alfresco-login": "^0.1.29",
|
||||
"ng2-alfresco-search": "^0.1.21",
|
||||
"ng2-alfresco-upload": "^0.1.49",
|
||||
"ng2-alfresco-viewer": "^0.1.32"
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-datatable": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-documentlist": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-login": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-search": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-upload": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-viewer": "0.0.0-PLACEHOLDER"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browser-sync": "2.10.0",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-core",
|
||||
"description": "Alfresco Angular 2 Components core",
|
||||
"version": "0.1.39",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -24,7 +24,8 @@
|
||||
"test-browser": "karma start karma.conf.js --reporters kjhtml ",
|
||||
"posttest": "node_modules/.bin/remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html",
|
||||
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"travis": "echo 'placeholder'"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-datatable",
|
||||
"description": "Alfresco Angular2 DataTable Component",
|
||||
"version": "0.1.17",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -68,7 +68,7 @@
|
||||
"rxjs": "5.0.0-beta.6",
|
||||
"zone.js": "0.6.12",
|
||||
"rimraf": "2.5.2",
|
||||
"ng2-alfresco-core": "^0.1.35"
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-documentlist",
|
||||
"description": "Alfresco Angular2 Document List Component",
|
||||
"version": "0.1.37",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -75,8 +75,8 @@
|
||||
"rimraf": "2.5.2",
|
||||
"ng2-translate": "2.2.2",
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"ng2-alfresco-core": "^0.1.35",
|
||||
"ng2-alfresco-datatable": "^0.1.17"
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER",
|
||||
"ng2-alfresco-datatable": "0.0.0-PLACEHOLDER"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-login",
|
||||
"description": "Alfresco Angular2 Login Component",
|
||||
"version": "0.1.32",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -27,7 +27,8 @@
|
||||
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
|
||||
"posttest": "node_modules/.bin/remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html",
|
||||
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"travis": "npm link ng2-alfresco-core"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
@ -81,7 +82,7 @@
|
||||
"zone.js": "0.6.12",
|
||||
"rimraf": "2.5.2",
|
||||
"ng2-translate": "2.2.2",
|
||||
"ng2-alfresco-core": "^0.1.35",
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER",
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"coveralls": "^2.11.9"
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-search",
|
||||
"description": "Alfresco Angular2 Search Component",
|
||||
"version": "0.1.25",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -27,7 +27,8 @@
|
||||
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
|
||||
"posttest": "node_modules/.bin/remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html",
|
||||
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"travis": "npm link ng2-alfresco-core"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
@ -75,7 +76,7 @@
|
||||
"ng2-translate": "2.2.2",
|
||||
"material-design-lite": "1.1.3",
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"ng2-alfresco-core": "^0.1.35"
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ng2-alfresco-upload",
|
||||
"description": "Alfresco Angular2 Upload Component",
|
||||
"version": "0.1.55",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
@ -25,7 +25,8 @@
|
||||
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
|
||||
"posttest": "node_modules/.bin/remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html",
|
||||
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"travis": "npm link ng2-alfresco-core"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
@ -77,7 +78,7 @@
|
||||
"rimraf": "2.5.2",
|
||||
"ng2-translate": "2.2.2",
|
||||
"alfresco-js-api": "^0.1.0",
|
||||
"ng2-alfresco-core": "^0.1.35"
|
||||
"ng2-alfresco-core": "0.0.0-PLACEHOLDER"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"material-design-icons": "^2.2.3",
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "ng2-alfresco-viewer",
|
||||
"description": "Alfresco documents viewer",
|
||||
"version": "0.1.35",
|
||||
"author": "Eugenio Romano",
|
||||
"version": "0.0.0-PLACEHOLDER",
|
||||
"author": "Alfresco Software, Ltd.",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist node_modules typings",
|
||||
"typings": "typings install",
|
||||
@ -25,7 +25,8 @@
|
||||
"test-browser": "concurrently \"karma start karma.conf.js --reporters kjhtml\" \"npm run watch-task\"",
|
||||
"posttest": "node_modules/.bin/remap-istanbul -i coverage/report/coverage-final.json -o coverage/report -t html",
|
||||
"coverage": "npm run test && wsrv -o -p 9875 ./coverage/report",
|
||||
"prepublish": "npm run build"
|
||||
"prepublish": "npm run build",
|
||||
"travis": "echo 'placeholder'"
|
||||
},
|
||||
"main": "./dist/index.js",
|
||||
"typings": "./dist/index.d.ts",
|
||||
|
@ -28,15 +28,33 @@ export class PDFViewermock {
|
||||
[{
|
||||
width: 793,
|
||||
scale: 1,
|
||||
update: this.update
|
||||
update: this.update,
|
||||
div: {
|
||||
offsetTop: 400
|
||||
},
|
||||
viewport: {
|
||||
height: 400
|
||||
}
|
||||
}, {
|
||||
width: 793,
|
||||
scale: 1,
|
||||
update: this.update
|
||||
update: this.update,
|
||||
div: {
|
||||
offsetTop: 800
|
||||
},
|
||||
viewport: {
|
||||
height: 400
|
||||
}
|
||||
}, {
|
||||
width: 793,
|
||||
scale: 1,
|
||||
update: this.update
|
||||
update: this.update,
|
||||
div: {
|
||||
offsetTop: 1200
|
||||
},
|
||||
viewport: {
|
||||
height: 400
|
||||
}
|
||||
}];
|
||||
|
||||
_currentPageNumber: number = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!-- Start Pdf Canvas -->
|
||||
<div id="viewer-pdf-container" class="viewer-pdf-container" (keypress)=eventHandler() (window:resize)="onResize($event)">
|
||||
<div id="viewer-viewerPdf" class="pdfViewer" >
|
||||
<div id="viewer-viewerPdf" class="pdfViewer">
|
||||
<div id="loader-container" class="loader-container">
|
||||
<div class="loader-item">
|
||||
<div id="loader-spin" class="mdl-progress mdl-js-progress mdl-progress__indeterminate"></div>
|
||||
|
@ -346,8 +346,7 @@ describe('PdfViewer', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Rezize interaction', () => {
|
||||
|
||||
describe('Resize interaction', () => {
|
||||
it('resize event should trigger setScaleUpdatePages', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
@ -370,4 +369,33 @@ describe('PdfViewer', () => {
|
||||
}));
|
||||
});
|
||||
|
||||
describe('scroll interaction', () => {
|
||||
it('scroll page should return the current page', inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
|
||||
return tcb
|
||||
.createAsync(PdfViewerComponent)
|
||||
.then((fixture) => {
|
||||
let component = fixture.componentInstance;
|
||||
|
||||
spyOn(component, 'getPDFJS').and.returnValue(new PDFJSmock());
|
||||
spyOn(component, 'initPDFViewer').and.callFake(() => {
|
||||
component.pdfViewer = new PDFViewermock();
|
||||
});
|
||||
|
||||
component.urlFile = 'fake-url-file';
|
||||
|
||||
component.ngOnChanges().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(1);
|
||||
component.inputPage('4');
|
||||
fixture.detectChanges();
|
||||
expect(component.displayPage).toBe(4);
|
||||
component.watchScroll({scrollTop: 10000});
|
||||
expect(component.displayPage).toBe(4);
|
||||
}).catch((error) => {
|
||||
expect(error).toBeUndefined();
|
||||
});
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -91,6 +91,10 @@ export class PdfViewerComponent {
|
||||
let documentContainer = document.getElementById('viewer-pdf-container');
|
||||
let viewer: any = document.getElementById('viewer-viewerPdf');
|
||||
|
||||
window.document.addEventListener('scroll', (event) => {
|
||||
this.watchScroll(event.target);
|
||||
}, true);
|
||||
|
||||
this.pdfViewer = new PDFJS.PDFViewer({
|
||||
container: documentContainer,
|
||||
viewer: viewer
|
||||
@ -284,6 +288,50 @@ export class PdfViewerComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Litener Scroll Event
|
||||
*
|
||||
* @param {any} target
|
||||
*/
|
||||
watchScroll(target) {
|
||||
let outputPage = this.getVisibleElement(target);
|
||||
if (outputPage) {
|
||||
this.page = outputPage.id;
|
||||
this.displayPage = this.page;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* find out what elements are visible within a scroll pane
|
||||
*
|
||||
* @param {any} target
|
||||
*
|
||||
* @returns {Object} page
|
||||
*/
|
||||
getVisibleElement(target) {
|
||||
return this.pdfViewer._pages.find((page) => {
|
||||
return this.isOnScreen(page, target);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a page is visible
|
||||
*
|
||||
* @param {any} page
|
||||
* @param {any} target
|
||||
*
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isOnScreen(page: any, target: any) {
|
||||
let viewport: any = {};
|
||||
viewport.top = target.scrollTop;
|
||||
viewport.bottom = viewport.top + target.scrollHeight;
|
||||
let bounds: any = {};
|
||||
bounds.top = page.div.offsetTop;
|
||||
bounds.bottom = bounds.top + page.viewport.height;
|
||||
return ((bounds.top <= viewport.bottom) && (bounds.bottom >= viewport.top));
|
||||
};
|
||||
|
||||
/**
|
||||
* Litener Keyboard Event
|
||||
* @param {KeyboardEvent} event
|
||||
|
31
scripts/npm-link-demo-shell.sh
Executable file
31
scripts/npm-link-demo-shell.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
for PACKAGE in \
|
||||
ng2-alfresco-core \
|
||||
ng2-alfresco-datatable \
|
||||
ng2-alfresco-documentlist \
|
||||
ng2-alfresco-login \
|
||||
ng2-alfresco-search \
|
||||
ng2-alfresco-upload \
|
||||
ng2-alfresco-viewer
|
||||
do
|
||||
DESTDIR=././../ng2-components/${PACKAGE}
|
||||
echo "====== linking component: ${DESTDIR} ====="
|
||||
npm link ${DESTDIR} --access public
|
||||
done
|
||||
|
||||
cd ./../demo-shell-ng2
|
||||
|
||||
for PACKAGE in \
|
||||
ng2-alfresco-core \
|
||||
ng2-alfresco-datatable \
|
||||
ng2-alfresco-documentlist \
|
||||
ng2-alfresco-login \
|
||||
ng2-alfresco-search \
|
||||
ng2-alfresco-upload \
|
||||
ng2-alfresco-viewer
|
||||
do
|
||||
DESTDIR=././../ng2-components/${PACKAGE}
|
||||
echo "====== demo shell linking: ${PACKAGE} ====="
|
||||
npm link ${PACKAGE}
|
||||
done
|
15
scripts/npm-publish.sh
Executable file
15
scripts/npm-publish.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
for PACKAGE in \
|
||||
ng2-alfresco-core \
|
||||
ng2-alfresco-datatable \
|
||||
ng2-alfresco-documentlist \
|
||||
ng2-alfresco-login \
|
||||
ng2-alfresco-search \
|
||||
ng2-alfresco-upload \
|
||||
ng2-alfresco-viewer
|
||||
do
|
||||
DESTDIR=././../ng2-components/${PACKAGE}
|
||||
echo "====== PUBLISHING: ${DESTDIR} ====="
|
||||
npm publish ${DESTDIR}
|
||||
done
|
16
scripts/update-version.sh
Executable file
16
scripts/update-version.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
cd `dirname $0`
|
||||
|
||||
VERSION=$1
|
||||
|
||||
if [[ "${VERSION}" == "" ]]
|
||||
then
|
||||
echo "Version number required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "====== RENAMING 0.0.0-PLACEHOLDER to N.N.N version ======"
|
||||
find ././../ng2-components/ -type f -name package.json -print0 | xargs -0 sed -i '' "s/0\\.0\\.0-PLACEHOLDER/${VERSION}/g"
|
Loading…
x
Reference in New Issue
Block a user