index.d.ts 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import { _AbstractConstructor } from '@angular/material/core';
  2. import { AriaDescriber } from '@angular/cdk/a11y';
  3. import { BooleanInput } from '@angular/cdk/coercion';
  4. import { CanDisable } from '@angular/material/core';
  5. import { _Constructor } from '@angular/material/core';
  6. import { ElementRef } from '@angular/core';
  7. import * as i0 from '@angular/core';
  8. import * as i2 from '@angular/cdk/a11y';
  9. import * as i3 from '@angular/material/core';
  10. import { NgZone } from '@angular/core';
  11. import { OnDestroy } from '@angular/core';
  12. import { OnInit } from '@angular/core';
  13. import { Renderer2 } from '@angular/core';
  14. import { ThemePalette } from '@angular/material/core';
  15. declare namespace i1 {
  16. export {
  17. MatBadgePosition,
  18. MatBadgeSize,
  19. MatBadge
  20. }
  21. }
  22. /** Directive to display a text badge. */
  23. export declare class MatBadge extends _MatBadgeBase implements OnInit, OnDestroy, CanDisable {
  24. private _ngZone;
  25. private _elementRef;
  26. private _ariaDescriber;
  27. private _renderer;
  28. private _animationMode?;
  29. /** The color of the badge. Can be `primary`, `accent`, or `warn`. */
  30. get color(): ThemePalette;
  31. set color(value: ThemePalette);
  32. private _color;
  33. /** Whether the badge should overlap its contents or not */
  34. get overlap(): boolean;
  35. set overlap(val: BooleanInput);
  36. private _overlap;
  37. /**
  38. * Position the badge should reside.
  39. * Accepts any combination of 'above'|'below' and 'before'|'after'
  40. */
  41. position: MatBadgePosition;
  42. /** The content for the badge */
  43. get content(): string | number | undefined | null;
  44. set content(newContent: string | number | undefined | null);
  45. private _content;
  46. /** Message used to describe the decorated element via aria-describedby */
  47. get description(): string;
  48. set description(newDescription: string);
  49. private _description;
  50. /** Size of the badge. Can be 'small', 'medium', or 'large'. */
  51. size: MatBadgeSize;
  52. /** Whether the badge is hidden. */
  53. get hidden(): boolean;
  54. set hidden(val: BooleanInput);
  55. private _hidden;
  56. /** Unique id for the badge */
  57. _id: number;
  58. /** Visible badge element. */
  59. private _badgeElement;
  60. /** Inline badge description. Used when the badge is applied to non-interactive host elements. */
  61. private _inlineBadgeDescription;
  62. /** Whether the OnInit lifecycle hook has run yet */
  63. private _isInitialized;
  64. /** InteractivityChecker to determine if the badge host is focusable. */
  65. private _interactivityChecker;
  66. private _document;
  67. constructor(_ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _ariaDescriber: AriaDescriber, _renderer: Renderer2, _animationMode?: string | undefined);
  68. /** Whether the badge is above the host or not */
  69. isAbove(): boolean;
  70. /** Whether the badge is after the host or not */
  71. isAfter(): boolean;
  72. /**
  73. * Gets the element into which the badge's content is being rendered. Undefined if the element
  74. * hasn't been created (e.g. if the badge doesn't have content).
  75. */
  76. getBadgeElement(): HTMLElement | undefined;
  77. ngOnInit(): void;
  78. ngOnDestroy(): void;
  79. /** Gets whether the badge's host element is interactive. */
  80. private _isHostInteractive;
  81. /** Creates the badge element */
  82. private _createBadgeElement;
  83. /** Update the text content of the badge element in the DOM, creating the element if necessary. */
  84. private _updateRenderedContent;
  85. /** Updates the host element's aria description via AriaDescriber. */
  86. private _updateDescription;
  87. private _updateInlineDescription;
  88. private _removeInlineDescription;
  89. /** Adds css theme class given the color to the component host */
  90. private _setColor;
  91. /** Clears any existing badges that might be left over from server-side rendering. */
  92. private _clearExistingBadges;
  93. static ɵfac: i0.ɵɵFactoryDeclaration<MatBadge, [null, null, null, null, { optional: true; }]>;
  94. static ɵdir: i0.ɵɵDirectiveDeclaration<MatBadge, "[matBadge]", never, { "disabled": { "alias": "matBadgeDisabled"; "required": false; }; "color": { "alias": "matBadgeColor"; "required": false; }; "overlap": { "alias": "matBadgeOverlap"; "required": false; }; "position": { "alias": "matBadgePosition"; "required": false; }; "content": { "alias": "matBadge"; "required": false; }; "description": { "alias": "matBadgeDescription"; "required": false; }; "size": { "alias": "matBadgeSize"; "required": false; }; "hidden": { "alias": "matBadgeHidden"; "required": false; }; }, {}, never, never, false, never>;
  95. }
  96. /** @docs-private */
  97. declare const _MatBadgeBase: _Constructor<CanDisable> & _AbstractConstructor<CanDisable> & {
  98. new (): {};
  99. };
  100. export declare class MatBadgeModule {
  101. static ɵfac: i0.ɵɵFactoryDeclaration<MatBadgeModule, never>;
  102. static ɵmod: i0.ɵɵNgModuleDeclaration<MatBadgeModule, [typeof i1.MatBadge], [typeof i2.A11yModule, typeof i3.MatCommonModule], [typeof i1.MatBadge, typeof i3.MatCommonModule]>;
  103. static ɵinj: i0.ɵɵInjectorDeclaration<MatBadgeModule>;
  104. }
  105. /** Allowed position options for matBadgePosition */
  106. export declare type MatBadgePosition = 'above after' | 'above before' | 'below before' | 'below after' | 'before' | 'after' | 'above' | 'below';
  107. /** Allowed size options for matBadgeSize */
  108. export declare type MatBadgeSize = 'small' | 'medium' | 'large';
  109. export { }