You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This control allows to drag and drop files in pre defined areas.
4
+
5
+
## How to use this control in your solutions
6
+
7
+
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency.
- Use the DragDropFiles control in your code as follows:
15
+
16
+
```jsx
17
+
<DragDropFiles
18
+
dropEffect="copy"
19
+
enable={true}
20
+
onDrop={this._getDropFiles}
21
+
iconName="Upload"
22
+
labelMessage="My custom upload File"
23
+
>
24
+
{/* Specify the components to load where Drag and drop area should work */}
25
+
</DragDropFiles>
26
+
```
27
+
**Content with drag and drop applied**
28
+
29
+
```jsx
30
+
<DragDropFiles
31
+
dropEffect="copy"
32
+
enable={true}
33
+
onDrop={this._getDropFiles}
34
+
iconName="Upload"
35
+
labelMessage="My custom upload File"
36
+
>
37
+
Drag and drop here...
38
+
39
+
</DragDropFiles>
40
+
```
41
+

42
+
43
+
**ListView with drag and drop applied**
44
+
45
+

46
+
47
+
**FilePicker with drag and drop applied**
48
+
49
+

50
+
51
+
- With the `onDrop` handler you can define a method that returns files and files inside folders that where drag and drop by user.
52
+
53
+
**PS: New property "fullPath" was included in file object to allow identify dropped files based on Folders, this allow users to create associated folder path.**
54
+
55
+
```typescript
56
+
private_getDropFiles= (files) => {
57
+
for (var i =0; i<files.length; i++) {
58
+
console.log("Filename: "+files[i].name);
59
+
console.log("Path: "+files[i].fullPath);
60
+
}
61
+
}
62
+
```
63
+
64
+
## Implementation
65
+
66
+
The `DragDropFiles` can be configured with the following properties:
67
+
68
+
| Property | Type | Required | Description |
69
+
| ---- | ---- | ---- | ---- |
70
+
| dropEffect | string | no | Visual feedback given to user during a drag and drop operation (copy,move,link,none). Default value is `copy`. |
71
+
| enable | boolean | no | Option allow control to be enable or disable. Default value is `true`|
72
+
| labelMessage | string | no | Message displayed in drag drop preview. |
73
+
| onDrop | any | no | Method that returns all Files[] from drag and drop file area. |
74
+
| iconName | string | no | Icon Name from Office UI Fabric Icons. |
-[FieldCollectionData](./controls/FieldCollectionData) (control gives you the ability to insert a list / collection data which can be used in your web part / application customizer)
64
65
-[FilePicker](./controls/FilePicker) (control that allows to browse and select a file from various places)
0 commit comments