123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { Directive, ElementRef } from '@angular/core';
  2. import { DomController } from '../../platform/dom-controller';
  3. /**
  4. * @hidden
  5. */
  6. var TabHighlight = (function () {
  7. function TabHighlight(_elementRef, _dom) {
  8. this._elementRef = _elementRef;
  9. this._dom = _dom;
  10. }
  11. TabHighlight.prototype.select = function (tab) {
  12. var _this = this;
  13. if (!tab) {
  14. return;
  15. }
  16. var dom = this._dom;
  17. dom.read(function () {
  18. var btnEle = tab.btn.getNativeElement();
  19. var transform = "translate3d(" + btnEle.offsetLeft + "px,0,0) scaleX(" + btnEle.offsetWidth + ")";
  20. dom.write(function () {
  21. var ele = _this._elementRef.nativeElement;
  22. ele.style[dom.plt.Css.transform] = transform;
  23. if (!_this._init) {
  24. _this._init = true;
  25. dom.write(function () {
  26. ele.classList.add('animate');
  27. }, 80);
  28. }
  29. });
  30. }, 32);
  31. };
  32. TabHighlight.decorators = [
  33. { type: Directive, args: [{
  34. selector: '.tab-highlight'
  35. },] },
  36. ];
  37. /** @nocollapse */
  38. TabHighlight.ctorParameters = function () { return [
  39. { type: ElementRef, },
  40. { type: DomController, },
  41. ]; };
  42. return TabHighlight;
  43. }());
  44. export { TabHighlight };
  45. //# sourceMappingURL=tab-highlight.js.map