├── .github └── workflows │ ├── export-and-branch-solution.yml │ ├── release-action-call.yml │ └── release-solution-prod-with-inputs.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── SECURITY.md └── custom-controls └── linear-input ├── ControlManifest.Input.xml ├── LinearInputControl.css └── index.ts /.github/workflows/export-and-branch-solution.yml: -------------------------------------------------------------------------------- 1 | name: export-and-branch-solution 2 | # Export solution from DEV environment 3 | # unpack it and prepare, commit and push a git branch with the changes 4 | 5 | on: 6 | workflow_dispatch: 7 | inputs: 8 | # Change this value 9 | solution_name: 10 | description: 'name of the solution to worked on from Power Platform' 11 | required: true 12 | default: ALMLab 13 | #Do Not change these values 14 | solution_exported_folder: 15 | description: 'folder name for staging the exported solution *do not change*' 16 | required: true 17 | default: out/exported/ 18 | solution_folder: 19 | description: 'staging the unpacked solution folder before check-in *do not change*' 20 | required: true 21 | default: out/solutions/ 22 | solution_target_folder: 23 | description: 'folder name to be created and checked in *do not change*' 24 | required: true 25 | default: solutions/ 26 | env: 27 | #edit your values here 28 | ENVIRONMENT_URL: '' 29 | CLIENT_ID: '' 30 | TENANT_ID: '' 31 | permissions: 32 | contents: write 33 | jobs: 34 | export-from-dev: 35 | runs-on: windows-latest 36 | # or you can say runs-on: ubuntu-latest 37 | env: 38 | RUNNER_DEBUG: 1 39 | 40 | steps: 41 | - uses: actions/checkout@v2 42 | with: 43 | lfs: true 44 | 45 | - name: who-am-i action 46 | uses: microsoft/powerplatform-actions/who-am-i@v0 47 | with: 48 | environment-url: ${{env.ENVIRONMENT_URL}} 49 | app-id: ${{env.CLIENT_ID}} 50 | client-secret: ${{ secrets.PowerPlatformSPN }} 51 | tenant-id: ${{env.TENANT_ID}} 52 | 53 | 54 | - name: export-solution action 55 | uses: microsoft/powerplatform-actions/export-solution@v0 56 | with: 57 | environment-url: ${{env.ENVIRONMENT_URL}} 58 | app-id: ${{env.CLIENT_ID}} 59 | client-secret: ${{ secrets.PowerPlatformSPN }} 60 | tenant-id: ${{env.TENANT_ID}} 61 | solution-name: ${{ github.event.inputs.solution_name }} 62 | solution-output-file: ${{ github.event.inputs.solution_exported_folder}}/${{ github.event.inputs.solution_name }}.zip 63 | 64 | - name: unpack-solution action 65 | uses: microsoft/powerplatform-actions/unpack-solution@v0 66 | with: 67 | solution-file: ${{ github.event.inputs.solution_exported_folder}}/${{ github.event.inputs.solution_name }}.zip 68 | solution-folder: ${{ github.event.inputs.solution_folder}}/${{ github.event.inputs.solution_name }} 69 | solution-type: 'Unmanaged' 70 | overwrite-files: true 71 | 72 | - name: branch-solution, prepare it for a PullRequest 73 | uses: microsoft/powerplatform-actions/branch-solution@v0 74 | with: 75 | solution-folder: ${{ github.event.inputs.solution_folder}}/${{ github.event.inputs.solution_name }} 76 | solution-target-folder: ${{ github.event.inputs.solution_target_folder}}/${{ github.event.inputs.solution_name }} 77 | repo-token: ${{ secrets.GITHUB_TOKEN }} 78 | allow-empty-commit: true 79 | -------------------------------------------------------------------------------- /.github/workflows/release-action-call.yml: -------------------------------------------------------------------------------- 1 | name: Release action 2 | # Call the reusable workflow release-solution-with-inputs.yml 3 | # Release your solution to prod when you create a new release. 4 | 5 | on: 6 | release: 7 | types: [created] 8 | permissions: 9 | contents: write 10 | jobs: 11 | Release-solution-ALMLab: 12 | uses: ./.github/workflows/release-solution-prod-with-inputs.yml 13 | with: 14 | #You can specify the solution name here 15 | solution_name: ALMLab 16 | #Update your values here 17 | BUILD_ENVIRONMENT_URL: '' 18 | PRODUCTION_ENVIRONMENT_URL: '' 19 | CLIENT_ID: '' 20 | TENANT_ID: '' 21 | secrets: 22 | envSecret: ${{ secrets.PowerPlatformSPN }} 23 | -------------------------------------------------------------------------------- /.github/workflows/release-solution-prod-with-inputs.yml: -------------------------------------------------------------------------------- 1 | name: release-solution-to-prod-reusable 2 | # Reusable workflow 3 | # convert solution to managed (using a build PowerPlatform environment for the conversion) 4 | # upload the solution to the GitHub artifacts and deploy to the PROD environment 5 | on: 6 | workflow_call: 7 | inputs: 8 | #Do Not change these values 9 | #Values are set by the caller 10 | #caller sample: release-action-call.ymnl 11 | solution_name: 12 | description: 'The solution name.' 13 | type: string 14 | default: ALMLab 15 | solution_shipping_folder: 16 | description: 'folder name for staging the exported solution *do not change*' 17 | type: string 18 | default: out/ship/ 19 | solution_outbound_folder: 20 | description: 'staging the unpacked solution folder before check-in *do not change*' 21 | type: string 22 | default: out/solutions/ 23 | solution_source_folder: 24 | description: 'folder name to be created and checked in *do not change*' 25 | type: string 26 | default: solutions/ 27 | solution_release_folder: 28 | description: 'folder where the released binaries are going to be hosted *do not change*' 29 | type: string 30 | default: out/exported 31 | BUILD_ENVIRONMENT_URL: 32 | description: 'Build environment url.' 33 | type: string 34 | required: true 35 | PRODUCTION_ENVIRONMENT_URL: 36 | description: 'Production environment url.' 37 | type: string 38 | required: true 39 | CLIENT_ID: 40 | description: 'The client id' 41 | type: string 42 | required: true 43 | TENANT_ID: 44 | description: 'The tenant id' 45 | type: string 46 | required: true 47 | secrets: 48 | envSecret: 49 | description: 'The secret value for authentication using SPN' 50 | required: true 51 | 52 | jobs: 53 | convert-to-managed: 54 | runs-on: windows-latest 55 | # or you can say runs-on: ubuntu-latest 56 | env: 57 | RUNNER_DEBUG: 1 58 | 59 | steps: 60 | - uses: actions/checkout@v2 61 | with: 62 | lfs: true 63 | 64 | - name: Pack solution 65 | uses: microsoft/powerplatform-actions/pack-solution@v0 66 | with: 67 | solution-folder: ${{ inputs.solution_source_folder}}/${{ inputs.solution_name }} 68 | solution-file: ${{ inputs.solution_outbound_folder}}/${{ inputs.solution_name }}.zip 69 | solution-type: Unmanaged 70 | 71 | - name: Import solution as unmanaged to build env 72 | uses: microsoft/powerplatform-actions/import-solution@v0 73 | with: 74 | environment-url: ${{inputs.BUILD_ENVIRONMENT_URL}} 75 | app-id: ${{inputs.CLIENT_ID}} 76 | client-secret: ${{ secrets.envSecret }} 77 | tenant-id: ${{inputs.TENANT_ID}} 78 | solution-file: ${{ inputs.solution_outbound_folder}}/${{ inputs.solution_name }}.zip 79 | force-overwrite: true 80 | publish-changes: true 81 | 82 | - name: Export solution as managed 83 | uses: microsoft/powerplatform-actions/export-solution@v0 84 | with: 85 | environment-url: ${{inputs.BUILD_ENVIRONMENT_URL}} 86 | app-id: ${{inputs.CLIENT_ID}} 87 | client-secret: ${{ secrets.envSecret }} 88 | tenant-id: ${{inputs.TENANT_ID}} 89 | solution-name: ${{ inputs.solution_name }} 90 | managed: true 91 | solution-output-file: ${{ inputs.solution_shipping_folder}}/${{ inputs.solution_name }}.zip 92 | 93 | - name: Upload the ready to ship solution to GH artifact store 94 | uses: actions/upload-artifact@v2 95 | with: 96 | name: managedSolutions 97 | path: ${{ inputs.solution_shipping_folder}}/ 98 | 99 | release-to-staging: 100 | needs: [ convert-to-managed ] 101 | runs-on: windows-latest 102 | env: 103 | RUNNER_DEBUG: 1 104 | 105 | steps: 106 | - uses: actions/checkout@v2 107 | with: 108 | lfs: true 109 | 110 | - name: Fetch the ready to ship solution from GH artifact store 111 | uses: actions/download-artifact@v2 112 | with: 113 | name: managedSolutions 114 | path: ${{ inputs.solution_release_folder}} 115 | - name: Import solution to prod env 116 | uses: microsoft/powerplatform-actions/import-solution@v0 117 | with: 118 | environment-url: ${{inputs.PRODUCTION_ENVIRONMENT_URL}} 119 | app-id: ${{inputs.CLIENT_ID}} 120 | client-secret: ${{ secrets.envSecret }} 121 | tenant-id: ${{inputs.TENANT_ID}} 122 | solution-file: ${{ inputs.solution_release_folder}}/${{ inputs.solution_name }}.zip 123 | force-overwrite: true 124 | publish-changes: true 125 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Power Platform Developer Hub 2 | 3 | > This repo contains sample files that are intended to be used as a reference and learning 4 | > resource for developers who are following tutorials in the [Developer Hub](https://developer.powerplatform.microsoft.com). The purpose is 5 | > to provide hands-on examples that demonstrate the concepts covered in the tutorials 6 | > and help developers build their skills and understanding. 7 | 8 | ## Build custom controls 9 | 10 | Refer to the samples in folder **custom-controls/linear-input** to build a custom control for your app. 11 | 12 | ## Setup CI/CD 13 | 14 | Refer to the samples in folder **.github/workflows** to setup CI/CD using GitHub Actions. 15 | 16 | 17 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /custom-controls/linear-input/ControlManifest.Input.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 17 | 18 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /custom-controls/linear-input/LinearInputControl.css: -------------------------------------------------------------------------------- 1 | .SampleNamespace\.LinearInputControl input[type=range].linearslider { 2 | margin: 1px 0; 3 | background:transparent; 4 | -webkit-appearance:none; 5 | width:100%;padding:0; 6 | height:24px; 7 | -webkit-tap-highlight-color:transparent 8 | } 9 | .SampleNamespace\.LinearInputControl input[type=range].linearslider:focus { 10 | outline: none; 11 | } 12 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-webkit-slider-runnable-track { 13 | background: #666; 14 | height:2px; 15 | cursor:pointer 16 | } 17 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-webkit-slider-thumb { 18 | background: #666; 19 | border:0 solid #f00; 20 | height:24px; 21 | width:10px; 22 | border-radius:48px; 23 | cursor:pointer; 24 | opacity:1; 25 | -webkit-appearance:none; 26 | margin-top:-12px 27 | } 28 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-moz-range-track { 29 | background: #666; 30 | height:2px; 31 | cursor:pointer 32 | } 33 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-moz-range-thumb { 34 | background: #666; 35 | border:0 solid #f00; 36 | height:24px; 37 | width:10px; 38 | border-radius:48px; 39 | cursor:pointer; 40 | opacity:1; 41 | -webkit-appearance:none; 42 | margin-top:-12px 43 | } 44 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-ms-track { 45 | background: #666; 46 | height:2px; 47 | cursor:pointer 48 | } 49 | .SampleNamespace\.LinearInputControl input[type=range].linearslider::-ms-thumb { 50 | background: #666; 51 | border:0 solid #f00; 52 | height:24px; 53 | width:10px; 54 | border-radius:48px; 55 | cursor:pointer; 56 | opacity:1; 57 | -webkit-appearance:none; 58 | } 59 | -------------------------------------------------------------------------------- /custom-controls/linear-input/index.ts: -------------------------------------------------------------------------------- 1 | import { IInputs, IOutputs } from "./generated/ManifestTypes"; 2 | 3 | export class LinearInputControl 4 | implements ComponentFramework.StandardControl 5 | { 6 | private _value: number; 7 | private _notifyOutputChanged: () => void; 8 | private labelElement: HTMLLabelElement; 9 | private inputElement: HTMLInputElement; 10 | private _container: HTMLDivElement; 11 | private _context: ComponentFramework.Context; 12 | private _refreshData: EventListenerOrEventListenerObject; 13 | constructor() {} 14 | 15 | public init( 16 | context: ComponentFramework.Context, 17 | notifyOutputChanged: () => void, 18 | state: ComponentFramework.Dictionary, 19 | container: HTMLDivElement 20 | ): void { 21 | // Add control initialization code 22 | this._context = context; 23 | this._container = document.createElement("div"); 24 | this._notifyOutputChanged = notifyOutputChanged; 25 | this._refreshData = this.refreshData.bind(this); 26 | 27 | // creating HTML elements for the input type range and binding it to the function which 28 | // refreshes the control data 29 | this.inputElement = document.createElement("input"); 30 | this.inputElement.setAttribute("type", "range"); 31 | this.inputElement.addEventListener("input", this._refreshData); 32 | 33 | //setting the max and min values for the control. 34 | this.inputElement.setAttribute("min", "1"); 35 | this.inputElement.setAttribute("max", "1000"); 36 | this.inputElement.setAttribute("class", "linearslider"); 37 | this.inputElement.setAttribute("id", "linearrangeinput"); 38 | 39 | // creating a HTML label element that shows the value that is set on the linear range control 40 | this.labelElement = document.createElement("label"); 41 | this.labelElement.setAttribute("class", "LinearRangeLabel"); 42 | this.labelElement.setAttribute("id", "lrclabel"); 43 | 44 | // retrieving the latest value from the control and setting it to the HTMl elements. 45 | this._value = context.parameters.controlValue.raw!; 46 | this.inputElement.setAttribute( 47 | "value", 48 | context.parameters.controlValue.formatted 49 | ? context.parameters.controlValue.formatted 50 | : "0" 51 | ); 52 | this.labelElement.innerHTML = context.parameters.controlValue.formatted 53 | ? context.parameters.controlValue.formatted 54 | : "0"; 55 | 56 | // appending the HTML elements to the control's HTML container element. 57 | this._container.appendChild(this.inputElement); 58 | this._container.appendChild(this.labelElement); 59 | container.appendChild(this._container); 60 | } 61 | 62 | public refreshData(evt: Event): void { 63 | this._value = this.inputElement.value as any as number; 64 | this.labelElement.innerHTML = this.inputElement.value; 65 | this._notifyOutputChanged(); 66 | } 67 | 68 | public updateView(context: ComponentFramework.Context): void { 69 | // Add code to update control view 70 | // storing the latest context from the control. 71 | this._value = context.parameters.controlValue.raw!; 72 | this._context = context; 73 | this.inputElement.setAttribute( 74 | "value", 75 | context.parameters.controlValue.formatted 76 | ? context.parameters.controlValue.formatted 77 | : "" 78 | ); 79 | this.labelElement.innerHTML = context.parameters.controlValue.formatted 80 | ? context.parameters.controlValue.formatted 81 | : ""; 82 | } 83 | 84 | public destroy(): void { 85 | // Add code to cleanup control if necessary 86 | this.inputElement.removeEventListener("input", this._refreshData); 87 | } 88 | } 89 | --------------------------------------------------------------------------------