@angular/material 12.0.0-rc.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/material-chips.umd.js.map +1 -1
- package/bundles/material-core.umd.js +27 -30
- package/bundles/material-core.umd.js.map +1 -1
- package/bundles/material-datepicker-testing.umd.js +5 -5
- package/bundles/material-datepicker-testing.umd.js.map +1 -1
- package/bundles/material-datepicker.umd.js +57 -7
- package/bundles/material-datepicker.umd.js.map +1 -1
- package/bundles/material-form-field-testing.umd.js +16 -8
- package/bundles/material-form-field-testing.umd.js.map +1 -1
- package/bundles/material-menu.umd.js.map +1 -1
- package/bundles/material-paginator.umd.js +1 -0
- package/bundles/material-paginator.umd.js.map +1 -1
- package/bundles/material-table-testing.umd.js +103 -143
- package/bundles/material-table-testing.umd.js.map +1 -1
- package/bundles/material-tabs.umd.js +8 -1
- package/bundles/material-tabs.umd.js.map +1 -1
- package/bundles/material-tree.umd.js +1 -3
- package/bundles/material-tree.umd.js.map +1 -1
- package/chips/chip.d.ts +2 -1
- package/chips/index.metadata.json +1 -1
- package/core/common-behaviors/color.d.ts +3 -3
- package/core/common-behaviors/constructor.d.ts +1 -3
- package/core/common-behaviors/disable-ripple.d.ts +2 -2
- package/core/common-behaviors/disabled.d.ts +3 -3
- package/core/common-behaviors/error-state.d.ts +3 -3
- package/core/common-behaviors/tabindex.d.ts +1 -1
- package/core/index.metadata.json +1 -1
- package/core/ripple/ripple-renderer.d.ts +2 -0
- package/core/ripple/ripple.d.ts +2 -0
- package/datepicker/date-range-input-parts.d.ts +2 -0
- package/datepicker/date-range-input.d.ts +6 -1
- package/datepicker/date-selection-model.d.ts +2 -0
- package/datepicker/datepicker-base.d.ts +1 -0
- package/datepicker/datepicker-input.d.ts +4 -2
- package/datepicker/index.metadata.json +1 -1
- package/datepicker/testing/datepicker-input-harness-base.d.ts +3 -2
- package/esm2015/chips/chip.js +1 -1
- package/esm2015/core/common-behaviors/color.js +1 -2
- package/esm2015/core/common-behaviors/common-module.js +1 -1
- package/esm2015/core/common-behaviors/constructor.js +1 -1
- package/esm2015/core/common-behaviors/disable-ripple.js +3 -8
- package/esm2015/core/common-behaviors/disabled.js +1 -2
- package/esm2015/core/common-behaviors/error-state.js +1 -5
- package/esm2015/core/common-behaviors/tabindex.js +3 -10
- package/esm2015/core/ripple/ripple-renderer.js +9 -1
- package/esm2015/core/ripple/ripple.js +8 -1
- package/esm2015/core/version.js +1 -1
- package/esm2015/datepicker/date-range-input-parts.js +23 -1
- package/esm2015/datepicker/date-range-input.js +18 -3
- package/esm2015/datepicker/date-selection-model.js +3 -2
- package/esm2015/datepicker/datepicker-base.js +8 -3
- package/esm2015/datepicker/datepicker-input.js +8 -1
- package/esm2015/datepicker/datepicker-toggle.js +1 -1
- package/esm2015/datepicker/testing/datepicker-input-harness-base.js +4 -3
- package/esm2015/form-field/testing/form-field-harness.js +12 -3
- package/esm2015/menu/menu-trigger.js +1 -1
- package/esm2015/menu/menu.js +1 -1
- package/esm2015/paginator/paginator.js +2 -1
- package/esm2015/table/testing/cell-harness.js +9 -9
- package/esm2015/table/testing/row-harness.js +38 -70
- package/esm2015/table/testing/table-harness.js +23 -15
- package/esm2015/tabs/paginated-tab-header.js +2 -2
- package/esm2015/tabs/tab-group.js +8 -1
- package/esm2015/tree/data-source/nested-data-source.js +2 -4
- package/fesm2015/chips.js.map +1 -1
- package/fesm2015/core.js +21 -24
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/datepicker/testing.js +2 -1
- package/fesm2015/datepicker/testing.js.map +1 -1
- package/fesm2015/datepicker.js +55 -5
- package/fesm2015/datepicker.js.map +1 -1
- package/fesm2015/form-field/testing.js +11 -2
- package/fesm2015/form-field/testing.js.map +1 -1
- package/fesm2015/menu.js.map +1 -1
- package/fesm2015/paginator.js +1 -0
- package/fesm2015/paginator.js.map +1 -1
- package/fesm2015/table/testing.js +66 -90
- package/fesm2015/table/testing.js.map +1 -1
- package/fesm2015/tabs.js +8 -1
- package/fesm2015/tabs.js.map +1 -1
- package/fesm2015/tree.js +1 -3
- package/fesm2015/tree.js.map +1 -1
- package/form-field/testing/form-field-harness.d.ts +6 -1
- package/package.json +6 -6
- package/paginator/index.metadata.json +1 -1
- package/prebuilt-themes/deeppurple-amber.css +1 -1
- package/prebuilt-themes/indigo-pink.css +1 -1
- package/prebuilt-themes/pink-bluegrey.css +1 -1
- package/prebuilt-themes/purple-green.css +1 -1
- package/schematics/collection.json +0 -6
- package/schematics/ng-add/index.js +2 -2
- package/schematics/ng-update/index.js +3 -1
- package/schematics/{ng-generate/theming-api → ng-update/migrations/theming-api-v12}/config.d.ts +6 -0
- package/schematics/ng-update/migrations/theming-api-v12/config.js +206 -0
- package/schematics/{ng-generate/theming-api → ng-update/migrations/theming-api-v12}/migration.d.ts +0 -0
- package/schematics/ng-update/migrations/theming-api-v12/migration.js +234 -0
- package/schematics/ng-update/migrations/theming-api-v12/theming-api-migration.d.ts +18 -0
- package/schematics/ng-update/migrations/theming-api-v12/theming-api-migration.js +45 -0
- package/table/testing/cell-harness.d.ts +2 -1
- package/table/testing/row-harness.d.ts +21 -22
- package/table/testing/table-harness.d.ts +32 -13
- package/tabs/_tabs-theme.scss +5 -2
- package/tabs/index.metadata.json +1 -1
- package/schematics/ng-generate/theming-api/config.js +0 -183
- package/schematics/ng-generate/theming-api/index.d.ts +0 -10
- package/schematics/ng-generate/theming-api/index.js +0 -26
- package/schematics/ng-generate/theming-api/migration.js +0 -223
- package/schematics/ng-generate/theming-api/schema.d.ts +0 -9
- package/schematics/ng-generate/theming-api/schema.js +0 -10
- package/schematics/ng-generate/theming-api/schema.json +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator.js","sources":["../../../../../../src/material/paginator/paginator-intl.ts","../../../../../../src/material/paginator/paginator.ts","../../../../../../src/material/paginator/paginator-module.ts","../../../../../../src/material/paginator/public-api.ts","../../../../../../src/material/paginator/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, Optional, SkipSelf} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n\n/**\n * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and\n * include it in a custom provider\n */\n@Injectable({providedIn: 'root'})\nexport class MatPaginatorIntl {\n /**\n * Stream to emit from when labels are changed. Use this to notify components when the labels have\n * changed after initialization.\n */\n readonly changes: Subject<void> = new Subject<void>();\n\n /** A label for the page size selector. */\n itemsPerPageLabel: string = 'Items per page:';\n\n /** A label for the button that increments the current page. */\n nextPageLabel: string = 'Next page';\n\n /** A label for the button that decrements the current page. */\n previousPageLabel: string = 'Previous page';\n\n /** A label for the button that moves to the first page. */\n firstPageLabel: string = 'First page';\n\n /** A label for the button that moves to the last page. */\n lastPageLabel: string = 'Last page';\n\n /** A label for the range of items within the current page and the length of the whole list. */\n getRangeLabel: (page: number, pageSize: number, length: number) => string =\n (page: number, pageSize: number, length: number) => {\n if (length == 0 || pageSize == 0) { return `0 of ${length}`; }\n\n length = Math.max(length, 0);\n\n const startIndex = page * pageSize;\n\n // If the start index exceeds the list length, do not try and fix the end index to the end.\n const endIndex = startIndex < length ?\n Math.min(startIndex + pageSize, length) :\n startIndex + pageSize;\n\n return `${startIndex + 1} – ${endIndex} of ${length}`;\n }\n}\n\n/** @docs-private */\nexport function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl: MatPaginatorIntl) {\n return parentIntl || new MatPaginatorIntl();\n}\n\n/** @docs-private */\nexport const MAT_PAGINATOR_INTL_PROVIDER = {\n // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.\n provide: MatPaginatorIntl,\n deps: [[new Optional(), new SkipSelf(), MatPaginatorIntl]],\n useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n coerceNumberProperty,\n coerceBooleanProperty,\n BooleanInput,\n NumberInput\n} from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewEncapsulation,\n InjectionToken,\n Inject,\n Optional,\n Directive,\n} from '@angular/core';\nimport {Subscription} from 'rxjs';\nimport {MatPaginatorIntl} from './paginator-intl';\nimport {\n HasInitialized,\n HasInitializedCtor,\n mixinInitialized,\n ThemePalette,\n mixinDisabled,\n CanDisableCtor,\n CanDisable,\n} from '@angular/material/core';\nimport {MatFormFieldAppearance} from '@angular/material/form-field';\n\n/** The default page size if there is no page size and there are no provided page size options. */\nconst DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Change event object that is emitted when the user selects a\n * different page size or navigates to another page.\n */\nexport class PageEvent {\n /** The current page index. */\n pageIndex: number;\n\n /**\n * Index of the page that was selected previously.\n * @breaking-change 8.0.0 To be made into a required property.\n */\n previousPageIndex?: number;\n\n /** The current page size */\n pageSize: number;\n\n /** The current total number of items being paged */\n length: number;\n}\n\n\n/** Object that can be used to configure the default options for the paginator module. */\nexport interface MatPaginatorDefaultOptions {\n /** Number of items to display on a page. By default set to 50. */\n pageSize?: number;\n\n /** The set of provided page size options to display to the user. */\n pageSizeOptions?: number[];\n\n /** Whether to hide the page size selection UI from the user. */\n hidePageSize?: boolean;\n\n /** Whether to show the first/last buttons UI to the user. */\n showFirstLastButtons?: boolean;\n\n /** The default form-field appearance to apply to the page size options selector. */\n formFieldAppearance?: MatFormFieldAppearance;\n}\n\n/** Injection token that can be used to provide the default options for the paginator module. */\nexport const MAT_PAGINATOR_DEFAULT_OPTIONS =\n new InjectionToken<MatPaginatorDefaultOptions>('MAT_PAGINATOR_DEFAULT_OPTIONS');\n\n// Boilerplate for applying mixins to _MatPaginatorBase.\n/** @docs-private */\nclass MatPaginatorMixinBase {}\nconst _MatPaginatorMixinBase: CanDisableCtor & HasInitializedCtor & typeof MatPaginatorMixinBase =\n mixinDisabled(mixinInitialized(MatPaginatorMixinBase));\n\n/**\n * Base class with all of the `MatPaginator` functionality.\n * @docs-private\n */\n@Directive()\nexport abstract class _MatPaginatorBase<O extends {\n pageSize?: number;\n pageSizeOptions?: number[];\n hidePageSize?: boolean;\n showFirstLastButtons?: boolean;\n}> extends _MatPaginatorMixinBase implements OnInit, OnDestroy,\n CanDisable, HasInitialized {\n private _initialized: boolean;\n private _intlChanges: Subscription;\n\n /** Theme color to be used for the underlying form controls. */\n @Input() color: ThemePalette;\n\n /** The zero-based page index of the displayed list of items. Defaulted to 0. */\n @Input()\n get pageIndex(): number { return this._pageIndex; }\n set pageIndex(value: number) {\n this._pageIndex = Math.max(coerceNumberProperty(value), 0);\n this._changeDetectorRef.markForCheck();\n }\n private _pageIndex = 0;\n\n /** The length of the total number of items that are being paginated. Defaulted to 0. */\n @Input()\n get length(): number { return this._length; }\n set length(value: number) {\n this._length = coerceNumberProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n private _length = 0;\n\n /** Number of items to display on a page. By default set to 50. */\n @Input()\n get pageSize(): number { return this._pageSize; }\n set pageSize(value: number) {\n this._pageSize = Math.max(coerceNumberProperty(value), 0);\n this._updateDisplayedPageSizeOptions();\n }\n private _pageSize: number;\n\n /** The set of provided page size options to display to the user. */\n @Input()\n get pageSizeOptions(): number[] { return this._pageSizeOptions; }\n set pageSizeOptions(value: number[]) {\n this._pageSizeOptions = (value || []).map(p => coerceNumberProperty(p));\n this._updateDisplayedPageSizeOptions();\n }\n private _pageSizeOptions: number[] = [];\n\n /** Whether to hide the page size selection UI from the user. */\n @Input()\n get hidePageSize(): boolean { return this._hidePageSize; }\n set hidePageSize(value: boolean) {\n this._hidePageSize = coerceBooleanProperty(value);\n }\n private _hidePageSize = false;\n\n\n /** Whether to show the first/last buttons UI to the user. */\n @Input()\n get showFirstLastButtons(): boolean { return this._showFirstLastButtons; }\n set showFirstLastButtons(value: boolean) {\n this._showFirstLastButtons = coerceBooleanProperty(value);\n }\n private _showFirstLastButtons = false;\n\n /** Event emitted when the paginator changes the page size or page index. */\n @Output() readonly page: EventEmitter<PageEvent> = new EventEmitter<PageEvent>();\n\n /** Displayed set of page size options. Will be sorted and include current page size. */\n _displayedPageSizeOptions: number[];\n\n constructor(public _intl: MatPaginatorIntl,\n private _changeDetectorRef: ChangeDetectorRef,\n defaults?: O) {\n super();\n this._intlChanges = _intl.changes.subscribe(() => this._changeDetectorRef.markForCheck());\n\n if (defaults) {\n const {\n pageSize,\n pageSizeOptions,\n hidePageSize,\n showFirstLastButtons,\n } = defaults;\n\n if (pageSize != null) {\n this._pageSize = pageSize;\n }\n\n if (pageSizeOptions != null) {\n this._pageSizeOptions = pageSizeOptions;\n }\n\n if (hidePageSize != null) {\n this._hidePageSize = hidePageSize;\n }\n\n if (showFirstLastButtons != null) {\n this._showFirstLastButtons = showFirstLastButtons;\n }\n }\n }\n\n ngOnInit() {\n this._initialized = true;\n this._updateDisplayedPageSizeOptions();\n this._markInitialized();\n }\n\n ngOnDestroy() {\n this._intlChanges.unsubscribe();\n }\n\n /** Advances to the next page if it exists. */\n nextPage(): void {\n if (!this.hasNextPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex++;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move back to the previous page if it exists. */\n previousPage(): void {\n if (!this.hasPreviousPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex--;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move to the first page if not already there. */\n firstPage(): void {\n // hasPreviousPage being false implies at the start\n if (!this.hasPreviousPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex = 0;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move to the last page if not already there. */\n lastPage(): void {\n // hasNextPage being false implies at the end\n if (!this.hasNextPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex = this.getNumberOfPages() - 1;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Whether there is a previous page. */\n hasPreviousPage(): boolean {\n return this.pageIndex >= 1 && this.pageSize != 0;\n }\n\n /** Whether there is a next page. */\n hasNextPage(): boolean {\n const maxPageIndex = this.getNumberOfPages() - 1;\n return this.pageIndex < maxPageIndex && this.pageSize != 0;\n }\n\n /** Calculate the number of pages */\n getNumberOfPages(): number {\n if (!this.pageSize) {\n return 0;\n }\n\n return Math.ceil(this.length / this.pageSize);\n }\n\n\n /**\n * Changes the page size so that the first item displayed on the page will still be\n * displayed using the new page size.\n *\n * For example, if the page size is 10 and on the second page (items indexed 10-19) then\n * switching so that the page size is 5 will set the third page as the current page so\n * that the 10th item will still be displayed.\n */\n _changePageSize(pageSize: number) {\n // Current page needs to be updated to reflect the new page size. Navigate to the page\n // containing the previous page's first item.\n const startIndex = this.pageIndex * this.pageSize;\n const previousPageIndex = this.pageIndex;\n\n this.pageIndex = Math.floor(startIndex / pageSize) || 0;\n this.pageSize = pageSize;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Checks whether the buttons for going forwards should be disabled. */\n _nextButtonsDisabled() {\n return this.disabled || !this.hasNextPage();\n }\n\n /** Checks whether the buttons for going backwards should be disabled. */\n _previousButtonsDisabled() {\n return this.disabled || !this.hasPreviousPage();\n }\n\n /**\n * Updates the list of page size options to display to the user. Includes making sure that\n * the page size is an option and that the list is sorted.\n */\n private _updateDisplayedPageSizeOptions() {\n if (!this._initialized) { return; }\n\n // If no page size is provided, use the first page size option or the default page size.\n if (!this.pageSize) {\n this._pageSize = this.pageSizeOptions.length != 0 ?\n this.pageSizeOptions[0] :\n DEFAULT_PAGE_SIZE;\n }\n\n this._displayedPageSizeOptions = this.pageSizeOptions.slice();\n\n if (this._displayedPageSizeOptions.indexOf(this.pageSize) === -1) {\n this._displayedPageSizeOptions.push(this.pageSize);\n }\n\n // Sort the numbers using a number-specific sort function.\n this._displayedPageSizeOptions.sort((a, b) => a - b);\n this._changeDetectorRef.markForCheck();\n }\n\n /** Emits an event notifying that a change of the paginator's properties has been triggered. */\n private _emitPageEvent(previousPageIndex: number) {\n this.page.emit({\n previousPageIndex,\n pageIndex: this.pageIndex,\n pageSize: this.pageSize,\n length: this.length\n });\n }\n\n static ngAcceptInputType_pageIndex: NumberInput;\n static ngAcceptInputType_length: NumberInput;\n static ngAcceptInputType_pageSize: NumberInput;\n static ngAcceptInputType_hidePageSize: BooleanInput;\n static ngAcceptInputType_showFirstLastButtons: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n\n\n/**\n * Component to provide navigation between paged information. Displays the size of the current\n * page, user-selectable options to change that size, what items are being shown, and\n * navigational button to go to the previous or next page.\n */\n@Component({\n selector: 'mat-paginator',\n exportAs: 'matPaginator',\n templateUrl: 'paginator.html',\n styleUrls: ['paginator.css'],\n inputs: ['disabled'],\n host: {\n 'class': 'mat-paginator',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class MatPaginator extends _MatPaginatorBase<MatPaginatorDefaultOptions> {\n /** If set, styles the \"page size\" form field with the designated style. */\n _formFieldAppearance?: MatFormFieldAppearance;\n\n constructor(intl: MatPaginatorIntl,\n changeDetectorRef: ChangeDetectorRef,\n @Optional() @Inject(MAT_PAGINATOR_DEFAULT_OPTIONS) defaults?: MatPaginatorDefaultOptions) {\n super(intl, changeDetectorRef, defaults);\n\n if (defaults && defaults.formFieldAppearance != null) {\n this._formFieldAppearance = defaults.formFieldAppearance;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatSelectModule} from '@angular/material/select';\nimport {MatTooltipModule} from '@angular/material/tooltip';\nimport {MatPaginator} from './paginator';\nimport {MAT_PAGINATOR_INTL_PROVIDER} from './paginator-intl';\n\n\n@NgModule({\n imports: [\n CommonModule,\n MatButtonModule,\n MatSelectModule,\n MatTooltipModule,\n MatCommonModule,\n ],\n exports: [MatPaginator],\n declarations: [MatPaginator],\n providers: [MAT_PAGINATOR_INTL_PROVIDER],\n})\nexport class MatPaginatorModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './paginator-module';\nexport * from './paginator';\nexport * from './paginator-intl';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAYA;;;;MAKa,gBAAgB;IAD7B;;;;;QAMW,YAAO,GAAkB,IAAI,OAAO,EAAQ,CAAC;;QAGtD,sBAAiB,GAAW,iBAAiB,CAAC;;QAG9C,kBAAa,GAAW,WAAW,CAAC;;QAGpC,sBAAiB,GAAW,eAAe,CAAC;;QAG5C,mBAAc,GAAW,YAAY,CAAC;;QAGtC,kBAAa,GAAW,WAAW,CAAC;;QAGpC,kBAAa,GACX,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAc;YAC7C,IAAI,MAAM,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE;gBAAE,OAAO,QAAQ,MAAM,EAAE,CAAC;aAAE;YAE9D,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAE7B,MAAM,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC;;YAGnC,MAAM,QAAQ,GAAG,UAAU,GAAG,MAAM;gBAChC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,QAAQ,EAAE,MAAM,CAAC;gBACvC,UAAU,GAAG,QAAQ,CAAC;YAE1B,OAAO,GAAG,UAAU,GAAG,CAAC,MAAM,QAAQ,OAAO,MAAM,EAAE,CAAC;SAC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,iBAA6C;IAI7E,YAAY,IAAsB,EAChC,iBAAoC,EACe,QAAqC;QACxF,KAAK,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAEzC,IAAI,QAAQ,IAAI,QAAQ,CAAC,mBAAmB,IAAI,IAAI,EAAE;YACpD,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;SAC1D;KACF;;;YAxBF,SAAS,SAAC;gBACT,QAAQ,EAAE,eAAe;gBACzB,QAAQ,EAAE,cAAc;gBACxB,uvHAA6B;gBAE7B,MAAM,EAAE,CAAC,UAAU,CAAC;gBACpB,IAAI,EAAE;oBACJ,OAAO,EAAE,eAAe;iBACzB;gBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;;aACtC;;;YA5UO,gBAAgB;YAdtB,iBAAiB;4CAiWd,QAAQ,YAAI,MAAM,SAAC,6BAA6B;;;ACjXrD;;;;;;;MA8Ba,kBAAkB;;;YAZ9B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,eAAe;oBACf,eAAe;oBACf,gBAAgB;oBAChB,eAAe;iBAChB;gBACD,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,SAAS,EAAE,CAAC,2BAA2B,CAAC;aACzC;;;AC7BD;;;;;;;;ACAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"paginator.js","sources":["../../../../../../src/material/paginator/paginator-intl.ts","../../../../../../src/material/paginator/paginator.ts","../../../../../../src/material/paginator/paginator-module.ts","../../../../../../src/material/paginator/public-api.ts","../../../../../../src/material/paginator/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, Optional, SkipSelf} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n\n/**\n * To modify the labels and text displayed, create a new instance of MatPaginatorIntl and\n * include it in a custom provider\n */\n@Injectable({providedIn: 'root'})\nexport class MatPaginatorIntl {\n /**\n * Stream to emit from when labels are changed. Use this to notify components when the labels have\n * changed after initialization.\n */\n readonly changes: Subject<void> = new Subject<void>();\n\n /** A label for the page size selector. */\n itemsPerPageLabel: string = 'Items per page:';\n\n /** A label for the button that increments the current page. */\n nextPageLabel: string = 'Next page';\n\n /** A label for the button that decrements the current page. */\n previousPageLabel: string = 'Previous page';\n\n /** A label for the button that moves to the first page. */\n firstPageLabel: string = 'First page';\n\n /** A label for the button that moves to the last page. */\n lastPageLabel: string = 'Last page';\n\n /** A label for the range of items within the current page and the length of the whole list. */\n getRangeLabel: (page: number, pageSize: number, length: number) => string =\n (page: number, pageSize: number, length: number) => {\n if (length == 0 || pageSize == 0) { return `0 of ${length}`; }\n\n length = Math.max(length, 0);\n\n const startIndex = page * pageSize;\n\n // If the start index exceeds the list length, do not try and fix the end index to the end.\n const endIndex = startIndex < length ?\n Math.min(startIndex + pageSize, length) :\n startIndex + pageSize;\n\n return `${startIndex + 1} – ${endIndex} of ${length}`;\n }\n}\n\n/** @docs-private */\nexport function MAT_PAGINATOR_INTL_PROVIDER_FACTORY(parentIntl: MatPaginatorIntl) {\n return parentIntl || new MatPaginatorIntl();\n}\n\n/** @docs-private */\nexport const MAT_PAGINATOR_INTL_PROVIDER = {\n // If there is already an MatPaginatorIntl available, use that. Otherwise, provide a new one.\n provide: MatPaginatorIntl,\n deps: [[new Optional(), new SkipSelf(), MatPaginatorIntl]],\n useFactory: MAT_PAGINATOR_INTL_PROVIDER_FACTORY\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n coerceNumberProperty,\n coerceBooleanProperty,\n BooleanInput,\n NumberInput\n} from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Output,\n ViewEncapsulation,\n InjectionToken,\n Inject,\n Optional,\n Directive,\n} from '@angular/core';\nimport {Subscription} from 'rxjs';\nimport {MatPaginatorIntl} from './paginator-intl';\nimport {\n HasInitialized,\n HasInitializedCtor,\n mixinInitialized,\n ThemePalette,\n mixinDisabled,\n CanDisableCtor,\n CanDisable,\n} from '@angular/material/core';\nimport {MatFormFieldAppearance} from '@angular/material/form-field';\n\n/** The default page size if there is no page size and there are no provided page size options. */\nconst DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Change event object that is emitted when the user selects a\n * different page size or navigates to another page.\n */\nexport class PageEvent {\n /** The current page index. */\n pageIndex: number;\n\n /**\n * Index of the page that was selected previously.\n * @breaking-change 8.0.0 To be made into a required property.\n */\n previousPageIndex?: number;\n\n /** The current page size */\n pageSize: number;\n\n /** The current total number of items being paged */\n length: number;\n}\n\n\n/** Object that can be used to configure the default options for the paginator module. */\nexport interface MatPaginatorDefaultOptions {\n /** Number of items to display on a page. By default set to 50. */\n pageSize?: number;\n\n /** The set of provided page size options to display to the user. */\n pageSizeOptions?: number[];\n\n /** Whether to hide the page size selection UI from the user. */\n hidePageSize?: boolean;\n\n /** Whether to show the first/last buttons UI to the user. */\n showFirstLastButtons?: boolean;\n\n /** The default form-field appearance to apply to the page size options selector. */\n formFieldAppearance?: MatFormFieldAppearance;\n}\n\n/** Injection token that can be used to provide the default options for the paginator module. */\nexport const MAT_PAGINATOR_DEFAULT_OPTIONS =\n new InjectionToken<MatPaginatorDefaultOptions>('MAT_PAGINATOR_DEFAULT_OPTIONS');\n\n// Boilerplate for applying mixins to _MatPaginatorBase.\n/** @docs-private */\nclass MatPaginatorMixinBase {}\nconst _MatPaginatorMixinBase: CanDisableCtor & HasInitializedCtor & typeof MatPaginatorMixinBase =\n mixinDisabled(mixinInitialized(MatPaginatorMixinBase));\n\n/**\n * Base class with all of the `MatPaginator` functionality.\n * @docs-private\n */\n@Directive()\nexport abstract class _MatPaginatorBase<O extends {\n pageSize?: number;\n pageSizeOptions?: number[];\n hidePageSize?: boolean;\n showFirstLastButtons?: boolean;\n}> extends _MatPaginatorMixinBase implements OnInit, OnDestroy,\n CanDisable, HasInitialized {\n private _initialized: boolean;\n private _intlChanges: Subscription;\n\n /** Theme color to be used for the underlying form controls. */\n @Input() color: ThemePalette;\n\n /** The zero-based page index of the displayed list of items. Defaulted to 0. */\n @Input()\n get pageIndex(): number { return this._pageIndex; }\n set pageIndex(value: number) {\n this._pageIndex = Math.max(coerceNumberProperty(value), 0);\n this._changeDetectorRef.markForCheck();\n }\n private _pageIndex = 0;\n\n /** The length of the total number of items that are being paginated. Defaulted to 0. */\n @Input()\n get length(): number { return this._length; }\n set length(value: number) {\n this._length = coerceNumberProperty(value);\n this._changeDetectorRef.markForCheck();\n }\n private _length = 0;\n\n /** Number of items to display on a page. By default set to 50. */\n @Input()\n get pageSize(): number { return this._pageSize; }\n set pageSize(value: number) {\n this._pageSize = Math.max(coerceNumberProperty(value), 0);\n this._updateDisplayedPageSizeOptions();\n }\n private _pageSize: number;\n\n /** The set of provided page size options to display to the user. */\n @Input()\n get pageSizeOptions(): number[] { return this._pageSizeOptions; }\n set pageSizeOptions(value: number[]) {\n this._pageSizeOptions = (value || []).map(p => coerceNumberProperty(p));\n this._updateDisplayedPageSizeOptions();\n }\n private _pageSizeOptions: number[] = [];\n\n /** Whether to hide the page size selection UI from the user. */\n @Input()\n get hidePageSize(): boolean { return this._hidePageSize; }\n set hidePageSize(value: boolean) {\n this._hidePageSize = coerceBooleanProperty(value);\n }\n private _hidePageSize = false;\n\n\n /** Whether to show the first/last buttons UI to the user. */\n @Input()\n get showFirstLastButtons(): boolean { return this._showFirstLastButtons; }\n set showFirstLastButtons(value: boolean) {\n this._showFirstLastButtons = coerceBooleanProperty(value);\n }\n private _showFirstLastButtons = false;\n\n /** Event emitted when the paginator changes the page size or page index. */\n @Output() readonly page: EventEmitter<PageEvent> = new EventEmitter<PageEvent>();\n\n /** Displayed set of page size options. Will be sorted and include current page size. */\n _displayedPageSizeOptions: number[];\n\n constructor(public _intl: MatPaginatorIntl,\n private _changeDetectorRef: ChangeDetectorRef,\n defaults?: O) {\n super();\n this._intlChanges = _intl.changes.subscribe(() => this._changeDetectorRef.markForCheck());\n\n if (defaults) {\n const {\n pageSize,\n pageSizeOptions,\n hidePageSize,\n showFirstLastButtons,\n } = defaults;\n\n if (pageSize != null) {\n this._pageSize = pageSize;\n }\n\n if (pageSizeOptions != null) {\n this._pageSizeOptions = pageSizeOptions;\n }\n\n if (hidePageSize != null) {\n this._hidePageSize = hidePageSize;\n }\n\n if (showFirstLastButtons != null) {\n this._showFirstLastButtons = showFirstLastButtons;\n }\n }\n }\n\n ngOnInit() {\n this._initialized = true;\n this._updateDisplayedPageSizeOptions();\n this._markInitialized();\n }\n\n ngOnDestroy() {\n this._intlChanges.unsubscribe();\n }\n\n /** Advances to the next page if it exists. */\n nextPage(): void {\n if (!this.hasNextPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex++;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move back to the previous page if it exists. */\n previousPage(): void {\n if (!this.hasPreviousPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex--;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move to the first page if not already there. */\n firstPage(): void {\n // hasPreviousPage being false implies at the start\n if (!this.hasPreviousPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex = 0;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Move to the last page if not already there. */\n lastPage(): void {\n // hasNextPage being false implies at the end\n if (!this.hasNextPage()) { return; }\n\n const previousPageIndex = this.pageIndex;\n this.pageIndex = this.getNumberOfPages() - 1;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Whether there is a previous page. */\n hasPreviousPage(): boolean {\n return this.pageIndex >= 1 && this.pageSize != 0;\n }\n\n /** Whether there is a next page. */\n hasNextPage(): boolean {\n const maxPageIndex = this.getNumberOfPages() - 1;\n return this.pageIndex < maxPageIndex && this.pageSize != 0;\n }\n\n /** Calculate the number of pages */\n getNumberOfPages(): number {\n if (!this.pageSize) {\n return 0;\n }\n\n return Math.ceil(this.length / this.pageSize);\n }\n\n\n /**\n * Changes the page size so that the first item displayed on the page will still be\n * displayed using the new page size.\n *\n * For example, if the page size is 10 and on the second page (items indexed 10-19) then\n * switching so that the page size is 5 will set the third page as the current page so\n * that the 10th item will still be displayed.\n */\n _changePageSize(pageSize: number) {\n // Current page needs to be updated to reflect the new page size. Navigate to the page\n // containing the previous page's first item.\n const startIndex = this.pageIndex * this.pageSize;\n const previousPageIndex = this.pageIndex;\n\n this.pageIndex = Math.floor(startIndex / pageSize) || 0;\n this.pageSize = pageSize;\n this._emitPageEvent(previousPageIndex);\n }\n\n /** Checks whether the buttons for going forwards should be disabled. */\n _nextButtonsDisabled() {\n return this.disabled || !this.hasNextPage();\n }\n\n /** Checks whether the buttons for going backwards should be disabled. */\n _previousButtonsDisabled() {\n return this.disabled || !this.hasPreviousPage();\n }\n\n /**\n * Updates the list of page size options to display to the user. Includes making sure that\n * the page size is an option and that the list is sorted.\n */\n private _updateDisplayedPageSizeOptions() {\n if (!this._initialized) { return; }\n\n // If no page size is provided, use the first page size option or the default page size.\n if (!this.pageSize) {\n this._pageSize = this.pageSizeOptions.length != 0 ?\n this.pageSizeOptions[0] :\n DEFAULT_PAGE_SIZE;\n }\n\n this._displayedPageSizeOptions = this.pageSizeOptions.slice();\n\n if (this._displayedPageSizeOptions.indexOf(this.pageSize) === -1) {\n this._displayedPageSizeOptions.push(this.pageSize);\n }\n\n // Sort the numbers using a number-specific sort function.\n this._displayedPageSizeOptions.sort((a, b) => a - b);\n this._changeDetectorRef.markForCheck();\n }\n\n /** Emits an event notifying that a change of the paginator's properties has been triggered. */\n private _emitPageEvent(previousPageIndex: number) {\n this.page.emit({\n previousPageIndex,\n pageIndex: this.pageIndex,\n pageSize: this.pageSize,\n length: this.length\n });\n }\n\n static ngAcceptInputType_pageIndex: NumberInput;\n static ngAcceptInputType_length: NumberInput;\n static ngAcceptInputType_pageSize: NumberInput;\n static ngAcceptInputType_hidePageSize: BooleanInput;\n static ngAcceptInputType_showFirstLastButtons: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n\n\n/**\n * Component to provide navigation between paged information. Displays the size of the current\n * page, user-selectable options to change that size, what items are being shown, and\n * navigational button to go to the previous or next page.\n */\n@Component({\n selector: 'mat-paginator',\n exportAs: 'matPaginator',\n templateUrl: 'paginator.html',\n styleUrls: ['paginator.css'],\n inputs: ['disabled'],\n host: {\n 'class': 'mat-paginator',\n 'role': 'group',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class MatPaginator extends _MatPaginatorBase<MatPaginatorDefaultOptions> {\n /** If set, styles the \"page size\" form field with the designated style. */\n _formFieldAppearance?: MatFormFieldAppearance;\n\n constructor(intl: MatPaginatorIntl,\n changeDetectorRef: ChangeDetectorRef,\n @Optional() @Inject(MAT_PAGINATOR_DEFAULT_OPTIONS) defaults?: MatPaginatorDefaultOptions) {\n super(intl, changeDetectorRef, defaults);\n\n if (defaults && defaults.formFieldAppearance != null) {\n this._formFieldAppearance = defaults.formFieldAppearance;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatSelectModule} from '@angular/material/select';\nimport {MatTooltipModule} from '@angular/material/tooltip';\nimport {MatPaginator} from './paginator';\nimport {MAT_PAGINATOR_INTL_PROVIDER} from './paginator-intl';\n\n\n@NgModule({\n imports: [\n CommonModule,\n MatButtonModule,\n MatSelectModule,\n MatTooltipModule,\n MatCommonModule,\n ],\n exports: [MatPaginator],\n declarations: [MatPaginator],\n providers: [MAT_PAGINATOR_INTL_PROVIDER],\n})\nexport class MatPaginatorModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './paginator-module';\nexport * from './paginator';\nexport * from './paginator-intl';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;;;AAYA;;;;MAKa,gBAAgB;IAD7B;;;;;QAMW,YAAO,GAAkB,IAAI,OAAO,EAAQ,CAAC;;QAGtD,sBAAiB,GAAW,iBAAiB,CAAC;;QAG9C,kBAAa,GAAW,WAAW,CAAC;;QAGpC,sBAAiB,GAAW,eAAe,CAAC;;QAG5C,mBAAc,GAAW,YAAY,CAAC;;QAGtC,kBAAa,GAAW,WAAW,CAAC;;QAGpC,kBAAa,GACX,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAc;YAC7C,IAAI,MAAM,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE;gBAAE,OAAO,QAAQ,MAAM,EAAE,CAAC;aAAE;YAE9D,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YAE7B,MAAM,UAAU,GAAG,IAAI,GAAG,QAAQ,CAAC;;YAGnC,MAAM,QAAQ,GAAG,UAAU,GAAG,MAAM;gBAChC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,QAAQ,EAAE,MAAM,CAAC;gBACvC,UAAU,GAAG,QAAQ,CAAC;YAE1B,OAAO,GAAG,UAAU,GAAG,CAAC,MAAM,QAAQ,OAAO,MAAM,EAAE,CAAC;SACvD,CAAA;KACJ;;;;YAvCA,UAAU,SAAC,EAAC,UAAU,EAAE,MAAM,EAAC;;AAyChC;SACgB,mCAAmC,CAAC,UAA4B;IAC9E,OAAO,UAAU,IAAI,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AI,QAAQ,IAAI,QAAQ,CAAC,mBAAmB,IAAI,IAAI,EAAE;YACpD,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;SAC1D;KACF;;;YAzBF,SAAS,SAAC;gBACT,QAAQ,EAAE,eAAe;gBACzB,QAAQ,EAAE,cAAc;gBACxB,uvHAA6B;gBAE7B,MAAM,EAAE,CAAC,UAAU,CAAC;gBACpB,IAAI,EAAE;oBACJ,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,OAAO;iBAChB;gBACD,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;;aACtC;;;YA7UO,gBAAgB;YAdtB,iBAAiB;4CAkWd,QAAQ,YAAI,MAAM,SAAC,6BAA6B;;;AClXrD;;;;;;;MA8Ba,kBAAkB;;;YAZ9B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,eAAe;oBACf,eAAe;oBACf,gBAAgB;oBAChB,eAAe;iBAChB;gBACD,OAAO,EAAE,CAAC,YAAY,CAAC;gBACvB,YAAY,EAAE,CAAC,YAAY,CAAC;gBAC5B,SAAS,EAAE,CAAC,2BAA2B,CAAC;aACzC;;;AC7BD;;;;;;;;ACAA;;;;;;"}
|
|
@@ -16,7 +16,7 @@ class MatCellHarness extends ContentContainerComponentHarness {
|
|
|
16
16
|
* @return a `HarnessPredicate` configured with the given options.
|
|
17
17
|
*/
|
|
18
18
|
static with(options = {}) {
|
|
19
|
-
return
|
|
19
|
+
return MatCellHarness._getCellPredicate(MatCellHarness, options);
|
|
20
20
|
}
|
|
21
21
|
/** Gets the cell's text. */
|
|
22
22
|
getText() {
|
|
@@ -39,6 +39,11 @@ class MatCellHarness extends ContentContainerComponentHarness {
|
|
|
39
39
|
throw Error('Could not determine column name of cell.');
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
+
static _getCellPredicate(type, options) {
|
|
43
|
+
return new HarnessPredicate(type, options)
|
|
44
|
+
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
45
|
+
.addOption('columnName', options.columnName, (harness, name) => HarnessPredicate.stringMatches(harness.getColumnName(), name));
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
/** The selector for the host element of a `MatCellHarness` instance. */
|
|
44
49
|
MatCellHarness.hostSelector = '.mat-cell';
|
|
@@ -51,7 +56,7 @@ class MatHeaderCellHarness extends MatCellHarness {
|
|
|
51
56
|
* @return a `HarnessPredicate` configured with the given options.
|
|
52
57
|
*/
|
|
53
58
|
static with(options = {}) {
|
|
54
|
-
return
|
|
59
|
+
return MatHeaderCellHarness._getCellPredicate(MatHeaderCellHarness, options);
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
/** The selector for the host element of a `MatHeaderCellHarness` instance. */
|
|
@@ -65,16 +70,11 @@ class MatFooterCellHarness extends MatCellHarness {
|
|
|
65
70
|
* @return a `HarnessPredicate` configured with the given options.
|
|
66
71
|
*/
|
|
67
72
|
static with(options = {}) {
|
|
68
|
-
return
|
|
73
|
+
return MatFooterCellHarness._getCellPredicate(MatFooterCellHarness, options);
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
/** The selector for the host element of a `MatFooterCellHarness` instance. */
|
|
72
77
|
MatFooterCellHarness.hostSelector = '.mat-footer-cell';
|
|
73
|
-
function getCellPredicate(type, options) {
|
|
74
|
-
return new HarnessPredicate(type, options)
|
|
75
|
-
.addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))
|
|
76
|
-
.addOption('columnName', options.columnName, (harness, name) => HarnessPredicate.stringMatches(harness.getColumnName(), name));
|
|
77
|
-
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* @license
|
|
@@ -83,39 +83,56 @@ function getCellPredicate(type, options) {
|
|
|
83
83
|
* Use of this source code is governed by an MIT-style license that can be
|
|
84
84
|
* found in the LICENSE file at https://angular.io/license
|
|
85
85
|
*/
|
|
86
|
-
|
|
87
|
-
class MatRowHarness extends ComponentHarness {
|
|
88
|
-
/**
|
|
89
|
-
* Gets a `HarnessPredicate` that can be used to search for a table row with specific attributes.
|
|
90
|
-
* @param options Options for narrowing the search
|
|
91
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
92
|
-
*/
|
|
93
|
-
static with(options = {}) {
|
|
94
|
-
return new HarnessPredicate(MatRowHarness, options);
|
|
95
|
-
}
|
|
86
|
+
class _MatRowHarnessBase extends ComponentHarness {
|
|
96
87
|
/** Gets a list of `MatCellHarness` for all cells in the row. */
|
|
97
88
|
getCells(filter = {}) {
|
|
98
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
return this.locatorForAll(
|
|
90
|
+
return this.locatorForAll(this._cellHarness.with(filter))();
|
|
100
91
|
});
|
|
101
92
|
}
|
|
102
93
|
/** Gets the text of the cells in the row. */
|
|
103
94
|
getCellTextByIndex(filter = {}) {
|
|
104
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
|
|
96
|
+
const cells = yield this.getCells(filter);
|
|
97
|
+
return parallel(() => cells.map(cell => cell.getText()));
|
|
106
98
|
});
|
|
107
99
|
}
|
|
108
100
|
/** Gets the text inside the row organized by columns. */
|
|
109
101
|
getCellTextByColumnName() {
|
|
110
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
|
|
103
|
+
const output = {};
|
|
104
|
+
const cells = yield this.getCells();
|
|
105
|
+
const cellsData = yield parallel(() => cells.map(cell => {
|
|
106
|
+
return parallel(() => [cell.getColumnName(), cell.getText()]);
|
|
107
|
+
}));
|
|
108
|
+
cellsData.forEach(([columnName, text]) => output[columnName] = text);
|
|
109
|
+
return output;
|
|
112
110
|
});
|
|
113
111
|
}
|
|
114
112
|
}
|
|
113
|
+
/** Harness for interacting with a standard Angular Material table row. */
|
|
114
|
+
class MatRowHarness extends _MatRowHarnessBase {
|
|
115
|
+
constructor() {
|
|
116
|
+
super(...arguments);
|
|
117
|
+
this._cellHarness = MatCellHarness;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Gets a `HarnessPredicate` that can be used to search for a table row with specific attributes.
|
|
121
|
+
* @param options Options for narrowing the search
|
|
122
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
123
|
+
*/
|
|
124
|
+
static with(options = {}) {
|
|
125
|
+
return new HarnessPredicate(MatRowHarness, options);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
115
128
|
/** The selector for the host element of a `MatRowHarness` instance. */
|
|
116
129
|
MatRowHarness.hostSelector = '.mat-row';
|
|
117
130
|
/** Harness for interacting with a standard Angular Material table header row. */
|
|
118
|
-
class MatHeaderRowHarness extends
|
|
131
|
+
class MatHeaderRowHarness extends _MatRowHarnessBase {
|
|
132
|
+
constructor() {
|
|
133
|
+
super(...arguments);
|
|
134
|
+
this._cellHarness = MatHeaderCellHarness;
|
|
135
|
+
}
|
|
119
136
|
/**
|
|
120
137
|
* Gets a `HarnessPredicate` that can be used to search for
|
|
121
138
|
* a table header row with specific attributes.
|
|
@@ -125,29 +142,15 @@ class MatHeaderRowHarness extends ComponentHarness {
|
|
|
125
142
|
static with(options = {}) {
|
|
126
143
|
return new HarnessPredicate(MatHeaderRowHarness, options);
|
|
127
144
|
}
|
|
128
|
-
/** Gets a list of `MatHeaderCellHarness` for all cells in the row. */
|
|
129
|
-
getCells(filter = {}) {
|
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
return this.locatorForAll(MatHeaderCellHarness.with(filter))();
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/** Gets the text of the cells in the header row. */
|
|
135
|
-
getCellTextByIndex(filter = {}) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
return getCellTextByIndex(this, filter);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/** Gets the text inside the header row organized by columns. */
|
|
141
|
-
getCellTextByColumnName() {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
return getCellTextByColumnName(this);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
145
|
}
|
|
147
146
|
/** The selector for the host element of a `MatHeaderRowHarness` instance. */
|
|
148
147
|
MatHeaderRowHarness.hostSelector = '.mat-header-row';
|
|
149
148
|
/** Harness for interacting with a standard Angular Material table footer row. */
|
|
150
|
-
class MatFooterRowHarness extends
|
|
149
|
+
class MatFooterRowHarness extends _MatRowHarnessBase {
|
|
150
|
+
constructor() {
|
|
151
|
+
super(...arguments);
|
|
152
|
+
this._cellHarness = MatFooterCellHarness;
|
|
153
|
+
}
|
|
151
154
|
/**
|
|
152
155
|
* Gets a `HarnessPredicate` that can be used to search for
|
|
153
156
|
* a table footer row cell with specific attributes.
|
|
@@ -157,44 +160,9 @@ class MatFooterRowHarness extends ComponentHarness {
|
|
|
157
160
|
static with(options = {}) {
|
|
158
161
|
return new HarnessPredicate(MatFooterRowHarness, options);
|
|
159
162
|
}
|
|
160
|
-
/** Gets a list of `MatFooterCellHarness` for all cells in the row. */
|
|
161
|
-
getCells(filter = {}) {
|
|
162
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
return this.locatorForAll(MatFooterCellHarness.with(filter))();
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
/** Gets the text of the cells in the footer row. */
|
|
167
|
-
getCellTextByIndex(filter = {}) {
|
|
168
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
return getCellTextByIndex(this, filter);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/** Gets the text inside the footer row organized by columns. */
|
|
173
|
-
getCellTextByColumnName() {
|
|
174
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
-
return getCellTextByColumnName(this);
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
163
|
}
|
|
179
164
|
/** The selector for the host element of a `MatFooterRowHarness` instance. */
|
|
180
165
|
MatFooterRowHarness.hostSelector = '.mat-footer-row';
|
|
181
|
-
function getCellTextByIndex(harness, filter) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
const cells = yield harness.getCells(filter);
|
|
184
|
-
return parallel(() => cells.map(cell => cell.getText()));
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function getCellTextByColumnName(harness) {
|
|
188
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
const output = {};
|
|
190
|
-
const cells = yield harness.getCells();
|
|
191
|
-
const cellsData = yield parallel(() => cells.map(cell => {
|
|
192
|
-
return parallel(() => [cell.getColumnName(), cell.getText()]);
|
|
193
|
-
}));
|
|
194
|
-
cellsData.forEach(([columnName, text]) => output[columnName] = text);
|
|
195
|
-
return output;
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
166
|
|
|
199
167
|
/**
|
|
200
168
|
* @license
|
|
@@ -203,32 +171,23 @@ function getCellTextByColumnName(harness) {
|
|
|
203
171
|
* Use of this source code is governed by an MIT-style license that can be
|
|
204
172
|
* found in the LICENSE file at https://angular.io/license
|
|
205
173
|
*/
|
|
206
|
-
|
|
207
|
-
class MatTableHarness extends ContentContainerComponentHarness {
|
|
208
|
-
/**
|
|
209
|
-
* Gets a `HarnessPredicate` that can be used to search for a table with specific attributes.
|
|
210
|
-
* @param options Options for narrowing the search
|
|
211
|
-
* @return a `HarnessPredicate` configured with the given options.
|
|
212
|
-
*/
|
|
213
|
-
static with(options = {}) {
|
|
214
|
-
return new HarnessPredicate(MatTableHarness, options);
|
|
215
|
-
}
|
|
174
|
+
class _MatTableHarnessBase extends ContentContainerComponentHarness {
|
|
216
175
|
/** Gets all of the header rows in a table. */
|
|
217
176
|
getHeaderRows(filter = {}) {
|
|
218
177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
-
return this.locatorForAll(
|
|
178
|
+
return this.locatorForAll(this._headerRowHarness.with(filter))();
|
|
220
179
|
});
|
|
221
180
|
}
|
|
222
181
|
/** Gets all of the regular data rows in a table. */
|
|
223
182
|
getRows(filter = {}) {
|
|
224
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
return this.locatorForAll(
|
|
184
|
+
return this.locatorForAll(this._rowHarness.with(filter))();
|
|
226
185
|
});
|
|
227
186
|
}
|
|
228
187
|
/** Gets all of the footer rows in a table. */
|
|
229
188
|
getFooterRows(filter = {}) {
|
|
230
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
return this.locatorForAll(
|
|
190
|
+
return this.locatorForAll(this._footerRowHarness.with(filter))();
|
|
232
191
|
});
|
|
233
192
|
}
|
|
234
193
|
/** Gets the text inside the entire table organized by rows. */
|
|
@@ -269,6 +228,23 @@ class MatTableHarness extends ContentContainerComponentHarness {
|
|
|
269
228
|
});
|
|
270
229
|
}
|
|
271
230
|
}
|
|
231
|
+
/** Harness for interacting with a standard mat-table in tests. */
|
|
232
|
+
class MatTableHarness extends _MatTableHarnessBase {
|
|
233
|
+
constructor() {
|
|
234
|
+
super(...arguments);
|
|
235
|
+
this._headerRowHarness = MatHeaderRowHarness;
|
|
236
|
+
this._rowHarness = MatRowHarness;
|
|
237
|
+
this._footerRowHarness = MatFooterRowHarness;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Gets a `HarnessPredicate` that can be used to search for a table with specific attributes.
|
|
241
|
+
* @param options Options for narrowing the search
|
|
242
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
243
|
+
*/
|
|
244
|
+
static with(options = {}) {
|
|
245
|
+
return new HarnessPredicate(MatTableHarness, options);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
272
248
|
/** The selector for the host element of a `MatTableHarness` instance. */
|
|
273
249
|
MatTableHarness.hostSelector = '.mat-table';
|
|
274
250
|
/** Extracts the text of cells only under a particular column. */
|
|
@@ -300,5 +276,5 @@ function getCellTextsByColumn(rowsData, column) {
|
|
|
300
276
|
* found in the LICENSE file at https://angular.io/license
|
|
301
277
|
*/
|
|
302
278
|
|
|
303
|
-
export { MatCellHarness, MatFooterCellHarness, MatFooterRowHarness, MatHeaderCellHarness, MatHeaderRowHarness, MatRowHarness, MatTableHarness };
|
|
279
|
+
export { MatCellHarness, MatFooterCellHarness, MatFooterRowHarness, MatHeaderCellHarness, MatHeaderRowHarness, MatRowHarness, MatTableHarness, _MatRowHarnessBase, _MatTableHarnessBase };
|
|
304
280
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table__testing.js","sources":["../../../../../../src/material/table/testing/cell-harness.ts","../../../../../../src/material/table/testing/row-harness.ts","../../../../../../src/material/table/testing/table-harness.ts","../../../../../../src/material/table/testing/public-api.ts","../../../../../../src/material/table/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n HarnessPredicate,\n ComponentHarnessConstructor,\n ContentContainerComponentHarness\n} from '@angular/cdk/testing';\nimport {CellHarnessFilters} from './table-harness-filters';\n\n/** Harness for interacting with a standard Angular Material table cell. */\nexport class MatCellHarness extends ContentContainerComponentHarness {\n /** The selector for the host element of a `MatCellHarness` instance. */\n static hostSelector = '.mat-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatCellHarness> {\n return getCellPredicate(MatCellHarness, options);\n }\n\n /** Gets the cell's text. */\n async getText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Gets the name of the column that the cell belongs to. */\n async getColumnName(): Promise<string> {\n const host = await this.host();\n const classAttribute = await host.getAttribute('class');\n\n if (classAttribute) {\n const prefix = 'mat-column-';\n const name = classAttribute.split(' ').map(c => c.trim()).find(c => c.startsWith(prefix));\n\n if (name) {\n return name.split(prefix)[1];\n }\n }\n\n throw Error('Could not determine column name of cell.');\n }\n}\n\n/** Harness for interacting with a standard Angular Material table header cell. */\nexport class MatHeaderCellHarness extends MatCellHarness {\n /** The selector for the host element of a `MatHeaderCellHarness` instance. */\n static hostSelector = '.mat-header-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table header cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatHeaderCellHarness> {\n return getCellPredicate(MatHeaderCellHarness, options);\n }\n}\n\n/** Harness for interacting with a standard Angular Material table footer cell. */\nexport class MatFooterCellHarness extends MatCellHarness {\n /** The selector for the host element of a `MatFooterCellHarness` instance. */\n static hostSelector = '.mat-footer-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table footer cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatFooterCellHarness> {\n return getCellPredicate(MatFooterCellHarness, options);\n }\n}\n\n\nfunction getCellPredicate<T extends MatCellHarness>(\n type: ComponentHarnessConstructor<T>,\n options: CellHarnessFilters): HarnessPredicate<T> {\n return new HarnessPredicate(type, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('columnName', options.columnName,\n (harness, name) => HarnessPredicate.stringMatches(harness.getColumnName(), name));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ComponentHarness, HarnessPredicate, parallel} from '@angular/cdk/testing';\nimport {RowHarnessFilters, CellHarnessFilters} from './table-harness-filters';\nimport {MatCellHarness, MatHeaderCellHarness, MatFooterCellHarness} from './cell-harness';\n\n/** Text extracted from a table row organized by columns. */\nexport interface MatRowHarnessColumnsText {\n [columnName: string]: string;\n}\n\n/** Harness for interacting with a standard Angular Material table row. */\nexport class MatRowHarness extends ComponentHarness {\n /** The selector for the host element of a `MatRowHarness` instance. */\n static hostSelector = '.mat-row';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table row with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatRowHarness> {\n return new HarnessPredicate(MatRowHarness, options);\n }\n\n /** Gets a list of `MatCellHarness` for all cells in the row. */\n async getCells(filter: CellHarnessFilters = {}): Promise<MatCellHarness[]> {\n return this.locatorForAll(MatCellHarness.with(filter))();\n }\n\n /** Gets the text of the cells in the row. */\n async getCellTextByIndex(filter: CellHarnessFilters = {}): Promise<string[]> {\n return getCellTextByIndex(this, filter);\n }\n\n /** Gets the text inside the row organized by columns. */\n async getCellTextByColumnName(): Promise<MatRowHarnessColumnsText> {\n return getCellTextByColumnName(this);\n }\n}\n\n/** Harness for interacting with a standard Angular Material table header row. */\nexport class MatHeaderRowHarness extends ComponentHarness {\n /** The selector for the host element of a `MatHeaderRowHarness` instance. */\n static hostSelector = '.mat-header-row';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table header row with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatHeaderRowHarness> {\n return new HarnessPredicate(MatHeaderRowHarness, options);\n }\n\n /** Gets a list of `MatHeaderCellHarness` for all cells in the row. */\n async getCells(filter: CellHarnessFilters = {}): Promise<MatHeaderCellHarness[]> {\n return this.locatorForAll(MatHeaderCellHarness.with(filter))();\n }\n\n /** Gets the text of the cells in the header row. */\n async getCellTextByIndex(filter: CellHarnessFilters = {}): Promise<string[]> {\n return getCellTextByIndex(this, filter);\n }\n\n /** Gets the text inside the header row organized by columns. */\n async getCellTextByColumnName(): Promise<MatRowHarnessColumnsText> {\n return getCellTextByColumnName(this);\n }\n}\n\n\n/** Harness for interacting with a standard Angular Material table footer row. */\nexport class MatFooterRowHarness extends ComponentHarness {\n /** The selector for the host element of a `MatFooterRowHarness` instance. */\n static hostSelector = '.mat-footer-row';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table footer row cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatFooterRowHarness> {\n return new HarnessPredicate(MatFooterRowHarness, options);\n }\n\n /** Gets a list of `MatFooterCellHarness` for all cells in the row. */\n async getCells(filter: CellHarnessFilters = {}): Promise<MatFooterCellHarness[]> {\n return this.locatorForAll(MatFooterCellHarness.with(filter))();\n }\n\n /** Gets the text of the cells in the footer row. */\n async getCellTextByIndex(filter: CellHarnessFilters = {}): Promise<string[]> {\n return getCellTextByIndex(this, filter);\n }\n\n /** Gets the text inside the footer row organized by columns. */\n async getCellTextByColumnName(): Promise<MatRowHarnessColumnsText> {\n return getCellTextByColumnName(this);\n }\n}\n\n\nasync function getCellTextByIndex(harness: {\n getCells: (filter?: CellHarnessFilters) => Promise<MatCellHarness[]>\n}, filter: CellHarnessFilters): Promise<string[]> {\n const cells = await harness.getCells(filter);\n return parallel(() => cells.map(cell => cell.getText()));\n}\n\nasync function getCellTextByColumnName(harness: {\n getCells: () => Promise<MatCellHarness[]>\n}): Promise<MatRowHarnessColumnsText> {\n const output: MatRowHarnessColumnsText = {};\n const cells = await harness.getCells();\n const cellsData = await parallel(() => cells.map(cell => {\n return parallel(() => [cell.getColumnName(), cell.getText()]);\n }));\n cellsData.forEach(([columnName, text]) => output[columnName] = text);\n return output;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ContentContainerComponentHarness, HarnessPredicate, parallel} from '@angular/cdk/testing';\nimport {TableHarnessFilters, RowHarnessFilters} from './table-harness-filters';\nimport {\n MatRowHarness,\n MatHeaderRowHarness,\n MatFooterRowHarness,\n MatRowHarnessColumnsText,\n} from './row-harness';\n\n/** Text extracted from a table organized by columns. */\nexport interface MatTableHarnessColumnsText {\n [columnName: string]: {\n text: string[];\n headerText: string[];\n footerText: string[];\n };\n}\n\n/** Harness for interacting with a standard mat-table in tests. */\nexport class MatTableHarness extends ContentContainerComponentHarness<string> {\n /** The selector for the host element of a `MatTableHarness` instance. */\n static hostSelector = '.mat-table';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TableHarnessFilters = {}): HarnessPredicate<MatTableHarness> {\n return new HarnessPredicate(MatTableHarness, options);\n }\n\n /** Gets all of the header rows in a table. */\n async getHeaderRows(filter: RowHarnessFilters = {}): Promise<MatHeaderRowHarness[]> {\n return this.locatorForAll(MatHeaderRowHarness.with(filter))();\n }\n\n /** Gets all of the regular data rows in a table. */\n async getRows(filter: RowHarnessFilters = {}): Promise<MatRowHarness[]> {\n return this.locatorForAll(MatRowHarness.with(filter))();\n }\n\n /** Gets all of the footer rows in a table. */\n async getFooterRows(filter: RowHarnessFilters = {}): Promise<MatFooterRowHarness[]> {\n return this.locatorForAll(MatFooterRowHarness.with(filter))();\n }\n\n /** Gets the text inside the entire table organized by rows. */\n async getCellTextByIndex(): Promise<string[][]> {\n const rows = await this.getRows();\n return parallel(() => rows.map(row => row.getCellTextByIndex()));\n }\n\n /** Gets the text inside the entire table organized by columns. */\n async getCellTextByColumnName(): Promise<MatTableHarnessColumnsText> {\n const [headerRows, footerRows, dataRows] = await parallel(() => [\n this.getHeaderRows(),\n this.getFooterRows(),\n this.getRows()\n ]);\n\n const text: MatTableHarnessColumnsText = {};\n const [headerData, footerData, rowsData] = await parallel(() => [\n parallel(() => headerRows.map(row => row.getCellTextByColumnName())),\n parallel(() => footerRows.map(row => row.getCellTextByColumnName())),\n parallel(() => dataRows.map(row => row.getCellTextByColumnName())),\n ]);\n\n rowsData.forEach(data => {\n Object.keys(data).forEach(columnName => {\n const cellText = data[columnName];\n\n if (!text[columnName]) {\n text[columnName] = {\n headerText: getCellTextsByColumn(headerData, columnName),\n footerText: getCellTextsByColumn(footerData, columnName),\n text: []\n };\n }\n\n text[columnName].text.push(cellText);\n });\n });\n\n return text;\n }\n}\n\n/** Extracts the text of cells only under a particular column. */\nfunction getCellTextsByColumn(rowsData: MatRowHarnessColumnsText[], column: string): string[] {\n const columnTexts: string[] = [];\n\n rowsData.forEach(data => {\n Object.keys(data).forEach(columnName => {\n if (columnName === column) {\n columnTexts.push(data[columnName]);\n }\n });\n });\n\n return columnTexts;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './table-harness';\nexport * from './row-harness';\nexport * from './cell-harness';\nexport * from './table-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAeA;MACa,cAAe,SAAQ,gCAAgC;;;;;;IASlE,OAAO,IAAI,CAAC,UAA8B,EAAE;QAC1C,OAAO,gBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;KAClD;;IAGK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;SACnC;KAAA;;IAGK,aAAa;;YACjB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAExD,IAAI,cAAc,EAAE;gBAClB,MAAM,MAAM,GAAG,aAAa,CAAC;gBAC7B,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC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C,UAAU;oBAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;oBAElC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;wBACrB,IAAI,CAAC,UAAU,CAAC,GAAG;4BACjB,UAAU,EAAE,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC;4BACxD,UAAU,EAAE,oBAAoB,CAAC,UAAU,EAAE,UAAU,CAAC;4BACxD,IAAI,EAAE,EAAE;yBACT,CAAC;qBACH;oBAED,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACtC,CAAC,CAAC;aACJ,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;SACb;KAAA;;AAjED;AACO,4BAAY,GAAG,YAAY,CAAC;AAmErC;AACA,SAAS,oBAAoB,CAAC,QAAoC,EAAE,MAAc;IAChF,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,QAAQ,CAAC,OAAO,CAAC,IAAI;QACnB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU;YAClC,IAAI,UAAU,KAAK,MAAM,EAAE;gBACzB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;aACpC;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB;;AC7GA;;;;;;;;ACAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"table__testing.js","sources":["../../../../../../src/material/table/testing/cell-harness.ts","../../../../../../src/material/table/testing/row-harness.ts","../../../../../../src/material/table/testing/table-harness.ts","../../../../../../src/material/table/testing/public-api.ts","../../../../../../src/material/table/testing/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n HarnessPredicate,\n ComponentHarnessConstructor,\n ContentContainerComponentHarness\n} from '@angular/cdk/testing';\nimport {CellHarnessFilters} from './table-harness-filters';\n\n/** Harness for interacting with a standard Angular Material table cell. */\nexport class MatCellHarness extends ContentContainerComponentHarness {\n /** The selector for the host element of a `MatCellHarness` instance. */\n static hostSelector = '.mat-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatCellHarness> {\n return MatCellHarness._getCellPredicate(MatCellHarness, options);\n }\n\n /** Gets the cell's text. */\n async getText(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Gets the name of the column that the cell belongs to. */\n async getColumnName(): Promise<string> {\n const host = await this.host();\n const classAttribute = await host.getAttribute('class');\n\n if (classAttribute) {\n const prefix = 'mat-column-';\n const name = classAttribute.split(' ').map(c => c.trim()).find(c => c.startsWith(prefix));\n\n if (name) {\n return name.split(prefix)[1];\n }\n }\n\n throw Error('Could not determine column name of cell.');\n }\n\n protected static _getCellPredicate<T extends MatCellHarness>(\n type: ComponentHarnessConstructor<T>,\n options: CellHarnessFilters): HarnessPredicate<T> {\n return new HarnessPredicate(type, options)\n .addOption('text', options.text,\n (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('columnName', options.columnName,\n (harness, name) => HarnessPredicate.stringMatches(harness.getColumnName(), name));\n }\n}\n\n/** Harness for interacting with a standard Angular Material table header cell. */\nexport class MatHeaderCellHarness extends MatCellHarness {\n /** The selector for the host element of a `MatHeaderCellHarness` instance. */\n static hostSelector = '.mat-header-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table header cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatHeaderCellHarness> {\n return MatHeaderCellHarness._getCellPredicate(MatHeaderCellHarness, options);\n }\n}\n\n/** Harness for interacting with a standard Angular Material table footer cell. */\nexport class MatFooterCellHarness extends MatCellHarness {\n /** The selector for the host element of a `MatFooterCellHarness` instance. */\n static hostSelector = '.mat-footer-cell';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table footer cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: CellHarnessFilters = {}): HarnessPredicate<MatFooterCellHarness> {\n return MatFooterCellHarness._getCellPredicate(MatFooterCellHarness, options);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n parallel,\n} from '@angular/cdk/testing';\nimport {RowHarnessFilters, CellHarnessFilters} from './table-harness-filters';\nimport {MatCellHarness, MatHeaderCellHarness, MatFooterCellHarness} from './cell-harness';\n\n/** Text extracted from a table row organized by columns. */\nexport interface MatRowHarnessColumnsText {\n [columnName: string]: string;\n}\n\nexport abstract class _MatRowHarnessBase<\n CellType extends (ComponentHarnessConstructor<Cell> & {\n with: (options?: CellHarnessFilters) => HarnessPredicate<Cell>}),\n Cell extends ComponentHarness & {getText(): Promise<string>, getColumnName(): Promise<string>}\n> extends ComponentHarness {\n protected abstract _cellHarness: CellType;\n\n /** Gets a list of `MatCellHarness` for all cells in the row. */\n async getCells(filter: CellHarnessFilters = {}): Promise<Cell[]> {\n return this.locatorForAll(this._cellHarness.with(filter))();\n }\n\n /** Gets the text of the cells in the row. */\n async getCellTextByIndex(filter: CellHarnessFilters = {}): Promise<string[]> {\n const cells = await this.getCells(filter);\n return parallel(() => cells.map(cell => cell.getText()));\n }\n\n /** Gets the text inside the row organized by columns. */\n async getCellTextByColumnName(): Promise<MatRowHarnessColumnsText> {\n const output: MatRowHarnessColumnsText = {};\n const cells = await this.getCells();\n const cellsData = await parallel(() => cells.map(cell => {\n return parallel(() => [cell.getColumnName(), cell.getText()]);\n }));\n cellsData.forEach(([columnName, text]) => output[columnName] = text);\n return output;\n }\n}\n\n/** Harness for interacting with a standard Angular Material table row. */\nexport class MatRowHarness extends _MatRowHarnessBase<typeof MatCellHarness, MatCellHarness> {\n /** The selector for the host element of a `MatRowHarness` instance. */\n static hostSelector = '.mat-row';\n protected _cellHarness = MatCellHarness;\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table row with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatRowHarness> {\n return new HarnessPredicate(MatRowHarness, options);\n }\n}\n\n/** Harness for interacting with a standard Angular Material table header row. */\nexport class MatHeaderRowHarness extends _MatRowHarnessBase<\n typeof MatHeaderCellHarness, MatHeaderCellHarness> {\n /** The selector for the host element of a `MatHeaderRowHarness` instance. */\n static hostSelector = '.mat-header-row';\n protected _cellHarness = MatHeaderCellHarness;\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table header row with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatHeaderRowHarness> {\n return new HarnessPredicate(MatHeaderRowHarness, options);\n }\n}\n\n\n/** Harness for interacting with a standard Angular Material table footer row. */\nexport class MatFooterRowHarness extends _MatRowHarnessBase<\n typeof MatFooterCellHarness, MatFooterCellHarness> {\n /** The selector for the host element of a `MatFooterRowHarness` instance. */\n static hostSelector = '.mat-footer-row';\n protected _cellHarness = MatFooterCellHarness;\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for\n * a table footer row cell with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: RowHarnessFilters = {}): HarnessPredicate<MatFooterRowHarness> {\n return new HarnessPredicate(MatFooterRowHarness, options);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n ContentContainerComponentHarness,\n HarnessPredicate,\n parallel,\n} from '@angular/cdk/testing';\nimport {TableHarnessFilters, RowHarnessFilters} from './table-harness-filters';\nimport {\n MatRowHarness,\n MatHeaderRowHarness,\n MatFooterRowHarness,\n MatRowHarnessColumnsText,\n} from './row-harness';\n\n/** Text extracted from a table organized by columns. */\nexport interface MatTableHarnessColumnsText {\n [columnName: string]: {\n text: string[];\n headerText: string[];\n footerText: string[];\n };\n}\n\ninterface RowBase extends ComponentHarness {\n getCellTextByColumnName(): Promise<MatRowHarnessColumnsText>;\n getCellTextByIndex(): Promise<string[]>;\n}\n\nexport abstract class _MatTableHarnessBase<\n HeaderRowType extends (ComponentHarnessConstructor<HeaderRow> & {\n with: (options?: RowHarnessFilters) => HarnessPredicate<HeaderRow>}),\n HeaderRow extends RowBase,\n RowType extends (ComponentHarnessConstructor<Row> & {\n with: (options?: RowHarnessFilters) => HarnessPredicate<Row>}),\n Row extends RowBase,\n FooterRowType extends (ComponentHarnessConstructor<FooterRow> & {\n with: (options?: RowHarnessFilters) => HarnessPredicate<FooterRow>}),\n FooterRow extends RowBase\n> extends ContentContainerComponentHarness<string> {\n protected abstract _headerRowHarness: HeaderRowType;\n protected abstract _rowHarness: RowType;\n protected abstract _footerRowHarness: FooterRowType;\n\n /** Gets all of the header rows in a table. */\n async getHeaderRows(filter: RowHarnessFilters = {}): Promise<HeaderRow[]> {\n return this.locatorForAll(this._headerRowHarness.with(filter))();\n }\n\n /** Gets all of the regular data rows in a table. */\n async getRows(filter: RowHarnessFilters = {}): Promise<Row[]> {\n return this.locatorForAll(this._rowHarness.with(filter))();\n }\n\n /** Gets all of the footer rows in a table. */\n async getFooterRows(filter: RowHarnessFilters = {}): Promise<FooterRow[]> {\n return this.locatorForAll(this._footerRowHarness.with(filter))();\n }\n\n /** Gets the text inside the entire table organized by rows. */\n async getCellTextByIndex(): Promise<string[][]> {\n const rows = await this.getRows();\n return parallel(() => rows.map(row => row.getCellTextByIndex()));\n }\n\n /** Gets the text inside the entire table organized by columns. */\n async getCellTextByColumnName(): Promise<MatTableHarnessColumnsText> {\n const [headerRows, footerRows, dataRows] = await parallel(() => [\n this.getHeaderRows(),\n this.getFooterRows(),\n this.getRows()\n ]);\n\n const text: MatTableHarnessColumnsText = {};\n const [headerData, footerData, rowsData] = await parallel(() => [\n parallel(() => headerRows.map(row => row.getCellTextByColumnName())),\n parallel(() => footerRows.map(row => row.getCellTextByColumnName())),\n parallel(() => dataRows.map(row => row.getCellTextByColumnName())),\n ]);\n\n rowsData.forEach(data => {\n Object.keys(data).forEach(columnName => {\n const cellText = data[columnName];\n\n if (!text[columnName]) {\n text[columnName] = {\n headerText: getCellTextsByColumn(headerData, columnName),\n footerText: getCellTextsByColumn(footerData, columnName),\n text: []\n };\n }\n\n text[columnName].text.push(cellText);\n });\n });\n\n return text;\n }\n}\n\n/** Harness for interacting with a standard mat-table in tests. */\nexport class MatTableHarness extends _MatTableHarnessBase<\n typeof MatHeaderRowHarness, MatHeaderRowHarness,\n typeof MatRowHarness, MatRowHarness,\n typeof MatFooterRowHarness, MatFooterRowHarness\n> {\n /** The selector for the host element of a `MatTableHarness` instance. */\n static hostSelector = '.mat-table';\n protected _headerRowHarness = MatHeaderRowHarness;\n protected _rowHarness = MatRowHarness;\n protected _footerRowHarness = MatFooterRowHarness;\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for a table with specific attributes.\n * @param options Options for narrowing the search\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with(options: TableHarnessFilters = {}): HarnessPredicate<MatTableHarness> {\n return new HarnessPredicate(MatTableHarness, options);\n }\n}\n\n/** Extracts the text of cells only under a particular column. */\nfunction getCellTextsByColumn(rowsData: MatRowHarnessColumnsText[], column: string): string[] {\n const columnTexts: string[] = [];\n\n rowsData.forEach(data => {\n Object.keys(data).forEach(columnName => {\n if (columnName === column) {\n columnTexts.push(data[columnName]);\n }\n });\n });\n\n return columnTexts;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './table-harness';\nexport * from './row-harness';\nexport * from './cell-harness';\nexport * from './table-harness-filters';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;AAeA;MACa,cAAe,SAAQ,gCAAgC;;;;;;IASlE,OAAO,IAAI,CAAC,UAA8B,EAAE;QAC1C,OAAO,cAAc,CAAC,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;KAClE;;IAGK,OAAO;;YACX,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC;SACnC;KAAA;;IAGK,aAAa;;YACjB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAExD,IAAI,cAAc,EAAE;gBAClB,MAAM,MAAM,GAAG,aAAa,CAAC;gBAC7B,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBAE1F,IAAI,IAAI,EAAE;oBACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9B;aACF;YAED,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAC;SACzD;KAAA;IAES,OAAO,iBAAiB,CAChC,IAAoC,EACpC,OAA2B;QAC3B,OAAO,IAAI,gBAAgB,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U,CAAC,CAAC,CAAC;aACpC;SACF,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC;AACrB;;AC/IA;;;;;;;;ACAA;;;;;;;;;;"}
|
package/fesm2015/tabs.js
CHANGED
|
@@ -599,6 +599,10 @@ class _MatTabGroupBase extends _MatTabGroupMixinBase {
|
|
|
599
599
|
const isFirstRun = this._selectedIndex == null;
|
|
600
600
|
if (!isFirstRun) {
|
|
601
601
|
this.selectedTabChange.emit(this._createChangeEvent(indexToSelect));
|
|
602
|
+
// Preserve the height so page doesn't scroll up during tab change.
|
|
603
|
+
// Fixes https://stackblitz.com/edit/mat-tabs-scroll-page-top-on-tab-change
|
|
604
|
+
const wrapper = this._tabBodyWrapper.nativeElement;
|
|
605
|
+
wrapper.style.minHeight = wrapper.clientHeight + 'px';
|
|
602
606
|
}
|
|
603
607
|
// Changing these values after change detection has run
|
|
604
608
|
// since the checked content may contain references to them.
|
|
@@ -606,6 +610,9 @@ class _MatTabGroupBase extends _MatTabGroupMixinBase {
|
|
|
606
610
|
this._tabs.forEach((tab, index) => tab.isActive = index === indexToSelect);
|
|
607
611
|
if (!isFirstRun) {
|
|
608
612
|
this.selectedIndexChange.emit(indexToSelect);
|
|
613
|
+
// Clear the min-height, this was needed during tab change to avoid
|
|
614
|
+
// unnecessary scrolling.
|
|
615
|
+
this._tabBodyWrapper.nativeElement.style.minHeight = '';
|
|
609
616
|
}
|
|
610
617
|
});
|
|
611
618
|
}
|
|
@@ -968,7 +975,7 @@ class MatPaginatedTabHeader {
|
|
|
968
975
|
});
|
|
969
976
|
}
|
|
970
977
|
ngAfterContentInit() {
|
|
971
|
-
const dirChange = this._dir ? this._dir.change : of(
|
|
978
|
+
const dirChange = this._dir ? this._dir.change : of('ltr');
|
|
972
979
|
const resize = this._viewportRuler.change(150);
|
|
973
980
|
const realign = () => {
|
|
974
981
|
this.updatePagination();
|