Skip to content

fix(cdk/table): remove private symbols from public API #30956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions goldens/cdk/table/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { ElementRef } from '@angular/core';
import { EventEmitter } from '@angular/core';
import * as i0 from '@angular/core';
import { InjectionToken } from '@angular/core';
import { Injector } from '@angular/core';
import { IterableChangeRecord } from '@angular/core';
import { IterableChanges } from '@angular/core';
import { IterableDiffer } from '@angular/core';
Expand Down Expand Up @@ -56,22 +55,12 @@ export abstract class BaseRowDef implements OnChanges {
static ɵfac: i0.ɵɵFactoryDeclaration<BaseRowDef, never>;
}

// @public
export interface CanStick {
hasStickyChanged(): boolean;
resetStickyChanged(): void;
sticky: boolean;
}

// @public
export const CDK_ROW_TEMPLATE = "<ng-container cdkCellOutlet></ng-container>";

// @public
export const CDK_TABLE: InjectionToken<any>;

// @public
export const CDK_TABLE_TEMPLATE = "\n <ng-content select=\"caption\"/>\n <ng-content select=\"colgroup, col\"/>\n\n <!--\n Unprojected content throws a hydration error so we need this to capture it.\n It gets removed on the client so it doesn't affect the layout.\n -->\n @if (_isServer) {\n <ng-content/>\n }\n\n @if (_isNativeHtmlTable) {\n <thead role=\"rowgroup\">\n <ng-container headerRowOutlet/>\n </thead>\n <tbody role=\"rowgroup\">\n <ng-container rowOutlet/>\n <ng-container noDataRowOutlet/>\n </tbody>\n <tfoot role=\"rowgroup\">\n <ng-container footerRowOutlet/>\n </tfoot>\n } @else {\n <ng-container headerRowOutlet/>\n <ng-container rowOutlet/>\n <ng-container noDataRowOutlet/>\n <ng-container footerRowOutlet/>\n }\n";

// @public
export class CdkCell extends BaseCdkCell {
constructor(...args: unknown[]);
Expand Down Expand Up @@ -525,15 +514,9 @@ export class _Schedule {
tasks: (() => unknown)[];
}

// @public
export const STICKY_DIRECTIONS: StickyDirection[];

// @public
export const STICKY_POSITIONING_LISTENER: InjectionToken<StickyPositioningListener>;

// @public
export type StickyDirection = 'top' | 'bottom' | 'left' | 'right';

// @public (undocumented)
export type StickyOffset = number | null | undefined;

Expand All @@ -548,24 +531,6 @@ export interface StickyPositioningListener {
// @public (undocumented)
export type StickySize = number | null | undefined;

// @public
export class StickyStyler {
constructor(_isNativeHtmlTable: boolean, _stickCellCss: string, direction: Direction, _coalescedStyleScheduler: _CoalescedStyleScheduler, _isBrowser?: boolean, _needsPositionStickyOnElement?: boolean, _positionListener?: StickyPositioningListener | undefined, _tableInjector?: Injector | undefined);
_addStickyStyle(element: HTMLElement, dir: StickyDirection, dirValue: number, isBorderElement: boolean): void;
clearStickyPositioning(rows: HTMLElement[], stickyDirections: StickyDirection[]): void;
destroy(): void;
// (undocumented)
direction: Direction;
_getCalculatedZIndex(element: HTMLElement): string;
_getCellWidths(row: HTMLElement, recalculateCellWidths?: boolean): number[];
_getStickyEndColumnPositions(widths: number[], stickyStates: boolean[]): number[];
_getStickyStartColumnPositions(widths: number[], stickyStates: boolean[]): number[];
_removeStickyStyle(element: HTMLElement, stickyDirections: StickyDirection[]): void;
stickRows(rowsToStick: HTMLElement[], stickyStates: boolean[], position: 'top' | 'bottom'): void;
updateStickyColumns(rows: HTMLElement[], stickyStartStates: boolean[], stickyEndStates: boolean[], recalculateCellWidths?: boolean, replay?: boolean): void;
updateStickyFooterContainer(tableElement: Element, stickyStates: boolean[]): void;
}

// @public (undocumented)
export interface StickyUpdate {
// (undocumented)
Expand Down
2 changes: 0 additions & 2 deletions src/cdk/table/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export * from './cell';
export * from './coalesced-style-scheduler';
export * from './row';
export * from './table-module';
export * from './sticky-styler';
export * from './sticky-position-listener';
export * from './can-stick';
export * from './text-column';
export * from './tokens';

Expand Down
70 changes: 30 additions & 40 deletions src/cdk/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,45 +184,6 @@ export class NoDataRowOutlet implements RowOutlet {
}
}

/**
* The table template that can be used by the mat-table. Should not be used outside of the
* material library.
* @docs-private
*/
export const CDK_TABLE_TEMPLATE =
// Note that according to MDN, the `caption` element has to be projected as the **first**
// element in the table. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
`
<ng-content select="caption"/>
<ng-content select="colgroup, col"/>

<!--
Unprojected content throws a hydration error so we need this to capture it.
It gets removed on the client so it doesn't affect the layout.
-->
@if (_isServer) {
<ng-content/>
}

@if (_isNativeHtmlTable) {
<thead role="rowgroup">
<ng-container headerRowOutlet/>
</thead>
<tbody role="rowgroup">
<ng-container rowOutlet/>
<ng-container noDataRowOutlet/>
</tbody>
<tfoot role="rowgroup">
<ng-container footerRowOutlet/>
</tfoot>
} @else {
<ng-container headerRowOutlet/>
<ng-container rowOutlet/>
<ng-container noDataRowOutlet/>
<ng-container footerRowOutlet/>
}
`;

/**
* Interface used to conveniently type the possible context interfaces for the render row.
* @docs-private
Expand Down Expand Up @@ -265,7 +226,36 @@ export interface RenderRow<T> {
@Component({
selector: 'cdk-table, table[cdk-table]',
exportAs: 'cdkTable',
template: CDK_TABLE_TEMPLATE,
template: `
<ng-content select="caption"/>
<ng-content select="colgroup, col"/>

<!--
Unprojected content throws a hydration error so we need this to capture it.
It gets removed on the client so it doesn't affect the layout.
-->
@if (_isServer) {
<ng-content/>
}

@if (_isNativeHtmlTable) {
<thead role="rowgroup">
<ng-container headerRowOutlet/>
</thead>
<tbody role="rowgroup">
<ng-container rowOutlet/>
<ng-container noDataRowOutlet/>
</tbody>
<tfoot role="rowgroup">
<ng-container footerRowOutlet/>
</tfoot>
} @else {
<ng-container headerRowOutlet/>
<ng-container rowOutlet/>
<ng-container noDataRowOutlet/>
<ng-container footerRowOutlet/>
}
`,
styleUrl: 'table.css',
host: {
'class': 'cdk-table',
Expand Down
1 change: 0 additions & 1 deletion src/material/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class MatRecycleRows {}
exportAs: 'matTable',
// Note that according to MDN, the `caption` element has to be projected as the **first**
// element in the table. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
// We can't reuse `CDK_TABLE_TEMPLATE` because it's incompatible with local compilation mode.
template: `
<ng-content select="caption"/>
<ng-content select="colgroup, col"/>
Expand Down
Loading