Skip to content

Commit 7c37240

Browse files
committed
Merge branch 'dev' of https://github.com/joaojmendes/sp-dev-fx-controls-react into joaojmendes-dev
2 parents 97818fc + 14254e7 commit 7c37240

21 files changed

+851
-1
lines changed
51.6 KB
Loading
55.3 KB
Loading
51.9 KB
Loading
50.1 KB
Loading
24.4 KB
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# List-Item-Attachments control
2+
3+
This control allows you to manage list item attachments, you can add or delete associated attachments, the attachments are listed in tile view.
4+
5+
6+
Here is an example of the control:
7+
8+
![ListItemAttachments Upload](../assets/ListItemAttachmentsUpload.png)
9+
10+
![ListItemAttachments Tiles](../assets/ListItemAttachmentsTitles.png)
11+
12+
![ListItemAttachments Confirm Delete](../assets/ListItemAttachmentDeleteConfirm.png)
13+
14+
![ListItemAttachments Attachment Deleted ](../assets/ListItemAttachementDeletedMsg.png)
15+
16+
## How to use this control in your solutions
17+
18+
- 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.
19+
- Import the control into your component:
20+
21+
```TypeScript
22+
23+
import { ListItemAttachments } from '@pnp/spfx-controls-react/listItemAttachments';
24+
```
25+
- Use the `ListItemAttachments` control in your code as follows:
26+
27+
```TypeScript
28+
<ListItemAttachments listId='dfa283f4-5faf-4d54-b6b8-5bcaf2725af5'
29+
itemId={1}
30+
context={this.props.context}
31+
disabled={false} />
32+
```
33+
34+
## Implementation
35+
36+
The `ListItemAttachments` control can be configured with the following properties:
37+
38+
39+
| Property | Type | Required | Description |
40+
| ---- | ---- | ---- | ---- |
41+
| context | WebPartContext \| ApplicationCustomizerContext | yes | SPFx web part or extention context |
42+
| itemId | number | yes | List Item Id |
43+
| listId | string | yes | Guid of the list. |
44+
| webUrl | string | no | URL of the site. By default it uses the current site URL. |
45+
| disabled | boolean | no | Specifies if the control is disabled or not. |
46+
47+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ListItemAttachments)

src/ListItemAttachments.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './controls/listItemAttachments';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface IListItemAttachmentFile{
2+
FileName : string;
3+
ServerRelativeUrl: string;
4+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { WebPartContext } from "@microsoft/sp-webpart-base";
2+
import { ApplicationCustomizerContext } from "@microsoft/sp-application-base";
3+
4+
export interface IListItemAttachmentsProps {
5+
listId: string;
6+
itemId: number;
7+
className?: string;
8+
webUrl?:string;
9+
disabled?: boolean;
10+
context: WebPartContext | ApplicationCustomizerContext;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {IListItemAttachmentFile } from './IListItemAttachmentFile';
2+
export interface IListItemAttachmentsState {
3+
file: IListItemAttachmentFile;
4+
hideDialog: boolean;
5+
dialogMessage: string;
6+
attachments: IListItemAttachmentFile[];
7+
deleteAttachment: boolean;
8+
disableButton: boolean;
9+
showPlaceHolder: boolean;
10+
fireUpload: boolean;
11+
}

0 commit comments

Comments
 (0)