Skip to content

Commit f958318

Browse files
authored
fix(material/progress-spinner): remove dependency on legacy progress spinner (#25583)
Fixes that the non-legacy progress spinner was depending on the legacy version.
1 parent c5c8e64 commit f958318

23 files changed

+132
-162
lines changed

src/components-examples/material/table/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ng_module(
2424
"//src/material/legacy-checkbox",
2525
"//src/material/legacy-input",
2626
"//src/material/legacy-paginator",
27-
"//src/material/progress-spinner",
27+
"//src/material/legacy-progress-spinner",
2828
"//src/material/sort",
2929
"//src/material/table",
3030
"//src/material/table/testing",

src/material/legacy-progress-spinner/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ng_module(
2323
"//src/cdk/platform",
2424
"//src/cdk/scrolling",
2525
"//src/material/core",
26+
"//src/material/progress-spinner",
2627
"@npm//@angular/animations",
2728
"@npm//@angular/common",
2829
"@npm//@angular/core",

src/material/legacy-progress-spinner/progress-spinner.ts

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Component,
1616
ElementRef,
1717
Inject,
18-
InjectionToken,
1918
Input,
2019
Optional,
2120
ViewEncapsulation,
@@ -24,17 +23,15 @@ import {
2423
OnDestroy,
2524
NgZone,
2625
} from '@angular/core';
27-
import {CanColor, mixinColor, ThemePalette} from '@angular/material/core';
26+
import {CanColor, mixinColor} from '@angular/material/core';
2827
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
28+
import {
29+
MatProgressSpinnerDefaultOptions,
30+
MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,
31+
ProgressSpinnerMode,
32+
} from '@angular/material/progress-spinner';
2933
import {Subscription} from 'rxjs';
3034

31-
/**
32-
* Possible mode for a progress spinner.
33-
* @deprecated Use `ProgressSpinnerMode` from `@angular/material/progress-spinner` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
34-
* @breaking-change 17.0.0
35-
*/
36-
export type LegacyProgressSpinnerMode = 'determinate' | 'indeterminate';
37-
3835
/**
3936
* Base reference size of the spinner.
4037
* @docs-private
@@ -56,48 +53,6 @@ const _MatProgressSpinnerBase = mixinColor(
5653
'primary',
5754
);
5855

59-
/**
60-
* Default `mat-progress-spinner` options that can be overridden.
61-
* @deprecated Use `MatProgressSpinnerDefaultOptions` from `@angular/material/progress-spinner` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
62-
* @breaking-change 17.0.0
63-
*/
64-
export interface MatLegacyProgressSpinnerDefaultOptions {
65-
/** Default color of the spinner. */
66-
color?: ThemePalette;
67-
/** Diameter of the spinner. */
68-
diameter?: number;
69-
/** Width of the spinner's stroke. */
70-
strokeWidth?: number;
71-
/**
72-
* Whether the animations should be force to be enabled, ignoring if the current environment is
73-
* using NoopAnimationsModule.
74-
*/
75-
_forceAnimations?: boolean;
76-
}
77-
78-
/**
79-
* Injection token to be used to override the default options for `mat-progress-spinner`.
80-
* @deprecated Use `MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS` from `@angular/material/progress-spinner` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
81-
* @breaking-change 17.0.0
82-
*/
83-
export const MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS =
84-
new InjectionToken<MatLegacyProgressSpinnerDefaultOptions>(
85-
'mat-progress-spinner-default-options',
86-
{
87-
providedIn: 'root',
88-
factory: MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
89-
},
90-
);
91-
92-
/**
93-
* @docs-private
94-
* @deprecated Use `MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY` from `@angular/material/progress-spinner` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
95-
* @breaking-change 17.0.0
96-
*/
97-
export function MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY(): MatLegacyProgressSpinnerDefaultOptions {
98-
return {diameter: BASE_SIZE};
99-
}
100-
10156
// .0001 percentage difference is necessary in order to avoid unwanted animation frames
10257
// for example because the animation duration is 4 seconds, .1% accounts to 4ms
10358
// which are enough to see the flicker described in
@@ -210,7 +165,7 @@ export class MatLegacyProgressSpinner
210165
}
211166

212167
/** Mode of the progress circle */
213-
@Input() mode: LegacyProgressSpinnerMode = 'determinate';
168+
@Input() mode: ProgressSpinnerMode = 'determinate';
214169

215170
/** Value of the progress circle. */
216171
@Input()
@@ -226,8 +181,8 @@ export class MatLegacyProgressSpinner
226181
_platform: Platform,
227182
@Optional() @Inject(DOCUMENT) private _document: any,
228183
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode: string,
229-
@Inject(MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS)
230-
defaults?: MatLegacyProgressSpinnerDefaultOptions,
184+
@Inject(MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS)
185+
defaults?: MatProgressSpinnerDefaultOptions,
231186
/**
232187
* @deprecated `changeDetectorRef`, `viewportRuler` and `ngZone`
233188
* parameters to become required.

src/material/legacy-progress-spinner/public-api.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
import {MatLegacyProgressSpinner} from './progress-spinner';
1010

1111
export {MatLegacyProgressSpinnerModule} from './progress-spinner-module';
12+
export {MatLegacyProgressSpinner} from './progress-spinner';
13+
1214
export {
13-
MatLegacyProgressSpinner,
14-
MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS,
15-
LegacyProgressSpinnerMode,
16-
MatLegacyProgressSpinnerDefaultOptions,
17-
MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
18-
} from './progress-spinner';
15+
MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS as MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS,
16+
MatProgressSpinnerDefaultOptions as MatLegacyProgressSpinnerDefaultOptions,
17+
MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY as MAT_LEGACY_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
18+
ProgressSpinnerMode as LegacyProgressSpinnerMode,
19+
} from '@angular/material/progress-spinner';
1920

2021
/**
2122
* @deprecated Import Progress Spinner instead. Note that the

src/material/legacy-progress-spinner/testing/BUILD.bazel

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ts_library(
1212
"//src/cdk/coercion",
1313
"//src/cdk/testing",
1414
"//src/material/legacy-progress-spinner",
15+
"//src/material/progress-spinner/testing",
1516
],
1617
)
1718

@@ -20,28 +21,13 @@ filegroup(
2021
srcs = glob(["**/*.ts"]),
2122
)
2223

23-
ng_test_library(
24-
name = "harness_tests_lib",
25-
srcs = ["shared.spec.ts"],
26-
deps = [
27-
":testing",
28-
"//src/cdk/testing",
29-
"//src/cdk/testing/testbed",
30-
"//src/material/legacy-progress-spinner",
31-
"@npm//@angular/platform-browser",
32-
],
33-
)
34-
3524
ng_test_library(
3625
name = "unit_tests_lib",
37-
srcs = glob(
38-
["**/*.spec.ts"],
39-
exclude = ["shared.spec.ts"],
40-
),
26+
srcs = glob(["**/*.spec.ts"]),
4127
deps = [
42-
":harness_tests_lib",
4328
":testing",
4429
"//src/material/legacy-progress-spinner",
30+
"//src/material/progress-spinner/testing:harness_tests_lib",
4531
],
4632
)
4733

src/material/legacy-progress-spinner/testing/progress-spinner-harness-filters.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {MatLegacyProgressSpinnerModule} from '@angular/material/legacy-progress-spinner';
2-
import {runHarnessTests} from '@angular/material/legacy-progress-spinner/testing/shared.spec';
2+
import {runHarnessTests} from '@angular/material/progress-spinner/testing/shared.spec';
33
import {MatLegacyProgressSpinnerHarness} from './progress-spinner-harness';
44

55
describe('Non-MDC-based MatProgressSpinnerHarness', () => {
6-
runHarnessTests(MatLegacyProgressSpinnerModule, MatLegacyProgressSpinnerHarness);
6+
runHarnessTests(MatLegacyProgressSpinnerModule, MatLegacyProgressSpinnerHarness as any);
77
});

src/material/legacy-progress-spinner/testing/progress-spinner-harness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import {coerceNumberProperty} from '@angular/cdk/coercion';
1010
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
1111
import {LegacyProgressSpinnerMode} from '@angular/material/legacy-progress-spinner';
12-
import {LegacyProgressSpinnerHarnessFilters} from './progress-spinner-harness-filters';
12+
import {ProgressSpinnerHarnessFilters} from '@angular/material/progress-spinner/testing';
1313

1414
/**
1515
* Harness for interacting with a standard mat-progress-spinner in tests.
@@ -27,7 +27,7 @@ export class MatLegacyProgressSpinnerHarness extends ComponentHarness {
2727
* @return a `HarnessPredicate` configured with the given options.
2828
*/
2929
static with(
30-
options: LegacyProgressSpinnerHarnessFilters = {},
30+
options: ProgressSpinnerHarnessFilters = {},
3131
): HarnessPredicate<MatLegacyProgressSpinnerHarness> {
3232
return new HarnessPredicate(MatLegacyProgressSpinnerHarness, options);
3333
}

src/material/legacy-progress-spinner/testing/public-api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88

99
export {MatLegacyProgressSpinnerHarness} from './progress-spinner-harness';
10-
export {LegacyProgressSpinnerHarnessFilters} from './progress-spinner-harness-filters';
10+
export {ProgressSpinnerHarnessFilters as LegacyProgressSpinnerHarnessFilters} from '@angular/material/progress-spinner/testing';

src/material/progress-spinner/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ng_module(
2424
deps = [
2525
"//src/cdk/platform",
2626
"//src/material/core",
27-
"//src/material/legacy-progress-spinner",
2827
"@npm//@angular/common",
2928
"@npm//@angular/core",
3029
],
@@ -58,7 +57,6 @@ ng_test_library(
5857
deps = [
5958
":progress-spinner",
6059
"//src/cdk/platform",
61-
"//src/material/legacy-progress-spinner",
6260
"@npm//@angular/common",
6361
"@npm//@angular/platform-browser",
6462
],

0 commit comments

Comments
 (0)