@pnp/spfx-controls-react 3.6.0-beta.1819521 → 3.7.0-beta.1834399
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.JSON +13 -2
- package/CHANGELOG.md +10 -1
- package/lib/AdaptiveCardHost.d.ts +2 -0
- package/lib/AdaptiveCardHost.d.ts.map +1 -0
- package/lib/AdaptiveCardHost.js +2 -0
- package/lib/AdaptiveCardHost.js.map +1 -0
- package/lib/common/telemetry/version.js +1 -1
- package/lib/controls/adaptiveCardHost/AdaptiveCardHost.css +142 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHost.d.ts +4 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHost.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHost.js +198 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHost.js.map +1 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.d.ts +10 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.js +1005 -0
- package/lib/controls/adaptiveCardHost/AdaptiveCardHostHelpers.js.map +1 -0
- package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.d.ts +96 -0
- package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.js +8 -0
- package/lib/controls/adaptiveCardHost/IAdaptiveCardHostProps.js.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Actions.d.ts +27 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Actions.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Actions.js +172 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Actions.js.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Elements.d.ts +145 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Elements.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Elements.js +706 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Elements.js.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.d.ts +11 -0
- package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.js +75 -0
- package/lib/controls/adaptiveCardHost/fluentUI/FluentUI.js.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Shared.d.ts +3 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Shared.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Shared.js +8 -0
- package/lib/controls/adaptiveCardHost/fluentUI/Shared.js.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/index.d.ts +5 -0
- package/lib/controls/adaptiveCardHost/fluentUI/index.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/fluentUI/index.js +5 -0
- package/lib/controls/adaptiveCardHost/fluentUI/index.js.map +1 -0
- package/lib/controls/adaptiveCardHost/index.d.ts +5 -0
- package/lib/controls/adaptiveCardHost/index.d.ts.map +1 -0
- package/lib/controls/adaptiveCardHost/index.js +5 -0
- package/lib/controls/adaptiveCardHost/index.js.map +1 -0
- package/lib/controls/adaptiveCardHost/themes/redPalette.json +24 -0
- package/lib/controls/adaptiveCardHost/themes/teamsDarkPalette.json +24 -0
- package/lib/controls/adaptiveCardHost/themes/teamsDefaultPalette.json +24 -0
- package/lib/controls/adaptiveCardHost/themes/teamsHighContrastPalette.json +24 -0
- package/package.json +7 -1
- package/release/webpack-stats/sp-dev-fx-controls-react.stats.json +110383 -28986
package/CHANGELOG.JSON
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"versions": [
|
|
3
3
|
{
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.7.0",
|
|
5
5
|
"changes": {
|
|
6
6
|
"new": [],
|
|
7
|
+
"enhancements": [],
|
|
8
|
+
"fixes": []
|
|
9
|
+
},
|
|
10
|
+
"contributors": []
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"version": "3.6.0",
|
|
14
|
+
"changes": {
|
|
15
|
+
"new": [
|
|
16
|
+
"`AdaptiveCardHost`: React control that allows you to render an Adaptive Card as a component [#1096](https://github.com/pnp/sp-dev-fx-controls-react/issues/1096)"
|
|
17
|
+
],
|
|
7
18
|
"enhancements": [
|
|
8
19
|
"`ModernTaxonomyPicker`: ability to add action buttons to terms [#1058](https://github.com/pnp/sp-dev-fx-controls-react/pull/1058)",
|
|
9
20
|
"`FilePicker`: allow to select files from other sites [#907](https://github.com/pnp/sp-dev-fx-controls-react/issues/907)",
|
|
@@ -11,7 +22,6 @@
|
|
|
11
22
|
"`FilePicker`: ability to allow external link and disable file existance chech [commit](https://github.com/pnp/sp-dev-fx-controls-react/commit/41ed4dd2277cf33050f9aeffe743dd684ed9d782)",
|
|
12
23
|
"`FilePicker`: support for multi-select on additional sources [#1047](https://github.com/pnp/sp-dev-fx-controls-react/pull/1047)",
|
|
13
24
|
"`DateTimePicker`: new property for allowTextInput [#1094](https://github.com/pnp/sp-dev-fx-controls-react/issues/1094)"
|
|
14
|
-
|
|
15
25
|
],
|
|
16
26
|
"fixes": [
|
|
17
27
|
"`LivePersona`: Cannot find module '@pnp/spfx-controls-react/lib/LivePersona'[#1069](https://github.com/pnp/sp-dev-fx-controls-react/issues/1069)",
|
|
@@ -30,6 +40,7 @@
|
|
|
30
40
|
"contributions": [
|
|
31
41
|
"[Alexander M](https://github.com/alexanmo)",
|
|
32
42
|
"[Carlos Marins Jr](https://github.com/kadu-jr)",
|
|
43
|
+
"[Fabio Franzini](https://github.com/fabiofranzini)",
|
|
33
44
|
"[Henrik](https://github.com/Henke-visual)",
|
|
34
45
|
"[Jasey Waegebaert](https://github.com/Jwaegebaert)",
|
|
35
46
|
"[João Mendes](https://github.com/joaojmendes)",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## 3.7.0
|
|
4
|
+
|
|
3
5
|
## 3.6.0
|
|
4
6
|
|
|
7
|
+
### New control(s)
|
|
8
|
+
|
|
9
|
+
- `AdaptiveCardHost`: React control that allows you to render an Adaptive Card as a component [#1096](https://github.com/pnp/sp-dev-fx-controls-react/issues/1096)
|
|
10
|
+
|
|
5
11
|
### Enhancements
|
|
6
12
|
|
|
7
13
|
- `ModernTaxonomyPicker`: ability to add action buttons to terms [#1058](https://github.com/pnp/sp-dev-fx-controls-react/pull/1058)
|
|
8
14
|
- `FilePicker`: allow to select files from other sites [#907](https://github.com/pnp/sp-dev-fx-controls-react/issues/907)
|
|
9
15
|
- `Localization`: Update Swedish translations [#1099](https://github.com/pnp/sp-dev-fx-controls-react/pull/1099)
|
|
10
16
|
- `FilePicker`: ability to allow external link and disable file existance chech [commit](https://github.com/pnp/sp-dev-fx-controls-react/commit/41ed4dd2277cf33050f9aeffe743dd684ed9d782)
|
|
17
|
+
- `FilePicker`: support for multi-select on additional sources [#1047](https://github.com/pnp/sp-dev-fx-controls-react/pull/1047)
|
|
18
|
+
- `DateTimePicker`: new property for allowTextInput [#1094](https://github.com/pnp/sp-dev-fx-controls-react/issues/1094)
|
|
11
19
|
|
|
12
20
|
### Fixes
|
|
13
21
|
|
|
@@ -20,11 +28,12 @@
|
|
|
20
28
|
- `TaxonomyPicker`: table markdown fix in documentation [#1072](https://github.com/pnp/sp-dev-fx-controls-react/pull/1072)
|
|
21
29
|
- `WebPartTitle`: Fix for styling of WebPartTitle to better match the styling of the oob webpart titles. [#1088](https://github.com/pnp/sp-dev-fx-controls-react/pull/1088)
|
|
22
30
|
- `LivePersona`: fix for documentation typos [#1106](https://github.com/pnp/sp-dev-fx-controls-react/pull/1106)
|
|
31
|
+
- `LivePersona`: remove property for SPFx context [#1108](https://github.com/pnp/sp-dev-fx-controls-react/pull/1108)
|
|
23
32
|
- Documentation fix for swedish translations [#1100](https://github.com/pnp/sp-dev-fx-controls-react/pull/1100)
|
|
24
33
|
|
|
25
34
|
### Contributors
|
|
26
35
|
|
|
27
|
-
Special thanks to our contributors (in alphabetical order): [Alexander M](https://github.com/alexanmo), [Carlos Marins Jr](https://github.com/kadu-jr), [Henrik](https://github.com/Henke-visual), [Jasey Waegebaert](https://github.com/Jwaegebaert), [Milan Holemans](https://github.com/milanholemans), [Patrik Hellgren](https://github.com/patrikhellgren), [Tom G](https://github.com/t0mgerman).
|
|
36
|
+
Special thanks to our contributors (in alphabetical order): [Alexander M](https://github.com/alexanmo), [Carlos Marins Jr](https://github.com/kadu-jr), [Fabio Franzini](https://github.com/fabiofranzini), [Henrik](https://github.com/Henke-visual), [Jasey Waegebaert](https://github.com/Jwaegebaert), [João Mendes](https://github.com/joaojmendes), [Milan Holemans](https://github.com/milanholemans), [MonalisaBaltatescu](https://github.com/MonalisaBaltatescu), [Patrik Hellgren](https://github.com/patrikhellgren), [Tom G](https://github.com/t0mgerman).
|
|
28
37
|
|
|
29
38
|
## 3.5.0
|
|
30
39
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveCardHost.d.ts","sourceRoot":"","sources":["../src/AdaptiveCardHost.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveCardHost.js","sourceRoot":"","sources":["../src/AdaptiveCardHost.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var version = "3.
|
|
1
|
+
export var version = "3.7.0-beta.1834399";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
.ac-container:focus:focus,
|
|
2
|
+
.ac-adaptiveCard:focus {
|
|
3
|
+
outline: none !important;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ac-pushButton {
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
text-align: center;
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
font-family: inherit;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
padding: 4px 10px 5px 10px;
|
|
16
|
+
-webkit-user-select: none;
|
|
17
|
+
-moz-user-select: none;
|
|
18
|
+
-ms-user-select: none;
|
|
19
|
+
user-select: none;
|
|
20
|
+
height: 32px;
|
|
21
|
+
border-radius: 2px;
|
|
22
|
+
border: 1px solid var(--ach-fui-buttonBorder);
|
|
23
|
+
background-color: var(--ach-fui-buttonBackground);
|
|
24
|
+
color: var(--ach-fui-buttonText);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ac-pushButton-disabled {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
text-align: center;
|
|
31
|
+
vertical-align: middle;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
font-family: inherit;
|
|
34
|
+
font-size: 14px;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
padding: 4px 10px 5px 10px;
|
|
37
|
+
-webkit-user-select: none;
|
|
38
|
+
-moz-user-select: none;
|
|
39
|
+
-ms-user-select: none;
|
|
40
|
+
user-select: none;
|
|
41
|
+
height: 32px;
|
|
42
|
+
border-radius: 2px;
|
|
43
|
+
border: 1px solid var(--ach-fui-buttonBorderDisabled);
|
|
44
|
+
background-color: var(--ach-fui-buttonBackgroundDisabled);
|
|
45
|
+
color: var(--ach-fui-buttonTextDisabled);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ac-pushButton:hover {
|
|
49
|
+
border: 1px solid var(--ach-fui-buttonBorder);
|
|
50
|
+
background-color: var(--ach-fui-buttonBackgroundHovered);
|
|
51
|
+
color: var(--ach-fui-buttonTextHovered);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ac-pushButton:active {
|
|
55
|
+
background-color: var(--ach-fui-buttonBackgroundPressed);
|
|
56
|
+
color: var(--ach-fui-buttonTextPressed);
|
|
57
|
+
border: 1px solid var(--ach-fui-buttonBorder);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ac-ctrl-overlay {
|
|
61
|
+
font-family: var(--ach-fui-fontFamily);
|
|
62
|
+
position: absolute;
|
|
63
|
+
left: 0;
|
|
64
|
+
top: 0;
|
|
65
|
+
z-index: 10000;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ac-ctrl {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
font-weight: normal;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ac-ctrl-popup-container {
|
|
75
|
+
background-color: var(--ach-fui-bodyBackground);
|
|
76
|
+
position: absolute;
|
|
77
|
+
overflow-y: auto;
|
|
78
|
+
box-shadow: rgb(0 0 0 / 13%) 0px 3.2px 7.2px 0px, rgb(0 0 0 / 11%) 0px 0.6px 1.8px 0px;
|
|
79
|
+
border-radius: 2px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ac-ctrl-popup-container:focus {
|
|
83
|
+
outline: 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ac-ctrl-slide {
|
|
87
|
+
animation-duration: 0.5s;
|
|
88
|
+
animation-timing-function: cubic-bezier(0.1, 0.9, 0.2, 1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ac-ctrl-slide.ac-ctrl-slideTopToBottom {
|
|
92
|
+
animation-name: fadeIn, slideTopToBottom;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ac-ctrl-slide.ac-ctrl-slideBottomToTop {
|
|
96
|
+
animation-name: fadeIn, slideBottomToTop;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ac-ctrl-slide.ac-ctrl-slideLeftToRight {
|
|
100
|
+
animation-name: fadeIn, slideLeftToRight;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ac-ctrl-slide.ac-ctrl-slideRightToLeft {
|
|
104
|
+
animation-name: fadeIn, slideRightToLeft;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ac-ctrl-dropdown-item {
|
|
108
|
+
width: 100%;
|
|
109
|
+
text-overflow: ellipsis;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
display: block;
|
|
113
|
+
padding: 0px 12px 0px 12px;
|
|
114
|
+
line-height: 30px;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
background-color: var(--ach-fui-bodyBackground);
|
|
117
|
+
color: var(--ach-fui-bodyText);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ac-ctrl-dropdown-item-disabled {
|
|
121
|
+
width: 100%;
|
|
122
|
+
text-overflow: ellipsis;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
display: block;
|
|
126
|
+
padding: 0px 12px 0px 12px;
|
|
127
|
+
line-height: 30px;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
background-color: var(--ach-fui-neutralLighter);
|
|
130
|
+
color: var(--ach-fui-neutralTertiary);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.ac-ctrl-dropdown-item:hover {
|
|
134
|
+
background-color: var(--ach-fui-neutralLighter);
|
|
135
|
+
color: var(--ach-fui-neutralDark);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ac-ctrl-dropdown-item:focus {
|
|
139
|
+
outline: 0;
|
|
140
|
+
background-color: var(--ach-fui-neutralLight);
|
|
141
|
+
color: var(--ach-fui-neutralDark);
|
|
142
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveCardHost.d.ts","sourceRoot":"","sources":["../../../src/controls/adaptiveCardHost/AdaptiveCardHost.tsx"],"names":[],"mappings":"AAaA,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAA4D,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAK5H,eAAO,MAAM,gBAAgB,UAAW,sBAAsB,gBAqN7D,CAAC"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { ThemeProvider } from '@fluentui/react-theme-provider';
|
|
2
|
+
import { AdaptiveCard, CardObjectRegistry, ExecuteAction, GlobalRegistry, HostConfig, OpenUrlAction, SerializationContext, SubmitAction } from 'adaptivecards';
|
|
3
|
+
import { Template } from 'adaptivecards-templating';
|
|
4
|
+
import { CustomizerContext } from 'office-ui-fabric-react/lib/Utilities';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
import './AdaptiveCardHost.css';
|
|
8
|
+
import { convertFromPartialThemeToTheme, createDarkTeamsHostConfig, createDefaultTeamsHostConfig, createHighContrastTeamsHostConfig, createSharePointHostConfig, initProcessMarkdown, setFluentUIThemeAsCSSVariables } from './AdaptiveCardHostHelpers';
|
|
9
|
+
import { createDarkTeamsTheme, createDefaultTeamsTheme, createHighContrastTeamsTheme, getDefaultFluentUITheme, setFluentUIThemeAsHostCapability, useLocalFluentUI } from './fluentUI';
|
|
10
|
+
import { AdaptiveCardHostThemeType } from './IAdaptiveCardHostProps';
|
|
11
|
+
// Init Process Markdown
|
|
12
|
+
initProcessMarkdown();
|
|
13
|
+
export var AdaptiveCardHost = function (props) {
|
|
14
|
+
var adaptiveCardInstanceRef = useRef(null);
|
|
15
|
+
var serializationContextInstanceRef = useRef(null);
|
|
16
|
+
var fluentUIThemeInstanceRef = useRef(null);
|
|
17
|
+
var renderElementRef = useRef(null);
|
|
18
|
+
var fluentUICustomizerContext = React.useContext(CustomizerContext);
|
|
19
|
+
// create the instance of AdaptiveCard & SerializationContext
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
adaptiveCardInstanceRef.current = new AdaptiveCard();
|
|
22
|
+
serializationContextInstanceRef.current = new SerializationContext();
|
|
23
|
+
}, [props.card, props.onSetCustomElements, props.onSetCustomActions, props.onUpdateHostCapabilities]);
|
|
24
|
+
// *****
|
|
25
|
+
// create executeAction
|
|
26
|
+
var invokeAction = useCallback(function (action) {
|
|
27
|
+
if (props.onInvokeAction) {
|
|
28
|
+
var actionResult = void 0;
|
|
29
|
+
var type = action.getJsonTypeName();
|
|
30
|
+
switch (type) {
|
|
31
|
+
case OpenUrlAction.JsonTypeName:
|
|
32
|
+
{
|
|
33
|
+
var typedAction = action;
|
|
34
|
+
actionResult = {
|
|
35
|
+
type: type,
|
|
36
|
+
title: typedAction.title,
|
|
37
|
+
url: typedAction.url
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
case SubmitAction.JsonTypeName:
|
|
42
|
+
{
|
|
43
|
+
var typedAction = action;
|
|
44
|
+
actionResult = {
|
|
45
|
+
type: type,
|
|
46
|
+
title: typedAction.title,
|
|
47
|
+
data: typedAction.data
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case ExecuteAction.JsonTypeName:
|
|
52
|
+
{
|
|
53
|
+
var typedAction = action;
|
|
54
|
+
actionResult = {
|
|
55
|
+
type: type,
|
|
56
|
+
title: typedAction.title,
|
|
57
|
+
data: typedAction.data,
|
|
58
|
+
verb: typedAction.verb
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
props.onInvokeAction(actionResult);
|
|
64
|
+
}
|
|
65
|
+
}, [props.onInvokeAction]);
|
|
66
|
+
// *****
|
|
67
|
+
// set hostConfig
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
var theme;
|
|
70
|
+
var themeType = props.themeType;
|
|
71
|
+
if (!themeType) {
|
|
72
|
+
themeType = AdaptiveCardHostThemeType.SharePoint;
|
|
73
|
+
}
|
|
74
|
+
switch (themeType) {
|
|
75
|
+
case AdaptiveCardHostThemeType.SharePoint:
|
|
76
|
+
{
|
|
77
|
+
var contextTheme = fluentUICustomizerContext.customizations.settings["theme"];
|
|
78
|
+
if (props.theme) {
|
|
79
|
+
theme = props.theme;
|
|
80
|
+
}
|
|
81
|
+
else if (contextTheme) {
|
|
82
|
+
theme = contextTheme;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
theme = getDefaultFluentUITheme();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case AdaptiveCardHostThemeType.Teams:
|
|
90
|
+
{
|
|
91
|
+
theme = createDefaultTeamsTheme();
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
case AdaptiveCardHostThemeType.TeamsDark:
|
|
95
|
+
{
|
|
96
|
+
theme = createDarkTeamsTheme();
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case AdaptiveCardHostThemeType.TeamsHighContrast:
|
|
100
|
+
{
|
|
101
|
+
theme = createHighContrastTeamsTheme();
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
var currentTheme = convertFromPartialThemeToTheme(theme);
|
|
106
|
+
fluentUIThemeInstanceRef.current = currentTheme;
|
|
107
|
+
var hostConfig = props.hostConfig;
|
|
108
|
+
if (!hostConfig) {
|
|
109
|
+
switch (themeType) {
|
|
110
|
+
case AdaptiveCardHostThemeType.SharePoint:
|
|
111
|
+
{
|
|
112
|
+
hostConfig = createSharePointHostConfig(currentTheme);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case AdaptiveCardHostThemeType.Teams:
|
|
116
|
+
{
|
|
117
|
+
hostConfig = createDefaultTeamsHostConfig(currentTheme);
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case AdaptiveCardHostThemeType.TeamsDark:
|
|
121
|
+
{
|
|
122
|
+
hostConfig = createDarkTeamsHostConfig(currentTheme);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
case AdaptiveCardHostThemeType.TeamsHighContrast:
|
|
126
|
+
{
|
|
127
|
+
hostConfig = createHighContrastTeamsHostConfig(currentTheme);
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
var currentHostConfig = new HostConfig(hostConfig);
|
|
133
|
+
adaptiveCardInstanceRef.current.hostConfig = currentHostConfig;
|
|
134
|
+
setFluentUIThemeAsHostCapability(currentHostConfig, currentTheme);
|
|
135
|
+
if (props.onUpdateHostCapabilities) {
|
|
136
|
+
props.onUpdateHostCapabilities(currentHostConfig.hostCapabilities);
|
|
137
|
+
}
|
|
138
|
+
setFluentUIThemeAsCSSVariables(renderElementRef.current, theme);
|
|
139
|
+
// just to fix the colors of the list actions menu
|
|
140
|
+
setFluentUIThemeAsCSSVariables(document.body, (props.isUniqueControlInPage) ? theme : getDefaultFluentUITheme());
|
|
141
|
+
// *****
|
|
142
|
+
}, [adaptiveCardInstanceRef.current, fluentUICustomizerContext, props.theme, props.themeType, props.hostConfig, props.isUniqueControlInPage]);
|
|
143
|
+
// *****
|
|
144
|
+
// set invokeAction
|
|
145
|
+
useEffect(function () {
|
|
146
|
+
adaptiveCardInstanceRef.current.onExecuteAction = invokeAction;
|
|
147
|
+
}, [adaptiveCardInstanceRef.current, invokeAction]);
|
|
148
|
+
// *****
|
|
149
|
+
// set elements & actions registry
|
|
150
|
+
useEffect(function () {
|
|
151
|
+
var elementRegistry = new CardObjectRegistry();
|
|
152
|
+
var actionRegistry = new CardObjectRegistry();
|
|
153
|
+
GlobalRegistry.populateWithDefaultElements(elementRegistry);
|
|
154
|
+
GlobalRegistry.populateWithDefaultActions(actionRegistry);
|
|
155
|
+
useLocalFluentUI(elementRegistry, actionRegistry);
|
|
156
|
+
if (props.onSetCustomElements) {
|
|
157
|
+
props.onSetCustomElements(elementRegistry);
|
|
158
|
+
}
|
|
159
|
+
if (props.onSetCustomActions) {
|
|
160
|
+
props.onSetCustomActions(actionRegistry);
|
|
161
|
+
}
|
|
162
|
+
var currentSerializationContext = serializationContextInstanceRef.current;
|
|
163
|
+
currentSerializationContext.setElementRegistry(elementRegistry);
|
|
164
|
+
currentSerializationContext.setActionRegistry(actionRegistry);
|
|
165
|
+
}, [serializationContextInstanceRef.current]);
|
|
166
|
+
// *****
|
|
167
|
+
// set Adaptive Card
|
|
168
|
+
useEffect(function () {
|
|
169
|
+
var currentRenderElement = renderElementRef.current;
|
|
170
|
+
if (!currentRenderElement) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
var currentAdaptiveCard = adaptiveCardInstanceRef.current;
|
|
174
|
+
try {
|
|
175
|
+
var cardPayload = void 0;
|
|
176
|
+
if (props.data) {
|
|
177
|
+
var template = new Template(props.card);
|
|
178
|
+
cardPayload = template.expand(props.data);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
cardPayload = props.card;
|
|
182
|
+
}
|
|
183
|
+
currentAdaptiveCard.parse(cardPayload, serializationContextInstanceRef.current);
|
|
184
|
+
var renderedElement = currentAdaptiveCard.render();
|
|
185
|
+
currentRenderElement.innerHTML = "";
|
|
186
|
+
currentRenderElement.appendChild(renderedElement);
|
|
187
|
+
}
|
|
188
|
+
catch (cardRenderError) {
|
|
189
|
+
if (props.onError) {
|
|
190
|
+
props.onError(cardRenderError);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, [adaptiveCardInstanceRef.current, props.data, props.hostConfig, props.onError]);
|
|
194
|
+
// *****
|
|
195
|
+
return (React.createElement(ThemeProvider, { theme: (fluentUIThemeInstanceRef.current) ? fluentUIThemeInstanceRef.current : getDefaultFluentUITheme() },
|
|
196
|
+
React.createElement("div", { ref: renderElementRef, className: "" + ((props.className) ? props.className : ""), style: props.style })));
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=AdaptiveCardHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveCardHost.js","sourceRoot":"","sources":["../../../src/controls/adaptiveCardHost/Ada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CAAC,WAAW,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;YAEhF,IAAI,eAAe,GAAG,mBAAmB,CAAC,MAAM,EAAE,CAAC;YACnD,oBAAoB,CAAC,SAAS,GAAG,EAAE,CAAC;YACpC,oBAAoB,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;SACrD;QAAC,OAAO,eAAe,EAAE;YACtB,IAAI,KAAK,CAAC,OAAO,EAAE;gBACf,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;aAClC;SACJ;IACL,CAAC,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACnF,QAAQ;IAER,OAAO,CACH,oBAAC,aAAa,IAAC,KAAK,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,EAAE;QACnH,6BACI,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,MAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAE,EACxD,KAAK,EAAE,KAAK,CAAC,KAAK,GACpB,CACU,CACnB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IReadonlyTheme } from '@microsoft/sp-component-base';
|
|
2
|
+
import { IPartialTheme, ITheme } from 'office-ui-fabric-react/lib/Styling';
|
|
3
|
+
export declare const initProcessMarkdown: () => void;
|
|
4
|
+
export declare const createSharePointHostConfig: (theme: ITheme) => any;
|
|
5
|
+
export declare const createDefaultTeamsHostConfig: (theme: ITheme) => any;
|
|
6
|
+
export declare const createDarkTeamsHostConfig: (theme: ITheme) => any;
|
|
7
|
+
export declare const createHighContrastTeamsHostConfig: (theme: ITheme) => any;
|
|
8
|
+
export declare const setFluentUIThemeAsCSSVariables: (domElement: HTMLElement, theme: IReadonlyTheme) => void;
|
|
9
|
+
export declare const convertFromPartialThemeToTheme: (partialTheme: IPartialTheme) => ITheme;
|
|
10
|
+
//# sourceMappingURL=AdaptiveCardHostHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdaptiveCardHostHelpers.d.ts","sourceRoot":"","sources":["../../../src/controls/adaptiveCardHost/AdaptiveCardHostHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAiC3E,eAAO,MAAM,mBAAmB,YAe/B,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAAW,MAAM,KAAG,GAwO1D,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,KAAG,GA4O5D,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAAW,MAAM,KAAG,GA6OzD,CAAC;AAEF,eAAO,MAAM,iCAAiC,UAAW,MAAM,KAAG,GA6OjE,CAAC;AAEF,eAAO,MAAM,8BAA8B,eAAgB,WAAW,SAAS,cAAc,SAQ5F,CAAC;AAEF,eAAO,MAAM,8BAA8B,iBAAkB,aAAa,KAAG,MAE5E,CAAC"}
|