progress-spinner.d.ts 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { Platform } from '@angular/cdk/platform';
  9. import { ElementRef, InjectionToken } from '@angular/core';
  10. import { CanColor, CanColorCtor } from '@angular/material/core';
  11. /** Possible mode for a progress spinner. */
  12. export declare type ProgressSpinnerMode = 'determinate' | 'indeterminate';
  13. /** @docs-private */
  14. declare class MatProgressSpinnerBase {
  15. _elementRef: ElementRef;
  16. constructor(_elementRef: ElementRef);
  17. }
  18. declare const _MatProgressSpinnerMixinBase: CanColorCtor & typeof MatProgressSpinnerBase;
  19. /** Default `mat-progress-spinner` options that can be overridden. */
  20. export interface MatProgressSpinnerDefaultOptions {
  21. /** Diameter of the spinner. */
  22. diameter?: number;
  23. /** Width of the spinner's stroke. */
  24. strokeWidth?: number;
  25. /**
  26. * Whether the animations should be force to be enabled, ignoring if the current environment is
  27. * using NoopAnimationsModule.
  28. */
  29. _forceAnimations?: boolean;
  30. }
  31. /** Injection token to be used to override the default options for `mat-progress-spinner`. */
  32. export declare const MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS: InjectionToken<MatProgressSpinnerDefaultOptions>;
  33. /** @docs-private */
  34. export declare function MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY(): MatProgressSpinnerDefaultOptions;
  35. /**
  36. * `<mat-progress-spinner>` component.
  37. */
  38. export declare class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements CanColor {
  39. _elementRef: ElementRef<HTMLElement>;
  40. private _document;
  41. private _diameter;
  42. private _value;
  43. private _strokeWidth;
  44. private _fallbackAnimation;
  45. /**
  46. * Element to which we should add the generated style tags for the indeterminate animation.
  47. * For most elements this is the document, but for the ones in the Shadow DOM we need to
  48. * use the shadow root.
  49. */
  50. private _styleRoot;
  51. /**
  52. * Tracks diameters of existing instances to de-dupe generated styles (default d = 100).
  53. * We need to keep track of which elements the diameters were attached to, because for
  54. * elements in the Shadow DOM the style tags are attached to the shadow root, rather
  55. * than the document head.
  56. */
  57. private static _diameters;
  58. /** Whether the _mat-animation-noopable class should be applied, disabling animations. */
  59. _noopAnimations: boolean;
  60. /** The diameter of the progress spinner (will set width and height of svg). */
  61. diameter: number;
  62. /** Stroke width of the progress spinner. */
  63. strokeWidth: number;
  64. /** Mode of the progress circle */
  65. mode: ProgressSpinnerMode;
  66. /** Value of the progress circle. */
  67. value: number;
  68. constructor(_elementRef: ElementRef<HTMLElement>, platform: Platform, _document: any, animationMode: string, defaults?: MatProgressSpinnerDefaultOptions);
  69. /** The radius of the spinner, adjusted for stroke width. */
  70. readonly _circleRadius: number;
  71. /** The view box of the spinner's svg element. */
  72. readonly _viewBox: string;
  73. /** The stroke circumference of the svg circle. */
  74. readonly _strokeCircumference: number;
  75. /** The dash offset of the svg circle. */
  76. readonly _strokeDashOffset: number | null;
  77. /** Stroke width of the circle in percent. */
  78. readonly _circleStrokeWidth: number;
  79. /** Dynamically generates a style tag containing the correct animation for this diameter. */
  80. private _attachStyleNode;
  81. /** Generates animation styles adjusted for the spinner's diameter. */
  82. private _getAnimationText;
  83. }
  84. /**
  85. * `<mat-spinner>` component.
  86. *
  87. * This is a component definition to be used as a convenience reference to create an
  88. * indeterminate `<mat-progress-spinner>` instance.
  89. */
  90. export declare class MatSpinner extends MatProgressSpinner {
  91. constructor(elementRef: ElementRef<HTMLElement>, platform: Platform, document: any, animationMode: string, defaults?: MatProgressSpinnerDefaultOptions);
  92. }
  93. /** Gets the shadow root of an element, if supported and the element is inside the Shadow DOM. */
  94. export declare function _getShadowRoot(element: HTMLElement, _document: Document): Node | null;
  95. export {};