Skip to content

Commit 3b8f7f3

Browse files
authored
docs: move some drag&drop examples into separate packages (#32620)
The examples showing how to integrate drag&drop into the Material tabs and table aren't surfaced on adev. These changes move them out into the individual components instead.
1 parent 89bdf48 commit 3b8f7f3

16 files changed

Lines changed: 40 additions & 24 deletions

File tree

src/cdk/drag-drop/drag-drop.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,9 @@ item will be moved into the new index, otherwise it will keep its current positi
273273
### Integrations with Angular Material
274274
The CDK's drag&drop functionality can be integrated with different parts of Angular Material.
275275

276-
#### Sortable table
277-
This example shows how you can set up a table which supports re-ordering of tabs.
278-
<!-- example(cdk-drag-drop-table) -->
279-
280-
#### Sortable tabs
281-
Example of how to add sorting support to a `mat-tab-group`.
282-
<!-- example(cdk-drag-drop-tabs) -->
283-
284276
#### Scrollable container
285277
If your draggable items are inside a scrollable container (e.g., a div with overflow: auto)
286-
automatic scrolling will not work unless the scrollable container has the `cdkScrollable` directive.
287-
Without it, the CDK cannot detect or control the scroll behavior of the container during drag
278+
automatic scrolling will not work unless the scrollable container has the `cdkScrollable` directive.
279+
Without it, the CDK cannot detect or control the scroll behavior of the container during drag
288280
operations.
289281
<!-- example(cdk-drag-drop-scrollable) -->

src/components-examples/cdk/drag-drop/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export {CdkDragDropOverviewExample} from './cdk-drag-drop-overview/cdk-drag-drop
1515
export {CdkDragDropRootElementExample} from './cdk-drag-drop-root-element/cdk-drag-drop-root-element-example';
1616
export {CdkDragDropSortingExample} from './cdk-drag-drop-sorting/cdk-drag-drop-sorting-example';
1717
export {CdkDragDropSortPredicateExample} from './cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example';
18-
export {CdkDragDropTableExample} from './cdk-drag-drop-table/cdk-drag-drop-table-example';
1918
export {CdkDragDropMixedSortingExample} from './cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example';
20-
export {CdkDragDropTabsExample} from './cdk-drag-drop-tabs/cdk-drag-drop-tabs-example';
2119
export {CdkDragDropCopyListExample} from './cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example';
2220
export {CdkDragDropScrollableExample} from './cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example';

src/components-examples/material/table/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ export {TableDynamicObservableDataExample} from './table-dynamic-observable-data
3131
export {TableGeneratedColumnsExample} from './table-generated-columns/table-generated-columns-example';
3232
export {TableFlexLargeRowExample} from './table-flex-large-row/table-flex-large-row-example';
3333
export {TableVirtualScrollExample} from './table-virtual-scroll/table-virtual-scroll-example';
34+
export {TableDragDropExample} from './table-drag-drop/table-drag-drop-example';

src/components-examples/cdk/drag-drop/cdk-drag-drop-table/cdk-drag-drop-table-example.css renamed to src/components-examples/material/table/table-drag-drop/table-drag-drop-example.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ table {
1414
box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
1515
0 8px 10px 1px rgba(0, 0, 0, 0.14),
1616
0 3px 14px 2px rgba(0, 0, 0, 0.12);
17-
background-color: white;
17+
background-color: var(--mat-sys-surface);
1818
}
1919

2020
.cdk-drag-placeholder {

src/components-examples/cdk/drag-drop/cdk-drag-drop-table/cdk-drag-drop-table-example.html renamed to src/components-examples/material/table/table-drag-drop/table-drag-drop-example.html

File renamed without changes.

src/components-examples/cdk/drag-drop/cdk-drag-drop-table/cdk-drag-drop-table-example.ts renamed to src/components-examples/material/table/table-drag-drop/table-drag-drop-example.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ export const ELEMENT_DATA: PeriodicElement[] = [
2525
];
2626

2727
/**
28-
* @title Drag&Drop table
28+
* @title Table with drag&drop support
2929
*/
3030
@Component({
31-
selector: 'cdk-drag-drop-table-example',
32-
templateUrl: 'cdk-drag-drop-table-example.html',
33-
styleUrl: 'cdk-drag-drop-table-example.css',
31+
selector: 'table-drag-drop-example',
32+
templateUrl: 'table-drag-drop-example.html',
33+
styleUrl: 'table-drag-drop-example.css',
3434
imports: [CdkDropList, CdkDrag, MatTableModule, MatIconModule],
3535
})
36-
export class CdkDragDropTableExample {
36+
export class TableDragDropExample {
3737
@ViewChild('table', {static: true}) table!: MatTable<PeriodicElement>;
3838

3939
displayedColumns: string[] = ['position', 'name', 'weight', 'symbol', 'quantity'];
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
table {
22
width: 100%;
33
}
4+
5+
th.cdk-drag {
6+
cursor: move;
7+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ng_project(
1919
"//:node_modules/@angular/platform-browser",
2020
"//:node_modules/@types/jasmine",
2121
"//:node_modules/rxjs",
22+
"//src/cdk/drag-drop",
2223
"//src/cdk/testing",
2324
"//src/cdk/testing/testbed",
2425
"//src/material/button",

src/components-examples/material/tabs/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export {TabGroupPaginatedExample} from './tab-group-paginated/tab-group-paginate
1313
export {TabGroupPreserveContentExample} from './tab-group-preserve-content/tab-group-preserve-content-example';
1414
export {TabGroupStretchedExample} from './tab-group-stretched/tab-group-stretched-example';
1515
export {TabNavBarBasicExample} from './tab-nav-bar-basic/tab-nav-bar-basic-example';
16+
export {TabGroupDragDropExample} from './tab-group-drag-drop/tab-group-drag-drop-example';

src/components-examples/cdk/drag-drop/cdk-drag-drop-tabs/cdk-drag-drop-tabs-example.css renamed to src/components-examples/material/tabs/tab-group-drag-drop/tab-group-drag-drop-example.css

File renamed without changes.

0 commit comments

Comments
 (0)