暂无描述

app.inlinemenu.component.ts 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { Component, Input } from '@angular/core';
  2. import { trigger, state, transition, style, animate } from '@angular/animations';
  3. import { AppMainComponent } from './app.main.component';
  4. import { AppComponent } from './app.component';
  5. @Component({
  6. selector: 'app-inline-menu',
  7. templateUrl: './app.inlinemenu.component.html',
  8. animations: [
  9. trigger('menu', [
  10. state('hiddenAnimated', style({
  11. height: '0px',
  12. paddingBottom: '0px',
  13. overflow: 'hidden'
  14. })),
  15. state('visibleAnimated', style({
  16. height: '*',
  17. overflow: 'visible'
  18. })),
  19. state('visible', style({
  20. opacity: 1,
  21. 'z-index': 100
  22. })),
  23. state('hidden', style({
  24. opacity: 0,
  25. 'z-index': '*'
  26. })),
  27. transition('visibleAnimated => hiddenAnimated', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')),
  28. transition('hiddenAnimated => visibleAnimated', animate('400ms cubic-bezier(0.86, 0, 0.07, 1)')),
  29. transition('visible => hidden', animate('.1s linear')),
  30. transition('hidden => visible', [style({transform: 'scaleY(0.8)'}), animate('.12s cubic-bezier(0, 0, 0.2, 1)')])
  31. ])
  32. ]
  33. })
  34. export class AppInlineMenuComponent {
  35. @Input() key = 'inline-menu';
  36. @Input() style: any;
  37. @Input() styleClass: string;
  38. active: boolean;
  39. constructor(public appMain: AppMainComponent, public app: AppComponent) { }
  40. onClick(event) {
  41. this.appMain.onInlineMenuClick(event, this.key);
  42. event.preventDefault();
  43. }
  44. get isTooltipDisabled() {
  45. return !(this.appMain.isSlim() && !this.appMain.isMobile());
  46. }
  47. get tabIndex() {
  48. return !this.appMain.inlineMenuActive ? '-1' : null;
  49. }
  50. isHorizontalActive() {
  51. return this.appMain.isHorizontal() && !this.appMain.isMobile();
  52. }
  53. }

Powered by TurnKey Linux.