diff --git a/src/cdk/drag-drop/drag-drop.md b/src/cdk/drag-drop/drag-drop.md index b6f7a01c9364..34d912bb184e 100644 --- a/src/cdk/drag-drop/drag-drop.md +++ b/src/cdk/drag-drop/drag-drop.md @@ -1,281 +1 @@ -The `@angular/cdk/drag-drop` module provides you with a way to easily and declaratively create -drag-and-drop interfaces, with support for free dragging, sorting within a list, transferring items -between lists, animations, touch devices, custom drag handles, previews, and placeholders, -in addition to horizontal lists and locking along an axis. - -### Getting started -Start by importing `DragDropModule` into the `NgModule` where you want to use drag-and-drop -features. You can now add the `cdkDrag` directive to elements to make them draggable. When -outside of a `cdkDropList` element, draggable elements can be freely moved around the page. -You can add `cdkDropList` elements to constrain where elements may be dropped. - - - -### Reordering lists -Adding `cdkDropList` around a set of `cdkDrag` elements groups the draggables into a -reorderable collection. Items will automatically rearrange as an element moves. Note -that this will *not* update your data model; you can listen to the `cdkDropListDropped` event to -update the data model once the user finishes dragging. - - - -### Transferring items between lists -The `cdkDropList` directive supports transferring dragged items between connected drop zones. -You can connect one or more `cdkDropList` instances together by setting the `cdkDropListConnectedTo` -property or by wrapping the elements in an element with the `cdkDropListGroup` attribute. - - - -Note that `cdkDropListConnectedTo` works both with a direct reference to another `cdkDropList`, or -by referencing the `id` of another drop container: - -```html - -
-
- - -
-
-``` - -If you have an unknown number of connected drop lists, you can use the `cdkDropListGroup` directive -to set up the connection automatically. Note that any new `cdkDropList` that is added under a group -will be connected to all other lists automatically. - -```html -
- - @for (list of lists; track list) { -
- } -
-``` - - - -### Attaching data -You can associate some arbitrary data with both `cdkDrag` and `cdkDropList` by setting `cdkDragData` -or `cdkDropListData`, respectively. Events fired from both directives include this data, allowing -you to easily identify the origin of the drag or drop interaction. - -```html -@for (list of lists; track list) { -
- @for (item of list; track item) { -
- } -
-} -``` - -### Styling -The `cdkDrag` and `cdkDropList` directive include only those styles strictly necessary for -functionality. The application can then customize the elements by styling CSS classes added -by the directives: - -| Selector | Description | -|---------------------|--------------------------------------------------------------------------| -| `.cdk-drop-list` | Corresponds to the `cdkDropList` container. | -| `.cdk-drag` | Corresponds to a `cdkDrag` instance. | -| `.cdk-drag-disabled`| Class that is added to a disabled `cdkDrag`. | -| `.cdk-drag-handle` | Class that is added to the host element of the cdkDragHandle directive. | -| `.cdk-drag-preview` | This is the element that will be rendered next to the user's cursor as they're dragging an item in a sortable list. By default the element looks exactly like the element that is being dragged. | -| `.cdk-drag-placeholder` | This is element that will be shown instead of the real element as it's being dragged inside a `cdkDropList`. By default this will look exactly like the element that is being sorted. | -| `.cdk-drag-anchor` | Only relevant when `cdkDropListHasAnchor` is enabled. Element indicating the position from which the dragged item started the drag sequence. | -| `.cdk-drop-list-dragging` | A class that is added to `cdkDropList` while the user is dragging an item. | -| `.cdk-drop-list-disabled` | A class that is added to `cdkDropList` when it is disabled. | -| `.cdk-drop-list-receiving`| A class that is added to `cdkDropList` when it can receive an item that is being dragged inside a connected drop list. | - -### Animations -The drag-and-drop module supports animations both while sorting an element inside a list, as well as -animating it from the position that the user dropped it to its final place in the list. To set up -your animations, you have to define a `transition` that targets the `transform` property. The -following classes can be used for animations: - -* `.cdk-drag` - If you add a `transition` to this class, it'll animate as the user is sorting - through a list. -* `.cdk-drag-animating` - This class is added to a `cdkDrag` when the user has stopped dragging. - If you add a `transition` to it, the CDK will animate the element from its drop position to - the final position inside the `cdkDropList` container. - -Example animations: - -```css -/* Animate items as they're being sorted. */ -.cdk-drop-list-dragging .cdk-drag { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -/* Animate an item that has been dropped. */ -.cdk-drag-animating { - transition: transform 300ms cubic-bezier(0, 0, 0.2, 1); -} -``` - -### Customizing the drag area using a handle -By default, the user can drag the entire `cdkDrag` element to move it around. If you want to -restrict the user to only be able to do so using a handle element, you can do it by adding the -`cdkDragHandle` directive to an element inside of `cdkDrag`. Note that you can have as many -`cdkDragHandle` elements as you want: - - - -### Customizing the drag preview -When a `cdkDrag` element is picked up, it will create a preview element visible while dragging. -By default, this will be a clone of the original element positioned next to the user's cursor. -This preview can be customized, though, by providing a custom template via `*cdkDragPreview`. -Using the default configuration the custom preview won't match the size of the original dragged -element, because the CDK doesn't make assumptions about the element's content. If you want the -size to be matched, you can pass `true` to the `matchSize` input. - -Note that the cloned element will remove its `id` attribute in order to avoid having multiple -elements with the same `id` on the page. This will cause any CSS that targets that `id` not -to be applied. - - - -### Drag preview insertion point -By default, the preview of a `cdkDrag` will be inserted into the `` of the page in order to -avoid issues with `z-index` and `overflow: hidden`. This may not be desireable in some cases, -because the preview won't retain its inherited styles. You can control where the preview is inserted -using the `cdkDragPreviewContainer` input on `cdkDrag`. The possible values are: - -| Value | Description | Advantages | Disadvantages | -|-------------------|-------------------------|------------------------|---------------------------| -| `global` | Default value. Preview is inserted into the `` or the closest shadow root. | Preview won't be affected by `z-index` or `overflow: hidden`. It also won't affect `:nth-child` selectors and flex layouts. | Doesn't retain inherited styles. -| `parent` | Preview is inserted inside the parent of the item that is being dragged. | Preview inherits the same styles as the dragged item. | Preview may be clipped by `overflow: hidden` or be placed under other elements due to `z-index`. Furthermore, it can affect `:nth-child` selectors and some flex layouts. -| `ElementRef` or `HTMLElement` | Preview will be inserted into the specified element. | Preview inherits styles from the specified container element. | Preview may be clipped by `overflow: hidden` or be placed under other elements due to `z-index`. Furthermore, it can affect `:nth-child` selectors and some flex layouts. - - -### Customizing the drag placeholder -While a `cdkDrag` element is being dragged, the CDK will create a placeholder element that will -show where it will be placed when it's dropped. By default the placeholder is a clone of the element -that is being dragged, however you can replace it with a custom one using the `*cdkDragPlaceholder` -directive: - - - -### List orientation -The `cdkDropList` directive assumes that lists are vertical by default. This can be -changed by setting the `cdkDropListOrientation` property to `horizontal`. - - - -### List wrapping -By default the `cdkDropList` sorts the items by moving them around using a CSS `transform`. This -allows for the sorting to be animated which provides a better user experience, but comes with the -drawback that it works only one direction: vertically or horizontally. - -If you have a sortable list that needs to wrap, you can set `cdkDropListOrientation="mixed"` which -will use a different strategy of sorting the elements that works by moving them in the DOM. It has -the advantage of allowing the items to wrap to the next line, but it **cannot** animate the -sorting action. - - - -### Copying items from one list to another -When the user starts dragging an item in a sortable list, by default the `cdkDropList` directive -will render out a placeholder element to show where the item will be dropped. If the item is dragged -into another list, the placeholder will be moved into the new list together with the item. - -If your use case calls for the item to remain in the original list, you can set the -`cdkDropListHasAnchor` input which will tell the `cdkDropList` to create an "anchor" element. The -anchor differs from the placeholder in that it will stay in the original container and won't move -to any subsequent containers that the item is dragged into. If the user moves the item back into -the original container, the anchor will be removed automatically. It can be styled by targeting -the `cdk-drag-anchor` CSS class. - -Combining `cdkDropListHasAnchor` and `cdkDropListSortingDisabled` makes it possible to construct a -list that user copies items from, but doesn't necessarily transfer out of (e.g. a product list and -a shopping cart). - - - -### Restricting movement within an element - -If you want to stop the user from being able to drag a `cdkDrag` element outside of another element, -you can pass a CSS selector to the `cdkDragBoundary` attribute. The attribute works by accepting a -selector and looking up the DOM until it finds an element that matches it. If a match is found, -it'll be used as the boundary outside of which the element can't be dragged. `cdkDragBoundary` can -also be used when `cdkDrag` is placed inside a `cdkDropList`. - - - -### Restricting movement along an axis -By default, `cdkDrag` allows free movement in all directions. To restrict dragging to a -specific axis, you can set `cdkDragLockAxis` on `cdkDrag` or `cdkDropListLockAxis` on `cdkDropList` -to either `"x"` or `"y"`. - - - -### Alternate drag root element -If there's an element that you want to make draggable, but you don't have direct access to it, you -can use the `cdkDragRootElement` attribute. The attribute works by accepting a selector and looking -up the DOM until it finds an element that matches the selector. If an element is found, it'll become -the element that is moved as the user is dragging. This is useful for cases like making a dialog -draggable. - - - -### Controlling which items can be moved into a container -By default, all `cdkDrag` items from one container can be moved into another connected container. -If you want more fine-grained control over which items can be dropped, you can use the -`cdkDropListEnterPredicate` which will be called whenever an item is about to enter a -new container. Depending on whether the predicate returns `true` or `false`, the item may or may not -be allowed into the new container. - - - -### Disabled dragging -If you want to disable dragging for a particular drag item, you can do so by setting the -`cdkDragDisabled` input on a `cdkDrag` item. Furthermore, you can disable an entire list -using the `cdkDropListDisabled` input on a `cdkDropList` or a particular handle via -`cdkDragHandleDisabled` on `cdkDragHandle`. - - - -### Disabled sorting -There are cases where draggable items can be dragged out of one list into another, however -the user shouldn't be able to sort them within the source list. For these cases you can set the -`cdkDropListSortingDisabled` input which will prevent the items in a `cdkDropList` from sorting, -in addition to preserving the dragged item's initial position in the source list, if the user -decides to return the item. - - - -### Delayed dragging -By default as soon as the user puts their pointer down on a `cdkDrag`, the dragging sequence will -be started. This might not be desirable in cases like fullscreen draggable elements on touch -devices where the user might accidentally trigger a drag as they're scrolling the page. For -cases like these you can delay the dragging sequence using the `cdkDragStartDelay` input which -will wait for the user to hold down their pointer for the specified number of milliseconds before -moving the element. - - - -### Changing the standalone drag position -By default, standalone `cdkDrag` elements move from their normal DOM position only when manually -moved by a user. The element's position can be explicitly set, however, via the -`cdkDragFreeDragPosition` input. Applications commonly use this, for example, to restore a -draggable's position after a user has navigated away and then returned. - - - -### Controlling whether an item can be sorted into a particular index -`cdkDrag` items can be sorted into any position inside of a `cdkDropList` by default. You can change -this behavior by setting a `cdkDropListSortPredicate`. The predicate function will be called -whenever an item is about to be moved into a new index. If the predicate returns `true`, the -item will be moved into the new index, otherwise it will keep its current position. - - - -### Integrations with Angular Material -The CDK's drag&drop functionality can be integrated with different parts of Angular Material. - -#### Scrollable container -If your draggable items are inside a scrollable container (e.g., a div with overflow: auto) -automatic scrolling will not work unless the scrollable container has the `cdkScrollable` directive. -Without it, the CDK cannot detect or control the scroll behavior of the container during drag -operations. - +See the full documentation at https://angular.dev/guide/drag-drop. diff --git a/src/components-examples/cdk/drag-drop/BUILD.bazel b/src/components-examples/cdk/drag-drop/BUILD.bazel deleted file mode 100644 index aa9bd195dec6..000000000000 --- a/src/components-examples/cdk/drag-drop/BUILD.bazel +++ /dev/null @@ -1,30 +0,0 @@ -load("//tools:defaults.bzl", "ng_project") - -package(default_visibility = ["//visibility:public"]) - -ng_project( - name = "drag-drop", - srcs = glob(["**/*.ts"]), - assets = glob([ - "**/*.html", - "**/*.css", - ]), - deps = [ - "//:node_modules/@angular/core", - "//src/cdk/drag-drop", - "//src/cdk/overlay", - "//src/cdk/portal", - "//src/material/icon", - "//src/material/table", - "//src/material/tabs", - ], -) - -filegroup( - name = "source-files", - srcs = glob([ - "**/*.html", - "**/*.css", - "**/*.ts", - ]), -) diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.css deleted file mode 100644 index 2fff94ff117b..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.css +++ /dev/null @@ -1,27 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: inline-flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - margin-right: 25px; - position: relative; - z-index: 1; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - font-family: sans-serif; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.html deleted file mode 100644 index df4d2893efaa..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.html +++ /dev/null @@ -1,7 +0,0 @@ -
- I can only be dragged up/down -
- -
- I can only be dragged left/right -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.ts deleted file mode 100644 index d394981811e3..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop position locking - */ -@Component({ - selector: 'cdk-drag-drop-axis-lock-example', - templateUrl: 'cdk-drag-drop-axis-lock-example.html', - styleUrl: 'cdk-drag-drop-axis-lock-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropAxisLockExample {} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.css deleted file mode 100644 index 0489d9d0ec48..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.css +++ /dev/null @@ -1,36 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: inline-flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - margin-right: 25px; - position: relative; - z-index: 1; - box-sizing: border-box; - padding: 10px; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - font-family: sans-serif; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.example-boundary { - width: 400px; - height: 400px; - max-width: 100%; - border: dotted #ccc 2px; -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.html deleted file mode 100644 index 97f71478cd64..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.html +++ /dev/null @@ -1,6 +0,0 @@ -
-
- I can only be dragged within the dotted container -
-
- diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.ts deleted file mode 100644 index f62b2b32bf33..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-boundary/cdk-drag-drop-boundary-example.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop boundary - */ -@Component({ - selector: 'cdk-drag-drop-boundary-example', - templateUrl: 'cdk-drag-drop-boundary-example.html', - styleUrl: 'cdk-drag-drop-boundary-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropBoundaryExample {} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.css deleted file mode 100644 index af4470456b4a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-container { - width: 400px; - max-width: 100%; - margin: 0 25px 25px 0; - display: inline-block; - vertical-align: top; - font-family: sans-serif; -} - -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html deleted file mode 100644 index 327ae1f986d9..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.html +++ /dev/null @@ -1,29 +0,0 @@ -
-
-

To do

- -
- @for (item of todo; track item) { -
{{item}}
- } -
-
- -
-

Done

- -
- @for (item of done; track item) { -
{{item}}
- } -
-
-
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts deleted file mode 100644 index 9aeb2b63d310..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example.ts +++ /dev/null @@ -1,37 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDragDrop, - CdkDrag, - CdkDropList, - CdkDropListGroup, - moveItemInArray, - transferArrayItem, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop connected sorting group - */ -@Component({ - selector: 'cdk-drag-drop-connected-sorting-group-example', - templateUrl: 'cdk-drag-drop-connected-sorting-group-example.html', - styleUrl: 'cdk-drag-drop-connected-sorting-group-example.css', - imports: [CdkDropListGroup, CdkDropList, CdkDrag], -}) -export class CdkDragDropConnectedSortingGroupExample { - todo = ['Get to work', 'Pick up groceries', 'Go home', 'Fall asleep']; - - done = ['Get up', 'Brush teeth', 'Take a shower', 'Check e-mail', 'Walk dog']; - - drop(event: CdkDragDrop) { - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); - } else { - transferArrayItem( - event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex, - ); - } - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.css deleted file mode 100644 index af4470456b4a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-container { - width: 400px; - max-width: 100%; - margin: 0 25px 25px 0; - display: inline-block; - vertical-align: top; - font-family: sans-serif; -} - -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html deleted file mode 100644 index 44cd97cf460e..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.html +++ /dev/null @@ -1,32 +0,0 @@ -
-

To do

- -
- @for (item of todo; track item) { -
{{item}}
- } -
-
- -
-

Done

- -
- @for (item of done; track item) { -
{{item}}
- } -
-
- diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts deleted file mode 100644 index fe55e4916275..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDragDrop, - moveItemInArray, - transferArrayItem, - CdkDrag, - CdkDropList, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop connected sorting - */ -@Component({ - selector: 'cdk-drag-drop-connected-sorting-example', - templateUrl: 'cdk-drag-drop-connected-sorting-example.html', - styleUrl: 'cdk-drag-drop-connected-sorting-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropConnectedSortingExample { - todo = ['Get to work', 'Pick up groceries', 'Go home', 'Fall asleep']; - - done = ['Get up', 'Brush teeth', 'Take a shower', 'Check e-mail', 'Walk dog']; - - drop(event: CdkDragDrop) { - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); - } else { - transferArrayItem( - event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex, - ); - } - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.css deleted file mode 100644 index 69c23ec04896..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.css +++ /dev/null @@ -1,52 +0,0 @@ -.example-container { - width: 400px; - max-width: 100%; - margin: 0 25px 25px 0; - display: inline-block; - vertical-align: top; - font-family: sans-serif; -} - -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.html deleted file mode 100644 index c229537adcc8..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.html +++ /dev/null @@ -1,31 +0,0 @@ -
-

Products

- -
- @for (product of products; track $index) { -
{{product}}
- } -
-
- -
-

Shopping cart

- -
- @for (product of cart; track $index) { -
{{product}}
- } -
-
- diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.ts deleted file mode 100644 index ab979b7f4bf5..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDragDrop, - moveItemInArray, - copyArrayItem, - CdkDrag, - CdkDropList, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop copy between lists - */ -@Component({ - selector: 'cdk-drag-drop-copy-list-example', - templateUrl: 'cdk-drag-drop-copy-list-example.html', - styleUrl: 'cdk-drag-drop-copy-list-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropCopyListExample { - products = ['Bananas', 'Oranges', 'Bread', 'Butter', 'Soda', 'Eggs']; - cart = ['Tomatoes']; - - drop(event: CdkDragDrop) { - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); - } else { - copyArrayItem( - event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex, - ); - } - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.css deleted file mode 100644 index c8ae685d5f09..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.css +++ /dev/null @@ -1,53 +0,0 @@ -.example-list { - width: 500px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: block; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-custom-placeholder { - background: #ccc; - border: dotted 3px #999; - min-height: 60px; - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html deleted file mode 100644 index f0673cd2abe7..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.html +++ /dev/null @@ -1,8 +0,0 @@ -
- @for (movie of movies; track movie) { -
-
- {{movie}} -
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts deleted file mode 100644 index 22686b4a0daf..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example.ts +++ /dev/null @@ -1,35 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDrag, - CdkDragDrop, - CdkDragPlaceholder, - CdkDropList, - moveItemInArray, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop custom placeholder - */ -@Component({ - selector: 'cdk-drag-drop-custom-placeholder-example', - templateUrl: 'cdk-drag-drop-custom-placeholder-example.html', - styleUrl: 'cdk-drag-drop-custom-placeholder-example.css', - imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], -}) -export class CdkDragDropCustomPlaceholderExample { - movies = [ - 'Episode I - The Phantom Menace', - 'Episode II - Attack of the Clones', - 'Episode III - Revenge of the Sith', - 'Episode IV - A New Hope', - 'Episode V - The Empire Strikes Back', - 'Episode VI - Return of the Jedi', - 'Episode VII - The Force Awakens', - 'Episode VIII - The Last Jedi', - 'Episode IX - The Rise of Skywalker', - ]; - - drop(event: CdkDragDrop) { - moveItemInArray(this.movies, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.css deleted file mode 100644 index 62cc39f5cc89..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.css +++ /dev/null @@ -1,50 +0,0 @@ -.example-list { - width: 500px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: block; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html deleted file mode 100644 index 5072331e4076..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.html +++ /dev/null @@ -1,8 +0,0 @@ -
- @for (movie of movies; track movie) { -
- {{movie.title}} - -
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts deleted file mode 100644 index 889c9cf057d4..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example.ts +++ /dev/null @@ -1,69 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDragDrop, - CdkDropList, - CdkDragPreview, - CdkDrag, - moveItemInArray, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop custom preview - */ -@Component({ - selector: 'cdk-drag-drop-custom-preview-example', - templateUrl: 'cdk-drag-drop-custom-preview-example.html', - styleUrl: 'cdk-drag-drop-custom-preview-example.css', - imports: [CdkDropList, CdkDrag, CdkDragPreview], -}) -export class CdkDragDropCustomPreviewExample { - // tslint:disable:max-line-length - movies = [ - { - title: 'Episode I - The Phantom Menace', - poster: 'https://upload.wikimedia.org/wikipedia/en/4/40/Star_Wars_Phantom_Menace_poster.jpg', - }, - { - title: 'Episode II - Attack of the Clones', - poster: - 'https://upload.wikimedia.org/wikipedia/en/3/32/Star_Wars_-_Episode_II_Attack_of_the_Clones_%28movie_poster%29.jpg', - }, - { - title: 'Episode III - Revenge of the Sith', - poster: - 'https://upload.wikimedia.org/wikipedia/en/9/93/Star_Wars_Episode_III_Revenge_of_the_Sith_poster.jpg', - }, - { - title: 'Episode IV - A New Hope', - poster: 'https://upload.wikimedia.org/wikipedia/en/8/87/StarWarsMoviePoster1977.jpg', - }, - { - title: 'Episode V - The Empire Strikes Back', - poster: - 'https://upload.wikimedia.org/wikipedia/en/3/3f/The_Empire_Strikes_Back_%281980_film%29.jpg', - }, - { - title: 'Episode VI - Return of the Jedi', - poster: 'https://upload.wikimedia.org/wikipedia/en/b/b2/ReturnOfTheJediPoster1983.jpg', - }, - { - title: 'Episode VII - The Force Awakens', - poster: - 'https://upload.wikimedia.org/wikipedia/en/a/a2/Star_Wars_The_Force_Awakens_Theatrical_Poster.jpg', - }, - { - title: 'Episode VIII - The Last Jedi', - poster: 'https://upload.wikimedia.org/wikipedia/en/7/7f/Star_Wars_The_Last_Jedi.jpg', - }, - { - title: 'Episode IX – The Rise of Skywalker', - poster: - 'https://upload.wikimedia.org/wikipedia/en/a/af/Star_Wars_The_Rise_of_Skywalker_poster.jpg', - }, - ]; - // tslint:enable:max-line-length - - drop(event: CdkDragDrop<{title: string; poster: string}[]>) { - moveItemInArray(this.movies, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.css deleted file mode 100644 index bc7616b91eb7..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.css +++ /dev/null @@ -1,26 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - position: relative; - z-index: 1; - font-family: sans-serif; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.html deleted file mode 100644 index 0b008e296c97..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Dragging starts after one second -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.ts deleted file mode 100644 index 44298429e4e6..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-delay/cdk-drag-drop-delay-example.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Delayed dragging - */ -@Component({ - selector: 'cdk-drag-drop-delay-example', - templateUrl: 'cdk-drag-drop-delay-example.html', - styleUrl: 'cdk-drag-drop-delay-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropDelayExample {} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.css deleted file mode 100644 index af4470456b4a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-container { - width: 400px; - max-width: 100%; - margin: 0 25px 25px 0; - display: inline-block; - vertical-align: top; - font-family: sans-serif; -} - -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html deleted file mode 100644 index ee6b133d578b..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.html +++ /dev/null @@ -1,30 +0,0 @@ -
-
-

Available items

- -
- @for (item of items; track item) { -
{{item}}
- } -
-
- -
-

Shopping basket

- -
- @for (item of basket; track item) { -
{{item}}
- } -
-
-
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts deleted file mode 100644 index 90390b0c124c..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example.ts +++ /dev/null @@ -1,37 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDrag, - CdkDragDrop, - CdkDropList, - CdkDropListGroup, - moveItemInArray, - transferArrayItem, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop disabled sorting - */ -@Component({ - selector: 'cdk-drag-drop-disabled-sorting-example', - templateUrl: 'cdk-drag-drop-disabled-sorting-example.html', - styleUrl: 'cdk-drag-drop-disabled-sorting-example.css', - imports: [CdkDropListGroup, CdkDropList, CdkDrag], -}) -export class CdkDragDropDisabledSortingExample { - items = ['Carrots', 'Tomatoes', 'Onions', 'Apples', 'Avocados']; - - basket = ['Oranges', 'Bananas', 'Cucumbers']; - - drop(event: CdkDragDrop) { - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); - } else { - transferArrayItem( - event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex, - ); - } - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.css deleted file mode 100644 index aa61e07b1e13..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-list { - width: 500px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: block; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.example-box.cdk-drag-disabled { - background: #ccc; - cursor: not-allowed; - user-select: none; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html deleted file mode 100644 index 75c0f30f1624..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.html +++ /dev/null @@ -1,8 +0,0 @@ -
- @for (item of items; track item) { -
{{item.value}}
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts deleted file mode 100644 index c3882264464a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-disabled/cdk-drag-drop-disabled-example.ts +++ /dev/null @@ -1,23 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop disabled - */ -@Component({ - selector: 'cdk-drag-drop-disabled-example', - templateUrl: 'cdk-drag-drop-disabled-example.html', - styleUrl: 'cdk-drag-drop-disabled-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropDisabledExample { - items = [ - {value: 'I can be dragged', disabled: false}, - {value: 'I cannot be dragged', disabled: true}, - {value: 'I can also be dragged', disabled: false}, - ]; - - drop(event: CdkDragDrop) { - moveItemInArray(this.items, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.css deleted file mode 100644 index af4470456b4a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-container { - width: 400px; - max-width: 100%; - margin: 0 25px 25px 0; - display: inline-block; - vertical-align: top; - font-family: sans-serif; -} - -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html deleted file mode 100644 index 258fb3c5d8ce..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.html +++ /dev/null @@ -1,40 +0,0 @@ -
-

Available numbers

- -
- @for (number of all; track number) { -
{{number}}
- } -
-
- -
-

Even numbers

- -
- @for (number of even; track number) { -
{{number}}
- } -
-
- diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts deleted file mode 100644 index ddd09b8394e6..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example.ts +++ /dev/null @@ -1,45 +0,0 @@ -import {Component} from '@angular/core'; -import { - CdkDragDrop, - moveItemInArray, - transferArrayItem, - CdkDrag, - CdkDropList, -} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop enter predicate - */ -@Component({ - selector: 'cdk-drag-drop-enter-predicate-example', - templateUrl: 'cdk-drag-drop-enter-predicate-example.html', - styleUrl: 'cdk-drag-drop-enter-predicate-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropEnterPredicateExample { - all = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - even = [10]; - - drop(event: CdkDragDrop) { - if (event.previousContainer === event.container) { - moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); - } else { - transferArrayItem( - event.previousContainer.data, - event.container.data, - event.previousIndex, - event.currentIndex, - ); - } - } - - /** Predicate function that only allows even numbers to be dropped into a list. */ - evenPredicate(item: CdkDrag) { - return item.data % 2 === 0; - } - - /** Predicate function that doesn't allow items to be dropped into a list. */ - noReturnPredicate() { - return false; - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.css deleted file mode 100644 index bc7616b91eb7..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.css +++ /dev/null @@ -1,26 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - position: relative; - z-index: 1; - font-family: sans-serif; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.html deleted file mode 100644 index c51e3e5ce7a4..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.html +++ /dev/null @@ -1,7 +0,0 @@ -

- -

- -
- Drag me around -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.ts deleted file mode 100644 index 24a3b9a23d1c..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Programmatically setting the free drag position - */ -@Component({ - selector: 'cdk-drag-drop-free-drag-position-example', - templateUrl: 'cdk-drag-drop-free-drag-position-example.html', - styleUrl: 'cdk-drag-drop-free-drag-position-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropFreeDragPositionExample { - dragPosition = {x: 0, y: 0}; - - changePosition() { - this.dragPosition = {x: this.dragPosition.x + 50, y: this.dragPosition.y + 50}; - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.css deleted file mode 100644 index f99e4c193e4b..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.css +++ /dev/null @@ -1,40 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - padding: 10px; - box-sizing: border-box; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - position: relative; - z-index: 1; - font-family: sans-serif; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.example-handle { - position: absolute; - top: 10px; - right: 10px; - cursor: move; - width: 24px; - height: 24px; -} - -.example-handle svg { - color: #ccc; -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.html deleted file mode 100644 index 2d1798df80d1..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.html +++ /dev/null @@ -1,10 +0,0 @@ -
- I can only be dragged using the handle - -
- - - - -
-
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.ts deleted file mode 100644 index dc9cf146dd07..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-handle/cdk-drag-drop-handle-example.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag, CdkDragHandle} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop with a handle - */ -@Component({ - selector: 'cdk-drag-drop-handle-example', - templateUrl: 'cdk-drag-drop-handle-example.html', - styleUrl: 'cdk-drag-drop-handle-example.css', - imports: [CdkDrag, CdkDragHandle], -}) -export class CdkDragDropHandleExample {} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.css deleted file mode 100644 index a26a6ea87cfb..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.css +++ /dev/null @@ -1,53 +0,0 @@ -.example-list { - width: 1000px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: flex; - flex-direction: row; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-right: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - flex-grow: 1; - flex-basis: 0; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html deleted file mode 100644 index f476de2fa1a2..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.html +++ /dev/null @@ -1,5 +0,0 @@ -
- @for (timePeriod of timePeriods; track timePeriod) { -
{{timePeriod}}
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts deleted file mode 100644 index 38d0ef7f77fd..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop horizontal sorting - */ -@Component({ - selector: 'cdk-drag-drop-horizontal-sorting-example', - templateUrl: 'cdk-drag-drop-horizontal-sorting-example.html', - styleUrl: 'cdk-drag-drop-horizontal-sorting-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropHorizontalSortingExample { - timePeriods = [ - 'Bronze age', - 'Iron age', - 'Middle ages', - 'Early modern period', - 'Long nineteenth century', - ]; - - drop(event: CdkDragDrop) { - moveItemInArray(this.timePeriods, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.css deleted file mode 100644 index b1bf6ae2644f..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.css +++ /dev/null @@ -1,44 +0,0 @@ -.example-list { - display: flex; - flex-wrap: wrap; - width: 505px; - max-width: 100%; - gap: 15px; - padding: 15px; - border: solid 1px #ccc; - min-height: 60px; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border: solid 1px #ccc; - border-radius: 4px; - color: rgba(0, 0, 0, 0.87); - display: inline-block; - box-sizing: border-box; - cursor: move; - background: white; - text-align: center; - font-size: 14px; - min-width: 115px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.html deleted file mode 100644 index e081bbe4b11b..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.html +++ /dev/null @@ -1,5 +0,0 @@ -
- @for (item of items; track item) { -
{{item}}
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.ts deleted file mode 100644 index d1ddf8194df9..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, CdkDrag, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop horizontal wrapping list - */ -@Component({ - selector: 'cdk-drag-drop-mixed-sorting-example', - templateUrl: 'cdk-drag-drop-mixed-sorting-example.html', - styleUrl: 'cdk-drag-drop-mixed-sorting-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropMixedSortingExample { - items = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']; - - drop(event: CdkDragDrop) { - moveItemInArray(this.items, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.css deleted file mode 100644 index 65c3220c3cfe..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.css +++ /dev/null @@ -1,26 +0,0 @@ -.example-box { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: flex; - justify-content: center; - align-items: center; - text-align: center; - background: #fff; - border-radius: 4px; - position: relative; - z-index: 1; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - font-family: sans-serif; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-box:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.html deleted file mode 100644 index 39badfd5efb1..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.html +++ /dev/null @@ -1,3 +0,0 @@ -
- Drag me around -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.ts deleted file mode 100644 index ca0a08f0259a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-overview/cdk-drag-drop-overview-example.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Basic Drag&Drop - */ -@Component({ - selector: 'cdk-drag-drop-overview-example', - templateUrl: 'cdk-drag-drop-overview-example.html', - styleUrl: 'cdk-drag-drop-overview-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropOverviewExample {} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.css deleted file mode 100644 index 30d7e2d45c1f..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.css +++ /dev/null @@ -1,23 +0,0 @@ -.example-dialog-content { - width: 200px; - height: 200px; - border: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - cursor: move; - display: flex; - justify-content: center; - align-items: center; - background: #fff; - border-radius: 4px; - transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1); - font-family: sans-serif; - box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), - 0 2px 2px 0 rgba(0, 0, 0, 0.14), - 0 1px 5px 0 rgba(0, 0, 0, 0.12); -} - -.example-dialog-content:active { - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.html deleted file mode 100644 index 3ae7f503ad4a..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.html +++ /dev/null @@ -1,7 +0,0 @@ - - - -
- Drag the dialog around! -
-
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts deleted file mode 100644 index b5bcf8b2670f..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-root-element/cdk-drag-drop-root-element-example.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - Component, - ViewChild, - TemplateRef, - AfterViewInit, - ViewContainerRef, - OnDestroy, - inject, - Injector, -} from '@angular/core'; -import {createGlobalPositionStrategy, createOverlayRef, OverlayRef} from '@angular/cdk/overlay'; -import {TemplatePortal} from '@angular/cdk/portal'; -import {CdkDrag} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop with alternate root element - */ -@Component({ - selector: 'cdk-drag-drop-root-element-example', - templateUrl: 'cdk-drag-drop-root-element-example.html', - styleUrl: 'cdk-drag-drop-root-element-example.css', - imports: [CdkDrag], -}) -export class CdkDragDropRootElementExample implements AfterViewInit, OnDestroy { - private _injector = inject(Injector); - private _viewContainerRef = inject(ViewContainerRef); - - @ViewChild(TemplateRef) _dialogTemplate!: TemplateRef; - private _overlayRef!: OverlayRef; - private _portal!: TemplatePortal; - - ngAfterViewInit() { - this._portal = new TemplatePortal(this._dialogTemplate, this._viewContainerRef); - this._overlayRef = createOverlayRef(this._injector, { - positionStrategy: createGlobalPositionStrategy(this._injector) - .centerHorizontally() - .centerVertically(), - hasBackdrop: true, - }); - this._overlayRef.backdropClick().subscribe(() => this._overlayRef.detach()); - } - - ngOnDestroy() { - this._overlayRef.dispose(); - } - - openDialog() { - this._overlayRef.attach(this._portal); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.css deleted file mode 100644 index f429431be37b..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.css +++ /dev/null @@ -1,56 +0,0 @@ -.example-container { - height: 20rem; - overflow: auto; -} - -.example-list { - width: 500px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: block; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - border: none; - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.html deleted file mode 100644 index 1c35951951ac..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
- @for (elementName of elementNames; track elementName) { -
{{elementName}}
- } -
-
\ No newline at end of file diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.ts deleted file mode 100644 index 02712a7eac5e..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example.ts +++ /dev/null @@ -1,138 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; -import {CdkScrollable} from '@angular/cdk/scrolling'; - -/** - * @title Drag&Drop scrollable - */ -@Component({ - selector: 'cdk-drag-drop-scrollable-example', - templateUrl: 'cdk-drag-drop-scrollable-example.html', - styleUrl: 'cdk-drag-drop-scrollable-example.css', - imports: [CdkDropList, CdkDrag, CdkScrollable], -}) -export class CdkDragDropScrollableExample { - elementNames = [ - 'Hydrogen', - 'Helium', - 'Lithium', - 'Beryllium', - 'Boron', - 'Carbon', - 'Nitrogen', - 'Oxygen', - 'Fluorine', - 'Neon', - 'Sodium', - 'Magnesium', - 'Aluminum', - 'Silicon', - 'Phosphorus', - 'Sulfur', - 'Chlorine', - 'Argon', - 'Potassium', - 'Calcium', - 'Scandium', - 'Titanium', - 'Vanadium', - 'Chromium', - 'Manganese', - 'Iron', - 'Cobalt', - 'Nickel', - 'Copper', - 'Zinc', - 'Gallium', - 'Germanium', - 'Arsenic', - 'Selenium', - 'Bromine', - 'Krypton', - 'Rubidium', - 'Strontium', - 'Yttrium', - 'Zirconium', - 'Niobium', - 'Molybdenum', - 'Technetium', - 'Ruthenium', - 'Rhodium', - 'Palladium', - 'Silver', - 'Cadmium', - 'Indium', - 'Tin', - 'Antimony', - 'Tellurium', - 'Iodine', - 'Xenon', - 'Cesium', - 'Barium', - 'Lanthanum', - 'Cerium', - 'Praseodymium', - 'Neodymium', - 'Promethium', - 'Samarium', - 'Europium', - 'Gadolinium', - 'Terbium', - 'Dysprosium', - 'Holmium', - 'Erbium', - 'Thulium', - 'Ytterbium', - 'Lutetium', - 'Hafnium', - 'Tantalum', - 'Tungsten', - 'Rhenium', - 'Osmium', - 'Iridium', - 'Platinum', - 'Gold', - 'Mercury', - 'Thallium', - 'Lead', - 'Bismuth', - 'Polonium', - 'Astatine', - 'Radon', - 'Francium', - 'Radium', - 'Actinium', - 'Thorium', - 'Protactinium', - 'Uranium', - 'Neptunium', - 'Plutonium', - 'Americium', - 'Curium', - 'Berkelium', - 'Californium', - 'Einsteinium', - 'Fermium', - 'Mendelevium', - 'Nobelium', - 'Lawrencium', - 'Rutherfordium', - 'Dubnium', - 'Seaborgium', - 'Bohrium', - 'Hassium', - 'Meitnerium', - 'Darmstadtium', - 'Roentgenium', - 'Copernicium', - 'Nihonium', - 'Flerovium', - 'Moscovium', - 'Livermorium', - 'Tennessine', - 'Oganesson', - ]; - drop(event: CdkDragDrop) { - moveItemInArray(this.elementNames, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.css deleted file mode 100644 index 2adc2bddddbd..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.css +++ /dev/null @@ -1,50 +0,0 @@ -.example-list { - border: solid 1px #ccc; - min-height: 60px; - background: white; - border-radius: 4px; - overflow: hidden; - display: block; - width: 400px; - max-width: 100%; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html deleted file mode 100644 index 1e97c0c37e49..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.html +++ /dev/null @@ -1,12 +0,0 @@ -
- @for (number of numbers; track number) { -
{{number}}
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts deleted file mode 100644 index b3f56d380bdb..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, moveItemInArray, CdkDrag, CdkDropList} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop sort predicate - */ -@Component({ - selector: 'cdk-drag-drop-sort-predicate-example', - templateUrl: 'cdk-drag-drop-sort-predicate-example.html', - styleUrl: 'cdk-drag-drop-sort-predicate-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropSortPredicateExample { - numbers = [1, 2, 3, 4, 5, 6, 7, 8]; - - drop(event: CdkDragDrop) { - moveItemInArray(this.numbers, event.previousIndex, event.currentIndex); - } - - /** - * Predicate function that only allows even numbers to be - * sorted into even indices and odd numbers at odd indices. - */ - sortPredicate(index: number, item: CdkDrag) { - return (index + 1) % 2 === item.data % 2; - } -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.css b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.css deleted file mode 100644 index 7d15c22d18d9..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.css +++ /dev/null @@ -1,51 +0,0 @@ -.example-list { - width: 500px; - max-width: 100%; - border: solid 1px #ccc; - min-height: 60px; - display: block; - background: white; - border-radius: 4px; - overflow: hidden; - font-family: sans-serif; -} - -.example-box { - padding: 20px 10px; - border-bottom: solid 1px #ccc; - color: rgba(0, 0, 0, 0.87); - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - box-sizing: border-box; - cursor: move; - background: white; - font-size: 14px; - font-family: sans-serif; -} - -.cdk-drag-preview { - border: none; - box-sizing: border-box; - border-radius: 4px; - box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), - 0 8px 10px 1px rgba(0, 0, 0, 0.14), - 0 3px 14px 2px rgba(0, 0, 0, 0.12); -} - -.cdk-drag-placeholder { - opacity: 0; -} - -.cdk-drag-animating { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} - -.example-box:last-child { - border: none; -} - -.example-list.cdk-drop-list-dragging .example-box:not(.cdk-drag-placeholder) { - transition: transform 250ms cubic-bezier(0, 0, 0.2, 1); -} diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html deleted file mode 100644 index d240babbfc3d..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.html +++ /dev/null @@ -1,5 +0,0 @@ -
- @for (movie of movies; track movie) { -
{{movie}}
- } -
diff --git a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts b/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts deleted file mode 100644 index d5edd5382430..000000000000 --- a/src/components-examples/cdk/drag-drop/cdk-drag-drop-sorting/cdk-drag-drop-sorting-example.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {Component} from '@angular/core'; -import {CdkDragDrop, CdkDropList, CdkDrag, moveItemInArray} from '@angular/cdk/drag-drop'; - -/** - * @title Drag&Drop sorting - */ -@Component({ - selector: 'cdk-drag-drop-sorting-example', - templateUrl: 'cdk-drag-drop-sorting-example.html', - styleUrl: 'cdk-drag-drop-sorting-example.css', - imports: [CdkDropList, CdkDrag], -}) -export class CdkDragDropSortingExample { - movies = [ - 'Episode I - The Phantom Menace', - 'Episode II - Attack of the Clones', - 'Episode III - Revenge of the Sith', - 'Episode IV - A New Hope', - 'Episode V - The Empire Strikes Back', - 'Episode VI - Return of the Jedi', - 'Episode VII - The Force Awakens', - 'Episode VIII - The Last Jedi', - 'Episode IX – The Rise of Skywalker', - ]; - - drop(event: CdkDragDrop) { - moveItemInArray(this.movies, event.previousIndex, event.currentIndex); - } -} diff --git a/src/components-examples/cdk/drag-drop/index.ts b/src/components-examples/cdk/drag-drop/index.ts deleted file mode 100644 index 1544b6263759..000000000000 --- a/src/components-examples/cdk/drag-drop/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -export {CdkDragDropAxisLockExample} from './cdk-drag-drop-axis-lock/cdk-drag-drop-axis-lock-example'; -export {CdkDragDropBoundaryExample} from './cdk-drag-drop-boundary/cdk-drag-drop-boundary-example'; -export {CdkDragDropConnectedSortingGroupExample} from './cdk-drag-drop-connected-sorting-group/cdk-drag-drop-connected-sorting-group-example'; -export {CdkDragDropConnectedSortingExample} from './cdk-drag-drop-connected-sorting/cdk-drag-drop-connected-sorting-example'; -export {CdkDragDropCustomPlaceholderExample} from './cdk-drag-drop-custom-placeholder/cdk-drag-drop-custom-placeholder-example'; -export {CdkDragDropCustomPreviewExample} from './cdk-drag-drop-custom-preview/cdk-drag-drop-custom-preview-example'; -export {CdkDragDropDelayExample} from './cdk-drag-drop-delay/cdk-drag-drop-delay-example'; -export {CdkDragDropDisabledSortingExample} from './cdk-drag-drop-disabled-sorting/cdk-drag-drop-disabled-sorting-example'; -export {CdkDragDropDisabledExample} from './cdk-drag-drop-disabled/cdk-drag-drop-disabled-example'; -export {CdkDragDropEnterPredicateExample} from './cdk-drag-drop-enter-predicate/cdk-drag-drop-enter-predicate-example'; -export {CdkDragDropFreeDragPositionExample} from './cdk-drag-drop-free-drag-position/cdk-drag-drop-free-drag-position-example'; -export {CdkDragDropHandleExample} from './cdk-drag-drop-handle/cdk-drag-drop-handle-example'; -export {CdkDragDropHorizontalSortingExample} from './cdk-drag-drop-horizontal-sorting/cdk-drag-drop-horizontal-sorting-example'; -export {CdkDragDropOverviewExample} from './cdk-drag-drop-overview/cdk-drag-drop-overview-example'; -export {CdkDragDropRootElementExample} from './cdk-drag-drop-root-element/cdk-drag-drop-root-element-example'; -export {CdkDragDropSortingExample} from './cdk-drag-drop-sorting/cdk-drag-drop-sorting-example'; -export {CdkDragDropSortPredicateExample} from './cdk-drag-drop-sort-predicate/cdk-drag-drop-sort-predicate-example'; -export {CdkDragDropMixedSortingExample} from './cdk-drag-drop-mixed-sorting/cdk-drag-drop-mixed-sorting-example'; -export {CdkDragDropCopyListExample} from './cdk-drag-drop-copy-list/cdk-drag-drop-copy-list-example'; -export {CdkDragDropScrollableExample} from './cdk-drag-drop-scrollable/cdk-drag-drop-scrollable-example'; diff --git a/src/components-examples/config.bzl b/src/components-examples/config.bzl index c9b41c2e21a2..435e064c5cb3 100644 --- a/src/components-examples/config.bzl +++ b/src/components-examples/config.bzl @@ -49,7 +49,6 @@ ALL_EXAMPLES = [ "//src/components-examples/cdk/portal", "//src/components-examples/cdk/accordion", "//src/components-examples/cdk/platform", - "//src/components-examples/cdk/drag-drop", "//src/components-examples/cdk/clipboard", "//src/components-examples/cdk/a11y", "//src/components-examples/cdk/layout",