Merge pull request #5224 from OGcanviz/main

This commit is contained in:
Hugo Bernier 2024-09-28 18:25:46 -07:00 committed by GitHub
commit 2e78437083
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 30944 additions and 16067 deletions

View File

@ -1,39 +0,0 @@
// 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.10.0",
"image": "docker.io/m365pnp/spfx:1.10.0",
// 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,
5432
],
"portsAttributes": {
"4321": {
"protocol": "https",
"label": "Manifest",
"onAutoForward": "silent",
"requireLocalPort": true
},
"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

@ -1,31 +0,0 @@
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
cp ~/.gcb-serve-data/gcb-serve.cer ./spfx-dev-cert.cer
cp ~/.gcb-serve-data/gcb-serve.cer ./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': 0,
// 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': 0,
// 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/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

@ -9,9 +9,11 @@ node_modules
# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft
# Coverage directory used by tools like istanbul
coverage

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 @@
v18.17.1

View File

@ -1,11 +1,20 @@
{
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"environment": "spo",
"version": "1.9.1",
"nodeVersion": "18.17.1",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
},
"version": "1.19.0",
"libraryName": "react-graph-calendar",
"libraryId": "42fe0a0f-c4d9-4b05-806c-3857decb3d71",
"environment": "spo",
"packageManager": "npm",
"solutionName": "react-graph-calendar",
"solutionShortDescription": "react-graph-calendar description",
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"componentType": "webpart"
}

View File

@ -20,15 +20,17 @@ Web part is developed using below technologies
| :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.|
| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to 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.10](https://img.shields.io/badge/SPFx-1.10.0-green.svg)
![Node.js v10 | v8](https://img.shields.io/badge/Node.js-v10%20%7C%20v8-green.svg)
This sample is optimally compatible with the following environment configuration:
![SPFx 1.19.0](https://img.shields.io/badge/SPFx-1.19.0-green.svg)
![Node.js v18](https://img.shields.io/badge/Node.js-v18-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 Incompatible](https://img.shields.io/badge/Local%20Workbench-Incompatible-red.svg "Requires access to Microsoft Graph")
![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)
@ -56,6 +58,7 @@ Version|Date|Comments
1.2.1|November 1, 2020 | Changed return behavior for single items vs recurring items
1.2.2|November 3, 2020 | Show calendar in other languages
1.2.3|November 6, 2020 | Added property panel translations (English, French, Dutch)
2.0|September 12, 2024 | Bumped to SPFx 1.19
## Minimal Path to Awesome

View File

@ -9,7 +9,7 @@
"This is a sample web part developed using React Framework to gather events from the underlying group calendar of a Team site. This sample also demonstrates the utilization of web parts as Teams tabs and Personal tab and offering a visualization context to change behaviors based on the platform used (Getting the proper information from the team vs. SharePoint site, understanding the context of the theme on Teams, etc.)."
],
"creationDateTime": "2020-11-06",
"updateDateTime": "2020-11-06",
"updateDateTime": "2024-09-12",
"products": [
"SharePoint"
],
@ -20,7 +20,7 @@
},
{
"key": "SPFX-VERSION",
"value": "1.10.0"
"value": "1.19.0"
},
{
"key": "SPFX-TEAMSTAB",
@ -54,14 +54,12 @@
"authors": [
{
"gitHubAccount": "sebastienlevert",
"company": "Microsoft",
"pictureUrl": "https://github.com/sebastienlevert.png",
"name": "S\u00E9bastien Levert",
"twitter": "sebastienlevert"
},
{
"gitHubAccount": "Abderahman88",
"company": "",
"pictureUrl": "https://avatars.githubusercontent.com/u/36161889?s=460\u0026u=afdd5f6681bc375ee3811482dec79824c12d8170\u0026v=4",
"name": "Abderahman Moujahid"
}

View File

@ -13,6 +13,8 @@
},
"externals": {},
"localizedResources": {
"GraphCalendarWebPartStrings": "lib/webparts/graphCalendar/loc/{locale}.js"
"GraphCalendarWebPartStrings": "lib/webparts/graphCalendar/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

@ -16,6 +16,32 @@
"resource": "Microsoft Graph",
"scope": "Calendars.Read"
}
],
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.19.0"
},
"metadata": {
"shortDescription": {
"default": "react-graph-calendar description"
},
"longDescription": {
"default": "react-graph-calendar description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "react-graph-calendar Feature",
"description": "The feature that activates elements of the react-graph-calendar solution.",
"id": "8a9284e7-7271-4ead-b323-b23ea37a68f5",
"version": "1.0.0.0"
}
]
},
"paths": {

View File

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

View File

@ -1,10 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://localhost:5432/workbench",
"api": {
"port": 5432,
"entryPath": "node_modules/@microsoft/sp-webpart-workbench/lib/api/"
}
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
}

View File

@ -1,7 +1,16 @@
'use strict';
const gulp = require('gulp');
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.`);
build.initialize(gulp);
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

@ -1,49 +1,63 @@
{
"name": "react-graph-calendar",
"version": "1.2.2",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
"node": ">=0.10.0"
"node": ">=18.17.1 <19.0.0"
},
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@fullcalendar/core": "^4.3.1",
"@fullcalendar/daygrid": "^4.3.0",
"@fullcalendar/moment": "^4.3.0",
"@fullcalendar/moment-timezone": "^4.3.0",
"@fullcalendar/react": "^4.3.0",
"@microsoft/sp-core-library": "1.10.0",
"@microsoft/sp-lodash-subset": "1.10.0",
"@microsoft/sp-office-ui-fabric-core": "1.10.0",
"@microsoft/sp-webpart-base": "1.10.0",
"@types/es6-promise": "0.0.33",
"@types/react": "16.8.8",
"@types/react-dom": "16.8.3",
"@types/webpack-env": "1.13.1",
"moment": "^2.24.0",
"@fluentui/react": "^8.106.4",
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.15",
"@fullcalendar/react": "^6.1.15",
"@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.3",
"@microsoft/decorators": "1.19.0",
"@microsoft/sp-application-base": "1.19.0",
"@microsoft/sp-component-base": "1.19.0",
"@microsoft/sp-core-library": "1.19.0",
"@microsoft/sp-dialog": "1.19.0",
"@microsoft/sp-lodash-subset": "1.19.0",
"@microsoft/sp-office-ui-fabric-core": "1.19.0",
"@microsoft/sp-property-pane": "1.19.0",
"@microsoft/sp-webpart-base": "1.19.0",
"@microsoft/teams-js": "^2.25.0",
"@pnp/graph": "^4.2.0",
"@pnp/sp": "^4.2.0",
"@pnp/spfx-controls-react": "3.18.1",
"@pnp/spfx-property-controls": "^3.17.1",
"axios": "^1.7.2",
"moment-range": "^4.0.2",
"moment-timezone": "^0.5.27",
"office-ui-fabric-react": "6.189.2",
"react": "16.8.5",
"react-dom": "16.8.5"
},
"resolutions": {
"@types/react": "16.8.8"
"moment-timezone": "^0.5.45",
"office-ui-fabric-react": "^7.204.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-slick": "^0.30.2",
"slick-carousel": "^1.8.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/sp-build-web": "1.10.0",
"@microsoft/sp-tslint-rules": "1.10.0",
"@microsoft/sp-module-interfaces": "1.10.0",
"@microsoft/sp-webpart-workbench": "1.10.0",
"@microsoft/rush-stack-compiler-2.9": "0.7.16",
"gulp": "~3.9.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"ajv": "~5.2.2"
"@microsoft/eslint-config-spfx": "1.20.1",
"@microsoft/eslint-plugin-spfx": "1.20.1",
"@microsoft/microsoft-graph-types": "^2.40.0",
"@microsoft/rush-stack-compiler-4.7": "0.1.0",
"@microsoft/sp-build-web": "1.20.1",
"@microsoft/sp-module-interfaces": "1.20.1",
"@rushstack/eslint-config": "2.5.1",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"@types/react-slick": "^0.23.13",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint": "8.7.0",
"eslint-plugin-react-hooks": "4.3.0",
"gulp": "4.0.2",
"typescript": "4.7.4"
}
}

View File

@ -12,7 +12,9 @@
// 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", "TeamsTab", "TeamsPersonalApp"],
"supportedHosts": ["SharePointWebPart", "TeamsPersonalApp", "TeamsTab", "SharePointFullPage"],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },

View File

@ -1,25 +1,28 @@
import { Version } from '@microsoft/sp-core-library';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
BaseClientSideWebPart,
PropertyPaneTextField
} from '@microsoft/sp-webpart-base';
import { IPropertyPaneConfiguration, PropertyPaneCheckbox, PropertyPaneSlider } from '@microsoft/sp-property-pane';
import * as microsoftTeams from '@microsoft/teams-js';
import * as strings from 'GraphCalendarWebPartStrings';
import { initializeIcons } from 'office-ui-fabric-react';
import GraphCalendar from './components/GraphCalendar';
import { IGraphCalendarProps } from './components/IGraphCalendarProps';
import * as microsoftTeams from '@microsoft/teams-js';
import { initializeIcons } from 'office-ui-fabric-react';
import { PropertyPaneSlider, PropertyPaneCheckbox, IPropertyPaneConfiguration } from '@microsoft/sp-property-pane';
import { IReadonlyTheme } from '@microsoft/sp-component-base';
import { IPropertyFieldGroupOrPerson, PrincipalType, PropertyFieldPeoplePicker } from '@pnp/spfx-property-controls';
export interface IGraphCalendarWebPartProps {
limit: number;
showRecurrence: boolean;
group: IPropertyFieldGroupOrPerson[];
}
export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCalendarWebPartProps> {
private _teamsContext: microsoftTeams.Context;
private _isDarkTheme: boolean = false;
private _teamsContext: microsoftTeams.app.Context;
public render(): void {
const element: React.ReactElement<IGraphCalendarProps> = React.createElement(
@ -27,6 +30,10 @@ export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCa
{
limit: this.properties.limit,
showRecurrence: this.properties.showRecurrence,
group: this.properties.group,
isDarkTheme: this._isDarkTheme,
hasTeamsContext: !!this.context.sdks.microsoftTeams,
userDisplayName: this.context.pageContext.user.displayName,
context: this.context,
teamsContext: this._teamsContext
}
@ -35,7 +42,7 @@ export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCa
ReactDom.render(element, this.domElement);
}
protected onInit(): Promise<any> {
protected onInit(): Promise<void> {
// create a new promise
return new Promise<void>((resolve, _reject) => {
@ -50,13 +57,17 @@ export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCa
// Sets the Teams context if in Teams
if (this.context.sdks.microsoftTeams) {
this._teamsContext = this.context.sdks.microsoftTeams.context;
// Initialize the OUIF icons if in Teams
initializeIcons();
microsoftTeams.app.initialize().then(() => {
microsoftTeams.app.getContext().then(context => {
this._teamsContext = context;
// resolve the promise
resolve(undefined);
// Initialize the OUIF icons if in Teams
initializeIcons();
// resolve the promise
resolve(undefined);
});
});
} else {
// resolve the promise
resolve(undefined);
@ -64,6 +75,23 @@ export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCa
});
}
protected onThemeChanged(currentTheme: IReadonlyTheme | undefined): void {
if (!currentTheme) {
return;
}
this._isDarkTheme = !!currentTheme.isInverted;
const {
semanticColors
} = currentTheme;
if (semanticColors) {
this.domElement.style.setProperty('--bodyText', semanticColors.bodyText || null);
this.domElement.style.setProperty('--link', semanticColors.link || null);
this.domElement.style.setProperty('--linkHovered', semanticColors.linkHovered || null);
}
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
@ -87,6 +115,21 @@ export default class GraphCalendarWebPart extends BaseClientSideWebPart<IGraphCa
PropertyPaneCheckbox('showRecurrence', {
text: strings.ShowRecurringEvents,
checked: true
}),
PropertyFieldPeoplePicker('group', {
label: 'Group',
initialData: this.properties.group,
allowDuplicate: false,
multiSelect: false,
principalType: [PrincipalType.Security],
onPropertyChange: this.onPropertyPaneFieldChanged,
context: this.context as any,
properties: this.properties,
onGetErrorMessage: (value) => {
return '';
},
deferredValidationTime: 0,
key: 'peopleFieldId'
})
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,7 +1,5 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
@import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
@import '~@fullcalendar/core/main.css';
@import '~@fullcalendar/daygrid/main.css';
:global {
.fc-event {

View File

@ -1,27 +1,27 @@
import * as React from 'react';
import { createRef } from "office-ui-fabric-react/lib/Utilities";
import styles from './GraphCalendar.module.scss';
import * as strings from "GraphCalendarWebPartStrings";
import { IGraphCalendarProps } from './IGraphCalendarProps';
import { MSGraphClient } from "@microsoft/sp-http";
import FullCalendar from '@fullcalendar/react';
import { EventInput } from '@fullcalendar/core';
import allLocales from '@fullcalendar/core/locales-all';
import dayGridPlugin from '@fullcalendar/daygrid';
import FullCalendar from '@fullcalendar/react';
import { MSGraphClientV3 } from "@microsoft/sp-http";
import * as strings from "GraphCalendarWebPartStrings";
import { extendMoment } from 'moment-range';
import * as moment from 'moment-timezone';
import { Panel, PanelType } from 'office-ui-fabric-react/lib/Panel';
import { extendMoment } from 'moment-range';
import allLocales from '@fullcalendar/core/locales-all';
import * as React from 'react';
import styles from './GraphCalendar.module.scss';
import { IGraphCalendarProps } from './IGraphCalendarProps';
import * as microsoftTeams from '@microsoft/teams-js';
const { range } = extendMoment(moment);
interface IGraphCalendarState {
events: EventInput[];
height: number;
currentActiveStartDate: Date;
currentActiveEndDate: Date;
currentActiveStartDate: Date | undefined;
currentActiveEndDate: Date | undefined;
isEventDetailsOpen: boolean;
currentSelectedEvent: EventInput;
groupId: string;
currentSelectedEvent: EventInput | undefined;
groupId: string | undefined;
tabType: TabType;
}
@ -31,8 +31,8 @@ enum TabType {
}
export default class GraphCalendar extends React.Component<IGraphCalendarProps, IGraphCalendarState> {
private calendar = createRef<FullCalendar>();
private calendarLang: string = null;
private calendar = React.createRef<FullCalendar>();
private calendarLang: string = '';
/**
* Builds the Component with the provided properties
@ -43,29 +43,37 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
// If this is running in Teams, embed the specific Teams styling
if (this._isRunningInTeams()) {
import("./GraphCalendar.Teams.module.scss");
import(/* webpackChunkName: 'LightTheme' */"./GraphCalendar.Teams.module.scss");
if (this.props.teamsContext.theme == "dark") {
import("./GraphCalendar.Teams.Dark.module.scss");
if (this.props.teamsContext.app.theme === "dark") {
import(/* webpackChunkName: 'DarkTheme' */"./GraphCalendar.Teams.Dark.module.scss");
}
}
//Set language of the calendar (if language is unknown, use english as default)
const allLanguages: Map<string, string> = this._createLangMap();
if (this._isRunningInTeams()) {
this.calendarLang = allLanguages.get(this.props.teamsContext.locale) || "en";
this.calendarLang = allLanguages.get(this.props.teamsContext.app.locale) || "en";
} else {
this.calendarLang = allLanguages.get(this.props.context.pageContext.cultureInfo.currentCultureName) || "en";
}
let resolvedGroupId = this.props.group && this.props.group.length ? this.props.group[0].id : "";
if (resolvedGroupId) {
const match = resolvedGroupId.match(/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/);
resolvedGroupId = match ? match[0] : '';
} else {
resolvedGroupId = this._isRunningInTeams() ? this.props.teamsContext.team?.groupId : this.props.context.pageContext.site.group ? this.props.context.pageContext.site.group.id : "";
}
this.state = {
events: [],
height: this._calculateHeight(),
currentActiveStartDate: null,
currentActiveEndDate: null,
currentActiveStartDate: undefined,
currentActiveEndDate: undefined,
isEventDetailsOpen: false,
currentSelectedEvent: null,
groupId: this._isRunningInTeams() ? this.props.teamsContext.groupId : this.props.context.pageContext.site.group ? this.props.context.pageContext.site.group.id : "",
currentSelectedEvent: undefined,
groupId: resolvedGroupId,
tabType: this._isRunningInTeams() ? (this._isPersonalTab() ? TabType.PersonalTab : TabType.TeamsTab) : TabType.TeamsTab
};
}
@ -75,25 +83,27 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
*/
public componentDidMount(): void {
// Gets the calendar current Active dates
let calendarStartDate = this.calendar.value.getApi().view.activeStart;
let calendarEndDate = this.calendar.value.getApi().view.activeEnd;
const calendarStartDate = this.calendar.current?.getApi().view.activeStart;
const calendarEndDate = this.calendar.current?.getApi().view.activeEnd;
// Loads the events
this._loadEvents(calendarStartDate, calendarEndDate);
if (calendarStartDate && calendarEndDate) {
// Loads the events
this._loadEvents(calendarStartDate, calendarEndDate);
}
}
/**
/**
* Renders the web part
*/
public render(): React.ReactElement<IGraphCalendarProps> {
public render(): React.ReactElement<IGraphCalendarProps> {
return (
<div className={styles.graphCalendar}>
<FullCalendar
ref={this.calendar}
defaultView="dayGridMonth"
initialView="dayGridMonth"
plugins={[dayGridPlugin]}
windowResize={this._handleResize.bind(this)}
datesRender={this._datesRender.bind(this)}
datesSet={this._datesRender.bind(this)}
eventClick={this._openEventPanel.bind(this)}
height={this.state.height}
events={this.state.events}
@ -111,16 +121,16 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
<span>{moment(this.state.currentSelectedEvent.start).format('MMMM Do YYYY [at] h:mm:ss a')}</span>
<h3>{strings.EndTime}</h3>
<span>{moment(this.state.currentSelectedEvent.end).format('MMMM Do YYYY [at] h:mm:ss a')}</span>
{this.state.currentSelectedEvent.extendedProps["location"] &&
{this.state.currentSelectedEvent.extendedProps && this.state.currentSelectedEvent.extendedProps.location &&
<div>
<h3>{strings.Location}</h3>
<span>{this.state.currentSelectedEvent.extendedProps["location"]}</span>
<span>{this.state.currentSelectedEvent.extendedProps.location}</span>
</div>
}
{this.state.currentSelectedEvent.extendedProps["body"] &&
{this.state.currentSelectedEvent.extendedProps && this.state.currentSelectedEvent.extendedProps.body &&
<div>
<h3>{strings.Body}</h3>
<span>{this.state.currentSelectedEvent.extendedProps["body"]}</span>
<span>{this.state.currentSelectedEvent.extendedProps.body}</span>
</div>
}
</Panel>
@ -128,7 +138,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
</div>
);
}
/**
* Calculates the dynamic height of the surface to render.
* Mainly used for Teams validation so it renders "full-screen" in Teams
@ -144,17 +154,17 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
/**
* Validates if the current web part is running in Teams
*/
private _isRunningInTeams() {
private _isRunningInTeams(): microsoftTeams.app.Context {
return this.props.teamsContext;
}
/**
* Validates if the current web part is running in a Personal Tab
*/
private _isPersonalTab() {
let _isPersonalTab: Boolean = false;
private _isPersonalTab(): boolean {
let _isPersonalTab: boolean = false;
if (this._isRunningInTeams() && !this.props.teamsContext.teamId) {
if (this._isRunningInTeams() && !this.props.teamsContext.team?.internalId) {
_isPersonalTab = true;
}
@ -165,7 +175,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
* Handles the click event and opens the OUIF Panel
* @param eventClickInfo The information about the selected event
*/
private _openEventPanel(eventClickInfo: any) {
private _openEventPanel(eventClickInfo: any): void {
this.setState({
isEventDetailsOpen: true,
currentSelectedEvent: eventClickInfo.event
@ -175,10 +185,10 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
/**
* Handles the click event on the dismiss from the Panel and closes the OUIF Panel
*/
private _closeEventPanel() {
private _closeEventPanel(): void {
this.setState({
isEventDetailsOpen: true,
currentSelectedEvent: null
currentSelectedEvent: undefined
});
}
@ -186,11 +196,11 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
* If the view changed, reload the events based on the active view
* @param info Information about the current active view
*/
private _datesRender(info: any) {
if (this.calendar.value) {
private _datesRender(info: any): void {
if (this.calendar.current) {
// If the active view has changed
if ((this.state.currentActiveStartDate && this.state.currentActiveEndDate) && this.state.currentActiveStartDate.toString() != info.view.activeStart.toString() && this.state.currentActiveEndDate.toString() != info.view.activeEnd.toString()) {
if ((this.state.currentActiveStartDate && this.state.currentActiveEndDate) && this.state.currentActiveStartDate.toString() !== info.view.activeStart.toString() && this.state.currentActiveEndDate.toString() !== info.view.activeEnd.toString()) {
this._loadEvents(info.view.activeStart, info.view.activeEnd);
}
}
@ -199,7 +209,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
/**
* Handles the resize event when in Microsoft Teams to ensure a proper responsive behaviour
*/
private _handleResize() {
private _handleResize(): void {
if (this._isRunningInTeams()) {
this.setState({
height: window.innerHeight - 30
@ -212,11 +222,11 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
* @param data Events from API
*/
private _transformEvents(data: any): Array<EventInput> {
let events: Array<EventInput> = new Array<EventInput>();
const events: Array<EventInput> = new Array<EventInput>();
data.value.map((item: any) => {
// Build a Timezone enabled Date
let currentStartDate = moment.tz(item.start.dateTime, item.start.timeZone);
let currentEndDate = moment.tz(item.end.dateTime, item.end.timeZone);
const currentStartDate = moment.tz(item.start.dateTime, item.start.timeZone);
const currentEndDate = moment.tz(item.end.dateTime, item.end.timeZone);
// Adding all retrieved events to the result array
events.push({
@ -245,23 +255,22 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
* @param endDate The last visible date on the calendar
*/
private _filterRecEvents(data: any, startDate: Date, endDate: Date): Array<EventInput> {
let events: Array<EventInput> = new Array<EventInput>();
const events: Array<EventInput> = new Array<EventInput>();
//Range of the Calendar
var r1 = range(startDate, endDate);
const r1 = range(startDate, endDate);
data.value.map((item: any) => {
// Build a Timezone enabled Date
let currentStartDate = moment.tz(item.start.dateTime, item.start.timeZone);
let currentEndDate = moment.tz(item.end.dateTime, item.end.timeZone);
const currentStartDate = moment.tz(item.start.dateTime, item.start.timeZone);
const currentEndDate = moment.tz(item.end.dateTime, item.end.timeZone);
var d1 = item.recurrence.range.startDate;
var d2 = item.recurrence.range.endDate;
var recStartDate = moment(d1).toDate();
var recEndDate = moment(d2).toDate();
const d1 = item.recurrence.range.startDate;
const d2 = item.recurrence.range.endDate;
const recStartDate = moment(d1).toDate();
const recEndDate = moment(d2).toDate();
//Range of the recurring event item
var r2 = range(recStartDate, recEndDate);
const r2 = range(recStartDate, recEndDate);
//Check if both ranges overlap
if (!!r1.overlaps(r2)) {
@ -291,12 +300,12 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
private _loadEvents(startDate: Date, endDate: Date): void {
// If a Group was found or running in the context of a Personal tab, execute the query. If not, do nothing.
if (this.state.groupId || this.state.tabType == TabType.PersonalTab) {
var events: Array<EventInput> = new Array<EventInput>();
if (this.state.groupId || this.state.tabType === TabType.PersonalTab) {
let events: Array<EventInput> = new Array<EventInput>();
this.props.context.msGraphClientFactory
.getClient()
.then((client: MSGraphClient): void => {
.getClient('3')
.then((client: MSGraphClientV3): void => {
let apiUrl: string = `/groups/${this.state.groupId}/events`;
if (this._isPersonalTab()) {
apiUrl = '/me/events';
@ -346,7 +355,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
this.setState({
currentActiveStartDate: startDate,
currentActiveEndDate: endDate,
currentSelectedEvent: null
currentSelectedEvent: undefined
});
});
});
@ -362,11 +371,11 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
private _getRecurrentEvents(events: Array<EventInput>, startDate: Date, endDate: Date): Promise<Array<EventInput>> {
return new Promise<Array<EventInput>>((resolve, reject) => {
this.props.context.msGraphClientFactory
.getClient()
.then((client: MSGraphClient): void => {
var recEvents: Array<EventInput> = new Array<EventInput>();
var count = 0;
events.map((item: any) => {
.getClient('3')
.then((client: MSGraphClientV3): void => {
let recEvents: Array<EventInput> = new Array<EventInput>();
let count = 0;
events.map((item: EventInput) => {
let apiUrl: string = `/groups/${this.state.groupId}/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`;
if (this._isPersonalTab()) {
apiUrl = `/me/events/${item.id}/instances?startDateTime=${startDate.toISOString()}&endDateTime=${endDate.toISOString()}`;
@ -381,7 +390,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
}
recEvents = recEvents.concat(this._transformEvents(res));
count += 1;
if (count == events.length) {
if (count === events.length) {
resolve(recEvents);
}
});
@ -400,8 +409,8 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
private _getRecurringMaster(startDate: Date, endDate: Date): Promise<Array<EventInput>> {
return new Promise<Array<EventInput>>((resolve, reject) => {
this.props.context.msGraphClientFactory
.getClient()
.then((client: MSGraphClient): void => {
.getClient('3')
.then((client: MSGraphClientV3): void => {
let apiUrl: string = `/groups/${this.state.groupId}/events`;
if (this._isPersonalTab()) {
apiUrl = '/me/events';
@ -416,7 +425,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
reject(err);
}
else {
var recEvents: Array<EventInput> = new Array<EventInput>();
let recEvents: Array<EventInput> = new Array<EventInput>();
recEvents = this._filterRecEvents(res, startDate, endDate);
resolve(recEvents);
}
@ -429,7 +438,7 @@ export default class GraphCalendar extends React.Component<IGraphCalendarProps,
* Mapping for SharePoint languages with Fullcalendar languages
*/
private _createLangMap(): Map<string, string> {
var languages = new Map();
const languages = new Map();
languages.set("en-US", "en"); //English
languages.set("ar-SA", "ar"); //Arabic

View File

@ -1,9 +1,14 @@
import { WebPartContext } from "@microsoft/sp-webpart-base";
import * as microsoftTeams from '@microsoft/teams-js';
import { IPropertyFieldGroupOrPerson } from "@pnp/spfx-property-controls";
export interface IGraphCalendarProps {
limit: number;
showRecurrence: boolean;
group: IPropertyFieldGroupOrPerson[];
isDarkTheme: boolean;
hasTeamsContext: boolean;
userDisplayName: string;
context: WebPartContext;
teamsContext: microsoftTeams.Context;
teamsContext: microsoftTeams.app.Context;
}

View File

@ -1,5 +1,5 @@
{
"extends": "./node_modules/@microsoft/rush-stack-compiler-2.9/includes/tsconfig-web.json",
"extends": "./node_modules/@microsoft/rush-stack-compiler-4.7/includes/tsconfig-web.json",
"compilerOptions": {
"target": "es5",
"forceConsistentCasingInFileNames": true,
@ -12,27 +12,24 @@
"skipLibCheck": true,
"outDir": "lib",
"inlineSources": false,
"strictNullChecks": false,
"noUnusedLocals": false,
"noImplicitAny": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules/@microsoft"
],
"types": [
"es6-promise",
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection"
"es2015.collection",
"es2015.promise"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"lib"
"src/**/*.ts",
"src/**/*.tsx"
]
}

View File

@ -1,30 +0,0 @@
{
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
"rules": {
"class-name": false,
"export-name": false,
"forin": false,
"label-position": false,
"member-access": true,
"no-arg": false,
"no-console": false,
"no-construct": false,
"no-duplicate-variable": true,
"no-eval": false,
"no-function-expression": true,
"no-internal-module": true,
"no-shadowed-variable": true,
"no-switch-case-fall-through": true,
"no-unnecessary-semicolons": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-with-statement": true,
"semicolon": true,
"trailing-comma": false,
"typedef": false,
"typedef-whitespace": false,
"use-named-parameter": true,
"variable-name": false,
"whitespace": false
}
}