toolbar-item.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { ContentChildren, Directive, ElementRef, Inject, Optional, Renderer, forwardRef } from '@angular/core';
  2. import { Button } from '../button/button';
  3. import { Config } from '../../config/config';
  4. import { Ion } from '../ion';
  5. import { Navbar } from './navbar';
  6. import { Toolbar } from './toolbar';
  7. /**
  8. * @hidden
  9. */
  10. export class ToolbarItem extends Ion {
  11. constructor(config, elementRef, renderer, toolbar, navbar) {
  12. super(config, elementRef, renderer, 'bar-buttons');
  13. this.inToolbar = !!(toolbar || navbar);
  14. }
  15. set _buttons(buttons) {
  16. if (this.inToolbar) {
  17. buttons.forEach((button) => {
  18. button.setRole('bar-button');
  19. });
  20. }
  21. }
  22. }
  23. ToolbarItem.decorators = [
  24. { type: Directive, args: [{
  25. selector: 'ion-buttons,[menuToggle]'
  26. },] },
  27. ];
  28. /** @nocollapse */
  29. ToolbarItem.ctorParameters = () => [
  30. { type: Config, },
  31. { type: ElementRef, },
  32. { type: Renderer, },
  33. { type: Toolbar, decorators: [{ type: Optional },] },
  34. { type: Navbar, decorators: [{ type: Optional }, { type: Inject, args: [forwardRef(() => Navbar),] },] },
  35. ];
  36. ToolbarItem.propDecorators = {
  37. '_buttons': [{ type: ContentChildren, args: [Button,] },],
  38. };
  39. //# sourceMappingURL=toolbar-item.js.map