@patternfly/react-drag-drop 6.0.0-alpha.71 → 6.0.0-alpha.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/cjs.tsbuildinfo +1 -1
- package/dist/esm/components/DragDrop/DragDropContainer.d.ts +41 -0
- package/dist/esm/components/DragDrop/DragDropContainer.d.ts.map +1 -0
- package/dist/esm/components/DragDrop/DragDropContainer.js +147 -0
- package/dist/esm/components/DragDrop/DragDropContainer.js.map +1 -0
- package/dist/esm/components/DragDrop/DragDropSort.d.ts +5 -11
- package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/DragDropSort.js +11 -59
- package/dist/esm/components/DragDrop/DragDropSort.js.map +1 -1
- package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js +2 -2
- package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.d.ts +15 -9
- package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.js +21 -4
- package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
- package/dist/esm/components/DragDrop/index.d.ts +2 -0
- package/dist/esm/components/DragDrop/index.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/index.js +2 -0
- package/dist/esm/components/DragDrop/index.js.map +1 -1
- package/dist/esm.tsbuildinfo +1 -1
- package/dist/js/components/DragDrop/DragDropContainer.d.ts +41 -0
- package/dist/js/components/DragDrop/DragDropContainer.d.ts.map +1 -0
- package/dist/js/components/DragDrop/DragDropContainer.js +151 -0
- package/dist/js/components/DragDrop/DragDropContainer.js.map +1 -0
- package/dist/js/components/DragDrop/DragDropSort.d.ts +5 -11
- package/dist/js/components/DragDrop/DragDropSort.d.ts.map +1 -1
- package/dist/js/components/DragDrop/DragDropSort.js +11 -59
- package/dist/js/components/DragDrop/DragDropSort.js.map +1 -1
- package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js +2 -2
- package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -1
- package/dist/js/components/DragDrop/Droppable.d.ts +15 -9
- package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/js/components/DragDrop/Droppable.js +21 -4
- package/dist/js/components/DragDrop/Droppable.js.map +1 -1
- package/dist/js/components/DragDrop/index.d.ts +2 -0
- package/dist/js/components/DragDrop/index.d.ts.map +1 -1
- package/dist/js/components/DragDrop/index.js +2 -0
- package/dist/js/components/DragDrop/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/DragDrop/DragDropContainer.tsx +305 -0
- package/src/components/DragDrop/DragDropSort.tsx +22 -137
- package/src/components/DragDrop/DraggableDualListSelectorListItem.tsx +2 -2
- package/src/components/DragDrop/Droppable.tsx +64 -15
- package/src/components/DragDrop/__tests__/DragDrop.test.tsx +5 -0
- package/src/components/DragDrop/examples/DataListDraggable.tsx +1 -0
- package/src/components/DragDrop/examples/DragDrop.md +8 -2
- package/src/components/DragDrop/examples/DragDropContainerBasic.tsx +45 -0
- package/src/components/DragDrop/examples/DragDropContainerDataList.tsx +75 -0
- package/src/components/DragDrop/examples/DragDropContainerDualListSelector.tsx +191 -0
- package/src/components/DragDrop/examples/DragDropDemos.md +25 -1
- package/src/components/DragDrop/index.ts +2 -0
- package/dist/esm/components/DragDrop/DroppableContext.d.ts +0 -6
- package/dist/esm/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DroppableContext.js +0 -6
- package/dist/esm/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/esm/next/components/DragDrop/DragButton.d.ts +0 -11
- package/dist/esm/next/components/DragDrop/DragButton.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/DragButton.js +0 -14
- package/dist/esm/next/components/DragDrop/DragButton.js.map +0 -1
- package/dist/esm/next/components/DragDrop/DragDropSort.d.ts +0 -35
- package/dist/esm/next/components/DragDrop/DragDropSort.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/DragDropSort.js +0 -73
- package/dist/esm/next/components/DragDrop/DragDropSort.js.map +0 -1
- package/dist/esm/next/components/DragDrop/Draggable.d.ts +0 -13
- package/dist/esm/next/components/DragDrop/Draggable.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/Draggable.js +0 -22
- package/dist/esm/next/components/DragDrop/Draggable.js.map +0 -1
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts +0 -15
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.js +0 -26
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.js.map +0 -1
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts +0 -23
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js +0 -37
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
- package/dist/esm/next/components/DragDrop/Droppable.d.ts +0 -16
- package/dist/esm/next/components/DragDrop/Droppable.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/Droppable.js +0 -11
- package/dist/esm/next/components/DragDrop/Droppable.js.map +0 -1
- package/dist/esm/next/components/DragDrop/DroppableContext.d.ts +0 -6
- package/dist/esm/next/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/DroppableContext.js +0 -6
- package/dist/esm/next/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/esm/next/components/DragDrop/index.d.ts +0 -2
- package/dist/esm/next/components/DragDrop/index.d.ts.map +0 -1
- package/dist/esm/next/components/DragDrop/index.js +0 -2
- package/dist/esm/next/components/DragDrop/index.js.map +0 -1
- package/dist/esm/next/components/index.d.ts +0 -2
- package/dist/esm/next/components/index.d.ts.map +0 -1
- package/dist/esm/next/components/index.js +0 -2
- package/dist/esm/next/components/index.js.map +0 -1
- package/dist/esm/next/index.d.ts +0 -2
- package/dist/esm/next/index.d.ts.map +0 -1
- package/dist/esm/next/index.js +0 -2
- package/dist/esm/next/index.js.map +0 -1
- package/dist/js/components/DragDrop/DroppableContext.d.ts +0 -6
- package/dist/js/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DroppableContext.js +0 -10
- package/dist/js/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/js/next/components/DragDrop/DragButton.d.ts +0 -11
- package/dist/js/next/components/DragDrop/DragButton.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/DragButton.js +0 -18
- package/dist/js/next/components/DragDrop/DragButton.js.map +0 -1
- package/dist/js/next/components/DragDrop/DragDropSort.d.ts +0 -35
- package/dist/js/next/components/DragDrop/DragDropSort.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/DragDropSort.js +0 -77
- package/dist/js/next/components/DragDrop/DragDropSort.js.map +0 -1
- package/dist/js/next/components/DragDrop/Draggable.d.ts +0 -13
- package/dist/js/next/components/DragDrop/Draggable.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/Draggable.js +0 -26
- package/dist/js/next/components/DragDrop/Draggable.js.map +0 -1
- package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts +0 -15
- package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/DraggableDataListItem.js +0 -30
- package/dist/js/next/components/DragDrop/DraggableDataListItem.js.map +0 -1
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts +0 -23
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js +0 -41
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
- package/dist/js/next/components/DragDrop/Droppable.d.ts +0 -16
- package/dist/js/next/components/DragDrop/Droppable.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/Droppable.js +0 -15
- package/dist/js/next/components/DragDrop/Droppable.js.map +0 -1
- package/dist/js/next/components/DragDrop/DroppableContext.d.ts +0 -6
- package/dist/js/next/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/DroppableContext.js +0 -10
- package/dist/js/next/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/js/next/components/DragDrop/index.d.ts +0 -2
- package/dist/js/next/components/DragDrop/index.d.ts.map +0 -1
- package/dist/js/next/components/DragDrop/index.js +0 -5
- package/dist/js/next/components/DragDrop/index.js.map +0 -1
- package/dist/js/next/components/index.d.ts +0 -2
- package/dist/js/next/components/index.d.ts.map +0 -1
- package/dist/js/next/components/index.js +0 -5
- package/dist/js/next/components/index.js.map +0 -1
- package/dist/js/next/index.d.ts +0 -2
- package/dist/js/next/index.d.ts.map +0 -1
- package/dist/js/next/index.js +0 -5
- package/dist/js/next/index.js.map +0 -1
- package/src/components/DragDrop/DroppableContext.ts +0 -6
- package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -19
- package/src/next/components/DragDrop/DragButton.tsx +0 -27
- package/src/next/components/DragDrop/DragDropSort.tsx +0 -186
- package/src/next/components/DragDrop/Draggable.tsx +0 -58
- package/src/next/components/DragDrop/DraggableDataListItem.tsx +0 -61
- package/src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx +0 -93
- package/src/next/components/DragDrop/Droppable.tsx +0 -27
- package/src/next/components/DragDrop/DroppableContext.ts +0 -6
- package/src/next/components/DragDrop/__tests__/DragDrop.test.tsx +0 -24
- package/src/next/components/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +0 -59
- package/src/next/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -20
- package/src/next/components/DragDrop/examples/DataListDraggable.tsx +0 -38
- package/src/next/components/DragDrop/examples/DragDrop.md +0 -32
- package/src/next/components/DragDrop/examples/DragDropDemos.md +0 -37
- package/src/next/components/DragDrop/examples/DualListSelectorDraggable.tsx +0 -150
- package/src/next/components/DragDrop/index.ts +0 -1
- package/src/next/components/index.ts +0 -1
- package/src/next/index.ts +0 -1
- /package/src/{next/components → components}/DragDrop/examples/BasicSorting.tsx +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Droppable as NewDroppable,
|
|
4
|
+
DraggableObject,
|
|
5
|
+
DragDropContainer,
|
|
6
|
+
DragDropContainerDragOverEvent,
|
|
7
|
+
DragDropContainerDragEndEvent,
|
|
8
|
+
DragDropContainerDragCancelEvent
|
|
9
|
+
} from '@patternfly/react-drag-drop';
|
|
10
|
+
|
|
11
|
+
export const DragDropContainerBasic: React.FunctionComponent = () => {
|
|
12
|
+
const [allItems, setAllItems] = React.useState<Record<string, DraggableObject[]>>({
|
|
13
|
+
container1: [
|
|
14
|
+
{ id: 'button-1', content: 'one' },
|
|
15
|
+
{ id: 'button-2', content: 'two' },
|
|
16
|
+
{ id: 'button-3', content: 'three' }
|
|
17
|
+
],
|
|
18
|
+
container2: [
|
|
19
|
+
{ id: 'button-4', content: 'four' },
|
|
20
|
+
{ id: 'button-5', content: 'five' },
|
|
21
|
+
{ id: 'button-6', content: 'six' }
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<DragDropContainer
|
|
27
|
+
items={allItems}
|
|
28
|
+
onDrop={(_event: DragDropContainerDragEndEvent, newItems: Record<string, DraggableObject[]>) => {
|
|
29
|
+
setAllItems(newItems);
|
|
30
|
+
}}
|
|
31
|
+
onContainerMove={(_event: DragDropContainerDragOverEvent, newItems: Record<string, DraggableObject[]>) => {
|
|
32
|
+
setAllItems(newItems);
|
|
33
|
+
}}
|
|
34
|
+
onCancel={(_event: DragDropContainerDragCancelEvent, prevItems: Record<string, DraggableObject[]>) => {
|
|
35
|
+
setAllItems(prevItems);
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<h1>group 1</h1>
|
|
39
|
+
<NewDroppable items={allItems.container1} id="container1" />
|
|
40
|
+
<br />
|
|
41
|
+
<h1>group 2</h1>
|
|
42
|
+
<NewDroppable items={allItems.container2} id="container2" />
|
|
43
|
+
</DragDropContainer>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
DataList,
|
|
4
|
+
DataListCell,
|
|
5
|
+
DataListCheck,
|
|
6
|
+
DataListControl,
|
|
7
|
+
DataListItemCells,
|
|
8
|
+
Grid,
|
|
9
|
+
GridItem
|
|
10
|
+
} from '@patternfly/react-core';
|
|
11
|
+
import { DragDropContainer, DraggableObject, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
12
|
+
|
|
13
|
+
const getItems = (from: number, count: number): DraggableObject[] =>
|
|
14
|
+
Array.from({ length: count }, (_, idx) => from + idx).map((idx) => ({
|
|
15
|
+
id: `data-list-item-${idx}`,
|
|
16
|
+
content: (
|
|
17
|
+
<>
|
|
18
|
+
<DataListControl>
|
|
19
|
+
<DataListCheck aria-labelledby={`item-${idx}`} name={`item-${idx}`} otherControls />
|
|
20
|
+
</DataListControl>
|
|
21
|
+
<DataListItemCells
|
|
22
|
+
dataListCells={[
|
|
23
|
+
<DataListCell key={`item-${idx}`}>
|
|
24
|
+
<span id={`item-${idx}`}>{`item-${idx}`}</span>
|
|
25
|
+
</DataListCell>
|
|
26
|
+
]}
|
|
27
|
+
/>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
export const DataListDraggable: React.FunctionComponent = (props) => {
|
|
33
|
+
const [items, setItems] = React.useState<Record<string, DraggableObject[]>>({
|
|
34
|
+
group1: getItems(0, 5),
|
|
35
|
+
group2: getItems(5, 5)
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<DragDropContainer
|
|
40
|
+
items={items}
|
|
41
|
+
onDrop={(_, newItems) => {
|
|
42
|
+
setItems(newItems);
|
|
43
|
+
}}
|
|
44
|
+
onContainerMove={(_, newItems) => {
|
|
45
|
+
setItems(newItems);
|
|
46
|
+
}}
|
|
47
|
+
onCancel={(_, prevItems) => {
|
|
48
|
+
setItems(prevItems);
|
|
49
|
+
}}
|
|
50
|
+
variant="DataList"
|
|
51
|
+
overlayProps={{ isCompact: true }}
|
|
52
|
+
>
|
|
53
|
+
<Grid hasGutter>
|
|
54
|
+
<GridItem span={6}>
|
|
55
|
+
<h1>group 1</h1>
|
|
56
|
+
<NewDroppable
|
|
57
|
+
id="group1"
|
|
58
|
+
items={items.group1}
|
|
59
|
+
variant="DataList"
|
|
60
|
+
wrapper={<DataList aria-label="draggable data list example" isCompact {...props} />}
|
|
61
|
+
/>
|
|
62
|
+
</GridItem>
|
|
63
|
+
<GridItem span={6}>
|
|
64
|
+
<h1>group 2</h1>
|
|
65
|
+
<NewDroppable
|
|
66
|
+
id="group2"
|
|
67
|
+
items={items.group2}
|
|
68
|
+
variant="DataList"
|
|
69
|
+
wrapper={<DataList aria-label="draggable data list example" isCompact {...props} />}
|
|
70
|
+
/>
|
|
71
|
+
</GridItem>
|
|
72
|
+
</Grid>
|
|
73
|
+
</DragDropContainer>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
DualListSelector,
|
|
4
|
+
DualListSelectorPane,
|
|
5
|
+
DualListSelectorList,
|
|
6
|
+
DualListSelectorControlsWrapper,
|
|
7
|
+
DualListSelectorControl
|
|
8
|
+
} from '@patternfly/react-core';
|
|
9
|
+
import { DragDropContainer, DraggableObject, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
10
|
+
|
|
11
|
+
import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
|
|
12
|
+
import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
|
|
13
|
+
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
|
|
14
|
+
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
15
|
+
|
|
16
|
+
export const DragDropContainerDualListSelector: React.FunctionComponent = () => {
|
|
17
|
+
const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = React.useState(false);
|
|
18
|
+
const [availableOptions, setAvailableOptions] = React.useState<DraggableObject[]>([
|
|
19
|
+
{ id: 'Apple', content: 'Apple', props: { key: 'Apple', isSelected: false } },
|
|
20
|
+
{ id: 'Banana', content: 'Banana', props: { key: 'Banana', isSelected: false } },
|
|
21
|
+
{ id: 'Pineapple', content: 'Pineapple', props: { key: 'Pineapple', isSelected: false } }
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const [chosenOptions, setChosenOptions] = React.useState<DraggableObject[]>([
|
|
25
|
+
{ id: 'Orange', content: 'Orange', props: { key: 'Orange', isSelected: false } },
|
|
26
|
+
{ id: 'Grape', content: 'Grape', props: { key: 'Grape', isSelected: false } },
|
|
27
|
+
{ id: 'Peach', content: 'Peach', props: { key: 'Peach', isSelected: false } },
|
|
28
|
+
{ id: 'Strawberry', content: 'Strawberry', props: { key: 'Strawberry', isSelected: false } }
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
const [allDraggableItems, setAllItems] = React.useState<Record<string, DraggableObject[]>>({
|
|
32
|
+
available: availableOptions.map((option, index) => ({
|
|
33
|
+
...option,
|
|
34
|
+
props: {
|
|
35
|
+
key: option.props.key,
|
|
36
|
+
isSelected: option.props.isSelected,
|
|
37
|
+
onOptionSelect: (e) => onOptionSelect(e, index, false)
|
|
38
|
+
}
|
|
39
|
+
})),
|
|
40
|
+
chosen: chosenOptions.map((option, index) => ({
|
|
41
|
+
...option,
|
|
42
|
+
props: {
|
|
43
|
+
key: option.props.key,
|
|
44
|
+
isSelected: option.props.isSelected,
|
|
45
|
+
onOptionSelect: (e) => onOptionSelect(e, index, true)
|
|
46
|
+
}
|
|
47
|
+
}))
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const handleDragOperation = (_event: any, items: Record<string, DraggableObject[]>) => {
|
|
51
|
+
setAvailableOptions(items.available);
|
|
52
|
+
setChosenOptions(items.chosen);
|
|
53
|
+
setAllItems(items);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
setAllItems({
|
|
58
|
+
available: availableOptions.map((option, index) => ({
|
|
59
|
+
...option,
|
|
60
|
+
props: {
|
|
61
|
+
key: option.props.key,
|
|
62
|
+
isSelected: option.props.isSelected,
|
|
63
|
+
onOptionSelect: (e) => onOptionSelect(e, index, false)
|
|
64
|
+
}
|
|
65
|
+
})),
|
|
66
|
+
chosen: chosenOptions.map((option, index) => ({
|
|
67
|
+
...option,
|
|
68
|
+
props: {
|
|
69
|
+
key: option.props.key,
|
|
70
|
+
isSelected: option.props.isSelected,
|
|
71
|
+
onOptionSelect: (e) => onOptionSelect(e, index, true)
|
|
72
|
+
}
|
|
73
|
+
}))
|
|
74
|
+
});
|
|
75
|
+
}, [availableOptions, chosenOptions]);
|
|
76
|
+
|
|
77
|
+
const moveSelected = (fromAvailable) => {
|
|
78
|
+
const sourceOptions = fromAvailable ? availableOptions : chosenOptions;
|
|
79
|
+
const destinationOptions = fromAvailable ? chosenOptions : availableOptions;
|
|
80
|
+
for (let i = 0; i < sourceOptions.length; i++) {
|
|
81
|
+
const option = sourceOptions[i];
|
|
82
|
+
if (option.props.isSelected) {
|
|
83
|
+
sourceOptions.splice(i, 1);
|
|
84
|
+
destinationOptions.push(option);
|
|
85
|
+
option.props.isSelected = false;
|
|
86
|
+
i--;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (fromAvailable) {
|
|
90
|
+
setAvailableOptions([...sourceOptions]);
|
|
91
|
+
setChosenOptions([...destinationOptions]);
|
|
92
|
+
} else {
|
|
93
|
+
setChosenOptions([...sourceOptions]);
|
|
94
|
+
setAvailableOptions([...destinationOptions]);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const moveAll = (fromAvailable) => {
|
|
99
|
+
if (fromAvailable) {
|
|
100
|
+
setChosenOptions([...availableOptions, ...chosenOptions]);
|
|
101
|
+
setAvailableOptions([]);
|
|
102
|
+
} else {
|
|
103
|
+
setAvailableOptions([...chosenOptions, ...availableOptions]);
|
|
104
|
+
setChosenOptions([]);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const onOptionSelect = (event, index, isChosen) => {
|
|
109
|
+
if (ignoreNextOptionSelect) {
|
|
110
|
+
setIgnoreNextOptionSelect(false);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (isChosen) {
|
|
114
|
+
const newChosen = [...chosenOptions];
|
|
115
|
+
newChosen[index].props.isSelected = !chosenOptions[index].props.isSelected;
|
|
116
|
+
setChosenOptions(newChosen);
|
|
117
|
+
} else {
|
|
118
|
+
const newAvailable = [...availableOptions];
|
|
119
|
+
newAvailable[index].props.isSelected = !availableOptions[index].props.isSelected;
|
|
120
|
+
setAvailableOptions(newAvailable);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<DragDropContainer
|
|
126
|
+
items={allDraggableItems}
|
|
127
|
+
onDrop={handleDragOperation}
|
|
128
|
+
onContainerMove={handleDragOperation}
|
|
129
|
+
onCancel={handleDragOperation}
|
|
130
|
+
variant="DualListSelectorList"
|
|
131
|
+
>
|
|
132
|
+
<DualListSelector>
|
|
133
|
+
<DualListSelectorPane
|
|
134
|
+
title="Available"
|
|
135
|
+
status={`${availableOptions.filter((x) => x.props.isSelected).length} of ${
|
|
136
|
+
availableOptions.length
|
|
137
|
+
} options selected`}
|
|
138
|
+
>
|
|
139
|
+
<NewDroppable
|
|
140
|
+
id="available"
|
|
141
|
+
items={allDraggableItems.available}
|
|
142
|
+
variant="DualListSelectorList"
|
|
143
|
+
wrapper={<DualListSelectorList />}
|
|
144
|
+
/>
|
|
145
|
+
</DualListSelectorPane>
|
|
146
|
+
<DualListSelectorControlsWrapper aria-label="Selector controls">
|
|
147
|
+
<DualListSelectorControl
|
|
148
|
+
isDisabled={!availableOptions.some((option) => option.props.isSelected)}
|
|
149
|
+
onClick={() => moveSelected(true)}
|
|
150
|
+
aria-label="Add selected"
|
|
151
|
+
>
|
|
152
|
+
<AngleRightIcon />
|
|
153
|
+
</DualListSelectorControl>
|
|
154
|
+
<DualListSelectorControl
|
|
155
|
+
isDisabled={availableOptions.length === 0}
|
|
156
|
+
onClick={() => moveAll(true)}
|
|
157
|
+
aria-label="Add all"
|
|
158
|
+
>
|
|
159
|
+
<AngleDoubleRightIcon />
|
|
160
|
+
</DualListSelectorControl>
|
|
161
|
+
<DualListSelectorControl
|
|
162
|
+
isDisabled={chosenOptions.length === 0}
|
|
163
|
+
onClick={() => moveAll(false)}
|
|
164
|
+
aria-label="Remove all"
|
|
165
|
+
>
|
|
166
|
+
<AngleDoubleLeftIcon />
|
|
167
|
+
</DualListSelectorControl>
|
|
168
|
+
<DualListSelectorControl
|
|
169
|
+
onClick={() => moveSelected(false)}
|
|
170
|
+
isDisabled={!chosenOptions.some((option) => option.props.isSelected)}
|
|
171
|
+
aria-label="Remove selected"
|
|
172
|
+
>
|
|
173
|
+
<AngleLeftIcon />
|
|
174
|
+
</DualListSelectorControl>
|
|
175
|
+
</DualListSelectorControlsWrapper>
|
|
176
|
+
<DualListSelectorPane
|
|
177
|
+
title="Chosen"
|
|
178
|
+
status={`${chosenOptions.filter((x) => x.props.isSelected).length} of ${chosenOptions.length} options selected`}
|
|
179
|
+
isChosen
|
|
180
|
+
>
|
|
181
|
+
<NewDroppable
|
|
182
|
+
id="chosen"
|
|
183
|
+
items={allDraggableItems.chosen}
|
|
184
|
+
variant="DualListSelectorList"
|
|
185
|
+
wrapper={<DualListSelectorList />}
|
|
186
|
+
/>
|
|
187
|
+
</DualListSelectorPane>
|
|
188
|
+
</DualListSelector>
|
|
189
|
+
</DragDropContainer>
|
|
190
|
+
);
|
|
191
|
+
};
|
|
@@ -14,7 +14,7 @@ import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-d
|
|
|
14
14
|
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
15
15
|
import PficonSortCommonAscIcon from '@patternfly/react-icons/dist/esm/icons/pficon-sort-common-asc-icon';
|
|
16
16
|
|
|
17
|
-
import { DragDropSort } from '@patternfly/react-drag-drop';
|
|
17
|
+
import { DragDropSort, DragDropContainer, Droppable as NewDroppable } from '@patternfly/react-drag-drop';
|
|
18
18
|
|
|
19
19
|
## Sorting demos
|
|
20
20
|
|
|
@@ -35,3 +35,27 @@ To enable reordering in a `<DualListSelector>` pane wrap the `<DualListSelectorL
|
|
|
35
35
|
```ts file="./DualListSelectorDraggable.tsx"
|
|
36
36
|
|
|
37
37
|
```
|
|
38
|
+
|
|
39
|
+
## Multiple drop zone demos
|
|
40
|
+
|
|
41
|
+
To enable multiple drop zones, wrap the component with `<DragDropContainer>`, place one or more `<Droppable>` components within the container, and define the `variant` property on all components. A collection of all draggable items should be passed to `<DragDropContainer>`, and each `<Droppable>` should be passed their respective draggable items.
|
|
42
|
+
|
|
43
|
+
`<Droppable>` will create the component's usual `children` internally based on the `items` property, so `children` should not be passed where the `<Droppable>` is defined.
|
|
44
|
+
|
|
45
|
+
To avoid a wrapping div inserted by `<Droppable>`, pass the desired container element to the `wrapper` property.
|
|
46
|
+
|
|
47
|
+
### Data list
|
|
48
|
+
|
|
49
|
+
To enable multiple drop zones with `<DataList>` components, place one or more `<Droppable>` within `<DragDropContainer>` and define the `variant` on all components as "DataList".
|
|
50
|
+
|
|
51
|
+
```ts file="./DragDropContainerDataList.tsx"
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Dual list selector
|
|
56
|
+
|
|
57
|
+
To enable multiple drop zones in a `<DualListSelector>`, wrap the `<DualListSelector>` component with `<DragDropContainer>`, and then include a `<Droppable>` component within each pane. Both `<DragDropContainer>` and `<Droppable>` should define the `variant` property as "DualListSelectorList".
|
|
58
|
+
|
|
59
|
+
```ts file="./DragDropContainerDualListSelector.tsx"
|
|
60
|
+
|
|
61
|
+
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DroppableContext.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DroppableContext.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC;IAClD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,oBAAoB;CAClC,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface DragButtonProps extends React.HTMLProps<HTMLButtonElement> {
|
|
3
|
-
/** Additional classes added to the drag button */
|
|
4
|
-
className?: string;
|
|
5
|
-
/** Sets button type */
|
|
6
|
-
type?: 'button' | 'submit' | 'reset';
|
|
7
|
-
/** Flag indicating if drag is disabled for the item */
|
|
8
|
-
isDisabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const DragButton: React.FunctionComponent<DragButtonProps>;
|
|
11
|
-
//# sourceMappingURL=DragButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACzE,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAU/D,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { css } from '@patternfly/react-styles';
|
|
4
|
-
import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list.mjs';
|
|
5
|
-
import buttonStyles from '@patternfly/react-styles/css/components/Button/button.mjs';
|
|
6
|
-
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
|
|
7
|
-
export const DragButton = (_a) => {
|
|
8
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
9
|
-
return (React.createElement("button", Object.assign({ className: css(className, buttonStyles.button, buttonStyles.modifiers.plain), "aria-label": "Drag button" }, props),
|
|
10
|
-
React.createElement("span", { className: css(dragButtonStyles.dataListItemDraggableIcon) },
|
|
11
|
-
React.createElement(GripVerticalIcon, null))));
|
|
12
|
-
};
|
|
13
|
-
DragButton.displayName = 'DragButton';
|
|
14
|
-
//# sourceMappingURL=DragButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragButton.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,gBAAgB,uEAAmE;AAC1F,OAAO,YAAY,kEAA8D;AACjF,OAAO,gBAAgB,MAAM,2DAA2D,CAAC;AAWzF,MAAM,CAAC,MAAM,UAAU,GAA6C,CAAC,EAAwC,EAAE,EAAE;QAA5C,EAAE,SAAS,OAA6B,EAAxB,KAAK,cAArB,aAAuB,CAAF;IAAwB,OAAA,CAChH,8CACE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,gBACjE,aAAa,IACpB,KAAK;QAET,8BAAM,SAAS,EAAE,GAAG,CAAC,gBAAgB,CAAC,yBAAyB,CAAC;YAC9D,oBAAC,gBAAgB,OAAG,CACf,CACA,CACV,CAAA;CAAA,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DndContextProps, DragEndEvent, DragStartEvent } from '@dnd-kit/core';
|
|
3
|
-
export type DragDropSortDragEndEvent = DragEndEvent;
|
|
4
|
-
export type DragDropSortDragStartEvent = DragStartEvent;
|
|
5
|
-
export interface DraggableObject {
|
|
6
|
-
/** Unique id of the draggable object */
|
|
7
|
-
id: string;
|
|
8
|
-
/** Content rendered in the draggable object */
|
|
9
|
-
content: React.ReactNode;
|
|
10
|
-
/** Props spread to the rendered wrapper of the draggable object */
|
|
11
|
-
props?: any;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* DragDropSortProps extends dnd-kit's props which may be viewed at https://docs.dndkit.com/api-documentation/context-provider#props.
|
|
15
|
-
*/
|
|
16
|
-
export interface DragDropSortProps extends DndContextProps {
|
|
17
|
-
/** Custom defined content wrapper for draggable items. By default, draggable items are wrapped in a styled div.
|
|
18
|
-
* Intended to be a 'DataList' or 'DualListSelectorList' without children. */
|
|
19
|
-
children?: React.ReactElement;
|
|
20
|
-
/** Sorted array of draggable objects */
|
|
21
|
-
items: DraggableObject[];
|
|
22
|
-
/** Callback when user drops a draggable object */
|
|
23
|
-
onDrop: (event: DragDropSortDragEndEvent, items: DraggableObject[], oldIndex?: number, newIndex?: number) => void;
|
|
24
|
-
/** Callback when use begins dragging a draggable object */
|
|
25
|
-
onDrag?: (event: DragDropSortDragStartEvent, oldIndex: number) => void;
|
|
26
|
-
/** The variant determines which component wraps the draggable object.
|
|
27
|
-
* Default and defaultWithHandle varaints wrap the draggable object in a div.
|
|
28
|
-
* DataList vairant wraps the draggable object in a DataListItem
|
|
29
|
-
* DualListSelectorList variant wraps the draggable objects in a DualListSelectorListItem and a div.pf-c-dual-list-selector__item-text element
|
|
30
|
-
* TableComposable variant wraps the draggable objects in TODO
|
|
31
|
-
* */
|
|
32
|
-
variant?: 'default' | 'defaultWithHandle' | 'DataList' | 'DualListSelectorList' | 'TableComposable';
|
|
33
|
-
}
|
|
34
|
-
export declare const DragDropSort: React.FunctionComponent<DragDropSortProps>;
|
|
35
|
-
//# sourceMappingURL=DragDropSort.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropSort.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,eAAe,EAKf,YAAY,EACZ,cAAc,EACf,MAAM,eAAe,CAAC;AAavB,MAAM,MAAM,wBAAwB,GAAG,YAAY,CAAC;AACpD,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,mEAAmE;IACnE,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;iFAC6E;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,wCAAwC;IACxC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,kDAAkD;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClH,2DAA2D;IAC3D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE;;;;;SAKK;IACL,OAAO,CAAC,EAAE,SAAS,GAAG,mBAAmB,GAAG,UAAU,GAAG,sBAAsB,GAAG,iBAAiB,CAAC;CACrG;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CA2HnE,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import * as ReactDOM from 'react-dom';
|
|
4
|
-
import { css } from '@patternfly/react-styles';
|
|
5
|
-
import { DndContext, closestCenter, DragOverlay, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
6
|
-
import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
7
|
-
import { Draggable } from './Draggable';
|
|
8
|
-
import { DraggableDataListItem } from './DraggableDataListItem';
|
|
9
|
-
import { DraggableDualListSelectorListItem } from './DraggableDualListSelectorListItem';
|
|
10
|
-
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
|
|
11
|
-
import { canUseDOM } from '@patternfly/react-core';
|
|
12
|
-
export const DragDropSort = (_a) => {
|
|
13
|
-
var { items, onDrop = () => { }, onDrag = () => { }, variant = 'default', children } = _a, props = __rest(_a, ["items", "onDrop", "onDrag", "variant", "children"]);
|
|
14
|
-
const [activeId, setActiveId] = React.useState(null);
|
|
15
|
-
const itemIds = React.useMemo(() => (items ? Array.from(items, (item) => item.id) : []), [items]);
|
|
16
|
-
const getItemById = (id) => items.find((item) => item.id === id);
|
|
17
|
-
const sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
18
|
-
coordinateGetter: sortableKeyboardCoordinates
|
|
19
|
-
}));
|
|
20
|
-
const handleDragEnd = (event) => {
|
|
21
|
-
const { active, over } = event;
|
|
22
|
-
const oldIndex = itemIds.indexOf(active.id);
|
|
23
|
-
const newIndex = itemIds.indexOf(over.id);
|
|
24
|
-
const newItems = arrayMove(items, oldIndex, newIndex);
|
|
25
|
-
onDrop(event, newItems, oldIndex, newIndex);
|
|
26
|
-
setActiveId(null);
|
|
27
|
-
};
|
|
28
|
-
const handleDragStart = (event) => {
|
|
29
|
-
setActiveId(event.active.id);
|
|
30
|
-
onDrag(event, itemIds.indexOf(event.active.id));
|
|
31
|
-
};
|
|
32
|
-
const getDragOverlay = () => {
|
|
33
|
-
if (!activeId) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const item = getItemById(activeId);
|
|
37
|
-
let content;
|
|
38
|
-
switch (variant) {
|
|
39
|
-
case 'DualListSelectorList':
|
|
40
|
-
content = (React.createElement(DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
41
|
-
break;
|
|
42
|
-
case 'DataList':
|
|
43
|
-
content = (React.createElement(DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
content = (React.createElement(Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
|
|
47
|
-
}
|
|
48
|
-
return (React.createElement("div", { className: css(styles.draggable, styles.modifiers.dragging), style: {
|
|
49
|
-
'--pf-v5-c-draggable--m-dragging--BackgroundColor': 'var(--pf-v5-global--BackgroundColor--100)'
|
|
50
|
-
} }, content));
|
|
51
|
-
};
|
|
52
|
-
const dragOverlay = React.createElement(DragOverlay, null, activeId && getDragOverlay());
|
|
53
|
-
const renderedChildren = (React.createElement(SortableContext, { items: itemIds, strategy: verticalListSortingStrategy, id: "droppable" },
|
|
54
|
-
items.map((item) => {
|
|
55
|
-
switch (variant) {
|
|
56
|
-
case 'DualListSelectorList':
|
|
57
|
-
return (React.createElement(DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
58
|
-
case 'DataList':
|
|
59
|
-
return (React.createElement(DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
60
|
-
default:
|
|
61
|
-
return (React.createElement(Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
canUseDOM ? ReactDOM.createPortal(dragOverlay, document.getElementById('root')) : dragOverlay));
|
|
65
|
-
return (React.createElement(DndContext, Object.assign({ sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, onDragStart: handleDragStart }, props),
|
|
66
|
-
children &&
|
|
67
|
-
React.cloneElement(children, {
|
|
68
|
-
children: renderedChildren
|
|
69
|
-
}),
|
|
70
|
-
!children && React.createElement("div", null, renderedChildren)));
|
|
71
|
-
};
|
|
72
|
-
DragDropSort.displayName = 'DragDropSort';
|
|
73
|
-
//# sourceMappingURL=DragDropSort.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropSort.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EAEX,cAAc,EACd,aAAa,EACb,SAAS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BACJ;oBACE,OAAO,CACL,oBAAC,SAAS,kBAAC,aAAa,EAAE,OAAO,KAAK,mBAAmB,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,IAAM,IAAI,CAAC,KAAK,GACjG,IAAI,CAAC,OAAO,CACH,CACb,CAAC;YACN,CAAC;QACH,CAAC,CAAC;QACD,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAC9E,CACnB,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,kBACT,OAAO,EAAE,OAAO,EAChB,kBAAkB,EAAE,aAAa,EACjC,SAAS,EAAE,aAAa,EACxB,WAAW,EAAE,eAAe,IACxB,KAAK;QAER,QAAQ;YACP,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE;gBAC3B,QAAQ,EAAE,gBAAgB;aAC3B,CAAC;QACH,CAAC,QAAQ,IAAI,iCAAM,gBAAgB,CAAO,CAChC,CACd,CAAC;AACJ,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface DraggableProps extends React.HTMLProps<HTMLDivElement> {
|
|
3
|
-
/** Content rendered inside DragDrop */
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
/** Class to add to outer div */
|
|
6
|
-
className?: string;
|
|
7
|
-
/** @hide Id of the sortable context. */
|
|
8
|
-
id?: string;
|
|
9
|
-
/** Flag indicating the draggable element should include a drag button. */
|
|
10
|
-
useDragButton?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const Draggable: React.FunctionComponent<DraggableProps>;
|
|
13
|
-
//# sourceMappingURL=Draggable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IACrE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAsC7D,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
4
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
5
|
-
import { css } from '@patternfly/react-styles';
|
|
6
|
-
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
|
|
7
|
-
import { DragButton } from './DragButton';
|
|
8
|
-
export const Draggable = (_a) => {
|
|
9
|
-
var { children, id, className, useDragButton = false } = _a, props = __rest(_a, ["children", "id", "className", "useDragButton"]);
|
|
10
|
-
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
11
|
-
id
|
|
12
|
-
});
|
|
13
|
-
const style = {
|
|
14
|
-
transform: CSS.Transform.toString(transform),
|
|
15
|
-
transition
|
|
16
|
-
};
|
|
17
|
-
return useDragButton ? (React.createElement("div", Object.assign({ className: css(isDragging && styles.droppable, isDragging && styles.modifiers.dragging, className), ref: setNodeRef, style: style }, props),
|
|
18
|
-
React.createElement(DragButton, Object.assign({}, attributes, listeners)),
|
|
19
|
-
children)) : (React.createElement("div", Object.assign({ className: css(isDragging && styles.droppable, isDragging && styles.modifiers.dragging, className), ref: setNodeRef, style: style }, listeners, attributes, props), children));
|
|
20
|
-
};
|
|
21
|
-
Draggable.displayName = 'Draggable';
|
|
22
|
-
//# sourceMappingURL=Draggable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,MAAM,uEAAmE;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,MAAM,CAAC,MAAM,SAAS,GAA4C,CAAC,EAMlD,EAAE,EAAE;QAN8C,EACjE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,aAAa,GAAG,KAAK,OAEN,EADZ,KAAK,cALyD,gDAMlE,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;QAC3F,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,OAAO,aAAa,CAAC,CAAC,CAAC,CACrB,2CACE,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,KAAK;QAET,oBAAC,UAAU,oBAAK,UAAU,EAAM,SAAS,EAAI;QAC5C,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,CACF,2CACE,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,SAAS,EACT,UAAU,EACV,KAAK,GAER,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface DraggableDataListItemObject {
|
|
3
|
-
id?: string;
|
|
4
|
-
content?: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export interface DraggableDataListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
7
|
-
/** Content rendered inside DragDrop */
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
/** Class to add to outer div */
|
|
10
|
-
className?: string;
|
|
11
|
-
/** @hide Id of the sortable context. */
|
|
12
|
-
id?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const DraggableDataListItem: React.FunctionComponent<DraggableDataListItemProps>;
|
|
15
|
-
//# sourceMappingURL=DraggableDataListItem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableDataListItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,2BAA2B;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAChF,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAoCrF,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
4
|
-
import { CSS } from '@dnd-kit/utilities';
|
|
5
|
-
import { css } from '@patternfly/react-styles';
|
|
6
|
-
import styles from '@patternfly/react-styles/css/components/DataList/data-list.mjs';
|
|
7
|
-
import dragStyles from '@patternfly/react-styles/css/components/DragDrop/drag-drop.mjs';
|
|
8
|
-
import { DragButton } from './DragButton';
|
|
9
|
-
import { DataListItemRow, DataListControl } from '@patternfly/react-core';
|
|
10
|
-
export const DraggableDataListItem = (_a) => {
|
|
11
|
-
var { children, id, className } = _a, props = __rest(_a, ["children", "id", "className"]);
|
|
12
|
-
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
13
|
-
id
|
|
14
|
-
});
|
|
15
|
-
const style = {
|
|
16
|
-
transform: CSS.Transform.toString(transform),
|
|
17
|
-
transition
|
|
18
|
-
};
|
|
19
|
-
return (React.createElement("li", Object.assign({ id: id, className: css(styles.dataListItem, isDragging && dragStyles.droppable, isDragging && dragStyles.modifiers.dragging, className) }, props, { ref: setNodeRef, style: style }),
|
|
20
|
-
React.createElement(DataListItemRow, null,
|
|
21
|
-
React.createElement(DataListControl, null,
|
|
22
|
-
React.createElement(DragButton, Object.assign({ className: css(styles.dataListItemDraggableButton) }, attributes, listeners))),
|
|
23
|
-
children)));
|
|
24
|
-
};
|
|
25
|
-
DraggableDataListItem.displayName = 'DraggableDataListItem';
|
|
26
|
-
//# sourceMappingURL=DraggableDataListItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"D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