@spfx-extensions/package 1.5.0 → 1.5.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/config/package-solution.json +2 -2
- package/dist/8d1029da-85e6-48cc-aaaf-37a5bbc0b9be.manifest.json +2 -2
- package/dist/d6ca1fc2-0591-4c6d-8a25-cae3262c017b.manifest.json +2 -2
- package/dist/debug/83e13c11-682e-4eaa-9ae0-74617ca28f96/Extension_8d1029da-85e6-48cc-aaaf-37a5bbc0b9be.xml +1 -1
- package/dist/debug/83e13c11-682e-4eaa-9ae0-74617ca28f96/WebPart_d6ca1fc2-0591-4c6d-8a25-cae3262c017b.xml +1 -1
- package/dist/debug/AppManifest.xml +1 -1
- package/dist/debug/ClientSideAssets/{spfx-extension-application-customizer_e311449ea569bb96355d.js → spfx-extension-application-customizer_76f02fb6b7d723e79de2.js} +1 -1
- package/dist/debug/ClientSideAssets/spfx-extension-core.js +1 -1
- package/dist/debug/ClientSideAssets/spfx-extension-coreconfigurator.js +14 -14
- package/dist/{spfx-extension-loader_216295ea1be5755397c2.js → debug/ClientSideAssets/spfx-extension-loader_d240a9da5827c10c0439.js} +1 -1
- package/dist/debug/ClientSideAssets/spfx-extensionloader-web-part_778d06883d4678c8ac03.js +3 -0
- package/dist/debug/ClientSideAssets.xml +1 -1
- package/dist/debug/ClientSideAssets.xml.config.xml +1 -1
- package/dist/debug/_rels/ClientSideAssets.xml.rels +1 -1
- package/dist/debug/feature_83e13c11-682e-4eaa-9ae0-74617ca28f96.xml +1 -1
- package/dist/debug/feature_83e13c11-682e-4eaa-9ae0-74617ca28f96.xml.config.xml +1 -1
- package/dist/deploy/sp-fx-extensions.sppkg +0 -0
- package/dist/{spfx-extension-application-customizer_e311449ea569bb96355d.js → spfx-extension-application-customizer_76f02fb6b7d723e79de2.js} +1 -1
- package/dist/spfx-extension-core.js +1 -1
- package/dist/spfx-extension-coreconfigurator.js +14 -14
- package/dist/{debug/ClientSideAssets/spfx-extension-loader_216295ea1be5755397c2.js → spfx-extension-loader_d240a9da5827c10c0439.js} +1 -1
- package/dist/spfx-extensionloader-web-part_778d06883d4678c8ac03.js +3 -0
- package/package.json +2 -2
- package/src/webparts/spfxExtensionloader/SpfxExtensionloaderWebPart.ts +197 -129
- package/dist/debug/ClientSideAssets/spfx-extensionloader-web-part_bf2aa294d1beeca6622b.js +0 -3
- package/dist/spfx-extensionloader-web-part_bf2aa294d1beeca6622b.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";(self.
|
|
1
|
+
"use strict";(self.webpackJsonp_f43f27c4ea448cbdacef657591e86913=self.webpackJsonp_f43f27c4ea448cbdacef657591e86913||[]).push([[548],{364:(e,t,n)=>{n.d(t,{initCore:()=>p});var a=n(367),{getPrototypeOf:i,defineProperty:r,getOwnPropertyNames:o}=(Object.create,Object);Object.prototype.hasOwnProperty;const s=n.p+"spfx-extension-core.js?v=8055e590c853bedb98c4",c=n.p+"spfx-extension-coreconfigurator.js?v=05c161bd2996e54939f4",d=n.p+"spfx-extension-wrapper.js?v=eac83830b8c1e249f52c";let l,u=!1;async function f(){return Promise.resolve({coreUrl:s,configuratorUrl:c,wrapperUrl:d})}async function p(e,t,n){if(!l){const t="2025-08-07T10:07:29.143Z";console.info(a.Lf,"Initializing Core from SPFx Built:",t),l=async function(e,t){if(window.__SPFxExtensions?.__CorePromise)return window.__SPFxExtensions.__CorePromise;!function(e){if(!window.__SPFxExtensions){let{promise:e,resolve:t}=Promise.withResolvers();window.__SPFxExtensions={__CorePromise:e,__CorePromiseResolver:t}}if(!window.__SPFxExtensions.Utils){let{promise:t,resolve:n}=Promise.withResolvers(),{promise:a,resolve:i}=Promise.withResolvers();window.__SPFxExtensions.Utils={environmentType:e,initializedThroughSPFX:true,placeHolderProviderPromise:t,placeHolderResolver:n,appManifestPromises:[],spAppInitializationPromise:a,spAppInitializationPromiseResolver:i,fluentIconsInitialized:!1,ConfiguratorPageUrl:"/sites/appcatalog/SPFxExtensionsData/SitePages/SPFxExtensionsConfigurator.aspx"}}}(t);let n=await async function(e){let t=Number(localStorage.getItem("SPFXEXT")),n={core:"",configuratorUrl:""};if(t>0){let e=Date.now();return n.core=`https://localhost:${t}/__spfxCore.js?v=${e}`,n.configuratorUrl=`https://localhost:${t}/__spfxCoreConfigurator.js?v=${e}`,n}let{coreUrl:a,configuratorUrl:i}=await e();if(!a)throw new Error("[SPFxExtensions/Core] Unable to resolve SPFx Core location");if(!i)throw new Error("[SPFxExtensions/Core] Unable to resolve SPFx Core Configurator location");return n.core=a,n.configuratorUrl=i,console.info("[SPFxExtensions/Core]","Core location resolved to",n),n}(e);window.__SPFxExtensions.__ConfiguratorUrl=n.configuratorUrl;let a=document.createElement("script");return a.src=n.core,a.type="module",a.addEventListener("error",e=>{console.error("[SPFxExtensions/Core]","Catastrophic failure, cannot load SPFxExtensions Core from",n,e)}),document.head.appendChild(a),window.__SPFxExtensions.__CorePromise}(f,e)}await l,window.__SPFxExtensions.Utils&&!window.__SPFxExtensions.Utils.initializedThroughSPFX&&(window.__SPFxExtensions.Utils.environmentType=e,window.__SPFxExtensions.Utils.initializedThroughSPFX=!0),!u&&t&&n&&(u=!0,window.__SPFxExtensions.Utils.placeHolderResolver({placeHolderProvider:t,eventObserver:n}))}}
|
|
2
2
|
,367:(e,t,n)=>{n.d(t,{Bc:()=>r,Lf:()=>o,Ne:()=>a,oz:()=>i});const a="Select one of these web parts for this column.",i="Edit page and select webpart.",r="Webpart that loads an app of your choice.",o="[SPFxExtensions]"}
|
|
3
3
|
}]);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(()=>{var e=document.currentScript;define(["@microsoft/sp-core-library","@microsoft/sp-property-pane","@microsoft/sp-webpart-base","@microsoft/sp-component-base"],(t,n,a,i)=>(()=>{"use strict";var r,o,s,c={367:(e,t,n)=>{n.d(t,{Bc:()=>r,Lf:()=>o,Ne:()=>a,oz:()=>i});const a="Select one of these web parts for this column.",i="Edit page and select webpart.",r="Webpart that loads an app of your choice.",o="[SPFxExtensions]"}
|
|
2
|
+
,574:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var a,i,r=function(){return r=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};!function(e){e[e.sync=0]="sync",e[e.async=1]="async"}(a||(a={})),function(e){e[e.onlyThemable=1]="onlyThemable",e[e.onlyNonThemable=2]="onlyNonThemable",e[e.all=3]="all"}(i||(i={}));var o,s,c,d="undefined"==typeof window?n.g:window,l=d&&d.CSPSettings&&d.CSPSettings.nonce,u=((c=d.__themeState__||{theme:void 0,lastStyleElement:void 0,registeredStyles:[]}).runState||(c=r(r({},c),{perf:{count:0,duration:0},runState:{flushTimer:0,mode:a.sync,buffer:[]}})),c.registeredThemableStyles||(c=r(r({},c),{registeredThemableStyles:[]})),d.__themeState__=c,c),f=/[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g,p=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};function m(e){var t=p();e();var n=p();u.perf.duration+=n-t}function _(e,t){u.loadStyles?u.loadStyles(h(e).styleString,e):function(e){if("undefined"!=typeof document){var t=document.getElementsByTagName("head")[0],n=document.createElement("style"),a=h(e),i=a.styleString,r=a.themable;n.setAttribute("data-load-themed-styles","true"),l&&n.setAttribute("nonce",l),n.appendChild(document.createTextNode(i)),u.perf.count++,t.appendChild(n);var o=document.createEvent("HTMLEvents");o.initEvent("styleinsert",!0,!1),o.args={newStyle:n},document.dispatchEvent(o);var s={styleElement:n,themableStyle:e};r?u.registeredThemableStyles.push(s):u.registeredStyles.push(s)}}(e)}function h(e){var t=u.theme,n=!1;return{styleString:(e||[]).map(function(e){var a=e.theme;if(a){n=!0;var i=t?t[a]:void 0,r=e.defaultValue||"inherit";return t&&!i&&console,i||r}return e.rawString}).join(""),themable:n}}o='.spfxExtensionloader_be4e0fd1{color:"[theme:bodyText, default: #323130]";color:var(--bodyText);overflow:hidden;padding:1em}.spfxExtensionloader_be4e0fd1.teams_be4e0fd1{font-family:Segoe UI,-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif}.welcome_be4e0fd1{text-align:center}.welcomeImage_be4e0fd1{max-width:420px;width:100%}.links_be4e0fd1 a{color:"[theme:link, default:#03787c]";color:var(--link);text-decoration:none}.links_be4e0fd1 a:hover{color:"[theme:linkHovered, default: #014446]";color:var(--linkHovered);text-decoration:underline}.SPFxExtensionApp_be4e0fd1 .loader_be4e0fd1{animation:rotation_be4e0fd1 1s linear infinite;border:2px solid #003755;border-bottom-color:#009fda;border-radius:50%;box-sizing:border-box;display:inline-block;height:28px;width:28px}@keyframes rotation_be4e0fd1{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.SPFxExtensionApp_be4e0fd1 .buttonLoader_be4e0fd1{align-items:center;border:none;display:flex;height:80px;justify-content:center;width:120px}.SPFxExtensionApp_be4e0fd1 .shimmerShine_be4e0fd1{-webkit-animation-duration:1s;-webkit-animation-fill-mode:forwards;-webkit-animation-iteration-count:infinite;-webkit-animation-name:placeholderShimmer_be4e0fd1;-webkit-animation-timing-function:linear;background:#f6f7f8;background-image:linear-gradient(90deg,#f6f7f8 0,#edeef1 20%,#f6f7f8 40%,#f6f7f8);background-repeat:no-repeat;background-size:200px 80px;border:none;display:block;height:80px;position:relative;width:120px}@keyframes placeholderShimmer_be4e0fd1{0%{background-position:-80px 0}to{background-position:120px 0}}.SPFxExtensionApp_be4e0fd1 .applicationListSection_be4e0fd1{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center;min-height:320px;text-align:center}.SPFxExtensionApp_be4e0fd1 .header_be4e0fd1{color:#242424;font-weight:600;letter-spacing:1px;line-height:32px;padding:0 12px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1{font-size:28px;font-style:normal;height:28px;line-height:28px;min-width:28px;width:28px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>img,.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>svg{height:auto;width:100%}.SPFxExtensionApp_be4e0fd1 .iconFont_be4e0fd1{background-color:#f6f7f8}.SPFxExtensionApp_be4e0fd1 .appButtonsContainer_be4e0fd1{align-items:center;display:flex;flex-wrap:wrap;height:100%;justify-content:center}.SPFxExtensionApp_be4e0fd1 .appButtonsWrapper_be4e0fd1{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;height:100%;justify-content:flex-start;width:100%}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1{align-items:center;background-color:unset;border:none;display:flex;flex-direction:column;height:80px;padding-top:14px;width:120px}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1:hover{background-color:#c8e3fa}',void 0===(s=!0)&&(s=!1),m(function(){var e=Array.isArray(o)?o:function(e){var t=[];if(e){for(var n=0,a=void 0;a=f.exec(e);){var i=a.index;i>n&&t.push({rawString:e.substring(n,i)}),t.push({theme:a[1],defaultValue:a[2]}),n=f.lastIndex}t.push({rawString:e.substring(n)})}return t}(o),t=u.runState,n=t.mode,i=t.buffer,r=t.flushTimer;s||n===a.async?(i.push(e),r||(u.runState.flushTimer=self.setTimeout(function(){u.runState.flushTimer=0,m(function(){var e=u.runState.buffer.slice();u.runState.buffer=[];var t=[].concat.apply([],e);t.length>0&&_(t)})},0))):_(e)});const b={spfxExtensionloader_be4e0fd1:"spfxExtensionloader_be4e0fd1",teams_be4e0fd1:"teams_be4e0fd1",welcome_be4e0fd1:"welcome_be4e0fd1",welcomeImage_be4e0fd1:"welcomeImage_be4e0fd1",links_be4e0fd1:"links_be4e0fd1",SPFxExtensionApp_be4e0fd1:"SPFxExtensionApp_be4e0fd1",loader_be4e0fd1:"loader_be4e0fd1",rotation_be4e0fd1:"rotation_be4e0fd1",buttonLoader_be4e0fd1:"buttonLoader_be4e0fd1",shimmerShine_be4e0fd1:"shimmerShine_be4e0fd1",placeholderShimmer_be4e0fd1:"placeholderShimmer_be4e0fd1",applicationListSection_be4e0fd1:"applicationListSection_be4e0fd1",header_be4e0fd1:"header_be4e0fd1",icon_be4e0fd1:"icon_be4e0fd1",iconFont_be4e0fd1:"iconFont_be4e0fd1",appButtonsContainer_be4e0fd1:"appButtonsContainer_be4e0fd1",appButtonsWrapper_be4e0fd1:"appButtonsWrapper_be4e0fd1",appButton_be4e0fd1:"appButton_be4e0fd1"}}
|
|
3
|
+
,962:e=>{e.exports=i},676:e=>{e.exports=t},877:e=>{e.exports=n},642:e=>{e.exports=a}},d={};function l(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return c[e](n,n.exports,l),n.exports}l.m=c,l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,n)=>(l.f[n](e,t),t),[])),l.u=e=>"spfx-extension-loader_d240a9da5827c10c0439.js",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="f43f27c4ea448cbdacef657591e86913:",l.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var i,s;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==o+n){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.setAttribute("data-webpack",o+n),i.src=e,0!==i.src.indexOf(window.location.origin+"/")&&(i.crossOrigin="anonymous")),r[e]=[t];var f=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),s&&document.head.appendChild(i)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s=e?e.src:"",l.p=s.slice(0,s.lastIndexOf("/")+1),(()=>{var e={650:0};l.f.j=(t,n)=>{var a=l.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else{var i=new Promise((n,i)=>a=e[t]=[n,i]);n.push(a[2]=i);var r=l.p+l.u(t),o=new Error;l.l(r,n=>{if(l.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",o.name="ChunkLoadError",o.type=i,o.request=r,a[1](o)}},"chunk-"+t,t)}};var t=(t,n)=>{var a,i,[r,o,s]=n,c=0;if(r.some(t=>0!==e[t])){for(a in o)l.o(o,a)&&(l.m[a]=o[a]);s&&s(l)}for(t&&t(n);c<r.length;c++)i=r[c],l.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=self.webpackJsonp_f43f27c4ea448cbdacef657591e86913=self.webpackJsonp_f43f27c4ea448cbdacef657591e86913||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{l.r(u),l.d(u,{default:()=>r});var e=l(676),t=l(877),n=l(642),a=l(367),i=l(962);l(574);class r extends n.BaseClientSideWebPart{SPFxExtensionInstance;allApps=[];appCatalogUrl="/sites/appcatalog";dropDownProps={options:[],selectedKey:"",disabled:!0};appDescription="";hideAppSelectorWhenAppLoaded=!1;hideConfiguratorButton=!1;configDomElement;themeProvider;serviceScope;appButtonElements=[];webpartSectionElement=document.createElement("section");webpartSectionTitle=document.createElement("header");appButtonsWrapper=document.createElement("div");appButtonsContainer=document.createElement("div");webPartContext;webPartComponentId;webPartInstanceId;webPartWidth;async onInit(){const t=e.Environment.type===e.EnvironmentType.SharePoint?"SharePoint":"ClassicSharePoint";this.themeProvider=this.context.serviceScope.consume(i.ThemeProvider.serviceKey),this.serviceScope=this.context.serviceScope,this.webPartContext=this.context,this.webPartInstanceId=this.instanceId,this.webPartComponentId=this.componentId,this.webPartWidth=this.width;const{initCore:n}=await l.e(548).then(l.bind(l,364));await n(t),this.appCatalogUrl=window.__SPFxExtensions.Utils.ConfiguratorPageUrl}openPropertyPane(){this.context.propertyPane.open()}closePropertyPane(){this.context.propertyPane.close()}isPropertyPaneOpen(){return this.context.propertyPane.isPropertyPaneOpen()}saveConfigValue(e,t=!0){this.properties.SPFxExtensionAppConfiguration=e,t&&this.SPFxExtensionInstance?.executeListeners("onConfigurationChange",e)}getConfigValue(e){if(e){let t=this.properties[e];return void 0===t&&(t=this.properties.SPFxExtensionAppConfiguration),t}return this.properties.SPFxExtensionAppConfiguration}getSearchData(){return{searchableText:this.properties.searchableText,searchableHtml:this.properties.searchableHtml}}setSearchData(e){this.properties.searchableText=e.searchableText,this.properties.searchableHtml=e.searchableHtml}getTopActions(){return this.properties.topActions??[]}setTopActions(e){this.properties.topActions=e??[]}getThemeProvider(){return this.themeProvider}getConfigDomElement(){return this.configDomElement}getContext(){return this.webPartContext}getServiceScope(){return this.serviceScope}async mountApp(e){this.domElement.innerHTML="";try{const t={domElement:this.domElement,webpart:this,openPropertyPane:()=>{this.openPropertyPane()},closePropertyPane:()=>{this.closePropertyPane()},isPropertyPaneOpen:()=>this.isPropertyPaneOpen(),saveConfigValue:(e,t=!0)=>{this.saveConfigValue(e,t)},getConfigValue:e=>this.getConfigValue(e),getSearchableData:()=>this.getSearchData(),setSearchableData:e=>{this.setSearchData(e)},setTopActions:e=>{this.setTopActions(e)},getTopActions:()=>this.getTopActions(),getThemeProvider:()=>this.getThemeProvider(),getConfigDomElement:()=>this.getConfigDomElement(),getContext:()=>this.getContext(),getServiceScope:()=>this.getServiceScope()};if(this.SPFxExtensionInstance=await window.__SPFxExtensions.InstantiateApp(e,t),!this.SPFxExtensionInstance)return void console.warn(a.Lf,"App instance is undefined, cannot mount app",e);const n=window.__SPFxExtensions.Apps.find(t=>t.id===e);n&&(this.appDescription=n.description)}catch(t){return console.error(a.Lf,"Error while mounting appid",e,t),new Error(`${t}`)}}unmountApp(){this.SPFxExtensionInstance&&this.SPFxExtensionInstance.unmount?.(),this.SPFxExtensionInstance=void 0,this.domElement.innerHTML=""}generateIconElement(e){const t=document.createElement("i");if(t.classList.add("icon_be4e0fd1"),!e)return t.innerHTML='<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" aria-hidden="true" width="28" height="28" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M20.84 2.66a2.25 2.25 0 0 0-3.18 0L13.5 6.8v-.56c0-1.24-1-2.25-2.25-2.25h-7C3.01 4 2 5.01 2 6.25v18c0 .97.78 1.75 1.75 1.75h18c1.24 0 2.25-1 2.25-2.25v-7c0-1.24-1-2.25-2.25-2.25h-.56l4.16-4.15c.88-.88.88-2.3 0-3.19l-4.5-4.5ZM17.31 14.5H13.5v-3.8l3.8 3.8Zm1.41-10.78c.3-.3.77-.3 1.06 0l4.5 4.5c.3.3.3.77 0 1.06l-4.5 4.51c-.3.3-.77.3-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.07l4.5-4.5ZM12 6.25v8.25H3.5V6.25c0-.41.34-.75.75-.75h7c.41 0 .75.34.75.75Zm-8.5 17.5V16H12v8.5H4.25a.75.75 0 0 1-.75-.75Zm10-7.75h8.25c.41 0 .75.34.75.75v7c0 .42-.34.75-.75.75H13.5V16Z" fill="currentColor"></path></svg>',t;if("font"===e.iconType&&e.fontFamily&&(t.style.fontFamily=e.fontFamily,t.classList.add("iconFont_be4e0fd1")),"url"===e.iconType){const n=document.createElement("img");n.src=e.iconData,t.appendChild(n)}return"svg"===e.iconType&&(t.innerHTML=e.iconData),t}createAndAppendAppButtons(e){const t=document.createElement("button");t.title=a.Bc,t.ariaLabel=a.Bc,t.className="appButton_be4e0fd1";const n=this.generateIconElement(e.icon);t.append(n,e.name),t.title=e.name,t.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.properties.selectedApp=e.id,this.webpartSectionElement.remove(),this.dropDownProps.selectedKey=e.id,this.context.propertyPane.refresh(),this.mountApp(e.id).catch(()=>{})}),this.appButtonsContainer.appendChild(t)}createWebpartSection(e){this.webpartSectionElement.className="applicationListSection_be4e0fd1",this.webpartSectionTitle.className="header_be4e0fd1",this.webpartSectionElement.appendChild(this.webpartSectionTitle),e&&this.webpartSectionElement.appendChild(this.appButtonsWrapper)}renderDisplayMode(){this.webpartSectionElement.ariaLabel=a.oz,this.webpartSectionTitle.textContent=a.oz,this.createWebpartSection(),this.domElement.appendChild(this.webpartSectionElement)}async renderEditMode(){this.webpartSectionElement.ariaLabel=a.Ne,this.webpartSectionTitle.textContent=a.Ne,this.createWebpartSection(!0),this.appButtonsContainer.className="appButtonsContainer_be4e0fd1",this.appButtonsWrapper.appendChild(this.appButtonsContainer),this.appButtonsWrapper.className="appButtonsWrapper_be4e0fd1",this.domElement.appendChild(this.webpartSectionElement),window.__SPFxExtensions.AddAppEventListener("appAdded",e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)}),window.__SPFxExtensions.Apps.filter(e=>e.registrationCompleted).forEach(e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)});try{await window.__SPFxExtensions.Utils.spAppInitializationPromise,window.__SPFxExtensions.Utils.appManifestPromises.forEach(e=>{const t=document.createElement("div"),n=document.createElement("span");t.className="buttonLoader_be4e0fd1",n.className="loader_be4e0fd1",t.appendChild(n),this.appButtonsContainer.append(t),e.catch(()=>{}).finally(()=>{t.remove()})})}catch(e){return console.error(a.Lf,"Error while awaiting app initialization",e),new Error(`Error while awaiting app initialization: ${e}`)}}async renderEmptyApp(){if(this.domElement.innerHTML="",this.domElement.className="SPFxExtensionApp_be4e0fd1",this.displayMode!==e.DisplayMode.Read)return this.renderEditMode();this.renderDisplayMode()}async render(){let e;try{if(this.SPFxExtensionInstance){if(!this.SPFxExtensionInstance.unmountOnRender)return void this.SPFxExtensionInstance.executeListeners("onRender",void 0);this.unmountApp()}if(this.properties.selectedApp&&!this.SPFxExtensionInstance)return void(e=await this.mountApp(this.properties.selectedApp));e=await this.renderEmptyApp()}finally{this.renderCompleted(e,!0)}}renderCompleted(e,t){super.renderCompleted(e,t)}get isRenderAsync(){return!0}get propertiesMetadata(){return{searchableText:{isSearchablePlainText:!0},searchableHtml:{isHtmlString:!0}}}CustomWebpartConfigurationField(e){return{type:t.PropertyPaneFieldType.Custom,targetProperty:e,properties:{key:e,onRender:(e,t,n)=>{this.configDomElement=e,this.SPFxExtensionInstance?.instanceLoadPromise.then(()=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationRender",{domElement:e})}).catch(e=>{console.error(a.Lf,"Error while awaiting app to load",e)})},onDispose:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationClose",{domElement:e}),this.configDomElement=void 0}}}}onPropertyPaneConfigurationStart(){window.__SPFxExtensions.AllAppAssetsLoadedPromise.then(()=>{const e=window.__SPFxExtensions.Apps.find(e=>e.id===this.properties.selectedApp);e&&(this.appDescription=e.description,this.hideAppSelectorWhenAppLoaded=e.hideAppSelectorWhenAppLoaded??!1,this.hideConfiguratorButton=e.hideConfiguratorButton??!1),this.dropDownProps.options?.splice(0,this.dropDownProps.options?.length);const t=window.__SPFxExtensions.Apps.filter(e=>e.isWebPartApp).map(e=>({key:e.id,text:e.name}));this.dropDownProps.options?.push(...t),this.dropDownProps.selectedKey=this.properties.selectedApp,this.dropDownProps.disabled=!1,this.context.propertyPane.refresh()}).catch(e=>{console.error(a.Lf,"Error while awaiting all app assets to load",e)})}getPropertyPaneConfiguration(){const e={groupFields:[(0,t.PropertyPaneLabel)("spfxExtensionLoaderLabel",{text:"App not working? Try refreshing the page. Or go to the configuration page."}),(0,t.PropertyPaneButton)("configuratorButton",{text:"Open Configurator",buttonType:1,onClick:()=>{window.open(`${this.appCatalogUrl}?web=${this.context.pageContext.web.absoluteUrl}`,"_blank")}})]},n=this.hideConfiguratorButton?[]:[e],a={groupFields:[(0,t.PropertyPaneDropdown)("selectedApp",{label:"App",disabled:this.dropDownProps.disabled,options:this.dropDownProps.options,selectedKey:this.dropDownProps.selectedKey}),(0,t.PropertyPaneLabel)("selectedAppDecription",{text:this.appDescription})]};return{pages:[{groups:[...n,...this.hideAppSelectorWhenAppLoaded?[]:[a],{groupFields:[this.CustomWebpartConfigurationField("SPFxExtensionAppConfiguration")]}]}]}}getTopActionsConfiguration(){return{topActions:this.properties.topActions??[],onExecute:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onTopActionExecute",{actionName:e,updatedValue:t})}}}onPropertyPaneConfigurationComplete(){!this.context.propertyPane.isPropertyPaneOpen()&&this.SPFxExtensionInstance&&this.SPFxExtensionInstance.executeListeners("onConfigurationClose",{domElement:this.configDomElement})}onPropertyPaneFieldChanged(e,t,n){if("selectedApp"===e){if(t&&t!==n&&this.SPFxExtensionInstance){if(!confirm("You are about to switch app, this will erase all previous app configuration. Are you sure?"))return void(this.properties[e]=t);this.unmountApp()}n&&(this.webpartSectionElement.remove(),this.mountApp(n).catch(()=>{}))}}onDisplayModeChanged(t){const n=t===e.DisplayMode.Edit?"Read":"Edit";this.SPFxExtensionInstance?.executeListeners("onDisplayModeChange",n)}onAfterPropertyPaneChangesApplied(){this.SPFxExtensionInstance?.executeListeners("onPropertyPaneChangesApplied",void 0)}onAfterResize(e){this.SPFxExtensionInstance?.executeListeners("onAfterResize",{newWidth:e})}onDispose(){this.unmountApp(),this.appButtonElements.forEach(e=>{e.remove()}),this.appButtonElements.splice(0,this.appButtonElements.length),this.webpartSectionElement.remove(),this.webpartSectionTitle.remove(),this.appButtonsWrapper.remove(),this.appButtonsContainer.remove()}onThemeChanged(e){this.SPFxExtensionInstance?.executeListeners("onThemeChange",e)}get dataVersion(){return e.Version.parse("1.0")}}})(),u})())})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spfx-extensions/package",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"author": "SPWizard01",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@microsoft/sp-office-ui-fabric-core": "^1.21.1",
|
|
45
45
|
"@microsoft/sp-property-pane": "^1.21.1",
|
|
46
46
|
"@microsoft/sp-webpart-base": "^1.21.1",
|
|
47
|
-
"@spfx-extensions/core": "^0.
|
|
47
|
+
"@spfx-extensions/core": "^0.9.0",
|
|
48
48
|
"tslib": "^2.8.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DisplayMode, Environment, EnvironmentType, Version } from "@microsoft/sp-core-library";
|
|
1
|
+
import { DisplayMode, Environment, EnvironmentType, ServiceScope, Version } from "@microsoft/sp-core-library";
|
|
2
2
|
import {
|
|
3
3
|
IPropertyPaneConditionalGroup,
|
|
4
4
|
type IPropertyPaneConfiguration,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
PropertyPaneFieldType,
|
|
13
13
|
PropertyPaneLabel
|
|
14
14
|
} from "@microsoft/sp-property-pane";
|
|
15
|
-
import { BaseClientSideWebPart, IWebPartPropertiesMetadata } from "@microsoft/sp-webpart-base";
|
|
15
|
+
import { BaseClientSideWebPart, IWebPartPropertiesMetadata, WebPartContext } from "@microsoft/sp-webpart-base";
|
|
16
16
|
import { ITopActions, ITopActionsField } from "@microsoft/sp-top-actions";
|
|
17
17
|
import { SPFxExtensionAppConfig, SPFxExtensionAppDefinition, SPFxExtensionAppIcon, SPFxExtensionAppInstance, SPFxExtensionAppRuntimeConfig, SPFxExtensionAppSearchableData } from "@spfx-extensions/core";
|
|
18
18
|
import { APP_BUTTON_LABEL, EDIT_PAGE_AND_SELECT_WEBPART, SELECT_WEBPART, SPFXPREFIX } from "../../utilities/constants";
|
|
@@ -47,17 +47,37 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
47
47
|
hideAppSelectorWhenAppLoaded = false;
|
|
48
48
|
hideConfiguratorButton = false;
|
|
49
49
|
configDomElement: HTMLElement | undefined;
|
|
50
|
-
_isDarkTheme: boolean = false;
|
|
51
50
|
themeProvider: ThemeProvider | undefined;
|
|
51
|
+
serviceScope: ServiceScope | undefined;
|
|
52
|
+
appButtonElements: HTMLElement[] = [];
|
|
53
|
+
|
|
54
|
+
webpartSectionElement = document.createElement("section");
|
|
55
|
+
webpartSectionTitle = document.createElement("header");
|
|
56
|
+
appButtonsWrapper = document.createElement("div");
|
|
57
|
+
appButtonsContainer = document.createElement("div");
|
|
58
|
+
|
|
59
|
+
// for some reason onRender these properties are not available if accessing `this` on edit mode
|
|
60
|
+
// so we copy them in onInit
|
|
61
|
+
webPartContext!: WebPartContext;
|
|
62
|
+
webPartComponentId!: string;
|
|
63
|
+
webPartInstanceId!: string;
|
|
64
|
+
webPartWidth!: number;
|
|
65
|
+
|
|
52
66
|
public async onInit() {
|
|
53
67
|
if (DEBUG) {
|
|
54
|
-
console.debug(SPFXPREFIX, "onInit");
|
|
68
|
+
console.debug(SPFXPREFIX, "onInit", this.instanceId);
|
|
55
69
|
}
|
|
56
70
|
const envType =
|
|
57
71
|
Environment.type === EnvironmentType.SharePoint
|
|
58
72
|
? "SharePoint"
|
|
59
73
|
: "ClassicSharePoint";
|
|
60
74
|
this.themeProvider = this.context.serviceScope.consume(ThemeProvider.serviceKey);
|
|
75
|
+
this.serviceScope = this.context.serviceScope;
|
|
76
|
+
|
|
77
|
+
this.webPartContext = this.context;
|
|
78
|
+
this.webPartInstanceId = this.instanceId;
|
|
79
|
+
this.webPartComponentId = this.componentId;
|
|
80
|
+
this.webPartWidth = this.width;
|
|
61
81
|
|
|
62
82
|
const { initCore } = await import(/* webpackChunkName: "spfx-extension-loader" */"../../services/initCoreService");
|
|
63
83
|
//init core then do stuff;
|
|
@@ -65,63 +85,8 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
65
85
|
this.appCatalogUrl = window.__SPFxExtensions.Utils.ConfiguratorPageUrl;
|
|
66
86
|
}
|
|
67
87
|
|
|
68
|
-
protected onPropertyPaneConfigurationComplete(): void {
|
|
69
|
-
const isPaneOpen = this.context.propertyPane.isPropertyPaneOpen();
|
|
70
|
-
|
|
71
|
-
// notify close only if the pane is not open
|
|
72
|
-
// complete event fires also when config is saved
|
|
73
|
-
// This event method is invoked in the following cases:
|
|
74
|
-
|
|
75
|
-
// When the CONFIGURATION_COMPLETE_TIMEOUT((currently the value is 5 secs) elapses after the last change.
|
|
76
|
-
|
|
77
|
-
// When user clicks the "X" (close) button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
|
|
78
|
-
|
|
79
|
-
// When user clicks the 'Apply' button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
|
|
80
|
-
|
|
81
|
-
// When the user switches web parts then the current web part gets this event.
|
|
82
|
-
if (!isPaneOpen && this.SPFxExtensionInstance) {
|
|
83
|
-
|
|
84
|
-
this.SPFxExtensionInstance.executeListeners(
|
|
85
|
-
"onConfigurationClose",
|
|
86
|
-
{ domElement: this.configDomElement }
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
protected onPropertyPaneFieldChanged(
|
|
92
|
-
propertyPath: propertyPath,
|
|
93
|
-
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
-
oldValue: any,
|
|
95
|
-
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
|
-
newValue: any
|
|
97
|
-
): void {
|
|
98
|
-
// if selected app changed unmount the old app
|
|
99
|
-
if (propertyPath === "selectedApp") {
|
|
100
|
-
if (oldValue && oldValue !== newValue && this.SPFxExtensionInstance) {
|
|
101
|
-
const shouldUnmount = confirm(
|
|
102
|
-
"You are about to switch app, this will erase all previous app configuration. Are you sure?"
|
|
103
|
-
);
|
|
104
|
-
if (!shouldUnmount) {
|
|
105
|
-
this.properties[propertyPath] = oldValue;
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
this.unmountApp();
|
|
109
|
-
}
|
|
110
|
-
// if new app was selected, mount it
|
|
111
|
-
if (newValue) {
|
|
112
|
-
this.webpartSectionElement.remove();
|
|
113
|
-
this.mountApp(newValue).catch(() => {
|
|
114
|
-
// do nothing
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected onDisplayModeChanged(oldDisplayMode: DisplayMode): void {
|
|
121
|
-
const mode = oldDisplayMode === DisplayMode.Edit ? "Read" : "Edit";
|
|
122
|
-
this.SPFxExtensionInstance?.executeListeners("onDisplayModeChange", mode);
|
|
123
|
-
}
|
|
124
88
|
|
|
89
|
+
//#region App mounting and property forwarding
|
|
125
90
|
openPropertyPane() {
|
|
126
91
|
// if (this.context.propertyPane.isPropertyPaneOpen()) {
|
|
127
92
|
// this.context.propertyPane.close();
|
|
@@ -186,6 +151,14 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
186
151
|
return this.configDomElement;
|
|
187
152
|
}
|
|
188
153
|
|
|
154
|
+
getContext() {
|
|
155
|
+
return this.webPartContext;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
getServiceScope() {
|
|
159
|
+
return this.serviceScope;
|
|
160
|
+
}
|
|
161
|
+
|
|
189
162
|
private async mountApp(appId: string) {
|
|
190
163
|
if (ISDEBUG) {
|
|
191
164
|
console.debug(SPFXPREFIX, "Mounting app", appId, "at", this.domElement);
|
|
@@ -196,8 +169,6 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
196
169
|
const runTimeConfig: SPFxExtensionAppRuntimeConfig = {
|
|
197
170
|
domElement: this.domElement,
|
|
198
171
|
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
-
webpartContext: this.context as any,
|
|
200
|
-
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
201
172
|
webpart: this as any,
|
|
202
173
|
openPropertyPane: () => {
|
|
203
174
|
this.openPropertyPane();
|
|
@@ -232,10 +203,16 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
232
203
|
getConfigDomElement: () => {
|
|
233
204
|
return this.getConfigDomElement();
|
|
234
205
|
},
|
|
206
|
+
getContext: () => {
|
|
207
|
+
return this.getContext();
|
|
208
|
+
},
|
|
209
|
+
getServiceScope: () => {
|
|
210
|
+
return this.getServiceScope();
|
|
211
|
+
}
|
|
235
212
|
};
|
|
236
213
|
this.SPFxExtensionInstance = await window.__SPFxExtensions.InstantiateApp(appId, runTimeConfig);
|
|
237
214
|
if (!this.SPFxExtensionInstance) {
|
|
238
|
-
|
|
215
|
+
console.warn(SPFXPREFIX, "App instance is undefined, cannot mount app", appId);
|
|
239
216
|
return;
|
|
240
217
|
}
|
|
241
218
|
const newApp = window.__SPFxExtensions.Apps.find((app) => app.id === appId);
|
|
@@ -248,12 +225,11 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
248
225
|
// this.context.propertyPane.open();
|
|
249
226
|
// }
|
|
250
227
|
}
|
|
251
|
-
this.renderCompleted(undefined, true);
|
|
252
228
|
}
|
|
253
229
|
catch (err) {
|
|
254
230
|
console.error(SPFXPREFIX, "Error while mounting appid", appId, err);
|
|
255
231
|
const error = new Error(`${err}`);
|
|
256
|
-
|
|
232
|
+
return error;
|
|
257
233
|
}
|
|
258
234
|
}
|
|
259
235
|
|
|
@@ -273,21 +249,9 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
273
249
|
this.SPFxExtensionInstance = undefined;
|
|
274
250
|
this.domElement.innerHTML = "";
|
|
275
251
|
}
|
|
276
|
-
|
|
277
|
-
protected onDispose(): void {
|
|
278
|
-
if (DEBUG) {
|
|
279
|
-
console.debug(SPFXPREFIX, "onDispose");
|
|
280
|
-
}
|
|
281
|
-
this.unmountApp();
|
|
282
|
-
}
|
|
252
|
+
//#endregion
|
|
283
253
|
|
|
284
254
|
//#region HTML Elements Rendering
|
|
285
|
-
appButtonElements: HTMLElement[] = [];
|
|
286
|
-
|
|
287
|
-
webpartSectionElement = document.createElement("section");
|
|
288
|
-
webpartSectionTitle = document.createElement("header");
|
|
289
|
-
appButtonsWrapper = document.createElement("div");
|
|
290
|
-
appButtonsContainer = document.createElement("div");
|
|
291
255
|
|
|
292
256
|
generateIconElement(icon?: SPFxExtensionAppIcon) {
|
|
293
257
|
const iconElement = document.createElement("i");
|
|
@@ -331,6 +295,9 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
331
295
|
ev.preventDefault();
|
|
332
296
|
this.properties.selectedApp = app.id;
|
|
333
297
|
this.webpartSectionElement.remove();
|
|
298
|
+
this.dropDownProps.selectedKey = app.id;
|
|
299
|
+
// refresh to rerender the dropdown and description
|
|
300
|
+
this.context.propertyPane.refresh();
|
|
334
301
|
this.mountApp(app.id).catch(() => {
|
|
335
302
|
// do nothing
|
|
336
303
|
});
|
|
@@ -399,6 +366,7 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
399
366
|
}
|
|
400
367
|
catch (err) {
|
|
401
368
|
console.error(SPFXPREFIX, "Error while awaiting app initialization", err);
|
|
369
|
+
return new Error(`Error while awaiting app initialization: ${err}`);
|
|
402
370
|
}
|
|
403
371
|
}
|
|
404
372
|
|
|
@@ -414,11 +382,9 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
414
382
|
|
|
415
383
|
if (this.displayMode === DisplayMode.Read) {
|
|
416
384
|
this.renderDisplayMode();
|
|
417
|
-
|
|
418
|
-
await this.renderEditMode();
|
|
385
|
+
return;
|
|
419
386
|
}
|
|
420
|
-
|
|
421
|
-
this.renderCompleted(undefined, true);
|
|
387
|
+
return this.renderEditMode();
|
|
422
388
|
}
|
|
423
389
|
//#endregion HTML Elements Rendering
|
|
424
390
|
|
|
@@ -430,26 +396,31 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
430
396
|
// this.onPropertyPaneConfigurationStart();
|
|
431
397
|
// }
|
|
432
398
|
if (DEBUG) {
|
|
433
|
-
console.debug(SPFXPREFIX, "render");
|
|
399
|
+
console.debug(SPFXPREFIX, "render", this.instanceId);
|
|
434
400
|
}
|
|
401
|
+
let possibleError: Error | undefined = undefined;
|
|
435
402
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (this.SPFxExtensionInstance
|
|
440
|
-
this.
|
|
441
|
-
|
|
442
|
-
|
|
403
|
+
try {
|
|
404
|
+
//in live editing mode dispose is not called when in production build for some reason
|
|
405
|
+
//we unmount and remount the app if applicable
|
|
406
|
+
if (this.SPFxExtensionInstance) {
|
|
407
|
+
if (this.SPFxExtensionInstance.unmountOnRender) {
|
|
408
|
+
this.unmountApp();
|
|
409
|
+
} else {
|
|
410
|
+
this.SPFxExtensionInstance.executeListeners("onRender", undefined);
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (this.properties.selectedApp && !this.SPFxExtensionInstance) {
|
|
416
|
+
possibleError = await this.mountApp(this.properties.selectedApp);
|
|
443
417
|
return;
|
|
444
418
|
}
|
|
445
|
-
}
|
|
446
419
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
420
|
+
possibleError = await this.renderEmptyApp();
|
|
421
|
+
} finally {
|
|
422
|
+
this.renderCompleted(possibleError, true);
|
|
450
423
|
}
|
|
451
|
-
|
|
452
|
-
await this.renderEmptyApp();
|
|
453
424
|
}
|
|
454
425
|
|
|
455
426
|
protected renderCompleted(error?: Error, didUpdate?: boolean): void {
|
|
@@ -477,6 +448,39 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
477
448
|
};
|
|
478
449
|
}
|
|
479
450
|
|
|
451
|
+
CustomWebpartConfigurationField(
|
|
452
|
+
name: string
|
|
453
|
+
): IPropertyPaneField<IPropertyPaneCustomFieldProps> {
|
|
454
|
+
return {
|
|
455
|
+
type: PropertyPaneFieldType.Custom,
|
|
456
|
+
targetProperty: name,
|
|
457
|
+
properties: {
|
|
458
|
+
key: name,
|
|
459
|
+
onRender: (domElement, _context, _callBack) => {
|
|
460
|
+
this.configDomElement = domElement;
|
|
461
|
+
// when app instance is loaded forward the render event
|
|
462
|
+
this.SPFxExtensionInstance?.instanceLoadPromise
|
|
463
|
+
.then(() => {
|
|
464
|
+
this.SPFxExtensionInstance?.executeListeners(
|
|
465
|
+
"onConfigurationRender",
|
|
466
|
+
{
|
|
467
|
+
domElement,
|
|
468
|
+
}
|
|
469
|
+
);
|
|
470
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
471
|
+
}).catch((err: any) => {
|
|
472
|
+
console.error(SPFXPREFIX, "Error while awaiting app to load", err);
|
|
473
|
+
});
|
|
474
|
+
},
|
|
475
|
+
onDispose: (domElement, _context) => {
|
|
476
|
+
this.SPFxExtensionInstance?.executeListeners("onConfigurationClose", { domElement });
|
|
477
|
+
this.configDomElement = undefined;
|
|
478
|
+
},
|
|
479
|
+
// context: this.context,
|
|
480
|
+
},
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
|
|
480
484
|
protected onPropertyPaneConfigurationStart(): void {
|
|
481
485
|
if (ISDEBUG) {
|
|
482
486
|
console.debug(SPFXPREFIX, "Property pane configuration start");
|
|
@@ -520,39 +524,6 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
520
524
|
});
|
|
521
525
|
}
|
|
522
526
|
|
|
523
|
-
CustomWebpartConfigurationField(
|
|
524
|
-
name: string
|
|
525
|
-
): IPropertyPaneField<IPropertyPaneCustomFieldProps> {
|
|
526
|
-
return {
|
|
527
|
-
type: PropertyPaneFieldType.Custom,
|
|
528
|
-
targetProperty: name,
|
|
529
|
-
properties: {
|
|
530
|
-
key: name,
|
|
531
|
-
onRender: (domElement, _context, _callBack) => {
|
|
532
|
-
this.configDomElement = domElement;
|
|
533
|
-
// when app instance is loaded forward the render event
|
|
534
|
-
this.SPFxExtensionInstance?.instanceLoadPromise
|
|
535
|
-
.then(() => {
|
|
536
|
-
this.SPFxExtensionInstance?.executeListeners(
|
|
537
|
-
"onConfigurationRender",
|
|
538
|
-
{
|
|
539
|
-
domElement,
|
|
540
|
-
}
|
|
541
|
-
);
|
|
542
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
543
|
-
}).catch((err: any) => {
|
|
544
|
-
console.error(SPFXPREFIX, "Error while awaiting app to load", err);
|
|
545
|
-
});
|
|
546
|
-
},
|
|
547
|
-
onDispose: (domElement, _context) => {
|
|
548
|
-
this.SPFxExtensionInstance?.executeListeners("onConfigurationClose", { domElement });
|
|
549
|
-
this.configDomElement = undefined;
|
|
550
|
-
},
|
|
551
|
-
// context: this.context,
|
|
552
|
-
},
|
|
553
|
-
};
|
|
554
|
-
}
|
|
555
|
-
|
|
556
527
|
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
|
|
557
528
|
const configuratorButton: IPropertyPaneGroup | IPropertyPaneConditionalGroup = {
|
|
558
529
|
groupFields: [
|
|
@@ -616,6 +587,103 @@ export default class SpfxExtensionloaderWebPart extends BaseClientSideWebPart<IS
|
|
|
616
587
|
}
|
|
617
588
|
}
|
|
618
589
|
|
|
590
|
+
protected onPropertyPaneConfigurationComplete(): void {
|
|
591
|
+
const isPaneOpen = this.context.propertyPane.isPropertyPaneOpen();
|
|
592
|
+
|
|
593
|
+
if (DEBUG) {
|
|
594
|
+
console.debug(SPFXPREFIX, "onPropertyPaneConfigurationComplete", isPaneOpen);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
// notify close only if the pane is not open
|
|
599
|
+
// complete event fires also when config is saved
|
|
600
|
+
// This event method is invoked in the following cases:
|
|
601
|
+
|
|
602
|
+
// When the CONFIGURATION_COMPLETE_TIMEOUT((currently the value is 5 secs) elapses after the last change.
|
|
603
|
+
|
|
604
|
+
// When user clicks the "X" (close) button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
|
|
605
|
+
|
|
606
|
+
// When user clicks the 'Apply' button before the CONFIGURATION_COMPLETE_TIMEOUT elapses.
|
|
607
|
+
|
|
608
|
+
// When the user switches web parts then the current web part gets this event.
|
|
609
|
+
if (!isPaneOpen && this.SPFxExtensionInstance) {
|
|
610
|
+
|
|
611
|
+
this.SPFxExtensionInstance.executeListeners(
|
|
612
|
+
"onConfigurationClose",
|
|
613
|
+
{ domElement: this.configDomElement }
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
protected onPropertyPaneFieldChanged(
|
|
619
|
+
propertyPath: propertyPath,
|
|
620
|
+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
621
|
+
oldValue: any,
|
|
622
|
+
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
623
|
+
newValue: any
|
|
624
|
+
): void {
|
|
625
|
+
if (DEBUG) {
|
|
626
|
+
console.debug(SPFXPREFIX, "onPropertyPaneFieldChanged", propertyPath, oldValue, newValue);
|
|
627
|
+
}
|
|
628
|
+
// if selected app changed unmount the old app
|
|
629
|
+
if (propertyPath === "selectedApp") {
|
|
630
|
+
if (oldValue && oldValue !== newValue && this.SPFxExtensionInstance) {
|
|
631
|
+
const shouldUnmount = confirm(
|
|
632
|
+
"You are about to switch app, this will erase all previous app configuration. Are you sure?"
|
|
633
|
+
);
|
|
634
|
+
if (!shouldUnmount) {
|
|
635
|
+
this.properties[propertyPath] = oldValue;
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
this.unmountApp();
|
|
639
|
+
}
|
|
640
|
+
// if new app was selected, mount it
|
|
641
|
+
if (newValue) {
|
|
642
|
+
this.webpartSectionElement.remove();
|
|
643
|
+
this.mountApp(newValue).catch(() => {
|
|
644
|
+
// do nothing
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
protected onDisplayModeChanged(oldDisplayMode: DisplayMode): void {
|
|
651
|
+
if (DEBUG) {
|
|
652
|
+
console.debug(SPFXPREFIX, "onDisplayModeChanged", oldDisplayMode);
|
|
653
|
+
}
|
|
654
|
+
const newDisplayMode = oldDisplayMode === DisplayMode.Edit ? "Read" : "Edit";
|
|
655
|
+
this.SPFxExtensionInstance?.executeListeners("onDisplayModeChange", newDisplayMode);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
protected onAfterPropertyPaneChangesApplied(): void {
|
|
659
|
+
if (DEBUG) {
|
|
660
|
+
console.debug(SPFXPREFIX, "onAfterPropertyPaneChangesApplied");
|
|
661
|
+
}
|
|
662
|
+
this.SPFxExtensionInstance?.executeListeners("onPropertyPaneChangesApplied", undefined);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
protected onAfterResize(newWidth: number): void {
|
|
666
|
+
if (DEBUG) {
|
|
667
|
+
console.debug(SPFXPREFIX, "onAfterResize");
|
|
668
|
+
}
|
|
669
|
+
this.SPFxExtensionInstance?.executeListeners("onAfterResize", { newWidth });
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
protected onDispose(): void {
|
|
673
|
+
if (DEBUG) {
|
|
674
|
+
console.debug(SPFXPREFIX, "onDispose");
|
|
675
|
+
}
|
|
676
|
+
this.unmountApp();
|
|
677
|
+
this.appButtonElements.forEach((button) => {
|
|
678
|
+
button.remove();
|
|
679
|
+
});
|
|
680
|
+
this.appButtonElements.splice(0, this.appButtonElements.length);
|
|
681
|
+
this.webpartSectionElement.remove();
|
|
682
|
+
this.webpartSectionTitle.remove();
|
|
683
|
+
this.appButtonsWrapper.remove();
|
|
684
|
+
this.appButtonsContainer.remove();
|
|
685
|
+
}
|
|
686
|
+
|
|
619
687
|
// private _getEnvironmentMessage(): Promise<string> {
|
|
620
688
|
// if (!!this.context.sdks.microsoftTeams) { // running in Teams, office.com or Outlook
|
|
621
689
|
// return this.context.sdks.microsoftTeams.teamsJs.app.getContext()
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(()=>{var e=document.currentScript;define(["@microsoft/sp-core-library","@microsoft/sp-property-pane","@microsoft/sp-webpart-base","@microsoft/sp-component-base"],(t,n,a,i)=>(()=>{"use strict";var r,o,s,c={367:(e,t,n)=>{n.d(t,{Bc:()=>r,Lf:()=>o,Ne:()=>a,oz:()=>i});const a="Select one of these web parts for this column.",i="Edit page and select webpart.",r="Webpart that loads an app of your choice.",o="[SPFxExtensions]"}
|
|
2
|
-
,574:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var a,i,r=function(){return r=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};!function(e){e[e.sync=0]="sync",e[e.async=1]="async"}(a||(a={})),function(e){e[e.onlyThemable=1]="onlyThemable",e[e.onlyNonThemable=2]="onlyNonThemable",e[e.all=3]="all"}(i||(i={}));var o,s,c,d="undefined"==typeof window?n.g:window,l=d&&d.CSPSettings&&d.CSPSettings.nonce,u=((c=d.__themeState__||{theme:void 0,lastStyleElement:void 0,registeredStyles:[]}).runState||(c=r(r({},c),{perf:{count:0,duration:0},runState:{flushTimer:0,mode:a.sync,buffer:[]}})),c.registeredThemableStyles||(c=r(r({},c),{registeredThemableStyles:[]})),d.__themeState__=c,c),f=/[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g,p=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};function m(e){var t=p();e();var n=p();u.perf.duration+=n-t}function _(e,t){u.loadStyles?u.loadStyles(h(e).styleString,e):function(e){if("undefined"!=typeof document){var t=document.getElementsByTagName("head")[0],n=document.createElement("style"),a=h(e),i=a.styleString,r=a.themable;n.setAttribute("data-load-themed-styles","true"),l&&n.setAttribute("nonce",l),n.appendChild(document.createTextNode(i)),u.perf.count++,t.appendChild(n);var o=document.createEvent("HTMLEvents");o.initEvent("styleinsert",!0,!1),o.args={newStyle:n},document.dispatchEvent(o);var s={styleElement:n,themableStyle:e};r?u.registeredThemableStyles.push(s):u.registeredStyles.push(s)}}(e)}function h(e){var t=u.theme,n=!1;return{styleString:(e||[]).map(function(e){var a=e.theme;if(a){n=!0;var i=t?t[a]:void 0,r=e.defaultValue||"inherit";return t&&!i&&console,i||r}return e.rawString}).join(""),themable:n}}o='.spfxExtensionloader_be4e0fd1{color:"[theme:bodyText, default: #323130]";color:var(--bodyText);overflow:hidden;padding:1em}.spfxExtensionloader_be4e0fd1.teams_be4e0fd1{font-family:Segoe UI,-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif}.welcome_be4e0fd1{text-align:center}.welcomeImage_be4e0fd1{max-width:420px;width:100%}.links_be4e0fd1 a{color:"[theme:link, default:#03787c]";color:var(--link);text-decoration:none}.links_be4e0fd1 a:hover{color:"[theme:linkHovered, default: #014446]";color:var(--linkHovered);text-decoration:underline}.SPFxExtensionApp_be4e0fd1 .loader_be4e0fd1{animation:rotation_be4e0fd1 1s linear infinite;border:2px solid #003755;border-bottom-color:#009fda;border-radius:50%;box-sizing:border-box;display:inline-block;height:28px;width:28px}@keyframes rotation_be4e0fd1{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.SPFxExtensionApp_be4e0fd1 .buttonLoader_be4e0fd1{align-items:center;border:none;display:flex;height:80px;justify-content:center;width:120px}.SPFxExtensionApp_be4e0fd1 .shimmerShine_be4e0fd1{-webkit-animation-duration:1s;-webkit-animation-fill-mode:forwards;-webkit-animation-iteration-count:infinite;-webkit-animation-name:placeholderShimmer_be4e0fd1;-webkit-animation-timing-function:linear;background:#f6f7f8;background-image:linear-gradient(90deg,#f6f7f8 0,#edeef1 20%,#f6f7f8 40%,#f6f7f8);background-repeat:no-repeat;background-size:200px 80px;border:none;display:block;height:80px;position:relative;width:120px}@keyframes placeholderShimmer_be4e0fd1{0%{background-position:-80px 0}to{background-position:120px 0}}.SPFxExtensionApp_be4e0fd1 .applicationListSection_be4e0fd1{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center;min-height:320px;text-align:center}.SPFxExtensionApp_be4e0fd1 .header_be4e0fd1{color:#242424;font-weight:600;letter-spacing:1px;line-height:32px;padding:0 12px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1{font-size:28px;font-style:normal;height:28px;line-height:28px;min-width:28px;width:28px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>img,.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>svg{height:auto;width:100%}.SPFxExtensionApp_be4e0fd1 .iconFont_be4e0fd1{background-color:#f6f7f8}.SPFxExtensionApp_be4e0fd1 .appButtonsContainer_be4e0fd1{align-items:center;display:flex;flex-wrap:wrap;height:100%;justify-content:center}.SPFxExtensionApp_be4e0fd1 .appButtonsWrapper_be4e0fd1{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;height:100%;justify-content:flex-start;width:100%}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1{align-items:center;background-color:unset;border:none;display:flex;flex-direction:column;height:80px;padding-top:14px;width:120px}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1:hover{background-color:#c8e3fa}',void 0===(s=!0)&&(s=!1),m(function(){var e=Array.isArray(o)?o:function(e){var t=[];if(e){for(var n=0,a=void 0;a=f.exec(e);){var i=a.index;i>n&&t.push({rawString:e.substring(n,i)}),t.push({theme:a[1],defaultValue:a[2]}),n=f.lastIndex}t.push({rawString:e.substring(n)})}return t}(o),t=u.runState,n=t.mode,i=t.buffer,r=t.flushTimer;s||n===a.async?(i.push(e),r||(u.runState.flushTimer=self.setTimeout(function(){u.runState.flushTimer=0,m(function(){var e=u.runState.buffer.slice();u.runState.buffer=[];var t=[].concat.apply([],e);t.length>0&&_(t)})},0))):_(e)});const b={spfxExtensionloader_be4e0fd1:"spfxExtensionloader_be4e0fd1",teams_be4e0fd1:"teams_be4e0fd1",welcome_be4e0fd1:"welcome_be4e0fd1",welcomeImage_be4e0fd1:"welcomeImage_be4e0fd1",links_be4e0fd1:"links_be4e0fd1",SPFxExtensionApp_be4e0fd1:"SPFxExtensionApp_be4e0fd1",loader_be4e0fd1:"loader_be4e0fd1",rotation_be4e0fd1:"rotation_be4e0fd1",buttonLoader_be4e0fd1:"buttonLoader_be4e0fd1",shimmerShine_be4e0fd1:"shimmerShine_be4e0fd1",placeholderShimmer_be4e0fd1:"placeholderShimmer_be4e0fd1",applicationListSection_be4e0fd1:"applicationListSection_be4e0fd1",header_be4e0fd1:"header_be4e0fd1",icon_be4e0fd1:"icon_be4e0fd1",iconFont_be4e0fd1:"iconFont_be4e0fd1",appButtonsContainer_be4e0fd1:"appButtonsContainer_be4e0fd1",appButtonsWrapper_be4e0fd1:"appButtonsWrapper_be4e0fd1",appButton_be4e0fd1:"appButton_be4e0fd1"}}
|
|
3
|
-
,962:e=>{e.exports=i},676:e=>{e.exports=t},877:e=>{e.exports=n},642:e=>{e.exports=a}},d={};function l(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return c[e](n,n.exports,l),n.exports}l.m=c,l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,n)=>(l.f[n](e,t),t),[])),l.u=e=>"spfx-extension-loader_216295ea1be5755397c2.js",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="55fa9a5f236bff525c187062f3954313:",l.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var i,s;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==o+n){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.setAttribute("data-webpack",o+n),i.src=e,0!==i.src.indexOf(window.location.origin+"/")&&(i.crossOrigin="anonymous")),r[e]=[t];var f=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),s&&document.head.appendChild(i)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s=e?e.src:"",l.p=s.slice(0,s.lastIndexOf("/")+1),(()=>{var e={650:0};l.f.j=(t,n)=>{var a=l.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else{var i=new Promise((n,i)=>a=e[t]=[n,i]);n.push(a[2]=i);var r=l.p+l.u(t),o=new Error;l.l(r,n=>{if(l.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",o.name="ChunkLoadError",o.type=i,o.request=r,a[1](o)}},"chunk-"+t,t)}};var t=(t,n)=>{var a,i,[r,o,s]=n,c=0;if(r.some(t=>0!==e[t])){for(a in o)l.o(o,a)&&(l.m[a]=o[a]);s&&s(l)}for(t&&t(n);c<r.length;c++)i=r[c],l.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=self.webpackJsonp_55fa9a5f236bff525c187062f3954313=self.webpackJsonp_55fa9a5f236bff525c187062f3954313||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{l.r(u),l.d(u,{default:()=>r});var e=l(676),t=l(877),n=l(642),a=l(367),i=l(962);l(574);class r extends n.BaseClientSideWebPart{SPFxExtensionInstance;allApps=[];appCatalogUrl="/sites/appcatalog";dropDownProps={options:[],selectedKey:"",disabled:!0};appDescription="";hideAppSelectorWhenAppLoaded=!1;hideConfiguratorButton=!1;configDomElement;_isDarkTheme=!1;themeProvider;async onInit(){const t=e.Environment.type===e.EnvironmentType.SharePoint?"SharePoint":"ClassicSharePoint";this.themeProvider=this.context.serviceScope.consume(i.ThemeProvider.serviceKey);const{initCore:n}=await l.e(548).then(l.bind(l,364));await n(t),this.appCatalogUrl=window.__SPFxExtensions.Utils.ConfiguratorPageUrl}onPropertyPaneConfigurationComplete(){!this.context.propertyPane.isPropertyPaneOpen()&&this.SPFxExtensionInstance&&this.SPFxExtensionInstance.executeListeners("onConfigurationClose",{domElement:this.configDomElement})}onPropertyPaneFieldChanged(e,t,n){if("selectedApp"===e){if(t&&t!==n&&this.SPFxExtensionInstance){if(!confirm("You are about to switch app, this will erase all previous app configuration. Are you sure?"))return void(this.properties[e]=t);this.unmountApp()}n&&(this.webpartSectionElement.remove(),this.mountApp(n).catch(()=>{}))}}onDisplayModeChanged(t){const n=t===e.DisplayMode.Edit?"Read":"Edit";this.SPFxExtensionInstance?.executeListeners("onDisplayModeChange",n)}openPropertyPane(){this.context.propertyPane.open()}closePropertyPane(){this.context.propertyPane.close()}isPropertyPaneOpen(){return this.context.propertyPane.isPropertyPaneOpen()}saveConfigValue(e,t=!0){this.properties.SPFxExtensionAppConfiguration=e,t&&this.SPFxExtensionInstance?.executeListeners("onConfigurationChange",e)}getConfigValue(e){if(e){let t=this.properties[e];return void 0===t&&(t=this.properties.SPFxExtensionAppConfiguration),t}return this.properties.SPFxExtensionAppConfiguration}getSearchData(){return{searchableText:this.properties.searchableText,searchableHtml:this.properties.searchableHtml}}setSearchData(e){this.properties.searchableText=e.searchableText,this.properties.searchableHtml=e.searchableHtml}getTopActions(){return this.properties.topActions??[]}setTopActions(e){this.properties.topActions=e??[]}getThemeProvider(){return this.themeProvider}getConfigDomElement(){return this.configDomElement}async mountApp(e){this.domElement.innerHTML="";try{const t={domElement:this.domElement,webpartContext:this.context,webpart:this,openPropertyPane:()=>{this.openPropertyPane()},closePropertyPane:()=>{this.closePropertyPane()},isPropertyPaneOpen:()=>this.isPropertyPaneOpen(),saveConfigValue:(e,t=!0)=>{this.saveConfigValue(e,t)},getConfigValue:e=>this.getConfigValue(e),getSearchableData:()=>this.getSearchData(),setSearchableData:e=>{this.setSearchData(e)},setTopActions:e=>{this.setTopActions(e)},getTopActions:()=>this.getTopActions(),getThemeProvider:()=>this.getThemeProvider(),getConfigDomElement:()=>this.getConfigDomElement()};if(this.SPFxExtensionInstance=await window.__SPFxExtensions.InstantiateApp(e,t),!this.SPFxExtensionInstance)return;const n=window.__SPFxExtensions.Apps.find(t=>t.id===e);n&&(this.appDescription=n.description),this.renderCompleted(void 0,!0)}catch(t){console.error(a.Lf,"Error while mounting appid",e,t);const n=new Error(`${t}`);this.renderCompleted(n)}}unmountApp(){this.SPFxExtensionInstance&&this.SPFxExtensionInstance.unmount?.(),this.SPFxExtensionInstance=void 0,this.domElement.innerHTML=""}onDispose(){this.unmountApp()}appButtonElements=[];webpartSectionElement=document.createElement("section");webpartSectionTitle=document.createElement("header");appButtonsWrapper=document.createElement("div");appButtonsContainer=document.createElement("div");generateIconElement(e){const t=document.createElement("i");if(t.classList.add("icon_be4e0fd1"),!e)return t.innerHTML='<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" aria-hidden="true" width="28" height="28" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M20.84 2.66a2.25 2.25 0 0 0-3.18 0L13.5 6.8v-.56c0-1.24-1-2.25-2.25-2.25h-7C3.01 4 2 5.01 2 6.25v18c0 .97.78 1.75 1.75 1.75h18c1.24 0 2.25-1 2.25-2.25v-7c0-1.24-1-2.25-2.25-2.25h-.56l4.16-4.15c.88-.88.88-2.3 0-3.19l-4.5-4.5ZM17.31 14.5H13.5v-3.8l3.8 3.8Zm1.41-10.78c.3-.3.77-.3 1.06 0l4.5 4.5c.3.3.3.77 0 1.06l-4.5 4.51c-.3.3-.77.3-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.07l4.5-4.5ZM12 6.25v8.25H3.5V6.25c0-.41.34-.75.75-.75h7c.41 0 .75.34.75.75Zm-8.5 17.5V16H12v8.5H4.25a.75.75 0 0 1-.75-.75Zm10-7.75h8.25c.41 0 .75.34.75.75v7c0 .42-.34.75-.75.75H13.5V16Z" fill="currentColor"></path></svg>',t;if("font"===e.iconType&&e.fontFamily&&(t.style.fontFamily=e.fontFamily,t.classList.add("iconFont_be4e0fd1")),"url"===e.iconType){const n=document.createElement("img");n.src=e.iconData,t.appendChild(n)}return"svg"===e.iconType&&(t.innerHTML=e.iconData),t}createAndAppendAppButtons(e){const t=document.createElement("button");t.title=a.Bc,t.ariaLabel=a.Bc,t.className="appButton_be4e0fd1";const n=this.generateIconElement(e.icon);t.append(n,e.name),t.title=e.name,t.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.properties.selectedApp=e.id,this.webpartSectionElement.remove(),this.mountApp(e.id).catch(()=>{})}),this.appButtonsContainer.appendChild(t)}createWebpartSection(e){this.webpartSectionElement.className="applicationListSection_be4e0fd1",this.webpartSectionTitle.className="header_be4e0fd1",this.webpartSectionElement.appendChild(this.webpartSectionTitle),e&&this.webpartSectionElement.appendChild(this.appButtonsWrapper)}renderDisplayMode(){this.webpartSectionElement.ariaLabel=a.oz,this.webpartSectionTitle.textContent=a.oz,this.createWebpartSection(),this.domElement.appendChild(this.webpartSectionElement)}async renderEditMode(){this.webpartSectionElement.ariaLabel=a.Ne,this.webpartSectionTitle.textContent=a.Ne,this.createWebpartSection(!0),this.appButtonsContainer.className="appButtonsContainer_be4e0fd1",this.appButtonsWrapper.appendChild(this.appButtonsContainer),this.appButtonsWrapper.className="appButtonsWrapper_be4e0fd1",this.domElement.appendChild(this.webpartSectionElement),window.__SPFxExtensions.AddAppEventListener("appAdded",e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)}),window.__SPFxExtensions.Apps.filter(e=>e.registrationCompleted).forEach(e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)});try{await window.__SPFxExtensions.Utils.spAppInitializationPromise,window.__SPFxExtensions.Utils.appManifestPromises.forEach(e=>{const t=document.createElement("div"),n=document.createElement("span");t.className="buttonLoader_be4e0fd1",n.className="loader_be4e0fd1",t.appendChild(n),this.appButtonsContainer.append(t),e.catch(()=>{}).finally(()=>{t.remove()})})}catch(e){console.error(a.Lf,"Error while awaiting app initialization",e)}}async renderEmptyApp(){this.domElement.innerHTML="",this.domElement.className="SPFxExtensionApp_be4e0fd1",this.displayMode===e.DisplayMode.Read?this.renderDisplayMode():await this.renderEditMode(),this.renderCompleted(void 0,!0)}async render(){if(this.SPFxExtensionInstance){if(!this.SPFxExtensionInstance.unmountOnRender)return void this.SPFxExtensionInstance.executeListeners("onRender",void 0);this.unmountApp()}!this.properties.selectedApp||this.SPFxExtensionInstance?await this.renderEmptyApp():await this.mountApp(this.properties.selectedApp)}renderCompleted(e,t){super.renderCompleted(e,t)}get isRenderAsync(){return!0}get propertiesMetadata(){return{searchableText:{isSearchablePlainText:!0},searchableHtml:{isHtmlString:!0}}}onPropertyPaneConfigurationStart(){window.__SPFxExtensions.AllAppAssetsLoadedPromise.then(()=>{const e=window.__SPFxExtensions.Apps.find(e=>e.id===this.properties.selectedApp);e&&(this.appDescription=e.description,this.hideAppSelectorWhenAppLoaded=e.hideAppSelectorWhenAppLoaded??!1,this.hideConfiguratorButton=e.hideConfiguratorButton??!1),this.dropDownProps.options?.splice(0,this.dropDownProps.options?.length);const t=window.__SPFxExtensions.Apps.filter(e=>e.isWebPartApp).map(e=>({key:e.id,text:e.name}));this.dropDownProps.options?.push(...t),this.dropDownProps.selectedKey=this.properties.selectedApp,this.dropDownProps.disabled=!1,this.context.propertyPane.refresh()}).catch(e=>{console.error(a.Lf,"Error while awaiting all app assets to load",e)})}CustomWebpartConfigurationField(e){return{type:t.PropertyPaneFieldType.Custom,targetProperty:e,properties:{key:e,onRender:(e,t,n)=>{this.configDomElement=e,this.SPFxExtensionInstance?.instanceLoadPromise.then(()=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationRender",{domElement:e})}).catch(e=>{console.error(a.Lf,"Error while awaiting app to load",e)})},onDispose:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationClose",{domElement:e}),this.configDomElement=void 0}}}}getPropertyPaneConfiguration(){const e={groupFields:[(0,t.PropertyPaneLabel)("spfxExtensionLoaderLabel",{text:"App not working? Try refreshing the page. Or go to the configuration page."}),(0,t.PropertyPaneButton)("configuratorButton",{text:"Open Configurator",buttonType:1,onClick:()=>{window.open(`${this.appCatalogUrl}?web=${this.context.pageContext.web.absoluteUrl}`,"_blank")}})]},n=this.hideConfiguratorButton?[]:[e],a={groupFields:[(0,t.PropertyPaneDropdown)("selectedApp",{label:"App",disabled:this.dropDownProps.disabled,options:this.dropDownProps.options,selectedKey:this.dropDownProps.selectedKey}),(0,t.PropertyPaneLabel)("selectedAppDecription",{text:this.appDescription})]};return{pages:[{groups:[...n,...this.hideAppSelectorWhenAppLoaded?[]:[a],{groupFields:[this.CustomWebpartConfigurationField("SPFxExtensionAppConfiguration")]}]}]}}getTopActionsConfiguration(){return{topActions:this.properties.topActions??[],onExecute:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onTopActionExecute",{actionName:e,updatedValue:t})}}}onThemeChanged(e){this.SPFxExtensionInstance?.executeListeners("onThemeChange",e)}get dataVersion(){return e.Version.parse("1.0")}}})(),u})())})();
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(()=>{var e=document.currentScript;define(["@microsoft/sp-core-library","@microsoft/sp-property-pane","@microsoft/sp-webpart-base","@microsoft/sp-component-base"],(t,n,a,i)=>(()=>{"use strict";var r,o,s,c={367:(e,t,n)=>{n.d(t,{Bc:()=>r,Lf:()=>o,Ne:()=>a,oz:()=>i});const a="Select one of these web parts for this column.",i="Edit page and select webpart.",r="Webpart that loads an app of your choice.",o="[SPFxExtensions]"}
|
|
2
|
-
,574:(e,t,n)=>{n.r(t),n.d(t,{default:()=>b});var a,i,r=function(){return r=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};!function(e){e[e.sync=0]="sync",e[e.async=1]="async"}(a||(a={})),function(e){e[e.onlyThemable=1]="onlyThemable",e[e.onlyNonThemable=2]="onlyNonThemable",e[e.all=3]="all"}(i||(i={}));var o,s,c,d="undefined"==typeof window?n.g:window,l=d&&d.CSPSettings&&d.CSPSettings.nonce,u=((c=d.__themeState__||{theme:void 0,lastStyleElement:void 0,registeredStyles:[]}).runState||(c=r(r({},c),{perf:{count:0,duration:0},runState:{flushTimer:0,mode:a.sync,buffer:[]}})),c.registeredThemableStyles||(c=r(r({},c),{registeredThemableStyles:[]})),d.__themeState__=c,c),f=/[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g,p=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};function m(e){var t=p();e();var n=p();u.perf.duration+=n-t}function _(e,t){u.loadStyles?u.loadStyles(h(e).styleString,e):function(e){if("undefined"!=typeof document){var t=document.getElementsByTagName("head")[0],n=document.createElement("style"),a=h(e),i=a.styleString,r=a.themable;n.setAttribute("data-load-themed-styles","true"),l&&n.setAttribute("nonce",l),n.appendChild(document.createTextNode(i)),u.perf.count++,t.appendChild(n);var o=document.createEvent("HTMLEvents");o.initEvent("styleinsert",!0,!1),o.args={newStyle:n},document.dispatchEvent(o);var s={styleElement:n,themableStyle:e};r?u.registeredThemableStyles.push(s):u.registeredStyles.push(s)}}(e)}function h(e){var t=u.theme,n=!1;return{styleString:(e||[]).map(function(e){var a=e.theme;if(a){n=!0;var i=t?t[a]:void 0,r=e.defaultValue||"inherit";return t&&!i&&console,i||r}return e.rawString}).join(""),themable:n}}o='.spfxExtensionloader_be4e0fd1{color:"[theme:bodyText, default: #323130]";color:var(--bodyText);overflow:hidden;padding:1em}.spfxExtensionloader_be4e0fd1.teams_be4e0fd1{font-family:Segoe UI,-apple-system,BlinkMacSystemFont,Roboto,Helvetica Neue,sans-serif}.welcome_be4e0fd1{text-align:center}.welcomeImage_be4e0fd1{max-width:420px;width:100%}.links_be4e0fd1 a{color:"[theme:link, default:#03787c]";color:var(--link);text-decoration:none}.links_be4e0fd1 a:hover{color:"[theme:linkHovered, default: #014446]";color:var(--linkHovered);text-decoration:underline}.SPFxExtensionApp_be4e0fd1 .loader_be4e0fd1{animation:rotation_be4e0fd1 1s linear infinite;border:2px solid #003755;border-bottom-color:#009fda;border-radius:50%;box-sizing:border-box;display:inline-block;height:28px;width:28px}@keyframes rotation_be4e0fd1{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.SPFxExtensionApp_be4e0fd1 .buttonLoader_be4e0fd1{align-items:center;border:none;display:flex;height:80px;justify-content:center;width:120px}.SPFxExtensionApp_be4e0fd1 .shimmerShine_be4e0fd1{-webkit-animation-duration:1s;-webkit-animation-fill-mode:forwards;-webkit-animation-iteration-count:infinite;-webkit-animation-name:placeholderShimmer_be4e0fd1;-webkit-animation-timing-function:linear;background:#f6f7f8;background-image:linear-gradient(90deg,#f6f7f8 0,#edeef1 20%,#f6f7f8 40%,#f6f7f8);background-repeat:no-repeat;background-size:200px 80px;border:none;display:block;height:80px;position:relative;width:120px}@keyframes placeholderShimmer_be4e0fd1{0%{background-position:-80px 0}to{background-position:120px 0}}.SPFxExtensionApp_be4e0fd1 .applicationListSection_be4e0fd1{display:flex;flex-direction:column;flex-wrap:wrap;justify-content:center;min-height:320px;text-align:center}.SPFxExtensionApp_be4e0fd1 .header_be4e0fd1{color:#242424;font-weight:600;letter-spacing:1px;line-height:32px;padding:0 12px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1{font-size:28px;font-style:normal;height:28px;line-height:28px;min-width:28px;width:28px}.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>img,.SPFxExtensionApp_be4e0fd1 .icon_be4e0fd1>svg{height:auto;width:100%}.SPFxExtensionApp_be4e0fd1 .iconFont_be4e0fd1{background-color:#f6f7f8}.SPFxExtensionApp_be4e0fd1 .appButtonsContainer_be4e0fd1{align-items:center;display:flex;flex-wrap:wrap;height:100%;justify-content:center}.SPFxExtensionApp_be4e0fd1 .appButtonsWrapper_be4e0fd1{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;height:100%;justify-content:flex-start;width:100%}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1{align-items:center;background-color:unset;border:none;display:flex;flex-direction:column;height:80px;padding-top:14px;width:120px}.SPFxExtensionApp_be4e0fd1 .appButton_be4e0fd1:hover{background-color:#c8e3fa}',void 0===(s=!0)&&(s=!1),m(function(){var e=Array.isArray(o)?o:function(e){var t=[];if(e){for(var n=0,a=void 0;a=f.exec(e);){var i=a.index;i>n&&t.push({rawString:e.substring(n,i)}),t.push({theme:a[1],defaultValue:a[2]}),n=f.lastIndex}t.push({rawString:e.substring(n)})}return t}(o),t=u.runState,n=t.mode,i=t.buffer,r=t.flushTimer;s||n===a.async?(i.push(e),r||(u.runState.flushTimer=self.setTimeout(function(){u.runState.flushTimer=0,m(function(){var e=u.runState.buffer.slice();u.runState.buffer=[];var t=[].concat.apply([],e);t.length>0&&_(t)})},0))):_(e)});const b={spfxExtensionloader_be4e0fd1:"spfxExtensionloader_be4e0fd1",teams_be4e0fd1:"teams_be4e0fd1",welcome_be4e0fd1:"welcome_be4e0fd1",welcomeImage_be4e0fd1:"welcomeImage_be4e0fd1",links_be4e0fd1:"links_be4e0fd1",SPFxExtensionApp_be4e0fd1:"SPFxExtensionApp_be4e0fd1",loader_be4e0fd1:"loader_be4e0fd1",rotation_be4e0fd1:"rotation_be4e0fd1",buttonLoader_be4e0fd1:"buttonLoader_be4e0fd1",shimmerShine_be4e0fd1:"shimmerShine_be4e0fd1",placeholderShimmer_be4e0fd1:"placeholderShimmer_be4e0fd1",applicationListSection_be4e0fd1:"applicationListSection_be4e0fd1",header_be4e0fd1:"header_be4e0fd1",icon_be4e0fd1:"icon_be4e0fd1",iconFont_be4e0fd1:"iconFont_be4e0fd1",appButtonsContainer_be4e0fd1:"appButtonsContainer_be4e0fd1",appButtonsWrapper_be4e0fd1:"appButtonsWrapper_be4e0fd1",appButton_be4e0fd1:"appButton_be4e0fd1"}}
|
|
3
|
-
,962:e=>{e.exports=i},676:e=>{e.exports=t},877:e=>{e.exports=n},642:e=>{e.exports=a}},d={};function l(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return c[e](n,n.exports,l),n.exports}l.m=c,l.d=(e,t)=>{for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((t,n)=>(l.f[n](e,t),t),[])),l.u=e=>"spfx-extension-loader_216295ea1be5755397c2.js",l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="55fa9a5f236bff525c187062f3954313:",l.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var i,s;if(void 0!==n)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==o+n){i=u;break}}i||(s=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.setAttribute("data-webpack",o+n),i.src=e,0!==i.src.indexOf(window.location.origin+"/")&&(i.crossOrigin="anonymous")),r[e]=[t];var f=(t,n)=>{i.onerror=i.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(n)),t)return t(n)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),s&&document.head.appendChild(i)}},l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s=e?e.src:"",l.p=s.slice(0,s.lastIndexOf("/")+1),(()=>{var e={650:0};l.f.j=(t,n)=>{var a=l.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else{var i=new Promise((n,i)=>a=e[t]=[n,i]);n.push(a[2]=i);var r=l.p+l.u(t),o=new Error;l.l(r,n=>{if(l.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=n&&("load"===n.type?"missing":n.type),r=n&&n.target&&n.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+r+")",o.name="ChunkLoadError",o.type=i,o.request=r,a[1](o)}},"chunk-"+t,t)}};var t=(t,n)=>{var a,i,[r,o,s]=n,c=0;if(r.some(t=>0!==e[t])){for(a in o)l.o(o,a)&&(l.m[a]=o[a]);s&&s(l)}for(t&&t(n);c<r.length;c++)i=r[c],l.o(e,i)&&e[i]&&e[i][0](),e[i]=0},n=self.webpackJsonp_55fa9a5f236bff525c187062f3954313=self.webpackJsonp_55fa9a5f236bff525c187062f3954313||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{l.r(u),l.d(u,{default:()=>r});var e=l(676),t=l(877),n=l(642),a=l(367),i=l(962);l(574);class r extends n.BaseClientSideWebPart{SPFxExtensionInstance;allApps=[];appCatalogUrl="/sites/appcatalog";dropDownProps={options:[],selectedKey:"",disabled:!0};appDescription="";hideAppSelectorWhenAppLoaded=!1;hideConfiguratorButton=!1;configDomElement;_isDarkTheme=!1;themeProvider;async onInit(){const t=e.Environment.type===e.EnvironmentType.SharePoint?"SharePoint":"ClassicSharePoint";this.themeProvider=this.context.serviceScope.consume(i.ThemeProvider.serviceKey);const{initCore:n}=await l.e(548).then(l.bind(l,364));await n(t),this.appCatalogUrl=window.__SPFxExtensions.Utils.ConfiguratorPageUrl}onPropertyPaneConfigurationComplete(){!this.context.propertyPane.isPropertyPaneOpen()&&this.SPFxExtensionInstance&&this.SPFxExtensionInstance.executeListeners("onConfigurationClose",{domElement:this.configDomElement})}onPropertyPaneFieldChanged(e,t,n){if("selectedApp"===e){if(t&&t!==n&&this.SPFxExtensionInstance){if(!confirm("You are about to switch app, this will erase all previous app configuration. Are you sure?"))return void(this.properties[e]=t);this.unmountApp()}n&&(this.webpartSectionElement.remove(),this.mountApp(n).catch(()=>{}))}}onDisplayModeChanged(t){const n=t===e.DisplayMode.Edit?"Read":"Edit";this.SPFxExtensionInstance?.executeListeners("onDisplayModeChange",n)}openPropertyPane(){this.context.propertyPane.open()}closePropertyPane(){this.context.propertyPane.close()}isPropertyPaneOpen(){return this.context.propertyPane.isPropertyPaneOpen()}saveConfigValue(e,t=!0){this.properties.SPFxExtensionAppConfiguration=e,t&&this.SPFxExtensionInstance?.executeListeners("onConfigurationChange",e)}getConfigValue(e){if(e){let t=this.properties[e];return void 0===t&&(t=this.properties.SPFxExtensionAppConfiguration),t}return this.properties.SPFxExtensionAppConfiguration}getSearchData(){return{searchableText:this.properties.searchableText,searchableHtml:this.properties.searchableHtml}}setSearchData(e){this.properties.searchableText=e.searchableText,this.properties.searchableHtml=e.searchableHtml}getTopActions(){return this.properties.topActions??[]}setTopActions(e){this.properties.topActions=e??[]}getThemeProvider(){return this.themeProvider}getConfigDomElement(){return this.configDomElement}async mountApp(e){this.domElement.innerHTML="";try{const t={domElement:this.domElement,webpartContext:this.context,webpart:this,openPropertyPane:()=>{this.openPropertyPane()},closePropertyPane:()=>{this.closePropertyPane()},isPropertyPaneOpen:()=>this.isPropertyPaneOpen(),saveConfigValue:(e,t=!0)=>{this.saveConfigValue(e,t)},getConfigValue:e=>this.getConfigValue(e),getSearchableData:()=>this.getSearchData(),setSearchableData:e=>{this.setSearchData(e)},setTopActions:e=>{this.setTopActions(e)},getTopActions:()=>this.getTopActions(),getThemeProvider:()=>this.getThemeProvider(),getConfigDomElement:()=>this.getConfigDomElement()};if(this.SPFxExtensionInstance=await window.__SPFxExtensions.InstantiateApp(e,t),!this.SPFxExtensionInstance)return;const n=window.__SPFxExtensions.Apps.find(t=>t.id===e);n&&(this.appDescription=n.description),this.renderCompleted(void 0,!0)}catch(t){console.error(a.Lf,"Error while mounting appid",e,t);const n=new Error(`${t}`);this.renderCompleted(n)}}unmountApp(){this.SPFxExtensionInstance&&this.SPFxExtensionInstance.unmount?.(),this.SPFxExtensionInstance=void 0,this.domElement.innerHTML=""}onDispose(){this.unmountApp()}appButtonElements=[];webpartSectionElement=document.createElement("section");webpartSectionTitle=document.createElement("header");appButtonsWrapper=document.createElement("div");appButtonsContainer=document.createElement("div");generateIconElement(e){const t=document.createElement("i");if(t.classList.add("icon_be4e0fd1"),!e)return t.innerHTML='<svg fill="currentColor" class="___12fm75w f1w7gpdv fez10in fg4l7m0" aria-hidden="true" width="28" height="28" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg"><path d="M20.84 2.66a2.25 2.25 0 0 0-3.18 0L13.5 6.8v-.56c0-1.24-1-2.25-2.25-2.25h-7C3.01 4 2 5.01 2 6.25v18c0 .97.78 1.75 1.75 1.75h18c1.24 0 2.25-1 2.25-2.25v-7c0-1.24-1-2.25-2.25-2.25h-.56l4.16-4.15c.88-.88.88-2.3 0-3.19l-4.5-4.5ZM17.31 14.5H13.5v-3.8l3.8 3.8Zm1.41-10.78c.3-.3.77-.3 1.06 0l4.5 4.5c.3.3.3.77 0 1.06l-4.5 4.51c-.3.3-.77.3-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.07l4.5-4.5ZM12 6.25v8.25H3.5V6.25c0-.41.34-.75.75-.75h7c.41 0 .75.34.75.75Zm-8.5 17.5V16H12v8.5H4.25a.75.75 0 0 1-.75-.75Zm10-7.75h8.25c.41 0 .75.34.75.75v7c0 .42-.34.75-.75.75H13.5V16Z" fill="currentColor"></path></svg>',t;if("font"===e.iconType&&e.fontFamily&&(t.style.fontFamily=e.fontFamily,t.classList.add("iconFont_be4e0fd1")),"url"===e.iconType){const n=document.createElement("img");n.src=e.iconData,t.appendChild(n)}return"svg"===e.iconType&&(t.innerHTML=e.iconData),t}createAndAppendAppButtons(e){const t=document.createElement("button");t.title=a.Bc,t.ariaLabel=a.Bc,t.className="appButton_be4e0fd1";const n=this.generateIconElement(e.icon);t.append(n,e.name),t.title=e.name,t.addEventListener("click",t=>{t.stopPropagation(),t.preventDefault(),this.properties.selectedApp=e.id,this.webpartSectionElement.remove(),this.mountApp(e.id).catch(()=>{})}),this.appButtonsContainer.appendChild(t)}createWebpartSection(e){this.webpartSectionElement.className="applicationListSection_be4e0fd1",this.webpartSectionTitle.className="header_be4e0fd1",this.webpartSectionElement.appendChild(this.webpartSectionTitle),e&&this.webpartSectionElement.appendChild(this.appButtonsWrapper)}renderDisplayMode(){this.webpartSectionElement.ariaLabel=a.oz,this.webpartSectionTitle.textContent=a.oz,this.createWebpartSection(),this.domElement.appendChild(this.webpartSectionElement)}async renderEditMode(){this.webpartSectionElement.ariaLabel=a.Ne,this.webpartSectionTitle.textContent=a.Ne,this.createWebpartSection(!0),this.appButtonsContainer.className="appButtonsContainer_be4e0fd1",this.appButtonsWrapper.appendChild(this.appButtonsContainer),this.appButtonsWrapper.className="appButtonsWrapper_be4e0fd1",this.domElement.appendChild(this.webpartSectionElement),window.__SPFxExtensions.AddAppEventListener("appAdded",e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)}),window.__SPFxExtensions.Apps.filter(e=>e.registrationCompleted).forEach(e=>{e.isWebPartApp&&this.createAndAppendAppButtons(e)});try{await window.__SPFxExtensions.Utils.spAppInitializationPromise,window.__SPFxExtensions.Utils.appManifestPromises.forEach(e=>{const t=document.createElement("div"),n=document.createElement("span");t.className="buttonLoader_be4e0fd1",n.className="loader_be4e0fd1",t.appendChild(n),this.appButtonsContainer.append(t),e.catch(()=>{}).finally(()=>{t.remove()})})}catch(e){console.error(a.Lf,"Error while awaiting app initialization",e)}}async renderEmptyApp(){this.domElement.innerHTML="",this.domElement.className="SPFxExtensionApp_be4e0fd1",this.displayMode===e.DisplayMode.Read?this.renderDisplayMode():await this.renderEditMode(),this.renderCompleted(void 0,!0)}async render(){if(this.SPFxExtensionInstance){if(!this.SPFxExtensionInstance.unmountOnRender)return void this.SPFxExtensionInstance.executeListeners("onRender",void 0);this.unmountApp()}!this.properties.selectedApp||this.SPFxExtensionInstance?await this.renderEmptyApp():await this.mountApp(this.properties.selectedApp)}renderCompleted(e,t){super.renderCompleted(e,t)}get isRenderAsync(){return!0}get propertiesMetadata(){return{searchableText:{isSearchablePlainText:!0},searchableHtml:{isHtmlString:!0}}}onPropertyPaneConfigurationStart(){window.__SPFxExtensions.AllAppAssetsLoadedPromise.then(()=>{const e=window.__SPFxExtensions.Apps.find(e=>e.id===this.properties.selectedApp);e&&(this.appDescription=e.description,this.hideAppSelectorWhenAppLoaded=e.hideAppSelectorWhenAppLoaded??!1,this.hideConfiguratorButton=e.hideConfiguratorButton??!1),this.dropDownProps.options?.splice(0,this.dropDownProps.options?.length);const t=window.__SPFxExtensions.Apps.filter(e=>e.isWebPartApp).map(e=>({key:e.id,text:e.name}));this.dropDownProps.options?.push(...t),this.dropDownProps.selectedKey=this.properties.selectedApp,this.dropDownProps.disabled=!1,this.context.propertyPane.refresh()}).catch(e=>{console.error(a.Lf,"Error while awaiting all app assets to load",e)})}CustomWebpartConfigurationField(e){return{type:t.PropertyPaneFieldType.Custom,targetProperty:e,properties:{key:e,onRender:(e,t,n)=>{this.configDomElement=e,this.SPFxExtensionInstance?.instanceLoadPromise.then(()=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationRender",{domElement:e})}).catch(e=>{console.error(a.Lf,"Error while awaiting app to load",e)})},onDispose:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onConfigurationClose",{domElement:e}),this.configDomElement=void 0}}}}getPropertyPaneConfiguration(){const e={groupFields:[(0,t.PropertyPaneLabel)("spfxExtensionLoaderLabel",{text:"App not working? Try refreshing the page. Or go to the configuration page."}),(0,t.PropertyPaneButton)("configuratorButton",{text:"Open Configurator",buttonType:1,onClick:()=>{window.open(`${this.appCatalogUrl}?web=${this.context.pageContext.web.absoluteUrl}`,"_blank")}})]},n=this.hideConfiguratorButton?[]:[e],a={groupFields:[(0,t.PropertyPaneDropdown)("selectedApp",{label:"App",disabled:this.dropDownProps.disabled,options:this.dropDownProps.options,selectedKey:this.dropDownProps.selectedKey}),(0,t.PropertyPaneLabel)("selectedAppDecription",{text:this.appDescription})]};return{pages:[{groups:[...n,...this.hideAppSelectorWhenAppLoaded?[]:[a],{groupFields:[this.CustomWebpartConfigurationField("SPFxExtensionAppConfiguration")]}]}]}}getTopActionsConfiguration(){return{topActions:this.properties.topActions??[],onExecute:(e,t)=>{this.SPFxExtensionInstance?.executeListeners("onTopActionExecute",{actionName:e,updatedValue:t})}}}onThemeChanged(e){this.SPFxExtensionInstance?.executeListeners("onThemeChange",e)}get dataVersion(){return e.Version.parse("1.0")}}})(),u})())})();
|