@microsoft/sp-component-base 1.23.1 → 1.24.0-beta.2
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/dist/467dc675-7cc5-4709-8aac-78e3b71bd2f6.manifest.json +136 -141
- package/dist/{chunk.legacy-third-party-fabric-core-localfont_none_9e84ea19c68fdc8b9094.js → chunk.legacy-third-party-fabric-core-localfont_none_b7f7978a3e90166c361b.js} +1 -1
- package/dist/chunk.teams-apps-client_none_27d3c7c1d01080e4f131.js +2 -0
- package/dist/index-internal-beta.d.ts +30 -8
- package/dist/index-internal-public.d.ts +30 -8
- package/dist/index-internal.d.ts +30 -8
- package/dist/sp-component-base_default_8d535b51fa18aa47002b.js +22 -0
- package/dist/sp-component-base_en-us_8ce25dfb69a7786caece.js +22 -0
- package/dist/sp-component-base_qps-ploc_4fec831895d90df8aa7a.js +22 -0
- package/dist/sp-component-base_qps-ploca_b80610c8dff04dcec755.js +22 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib-commonjs/BaseComponent.js +110 -145
- package/lib-commonjs/BaseComponentContext.js +126 -183
- package/lib-commonjs/DynamicDataProvider.js +251 -268
- package/lib-commonjs/DynamicDataSourceManager.js +218 -241
- package/lib-commonjs/DynamicProperty.js +232 -280
- package/lib-commonjs/EnsureIsolatedDomainUrl.js +14 -14
- package/lib-commonjs/IComponentPosition.js +8 -3
- package/lib-commonjs/IComponentPropertyMetadata.js +10 -3
- package/lib-commonjs/ISerializedServerProcessedData.js +24 -21
- package/lib-commonjs/LegacyThirdPartyFabricCoreLoader.js +53 -87
- package/lib-commonjs/PropertyMetadataProcessor.js +117 -150
- package/lib-commonjs/RenderableComponentContext.js +37 -0
- package/lib-commonjs/ShimmerFactory.js +66 -51
- package/lib-commonjs/chunks/legacy-third-party-fabric-core/FabricLocalFont.js +6 -4
- package/lib-commonjs/common/Flights.js +22 -10
- package/lib-commonjs/common/KillSwitches.js +13 -6
- package/lib-commonjs/dataCollector/IWebPartLoadData.js +35 -30
- package/lib-commonjs/dataCollector/WebPartLoadDataCollector.js +82 -91
- package/lib-commonjs/index.js +78 -38
- package/lib-commonjs/teams/DeferredTeamsAppsClient.js +30 -52
- package/lib-commonjs/teams/ITeamsAppCatalog.js +10 -3
- package/lib-commonjs/teams/TeamsAppsClient.js +189 -231
- package/lib-commonjs/test-api/MockComponent.js +38 -23
- package/lib-commonjs/test-api/MockComponentContext.js +21 -14
- package/lib-commonjs/test-api/index.js +21 -7
- package/lib-commonjs/themeProvider/ThemeProvider.js +68 -82
- package/lib-commonjs/themeProvider/themeInterfaces/IFontStyles.js +5 -2
- package/lib-commonjs/themeProvider/themeInterfaces/IPalette.js +10 -3
- package/lib-commonjs/themeProvider/themeInterfaces/ISemanticColors.js +59 -3
- package/lib-commonjs/themeProvider/themeInterfaces/ISemanticTextColors.js +10 -3
- package/lib-commonjs/themeProvider/themeInterfaces/ITheme.js +5 -2
- package/{lib → lib-dts}/BaseComponent.d.ts +8 -8
- package/{lib → lib-dts}/BaseComponentContext.d.ts +5 -5
- package/lib-dts/RenderableComponentContext.d.ts +35 -0
- package/{lib → lib-dts}/index.d.ts +1 -0
- package/lib-esm/BaseComponent.js +123 -0
- package/lib-esm/BaseComponentContext.js +157 -0
- package/lib-esm/DynamicDataProvider.js +401 -0
- package/lib-esm/DynamicDataSourceManager.js +358 -0
- package/lib-esm/DynamicProperty.js +344 -0
- package/{lib → lib-esm}/EnsureIsolatedDomainUrl.js +6 -6
- package/lib-esm/IComponentPosition.js +5 -0
- package/lib-esm/IComponentPropertyMetadata.js +7 -0
- package/lib-esm/ISerializedServerProcessedData.js +24 -0
- package/lib-esm/LegacyThirdPartyFabricCoreLoader.js +76 -0
- package/{lib → lib-esm}/PropertyMetadataProcessor.js +92 -127
- package/lib-esm/RenderableComponentContext.js +26 -0
- package/lib-esm/ShimmerFactory.js +74 -0
- package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/FabricLocalFont.js +3 -3
- package/{lib → lib-esm}/common/Flights.js +4 -3
- package/{lib → lib-esm}/common/KillSwitches.js +3 -2
- package/lib-esm/dataCollector/IWebPartLoadData.js +33 -0
- package/lib-esm/dataCollector/WebPartLoadDataCollector.js +125 -0
- package/{lib → lib-esm}/index.js +4 -3
- package/lib-esm/teams/DeferredTeamsAppsClient.js +32 -0
- package/lib-esm/teams/ITeamsAppCatalog.js +9 -0
- package/lib-esm/teams/TeamsAppsClient.js +395 -0
- package/lib-esm/test-api/MockComponent.js +38 -0
- package/{lib → lib-esm}/test-api/MockComponentContext.js +10 -11
- package/{lib → lib-esm}/test-api/index.js +2 -1
- package/lib-esm/themeProvider/ThemeProvider.js +79 -0
- package/lib-esm/themeProvider/themeInterfaces/IFontStyles.js +7 -0
- package/lib-esm/themeProvider/themeInterfaces/IPalette.js +7 -0
- package/lib-esm/themeProvider/themeInterfaces/ISemanticColors.js +56 -0
- package/lib-esm/themeProvider/themeInterfaces/ISemanticTextColors.js +7 -0
- package/lib-esm/themeProvider/themeInterfaces/ITheme.js +7 -0
- package/package.json +41 -14
- package/dist/chunk.teams-apps-client_none_f9872389cb6ea9ad28e2.js +0 -2
- package/dist/sp-component-base_default_5ba07be39b0dc8968f7b.js +0 -2
- package/dist/sp-component-base_en-us_eb9bebb3acce0ae83f1c.js +0 -2
- package/dist/sp-component-base_qps-ploc_45f37623d87c3d848f2a.js +0 -2
- package/dist/sp-component-base_qps-ploca_b3f3b7bf97c4185b0fd6.js +0 -2
- package/lib/BaseComponent.d.ts.map +0 -1
- package/lib/BaseComponent.js +0 -161
- package/lib/BaseComponentContext.d.ts.map +0 -1
- package/lib/BaseComponentContext.js +0 -222
- package/lib/DynamicDataProvider.d.ts.map +0 -1
- package/lib/DynamicDataProvider.js +0 -420
- package/lib/DynamicDataSourceManager.d.ts.map +0 -1
- package/lib/DynamicDataSourceManager.js +0 -382
- package/lib/DynamicProperty.d.ts.map +0 -1
- package/lib/DynamicProperty.js +0 -390
- package/lib/EnsureIsolatedDomainUrl.d.ts.map +0 -1
- package/lib/IComponentPosition.d.ts.map +0 -1
- package/lib/IComponentPosition.js +0 -2
- package/lib/IComponentPropertyMetadata.d.ts.map +0 -1
- package/lib/IComponentPropertyMetadata.js +0 -2
- package/lib/ISerializedServerProcessedData.d.ts.map +0 -1
- package/lib/ISerializedServerProcessedData.js +0 -28
- package/lib/LegacyThirdPartyFabricCoreLoader.d.ts.map +0 -1
- package/lib/LegacyThirdPartyFabricCoreLoader.js +0 -90
- package/lib/PropertyMetadataProcessor.d.ts.map +0 -1
- package/lib/ShimmerFactory.d.ts.map +0 -1
- package/lib/ShimmerFactory.js +0 -62
- package/lib/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts.map +0 -1
- package/lib/common/Flights.d.ts.map +0 -1
- package/lib/common/KillSwitches.d.ts.map +0 -1
- package/lib/dataCollector/IWebPartLoadData.d.ts.map +0 -1
- package/lib/dataCollector/IWebPartLoadData.js +0 -40
- package/lib/dataCollector/WebPartLoadDataCollector.d.ts.map +0 -1
- package/lib/dataCollector/WebPartLoadDataCollector.js +0 -137
- package/lib/index.d.ts.map +0 -1
- package/lib/teams/DeferredTeamsAppsClient.d.ts.map +0 -1
- package/lib/teams/DeferredTeamsAppsClient.js +0 -39
- package/lib/teams/ITeamsAppCatalog.d.ts.map +0 -1
- package/lib/teams/ITeamsAppCatalog.js +0 -2
- package/lib/teams/TeamsAppsClient.d.ts.map +0 -1
- package/lib/teams/TeamsAppsClient.js +0 -440
- package/lib/test-api/MockComponent.d.ts.map +0 -1
- package/lib/test-api/MockComponent.js +0 -31
- package/lib/test-api/MockComponentContext.d.ts.map +0 -1
- package/lib/test-api/index.d.ts.map +0 -1
- package/lib/themeProvider/ThemeProvider.d.ts.map +0 -1
- package/lib/themeProvider/ThemeProvider.js +0 -99
- package/lib/themeProvider/themeInterfaces/IFontStyles.d.ts.map +0 -1
- package/lib/themeProvider/themeInterfaces/IFontStyles.js +0 -2
- package/lib/themeProvider/themeInterfaces/IPalette.d.ts.map +0 -1
- package/lib/themeProvider/themeInterfaces/IPalette.js +0 -2
- package/lib/themeProvider/themeInterfaces/ISemanticColors.d.ts.map +0 -1
- package/lib/themeProvider/themeInterfaces/ISemanticColors.js +0 -2
- package/lib/themeProvider/themeInterfaces/ISemanticTextColors.d.ts.map +0 -1
- package/lib/themeProvider/themeInterfaces/ISemanticTextColors.js +0 -2
- package/lib/themeProvider/themeInterfaces/ITheme.d.ts.map +0 -1
- package/lib/themeProvider/themeInterfaces/ITheme.js +0 -2
- /package/{lib → lib-dts}/DynamicDataProvider.d.ts +0 -0
- /package/{lib → lib-dts}/DynamicDataSourceManager.d.ts +0 -0
- /package/{lib → lib-dts}/DynamicProperty.d.ts +0 -0
- /package/{lib → lib-dts}/EnsureIsolatedDomainUrl.d.ts +0 -0
- /package/{lib → lib-dts}/IComponentPosition.d.ts +0 -0
- /package/{lib → lib-dts}/IComponentPropertyMetadata.d.ts +0 -0
- /package/{lib → lib-dts}/ISerializedServerProcessedData.d.ts +0 -0
- /package/{lib → lib-dts}/LegacyThirdPartyFabricCoreLoader.d.ts +0 -0
- /package/{lib → lib-dts}/PropertyMetadataProcessor.d.ts +0 -0
- /package/{lib → lib-dts}/ShimmerFactory.d.ts +0 -0
- /package/{lib → lib-dts}/chunks/legacy-third-party-fabric-core/FabricLocalFont.d.ts +0 -0
- /package/{lib → lib-dts}/common/Flights.d.ts +0 -0
- /package/{lib → lib-dts}/common/KillSwitches.d.ts +0 -0
- /package/{lib → lib-dts}/dataCollector/IWebPartLoadData.d.ts +0 -0
- /package/{lib → lib-dts}/dataCollector/WebPartLoadDataCollector.d.ts +0 -0
- /package/{lib → lib-dts}/loc/Strings.resx.d.ts +0 -0
- /package/{lib → lib-dts}/teams/DeferredTeamsAppsClient.d.ts +0 -0
- /package/{lib → lib-dts}/teams/ITeamsAppCatalog.d.ts +0 -0
- /package/{lib → lib-dts}/teams/TeamsAppsClient.d.ts +0 -0
- /package/{lib → lib-dts}/test-api/MockComponent.d.ts +0 -0
- /package/{lib → lib-dts}/test-api/MockComponentContext.d.ts +0 -0
- /package/{lib → lib-dts}/test-api/index.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/ThemeProvider.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/themeInterfaces/IFontStyles.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/themeInterfaces/IPalette.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/themeInterfaces/ISemanticColors.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/themeInterfaces/ISemanticTextColors.d.ts +0 -0
- /package/{lib → lib-dts}/themeProvider/themeInterfaces/ITheme.d.ts +0 -0
- /package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFont.global.scss.css +0 -0
- /package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/fabric-core-sass/Fabric.LocalFontKillSwitchActivated.scss.css +0 -0
- /package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/fabric-core-shim.global.scss.css +0 -0
- /package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/fabric-core-shimKillSwitchActivated.scss.css +0 -0
- /package/{lib → lib-esm}/chunks/legacy-third-party-fabric-core/iconDefinitions.css +0 -0
- /package/{lib → lib-esm}/loc/Strings.resx.json +0 -0
- /package/{lib → lib-esm}/sp-component-base.manifest.json +0 -0
- /package/{lib → lib-esm}/styles/shimmer.module.scss.css +0 -0
|
@@ -8,43 +8,34 @@ import { SafeHtml } from '@msinternal/sp-safehtml';
|
|
|
8
8
|
* based on component metadata.
|
|
9
9
|
*
|
|
10
10
|
* @internal
|
|
11
|
-
*/
|
|
12
|
-
var PropertyMetadataProcessor = /** @class */ (function () {
|
|
13
|
-
function PropertyMetadataProcessor() {
|
|
14
|
-
}
|
|
11
|
+
*/ export class PropertyMetadataProcessor {
|
|
15
12
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _this = this;
|
|
24
|
-
this._forEachPropertyWithMetaData(propertiesMetadata, properties, function (propPath, metadata, iteration) {
|
|
13
|
+
* Serialize the properties into server processed content as declared in metadata.
|
|
14
|
+
*
|
|
15
|
+
* @param propertiesMetadata - The component properties metadata.
|
|
16
|
+
* @param properties - The component properties. This object will be modified during serialization.
|
|
17
|
+
* @param serverProcessedContent - The serialized server processed content. This object will be modified.
|
|
18
|
+
*/ static serializeServerProcessedData(propertiesMetadata, properties, serverProcessedContent) {
|
|
19
|
+
this._forEachPropertyWithMetaData(propertiesMetadata, properties, (propPath, metadata, iteration)=>{
|
|
25
20
|
// Remove fields with shouldNotPersist metadata
|
|
26
21
|
if (metadata.shouldNotPersist) {
|
|
27
22
|
lodash.set(properties, propPath, undefined);
|
|
28
23
|
}
|
|
29
24
|
// Use the property path as the key in server-processed content maps
|
|
30
|
-
|
|
25
|
+
const key = propPath;
|
|
31
26
|
// WARNING: This is critical code. Please do not modify without fully understanding the data pipeline
|
|
32
|
-
|
|
27
|
+
const value = lodash.get(properties, propPath);
|
|
33
28
|
// Skip if the property is non-string or undefined
|
|
34
29
|
if (serverProcessedContent && typeof value === 'string' && value) {
|
|
35
30
|
if (serverProcessedContent.htmlStrings && metadata.isHtmlString) {
|
|
36
31
|
serverProcessedContent.htmlStrings[key] = value;
|
|
37
|
-
}
|
|
38
|
-
else if (serverProcessedContent.searchablePlainTexts && metadata.isSearchablePlainText) {
|
|
32
|
+
} else if (serverProcessedContent.searchablePlainTexts && metadata.isSearchablePlainText) {
|
|
39
33
|
serverProcessedContent.searchablePlainTexts[key] = value;
|
|
40
|
-
}
|
|
41
|
-
else if (serverProcessedContent.links && metadata.isLink) {
|
|
34
|
+
} else if (serverProcessedContent.links && metadata.isLink) {
|
|
42
35
|
serverProcessedContent.links[key] = value;
|
|
43
|
-
}
|
|
44
|
-
else if (serverProcessedContent.imageSources && metadata.isImageSource) {
|
|
36
|
+
} else if (serverProcessedContent.imageSources && metadata.isImageSource) {
|
|
45
37
|
serverProcessedContent.imageSources[key] = value;
|
|
46
|
-
}
|
|
47
|
-
else if (metadata.isComponentDependency) {
|
|
38
|
+
} else if (metadata.isComponentDependency) {
|
|
48
39
|
if (!serverProcessedContent.componentDependencies) {
|
|
49
40
|
serverProcessedContent.componentDependencies = {};
|
|
50
41
|
}
|
|
@@ -52,65 +43,58 @@ var PropertyMetadataProcessor = /** @class */ (function () {
|
|
|
52
43
|
}
|
|
53
44
|
if (metadata.customMetadata) {
|
|
54
45
|
// Build custom metadata for the given property path
|
|
55
|
-
|
|
46
|
+
const customMetadata = {};
|
|
56
47
|
if (metadata && metadata.customMetadata) {
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
for (const [propName, customMetadataPropPath] of Object.entries(metadata.customMetadata)){
|
|
49
|
+
let normalizedCustomMetadataPropPath = customMetadataPropPath;
|
|
59
50
|
if (iteration !== undefined && normalizedCustomMetadataPropPath.indexOf('*') !== -1) {
|
|
60
51
|
// Custom metadata should be resolved with current iteration of wildcard
|
|
61
52
|
normalizedCustomMetadataPropPath = normalizedCustomMetadataPropPath.replace('*', iteration.toString());
|
|
62
53
|
}
|
|
63
|
-
|
|
54
|
+
this._validateAndIteratePath(normalizedCustomMetadataPropPath, properties, (fixedPropPath, customIteration)=>{
|
|
64
55
|
// Custom metadata should be resolved without iteration
|
|
65
56
|
if (customIteration === undefined && metadata.customMetadata) {
|
|
66
|
-
|
|
57
|
+
const customValue = lodash.get(properties, fixedPropPath);
|
|
67
58
|
if (serverProcessedContent && customValue !== undefined) {
|
|
68
59
|
// Insert custom metadata key and value
|
|
69
60
|
if (isFixCustomMetadataKeyKillSwitchActivated()) {
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
customMetadata_1[propName] = customValue;
|
|
61
|
+
customMetadata[fixedPropPath] = customValue;
|
|
62
|
+
} else {
|
|
63
|
+
customMetadata[propName] = customValue;
|
|
74
64
|
}
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
67
|
});
|
|
78
|
-
};
|
|
79
|
-
for (var _i = 0, _a = Object.entries(metadata.customMetadata); _i < _a.length; _i++) {
|
|
80
|
-
var _b = _a[_i], propName = _b[0], customMetadataPropPath = _b[1];
|
|
81
|
-
_loop_1(propName, customMetadataPropPath);
|
|
82
68
|
}
|
|
83
69
|
}
|
|
84
70
|
if (!serverProcessedContent.customMetadata) {
|
|
85
71
|
serverProcessedContent.customMetadata = {};
|
|
86
72
|
}
|
|
87
73
|
// Store serialized custom metadata for the given the property path.
|
|
88
|
-
serverProcessedContent.customMetadata[key] =
|
|
74
|
+
serverProcessedContent.customMetadata[key] = customMetadata;
|
|
89
75
|
}
|
|
90
76
|
// Unset the extracted property to avoid duplication
|
|
91
77
|
lodash.set(properties, propPath, undefined);
|
|
92
78
|
}
|
|
93
79
|
});
|
|
94
|
-
}
|
|
80
|
+
}
|
|
95
81
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var _this = this;
|
|
106
|
-
var propertyPathsNotInServerProcessedContent = new Set();
|
|
82
|
+
* Reapply the serialized server processed content on the properties based on the metadata.
|
|
83
|
+
* This process will result in the properties bag as it was when the serialization happened.
|
|
84
|
+
*
|
|
85
|
+
* @param propertiesMetadata - The component properties metadata.
|
|
86
|
+
* @param properties - The component properties. This object will be modified during serialization.
|
|
87
|
+
* @param serverProcessedContent - The serialized server processed content.
|
|
88
|
+
* @param manifest - The optional component manifest.
|
|
89
|
+
*/ static reInstateServerProcessedData(propertiesMetadata, properties, serverProcessedContent, manifest) {
|
|
90
|
+
const propertyPathsNotInServerProcessedContent = new Set();
|
|
107
91
|
if (manifest) {
|
|
108
92
|
// @privateRemarks Clear out the properties with isHtmlString metadata for security reasons. We only want to
|
|
109
93
|
// propagate values from the serverProcessed content as they are security sanitized by the server. Note, there is a
|
|
110
94
|
// scenario when an end user can update the list item with whatever data they like. In that case, they can
|
|
111
95
|
// eliminate the serverProcessed content and that can cause a potential security hole. Hence, we always want
|
|
112
96
|
// clear out the property values that have isHtmlString metadata.
|
|
113
|
-
this._forEachPropertyWithMetaData(propertiesMetadata, properties,
|
|
97
|
+
this._forEachPropertyWithMetaData(propertiesMetadata, properties, (propPath, metadata)=>{
|
|
114
98
|
if (!isServerPropertiesSanitizedEnabled()) {
|
|
115
99
|
// This is a temporary hack to make sure that the webparts published using the Mobile app keep rendering.
|
|
116
100
|
// Currently, for those pages, the DocumentEmbedWebPart does not have HTMLProperties pupulated. Hence,
|
|
@@ -119,8 +103,7 @@ var PropertyMetadataProcessor = /** @class */ (function () {
|
|
|
119
103
|
if (manifest.id !== 'b7dd04e1-19ce-4b24-9132-b60a1c2b910d' && metadata.isHtmlString) {
|
|
120
104
|
lodash.set(properties, propPath, undefined);
|
|
121
105
|
}
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
106
|
+
} else {
|
|
124
107
|
// We should always sanitize the deserialized property bag for any property
|
|
125
108
|
// that is marked with propertiesMetadata. It is possible for the content to have been
|
|
126
109
|
// modified at rest and therefore work around the assumption of the serverProcessedContent
|
|
@@ -131,24 +114,23 @@ var PropertyMetadataProcessor = /** @class */ (function () {
|
|
|
131
114
|
// if the data has been incorrectly modified at rest. The web part is expected to handle that.
|
|
132
115
|
//
|
|
133
116
|
// If the path is already undefined then we can skip setting to undefined and the enforcement
|
|
134
|
-
if (manifest.id === 'b7dd04e1-19ce-4b24-9132-b60a1c2b910d' &&
|
|
135
|
-
_SPKillSwitch.isActivated('71b68bd4-eb7a-4330-93bd-dc6d382123c1' /* '9/28/2023', 'Do not serverProcessContent sanitization for DocumentEmbedWebPart' */)) {
|
|
117
|
+
if (manifest.id === 'b7dd04e1-19ce-4b24-9132-b60a1c2b910d' && _SPKillSwitch.isActivated('71b68bd4-eb7a-4330-93bd-dc6d382123c1' /* '9/28/2023', 'Do not serverProcessContent sanitization for DocumentEmbedWebPart' */ )) {
|
|
136
118
|
return;
|
|
137
119
|
}
|
|
138
120
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
-
|
|
121
|
+
const propValue = lodash.get(properties, propPath);
|
|
140
122
|
if (propValue !== undefined) {
|
|
141
|
-
|
|
123
|
+
const qosMonitor = new _QosMonitor('PropertyMetadataProcessor.clearMetadataValue');
|
|
142
124
|
if (metadata.isLink) {
|
|
143
125
|
propertyPathsNotInServerProcessedContent.add(propPath);
|
|
144
|
-
if (!
|
|
126
|
+
if (!this._isSafeLink(propValue)) {
|
|
145
127
|
qosMonitor.writeUnexpectedFailure('ClearingLinkProperty', new Error(propPath));
|
|
146
128
|
lodash.set(properties, propPath, undefined);
|
|
147
129
|
}
|
|
148
130
|
}
|
|
149
131
|
if (metadata.isHtmlString) {
|
|
150
132
|
propertyPathsNotInServerProcessedContent.add(propPath);
|
|
151
|
-
|
|
133
|
+
const safeHtml = this._getSafeHtml(propValue);
|
|
152
134
|
if (safeHtml !== propValue) {
|
|
153
135
|
qosMonitor.writeUnexpectedFailure('SettingSafeHtml', new Error(propPath));
|
|
154
136
|
lodash.set(properties, propPath, safeHtml);
|
|
@@ -168,18 +150,16 @@ var PropertyMetadataProcessor = /** @class */ (function () {
|
|
|
168
150
|
// back to the web part that has the same shape as when the serialization happened.
|
|
169
151
|
// CustomMetadata is only processed on the server so we do not round trip the data back
|
|
170
152
|
// into the web part properties. This is by design of the feature
|
|
171
|
-
|
|
153
|
+
const htmlMaps = [
|
|
172
154
|
serverProcessedContent.htmlStrings,
|
|
173
155
|
serverProcessedContent.searchablePlainTexts,
|
|
174
156
|
serverProcessedContent.imageSources,
|
|
175
157
|
serverProcessedContent.links,
|
|
176
158
|
serverProcessedContent.componentDependencies
|
|
177
159
|
];
|
|
178
|
-
for (
|
|
179
|
-
var htmlMap = htmlMaps_1[_i];
|
|
160
|
+
for (const htmlMap of htmlMaps){
|
|
180
161
|
if (htmlMap) {
|
|
181
|
-
for (
|
|
182
|
-
var _c = _b[_a], propPath = _c[0], value = _c[1];
|
|
162
|
+
for (const [propPath, value] of Object.entries(htmlMap)){
|
|
183
163
|
// WARNING: This is critical code. Please do not modify without fully understanding the data pipeline
|
|
184
164
|
if (typeof value === 'string') {
|
|
185
165
|
lodash.set(properties, propPath, value);
|
|
@@ -191,107 +171,92 @@ var PropertyMetadataProcessor = /** @class */ (function () {
|
|
|
191
171
|
}
|
|
192
172
|
}
|
|
193
173
|
}
|
|
194
|
-
if (isServerPropertiesSanitizedEnabled() &&
|
|
195
|
-
|
|
196
|
-
propertyPathsNotInServerProcessedContent.size > 0) {
|
|
197
|
-
var logServerPropertiesMissing = new _QosMonitor('PropertyMetadataProcessor.serverProcessedContentMissing');
|
|
174
|
+
if (isServerPropertiesSanitizedEnabled() && manifest && propertyPathsNotInServerProcessedContent.size > 0) {
|
|
175
|
+
const logServerPropertiesMissing = new _QosMonitor('PropertyMetadataProcessor.serverProcessedContentMissing');
|
|
198
176
|
logServerPropertiesMissing.writeUnexpectedFailure('Missing Content', undefined, {
|
|
199
177
|
manifest: manifest.id,
|
|
200
178
|
properties: Array.from(propertyPathsNotInServerProcessedContent).join(',')
|
|
201
179
|
});
|
|
202
180
|
}
|
|
203
|
-
}
|
|
204
|
-
|
|
181
|
+
}
|
|
182
|
+
static _isSafeLink(link) {
|
|
205
183
|
try {
|
|
206
|
-
|
|
184
|
+
const safeLinkUrl = new URL(link);
|
|
207
185
|
return SafeHtml.isSafeLinkProtocol(safeLinkUrl.protocol);
|
|
208
|
-
}
|
|
209
|
-
catch (_a) {
|
|
186
|
+
} catch {
|
|
210
187
|
try {
|
|
211
|
-
|
|
188
|
+
const safeLinkUrl = new URL(link, window.location.origin);
|
|
212
189
|
return SafeHtml.isSafeLinkProtocol(safeLinkUrl.protocol);
|
|
213
|
-
}
|
|
214
|
-
catch (_b) {
|
|
190
|
+
} catch {
|
|
215
191
|
return false;
|
|
216
192
|
}
|
|
217
193
|
}
|
|
218
|
-
}
|
|
219
|
-
|
|
194
|
+
}
|
|
195
|
+
static _getSafeHtml(html) {
|
|
220
196
|
return SafeHtml.clean(html);
|
|
221
|
-
}
|
|
197
|
+
}
|
|
222
198
|
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
PropertyMetadataProcessor._forEachPropertyWithMetaData = function (propertiesMetadata, properties, metadataProcessor) {
|
|
199
|
+
* Iterates and validates each metadata property before calling metadata processor.
|
|
200
|
+
*
|
|
201
|
+
* @param propertiesMetadata - Component properties metadata.
|
|
202
|
+
* @param properties - Component properties.
|
|
203
|
+
* @param metadataProcessor - Callback handler to to process validated metadata.
|
|
204
|
+
*
|
|
205
|
+
* @internal
|
|
206
|
+
*/ static _forEachPropertyWithMetaData(propertiesMetadata, properties, metadataProcessor) {
|
|
232
207
|
if (propertiesMetadata) {
|
|
233
|
-
|
|
234
|
-
|
|
208
|
+
for (const [propPath, metadata] of Object.entries(propertiesMetadata)){
|
|
209
|
+
this._validateAndIteratePath(propPath, properties, (fixedPropPath, index)=>{
|
|
235
210
|
metadataProcessor(fixedPropPath, metadata, index);
|
|
236
211
|
});
|
|
237
|
-
};
|
|
238
|
-
var this_1 = this;
|
|
239
|
-
for (var _i = 0, _a = Object.entries(propertiesMetadata); _i < _a.length; _i++) {
|
|
240
|
-
var _b = _a[_i], propPath = _b[0], metadata = _b[1];
|
|
241
|
-
_loop_2(propPath, metadata);
|
|
242
212
|
}
|
|
243
213
|
}
|
|
244
|
-
}
|
|
214
|
+
}
|
|
245
215
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var wildcardCount = (propPath.match(/\*/g) || []).length;
|
|
216
|
+
* Validates path and iterate over one or multiple wildcard paths
|
|
217
|
+
*
|
|
218
|
+
* @param propPath - Original property path provided in metadata
|
|
219
|
+
* @param properties - Properties to look for the given path.
|
|
220
|
+
* @param propertyPathHandler - Handler to process validated and fixed path
|
|
221
|
+
*/ static _validateAndIteratePath(propPath, properties, propertyPathHandler) {
|
|
222
|
+
const wildcardCount = (propPath.match(/\*/g) || []).length;
|
|
254
223
|
if (wildcardCount > 1) {
|
|
255
224
|
// Skip if there are more than one asterisks in the path (not supported)
|
|
256
225
|
// eslint-disable-next-line no-console
|
|
257
|
-
console.warn(
|
|
226
|
+
console.warn(`Invalid property path: Multiple wildcards are not supported in property paths.
|
|
227
|
+
Entry with path '${propPath}' got ignored in the properties metadata.`);
|
|
258
228
|
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
var index = propPath.indexOf('[*]');
|
|
229
|
+
} else if (wildcardCount === 1) {
|
|
230
|
+
const index = propPath.indexOf('[*]');
|
|
262
231
|
if (index < -1) {
|
|
263
232
|
// eslint-disable-next-line no-console
|
|
264
|
-
console.warn(
|
|
233
|
+
console.warn(`Invalid property path: Wildcards are only supported inside brackets to select array
|
|
234
|
+
indices as in 'foo[*].bar'. Entry with path '${propPath}' got ignored in the properties metadata.`);
|
|
265
235
|
// Skip if the wildcard is not used for an array (not supported)
|
|
266
236
|
return;
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
237
|
+
} else {
|
|
269
238
|
// Handle the array wildcard by generating each individual property path
|
|
270
|
-
|
|
271
|
-
|
|
239
|
+
const arrayPath = propPath.substr(0, index);
|
|
240
|
+
const arrayInstance = lodash.get(properties, arrayPath);
|
|
272
241
|
if (!arrayInstance) {
|
|
273
242
|
// eslint-disable-next-line no-console
|
|
274
|
-
console.warn(
|
|
243
|
+
console.warn(`Invalid property path: Could not find an array named '${arrayPath}' in the properties.
|
|
244
|
+
Entry with path '${propPath}' got ignored in the properties metadata.`);
|
|
275
245
|
return;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
var fixedPropPath = propPath.replace('*', "".concat(i));
|
|
246
|
+
} else {
|
|
247
|
+
for(let i = 0; i < arrayInstance.length; i++){
|
|
248
|
+
const fixedPropPath = propPath.replace('*', `${i}`);
|
|
280
249
|
propertyPathHandler(fixedPropPath, i);
|
|
281
250
|
}
|
|
282
251
|
}
|
|
283
252
|
}
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
253
|
+
} else {
|
|
286
254
|
propertyPathHandler(propPath);
|
|
287
255
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
}());
|
|
291
|
-
export { PropertyMetadataProcessor };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
292
258
|
function isFixCustomMetadataKeyKillSwitchActivated() {
|
|
293
|
-
return _SPKillSwitch.isActivated('bf085c27-422d-4b62-a93a-43efa89e77ee'
|
|
294
|
-
/* '2022-03-28', 'Fix custom metadata key' */
|
|
295
|
-
);
|
|
259
|
+
return _SPKillSwitch.isActivated('bf085c27-422d-4b62-a93a-43efa89e77ee');
|
|
296
260
|
}
|
|
297
|
-
|
|
261
|
+
|
|
262
|
+
//# sourceMappingURL=./PropertyMetadataProcessor.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Validate, _ES5CompatibleClass } from '@microsoft/sp-core-library';
|
|
2
|
+
import BaseComponentContext from './BaseComponentContext';
|
|
3
|
+
/**
|
|
4
|
+
* Base context for component types that render into a DOM element — web parts,
|
|
5
|
+
* Copilot Components, and any future renderable component type.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Extends {@link @microsoft/sp-component-base#BaseComponentContext} with a
|
|
9
|
+
* {@link RenderableComponentContext.domElement | domElement} property. Component
|
|
10
|
+
* types that do not have a dedicated render target (e.g. application
|
|
11
|
+
* customizers, extensions) should continue to extend `BaseComponentContext`
|
|
12
|
+
* directly.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/ class RenderableComponentContext extends BaseComponentContext {
|
|
16
|
+
/** @internal */ constructor(parameters){
|
|
17
|
+
const { domElement, ...superParameters } = parameters;
|
|
18
|
+
super(superParameters);
|
|
19
|
+
Validate.isNotNullOrUndefined(domElement, 'domElement');
|
|
20
|
+
this.domElement = domElement;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
_ES5CompatibleClass(RenderableComponentContext);
|
|
24
|
+
export default RenderableComponentContext;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=./RenderableComponentContext.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import styles from './styles/shimmer.module.scss';
|
|
2
|
+
// These constants are taken from generic shimmer design.
|
|
3
|
+
const SHIMMER_WIDTH_DEFAULT = 100;
|
|
4
|
+
const SHIMMER_HEIGHT_DEFAULT = 100;
|
|
5
|
+
const SHIMMER_RECTANGLE_HEIGHT_MAX = 16;
|
|
6
|
+
const SHIMMER_RECTANGLE_COUNT = 4;
|
|
7
|
+
const SHIMMER_ELEMENT_COUNT = 2 * SHIMMER_RECTANGLE_COUNT + 1;
|
|
8
|
+
const RECTANGLE_X = 8;
|
|
9
|
+
const SHIMMER_MAIN_RECTANGLE_SIZE_RATIO = 0.9;
|
|
10
|
+
const RECTANGLE_1_LENGTH = 20;
|
|
11
|
+
const RECTANGLE_2_LENGTH = 40;
|
|
12
|
+
const RECTANGLE_3_LENGTH = 90;
|
|
13
|
+
const RECTANGLE_4_LENGTH = 80;
|
|
14
|
+
class ShimmerFactory {
|
|
15
|
+
/**
|
|
16
|
+
* Method that creates a shimmer for applications using an svg.
|
|
17
|
+
* @param width - Width of the shimmer
|
|
18
|
+
* @param height - Height of the shimmer
|
|
19
|
+
* @param componentTag - ID for the shimmer
|
|
20
|
+
* @param loadingMessage - Displays message when the shimmer loads
|
|
21
|
+
*/ static createShimmer(width, height, componentTag, loadingMessage, containerMargin = undefined) {
|
|
22
|
+
width = width || SHIMMER_WIDTH_DEFAULT;
|
|
23
|
+
height = height || SHIMMER_HEIGHT_DEFAULT;
|
|
24
|
+
const shimmerContainerDiv = document.createElement('div');
|
|
25
|
+
shimmerContainerDiv.className = styles.shimmerContainer;
|
|
26
|
+
const shimmerDiv = document.createElement('div');
|
|
27
|
+
const mainRectangleHeight = height * SHIMMER_MAIN_RECTANGLE_SIZE_RATIO;
|
|
28
|
+
let rectangleHeight = mainRectangleHeight / SHIMMER_ELEMENT_COUNT;
|
|
29
|
+
rectangleHeight = Math.min(SHIMMER_RECTANGLE_HEIGHT_MAX, rectangleHeight);
|
|
30
|
+
const gap = 2 * rectangleHeight;
|
|
31
|
+
const rectangle1Y = rectangleHeight;
|
|
32
|
+
const rectangle2Y = rectangle1Y + gap;
|
|
33
|
+
const rectangle3Y = rectangle2Y + gap;
|
|
34
|
+
const rectangle4Y = rectangle3Y + gap;
|
|
35
|
+
const className = styles.shimmerElementFill;
|
|
36
|
+
shimmerDiv.innerHTML = `<svg width=${width} height=${height} viewBox="0 0 ${width} ${height}" version="1.1"
|
|
37
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
38
|
+
<title>${loadingMessage}</title>
|
|
39
|
+
<g id=${componentTag}_Shimmer stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
40
|
+
<rect x="0" y="0" width=${width} height=${height}></rect>
|
|
41
|
+
${ShimmerFactory._shimmerRect(componentTag + '_1', className, RECTANGLE_X, rectangle1Y, RECTANGLE_1_LENGTH, rectangleHeight)}
|
|
42
|
+
${ShimmerFactory._shimmerRect(componentTag + '_2', className, RECTANGLE_X, rectangle2Y, RECTANGLE_2_LENGTH, rectangleHeight)}
|
|
43
|
+
${ShimmerFactory._shimmerRect(componentTag + '_3', className, RECTANGLE_X, rectangle3Y, RECTANGLE_3_LENGTH, rectangleHeight)}
|
|
44
|
+
${ShimmerFactory._shimmerRect(componentTag + '_4', className, RECTANGLE_X, rectangle4Y, RECTANGLE_4_LENGTH, rectangleHeight)}
|
|
45
|
+
</g>
|
|
46
|
+
</svg>`;
|
|
47
|
+
if (containerMargin !== undefined) {
|
|
48
|
+
shimmerContainerDiv.style.margin = containerMargin + '';
|
|
49
|
+
}
|
|
50
|
+
shimmerContainerDiv.appendChild(shimmerDiv);
|
|
51
|
+
const shimmerAccessibilityContainerDiv = document.createElement('div');
|
|
52
|
+
shimmerAccessibilityContainerDiv.setAttribute('role', 'status');
|
|
53
|
+
shimmerAccessibilityContainerDiv.setAttribute('aria-live', 'polite');
|
|
54
|
+
shimmerContainerDiv.appendChild(shimmerAccessibilityContainerDiv);
|
|
55
|
+
return shimmerContainerDiv;
|
|
56
|
+
}
|
|
57
|
+
static _shimmerRect(id, className, x, y, width, height) {
|
|
58
|
+
return `<rect id=${id} class=${className} x=${x} y=${y} width="${width}%" height=${height}>
|
|
59
|
+
<animate
|
|
60
|
+
attributeName="opacity"
|
|
61
|
+
dur="1s"
|
|
62
|
+
values="0.2;0.5;0.9"
|
|
63
|
+
repeatCount="indefinite"
|
|
64
|
+
begin="0"/>
|
|
65
|
+
</rect>`;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Class to create shimmers for applications.
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/ export { ShimmerFactory as default };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=./ShimmerFactory.js.map
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* NOTE: Fabric.LocalFont is a modified copy of legacy Fabric that removes the
|
|
12
12
|
* use of Segoe CSS font-face in favor of local fonts (Segoe/SF/Roboto).
|
|
13
|
-
*/
|
|
14
|
-
import './fabric-core-sass/Fabric.LocalFont.global.scss';
|
|
13
|
+
*/ import './fabric-core-sass/Fabric.LocalFont.global.scss';
|
|
15
14
|
import './fabric-core-shim.global.scss';
|
|
16
15
|
import './iconDefinitions.css';
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=./FabricLocalFont.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { _SPFlight } from '@microsoft/sp-core-library';
|
|
2
2
|
// cross-project flight
|
|
3
3
|
export function isBotAcesFromTeamsEnabled() {
|
|
4
|
-
return _SPFlight.isEnabled(60693 /* APEXBotAceFromTeamsClient */);
|
|
4
|
+
return _SPFlight.isEnabled(60693 /* APEXBotAceFromTeamsClient */ );
|
|
5
5
|
}
|
|
6
6
|
// cross-project flight
|
|
7
7
|
export function isServerPropertiesSanitizedEnabled() {
|
|
8
|
-
return _SPFlight.isEnabled(61389 /* APEXServerPropertiesSanitizedEnabled */);
|
|
8
|
+
return _SPFlight.isEnabled(61389 /* APEXServerPropertiesSanitizedEnabled */ );
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=./Flights.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _SPKillSwitch } from '@microsoft/sp-core-library';
|
|
2
2
|
export function isExemptWebPartWithDynamicDataFromLazyLoadKSActivated() {
|
|
3
|
-
return _SPKillSwitch.isActivated('bbd78e03-ff18-40ed-9a94-973fc659366c' /* '12/01/2022', 'Update getWebPartsExemptedFromViewPortLoading to check for containsDynamicDataSource' */);
|
|
3
|
+
return _SPKillSwitch.isActivated('bbd78e03-ff18-40ed-9a94-973fc659366c' /* '12/01/2022', 'Update getWebPartsExemptedFromViewPortLoading to check for containsDynamicDataSource' */ );
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=./KillSwitches.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/ // eslint-disable-next-line @typescript-eslint/typedef
|
|
4
|
+
export const CacheStatus = {
|
|
5
|
+
True: 'true',
|
|
6
|
+
False: 'false',
|
|
7
|
+
NotAvailable: 'N/A'
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/ // eslint-disable-next-line @typescript-eslint/typedef
|
|
12
|
+
export const _CacheMissReason = {
|
|
13
|
+
/**
|
|
14
|
+
* Cache was available but config requested has changed.
|
|
15
|
+
*/ CacheConfigMissmatch: 'CacheConfigMissmatch',
|
|
16
|
+
/**
|
|
17
|
+
* Cache did not arrvie by the time web part requested it.
|
|
18
|
+
*/ LateFlush: 'LateFlush',
|
|
19
|
+
/**
|
|
20
|
+
* Cache is available but there is no cache entry for the web part.
|
|
21
|
+
*/ CachedItemNotFound: 'CachedItemNotFound',
|
|
22
|
+
/**
|
|
23
|
+
* Cache is available, config is also good but is too stale for use.
|
|
24
|
+
*/ CacheExpired: 'CacheExpired',
|
|
25
|
+
/**
|
|
26
|
+
* Cache miss happened but reason is not specified.
|
|
27
|
+
*/ NotSpecified: 'NotSpecified',
|
|
28
|
+
/**
|
|
29
|
+
* Not Applicable if there was cache hit.
|
|
30
|
+
*/ NotApplicable: 'N/A'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=./IWebPartLoadData.js.map
|