Scroll component #643
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-09-05 13:06:40 +02:00
parent 59c6952025
commit 176750046a
17 changed files with 73 additions and 14 deletions

View File

@ -45,4 +45,4 @@ import './input-file';
import './treeview';
import './treeview/child';
import './calendar';
import './scroll-up/scroll-up';

View File

@ -0,0 +1,5 @@
<button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-js-ripple-effect mdl-button--colored"
ng-click="$ctrl.goUp()"
vn-tooltip="Go up">
<vn-icon icon="keyboard_arrow_up"></vn-icon>
</button>

View File

@ -0,0 +1,35 @@
import ngModule from '../../module';
import Component from '../../lib/component';
import './style.scss';
export default class Controller extends Component {
constructor($element, $scope, $window) {
super($element, $scope);
this.$window = $window;
$window.addEventListener('scroll', () => {
console.log($element[0]);
if ($window.scrollY > 0)
$element[0].style.display = 'block';
else
$element[0].style.display = 'none';
});
}
goUp() {
this.$window.scrollTo(0, 0);
}
}
Controller.$inject = ['$element', '$scope', '$window'];
ngModule.component('vnScrollUp', {
template: require('./scroll-up.html'),
controller: Controller,
bindings: {
field: '=?',
options: '<?',
disabled: '<?',
checked: '<?'
}
});

View File

@ -0,0 +1,6 @@
vn-scroll-up {
top: 5em;
right: 1.8em;
display: none;
position: fixed;
}

View File

@ -51,3 +51,4 @@ Create new one: Crear nuevo
Toggle: Desplegar/Plegar
Check all: Seleccionar todo
Select a file: Selecciona un fichero
Go up: Ir arriba

View File

@ -51,8 +51,8 @@ a, .link {
}
html [fixed-bottom-right] {
position: fixed;
bottom: 2em;
right: 2em;
bottom: 1.3em;
right: 1.3em;
}
html [text-center], .text-center {
text-align: center;

View File

@ -82,3 +82,4 @@
vn-acl-action="remove">
</vn-float-button>
</a>
<vn-scroll-up></vn-scroll-up>

View File

@ -76,3 +76,4 @@
<vn-claim-summary claim="$ctrl.claimSelected"></vn-claim-summary>
</tpl-body>
</vn-dialog>
<vn-scroll-up></vn-scroll-up>

View File

@ -67,3 +67,4 @@
<vn-client-summary client="$ctrl.clientSelected"></vn-client-summary>
</tpl-body>
</vn-dialog>
<vn-scroll-up></vn-scroll-up>

View File

@ -78,3 +78,4 @@
</tpl-body>
</vn-dialog>
<vn-client-descriptor-popover vn-id="clientDescriptor"></vn-client-descriptor-popover>
<vn-scroll-up></vn-scroll-up>

View File

@ -82,3 +82,5 @@
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>
<vn-scroll-up></vn-scroll-up>

View File

@ -146,3 +146,4 @@
vn-id="workerDescriptor"
worker-fk="$ctrl.selectedWorker">
</vn-worker-descriptor-popover>
<vn-scroll-up></vn-scroll-up>

View File

@ -91,3 +91,4 @@
<vn-order-summary order="$ctrl.selectedOrder"></vn-order-summary>
</tpl-body>
</vn-dialog>
<vn-scroll-up></vn-scroll-up>

View File

@ -75,3 +75,4 @@
<a ui-sref="route.create" vn-tooltip="New route" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>
</a>
<vn-scroll-up></vn-scroll-up>

View File

@ -161,3 +161,4 @@
<vn-client-balance-create
vn-id="balanceCreateDialog">
</vn-client-balance-create>
<vn-scroll-up></vn-scroll-up>

View File

@ -52,3 +52,4 @@
</vn-card>
<vn-pagination model="model"></vn-pagination>
</div>
<vn-scroll-up></vn-scroll-up>

View File

@ -73,3 +73,4 @@
<vn-worker-summary worker="$ctrl.selectedWorker"></vn-worker-summary>
</tpl-body>
</vn-dialog>
<vn-scroll-up></vn-scroll-up>