-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #940 from pnp/v2-dev
Merge for 2.8.0
- Loading branch information
Showing
53 changed files
with
2,357 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Dynamic Form | ||
|
||
This control can dynamically generate SharePoint list or SharePoint document library form and everything controlled through list setting. | ||
|
||
## How to use this control in your solutions | ||
|
||
- 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. | ||
- Import the following modules to your component: | ||
|
||
```TypeScript | ||
import { DynamicForm } from "fx-controls-react/lib/DynamicForm"; | ||
``` | ||
|
||
- Use the DynamicForm control in your code as follows: | ||
|
||
```jsx | ||
<DynamicForm | ||
context={this.props.context} | ||
listId={"3071c058-549f-461d-9d73-8b9a52049a80"} | ||
listItemId={1}> | ||
onCancelled={() => { console.log('Cancelled') }} | ||
onBeforeSubmit={(async listItem) => { return true; }} | ||
onSubmitError={(listItem, error) => { alert(error.message); }} | ||
onSubmitted={async (listItemData) => { console.log(listItemData); }}> | ||
</DynamicForm> | ||
``` | ||
![DynamicForm](../assets/DynamicForm.png) | ||
|
||
## Implementation | ||
|
||
The `DynamicForm` can be configured with the following properties: | ||
|
||
| Property | Type | Required | Description | | ||
| ---- | ---- | ---- | ---- | | ||
| context | WebPartContext or ExtensionContext | yes | The context object of the SPFx loaded webpart or customizer. | | ||
| listId | string | yes | Guid of the list.| | ||
| listItemId | number | no | list item ID. | | ||
| contentTypeId | string | no | content type ID | | ||
| disabled | boolean | no | Option allow to be enable or disable. Default value is `false`| | ||
| onBeforeSubmit | (listItemData: any) => Promise<boolean> | no | Before submit handler. Allows to modify the object to be submitted or cancel the submission. | | ||
| onSubmitted | (listItem: any) => void | no | Method that returns listItem data JSON object. | | ||
| onSubmitError | (listItemData: any, error: Error) => void | no | Handler of submission error. | | ||
| onCancelled | () => void | no | Handler when form has been cancelled. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Location Picker | ||
|
||
|
||
|
||
This control allows you to search and select the Location, also allows enter a custom location. | ||
|
||
|
||
## How to use this control in your solutions | ||
|
||
|
||
|
||
- 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. | ||
|
||
- Import the following modules to your component: | ||
|
||
|
||
|
||
```TypeScript | ||
|
||
import { LocationPicker,ILocationPickerItem } from "fx-controls-react/lib/LocationPicker"; | ||
|
||
``` | ||
|
||
|
||
|
||
- Use the LocationPicker control in your code as follows: | ||
|
||
|
||
|
||
```jsx | ||
|
||
<LocationPicker | ||
context={this.props.context} | ||
label="Location" | ||
onSelectionChanged={(locValue: ILocationPickerItem) => { | ||
console.log(locValue.DisplayName + ", " + locValue.Address.Street) | ||
} | ||
}/> | ||
|
||
|
||
``` | ||
|
||
| *Location searching mode* | | ||
|:--:| | ||
|![Location Picker search](../assets/location1.png)| | ||
|
||
| *Entering into edit mode* | | ||
|:--:| | ||
|![Location Picker Edit](../assets/location2.png)| | ||
|
||
| *Readonly mode* | | ||
|:--:| | ||
|![Location Picker Read](../assets/location3.png)| | ||
|
||
|
||
|
||
## Implementation | ||
|
||
|
||
|
||
The `LocationPicker` can be configured with the following properties: | ||
|
||
|
||
|
||
| Property | Type | Required | Description | | ||
| ---- | ---- | ---- | ---- | | ||
| context | WebPartContext or ExtensionContext | yes | The context object of the SPFx loaded webpart or customizer. | | ||
| disabled | boolean | no | Option allows to be enable or disable. Default value is `false`| | ||
| defaultValue | ILocationPickerItem | no | Option allows set default value| | ||
| errorMessage | string | no | Static error message displayed below the picker.| | ||
| className | string | no | Applies custom styling | | ||
| label | string | no | Label to use for the control. | | ||
| placeholder | string | no | Placeholder label to show in the dropdown. | | ||
| onChange | (locItem: ILocationPickerItem) => void | no | The method that returns location data JSON object. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './controls/dynamicForm/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './controls/locationPicker/index'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.