Skip to content

Commit

Permalink
Merge branch 'main' into feat/bpm/react-custom-localization
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoabernier authored Jan 27, 2025
2 parents 64a95e8 + 8d71eee commit f22b8d8
Show file tree
Hide file tree
Showing 28 changed files with 17,089 additions and 39,576 deletions.
4 changes: 2 additions & 2 deletions .metadata/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -27567,7 +27567,7 @@
"This web part demonstrates Star Ratings capabilities to SharePoint News. The Ratings site collection feature provides Likes and Star Ratings, but SharePoint News provides only provides Likes. This web part can get or set ratings of the current page."
],
"creationDateTime": "2021-10-07",
"updateDateTime": "2023-11-09",
"updateDateTime": "2025-01-22",
"products": [
"SharePoint"
],
Expand All @@ -27578,7 +27578,7 @@
},
{
"key": "SPFX-VERSION",
"value": "1.18.0"
"value": "1.20.0"
}
],
"thumbnails": [
Expand Down
2 changes: 1 addition & 1 deletion samples/react-calendar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Each category has its own color that is generated in the load.

The Web Part checks the user's permissions for the View, Add, Edit, and Delete events.

![calendar](assets/react-calendar-categories.mp4)
![calendar](assets/react-calendar-categories.png)

![calendar](assets/animatevideo.gif)

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions samples/react-calendar/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
],
"thumbnails": [
{
"type": "video",
"type": "image",
"order": 100,
"url": "https://raw.githubusercontent.com/pnp/sp-dev-fx-webparts/refs/heads/main/samples/react-calendar/assets/react-calendar-categories.mp4",
"url": "raw.githubusercontent.com/pnp/sp-dev-fx-webparts/refs/heads/main/samples/react-calendar/assets/react-calendar-categories.png",
"alt": "Calendar"
},
{
Expand Down
45 changes: 25 additions & 20 deletions samples/react-calendar/src/controls/Event/event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -816,49 +816,56 @@ export class Event extends React.Component<IEventProps, IEventState> {
* @memberof Event
*/
private async returnExceptionRecurrenceInfo(recurrenceData: string) {
const parser = new XMLParser();
// Configure the XML parser
const parser = new XMLParser({
ignoreAttributes: false, // Include attributes in the parsed JSON
attributeNamePrefix: "", // Do not prefix attributes with @
isArray: (name) => ["rule", "repeat", "daily", "weekly", "monthly", "monthlyByDay", "yearly", "yearlyByDay"].includes(name), // Explicitly set nodes to be arrays
});

try {
// Parse the XML string into a JSON object
const promise = parser.parse(recurrenceData);

const recurrenceInfo: any = await promise;
if (recurrenceInfo != null) {
let keys = Object.keys(recurrenceInfo.recurrence.rule[0].repeat[0]);
// Parse the XML string
const recurrenceInfo: any = parser.parse(recurrenceData);

// Check if parsed data contains expected structure
if (recurrenceInfo?.recurrence?.rule?.[0]?.repeat?.[0]) {
// Access repeat keys
const repeat = recurrenceInfo.recurrence.rule[0].repeat[0];
const keys = Object.keys(repeat);

// Supported recurrence types
const recurrenceTypes = ["daily", "weekly", "monthly", "monthlyByDay", "yearly", "yearlyByDay"];
for (var key of keys) {
const rule = recurrenceInfo.recurrence.rule[0].repeat[0][key][0]['$'];

for (const key of keys) {
const rule = repeat[key]?.[0]?.["$"];
if (!rule) continue; // Skip if the rule is not present

switch (recurrenceTypes.indexOf(key)) {
case 0:
return this.parseDailyRule(rule);
break;
case 1:
return this.parseWeeklyRule(rule);
break;
case 2:
return this.parseMonthlyRule(rule);
break;
case 3:
return this.parseMonthlyByDayRule(rule);
break;
case 4:
return this.parseYearlyRule(rule);
break;
case 5:
return this.parseYearlyByDayRule(rule);
break;
default:
continue;
}
}
} else {
return "Invalid recurrence format";
}

} catch (error) {
// Handle parsing errors by rejecting the promise
// Handle parsing errors
throw new Error(`Error parsing recurrence data: ${error.message}`);
}
}


/**
*
*
Expand All @@ -868,8 +875,6 @@ export class Event extends React.Component<IEventProps, IEventState> {
*/
public async returnRecurrenceInfo(startDate: Date, recurrenceData: string) {
this.returnedRecurrenceInfo = { recurrenceData: recurrenceData, eventDate: startDate, endDate: moment().add(20, 'years').toDate() };
//this.setState({ editRecurrenceSeries:false})
//console.log(this.returnedRecurrenceInfo);
}


Expand Down
8 changes: 3 additions & 5 deletions samples/react-calendar/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
"webpack-env"
],
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.promise"
]
"es2016",
"dom"
],
},
"include": [
"src/**/*.ts",
Expand Down
6 changes: 3 additions & 3 deletions samples/react-carousel/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions samples/react-star-ratings/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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.18.0",
"image": "docker.io/m365pnp/spfx:1.18.0",
"name": "SPFx 1.20.0",
"image": "docker.io/m365pnp/spfx:1.20.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.
Expand Down
42 changes: 2 additions & 40 deletions samples/react-star-ratings/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,6 @@ module.exports = {
'@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,
Expand Down Expand Up @@ -85,12 +52,7 @@ module.exports = {
// 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,
{
"ignoreIIFE": true
}
],
'@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
Expand Down Expand Up @@ -354,4 +316,4 @@ module.exports = {
rules: {}
}
]
};
};
2 changes: 1 addition & 1 deletion samples/react-star-ratings/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.18.0
v18.20.6
6 changes: 3 additions & 3 deletions samples/react-star-ratings/.yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"@microsoft/generator-sharepoint": {
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "16.20.2",
"nodeVersion": "18.20.5",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
"@microsoft/teams-js": "2.24.0"
},
"version": "1.18.0",
"version": "1.20.0",
"libraryName": "ratings",
"libraryId": "1fac5bb8-6a05-4c52-aee3-496f6921ac1a",
"environment": "spo",
Expand Down
7 changes: 4 additions & 3 deletions samples/react-star-ratings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This web part demonstrates *Star Ratings* capabilities to SharePoint News. The "
| 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.18.0](https://img.shields.io/badge/SPFx-1.18.0-green.svg)
![Node.js v18 | v16](https://img.shields.io/badge/Node.js-v18%20%7C%20v16-green.svg)
![SPFx 1.20.0](https://img.shields.io/badge/SPFx-1.20.0-green.svg)
![Node.js v19 | v18](https://img.shields.io/badge/Node.js-v19%20%7C%20v18-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")
Expand Down Expand Up @@ -57,7 +57,8 @@ This web part demonstrates *Star Ratings* capabilities to SharePoint News. The "

Version|Date|Comments
-------|----|--------
1.4|November 9, 2023|Upgraded* to SPFx v1.18
1.5|January 23, 2025|Upgraded to SPFx v1.20 and changed to React Fluent UI v9.
1.4|November 9, 2023|Upgraded to SPFx v1.18
1.3|April 27, 2022|Changed to show averages with stars instead of user ratings.
1.2|March 28, 2022|Upgraded to SPFx v1.14
1.1|January 12, 2022|Updated to retrieve values from API
Expand Down
Binary file modified samples/react-star-ratings/assets/react-star-ratings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions samples/react-star-ratings/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"This web part demonstrates Star Ratings capabilities to SharePoint News. The Ratings site collection feature provides Likes and Star Ratings, but SharePoint News provides only provides Likes. This web part can get or set ratings of the current page."
],
"creationDateTime": "2021-10-07",
"updateDateTime": "2023-11-09",
"updateDateTime": "2025-01-22",
"products": [
"SharePoint"
],
Expand All @@ -20,7 +20,7 @@
},
{
"key": "SPFX-VERSION",
"value": "1.18.0"
"value": "1.20.0"
}
],
"thumbnails": [
Expand Down
3 changes: 2 additions & 1 deletion samples/react-star-ratings/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"externals": {},
"localizedResources": {
"RatingsWebPartStrings": "lib/webparts/ratings/loc/{locale}.js"
"RatingsWebPartStrings": "lib/webparts/ratings/loc/{locale}.js",
"ControlStrings": "node_modules/@pnp/spfx-controls-react/lib/loc/{locale}.js"
}
}
4 changes: 2 additions & 2 deletions samples/react-star-ratings/config/package-solution.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"solution": {
"name": "ratings",
"id": "1fac5bb8-6a05-4c52-aee3-496f6921ac1a",
"version": "1.4.0.0",
"version": "1.5.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
Expand All @@ -30,7 +30,7 @@
"title": "Ratings",
"description": "The feature that activates elements of the ratings solution.",
"id": "6f19fff7-a71c-47bd-a5d0-c1d6c147acae",
"version": "1.4.0.0"
"version": "1.5.0.0"
}
]
},
Expand Down
Loading

0 comments on commit f22b8d8

Please sign in to comment.