Merge pull request #3715 from rishabhshukla12/dev

This commit is contained in:
Hugo Bernier 2023-06-13 09:25:32 -04:00 committed by GitHub
commit 085fca6378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 65193 additions and 0 deletions

View File

@ -0,0 +1,39 @@
// For more information on how to run this SPFx project in a VS Code Remote Container, please visit https://aka.ms/spfx-devcontainer
{
"name": "SPFx 1.16.1",
"image": "docker.io/m365pnp/spfx:1.16.1",
// Set *default* container specific settings.json values on container create.
"settings": {},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
4321,
35729
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
// Not needed for SPFx>= 1.12.1
// "5432": {
// "protocol": "https",
// "label": "Workbench",
// "onAutoForward": "silent"
// },
"35729": {
"protocol": "https",
"label": "LiveReload",
"onAutoForward": "silent",
"requireLocalPort": true
}
},
"postCreateCommand": "bash .devcontainer/spfx-startup.sh",
"remoteUser": "node"
}

View File

@ -0,0 +1,33 @@
echo
echo -e "\e[1;94mInstalling Node dependencies\e[0m"
npm install
## commands to create dev certificate and copy it to the root folder of the project
echo
echo -e "\e[1;94mGenerating dev certificate\e[0m"
gulp trust-dev-cert
# Convert the generated PEM certificate to a CER certificate
openssl x509 -inform PEM -in ~/.rushstack/rushstack-serve.pem -outform DER -out ./spfx-dev-cert.cer
# Copy the PEM ecrtificate for non-Windows hosts
cp ~/.rushstack/rushstack-serve.pem ./spfx-dev-cert.pem
## add *.cer to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.cer' ./.gitignore
then
echo "# .CER Certificates" >> .gitignore
echo "*.cer" >> .gitignore
fi
## add *.pem to .gitignore to prevent certificates from being saved in repo
if ! grep -Fxq '*.pem' ./.gitignore
then
echo "# .PEM Certificates" >> .gitignore
echo "*.pem" >> .gitignore
fi
echo
echo -e "\e[1;92mReady!\e[0m"
echo -e "\n\e[1;94m**********\nOptional: if you plan on using gulp serve, don't forget to add the container certificate to your local machine. Please visit https://aka.ms/spfx-devcontainer for more information\n**********"

View File

@ -0,0 +1,352 @@
require('@rushstack/eslint-config/patch/modern-module-resolution');
module.exports = {
extends: ['@microsoft/eslint-config-spfx/lib/profiles/react'],
parserOptions: { tsconfigRootDir: __dirname },
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
'parserOptions': {
'project': './tsconfig.json',
'ecmaVersion': 2018,
'sourceType': 'module'
},
rules: {
// Prevent usage of the JavaScript null value, while allowing code to access existing APIs that may require null. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/no-new-null': 1,
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
'@rushstack/hoist-jest-mock': 1,
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
'@rushstack/security/no-unsafe-regexp': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/adjacent-overload-signatures': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// CONFIGURATION: By default, these are banned: String, Boolean, Number, Object, Symbol
'@typescript-eslint/ban-types': [
1,
{
'extendDefaults': false,
'types': {
'String': {
'message': 'Use \'string\' instead',
'fixWith': 'string'
},
'Boolean': {
'message': 'Use \'boolean\' instead',
'fixWith': 'boolean'
},
'Number': {
'message': 'Use \'number\' instead',
'fixWith': 'number'
},
'Object': {
'message': 'Use \'object\' instead, or else define a proper TypeScript type:'
},
'Symbol': {
'message': 'Use \'symbol\' instead',
'fixWith': 'symbol'
},
'Function': {
'message': 'The \'Function\' type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with \'new\'.\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
}
}
}
],
// RATIONALE: Code is more readable when the type of every variable is immediately obvious.
// Even if the compiler may be able to infer a type, this inference will be unavailable
// to a person who is reviewing a GitHub diff. This rule makes writing code harder,
// but writing code is a much less important activity than reading it.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/explicit-function-return-type': [
1,
{
'allowExpressions': true,
'allowTypedFunctionExpressions': true,
'allowHigherOrderFunctions': false
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: although this is a recommended rule, it is up to dev to select coding style.
// Set to 1 (warning) or 2 (error) to enable.
'@typescript-eslint/explicit-member-accessibility': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-array-constructor': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
//
// RATIONALE: The "any" keyword disables static type checking, the main benefit of using TypeScript.
// This rule should be suppressed only in very special cases such as JSON.stringify()
// where the type really can be anything. Even if the type is flexible, another type
// may be more appropriate such as "unknown", "{}", or "Record<k,V>".
'@typescript-eslint/no-explicit-any': 1,
// RATIONALE: The #1 rule of promises is that every promise chain must be terminated by a catch()
// handler. Thus wherever a Promise arises, the code must either append a catch handler,
// or else return the object to a caller (who assumes this responsibility). Unterminated
// promise chains are a serious issue. Besides causing errors to be silently ignored,
// they can also cause a NodeJS process to terminate unexpectedly.
'@typescript-eslint/no-floating-promises': 2,
// RATIONALE: Catches a common coding mistake.
'@typescript-eslint/no-for-in-array': 2,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-misused-new': 2,
// RATIONALE: The "namespace" keyword is not recommended for organizing code because JavaScript lacks
// a "using" statement to traverse namespaces. Nested namespaces prevent certain bundler
// optimizations. If you are declaring loose functions/variables, it's better to make them
// static members of a class, since classes support property getters and their private
// members are accessible by unit tests. Also, the exercise of choosing a meaningful
// class name tends to produce more discoverable APIs: for example, search+replacing
// the function "reverse()" is likely to return many false matches, whereas if we always
// write "Text.reverse()" is more unique. For large scale organization, it's recommended
// to decompose your code into separate NPM packages, which ensures that component
// dependencies are tracked more conscientiously.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-namespace': [
1,
{
'allowDeclarations': false,
'allowDefinitionFiles': false
}
],
// RATIONALE: Parameter properties provide a shorthand such as "constructor(public title: string)"
// that avoids the effort of declaring "title" as a field. This TypeScript feature makes
// code easier to write, but arguably sacrifices readability: In the notes for
// "@typescript-eslint/member-ordering" we pointed out that fields are central to
// a class's design, so we wouldn't want to bury them in a constructor signature
// just to save some typing.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-parameter-properties': 0,
// RATIONALE: When left in shipping code, unused variables often indicate a mistake. Dead code
// may impact performance.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-unused-vars': [
1,
{
'vars': 'all',
// Unused function arguments often indicate a mistake in JavaScript code. However in TypeScript code,
// the compiler catches most of those mistakes, and unused arguments are fairly common for type signatures
// that are overriding a base class method or implementing an interface.
'args': 'none'
}
],
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/no-use-before-define': [
2,
{
'functions': false,
'classes': true,
'variables': true,
'enums': true,
'typedefs': true
}
],
// Disallows require statements except in import statements.
// In other words, the use of forms such as var foo = require("foo") are banned. Instead use ES6 style imports or import foo = require("foo") imports.
'@typescript-eslint/no-var-requires': 'error',
// RATIONALE: The "module" keyword is deprecated except when describing legacy libraries.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'@typescript-eslint/prefer-namespace-keyword': 1,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: it's up to developer to decide if he wants to add type annotations
// Set to 1 (warning) or 2 (error) to enable the rule
'@typescript-eslint/no-inferrable-types': 0,
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
// Rationale to disable: declaration of empty interfaces may be helpful for generic types scenarios
'@typescript-eslint/no-empty-interface': 0,
// RATIONALE: This rule warns if setters are defined without getters, which is probably a mistake.
'accessor-pairs': 1,
// RATIONALE: In TypeScript, if you write x["y"] instead of x.y, it disables type checking.
'dot-notation': [
1,
{
'allowPattern': '^_'
}
],
// RATIONALE: Catches code that is likely to be incorrect
'eqeqeq': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'for-direction': 1,
// RATIONALE: Catches a common coding mistake.
'guard-for-in': 2,
// RATIONALE: If you have more than 2,000 lines in a single source file, it's probably time
// to split up your code.
'max-lines': ['warn', { max: 2000 }],
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-async-promise-executor': 2,
// RATIONALE: Deprecated language feature.
'no-caller': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-compare-neg-zero': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-cond-assign': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-constant-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-control-regex': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-debugger': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-delete-var': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-duplicate-case': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-character-class': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-empty-pattern': 1,
// RATIONALE: Eval is a security concern and a performance concern.
'no-eval': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-ex-assign': 2,
// RATIONALE: System types are global and should not be tampered with in a scalable code base.
// If two different libraries (or two versions of the same library) both try to modify
// a type, only one of them can win. Polyfills are acceptable because they implement
// a standardized interoperable contract, but polyfills are generally coded in plain
// JavaScript.
'no-extend-native': 1,
// Disallow unnecessary labels
'no-extra-label': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-fallthrough': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-func-assign': 1,
// RATIONALE: Catches a common coding mistake.
'no-implied-eval': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-invalid-regexp': 2,
// RATIONALE: Catches a common coding mistake.
'no-label-var': 2,
// RATIONALE: Eliminates redundant code.
'no-lone-blocks': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-misleading-character-class': 2,
// RATIONALE: Catches a common coding mistake.
'no-multi-str': 2,
// RATIONALE: It's generally a bad practice to call "new Thing()" without assigning the result to
// a variable. Either it's part of an awkward expression like "(new Thing()).doSomething()",
// or else implies that the constructor is doing nontrivial computations, which is often
// a poor class design.
'no-new': 1,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-func': 2,
// RATIONALE: Obsolete language feature that is deprecated.
'no-new-object': 2,
// RATIONALE: Obsolete notation.
'no-new-wrappers': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-octal': 2,
// RATIONALE: Catches code that is likely to be incorrect
'no-octal-escape': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-regex-spaces': 2,
// RATIONALE: Catches a common coding mistake.
'no-return-assign': 2,
// RATIONALE: Security risk.
'no-script-url': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-self-assign': 2,
// RATIONALE: Catches a common coding mistake.
'no-self-compare': 2,
// RATIONALE: This avoids statements such as "while (a = next(), a && a.length);" that use
// commas to create compound expressions. In general code is more readable if each
// step is split onto a separate line. This also makes it easier to set breakpoints
// in the debugger.
'no-sequences': 1,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-shadow-restricted-names': 2,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-sparse-arrays': 2,
// RATIONALE: Although in theory JavaScript allows any possible data type to be thrown as an exception,
// such flexibility adds pointless complexity, by requiring every catch block to test
// the type of the object that it receives. Whereas if catch blocks can always assume
// that their object implements the "Error" contract, then the code is simpler, and
// we generally get useful additional information like a call stack.
'no-throw-literal': 2,
// RATIONALE: Catches a common coding mistake.
'no-unmodified-loop-condition': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unsafe-finally': 2,
// RATIONALE: Catches a common coding mistake.
'no-unused-expressions': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-unused-labels': 1,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-useless-catch': 1,
// RATIONALE: Avoids a potential performance problem.
'no-useless-concat': 1,
// RATIONALE: The "var" keyword is deprecated because of its confusing "hoisting" behavior.
// Always use "let" or "const" instead.
//
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
'no-var': 2,
// RATIONALE: Generally not needed in modern code.
'no-void': 1,
// RATIONALE: Obsolete language feature that is deprecated.
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'no-with': 2,
// RATIONALE: Makes logic easier to understand, since constants always have a known value
// @typescript-eslint\eslint-plugin\dist\configs\eslint-recommended.js
'prefer-const': 1,
// RATIONALE: Catches a common coding mistake where "resolve" and "reject" are confused.
'promise/param-names': 2,
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-atomic-updates': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'require-yield': 1,
// "Use strict" is redundant when using the TypeScript compiler.
'strict': [
2,
'never'
],
// RATIONALE: Catches code that is likely to be incorrect
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
'use-isnan': 2,
// STANDARDIZED BY: eslint\conf\eslint-recommended.js
// Set to 1 (warning) or 2 (error) to enable.
// Rationale to disable: !!{}
'no-extra-boolean-cast': 0,
// ====================================================================
// @microsoft/eslint-plugin-spfx
// ====================================================================
'@microsoft/spfx/import-requires-chunk-name': 1,
'@microsoft/spfx/no-require-ensure': 2,
'@microsoft/spfx/pair-react-dom-render-unmount': 1
}
},
{
// For unit tests, we can be a little bit less strict. The settings below revise the
// defaults specified in the extended configurations, as well as above.
files: [
// Test files
'*.test.ts',
'*.test.tsx',
'*.spec.ts',
'*.spec.tsx',
// Facebook convention
'**/__mocks__/*.ts',
'**/__mocks__/*.tsx',
'**/__tests__/*.ts',
'**/__tests__/*.tsx',
// Microsoft convention
'**/test/*.ts',
'**/test/*.tsx'
],
rules: {}
}
]
};

View File

@ -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

View File

@ -0,0 +1,16 @@
!dist
config
gulpfile.js
release
src
temp
tsconfig.json
tslint.json
*.log
.yo-rc.json
.vscode

View File

@ -0,0 +1,21 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "16.18.1",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.4.1"
},
"version": "1.16.1",
"libraryName": "invoice-generator",
"libraryId": "05e5868d-2b90-44ba-82ea-0fcbd66b925a",
"environment": "spo",
"packageManager": "npm",
"solutionName": "InvoiceGenerator",
"solutionShortDescription": "InvoiceGenerator description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}
}

View File

@ -0,0 +1,84 @@
# Invoice Generator
## Summary
SPFx Invoice Generator Web part using PnP JS allows users to create invoices for different clients or customers. Users can add items to the invoice using add item button, and the application calculates the subtotal, tax, and total amount. The application also generates PDF versions of the invoices. To obtain customer names and addresses, the application retrieve data from a SharePoint list and present them in dropdown menus for use in the application. The user interface components are designed and implemented using the Fluent UI library. Additionally, the @react-pdf/renderer library is utilized to generate the PDF versions of the invoices. Company Logo, Company Name, Address and Tax rate can be updated using web part properties.
![Configure Invoice Generator](./assets/configureWebpart.PNG)
![Invoice Generator](./assets/invoice.PNG)
List needed to configure to make the app work
![Invoice Generator List ](./assets/invoiceList.PNG)
PDF generated using Download Invoice PDF button
![Invoice Generator PDF ](./assets/invoicePDF.PNG)
## 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. |
![SPFx 1.16.1](https://img.shields.io/badge/SPFx-1.16.1-green.svg)
![Node.js v16 | v14 | v12](https://img.shields.io/badge/Node.js-v16%20%7C%20v14%20%7C%20v12-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://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview)
* [Office 365 developer tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
## Prerequisites
To use the SPFX Invoice Generator app, you will need:
A custom list on the current SharePoint site with the following columns:
* Title (single line of text) renamed to customerName in the screenshot. Internal Name - Title
* billTo (multiple lines of text)
## Contributors
* [Rishabh Shukla](https://github.com/rishabhshukla12)
## Version history
| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | May 25, 2023 | Initial release |
## Minimal Path to Awesome
* Clone this repository
* Ensure that you are at the solution folder
* in the command-line run:
* `npm install`
* `gulp serve`
## References
* [Getting started with SharePoint Framework](https://docs.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant)
* [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) - Guidance, tooling, samples and open-source controls for your Microsoft 365 development
## Help
We do not support samples, but we 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.
If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-invoice-generator&template=bug-report.yml&sample=react-invoice-generator&authors=@rishabhshukla12&title=react-invoice-generator%20-%20).
For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-invoice-generator&template=question.yml&sample=react-invoice-generator&authors=@rishabhshukla12&title=react-invoice-generator%20-%20).
Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-invoice-generator&template=question.yml&sample=react-invoice-generator&authors=@rishabhshukla12&title=react-invoice-generator%20-%20).
**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-webparts/samples/react-invoice-generator" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,50 @@
[
{
"name": "pnp-sp-dev-spfx-web-parts-react-invoice-generator",
"source": "pnp",
"title": "Invoice Generator",
"shortDescription": "SPFx Invoice Generator Web part using PnP JS allows users to create invoices for different clients or customers.",
"url": "https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-invoice-generator",
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/sp-dev-fx-webparts/tree/main/samples/react-invoice-generator",
"longDescription": [
"SPFx Invoice Generator Web part using PnP JS allows users to create invoices for different clients or customers."
],
"creationDateTime": "2023-06-12",
"updateDateTime": "2023-06-12",
"products": [
"SharePoint"
],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.16.1"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://github.com/pnp/sp-dev-fx-webparts/raw/main/samples/react-invoice-generator/assets/YOUR-IMAGE-NAME-HERE",
"alt": "Web Part Preview"
}
],
"authors": [
{
"gitHubAccount": "rishabhshukla12",
"pictureUrl": "https://github.com/rishabhshukla12.png",
"name": "Rishabh Shukla"
}
],
"references": [
{
"name": "Build your first SharePoint client-side web part",
"description": "Client-side web parts are client-side components that run in the context of a SharePoint page. Client-side web parts can be deployed to SharePoint environments that support the SharePoint Framework. You can also use modern JavaScript web frameworks, tools, and libraries to build them.",
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/build-a-hello-world-web-part"
}
]
}
]

View File

@ -0,0 +1,20 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"invoice-generator-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/invoiceGenerator/InvoiceGeneratorWebPart.js",
"manifest": "./src/webparts/invoiceGenerator/InvoiceGeneratorWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"InvoiceGeneratorWebPartStrings": "lib/webparts/invoiceGenerator/loc/{locale}.js",
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js",
"PropertyControlStrings": "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"
}
}

View File

@ -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": "invoice-generator",
"accessKey": "<!-- ACCESS KEY -->"
}

View File

@ -0,0 +1,40 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "invoice-generator-client-side-solution",
"id": "05e5868d-2b90-44ba-82ea-0fcbd66b925a",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.16.1"
},
"metadata": {
"shortDescription": {
"default": "InvoiceGenerator description"
},
"longDescription": {
"default": "InvoiceGenerator description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "invoice-generator Feature",
"description": "The feature that activates elements of the invoice-generator solution.",
"id": "e3e60b93-71d8-40c7-95c7-ff734b818ef5",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/invoice-generator.sppkg"
}
}

View File

@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}

View File

@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://enter-your-SharePoint-site/_layouts/workbench.aspx"
}

View File

@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}

View File

@ -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'));

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
{
"name": "invoice-generator",
"version": "0.0.1",
"private": true,
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/sp-core-library": "1.16.1",
"@microsoft/sp-lodash-subset": "1.16.1",
"@microsoft/sp-office-ui-fabric-core": "1.16.1",
"@microsoft/sp-property-pane": "1.16.1",
"@microsoft/sp-webpart-base": "1.16.1",
"@pnp/core": "^3.13.0",
"@pnp/logging": "^3.13.0",
"@pnp/pnpjs": "^2.15.0",
"@pnp/queryable": "^3.13.0",
"@pnp/sp": "^3.13.0",
"@pnp/spfx-controls-react": "^3.13.0",
"@pnp/spfx-property-controls": "^3.12.0",
"@react-pdf/renderer": "^3.1.9",
"file-saver": "^2.0.5",
"office-ui-fabric-react": "^7.199.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/eslint-config-spfx": "1.16.1",
"@microsoft/eslint-plugin-spfx": "1.16.1",
"@microsoft/rush-stack-compiler-4.5": "0.2.2",
"@microsoft/sp-build-web": "1.16.1",
"@microsoft/sp-module-interfaces": "1.16.1",
"@rushstack/eslint-config": "2.5.1",
"@types/file-saver": "^2.0.5",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"typescript": "4.5.5"
}
}

View File

@ -0,0 +1 @@
// A file is required to be in the root of the /src directory by the TypeScript compiler

View File

@ -0,0 +1,29 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "24d20c49-c027-4bf2-9a27-163c0bfdc54b",
"alias": "InvoiceGeneratorWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Advanced
"group": { "default": "Advanced" },
"title": { "default": "InvoiceGenerator" },
"description": { "default": "InvoiceGenerator description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "InvoiceGenerator",
"createListToggle":false
}
}]
}

View File

@ -0,0 +1,212 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
IPropertyPaneGroup,
PropertyPaneButton,
PropertyPaneButtonType,
PropertyPaneDropdown,
PropertyPaneTextField,
PropertyPaneToggle,
} from '@microsoft/sp-property-pane';
import * as strings from 'InvoiceGeneratorWebPartStrings';
import { IInvoiceGeneratorProps } from './components/InvoiceGenerator/IInvoiceGeneratorProps';
import { InvoiceGenerator } from './components/InvoiceGenerator/InvoiceGenerator';
import { IFilePickerResult, PropertyFieldFilePicker } from '@pnp/spfx-property-controls';
import {
ThemeProvider,
ThemeChangedEventArgs,
IReadonlyTheme
} from '@microsoft/sp-component-base';
import { InvoiceService } from './services/InvoiceService';
export interface IInvoiceGeneratorWebPartProps {
filePickerResult: IFilePickerResult;
description: string;
listId: string;
taxRate: number
companyName: string;
companyAddress: string;
logoImage: string;
createListToggle: boolean;
listName: string;
listIdOptions: { key: string, text: string }[];
}
export default class InvoiceGeneratorWebPart extends BaseClientSideWebPart<IInvoiceGeneratorWebPartProps> {
private _themeProvider: ThemeProvider;
private _themeVariant: IReadonlyTheme | undefined;
private _invoiceService: InvoiceService;
protected async onInit(): Promise<void> {
// Consume the new ThemeProvider service
this._themeProvider = this.context.serviceScope.consume(ThemeProvider.serviceKey);
// If it exists, get the theme variant
this._themeVariant = this._themeProvider.tryGetTheme();
// Register a handler to be notified if the theme variant changes
this._themeProvider.themeChangedEvent.add(this, this._handleThemeChangedEvent);
this._invoiceService = new InvoiceService(this.context);
const availableLists = await this._invoiceService.getLists();
this.properties.listIdOptions = availableLists.map(list => ({
key: list.Id,
text: list.Title,
}));
return super.onInit();
}
private _handleThemeChangedEvent(args: ThemeChangedEventArgs): void {
this._themeVariant = args.theme;
this.render();
}
public render(): void {
const element: React.ReactElement<IInvoiceGeneratorProps> = React.createElement(
InvoiceGenerator,
{
logoImage: this.properties.logoImage,
listId: this.properties.listId,
context: this.context,
taxRate: this.properties.taxRate || 0,
companyName: this.properties.companyName,
companyAddress: this.properties.companyAddress,
themeVariant: this._themeVariant
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
protected get dataVersion(): Version {
return Version.parse('1.0');
}
private async validateListName(value: string): Promise<string> {
const listExists = await this._invoiceService.listExists(value);
if (listExists) {
return (`List with name "${value}" already exists.`);
}
}
protected onPropertyPaneFieldChanged(propertyPath: string, newValue: string): void {
if (propertyPath === 'listId' && newValue) {
// Update the web part property
this.properties.listId = newValue;
// Refresh the web part to reflect the new property value
this.render();
}
}
private async createList(): Promise<void> {
try {
const createdList = await this._invoiceService.createList(this.properties.listName);
if (createdList) {
console.log(`List "${this.properties.listName}" created successfully.`);
const availableLists = await this._invoiceService.getLists();
this.properties.listIdOptions = availableLists.map(list => ({
key: list.Id,
text: list.Title,
}));
this.properties.listId = createdList.Id;
this.context.propertyPane.refresh();
this.render();
}
} catch (error) {
console.error('Error creating list:', error);
}
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
const { createListToggle, listId, listIdOptions } = this.properties;
const PropertyPaneFields: IPropertyPaneGroup["groupFields"] = [
PropertyFieldFilePicker('filePicker', {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
context: this.context as any,
filePickerResult: this.properties.filePickerResult,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
properties: this.properties,
onSave: (e: IFilePickerResult) => {
this.properties.logoImage = e.fileAbsoluteUrl;
this.context.propertyPane.refresh();
},
onChanged: (e: IFilePickerResult) => {
this.properties.logoImage = e.fileAbsoluteUrl;
this.context.propertyPane.refresh();
},
accepts: [".gif", ".jpg", ".jpeg", ".bmp", ".dib", ".tif", ".tiff", ".ico", ".png", ".jxr", ".svg"],
key: "filePickerId",
buttonLabel: "Logo Picker",
label: "Logo Picker",
}),
PropertyPaneToggle('createListToggle', {
label: 'Do you want to create a new list?',
checked: createListToggle,
}),
createListToggle &&
PropertyPaneTextField('listName', {
label: 'New list name',
onGetErrorMessage: this.validateListName.bind(this)
}),
createListToggle &&
PropertyPaneButton('CreateList', {
text: "Create List",
buttonType: PropertyPaneButtonType.Normal,
onClick: this.createList.bind(this),
}),
PropertyPaneDropdown('listId', {
label: 'Pick your list',
options: listIdOptions.map(list => ({
key: list.key,
text: list.text
})),
selectedKey: listId
}),
PropertyPaneTextField('companyName', {
label: strings.CompanyNameFieldLabel
}),
PropertyPaneTextField('companyAddress', {
label: strings.CompanyAddressFieldLabel,
multiline: true
}),
PropertyPaneTextField('taxRate', {
label: strings.TaxRateFieldLabel
}),
];
return {
pages: [
{
groups: [
{
groupName: "Invoice Settings",
groupFields: PropertyPaneFields
}
]
}
]
};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,13 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";
import {
IReadonlyTheme
} from '@microsoft/sp-component-base';
export interface IInvoiceGeneratorProps {
logoImage: string,
listId: string;
context: WebPartContext;
taxRate: number;
companyName: string;
companyAddress: string;
themeVariant: IReadonlyTheme;
}

View File

@ -0,0 +1,207 @@
$primaryColor: "[theme: themePrimary, default: #0078d4]";
$neutralColor: "[theme: neutralPrimary, default: #323130]";
.invoiceGenerator {
display: flex;
flex-direction: column;
border: 1px solid #ccc;
padding: 1rem;
.title {
margin-bottom: 1.5rem;
font-size: 30px;
text-align: center;
display: inline-block;
margin-right: 300px;
}
.header {
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
}
.invoiceSelect {
display: inline-block;
vertical-align: top;
margin-left: 20px;
display: flex;
margin-left: auto;
justify-content: center;
align-items: center;
background-color: $primaryColor;
color: #fff;
padding: 8px 16px;
border-radius: 3px;
margin-bottom: 50px;
&:hover {
background-color: $primaryColor;
}
}
.itemsContainer {
display: flex;
flex-direction: column;
align-items: center;
}
.itemsTable {
border-radius: 5px;
width: 100%;
max-width: 800px;
margin-bottom: 2.5rem;
padding: 0px 80px;
}
.itemsTableHeader,
.itemRow {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
box-sizing: border-box;
}
.itemDescription,
.itemQuantity,
.itemPrice,
.itemTotal {
flex: 1;
text-align: center;
padding: 10px;
box-sizing: border-box;
}
.itemsTableHeader {
background-color: $neutralColor;
color: #fff;
font-weight: bold;
padding: 2px 40px 2px 0px;
}
.itemsTableBody {
background-color: #fff;
flex: 1;
width: 100%;
}
.selectedItem {
background-color: #f5f5f5;
}
.itemsTableFooter {
color: #fff;
font-weight: bold;
}
.footerButtons {
display: flex;
justify-content: center;
align-items: center;
margin: 1rem;
}
.footerButton {
background-color: $primaryColor;
color: #fff;
border: none;
border-radius: 3px;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.2s ease-in-out;
&:hover {
background-color: "[theme: themeSecondary]";
}
}
.deleteButton {
background-color: #f44336;
color: white;
border: none;
padding: 5px 8px;
font-size: 14px;
cursor: pointer;
border-radius: 3px;
margin-left: 0.5rem;
&:hover {
opacity: 0.8;
}
}
.companyLogo {
max-width: 200px;
margin-bottom: 20px;
margin-right: 130px;
}
.fullWidthPlusButton {
display: flex;
justify-content: center;
align-items: center;
background-color: $primaryColor;
padding: 0.5rem;
border-radius: 0.25rem;
margin-bottom: 1rem;
cursor: pointer;
transition: background-color 0.2s ease;
&:hover {
background-color: "[theme: themeSecondary, default: #005a9e]";
}
i {
margin-right: 5px;
}
}
.submitButton {
display: inline-block;
padding: 10px 20px;
background-color: $primaryColor;
color: #fff;
font-size: 16px;
font-weight: bold;
text-transform: uppercase;
border-radius: 3px;
cursor: pointer;
transition: background-color 0.2s ease-in-out;
&:hover {
background-color: "[theme: themeSecondary]";
}
}
.addItem {
margin-top: 1rem;
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 0.5rem;
.inputWrapper {
margin-right: 0.5rem;
input {
padding: 5px 10px;
font-size: 12px;
}
}
.selectWrapper {
margin-right: 0.5rem;
flex: 1;
select {
width: 120px;
padding: 8px;
font-size: 16px;
}
}
}
}

View File

@ -0,0 +1,279 @@
import * as React from 'react';
import styles from './InvoiceGenerator.module.scss';
import { InvoiceService } from '../../services/InvoiceService';
import { IInvoiceItem, IInvoice } from '../../models/index'
import { IInvoiceGeneratorProps } from './IInvoiceGeneratorProps';
import { InvoiceHeader } from './InvoiceHeader/InvoiceHeader';
import { Dropdown } from '@fluentui/react/lib/Dropdown';
import { MessageBar } from '@fluentui/react/lib/MessageBar';
import { InvoiceSummary } from './InvoiceSummary/InvoiceSummary';
import { Icon } from '@fluentui/react/lib/Icon';
import { PDFGenerator } from './PDFGenerator/PDFGenerator';
import { pdf } from '@react-pdf/renderer';
import { InvoiceItemRow } from './InvoiceItemRow/InvoiceItemRow';
import * as strings from 'InvoiceGeneratorWebPartStrings';
import { Placeholder } from "@pnp/spfx-controls-react/lib/Placeholder";
import { Customizer } from "@uifabric/utilities/lib/";
const Plus = (): JSX.Element => <Icon iconName="CirclePlus" />;
export const InvoiceGenerator: React.FC<IInvoiceGeneratorProps> = (props) => {
const { context, listId, taxRate, companyAddress, companyName, logoImage, themeVariant } = props;
const [invoices, setInvoices] = React.useState<IInvoice[]>([]);
const [selectedInvoiceIndex, setSelectedInvoiceIndex] = React.useState<string>('0');
const [invoiceItems, setInvoiceItems] = React.useState<IInvoiceItem[]>([]);
const [selectedItem, setSelectedItem] = React.useState<IInvoiceItem>(null);
const [itemDescription, setItemDescription] = React.useState('');
const [quantity, setQuantity] = React.useState(0);
const [price, setPrice] = React.useState(0);
const [showAddItemForm, setShowAddItemForm] = React.useState(false);
const [issueDate, setIssueDate] = React.useState<Date>(new Date());
const [dueDate, setDueDate] = React.useState<Date>(new Date());
React.useEffect(() => {
const invoiceService = new InvoiceService(context);
invoiceService.getInvoice(listId)
.then((data: IInvoice[]) => {
setInvoices(data);
})
.catch((error) => {
console.error('Error loading invoices:', error);
});
}, [listId, context]);
const calculateSubtotal = (): number => {
const subtotal = invoiceItems.reduce((acc, cur) => acc + cur.totalAmount, 0);
return subtotal;
};
const calculateTax = (): number => {
const subtotal = calculateSubtotal();
const taxAmount = (subtotal * taxRate) / 100;
return taxAmount;
};
const calculateTotal = (): number => {
const subtotal = calculateSubtotal();
const taxAmount = calculateTax();
const total = subtotal + taxAmount;
if (isNaN(total)) {
return 0;
}
return total;
};
const onItemSelected = (item: IInvoiceItem): void => {
setSelectedItem(item);
setItemDescription(item.description);
setQuantity(item.quantity);
setPrice(item.price);
};
const toggleAddItemForm = (): void => {
setShowAddItemForm(!showAddItemForm);
};
const handleDeleteItem = (): void => {
if (!selectedItem) {
console.error('No item selected for deletion');
return;
}
try {
const updatedItems = invoiceItems.filter((item) => item !== selectedItem);
setInvoiceItems(updatedItems);
setSelectedItem(null);
setItemDescription('');
setQuantity(0);
setPrice(0);
} catch (error) {
console.error('Error deleting item:', error);
}
};
const handleAddItem = (): void => {
if (!itemDescription || quantity === 0 || price === 0) {
return;
}
const newInvoiceItem: IInvoiceItem = {
description: itemDescription,
id: invoiceItems.length + 1,
quantity,
price,
totalAmount: quantity * price,
};
const updatedItems = [...invoiceItems, newInvoiceItem];
setInvoiceItems(updatedItems);
setItemDescription('');
setQuantity(0);
setPrice(0);
setShowAddItemForm(false);
};
const handlePdfGeneration = async (): Promise<void> => {
if (invoiceItems.length === 0) {
return;
}
const invoiceData = {
items: invoiceItems,
subtotal: calculateSubtotal(),
tax: calculateTax(),
total: calculateTotal(),
invoiceNumber: invoices[Number(selectedInvoiceIndex)]?.ID,
customerName: invoices[Number(selectedInvoiceIndex)]?.Title,
customerAddress: invoices[Number(selectedInvoiceIndex)]?.billTo,
companyAddress,
companyName,
issueDate,
dueDate,
logoImage
};
const pdfContent = <PDFGenerator {...invoiceData} />;
const fileName = `invoice-#000${invoiceData.invoiceNumber}.pdf`;
const blob = await pdf(pdfContent).toBlob();
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
const DefaultExample = (): JSX.Element => (
<MessageBar>
Please add items to the invoice before generating a PDF.
</MessageBar>
);
return (
<Customizer settings={{ theme: themeVariant }}>
<div className={styles.invoiceGenerator}>
{(!invoices || invoices.length === 0 || !listId) && (
<Placeholder
iconName="Edit"
iconText="Configure your web part"
description="Please configure the web part properties."
buttonLabel="Configure"
onConfigure={() => {
context.propertyPane.open();
}}
theme={props.themeVariant}
/>
)}
{invoices && invoices.length > 0 && (
<>
<div className={styles.invoiceSelect}>
<label style={{ marginRight: '8px', fontWeight: '700' }}>{strings.selectInvoicesLabel}</label>
<Dropdown
options={invoices.map((invoice, index) => ({
key: index.toString(),
text: `${strings.invoiceText} ${invoice.ID} - ${invoice.Title}`,
}))}
selectedKey={selectedInvoiceIndex.toString()}
onChange={(event, option) => setSelectedInvoiceIndex(option.key.toString())}
/>
</div>
<div className={styles.header}>
<img className={styles.companyLogo} src={logoImage} alt={strings.companyLogoAlt} height="100" width="100" />
<div className={styles.title}>{strings.invoiceTitle}</div>
</div>
<InvoiceHeader
invoiceNumber={invoices[Number(selectedInvoiceIndex)]?.ID}
customerName={invoices[Number(selectedInvoiceIndex)]?.Title}
customerAddress={invoices[Number(selectedInvoiceIndex)]?.billTo}
companyAddress={companyAddress}
companyName={companyName}
amountdue={calculateTotal()}
issueDate={issueDate}
dueDate={dueDate}
onIssueDateChange={setIssueDate}
onDueDateChange={setDueDate}
/>
<div className={styles.itemsContainer}>
<div className={styles.itemsTable}>
<div className={styles.itemsTableHeader}>
<div className={styles.itemDescription}>{strings.itemDescriptionText}</div>
<div className={styles.itemQuantity}>{strings.quantityText}</div>
<div className={styles.itemPrice}>{strings.priceText}</div>
<div className={styles.itemTotal}>{strings.totalText}</div>
</div>
{showAddItemForm && (
<div className={styles.addItem}>
<div className={styles.inputWrapper}>
<input
type="text"
placeholder={strings.itemDescriptionPlaceholder}
value={itemDescription}
onChange={(e) => setItemDescription(e.target.value)}
/>
</div>
<div className={styles.inputWrapper}>
<input
type="number"
placeholder={strings.quantityPlaceholder}
value={quantity}
onChange={(e) => setQuantity(parseInt(e.target.value))}
/>
</div>
<div className={styles.inputWrapper}>
<input
type="number"
placeholder={strings.pricePlaceholder}
value={price}
onChange={(e) => setPrice(parseFloat(e.target.value))}
/>
</div>
<div onClick={handleAddItem} className={styles.submitButton}>{strings.submitButtonText}</div>
</div>
)}
{invoiceItems.map((item) => (
<InvoiceItemRow
key={item.id}
item={item}
isSelected={item === selectedItem}
onItemSelected={onItemSelected}
onDeleteItem={handleDeleteItem}
/>
))}
<div className={styles.fullWidthPlusButton} onClick={toggleAddItemForm}>
<Plus />{strings.addItemButtonText}
</div>
{invoiceItems.length === 0 && showAddItemForm && (
<DefaultExample />
)}
<div className={styles.itemsTableFooter}>
<InvoiceSummary subtotal={calculateSubtotal()} taxRate={taxRate} total={calculateTotal()} />
<button className={styles.footerButton} onClick={handlePdfGeneration}>{strings.downloadPdfButtonText}</button>
</div>
</div>
</div>
</>
)}
</div>
</Customizer>
);
}

View File

@ -0,0 +1,87 @@
.header {
display: flex;
justify-content: space-between;
padding: 1rem;
font-family: 'Arial', sans-serif;
border-bottom: 2px solid #ccc;
margin-bottom: 1rem;
width: -webkit-fill-available;
}
.headerSection {
display: flex;
flex-direction: column;
width: 200px;
padding: 10px 0px 15px 0px;
}
.companyName {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
.companyAddress {
font-size: .9rem;
margin-bottom: 1rem;
color: #777;
}
.customerDetails {
margin-top: 1rem;
}
.Amount {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
.amountDue {
font-size: 0.9rem;
color: #777;
margin-bottom: 2rem;
}
.customerName {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
.customerAddress {
font-size: 0.9rem;
color: #777;
margin-bottom: 2rem;
display: block;
white-space: pre-wrap;
}
.customerAddress span {
display: block;
}
.invoiceDate {
font-size: 0.9rem;
font-weight: bold;
}
.invoiceDetails {
text-align: right;
margin-left: auto;
}
.invoiceTitle {
font-size: 1rem;
font-weight: bold;
margin-bottom: 0.5rem;
}
.invoiceNumber {
font-size: .9rem;
color: #777;
margin-bottom: 1.9rem;
margin-left: auto;
}

View File

@ -0,0 +1,71 @@
import { DateConvention, DateTimePicker } from '@pnp/spfx-controls-react/lib/DateTimePicker';
import * as React from 'react';
import styles from './InvoiceHeader.module.scss';
import * as strings from 'InvoiceGeneratorWebPartStrings';
export interface IInvoiceHeaderProps {
invoiceNumber: number;
customerName: string;
customerAddress: string;
amountdue: number;
companyName: string;
companyAddress: string;
issueDate: Date;
dueDate: Date;
onIssueDateChange: (date: Date) => void;
onDueDateChange: (date: Date) => void;
}
export const InvoiceHeader: React.FC<IInvoiceHeaderProps> = (props) => {
const {
invoiceNumber,
customerName,
customerAddress,
amountdue,
companyAddress,
companyName,
issueDate,
dueDate,
onIssueDateChange,
onDueDateChange,
} = props;
return (
<div className={styles.header}>
<div className={styles.headerSection}>
<div className={styles.companyName}>{companyName}</div>
<div className={styles.companyAddress}>{companyAddress}</div>
<div className={styles.customerDetails}>
<div className={styles.customerName}>{strings.billToText} {customerName}</div>
<div className={styles.customerAddress}>{customerAddress}</div>
<div className={styles.invoiceDate}>
Date of Issue:
<DateTimePicker
dateConvention={DateConvention.Date}
showLabels={false}
value={issueDate}
onChange={(date) => onIssueDateChange(date)}
/>
</div>
</div>
</div>
<div className={styles.headerSection}>
<div className={styles.invoiceDetails}>
<div className={styles.invoiceTitle}>{strings.invoiceNumberText}</div>
<div className={styles.invoiceNumber}>#000{invoiceNumber}</div>
<div className={styles.Amount}>{strings.amountDue}</div>
<div className={styles.amountDue}>${amountdue}</div>
<div className={styles.invoiceDate}>
{strings.dueDate}
<DateTimePicker
dateConvention={DateConvention.Date}
showLabels={false}
value={dueDate}
onChange={(date) => onDueDateChange(date)}
/>
</div>
</div>
</div>
</div>
);
};

View File

@ -0,0 +1,41 @@
.itemRow {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
box-sizing: border-box;
.itemDescription,
.itemQuantity,
.itemPrice,
.itemTotal {
flex: 1;
text-align: center;
padding: 10px;
box-sizing: border-box;
}
.itemDescription {
margin-right: 10px;
}
.deleteButton {
background-color: #f44336;
color: white;
border: none;
padding: 5px 8px;
font-size: 14px;
cursor: pointer;
border-radius: 3px;
margin-left: 0.5rem;
&:hover {
opacity: 0.8;
}
}
&.selectedItem {
background-color: #f5f5f5;
}
}

View File

@ -0,0 +1,43 @@
import * as React from 'react';
import styles from './InvoiceItemRow.module.scss';
import { IInvoiceItem } from '../../../models/index';
import { Icon } from '@fluentui/react/lib/Icon';
interface IInvoiceItemRowProps {
item: IInvoiceItem;
isSelected: boolean;
onItemSelected: (item: IInvoiceItem) => void;
onDeleteItem: () => void;
}
const Delete = (): JSX.Element => <Icon iconName="Delete" />;
export const InvoiceItemRow: React.FC<IInvoiceItemRowProps> = (props) => {
const { item, isSelected, onItemSelected, onDeleteItem } = props;
const handleClick = (): void => {
onItemSelected(item);
};
const handleDelete = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>): void => {
e.stopPropagation();
onItemSelected(item);
onDeleteItem();
};
return (
<div
className={`${styles.itemRow} ${isSelected ? styles.selectedItem : ''}`}
onClick={handleClick}
>
<div className={styles.itemDescription}>{item.description}</div>
<div className={styles.itemQuantity}>{item.quantity}</div>
<div className={styles.itemPrice}>{item.price.toFixed(2)}</div>
<div className={styles.itemTotal}>{item.totalAmount.toFixed(2)}</div>
<button className={styles.deleteButton} onClick={handleDelete}>
<Delete />
</button>
</div>
);
};

View File

@ -0,0 +1,25 @@
.summary {
display: flex;
flex-direction: column;
margin-top: 1rem;
background-color: #f5f5f5;
border-radius: 0.25rem;
padding: 1rem;
margin-left: 400px;
}
.row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
}
.label {
font-weight: bold;
color: #4d4d4d;
}
.value {
font-weight: normal;
color: #4d4d4d;
}

View File

@ -0,0 +1,30 @@
import * as React from 'react';
import styles from './InvoiceSummary.module.scss';
interface IInvoiceSummaryProps {
subtotal: number;
taxRate: number;
total:number
}
export const InvoiceSummary: React.FC<IInvoiceSummaryProps> = ({ subtotal, taxRate }) => {
const tax = subtotal * (taxRate / 100) || 0;
const total = subtotal + tax || 0;
return (
<div className={styles.summary}>
<div className={styles.row}>
<div className={styles.label}>Subtotal:</div>
<div className={styles.value}>${subtotal.toFixed(2)}</div>
</div>
<div className={styles.row}>
<div className={styles.label}>Tax ({taxRate}%):</div>
<div className={styles.value}>${tax.toFixed(2)}</div>
</div>
<div className={styles.row}>
<div className={styles.label}>Total:</div>
<div className={styles.value}>${total.toFixed(2)}</div>
</div>
</div>
);
};

View File

@ -0,0 +1,171 @@
import * as React from 'react';
import { Page, Text, View, Document, Image} from '@react-pdf/renderer';
import { IInvoiceItem } from '../../../models/index'
export interface IInvoicePDFProps {
invoiceNumber: number;
customerName: string;
customerAddress: string;
companyName: string,
companyAddress: string
items: IInvoiceItem[];
subtotal: number;
tax: number;
total: number;
dueDate: Date;
issueDate: Date;
logoImage:string,
}
export const PDFGenerator: React.FC<IInvoicePDFProps> = ({ items, subtotal, tax, total, invoiceNumber,
customerName,
customerAddress,
companyName,
companyAddress, issueDate, dueDate, logoImage }) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const styles : any = {
page: {
flexDirection: 'row',
backgroundColor: '#fff',
padding: '48pt',
fontSize: 12,
lineHeight: 1.5,
},
section: {
flexDirection: 'column',
width: '100%',
},
sectionLeft: {
width: '50%',
marginBottom: '20pt',
},
sectionRight: {
width: '50%',
marginBottom: '20pt',
marginLeft: '50%',
},
title: {
fontSize: 24,
marginBottom: 10,
textAlign: 'center',
fontWeight: 'bold',
},
label: {
fontSize: 12,
fontWeight: 'bold',
marginBottom: 5,
},
companyAddress:{
marginBottom: 15,
},
customerAddress:{
marginBottom: 15,
},
Amount:{
marginBottom: 15,
},
dueDate:{
marginBottom: 15,
},
value: {
fontSize: 12,
marginBottom: 10,
},
tableHeader: [
{
flexDirection: 'row',
borderBottomWidth: 1,
borderColor: '#000',
alignItems: 'center',
height: 24,
},
],
tableRow: {
flexDirection: 'row',
borderBottomWidth: 1,
borderColor: '#000',
alignItems: 'center',
height: 24,
},
tableCell: {
flex: 1,
fontSize: 12,
paddingLeft: 5,
paddingRight: 5,
},
total: {
flexDirection: 'row',
justifyContent: 'flex-end',
marginTop: 10,
},
address: {
marginBottom: '10pt',
},
logoImage: {
height: 100,
width: 100,
},
};
return (
<Document style={styles.pdfViewer}>
<Page size="A4" style={styles.page}>
<View style={styles.section}>
<Image src= {logoImage} style={styles.logoImage}/>
<Text style={{ textAlign: 'center', marginBottom: '20pt' }}>Invoice</Text>
<View style={{ flexDirection: 'row', marginBottom: '20pt' }}>
<View style={styles.sectionLeft}>
<Text>{companyName}</Text>
<Text style={styles.companyAddress}>{companyAddress}</Text>
<Text >Bill To: {customerName}</Text>
<Text style={styles.customerAddress}>{customerAddress}</Text>
<Text style={styles.label}>Date of Issue:</Text>
<Text>{issueDate.toDateString()}</Text>
</View>
<View style={styles.sectionRight}>
<Text style={styles.label}>Invoice Number:</Text>
<Text>{invoiceNumber}</Text>
<Text style={styles.label}>Amount Due:</Text>
<Text style={styles.Amount}>{`$${total.toFixed(2)}`}</Text>
<Text style={styles.dueDate}>Due Date:</Text>
<Text>{dueDate.toDateString()}</Text>
</View>
</View>
<View style={styles.tableHeader}>
<Text style={styles.tableCell}>Description</Text>
<Text style={styles.tableCell}>Quantity</Text>
<Text style={styles.tableCell}>Price</Text>
<Text style={styles.tableCell}>Total</Text>
</View>
{items.map((item) => (
<View style={styles.tableRow} key={item.id}>
<Text style={styles.tableCell}>{item.description}</Text>
<Text style={styles.tableCell}>{item.quantity}</Text>
<Text style={styles.tableCell}>{item.price.toFixed(2)}</Text>
<Text style={styles.tableCell}>{item.totalAmount.toFixed(2)}</Text>
</View>
))}
<View style={styles.total}>
<Text style={styles.label}>Subtotal:</Text>
<Text style={styles.value}>{`$ ${subtotal.toFixed(2)}`}</Text>
</View>
<View style={styles.total}>
<Text style={styles.label}>Tax:</Text>
<Text style={styles.value}>{`$ ${tax.toFixed(2)}`}</Text>
</View>
<View style={styles.total}>
<Text style={styles.label}>Total:</Text>
<Text style={styles.value}>{`$ ${total.toFixed(2)}`}</Text>
</View>
</View>
</Page>
</Document>
);
};

View File

@ -0,0 +1,62 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Group Name",
"DescriptionFieldLabel": "Description Field",
"ListNameFieldLabel":"Select list name",
"TaxRateFieldLabel":"Provide Tax rate",
"CompanyNameFieldLabel":"Company Name",
"CompanyAddressFieldLabel": "Company Address",
"CreateListButtonText":"Create a list name invoice",
"InvoiceGeneratorWebPartTitle": "Invoice Generator",
"selectInvoicesLabel": "Select Invoices:",
"companyLogoAlt": "Company Logo",
"invoiceTitle": "Invoice",
"customerName": "Customer Name",
"customerAddress": "Customer Address",
"companyAddress": "Company Address",
"amountDue": "Amount Due",
"issueDate": "Issue Date",
"dueDate": "Due Date",
"addItemButtonText": "Add Item",
"itemDescriptionText": "Item Description",
"quantityText": "Quantity",
"priceText": "Price",
"submitButtonText": "Submit",
"downloadPdfButtonText": "Download Invoice PDF",
"subtotalText": "Subtotal",
"taxRateText": "Tax Rate",
"totalText": "Total",
"noItemsFound": "No items found.",
"invoiceText": "Invoice",
"descriptionText": "Description",
"selectItemText": "Select Item",
"deleteText": "Delete",
"itemDescriptionPlaceholder": "Enter item description",
"quantityPlaceholder": "Enter quantity",
"pricePlaceholder": "Enter price",
"invoiceNumberText": "Invoice Number",
"invoiceDateText": "Invoice Date",
"customerDetailsText": "Customer Details",
"companyDetailsText": "Company Details",
"billToText": "Bill To",
"shipToText": "Ship To",
"itemText": "Item",
"qtyText": "Qty",
"pricePerUnitText": "Price per unit",
"totalPriceText": "Total Price",
"selectItemPlaceholder": "Select Item",
"selectCustomerPlaceholder": "Select Customer",
"addNewCustomerText": "Add New Customer",
"newCustomerHeaderText": "New Customer",
"customerNameText": "Customer Name",
"customerAddressText": "Customer Address",
"customerEmailText": "Customer Email",
"customerPhoneText": "Customer Phone",
"addCustomerButtonText": "Add Customer",
"saveButtonText": "Save",
"cancelButtonText": "Cancel",
"listNotFound": "List not found. Please configure the web part.",
"listNotFoundDescription": "Please configure the web part with a valid list URL."
}
});

View File

@ -0,0 +1,63 @@
define([], function() {
return {
"PropertyPaneDescription": "Description",
"BasicGroupName": "Nom du groupe",
"DescriptionFieldLabel": "Champ de description",
"ListNameFieldLabel": "Sélectionnez le nom de la liste",
"TaxRateFieldLabel": "Fournir le taux de taxe",
"CompanyNameFieldLabel": "Nom de la compagnie",
"CompanyAddressFieldLabel": "Adresse de la compagnie",
"CreateListButtonText": "Créer un nom de liste facture",
"InvoiceGeneratorWebPartTitle": "Générateur de factures",
"InvoiceGenerator": "Générateur de factures",
"selectInvoicesLabel": "Sélectionnez les factures:",
"companyLogoAlt": "Logo de la compagnie",
"invoiceTitle": "Facture",
"customerName": "Nom du client",
"customerAddress": "Adresse du client",
"companyAddress": "Adresse de la compagnie",
"amountDue": "Montant dû",
"issueDate": "Date d'émission",
"dueDate": "Date d'échéance",
"addItemButtonText": "Ajouter un article",
"itemDescriptionText": "Description de l'article",
"quantityText": "Quantité",
"priceText": "Prix",
"submitButtonText": "Soumettre",
"downloadPdfButtonText": "Télécharger la facture PDF",
"subtotalText": "Sous-total",
"taxRateText": "Taux de taxe",
"totalText": "Total",
"noItemsFound": "Aucun article trouvé.",
"descriptionText": "La description",
"selectItemText": "Sélectionner l'article",
"totalText": "Total",
"deleteText": "Supprimer",
"itemDescriptionPlaceholder": "Entrez la description de l'article",
"quantityPlaceholder": "Entrez la quantité",
"pricePlaceholder": "Entrez le prix",
"invoiceNumberText": "Numéro de facture",
"invoiceDateText": "Date de facture",
"customerDetailsText": "Détails du client",
"companyDetailsText": "Détails de la compagnie",
"billToText": "Facturé à",
"shipToText": "Expédié à",
"itemText": "Article",
"qtyText": "Qté",
"pricePerUnitText": "Prix unitaire",
"totalPriceText": "Prix total",
"selectItemPlaceholder": "Sélectionnez l'article",
"selectCustomerPlaceholder": "Sélectionnez le client",
"addNewCustomerText": "Ajouter un nouveau client",
"newCustomerHeaderText": "Nouveau client",
"customerNameText": "Nom du client",
"customerAddressText": "Adresse du client",
"customerEmailText": "Courriel du client",
"customerPhoneText": "Téléphone du client",
"addCustomerButtonText": "Ajouter un client",
"saveButtonText": "Enregistrer",
"cancelButtonText": "Annuler",
"listNotFound": "Liste introuvable. Veuillez configurer la web part.",
"listNotFoundDescription": "Veuillez configurer la partie Web avec une URL de liste valide."
}
});

View File

@ -0,0 +1,71 @@
declare interface IInvoiceGeneratorWebPartStrings {
PropertyPaneDescription: string;
BasicGroupName: string;
DescriptionFieldLabel: string;
ListNameFieldLabel: string;
TaxRateFieldLabel: string;
CompanyNameFieldLabel: string;
CompanyAddressFieldLabel: string;
CreateListButtonText: string;
InvoiceGeneratorWebPartTitle: string;
selectInvoicesLabel: string;
companyLogoAlt: string;
invoiceTitle: string;
customerName: string;
customerAddress: string;
companyAddress: string;
amountDue: string;
issueDate: string;
dueDate: string;
addItemButtonText: string;
itemDescriptionText: string;
quantityText: string;
priceText: string;
submitButtonText: string;
downloadPdfButtonText: string;
subtotalText: string;
taxRateText: string;
totalText: string;
noItemsFound: string;
invoiceText: string;
descriptionText: string;
selectItemText: string;
quantityText: string;
priceText: string;
totalText: string;
deleteText: string;
itemDescriptionPlaceholder: string;
quantityPlaceholder: string;
pricePlaceholder: string;
invoiceNumberText: string;
invoiceDateText: string;
customerDetailsText: string;
companyDetailsText: string;
billToText: string;
shipToText: string;
amountDueText: string;
itemText: string;
qtyText: string;
pricePerUnitText: string;
totalPriceText: string;
selectItemPlaceholder: string;
selectCustomerPlaceholder: string;
addNewCustomerText: string;
newCustomerHeaderText: string;
customerNameText: string;
customerAddressText: string;
customerEmailText: string;
customerPhoneText: string;
addCustomerButtonText: string;
saveButtonText: string;
cancelButtonText: string;
listNotFound: string;
listNotFoundDescription: string;
dueDateText: string;
companyNameText: string;
}
declare module 'InvoiceGeneratorWebPartStrings' {
const strings: IInvoiceGeneratorWebPartStrings;
export = strings;
}

View File

@ -0,0 +1,5 @@
export interface IInvoice {
ID: number;
Title: string;
billTo: string;
}

View File

@ -0,0 +1,8 @@
export interface IInvoiceItem {
description: string;
id: number;
quantity: number;
price: number;
totalAmount: number;
}

View File

@ -0,0 +1,2 @@
export { IInvoice } from "./IInvoice";
export { IInvoiceItem} from "./IIvoiceItem";

View File

@ -0,0 +1,75 @@
import { SPFI, spfi, SPFx } from "@pnp/sp";
import "@pnp/sp/webs";
import "@pnp/sp/lists/web";
import "@pnp/sp/items/list";
import "@pnp/sp/lists";
import "@pnp/sp/fields";
import "@pnp/sp/views";
import { IInvoice } from '../models/index'
import { WebPartContext } from "@microsoft/sp-webpart-base";
import { IFieldAddResult, FieldTypes } from "@pnp/sp/fields/types";
import { IListInfo } from "@pnp/sp/lists";
export class InvoiceService {
private sp: SPFI;
constructor(context: WebPartContext) {
this.sp = spfi().using(SPFx(context));
}
public async getInvoice(listId: string): Promise<IInvoice[]> {
try {
if (listId) {
const list = this.sp.web.lists.getById(listId);
const items = await list.items.select('ID', 'Title', 'billTo')();
return items;
}
} catch (error) {
console.error('Error loading invoices:', error);
return null;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public async createList(listName: string): Promise<any> {
try {
// create list
const createList = await this.sp.web.lists.add(listName, "List created by Invoice Generator web part");
const field: IFieldAddResult = await this.sp.web.lists.getByTitle(listName).fields.add("billTo", FieldTypes.Text,
{ FieldTypeKind: 3, Group: "Invoice Generator Fields" });
// return list ID
console.log(`List '${listName}' created with ID '${createList.data.Id}' and field '${field.data.InternalName}'.`);
await this.sp.web.lists.getByTitle(listName).defaultView.fields.add("billTo");
return createList.data.Id;
} catch (error) {
console.log("Error creating list or field:", error);
return null;
}
}
public async getLists(): Promise<IListInfo[]> {
try {
const lists = await this.sp.web.lists.select("Id", "Title")();
return lists;
} catch (error) {
console.log(`Error retrieving lists: ${error}`);
return null;
}
}
public async listExists(listName: string): Promise<boolean> {
try {
const lists = await this.sp.web.lists.filter(`Title eq '${listName}'`)();
if (lists.length > 0) {
return true;
}
} catch (error) {
console.error('Error checking if list exists:', error);
}
return false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

View File

@ -0,0 +1,37 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.5/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"declaration": true,
"sourceMap": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft",
],
"types": [
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
]
}