Skip to content

Commit

Permalink
Merge pull request #1157 from pnp/dev
Browse files Browse the repository at this point in the history
v3.7.0
  • Loading branch information
AJIXuMuK authored Mar 18, 2022
2 parents e082497 + d2c67e9 commit 582ca3f
Show file tree
Hide file tree
Showing 43 changed files with 40,321 additions and 5,170 deletions.
2 changes: 1 addition & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@microsoft/generator-sharepoint": {
"version": "1.13.1",
"version": "1.14.0",
"libraryName": "sp-dev-fx-controls-react",
"libraryId": "92b1e52c-a5fa-490a-bcf4-76080f39442c",
"environment": "spo",
Expand Down
29 changes: 28 additions & 1 deletion CHANGELOG.JSON
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
{
"versions": [
{
"version": "3.7.0",
"changes": {
"new": [
"`VariantThemeProvider`: new `VariantThemeProvider` control [#1120](https://github.com/pnp/sp-dev-fx-controls-react/issues/1120)",
"`MonacoEditor`: new `MonacoEditor` control [#1134](https://github.com/pnp/sp-dev-fx-controls-react/pull/1134)"
],
"enhancements": [
"`Carousel`: Prev and Next Buttons are not labeled, and read as 'Unlabeled button' by screen readers [#1137](https://github.com/pnp/sp-dev-fx-controls-react/issues/1137)",
"`TreeView`: Ability to set keys of items that should be expanded by default [#1084](https://github.com/pnp/sp-dev-fx-controls-react/pull/1084)",
"SharePoint Framework v1.14.0 support"
],
"fixes": [
"`FilePicker`: `defaultFolderAbsolutePath` doesn't work with `webAbsoluteUrl` [#1129](https://github.com/pnp/sp-dev-fx-controls-react/issues/1129)",
"`LocationPicker`: Location picker not resolving locations [#1149](https://github.com/pnp/sp-dev-fx-controls-react/issues/1149)",
"`DynamicForm`: `RichText` Field losing focus on typing [#1024](https://github.com/pnp/sp-dev-fx-controls-react/issues/1024)",
"`LivePersona`: Documentation fix for `template` type [#1147](https://github.com/pnp/sp-dev-fx-controls-react/pull/1147)"
]
},
"contributors": [
"[Amir Msai](https://github.com/amirmsai)",
"[Fabio Franzini](https://github.com/fabiofranzini)",
"[João Mendes](https://github.com/joaojmendes)",
"[Mathijs Verbeeck](https://github.com/MathijsVerbeeck)",
"[Rolands Strakis](https://github.com/wonderplayer)",
"[Won Song](https://github.com/WonSong)"
]
},
{
"version": "3.6.0",
"changes": {
Expand All @@ -13,7 +41,6 @@
"`FilePicker`: ability to allow external link and disable file existance chech [commit](https://github.com/pnp/sp-dev-fx-controls-react/commit/41ed4dd2277cf33050f9aeffe743dd684ed9d782)",
"`FilePicker`: support for multi-select on additional sources [#1047](https://github.com/pnp/sp-dev-fx-controls-react/pull/1047)",
"`DateTimePicker`: new property for allowTextInput [#1094](https://github.com/pnp/sp-dev-fx-controls-react/issues/1094)"

],
"fixes": [
"`LivePersona`: Cannot find module '@pnp/spfx-controls-react/lib/LivePersona'[#1069](https://github.com/pnp/sp-dev-fx-controls-react/issues/1069)",
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Releases

## 3.7.0

### New control(s)

- `VariantThemeProvider`: new `VariantThemeProvider` control [#1120](https://github.com/pnp/sp-dev-fx-controls-react/issues/1120)
- `MonacoEditor`: new `MonacoEditor` control [#1134](https://github.com/pnp/sp-dev-fx-controls-react/pull/1134)

### Enhancements

- `Carousel`: Prev and Next Buttons are not labeled, and read as 'Unlabeled button' by screen readers [#1137](https://github.com/pnp/sp-dev-fx-controls-react/issues/1137)
- `TreeView`: Ability to set keys of items that should be expanded by default [#1084](https://github.com/pnp/sp-dev-fx-controls-react/pull/1084)
- SharePoint Framework v1.14.0 support

### Fixes

- `FilePicker`: `defaultFolderAbsolutePath` doesn't work with `webAbsoluteUrl` [#1129](https://github.com/pnp/sp-dev-fx-controls-react/issues/1129)
- `LocationPicker`: Location picker not resolving locations [#1149](https://github.com/pnp/sp-dev-fx-controls-react/issues/1149)
- `DynamicForm`: `RichText` Field losing focus on typing [#1024](https://github.com/pnp/sp-dev-fx-controls-react/issues/1024)
- `LivePersona`: Documentation fix for `template` type [#1147](https://github.com/pnp/sp-dev-fx-controls-react/pull/1147)

## 3.6.0

### New control(s)
Expand Down
20 changes: 20 additions & 0 deletions docs/documentation/docs/about/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Releases

## 3.7.0

### New control(s)

- `VariantThemeProvider`: new `VariantThemeProvider` control [#1120](https://github.com/pnp/sp-dev-fx-controls-react/issues/1120)
- `MonacoEditor`: new `MonacoEditor` control [#1134](https://github.com/pnp/sp-dev-fx-controls-react/pull/1134)

### Enhancements

- `Carousel`: Prev and Next Buttons are not labeled, and read as 'Unlabeled button' by screen readers [#1137](https://github.com/pnp/sp-dev-fx-controls-react/issues/1137)
- `TreeView`: Ability to set keys of items that should be expanded by default [#1084](https://github.com/pnp/sp-dev-fx-controls-react/pull/1084)
- SharePoint Framework v1.14.0 support

### Fixes

- `FilePicker`: `defaultFolderAbsolutePath` doesn't work with `webAbsoluteUrl` [#1129](https://github.com/pnp/sp-dev-fx-controls-react/issues/1129)
- `LocationPicker`: Location picker not resolving locations [#1149](https://github.com/pnp/sp-dev-fx-controls-react/issues/1149)
- `DynamicForm`: `RichText` Field losing focus on typing [#1024](https://github.com/pnp/sp-dev-fx-controls-react/issues/1024)
- `LivePersona`: Documentation fix for `template` type [#1147](https://github.com/pnp/sp-dev-fx-controls-react/pull/1147)

## 3.6.0

### New control(s)
Expand Down
Binary file added docs/documentation/docs/assets/MonacoEditor1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/documentation/docs/assets/MonacoEditor2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/documentation/docs/controls/Carousel.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ The Carousel component can be configured with the following properties:
| indicatorsDisplay | CarouselIndicatorsDisplay | no | Specifies display mode of the indicators. Default value `overlap`. |
| rootStyles | ICssInput | no | Allows to specify own styles for root element |
| indicatorsContainerStyles | ICssInput | no | Allows to specify own styles for indicators container when indicatorsDisplay is set to "block" |
| prevButtonAriaLabel | string | no | Aria label of the PreviousItem button. Default 'Previous item'. |
| nextButtonAriaLabel | string | no | Aria label of the NextItem button. Default 'Next item'. |

enum `CarouselButtonsLocation`

Expand Down
2 changes: 1 addition & 1 deletion docs/documentation/docs/controls/LivePersona.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ The `LivePersona` control can be configured with the following properties:
| serviceScope | ServiceScope | yes | The SPFx ServiceScope object loaded from context of web part or extension. |
| upn |string | yes | User UPN. |
| disableHover | boolean | no | If info should not appear on hover. |
| template | string | JSX.ELement | yes | The content to wrap with persona info. |
| template | string \| JSX.Element | yes | The content to wrap with persona info. |
54 changes: 54 additions & 0 deletions docs/documentation/docs/controls/MonacoEditor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Monaco Editor control

This control is a implementatiopn of Monaco Editor.

Here is an example of the control:

![monacoeditor](../assets/MonacoEditor1.png)

`MonacoEditor` dark theme:

![monacoeditor](../assets/MonacoEditor2.png)


## How to use this control in your solutions

- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency.
- Import the control into your component:

```TypeScript
import { MonacoEditor } from "@pnp/spfx-controls-react/lib/MonacoEditor";
```

- Use the `MonacoEditor` control in your code as follows:

```TypeScript
<MonacoEditor value={defaultValue}
showMiniMap={true}
onValueChange={onValueChange}
language={"javascript"}/>
```

- The `onValueChange` change event returns the upadated code and array with messages of errors on validation and can be implemented as follows:
**this validation is done only to JSON language

```TypeScript
const onValueChange = React.useCallback((newValue: string, validationErrors: string[]): void => {console.log(newValue);} , []);
```

## Implementation

The `MonacoEditor` control can be configured with the following properties:

| Property | Type | Required | Description |
| ---- | ---- | ---- | ---- |
| value | string | yes | default content for editor |
| theme | string | no | theme used by editor , two themes are supported 'vs' and 'vs-dark', default 'vs' |
| readOnly | boolean | no | indecate if editor is in read only mode |
| showLineNumbers | boolean | no | editor show linenumber or not, default : yes|
| onValueChange |(newValue:string, validationErrors:string[]) => void | no | function to get code changes, return an array with validation error in case of language is 'JSON' |
| language |string | yes | editor code language, please see https://microsoft.github.io/monaco-editor/index.html for supported languages|
| jsonDiagnosticsOptions |monaco.languages.json.DiagnosticsOptions | no | define options to JSON validation, please see https://microsoft.github.io/monaco-editor/index.html for more details |
| jscriptDiagnosticsOptions | monaco.languages.typescript.DiagnosticsOptions | no | define options to javascript or typescript validation, please see https://microsoft.github.io/monaco-editor/index.html for more details |


1 change: 1 addition & 0 deletions docs/documentation/docs/controls/TreeView.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ The `TreeView` control can be configured with the following properties:
| onSelect | function | no | Captures the event of when the tree item selection has changed. |
| onRenderItem | function | no | Optional callback to provide custom rendering of the item (default is simple text of item label and a checkbox for selection). |
| defaultExpandedChildren | boolean | no | Default expand / collapse behavior for the child nodes. By default this is set to true. |
| defaultExpandedKeys | string[] | no | Keys of items expanded by default. |
Enum `TreeViewSelectionMode`
Expand Down
80 changes: 80 additions & 0 deletions docs/documentation/docs/controls/VariantThemeProvider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Variant Theme Provider

This control is a super set of the Theme Provider control, which not only allows you to pass the FluentUI Theme to the child controls, but also allows you to apply "variants" or generate a theme starting from the three basic colors, primary color, text color and color background.

The idea comes from the possibility of "highlighting" a Web Part in the page or section where it is contained.

By default, the SharePoint Modern Pages allow to change the set of colors which are then applied to all controls, but this can only be done at the site level (changing the site theme) or at the page section level (applying variations from the site theme).

With this control we have the possibility to apply the variants to the single Web Part or to a portion of it.

Here is an example of the control in action inside a Web Part:

![Variant Theme Provider control](../assets/VariantThemeProvider.gif)

## How to use this control in your solutions

- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../../#getting-started) page for more information about installing the dependency.
- In your component file, import the `VariantThemeProvider` control as follows:

```TypeScript
import { VariantThemeProvider, VariantType, IThemeColors } from "@pnp/spfx-controls-react/lib/VariantThemeProvider";
```

- Example on use the `VariantThemeProvider` control with the 'Neutral' variant on custom theme generated from the 'themeColors' property:

```TSX
const customThemeColors: IThemeColors = {
primaryColor: "#0078d4",
textColor: "#323130",
backgroundColor: "#ffffff"
}
<VariantThemeProvider
themeColors={customThemeColors}
variantType={VariantType.Neutral}>
{/* Child controls */}
</VariantThemeProvider>
```

- Example on use the `VariantThemeProvider` control with the 'Strong' variant on theme passed with the from the 'theme' property:

```TSX
<VariantThemeProvider
theme={theme}
variantType={VariantType.Strong}>
{/* Child controls */}
</VariantThemeProvider>
```

## Implementation

The `VariantThemeProvider` control can be configured with the following properties (inherits all the properties present in the FluentUI ThemeProvider control):

| Property | Type | Required | Description |
| ---- | ---- | ---- | ---- |
| as | React.ElementType | no | A component that should be used as the root element of the ThemeProvider component. |
| ref | React.Ref<HTMLElement> | no | Optional ref to the root element. |
| theme | PartialTheme \| Theme | no | Defines the theme provided by the user. |
| renderer | StyleRenderer | no | Optional interface for registering dynamic styles. Defaults to using `merge-styles`. Use this to opt into a particular rendering implementation, such as `emotion`, `styled-components`, or `jss`. Note: performance will differ between all renders. Please measure your scenarios before using an alternative implementation. |
| applyTo | element \| body \| none | no | Defines where body-related theme is applied to. Setting to 'element' will apply body styles to the root element of this control. Setting to 'body' will apply body styles to document body. Setting to 'none' will not apply body styles to either element or body. |
| variantType | VariantType | no | Variant type to apply to the theme. |
| themeColors | IThemeColors | no | Object used to generate a new theme from colors. |

Interface `IThemeColors`

| Property | Type | Required | Description |
| ---- | ---- | ---- | ---- |
| primaryColor | string | yes | Primary Color of the theme. |
| textColor | string | yes | Text Color of the theme. |
| backgroundColor | string | yes | Background Color of the theme. |

Enum `VariantType`

| Type | Description |
| ---- | ---- |
| None | Apply the theme without variations. |
| Neutral | Apply the 'Neutral' variation to the theme. |
| Soft | Apply the 'Soft' variation to the theme. |
| Strong | Apply the 'Strong' variation to the theme. |

![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/VariantThemeProvider)
Loading

0 comments on commit 582ca3f

Please sign in to comment.