Update to SPFx v1.17.4 (#4022)

This commit is contained in:
Mikael Svenson 2023-09-07 11:17:44 +02:00 committed by GitHub
parent 53608b5c93
commit 0b56890d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 25310 additions and 24670 deletions

View File

@ -0,0 +1,22 @@
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
'@typescript-eslint/no-explicit-any': 0,
}
}
]
};

View File

@ -32,4 +32,6 @@ obj
*.scss.ts
# Release folder
release
release
.heft

View File

@ -1,12 +1,17 @@
{
"@microsoft/generator-sharepoint": {
"libraryName": "pnp-script-editor",
"version": "1.13.1",
"version": "1.17.4",
"environment": "spo",
"isDomainIsolated": false,
"libraryId": "1425175f-3ed8-44d2-8fc4-dd1497191294",
"isCreatingSolution": true,
"packageManager": "npm",
"componentType": "webpart"
"componentType": "webpart",
"nodeVersion": "16.20.0",
"sdkVersions": {
"@microsoft/teams-js": "2.9.1",
"@microsoft/microsoft-graph-client": "3.0.2"
}
}
}

View File

@ -201,6 +201,7 @@ Version|Date|Comments
1.0.20.0|October 10, 2022|Added sample html/script with self-executing function
1.0.21.0|March 11, 2023|Bump dependencies to allow react-script-editor to build under SPFx 1.16.1
1.0.22.0|April 24, 2023|Added support for script in external template
1.0.23.0|September 7, 2023|Upgrade to SPFx 1.17.4
## Minimal Path to Awesome

View File

@ -3,7 +3,7 @@
"solution": {
"name": "Modern Script Editor web part by mikaelsvenson",
"id": "1425175f-3ed8-44d2-8fc4-dd1497191294",
"version": "1.0.22.0",
"version": "1.0.23.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": false,
"isDomainIsolated": false,
@ -13,9 +13,31 @@
"termsOfUseUrl": "",
"websiteUrl": "",
"mpnId": ""
}
},
"metadata": {
"shortDescription": {
"default": "Script editor web part"
},
"longDescription": {
"default": "Script editor web part to allow arbitrary script and markup on a SharePoint page"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "PnP Modern Script Editor Web Part Feature",
"description": "The feature that activates ScriptEditorWebPart from the pnp-script-editor solution.",
"id": "3a328f0a-99c4-4b28-95ab-fe0847f657a3",
"version": "1.0.23.0",
"componentIds": [
"3a328f0a-99c4-4b28-95ab-fe0847f657a3"
]
}
]
},
"paths": {
"zippedPackage": "solution/pnp-script-editor.sppkg"
}
}
}

View File

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

View File

@ -1,6 +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,
"initialPage": "https://contoso.sharepoint.com/_layouts/workbench.aspx",
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx",
"https": true
}

File diff suppressed because it is too large Load Diff

View File

@ -6,40 +6,42 @@
"resolutions": {
"@types/react": "16.8.8"
},
"engines": {
"node": ">=16.13.0 <17.0.0"
},
"dependencies": {
"@microsoft/sp-core-library": "1.16.1",
"@microsoft/sp-loader": "1.16.1",
"@microsoft/sp-lodash-subset": "1.16.1",
"@microsoft/sp-property-pane": "1.16.1",
"@microsoft/sp-webpart-base": "1.16.1",
"@pnp/spfx-controls-react": "3.13.0",
"@pnp/spfx-property-controls": "3.12.0",
"office-ui-fabric-react": "7.174.1",
"react": "16.13.1",
"react-dom": "16.13.1"
"@fluentui/react": "7.199.1",
"@microsoft/sp-core-library": "1.17.4",
"@microsoft/sp-loader": "1.17.4",
"@microsoft/sp-lodash-subset": "1.17.4",
"@microsoft/sp-property-pane": "1.17.4",
"@microsoft/sp-webpart-base": "1.17.4",
"@pnp/spfx-controls-react": "3.15.0",
"@pnp/spfx-property-controls": "3.14.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"tslib": "2.3.1"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.2": "0.11.0",
"@microsoft/rush-stack-compiler-3.3": "0.10.0",
"@microsoft/rush-stack-compiler-3.7": "0.7.0",
"@microsoft/rush-stack-compiler-3.9": "0.5.0",
"@microsoft/rush-stack-compiler-4.5": "0.4.0",
"@microsoft/sp-build-web": "1.16.1",
"@microsoft/sp-module-interfaces": "1.16.1",
"@microsoft/sp-tslint-rules": "1.16.1",
"@types/chai": "3.4.34",
"@types/mocha": "2.2.38",
"@types/react": "16.9.51",
"@types/react-dom": "16.9.15",
"@types/webpack-env": "1.13.1",
"ajv": "~8.2.0",
"@microsoft/rush-stack-compiler-4.5": "0.5.0",
"@rushstack/eslint-config": "2.5.1",
"@microsoft/eslint-plugin-spfx": "1.17.4",
"@microsoft/eslint-config-spfx": "1.17.4",
"@microsoft/sp-build-web": "1.17.4",
"@types/webpack-env": "~1.15.2",
"ajv": "^6.12.5",
"eslint": "8.7.0",
"gulp": "4.0.2",
"tslint-microsoft-contrib": "5.0.0",
"webpack-bundle-analyzer": "^4.4.0"
"typescript": "4.5.5",
"@types/react": "17.0.45",
"@types/react-dom": "17.0.17",
"eslint-plugin-react-hooks": "4.3.0",
"@microsoft/sp-module-interfaces": "1.17.4",
"webpack-bundle-analyzer": "4.9.1"
},
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
}
}
}

View File

@ -15,7 +15,7 @@ export class PropertyPaneLogo implements IPropertyPaneField<IPropertyPaneCustomF
private onRender(elem: HTMLElement): void {
elem.innerHTML = `
<div style="margin-top: 30px">
<div style="float:right">Author: <a href="https://twitter.com/mikaelsvenson" tabindex="-1">Mikael Svenson</a></div>
<div style="float:right">Web part developer: <a href="https://twitter.com/mikaelsvenson" tabindex="-1">Mikael Svenson</a></div>
</div>`;
}
}

View File

@ -9,6 +9,7 @@
"supportedHosts": ["SharePointWebPart", "SharePointFullPage", "TeamsTab"],
"requiresCustomScript": true,
"supportsThemeVariants": true,
"hiddenFromToolbox": false,
"preconfiguredEntries": [{
"groupId": "3a328f0a-99c4-4b28-95ab-fe0847f657a3",
"group": {

View File

@ -104,7 +104,7 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart<IScriptEd
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
let webPartOptions: IPropertyPaneField<any>[] = [
const webPartOptions: IPropertyPaneField<any>[] = [
PropertyPaneTextField("title", {
label: "Title to show in edit mode",
value: this.properties.title
@ -122,15 +122,15 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart<IScriptEd
offText: "Disabled"
}),
PropertyPaneToggle('useExternalScript', {
label: 'Use an external HTML Code instead of inline script',
onText: "Use external HTML Code",
label: 'Use script from an external URL instead of inline script',
onText: "Use external script",
offText: "Use inline script"
}),
];
if (this.properties.useExternalScript) {
webPartOptions.push(PropertyPaneTextField("externalScript", {
label: "External HTML Code URL",
label: "Script URL",
value: this.properties.externalScript,
}));
} else {
@ -138,7 +138,7 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart<IScriptEd
}
if (this.context.sdks.microsoftTeams) {
let config = PropertyPaneToggle("teamsContext", {
const config = PropertyPaneToggle("teamsContext", {
label: "Enable teams context as _teamsContexInfo",
checked: this.properties.teamsContext,
onText: "Enabled",
@ -201,7 +201,7 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart<IScriptEd
private async executeScript(element: HTMLElement) {
// clean up added script tags in case of smart re-load
const headTag = document.getElementsByTagName("head")[0] || document.documentElement;
let scriptTags = headTag.getElementsByTagName("script");
const scriptTags = headTag.getElementsByTagName("script");
for (let i = 0; i < scriptTags.length; i++) {
const scriptTag = scriptTags[i];
if (scriptTag.hasAttribute("pnpname") && scriptTag.attributes["pnpname"].value == this._unqiueId) {

View File

@ -1 +1 @@
@import '~office-ui-fabric-react/dist/sass/References.scss';
@import '~@fluentui/react/dist/sass/References.scss'

View File

@ -7,7 +7,7 @@ export default class ScriptEditor extends React.Component<IScriptEditorProps, an
super(props);
this._showDialog = this._showDialog.bind(this);
this.state = {};
this.state = state || {};
}
public componentDidMount(): void {
@ -19,7 +19,7 @@ export default class ScriptEditor extends React.Component<IScriptEditorProps, an
}
public render(): React.ReactElement<IScriptEditorProps> {
const viewMode = <span dangerouslySetInnerHTML={{ __html: this.state.script }}></span>;
const viewMode = <span dangerouslySetInnerHTML={{ __html: this.state.script }} />;
return (
<div className='ms-Fabric'>
<Placeholder iconName='JS'

View File

@ -1,9 +0,0 @@
/// <reference types="mocha" />
import { assert } from 'chai';
describe('ScriptEditorWebPart', () => {
it('should do something', () => {
assert.ok(true);
});
});