-
Notifications
You must be signed in to change notification settings - Fork 833
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 #851 from martinlingstuyl/react-dynamic-form-with-…
…location-picker
- Loading branch information
Showing
27 changed files
with
65,736 additions
and
0 deletions.
There are no files selected for viewing
352 changes: 352 additions & 0 deletions
352
samples/react-dynamic-form-with-location-picker/.eslintrc.js
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
samples/react-dynamic-form-with-location-picker/.gitignore
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,34 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
# Build generated files | ||
dist | ||
lib | ||
release | ||
solution | ||
temp | ||
*.sppkg | ||
.heft | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Visual Studio files | ||
.ntvs_analysis.dat | ||
.vs | ||
bin | ||
obj | ||
|
||
# Resx Generated Code | ||
*.resx.ts | ||
|
||
# Styles Generated Code | ||
*.scss.ts |
16 changes: 16 additions & 0 deletions
16
samples/react-dynamic-form-with-location-picker/.npmignore
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,16 @@ | ||
!dist | ||
config | ||
|
||
gulpfile.js | ||
|
||
release | ||
src | ||
temp | ||
|
||
tsconfig.json | ||
tslint.json | ||
|
||
*.log | ||
|
||
.yo-rc.json | ||
.vscode |
22 changes: 22 additions & 0 deletions
22
samples/react-dynamic-form-with-location-picker/.yo-rc.json
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,22 @@ | ||
{ | ||
"@microsoft/generator-sharepoint": { | ||
"plusBeta": false, | ||
"isCreatingSolution": false, | ||
"nodeVersion": "16.15.0", | ||
"sdksVersions": { | ||
"@microsoft/microsoft-graph-client": "3.0.2", | ||
"@microsoft/teams-js": "2.9.1" | ||
}, | ||
"version": "1.17.3", | ||
"libraryName": "react-dynamic-form-with-location-picker", | ||
"libraryId": "1ef8efab-1523-4382-8e66-d2340e5e2bb7", | ||
"environment": "spo", | ||
"packageManager": "npm", | ||
"solutionName": "react-dynamic-form-with-location-picker", | ||
"solutionShortDescription": "react-dynamic-form-with-location-picker description", | ||
"skipFeatureDeployment": true, | ||
"isDomainIsolated": false, | ||
"componentType": "extension", | ||
"extensionType": "FormCustomizer" | ||
} | ||
} |
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,89 @@ | ||
# Dynamic Site Form | ||
|
||
## Summary | ||
|
||
This solution is a sample of an SPFx Form Customizer using the SPFx PnP Controls Dynamic Form to render a form. It combines default fields with a location picker control. | ||
|
||
![Dynamic Form with location picker screenshot](./assets/dynamic-form-with-location-picker-screenshot.png) | ||
|
||
![Dynamic Form with location picker gif](./assets/dynamic-form-with-location-picker.gif) | ||
|
||
## Compatibility | ||
|
||
| :warning: Important | | ||
|:---------------------------| | ||
| Every SPFx version is only compatible with specific version(s) of Node.js. In order to be able to build this sample, please ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.| | ||
|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. | | ||
|
||
This sample is optimally compatible with the following environment configuration: | ||
|
||
![SPFx 1.17.3](https://img.shields.io/badge/SPFx-1.17.3-green.svg) | ||
![Node.js v16.13+](https://img.shields.io/badge/Node.js-v16.13-green.svg) | ||
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg) | ||
![Does not work with SharePoint 2019](https://img.shields.io/badge/SharePoint%20Server%202019-Incompatible-red.svg "SharePoint Server 2019 requires SPFx 1.4.1 or lower") | ||
![Does not work with SharePoint 2016 (Feature Pack 2)](https://img.shields.io/badge/SharePoint%20Server%202016%20(Feature%20Pack%202)-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1") | ||
![Local Workbench Unsupported](https://img.shields.io/badge/Local%20Workbench-Unsupported-red.svg "Local workbench is no longer available as of SPFx 1.13 and above") | ||
![Hosted Workbench Compatible](https://img.shields.io/badge/Hosted%20Workbench-Compatible-green.svg) | ||
![Compatible with Remote Containers](https://img.shields.io/badge/Remote%20Containers-Compatible-green.svg) | ||
|
||
## Applies to | ||
|
||
- [SharePoint Framework](https://aka.ms/spfx) | ||
- [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant) | ||
|
||
> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/m365devprogram) | ||
## Contributors | ||
|
||
- [Martin Lingstuyl](https://github.com/martinlingstuyl) | ||
|
||
## Version history | ||
|
||
| Version | Date | Comments | | ||
| ------- | ---------------- | --------------- | | ||
| 1.0.0.0 | Jun 28, 2023 | Initial setup | | ||
|
||
## Minimal Path to Awesome | ||
|
||
- Create a SharePoint list with a multiline text field (Internal name: 'Location'), and some other fields to your liking. | ||
- Clone this repository | ||
- Ensure that you are at the solution folder | ||
- Replace `pageUrl` and `rootFolder` variables of serve configurations in `serve.json`. | ||
- in the command-line run: | ||
- `npm install` | ||
- `gulp serve --config customForm_NewForm` | ||
- To package and deploy: | ||
- Use `gulp bundle --ship` & `gulp package-solution --ship` | ||
- Add the `.sppkg` to your SharePoint App Catalog | ||
|
||
> This sample can also be opened with [VS Code Remote Development](https://code.visualstudio.com/docs/remote/remote-overview). Visit <https://aka.ms/spfx-devcontainer> for further instructions. | ||
## Features | ||
|
||
- The form uses a Dynamic Form to render a list form. | ||
- The form overrides the Location fields with a location picker from the PnP SPFx Control open source repository. | ||
- The New mode, Edit mode and View mode all work. | ||
|
||
## Help | ||
|
||
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues. | ||
|
||
If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment. | ||
|
||
You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-extensions/issues?q=label%3A%22sample%3A%20react-dynamic-form-with-location-picker%22) to see if anybody else is having the same issues. | ||
|
||
You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-extensions/discussions?discussions_q=react-dynamic-form-with-location-picker) and see what the community is saying. | ||
|
||
If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-dynamic-form-with-location-picker&template=bug-report.yml&sample=react-dynamic-form-with-location-picker&authors=@martinlingstuyl&title=react-dynamic-form-with-location-picker%20-%20). | ||
|
||
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-dynamic-form-with-location-picker&template=question.yml&sample=react-dynamic-form-with-location-picker&authors=@martinlingstuyl&title=react-dynamic-form-with-location-picker%20-%20). | ||
|
||
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-dynamic-form-with-location-picker&template=suggestion.yml&sample=react-dynamic-form-with-location-picker&authors=@martinlingstuyl&title=react-dynamic-form-with-location-picker%20-%20). | ||
|
||
## Disclaimer | ||
|
||
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** | ||
|
||
--- | ||
|
||
<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-extensions/samples/react-dynamic-form-with-location-picker" /> |
Binary file added
BIN
+57.1 KB
...rm-with-location-picker/assets/dynamic-form-with-location-picker-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+435 KB
...-dynamic-form-with-location-picker/assets/dynamic-form-with-location-picker.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions
74
samples/react-dynamic-form-with-location-picker/assets/sample.json
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 @@ | ||
[ | ||
{ | ||
"name": "pnp-sp-dev-spfx-extensions-react-dynamic-form-with-location-picker", | ||
"source": "pnp", | ||
"title": "Dynamic Form with location picker", | ||
"shortDescription": "This solution implements a simple Form Customizer with a Dynamic Form with a location picker, to demonstrate the many usages of a Dynamic Form.", | ||
"url": "https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples/react-dynamic-form-with-location-picker", | ||
"longDescription": [ | ||
"This solution implements a simple Form Customizer with a Dynamic Form with a location picker, to demonstrate the many usages of a Dynamic Form." | ||
], | ||
"creationDateTime": "2023-06-28", | ||
"updateDateTime": "2023-06-28", | ||
"products": [ | ||
"SharePoint" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "CLIENT-SIDE-DEV", | ||
"value": "TypeScript,React" | ||
}, | ||
{ | ||
"key": "SPFX-VERSION", | ||
"value": "1.17.3" | ||
} | ||
], | ||
"tags": [], | ||
"categories": [ | ||
"SPFX-FORM-EXTENSION" | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples/react-dynamic-form-with-location-picker/assets/dynamic-form-with-location-picker.gif", | ||
"alt": "Dynamic Form with location picker solution" | ||
}, | ||
{ | ||
"type": "image", | ||
"order": 101, | ||
"url": "https://github.com/pnp/sp-dev-fx-extensions/tree/main/samples/react-dynamic-form-with-location-picker/assets/dynamic-form-with-location-picker-screenshot.png", | ||
"alt": "Dynamic Form with location picker solution" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "martinlingstuyl", | ||
"pictureUrl": "https://github.com/martinlingstuyl.png", | ||
"name": "Martin Lingstuyl" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Building a SharePoint New Site Form Look-Alike", | ||
"description": "A post on building a SPFx Form Customizer with a Dynamic Site with field overrides to create an experience that looks like the default SharePoint new site form.", | ||
"url": "https://www.blimped.nl/building-a-sharepoint-new-site-form-look-alike" | ||
}, | ||
{ | ||
"name": "Getting started with SharePoint Framework", | ||
"description": "Introduction about how to develop Microsoft 365 extensions using SharePoint Framework.", | ||
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant" | ||
}, | ||
{ | ||
"name": "Build your first Form Customizer extension", | ||
"description": "Introduction about how to develop SharePoint Online form customizers using SharePoint Framework.", | ||
"url": "https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-form-customizer" | ||
}, | ||
{ | ||
"name": "Microsoft 365 Patterns and Practices", | ||
"description": "Guidance, tooling, samples and open-source controls for your Microsoft 365 development.", | ||
"url": "https://aka.ms/m365pnp" | ||
} | ||
] | ||
} | ||
] |
19 changes: 19 additions & 0 deletions
19
samples/react-dynamic-form-with-location-picker/config/config.json
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,19 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json", | ||
"version": "2.0", | ||
"bundles": { | ||
"custom-form-form-customizer": { | ||
"components": [ | ||
{ | ||
"entrypoint": "./lib/extensions/customForm/CustomFormFormCustomizer.js", | ||
"manifest": "./src/extensions/customForm/CustomFormFormCustomizer.manifest.json" | ||
} | ||
] | ||
} | ||
}, | ||
"externals": {}, | ||
"localizedResources": { | ||
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js", | ||
"CustomFormFormCustomizerStrings": "lib/extensions/customForm/loc/{locale}.js" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
samples/react-dynamic-form-with-location-picker/config/deploy-azure-storage.json
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,7 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json", | ||
"workingDir": "./release/assets/", | ||
"account": "<!-- STORAGE ACCOUNT NAME -->", | ||
"container": "react-dynamic-form-with-location-picker", | ||
"accessKey": "<!-- ACCESS KEY -->" | ||
} |
40 changes: 40 additions & 0 deletions
40
samples/react-dynamic-form-with-location-picker/config/package-solution.json
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,40 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json", | ||
"solution": { | ||
"name": "react-dynamic-form-with-location-picker-client-side-solution", | ||
"id": "1ef8efab-1523-4382-8e66-d2340e5e2bb7", | ||
"version": "1.0.0.0", | ||
"includeClientSideAssets": true, | ||
"skipFeatureDeployment": true, | ||
"isDomainIsolated": false, | ||
"developer": { | ||
"name": "Martin Lingstuyl", | ||
"websiteUrl": "https://www.blimped.nl", | ||
"privacyUrl": "", | ||
"termsOfUseUrl": "", | ||
"mpnId": "Undefined-1.15.0" | ||
}, | ||
"metadata": { | ||
"shortDescription": { | ||
"default": "This solution implements a simple Form Customizer with a Dynamic Form with a location picker, to demonstrate the many usages of a Dynamic Form." | ||
}, | ||
"longDescription": { | ||
"default": "This solution implements a simple Form Customizer with a Dynamic Form with a location picker, to demonstrate the many usages of a Dynamic Form." | ||
}, | ||
"screenshotPaths": [], | ||
"videoUrl": "", | ||
"categories": [] | ||
}, | ||
"features": [ | ||
{ | ||
"title": "react-dynamic-form-with-location-picker Feature", | ||
"description": "The feature that activates elements of the react-dynamic-form-with-location-picker solution.", | ||
"id": "a4eb427f-4c85-4466-aa10-824c3c1a3b34", | ||
"version": "1.0.0.0" | ||
} | ||
] | ||
}, | ||
"paths": { | ||
"zippedPackage": "solution/react-dynamic-form-with-location-picker.sppkg" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
samples/react-dynamic-form-with-location-picker/config/sass.json
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,3 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json" | ||
} |
50 changes: 50 additions & 0 deletions
50
samples/react-dynamic-form-with-location-picker/config/serve.json
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,50 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json", | ||
"port": 4321, | ||
"https": true, | ||
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx", | ||
"serveConfigurations": { | ||
"default": { | ||
"pageUrl": "https://{tenantDomain}/_layouts/15/SPListForm.aspx", | ||
"formCustomizer": { | ||
"componentId": "8abab516-fca5-4762-b17a-e36c4b7fcfab", | ||
"PageType": 8, | ||
"RootFolder": "/sites/mySite/Lists/MyList", | ||
"properties": { | ||
} | ||
} | ||
}, | ||
"customForm_NewForm": { | ||
"pageUrl": "https://{tenantDomain}/_layouts/15/SPListForm.aspx", | ||
"formCustomizer": { | ||
"componentId": "8abab516-fca5-4762-b17a-e36c4b7fcfab", | ||
"PageType": 8, | ||
"RootFolder": "/sites/mySite/Lists/MyList", | ||
"properties": { | ||
} | ||
} | ||
}, | ||
"customForm_EditForm": { | ||
"pageUrl": "https://{tenantDomain}/_layouts/15/SPListForm.aspx", | ||
"formCustomizer": { | ||
"componentId": "8abab516-fca5-4762-b17a-e36c4b7fcfab", | ||
"PageType": 6, | ||
"RootFolder": "/sites/mySite/Lists/MyList", | ||
"ID": 1, | ||
"properties": { | ||
} | ||
} | ||
}, | ||
"customForm_ViewForm": { | ||
"pageUrl": "https://{tenantDomain}/_layouts/15/SPListForm.aspx", | ||
"formCustomizer": { | ||
"componentId": "8abab516-fca5-4762-b17a-e36c4b7fcfab", | ||
"PageType": 4, | ||
"RootFolder": "/sites/mySite/Lists/MyList", | ||
"ID": 1, | ||
"properties": { | ||
} | ||
} | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
samples/react-dynamic-form-with-location-picker/config/write-manifests.json
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,4 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json", | ||
"cdnBasePath": "<!-- PATH TO CDN -->" | ||
} |
16 changes: 16 additions & 0 deletions
16
samples/react-dynamic-form-with-location-picker/gulpfile.js
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,16 @@ | ||
'use strict'; | ||
|
||
const build = require('@microsoft/sp-build-web'); | ||
|
||
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`); | ||
|
||
var getTasks = build.rig.getTasks; | ||
build.rig.getTasks = function () { | ||
var result = getTasks.call(build.rig); | ||
|
||
result.set('serve', result.get('serve-deprecated')); | ||
|
||
return result; | ||
}; | ||
|
||
build.initialize(require('gulp')); |
Oops, something went wrong.