@mohsinonxrm/pptb-commandbar-studio 0.8.0 → 0.9.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +578 -0
- package/README.md +82 -61
- package/dist/assets/BulkPublishModal-DjdSDcWe.js +36 -0
- package/dist/assets/CommandEditorPanel-DYsxUTOk.js +1 -0
- package/dist/assets/CommandPalette-DihgRpHI.js +1 -0
- package/dist/assets/CompareView-CdQo0D6e.js +7 -0
- package/dist/assets/CrmParameterEditor-DO6Rt764.js +1 -0
- package/dist/assets/EditorDrawer-Cid60F3b.js +2 -0
- package/dist/assets/HideInsteadOfDeleteModal-Bk_foggy.js +1 -0
- package/dist/assets/IconPickerModal-CW_pvpVS.js +1 -0
- package/dist/assets/ImportXmlModal-BcszuTi-.js +1 -0
- package/dist/assets/MonacoEditor-DweI16yt.js +2 -0
- package/dist/assets/NewButtonModal-C2fAUuZI.js +1 -0
- package/dist/assets/NewGroupModal-BDr4DPBs.js +1 -0
- package/dist/assets/NewTabModal-CYc1fc2A.js +1 -0
- package/dist/assets/RuleEditorPanel-BxGrJYo4.js +1 -0
- package/dist/assets/ScriptView-tkdIK4sg.js +1 -0
- package/dist/assets/TabDisplayRulesPanel-S_AxUWfB.js +1 -0
- package/dist/assets/TranslationsView-DZIGE2pC.js +1 -0
- package/dist/assets/WebResourceBrowser-Dc3kBMvH.js +1 -0
- package/dist/assets/XmlView-B0weY9hR.js +2 -0
- package/dist/assets/dnd-iy5K5XAJ.js +5 -0
- package/dist/assets/fluent-ui-CQyNN9H3.js +59 -0
- package/dist/assets/index-D5GCH8nj.css +1 -0
- package/dist/assets/index-DRTwBo4g.js +136 -0
- package/dist/assets/monaco-DQA8g3bM.css +1 -0
- package/dist/assets/monaco-cQE5XS3B.js +1010 -0
- package/dist/assets/monacoSetup-BIq1zGyP.js +1 -0
- package/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/dist/assets/ruleKinds-BKTUiZ1-.js +1 -0
- package/dist/assets/{server.browser-xEJRzS2D.js → server.browser-DTeSoizu.js} +1 -1
- package/dist/assets/useReplaceWebResourceConfirm-BhU1AM5L.js +1 -0
- package/dist/assets/useStableKeys-49o4VnxU.js +1 -0
- package/dist/assets/{xmlValidator-BkeotXuB.js → xmlValidator-CnbyWxHe.js} +2 -2
- package/dist/icons/icon.svg +11 -4
- package/dist/index.html +15 -11
- package/index.html +10 -4
- package/package.json +3 -1
- package/dist/assets/BulkPublishModal-mJ41AWew.js +0 -36
- package/dist/assets/CommandEditorPanel-BiP1kPHY.js +0 -1
- package/dist/assets/CommandPalette-q51_0qRZ.js +0 -1
- package/dist/assets/ConflictDrawer-CdWv_PbN.js +0 -1
- package/dist/assets/DiffViewer-BQP5f73U.js +0 -7
- package/dist/assets/HideInsteadOfDeleteModal-C9r6ah5p.js +0 -1
- package/dist/assets/IconPickerModal-B81Tnf5i.js +0 -1
- package/dist/assets/ImportXmlModal-C0cMaS59.js +0 -1
- package/dist/assets/LocalizationEditor-DniDtrZV.js +0 -1
- package/dist/assets/MonacoEditor-uzfuRCpJ.js +0 -2
- package/dist/assets/NewButtonModal-BXpX1Ld5.js +0 -1
- package/dist/assets/NewGroupModal-Bh7lXq52.js +0 -1
- package/dist/assets/NewTabModal-Pntdk3in.js +0 -1
- package/dist/assets/RuleEditorPanel-BUGKgc0N.js +0 -1
- package/dist/assets/ScalingEditorPanel-p3-Yw3CO.js +0 -1
- package/dist/assets/TabDisplayRulesPanel-CSNshwaw.js +0 -1
- package/dist/assets/UrlComposerModal-WKSTwUcW.js +0 -1
- package/dist/assets/WebResourceBrowser-BK-gVU2g.js +0 -1
- package/dist/assets/XmlDrawer-CQJElnD1.js +0 -2
- package/dist/assets/abap-DLDM7-KI.js +0 -1
- package/dist/assets/apex-DNDY2TF8.js +0 -1
- package/dist/assets/azcli-Y6nb8tq_.js +0 -1
- package/dist/assets/bat-BwHxbl9M.js +0 -1
- package/dist/assets/bicep-CFznDFnq.js +0 -2
- package/dist/assets/cameligo-Bf6VGUru.js +0 -1
- package/dist/assets/clojure-Dnu-v4kV.js +0 -1
- package/dist/assets/coffee-Bd8akH9Z.js +0 -1
- package/dist/assets/cpp-BbWJElDN.js +0 -1
- package/dist/assets/csharp-Co3qMtFm.js +0 -1
- package/dist/assets/csp-D-4FJmMZ.js +0 -1
- package/dist/assets/css-DdJfP1eB.js +0 -3
- package/dist/assets/css.worker-C_6RgliQ.js +0 -97
- package/dist/assets/cssMode-yNaVDuBb.js +0 -1
- package/dist/assets/cypher-cTPe9QuQ.js +0 -1
- package/dist/assets/dart-BOtBlQCF.js +0 -1
- package/dist/assets/dnd-Cq8OftAq.js +0 -5
- package/dist/assets/dockerfile-BG73LgW2.js +0 -1
- package/dist/assets/ecl-BEgZUVRK.js +0 -1
- package/dist/assets/elixir-BkW5O-1t.js +0 -1
- package/dist/assets/flow9-BeJ5waoc.js +0 -1
- package/dist/assets/fluent-icons-BqJj6rDi.js +0 -1
- package/dist/assets/fluent-ui-QADO660t.js +0 -43
- package/dist/assets/freemarker2-CzWSO7cF.js +0 -3
- package/dist/assets/fsharp-PahG7c26.js +0 -1
- package/dist/assets/go-acbASCJo.js +0 -1
- package/dist/assets/graphql-BxJiqAUM.js +0 -1
- package/dist/assets/handlebars-BpG2O9CH.js +0 -1
- package/dist/assets/hcl-DtV1sZF8.js +0 -1
- package/dist/assets/html-Bm7ESfBq.js +0 -1
- package/dist/assets/html.worker-CLyYFd_g.js +0 -474
- package/dist/assets/htmlMode--CmpAV7s.js +0 -1
- package/dist/assets/index-D9lerlVA.css +0 -1
- package/dist/assets/index-Di2_5czx.js +0 -136
- package/dist/assets/ini-Kd9XrMLS.js +0 -1
- package/dist/assets/java-CXBNlu9o.js +0 -1
- package/dist/assets/javascript-DYy3TIq5.js +0 -1
- package/dist/assets/json.worker-BggoxaER.js +0 -62
- package/dist/assets/jsonMode-DwsyQ3o1.js +0 -7
- package/dist/assets/julia-cl7-CwDS.js +0 -1
- package/dist/assets/kotlin-s7OhZKlX.js +0 -1
- package/dist/assets/less-9HpZscsL.js +0 -2
- package/dist/assets/lexon-OrD6JF1K.js +0 -1
- package/dist/assets/liquid-qkuWCPaY.js +0 -1
- package/dist/assets/lspLanguageFeatures-Cgd9CNvq.js +0 -4
- package/dist/assets/lua-Cyyb5UIc.js +0 -1
- package/dist/assets/m3-B8OfTtLu.js +0 -1
- package/dist/assets/markdown-BFxVWTOG.js +0 -1
- package/dist/assets/mdx-CtHfOclF.js +0 -1
- package/dist/assets/mips-CiqrrVzr.js +0 -1
- package/dist/assets/monaco-BIO15LCS.js +0 -1005
- package/dist/assets/monaco-DdLsZAcA.css +0 -1
- package/dist/assets/msdax-DmeGPVcC.js +0 -1
- package/dist/assets/mysql-C_tMU-Nz.js +0 -1
- package/dist/assets/objective-c-BDtDVThU.js +0 -1
- package/dist/assets/pascal-vHIfCaH5.js +0 -1
- package/dist/assets/pascaligo-DtZ0uQbO.js +0 -1
- package/dist/assets/perl-Ub6l9XKa.js +0 -1
- package/dist/assets/pgsql-BlNEE0v7.js +0 -1
- package/dist/assets/php-BBUBE1dy.js +0 -1
- package/dist/assets/pla-DSh2-awV.js +0 -1
- package/dist/assets/postiats-CocnycG-.js +0 -1
- package/dist/assets/powerquery-tScXyioY.js +0 -1
- package/dist/assets/powershell-COWaemsV.js +0 -1
- package/dist/assets/protobuf-Brw8urJB.js +0 -2
- package/dist/assets/pug-8SOpv6rk.js +0 -1
- package/dist/assets/python-CazlH6B-.js +0 -1
- package/dist/assets/qsharp-Bw9ernYp.js +0 -1
- package/dist/assets/r-j7ic8hl3.js +0 -1
- package/dist/assets/razor-BfGfB6aB.js +0 -1
- package/dist/assets/redis-Bu5POkcn.js +0 -1
- package/dist/assets/redshift-Bs9aos_-.js +0 -1
- package/dist/assets/restructuredtext-CqXO7rUv.js +0 -1
- package/dist/assets/ruby-zBfavPgS.js +0 -1
- package/dist/assets/ruleKinds-B9hACGaq.js +0 -1
- package/dist/assets/rust-BzKRNQWT.js +0 -1
- package/dist/assets/sb-BBc9UKZt.js +0 -1
- package/dist/assets/scala-D9hQfWCl.js +0 -1
- package/dist/assets/scheme-BPhDTwHR.js +0 -1
- package/dist/assets/scss-CBJaRo0y.js +0 -3
- package/dist/assets/shell-DiJ1NA_G.js +0 -1
- package/dist/assets/solidity-Db0IVjzk.js +0 -1
- package/dist/assets/sophia-CnS9iZB_.js +0 -1
- package/dist/assets/sparql-CJmd_6j2.js +0 -1
- package/dist/assets/sql-ClhHkBeG.js +0 -1
- package/dist/assets/st-CHwy0fLd.js +0 -1
- package/dist/assets/swift-CnmFD0ga.js +0 -1
- package/dist/assets/systemverilog-Bs9z6M-B.js +0 -1
- package/dist/assets/tcl-Dm6ycUr_.js +0 -1
- package/dist/assets/tsMode-BZv6gTt6.js +0 -11
- package/dist/assets/twig-Csy3S7wG.js +0 -1
- package/dist/assets/typescript-BgDL1fzP.js +0 -1
- package/dist/assets/typespec-Btyra-wh.js +0 -1
- package/dist/assets/useReplaceWebResourceConfirm-BUWBVNSC.js +0 -1
- package/dist/assets/useStableKeys-p2OkzZWO.js +0 -1
- package/dist/assets/vb-Db0cS2oM.js +0 -1
- package/dist/assets/wgsl-BTesnYfV.js +0 -298
- package/dist/assets/workers-BZ4mXA5s.js +0 -1
- package/dist/assets/xml-Cl6spsD4.js +0 -1
- package/dist/assets/yaml-El-x4GhS.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as o,m as e,W as a,a as n}from"./monaco-cQE5XS3B.js";import"./fluent-ui-CQyNN9H3.js";import"./preload-helper-PPVm8Dsz.js";o.config({monaco:e});self.MonacoEnvironment={getWorker(p,r){return r==="typescript"||r==="javascript"?new a:new n}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p="modulepreload",y=function(u,i){return new URL(u,i).href},v={},w=function(i,a,f){let d=Promise.resolve();if(a&&a.length>0){let E=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const r=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),m=t?.nonce||t?.getAttribute("nonce");d=E(a.map(e=>{if(e=y(e,f),e in v)return;v[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(f)for(let c=r.length-1;c>=0;c--){const l=r[c];if(l.href===e&&(!o||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,m&&n.setAttribute("nonce",m),document.head.appendChild(n),o)return new Promise((c,l)=>{n.addEventListener("load",c),n.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${e}`)))})}))}function h(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return d.then(r=>{for(const t of r||[])t.status==="rejected"&&h(t.reason);return i().catch(h)})};export{w as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u={CommandClientTypeRule:"Client (Unified Interface / legacy)",CrmClientTypeRule:"Client (web / Outlook)",CrmOfflineAccessStateRule:"Offline access",CrmOutlookClientTypeRule:"Outlook client",CrmOutlookClientVersionRule:"Outlook client version",CustomRule:"Your JavaScript",DeviceTypeRule:"Device",EntityPrivilegeRule:"Table privilege",EntityPropertyRule:"Table property",EntityRule:"Table",FeatureControlRule:"Feature control bit",FormEntityContextRule:"Form's table",FormStateRule:"Form state",FormTypeRule:"Form type",HideForTabletExperienceRule:"Hide on tablets",MiscellaneousPrivilegeRule:"Other privilege",OptionSetRule:"Choice value",OrganizationSettingRule:"Organization setting",OrRule:"Any of (Or)",OutlookItemTrackingRule:"Outlook item tracking",OutlookRenderTypeRule:"Outlook or web",OutlookVersionRule:"Outlook version",PageRule:"Page address",RawRule:"Other rule (kept as XML)",RecordPrivilegeRule:"Record privilege",ReferencingAttributeRequiredRule:"Referencing column required",RelationshipTypeRule:"Relationship type",SelectionCountRule:"Selected records",SkuRule:"Deployment (online / on-premises)",ValueRule:"Column value"},n=[{label:"Client and device",kinds:["CommandClientTypeRule","CrmClientTypeRule","DeviceTypeRule","CrmOutlookClientVersionRule"]},{label:"Form",kinds:["FormStateRule","FormTypeRule","FormEntityContextRule"]},{label:"Table",kinds:["EntityRule","EntityPrivilegeRule","EntityPropertyRule","OptionSetRule"]},{label:"Selection and record",kinds:["SelectionCountRule","ValueRule","RecordPrivilegeRule"]},{label:"Other",kinds:["MiscellaneousPrivilegeRule","OrganizationSettingRule","FeatureControlRule","PageRule","SkuRule","HideForTabletExperienceRule","RelationshipTypeRule","ReferencingAttributeRequiredRule"]},{label:"Outlook",kinds:["CrmOfflineAccessStateRule","CrmOutlookClientTypeRule","OutlookItemTrackingRule","OutlookRenderTypeRule","OutlookVersionRule"]},{label:"Combine steps",kinds:["OrRule"]},{label:"Your code",kinds:["CustomRule"]}],o=new Set(["CustomRule","OutlookItemTrackingRule","RecordPrivilegeRule","SelectionCountRule"]),l=new Set(["CrmOutlookClientVersionRule","DeviceTypeRule","EntityPrivilegeRule","EntityPropertyRule","FeatureControlRule","FormEntityContextRule","FormTypeRule","HideForTabletExperienceRule","MiscellaneousPrivilegeRule","OptionSetRule","OrganizationSettingRule","OutlookRenderTypeRule","ReferencingAttributeRequiredRule","RelationshipTypeRule"]),r=new Set([...Array.from(l),"HideIfNetBreezeNotAvailableRule","HideIfServiceMetadataAvailableRule","HideIfSharepointS2SConfigurationEnabledRule","HideIfExportToExcelNotEnabledRule","IsExportToExcelOnlineEnabledRule","HideIfDisabledForMobileRule","HideIfHybridSSSNotEnabledRule","HideIfEmailSignatureNotEnabledRule","HideIfReverseHybridSSSNotEnabledRule","HideIfDelveNotAvailableRule","HideIfTestExchangeServerNotEnabledRule","HideIfSSSTroubleshootingNotEnabledRule","HideIfCurrentUserIsNotSystemAdministratorRule","HideIfPowerBITileNotAvailableRule","HideIfProcessActiveRule","HideIfProcessInactiveRule","HideIfProcessUnificationIsDisabledRule","HideIfO365UserDoesNotHaveExchangeSubscriptionsRule","HideIfEmailIsApprovedByAdminRule","HideIfUserIsNotTenantAdminRule","HideIfEmailIsApprovedByAdminBasedOnESPRule","HideIfProductRecommendationsNotEnabledRule"]);function R(e,t,i=!1){return e==="RawRule"||i&&e==="OrRule"?!1:t==="enable"?!l.has(e):!o.has(e)}export{r as D,o as E,n as R,u as a,R as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{eS as Kr}from"./fluent-ui-CQyNN9H3.js";function cn($,m){for(var F=0;F<m.length;F++){const B=m[F];if(typeof B!="string"&&!Array.isArray(B)){for(const v in B)if(v!=="default"&&!(v in $)){const R=Object.getOwnPropertyDescriptor(B,v);R&&Object.defineProperty($,v,R.get?R:{enumerable:!0,get:()=>B[v]})}}}return Object.freeze(Object.defineProperty($,Symbol.toStringTag,{value:"Module"}))}var he={},Re={};var Gr;function fn(){if(Gr)return Re;Gr=1;var $=Kr();function m(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,l=1;l<arguments.length;l++)n+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var F=Object.prototype.hasOwnProperty,B=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},R={};function Ae(e){return F.call(R,e)?!0:F.call(v,e)?!1:B.test(e)?R[e]=!0:(v[e]=!0,!1)}function N(e,n,l,s,f,i,p){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=s,this.attributeNamespace=f,this.mustUseProperty=l,this.propertyName=e,this.type=n,this.sanitizeURL=i,this.removeEmptyString=p}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new N(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];S[n]=new N(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new N(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new N(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new N(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new N(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new N(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new N(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new N(e,5,!1,e.toLowerCase(),null,!1,!1)});var g=/[\-:]([a-z])/g;function _e(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(g,_e);S[n]=new N(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new N("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new N(e,1,!1,e.toLowerCase(),null,!0,!0)});var z={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},sr=["Webkit","ms","Moz","O"];Object.keys(z).forEach(function(e){sr.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),z[n]=z[e]})});var gt=/["'&<>]/;function O(e){if(typeof e=="boolean"||typeof e=="number")return""+e;e=""+e;var n=gt.exec(e);if(n){var l="",s,f=0;for(s=n.index;s<e.length;s++){switch(e.charCodeAt(s)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}f!==s&&(l+=e.substring(f,s)),f=s+1,l+=n}e=f!==s?l+e.substring(f,s):l}return e}var vt=/([A-Z])/g,L=/^ms-/,b=Array.isArray;function U(e,n){return{insertionMode:e,selectedValue:n}}function He(e,n,l){switch(n){case"select":return U(1,l.value!=null?l.value:l.defaultValue);case"svg":return U(2,null);case"math":return U(3,null);case"foreignObject":return U(1,null);case"table":return U(4,null);case"thead":case"tbody":case"tfoot":return U(5,null);case"colgroup":return U(7,null);case"tr":return U(6,null)}return 4<=e.insertionMode||e.insertionMode===0?U(1,null):e}var me=new Map;function St(e,n,l){if(typeof l!="object")throw Error(m(62));n=!0;for(var s in l)if(F.call(l,s)){var f=l[s];if(f!=null&&typeof f!="boolean"&&f!==""){if(s.indexOf("--")===0){var i=O(s);f=O((""+f).trim())}else{i=s;var p=me.get(i);p!==void 0||(p=O(i.replace(vt,"-$1").toLowerCase().replace(L,"-ms-")),me.set(i,p)),i=p,f=typeof f=="number"?f===0||F.call(z,s)?""+f:f+"px":O((""+f).trim())}n?(n=!1,e.push(' style="',i,":",f)):e.push(";",i,":",f)}}n||e.push('"')}function j(e,n,l,s){switch(l){case"style":St(e,n,s);return;case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N"){if(n=S.hasOwnProperty(l)?S[l]:null,n!==null){switch(typeof s){case"function":case"symbol":return;case"boolean":if(!n.acceptsBooleans)return}switch(l=n.attributeName,n.type){case 3:s&&e.push(" ",l,'=""');break;case 4:s===!0?e.push(" ",l,'=""'):s!==!1&&e.push(" ",l,'="',O(s),'"');break;case 5:isNaN(s)||e.push(" ",l,'="',O(s),'"');break;case 6:!isNaN(s)&&1<=s&&e.push(" ",l,'="',O(s),'"');break;default:n.sanitizeURL&&(s=""+s),e.push(" ",l,'="',O(s),'"')}}else if(Ae(l)){switch(typeof s){case"function":case"symbol":return;case"boolean":if(n=l.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-")return}e.push(" ",l,'="',O(s),'"')}}}function D(e,n,l){if(n!=null){if(l!=null)throw Error(m(60));if(typeof n!="object"||!("__html"in n))throw Error(m(61));n=n.__html,n!=null&&e.push(""+n)}}function ir(e){var n="";return $.Children.forEach(e,function(l){l!=null&&(n+=l)}),n}function Ue(e,n,l,s){e.push(X(l));var f=l=null,i;for(i in n)if(F.call(n,i)){var p=n[i];if(p!=null)switch(i){case"children":l=p;break;case"dangerouslySetInnerHTML":f=p;break;default:j(e,s,i,p)}}return e.push(">"),D(e,f,l),typeof l=="string"?(e.push(O(l)),null):l}var We=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,xt=new Map;function X(e){var n=xt.get(e);if(n===void 0){if(!We.test(e))throw Error(m(65,e));n="<"+e,xt.set(e,n)}return n}function ar(e,n,l,s,f){switch(n){case"select":e.push(X("select"));var i=null,p=null;for(C in l)if(F.call(l,C)){var y=l[C];if(y!=null)switch(C){case"children":i=y;break;case"dangerouslySetInnerHTML":p=y;break;case"defaultValue":case"value":break;default:j(e,s,C,y)}}return e.push(">"),D(e,p,i),i;case"option":p=f.selectedValue,e.push(X("option"));var x=y=null,w=null,C=null;for(i in l)if(F.call(l,i)){var M=l[i];if(M!=null)switch(i){case"children":y=M;break;case"selected":w=M;break;case"dangerouslySetInnerHTML":C=M;break;case"value":x=M;default:j(e,s,i,M)}}if(p!=null)if(l=x!==null?""+x:ir(y),b(p)){for(s=0;s<p.length;s++)if(""+p[s]===l){e.push(' selected=""');break}}else""+p===l&&e.push(' selected=""');else w&&e.push(' selected=""');return e.push(">"),D(e,C,y),y;case"textarea":e.push(X("textarea")),C=p=i=null;for(y in l)if(F.call(l,y)&&(x=l[y],x!=null))switch(y){case"children":C=x;break;case"value":i=x;break;case"defaultValue":p=x;break;case"dangerouslySetInnerHTML":throw Error(m(91));default:j(e,s,y,x)}if(i===null&&p!==null&&(i=p),e.push(">"),C!=null){if(i!=null)throw Error(m(92));if(b(C)&&1<C.length)throw Error(m(93));i=""+C}return typeof i=="string"&&i[0]===`
|
|
2
2
|
`&&e.push(`
|
|
3
3
|
`),i!==null&&e.push(O(""+i)),null;case"input":e.push(X("input")),x=C=y=i=null;for(p in l)if(F.call(l,p)&&(w=l[p],w!=null))switch(p){case"children":case"dangerouslySetInnerHTML":throw Error(m(399,"input"));case"defaultChecked":x=w;break;case"defaultValue":y=w;break;case"checked":C=w;break;case"value":i=w;break;default:j(e,s,p,w)}return C!==null?j(e,s,"checked",C):x!==null&&j(e,s,"checked",x),i!==null?j(e,s,"value",i):y!==null&&j(e,s,"value",y),e.push("/>"),null;case"menuitem":e.push(X("menuitem"));for(var K in l)if(F.call(l,K)&&(i=l[K],i!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(m(400));default:j(e,s,K,i)}return e.push(">"),null;case"title":e.push(X("title")),i=null;for(M in l)if(F.call(l,M)&&(p=l[M],p!=null))switch(M){case"children":i=p;break;case"dangerouslySetInnerHTML":throw Error(m(434));default:j(e,s,M,p)}return e.push(">"),i;case"listing":case"pre":e.push(X(n)),p=i=null;for(x in l)if(F.call(l,x)&&(y=l[x],y!=null))switch(x){case"children":i=y;break;case"dangerouslySetInnerHTML":p=y;break;default:j(e,s,x,y)}if(e.push(">"),p!=null){if(i!=null)throw Error(m(60));if(typeof p!="object"||!("__html"in p))throw Error(m(61));l=p.__html,l!=null&&(typeof l=="string"&&0<l.length&&l[0]===`
|
|
4
4
|
`?e.push(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,j as e,D as g,f as x,g as m,h,n as j,t as f,c as l,o as y,k as o}from"./fluent-ui-CQyNN9H3.js";import{S as b,at as k}from"./index-DRTwBo4g.js";function w(){const[n,t]=r.useState(null),c=r.useRef(null),d=b(a=>a.connectionVersion),s=r.useCallback(a=>{c.current?.(a),c.current=null,t(null)},[]),p=r.useCallback(a=>new Promise(i=>{c.current?.("cancel"),c.current=i,t({name:a.name,managed:a.managed})}),[]);r.useEffect(()=>()=>s("cancel"),[d,s]);const u=e.jsx(g,{open:n!==null,onOpenChange:(a,i)=>!i.open&&s("cancel"),children:e.jsx(x,{style:{maxWidth:520},children:e.jsxs(m,{children:[e.jsx(h,{children:n?.managed?"Use the existing web resource?":"Replace the existing web resource?"}),e.jsxs(j,{style:{display:"flex",flexDirection:"column",gap:f.spacingVerticalS},children:[n?.managed?e.jsxs(l,{children:["A managed web resource named ",e.jsx("strong",{children:n.name})," already exists. It can't be replaced: keep it as it is, or rename the file and upload it again."]}):e.jsxs(l,{children:["A web resource named ",e.jsx("strong",{children:n?.name})," already exists. Replacing it changes its content everywhere it is used (other ribbons, forms, apps)."]}),e.jsx(k,{prefix:"In"})]}),e.jsxs(y,{children:[e.jsx(o,{appearance:"secondary",onClick:()=>s("cancel"),children:"Cancel"}),e.jsx(o,{appearance:n?.managed?"primary":"secondary",onClick:()=>s("keep"),children:"Keep existing"}),!n?.managed&&e.jsx(o,{appearance:"primary",onClick:()=>s("replace"),children:"Replace"})]})]})})});return{onExisting:p,dialog:u}}export{w as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as d}from"./fluent-ui-CQyNN9H3.js";import{g as y}from"./dnd-iy5K5XAJ.js";let c=0;const g=(n,t)=>Array.from({length:t},()=>`${n}#${++c}`);function p(n,t){const[e,a]=d.useState(null),f=d.useMemo(()=>g(n,t.length),[n,t]),l=!!e&&e.scope===n&&e.keys.length===t.length&&(e.items===t||e.pending);e?.pending&&a({...e,items:l?t:e.items,pending:!1});const r=l?e.keys:f,o=s=>a({scope:n,items:t,pending:!0,keys:s});return{keys:r,add:()=>o([...r,...g(n,1)]),remove:s=>o(r.filter((u,i)=>i!==s)),move:(s,u)=>o(y(r,s,u)),update:()=>o(r)}}export{p as u};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{af as v,ag as ie,ah as re,ai as V,aj as le,p as ce}from"./index-DRTwBo4g.js";import{D as ue,E as me}from"./ruleKinds-BKTUiZ1-.js";import{C as de,i as fe}from"./crmParameters-rgfZhhzN.js";const pe=/^[a-zA-Z_$][a-zA-Z_$0-9.]*$/,he=/^[a-zA-Z_][a-zA-Z_0-9]*$/,ge=/^[+-]?\d+$/,be=/^[+-]?(\d+(\.\d*)?|\.\d+)$/,H=/^(true|false|1|0)$/,W={JavaScriptFunction:["FunctionName","Library"],Url:["Address"],CustomRule:["FunctionName","Library"],CommandClientTypeRule:["Type"],CrmClientTypeRule:["Type"],CrmOfflineAccessStateRule:["State"],CrmOutlookClientTypeRule:["Type"],CrmOutlookClientVersionRule:["Major"],DeviceTypeRule:["Type"],EntityPrivilegeRule:["PrivilegeType","PrivilegeDepth"],EntityPropertyRule:["PropertyName","PropertyValue"],FeatureControlRule:["FeatureControlBit","ExpectedValue"],FormEntityContextRule:["EntityName"],FormStateRule:["State"],FormTypeRule:["Type"],MiscellaneousPrivilegeRule:["PrivilegeName"],OptionSetRule:["OptionSet","StateCode","ObjectTypeCode"],OrganizationSettingRule:["Setting"],OutlookItemTrackingRule:["TrackedInCrm"],OutlookRenderTypeRule:["Type"],OutlookVersionRule:["Version"],PageRule:["Address"],RecordPrivilegeRule:["PrivilegeType"],RelationshipTypeRule:["AppliesTo"],SkuRule:["Sku"],ValueRule:["Field","Value"],BoolParameter:["Value"],CrmParameter:["Value"],DecimalParameter:["Value"],IntParameter:["Value"],StringParameter:["Value"]},ye=new Set(["ValueRule.Value","StringParameter.Value"]),$e={SelectionCountRule:["Minimum","Maximum"],CrmOutlookClientVersionRule:["Major","Minor","Build","Revision"],IntParameter:["Value"],Url:["WinMode"]},Ae={DecimalParameter:["Value"]},Re={BoolParameter:["Value"],Url:["PassParams"],OutlookItemTrackingRule:["TrackedInCrm"],EntityPropertyRule:["PropertyValue"],FeatureControlRule:["ExpectedValue"],RelationshipTypeRule:["AllowCustomRelationship","AllowSystemRelationship"]},Se=["Default","InvertResult"],Ie=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]),O=s=>Array.from(s.children);function q(s,l,g){const u=[],f=s.tagName;for(const p of W[f]??[]){const m=s.getAttribute(p);(m===null||!m.trim()&&!ye.has(`${f}.${p}`))&&u.push(`${l}: ${f} has no ${p}`)}const b=(p,m,i)=>{for(const d of p??[]){const R=s.getAttribute(d);R===null||R===""&&W[f]?.includes(d)||m.test(R.trim())||u.push(`${l}: ${f} ${d}="${R}" is not ${i}`)}};if(b($e[f],ge,"a whole number"),b(Ae[f],be,"a number"),b(Re[f],H,"true or false"),g&&b(Se,H,"true or false"),f==="JavaScriptFunction"||f==="CustomRule"){const p=s.getAttribute("FunctionName");p?.trim()&&!pe.test(p)&&u.push(`${l}: FunctionName "${p}" isn't a JavaScript function name (letters, digits, _, $ and dots)`)}if((f==="JavaScriptFunction"||f==="CustomRule")&&/^\$webresource:\s*$/i.test(s.getAttribute("Library")??"")&&u.push(`${l}: ${f} Library names no web resource`),f==="EntityRule"){const p=s.getAttribute("Context");p!==null&&!he.test(p)&&u.push(`${l}: EntityRule Context "${p}" isn't valid`)}f==="Url"&&/^https?:\/\/$/i.test(s.getAttribute("Address")?.trim()??"")&&u.push(`${l}: Url has no address`);for(const p of O(s).filter(m=>Ie.has(m.tagName)))f==="Url"&&!p.getAttribute("Name")?.trim()&&u.push(`${l}: a ${p.tagName} of the Url has no Name`),f!=="Url"&&p.hasAttribute("Name")&&u.push(`${l}: a ${p.tagName} of ${f} can't have a Name`),u.push(...q(p,l,!1));return u}function we(s){const l=s.getAttribute("Id")??"";if(s.tagName==="CommandDefinition"){const b=`Command ${l}`,p=O(s).find(m=>m.tagName==="Actions");return O(p??s).filter(m=>m.tagName==="JavaScriptFunction"||m.tagName==="Url").flatMap(m=>q(m,b,!1))}if(s.tagName!=="EnableRule"&&s.tagName!=="DisplayRule")return[];const g=`${s.tagName==="EnableRule"?"Enable":"Display"} rule ${l}`,u=O(s);if(u.length===0)return[`${g} has no steps — add one, or remove the rule from its commands`];const f=[];for(const b of u){if(b.tagName!=="OrRule"){f.push(...q(b,g,!0));continue}const p=O(b).filter(m=>m.tagName==="Or");p.length<2&&f.push(`${g}: an OrRule needs at least 2 alternatives (it has ${p.length})`);for(const m of p){const i=O(m);i.length===0&&f.push(`${g}: an alternative of its OrRule has no steps`);for(const d of i)d.tagName==="OrRule"?f.push(`${g}: an OrRule can't contain another OrRule`):f.push(...q(d,g,!0))}}return f}const Ne=["Mscrm.HideOnModern","Mscrm.ShowOnlyOnModern"];function E(s,l){const g=s.indexOf(l);return g<0?void 0:`Line ${s.slice(0,g).split(/\r?\n/).length}`}function _e(s,l,g){const u=[],b=new DOMParser().parseFromString(s,"application/xml"),p=b.querySelector("parsererror");if(p){const i=(p.textContent??"").replace(/This page contains the following errors:/i,"").replace(/Below is a rendering of the page up to the first error\.?/i,"").trim()||"Unknown",d=i.match(/line\s+(\d+)/i);return u.push({message:`XML parse error: ${i}`,lineHint:d?`Line ${d[1]}`:void 0}),u}const m=new Set([]);return b.querySelectorAll("[Id]").forEach(i=>{const d=i.getAttribute("Id")??"";if(/\s/.test(d)){const R=E(s,`Id="${d}"`);u.push({message:`Element ID "${d}" contains invalid whitespace characters`,elementId:d,lineHint:R})}}),b.querySelectorAll("[LabelText]").forEach(i=>{const d=i.getAttribute("LabelText")??"",R=d.match(/^\$LocLabels:(.+)$/);if(R&&m.size>0&&!m.has(R[1])){const $=i.getAttribute("Id")??"",S=E(s,$?`Id="${$}"`:`LabelText="${d}"`);u.push({message:`Button label reference "$LocLabels:${R[1]}" has no matching LocLabel entry`,elementId:$||void 0,lineHint:S})}}),(s.includes("& ")||s.includes(`&
|
|
2
2
|
`))&&u.push({message:'URL may contain an unescaped "&" — all ampersands in XML must be written as &',lineHint:E(s,"& ")??E(s,`&
|
|
3
|
-
`)}),b.querySelectorAll("Group").forEach(i=>{const d=[];i.querySelectorAll(":scope > Controls > Button, :scope > Controls > FlyoutAnchor, :scope > Controls > SplitButton").forEach(R=>{const $=parseInt(R.getAttribute("Sequence")??"0",10);if(d.includes($)){const S=i.getAttribute("Id")??"?";u.push({message:`Two elements share Sequence "${$}" in group "${S}"`,elementId:S,lineHint:E(s,`Sequence="${$}"`)})}d.push($)})}),u.push(...Ee(b,s)),u}const X=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]);function A(s){return Array.from(s.children)}function te(s,l){return l==="enable"?ue.has(s):me.has(s)}function Ee(s,l){const g=[],u=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i)}),f=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i),severity:"warning"}),b=s.querySelector("RibbonDiffXml > RuleDefinitions"),p=[{tag:"EnableRule",label:"Enable",container:"enable"},{tag:"DisplayRule",label:"Display",container:"display"}];for(const{tag:m,label:i,container:d}of p)b?.querySelectorAll(`:scope > ${m}s > ${m}`).forEach(R=>{const $=R.getAttribute("Id")??"",S=A(R);S.length===0&&u(`${i} rule "${$}" has no steps — the schema requires at least one`,`Id="${$}"`,$);const D=I=>{te(I.tagName,d)&&f(`${i} rule "${$}" contains ${I.tagName}, which RibbonTypes.xsd only allows in ${d==="enable"?"display":"enable"} rules`,`<${I.tagName}`,$)};for(const I of S){if(I.tagName!=="OrRule"){D(I);continue}const T=A(I);T.filter(w=>w.tagName==="Or").length<2&&u(`OrRule in ${i.toLowerCase()} rule "${$}" needs at least 2 <Or> children (found ${T.filter(w=>w.tagName==="Or").length})`,"<OrRule",$);for(const w of T){const C=A(w);C.length===0&&u(`Empty <Or> in rule "${$}"`,"<Or",$);for(const L of C)L.tagName==="OrRule"?u(`Rule "${$}": an <Or> cannot contain another OrRule`,"<OrRule",$):D(L)}}});return b||s.querySelectorAll("OrRule").forEach(m=>{const i=m.querySelectorAll(":scope > Or").length;i<2&&u(`OrRule requires at least 2 <Or> children (found ${i})`,"<OrRule")}),s.querySelectorAll("JavaScriptFunction, CustomRule").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.hasAttribute("Name")&&u(`${i.tagName} inside <${m.tagName}> must not have a Name attribute (only <Url> parameters are named)`,`<${i.tagName} Name=`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!de.has(d)&&u(`CrmParameter Value "${d}" is not a valid CrmParameterValue`,`Value="${d}"`)}}),s.querySelectorAll("Url").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.getAttribute("Name")||u(`${i.tagName} inside <Url> requires a Name (the query-string key)`,`<${i.tagName}`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!fe(d)&&u(`CrmParameter Value "${d}" is not allowed in a <Url> action (CrmNamedParameterValue)`,`Value="${d}"`)}}),s.querySelector("RibbonDiffXml > Scalings")&&u('<Scalings> is not allowed in RibbonDiffXml — scaling changes are CustomActions with Location="{tabId}.Scaling._children"',"<Scalings"),s.querySelectorAll("CustomAction > CommandUIDefinition > Tab").forEach(m=>{const i=m.getAttribute("Id")??"",d=A(m).map(S=>S.tagName),R=d.indexOf("Scaling"),$=d.indexOf("Groups");(R<0||$>=0&&R>$)&&u(`Tab "${i}" needs a <Scaling Id> element before <Groups>`,`Id="${i}"`,i)}),s.querySelectorAll("TabDisplayRule > DisplayRules").forEach(()=>{u("TabDisplayRule rules must be direct children — remove the <DisplayRules> wrapper","<TabDisplayRule")}),g}const Te=["LabelText","ToolTipTitle","ToolTipDescription","Alt","Title","Description"],Ce=new Set(["powerFx","customApi"]),Le={powerFx:"Power Fx",customApi:"Custom API"};function ve(s){return[...new Set(s.actions.map(l=>l.kind).filter(l=>Ce.has(l)))]}const K=/^\$LocLabels:(.+)$/,ne=/^\$webresource:([^?#]+)/i,J=new Set(["ModernImage","Image16by16","Image32by32"]),Q=new Set(["Tab","Group"]),oe=new Set(["main_system_library.js"]),Oe=new Set(["FlyoutAnchor","SplitButton"]),Pe=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),Y=/^(.+)\.Scaling\._children$/,Z=s=>/^(Mscrm|Microsoft)\./.test(s);function ae(s){const l=[],g=[],u=new DOMParser;for(const f of Object.keys(s))for(const[b,p]of s[f]){const m=u.parseFromString(p,"application/xml");if(m.querySelector("parsererror")){g.push({severity:"error",code:"xml-parse",message:`${f} element ${b} is not well-formed XML`,elementId:b});continue}l.push({part:f,key:`${f}:${b}`,el:m.documentElement})}return{elements:l,errors:g}}function N(s){return[s,...Array.from(s.getElementsByTagName("*"))]}function se(s){return typeof s=="string"?ce(s):s}function Be(s){let l;try{l=se(s)}catch{return[]}const g=new Map;for(const{el:u}of ae(l).elements)for(const f of N(u))for(const b of Array.from(f.attributes)){const p=ne.exec(b.value.trim())?.[1],m=p?.toLowerCase();p&&m&&!oe.has(m)&&!g.has(m)&&g.set(m,p)}return[...g.values()]}const ee=s=>{const l=s.trim();return l&&!l.includes(".")?`Mscrm.Templates.${l}`:l};function qe(s,l={}){let g;try{g=se(s)}catch(e){return[{severity:"error",code:"xml-parse",message:e instanceof Error?e.message:String(e)}]}const{elements:u,errors:f}=ae(g),b=l.changedKeys?new Set(l.changedKeys):null,p=e=>!b||b.has(e),m=new Set(l.newKeys??[]),i=(e,n,t,a,o=!1)=>{const r=(Array.isArray(n)?n:[n]).some(p);f.push({severity:o||!r?"warning":"error",code:e,message:r?t:`${t} (already in the published customizations)`,elementId:a})},d=u.filter(e=>e.part==="customActions"),R=u.filter(e=>e.part==="commandDefinitions");for(const{part:e,key:n,el:t}of u)if(!(e!=="commandDefinitions"&&e!=="enableRules"&&e!=="displayRules"))for(const a of we(t))i("schema",n,a,t.getAttribute("Id")??void 0);const $=new Map((l.commands??[]).map(e=>[e.id,e]));for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=$.get(t);if(!a||!p(e))continue;const o=ve(a);o.length!==0&&i("dropped-action",e,`Command ${t} has a ${o.map(r=>Le[r]??r).join(" / ")} action — classic ribbon commands can't run it, so it would be dropped; remove the action`,t)}const S=new Set;for(const{el:e}of d)if(e.tagName==="CustomAction")for(const n of Array.from(e.getElementsByTagName("*")))n.getAttribute("Command")===v&&S.add(n.getAttribute("Id")??"");for(const{key:e,el:n}of d){if(n.tagName!=="HideCustomAction")continue;const t=n.getAttribute("Location")??"";!S.has(t)&&!ie({id:t,commandId:v})||i("open-record-hidden",e,`${t} is hidden, but it carries the record open override (${v}) — Unified Interface may then open records as usual or fail to open them; unhide it, or turn the override off`,t,!0)}for(const{key:e,el:n}of R){if(n.getAttribute("Id")!==v)continue;const t=A(n).filter(o=>o.tagName==="DisplayRules").flatMap(o=>A(o).map(r=>r.getAttribute("Id")??r.tagName));if(t.length===0)continue;const a=t.includes("Mscrm.HideOnModern")?Ne.filter(o=>t.includes(o)):[];i("open-record-hidden",e,`${v} has display rules (${t.join(", ")})${a.length>0?` — ${a.join(" + ")} hide its button`:""}: where they hide the "Open record" button, the record open override may stop working; the button must stay shown`,v,!0)}for(const{key:e,el:n}of d)for(const t of Array.from(n.getElementsByTagName("*"))){if(!Oe.has(t.tagName)||A(t).some(o=>o.tagName==="Menu"))continue;const a=t.getAttribute("Id")??"";if(re(t.getAttribute("PopulateDynamically"))){t.getAttribute("PopulateQueryCommand")?.trim()||i("menu-missing",e,`${t.tagName} ${a} is populated dynamically but has no PopulateQueryCommand — its drop-down may stay empty`,a,!0);continue}i("menu-missing",e,`${t.tagName} ${a} has no <Menu> — it would publish as an empty drop-down`,a)}const D=new Set(l.menuControlsIds??[]);for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=t.endsWith("._children")&&D.has(t.slice(0,-10));for(const o of Array.from(n.getElementsByTagName("*"))){const r=a||!!o.parentElement?.closest("Menu");for(const c of Te){const y=o.getAttribute(c);if(!y?.startsWith("$LocLabels:"))continue;const h=y.slice(11);h.length<=V||i("label-id-length",e,`${o.tagName} ${o.getAttribute("Id")??""} uses label ${h} (${h.length} characters)`+(r?`: a menu item's label id may have at most ${V} characters, or the publish fails after the import — give the control a shorter id`:`: label ids over ${V} characters fail inside menus; consider a shorter control id`),o.getAttribute("Id")??void 0,!r)}}}if(l.known?.commandIds){const e=new Set([...g.commandDefinitions.keys(),...l.known.commandIds]);for(const{key:n,el:t}of d)for(const a of Array.from(t.getElementsByTagName("*")))if(!Q.has(a.tagName))for(const o of["Command","PopulateQueryCommand"]){const r=a.getAttribute(o);if(!r||e.has(r))continue;const c=a.getAttribute("Id")??"";i("undefined-command",n,`${a.tagName} ${c} uses ${o==="Command"?"command":"PopulateQueryCommand"} ${r}, which is defined neither in the customizations nor in the loaded ribbon`,c,Z(r))}}const I={EnableRule:l.known?.enableRuleIds?new Set([...g.enableRules.keys(),...l.known.enableRuleIds]):null,DisplayRule:l.known?.displayRuleIds?new Set([...g.displayRules.keys(),...l.known.displayRuleIds]):null};for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=A(n).filter(o=>o.tagName==="EnableRules"||o.tagName==="DisplayRules").flatMap(A);for(const o of a){const r=I[o.tagName],c=o.getAttribute("Id");!r||!c||r.has(c)||i("undefined-rule",e,`Command ${t} uses ${o.tagName==="EnableRule"?"enable":"display"} rule ${c}, which is defined neither in the customizations nor in the loaded ribbon`,t,Z(c))}}for(const{part:e,key:n,el:t}of u){if(e!=="enableRules"&&e!=="displayRules")continue;const a=e==="enableRules"?"enable":"display",o=t.getAttribute("Id")??"",r=A(t).flatMap(c=>c.tagName==="OrRule"?A(c).filter(y=>y.tagName==="Or").flatMap(A):[c]);for(const c of r)te(c.tagName,a)&&i("rule-placement",n,`${a==="enable"?"Enable":"Display"} rule ${o} contains ${c.tagName}, which the ribbon schema only allows in ${a==="enable"?"display":"enable"} rules`,o,!0)}const T=new Set;for(const e of Object.values(l.loadedAttributes??{}))for(const n of Object.values(e))K.test(n)&&T.add(n);for(const{key:e,el:n}of u)if(n.tagName!=="LocLabel")for(const t of N(n))for(const a of Array.from(t.attributes)){const o=K.exec(a.value)?.[1];if(!o||g.locLabels.has(o))continue;const r=t.getAttribute("Id")??void 0;r&&l.loadedAttributes?.[r]?.[a.name]===a.value||T.has(a.value)||i("loclabel-missing",e,`${[t.tagName,r,a.name].filter(Boolean).join(" ")} references $LocLabels:${o}, which has no <LocLabel> in these customizations — the text won't resolve unless another solution defines the label`,r,!0)}const w=new Map;for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=n.getAttribute("Sequence");if(n.tagName!=="CustomAction"||!t.endsWith("._children")||!a)continue;const o=`${t}|${a}`;w.set(o,[...w.get(o)??[],{key:e,id:n.getAttribute("Id")??e}])}for(const[e,n]of w){if(n.length<2||!n.some(o=>p(o.key)))continue;const[t,a]=e.split("|");i("duplicate-sequence",n.map(o=>o.key),`${n.map(o=>o.id).join(" and ")} have the same Sequence (${a}) in ${t} — their order isn't defined; give one another Sequence`,n[0].id,!0)}for(const{key:e,el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){if(a.name!=="Library"&&!J.has(a.name))continue;const o=/^\/?WebResources\/(.+)$/i.exec(a.value.trim())?.[1];o&&i("webresource-path",e,`${t.tagName} ${t.getAttribute("Id")??""} ${a.name} is the path ${a.value} — use $webresource:${o}, the only form that makes the solution depend on the web resource`.replace(/\s+/g," "),t.getAttribute("Id")??void 0,!0)}if(l.webResources){const e=new Set;for(const{el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){const o=ne.exec(a.value.trim())?.[1],r=o?.toLowerCase();if(!o||!r||oe.has(r)||e.has(r))continue;const c=l.webResources[r];if(!c)continue;const y=t.getAttribute("Id")??void 0;c.exists?!c.inSolution&&!c.managed&&(e.add(r),f.push({severity:"warning",code:"webresource-not-in-solution",message:`Web resource ${o} isn't in the selected solution — the ribbon won't import into another environment without it`,elementId:y})):(e.add(r),f.push({severity:"warning",code:"webresource-missing",message:`Web resource ${o} (${t.tagName} ${a.name}) doesn't exist in this environment — ${J.has(a.name)?"the button will show no icon":"the action or rule that loads it will fail when it runs"}`,elementId:y}))}}const C=new Map,L=e=>{let n=C.get(e);return n||C.set(e,n=new Map),n};for(const[e,n]of Object.entries(l.tabScaling??{})){for(const t of n.maxSizes)L(e).set(t.id,{...t,tag:"MaxSize"});for(const t of n.scales)L(e).set(t.id,{...t,tag:"Scale"})}const F=new Map(Object.entries(l.groupTemplates??{}).map(([e,n])=>[e,ee(n)])),z=new Map(Object.entries(l.templateLayouts??{}));for(const{part:e,el:n}of u)if(e==="templates")for(const t of N(n).filter(a=>a.tagName==="GroupTemplate")){const a=A(t).filter(o=>o.tagName==="Layout").map(o=>o.getAttribute("Title")??"");z.set(t.getAttribute("Id")??"",a)}const x=[];for(const{key:e,el:n}of d){for(const r of Array.from(n.getElementsByTagName("Group"))){const c=r.getAttribute("Template");c&&F.set(r.getAttribute("Id")??"",ee(c))}const t=[],a=Y.exec(n.getAttribute("Location")??"")?.[1],o=A(n).find(r=>r.tagName==="CommandUIDefinition");if(a&&o)for(const r of A(o))t.push([a,r]);for(const r of Array.from(n.getElementsByTagName("Tab")))for(const c of A(r).filter(y=>y.tagName==="Scaling"))for(const y of A(c))t.push([r.getAttribute("Id")??"",y]);for(const[r,c]of t){if(c.tagName!=="MaxSize"&&c.tagName!=="Scale")continue;const y={id:c.getAttribute("Id")??"",tag:c.tagName,groupId:c.getAttribute("GroupId")??"",size:c.getAttribute("Size")??"",sequence:parseInt(c.getAttribute("Sequence")??"",10),key:e};L(r).set(y.id,y),x.push(y)}}for(const[e,n]of C){const t=new Map;for(const a of n.values())Number.isNaN(a.sequence)||t.set(a.sequence,[...t.get(a.sequence)??[],a]);for(const[a,o]of t){const r=[...new Set(o.flatMap(h=>h.key?[h.key]:[]))];if(o.length<2||r.length===0)continue;const c=o.find(h=>h.key&&h.tag==="MaxSize"&&h.id===`${h.groupId}.MaxSize`),y=c?`move group ${c.groupId} to another position (its MaxSize takes the group's Sequence; #66 picks a free one automatically)`:"give each step its own Sequence";i("scaling-collision",r,`Scaling of tab ${e}: ${o.map(h=>`${h.tag} ${h.id}`).join(" and ")} have the same Sequence ${a} — Unified Interface then drops every custom control of the table; ${y}`,o.find(h=>h.key)?.id)}}for(const e of x){const n=F.get(e.groupId),t=n?z.get(n):void 0;!t?.length||t.includes(e.size)||i("scaling-size",e.key??[],`${e.tag} ${e.id} has Size "${e.size}", which isn't a layout of template ${n} used by group ${e.groupId} (${t.join(", ")})`,e.id,!0)}const j=new Set(l.known?.elementIds??[]),M=new Map;for(const{key:e,el:n}of d){if(!(n.getAttribute("Location")??"").endsWith("._children"))continue;const t=A(n).find(o=>o.tagName==="CommandUIDefinition"),a=t?A(t)[0]:void 0;if(!(!a||a.tagName==="MaxSize"||a.tagName==="Scale"))for(const o of N(a)){const r=o.getAttribute("Id");if(!r||o.closest("Scaling"))continue;const c=M.get(r)??[];c.includes(e)||M.set(r,[...c,e])}}for(const[e,n]of M)n.length>1?i("duplicate-id",n,`Id ${e} is added by more than one CustomAction (${n.map(t=>t.replace(/^customActions:ca:/,"")).join(", ")})`,e):m.has(n[0])&&j.has(e)&&i("duplicate-id",n,`Id ${e} is added as a new element, but the ribbon already has an element with this id`,e);if(l.places){const{entityLogicalName:e,tabByCollection:n}=l.places,t=new Set(["Mscrm.Tabs",`Mscrm.SubGrid.${e}.ContextualTabs`]);for(const{key:a,el:o}of d){const r=o.getAttribute("Location")??"",c=/^(.+)\._children$/.exec(r)?.[1];if(!c||Y.test(r)||!p(a))continue;const y=A(o).find(k=>k.tagName==="CommandUIDefinition"),h=y?A(y)[0]:void 0,P=h?.getAttribute("Id")??"";if(!h||!P||!(Pe.has(h.tagName)||Q.has(h.tagName)))continue;const B=c.split("{!EntityLogicalName}").join(e),U=n[B];if(U!==void 0){le(U)&&i("orphan-location",a,`${h.tagName} ${P} is added to ${c}, on the tab ${U}: Unified Interface doesn't show that tab and the ribbon doesn't return what is added there, so it won't show anywhere — add it to the table's main tab instead`,P,!0);continue}const G=k=>k.replace(/\.(Controls|Groups)$/,"");t.has(B)||[c,B,G(c),G(B)].some(k=>M.has(k))||i("orphan-location",a,`${h.tagName} ${P} is added at ${r}, but this table's ribbon has no ${c} — it won't show anywhere (check the Location, or move it to an existing group)`,P,!0)}}const _=l.publisherPrefix?.trim().toLowerCase();if(_&&m.size>0){const e=new Set([...j,...l.known?.commandIds??[],...l.known?.enableRuleIds??[],...l.known?.displayRuleIds??[]]),n=o=>{const r=o.split(".");for(let c=r.length;c>0;c--)if(e.has(r.slice(0,c).join(".")))return!0;return!1},t=o=>{const r=o.toLowerCase();return r.startsWith(`${_}.`)||r.startsWith(`${_}_`)},a=new Set;for(const{part:o,key:r,el:c}of u)if(!(!m.has(r)||o==="templates"||o==="tabDisplayRules"))for(const y of N(c)){if(y!==c&&y.closest("Actions, EnableRules, DisplayRules, EnableRule, DisplayRule"))continue;const h=y.getAttribute("Id")??y.getAttribute("HideActionId");!h||a.has(h)||t(h)||n(h)||(a.add(h),f.push({severity:"warning",code:"id-prefix",message:`${y.tagName} id ${h} doesn't start with the publisher prefix "${_}." — ids without it can collide with other solutions`,elementId:h}))}}return f}export{_e as a,qe as v,Be as w};
|
|
3
|
+
`)}),b.querySelectorAll("Group").forEach(i=>{const d=[];i.querySelectorAll(":scope > Controls > Button, :scope > Controls > FlyoutAnchor, :scope > Controls > SplitButton").forEach(R=>{const $=parseInt(R.getAttribute("Sequence")??"0",10);if(d.includes($)){const S=i.getAttribute("Id")??"?";u.push({message:`Two elements share Sequence "${$}" in group "${S}"`,elementId:S,lineHint:E(s,`Sequence="${$}"`)})}d.push($)})}),u.push(...Ee(b,s)),u}const X=new Set(["BoolParameter","CrmParameter","DecimalParameter","IntParameter","StringParameter"]);function A(s){return Array.from(s.children)}function te(s,l){return l==="enable"?ue.has(s):me.has(s)}function Ee(s,l){const g=[],u=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i)}),f=(m,i,d)=>g.push({message:m,elementId:d,lineHint:E(l,i),severity:"warning"}),b=s.querySelector("RibbonDiffXml > RuleDefinitions"),p=[{tag:"EnableRule",label:"Enable",container:"enable"},{tag:"DisplayRule",label:"Display",container:"display"}];for(const{tag:m,label:i,container:d}of p)b?.querySelectorAll(`:scope > ${m}s > ${m}`).forEach(R=>{const $=R.getAttribute("Id")??"",S=A(R);S.length===0&&u(`${i} rule "${$}" has no steps — the schema requires at least one`,`Id="${$}"`,$);const D=I=>{te(I.tagName,d)&&f(`${i} rule "${$}" contains ${I.tagName}, which RibbonTypes.xsd only allows in ${d==="enable"?"display":"enable"} rules`,`<${I.tagName}`,$)};for(const I of S){if(I.tagName!=="OrRule"){D(I);continue}const T=A(I);T.filter(w=>w.tagName==="Or").length<2&&u(`OrRule in ${i.toLowerCase()} rule "${$}" needs at least 2 <Or> children (found ${T.filter(w=>w.tagName==="Or").length})`,"<OrRule",$);for(const w of T){const C=A(w);C.length===0&&u(`Empty <Or> in rule "${$}"`,"<Or",$);for(const L of C)L.tagName==="OrRule"?u(`Rule "${$}": an <Or> cannot contain another OrRule`,"<OrRule",$):D(L)}}});return b||s.querySelectorAll("OrRule").forEach(m=>{const i=m.querySelectorAll(":scope > Or").length;i<2&&u(`OrRule requires at least 2 <Or> children (found ${i})`,"<OrRule")}),s.querySelectorAll("JavaScriptFunction, CustomRule").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.hasAttribute("Name")&&u(`${i.tagName} inside <${m.tagName}> must not have a Name attribute (only <Url> parameters are named)`,`<${i.tagName} Name=`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!de.has(d)&&u(`CrmParameter Value "${d}" is not a valid CrmParameterValue`,`Value="${d}"`)}}),s.querySelectorAll("Url").forEach(m=>{for(const i of A(m)){if(!X.has(i.tagName))continue;i.getAttribute("Name")||u(`${i.tagName} inside <Url> requires a Name (the query-string key)`,`<${i.tagName}`);const d=i.getAttribute("Value")??"";i.tagName==="CrmParameter"&&!fe(d)&&u(`CrmParameter Value "${d}" is not allowed in a <Url> action (CrmNamedParameterValue)`,`Value="${d}"`)}}),s.querySelector("RibbonDiffXml > Scalings")&&u('<Scalings> is not allowed in RibbonDiffXml — scaling changes are CustomActions with Location="{tabId}.Scaling._children"',"<Scalings"),s.querySelectorAll("CustomAction > CommandUIDefinition > Tab").forEach(m=>{const i=m.getAttribute("Id")??"",d=A(m).map(S=>S.tagName),R=d.indexOf("Scaling"),$=d.indexOf("Groups");(R<0||$>=0&&R>$)&&u(`Tab "${i}" needs a <Scaling Id> element before <Groups>`,`Id="${i}"`,i)}),s.querySelectorAll("TabDisplayRule > DisplayRules").forEach(()=>{u("TabDisplayRule rules must be direct children — remove the <DisplayRules> wrapper","<TabDisplayRule")}),g}const Te=["LabelText","ToolTipTitle","ToolTipDescription","Alt","Title","Description"],Ce=new Set(["powerFx","customApi"]),Le={powerFx:"Power Fx",customApi:"Custom API"};function ve(s){return[...new Set(s.actions.map(l=>l.kind).filter(l=>Ce.has(l)))]}const K=/^\$LocLabels:(.+)$/,ne=/^\$webresource:([^?#]+)/i,J=new Set(["ModernImage","Image16by16","Image32by32"]),Q=new Set(["Tab","Group"]),oe=new Set(["main_system_library.js"]),Oe=new Set(["FlyoutAnchor","SplitButton"]),Pe=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),Y=/^(.+)\.Scaling\._children$/,Z=s=>/^(Mscrm|Microsoft)\./.test(s);function ae(s){const l=[],g=[],u=new DOMParser;for(const f of Object.keys(s))for(const[b,p]of s[f]){const m=u.parseFromString(p,"application/xml");if(m.querySelector("parsererror")){g.push({severity:"error",code:"xml-parse",message:`${f} element ${b} is not well-formed XML`,elementId:b});continue}l.push({part:f,key:`${f}:${b}`,el:m.documentElement})}return{elements:l,errors:g}}function N(s){return[s,...Array.from(s.getElementsByTagName("*"))]}function se(s){return typeof s=="string"?ce(s):s}function Be(s){let l;try{l=se(s)}catch{return[]}const g=new Map;for(const{el:u}of ae(l).elements)for(const f of N(u))for(const b of Array.from(f.attributes)){const p=ne.exec(b.value.trim())?.[1],m=p?.toLowerCase();p&&m&&!oe.has(m)&&!g.has(m)&&g.set(m,p)}return[...g.values()]}const ee=s=>{const l=s.trim();return l&&!l.includes(".")?`Mscrm.Templates.${l}`:l};function qe(s,l={}){let g;try{g=se(s)}catch(e){return[{severity:"error",code:"xml-parse",message:e instanceof Error?e.message:String(e)}]}const{elements:u,errors:f}=ae(g),b=l.changedKeys?new Set(l.changedKeys):null,p=e=>!b||b.has(e),m=new Set(l.newKeys??[]),i=(e,n,t,a,o=!1)=>{const r=(Array.isArray(n)?n:[n]).some(p);f.push({severity:o||!r?"warning":"error",code:e,message:r?t:`${t} (already in the published customizations)`,elementId:a})},d=u.filter(e=>e.part==="customActions"),R=u.filter(e=>e.part==="commandDefinitions");for(const{part:e,key:n,el:t}of u)if(!(e!=="commandDefinitions"&&e!=="enableRules"&&e!=="displayRules"))for(const a of we(t))i("schema",n,a,t.getAttribute("Id")??void 0);const $=new Map((l.commands??[]).map(e=>[e.id,e]));for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=$.get(t);if(!a||!p(e))continue;const o=ve(a);o.length!==0&&i("dropped-action",e,`Command ${t} has a ${o.map(r=>Le[r]??r).join(" / ")} action — classic ribbon commands can't run it, so it would be dropped; remove the action`,t)}const S=new Set;for(const{el:e}of d)if(e.tagName==="CustomAction")for(const n of Array.from(e.getElementsByTagName("*")))n.getAttribute("Command")===v&&S.add(n.getAttribute("Id")??"");for(const{key:e,el:n}of d){if(n.tagName!=="HideCustomAction")continue;const t=n.getAttribute("Location")??"";!S.has(t)&&!ie({id:t,commandId:v})||i("open-record-hidden",e,`${t} is hidden, but it carries the record open override (${v}) — Unified Interface may then open records as usual or fail to open them; unhide it, or turn the override off`,t,!0)}for(const{key:e,el:n}of R){if(n.getAttribute("Id")!==v)continue;const t=A(n).filter(o=>o.tagName==="DisplayRules").flatMap(o=>A(o).map(r=>r.getAttribute("Id")??r.tagName));if(t.length===0)continue;const a=t.includes("Mscrm.HideOnModern")?Ne.filter(o=>t.includes(o)):[];i("open-record-hidden",e,`${v} has display rules (${t.join(", ")})${a.length>0?` — ${a.join(" + ")} hide its button`:""}: where they hide the "Open record" button, the record open override may stop working; the button must stay shown`,v,!0)}for(const{key:e,el:n}of d)for(const t of Array.from(n.getElementsByTagName("*"))){if(!Oe.has(t.tagName)||A(t).some(o=>o.tagName==="Menu"))continue;const a=t.getAttribute("Id")??"";if(re(t.getAttribute("PopulateDynamically"))){t.getAttribute("PopulateQueryCommand")?.trim()||i("menu-missing",e,`${t.tagName} ${a} is populated dynamically but has no PopulateQueryCommand — its drop-down may stay empty`,a,!0);continue}i("menu-missing",e,`${t.tagName} ${a} has no <Menu> — it would publish as an empty drop-down`,a)}const D=new Set(l.menuControlsIds??[]);for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=t.endsWith("._children")&&D.has(t.slice(0,-10));for(const o of Array.from(n.getElementsByTagName("*"))){const r=a||!!o.parentElement?.closest("Menu");for(const c of Te){const y=o.getAttribute(c);if(!y?.startsWith("$LocLabels:"))continue;const h=y.slice(11);h.length<=V||i("label-id-length",e,`${o.tagName} ${o.getAttribute("Id")??""} uses label ${h} (${h.length} characters)`+(r?`: a menu item's label id may have at most ${V} characters, or the publish fails after the import — give the control a shorter id`:`: label ids over ${V} characters fail inside menus; consider a shorter control id`),o.getAttribute("Id")??void 0,!r)}}}if(l.known?.commandIds){const e=new Set([...g.commandDefinitions.keys(),...l.known.commandIds]);for(const{key:n,el:t}of d)for(const a of Array.from(t.getElementsByTagName("*")))if(!Q.has(a.tagName))for(const o of["Command","PopulateQueryCommand"]){const r=a.getAttribute(o);if(!r||e.has(r))continue;const c=a.getAttribute("Id")??"";i("undefined-command",n,`${a.tagName} ${c} uses ${o==="Command"?"command":"PopulateQueryCommand"} ${r}, which is defined neither in the customizations nor in the loaded ribbon`,c,Z(r))}}const I={EnableRule:l.known?.enableRuleIds?new Set([...g.enableRules.keys(),...l.known.enableRuleIds]):null,DisplayRule:l.known?.displayRuleIds?new Set([...g.displayRules.keys(),...l.known.displayRuleIds]):null};for(const{key:e,el:n}of R){const t=n.getAttribute("Id")??"",a=A(n).filter(o=>o.tagName==="EnableRules"||o.tagName==="DisplayRules").flatMap(A);for(const o of a){const r=I[o.tagName],c=o.getAttribute("Id");!r||!c||r.has(c)||i("undefined-rule",e,`Command ${t} uses ${o.tagName==="EnableRule"?"enable":"display"} rule ${c}, which is defined neither in the customizations nor in the loaded ribbon`,t,Z(c))}}for(const{part:e,key:n,el:t}of u){if(e!=="enableRules"&&e!=="displayRules")continue;const a=e==="enableRules"?"enable":"display",o=t.getAttribute("Id")??"",r=A(t).flatMap(c=>c.tagName==="OrRule"?A(c).filter(y=>y.tagName==="Or").flatMap(A):[c]);for(const c of r)te(c.tagName,a)&&i("rule-placement",n,`${a==="enable"?"Enable":"Display"} rule ${o} contains ${c.tagName}, which the ribbon schema only allows in ${a==="enable"?"display":"enable"} rules`,o,!0)}const T=new Set;for(const e of Object.values(l.loadedAttributes??{}))for(const n of Object.values(e))K.test(n)&&T.add(n);for(const{key:e,el:n}of u)if(n.tagName!=="LocLabel")for(const t of N(n))for(const a of Array.from(t.attributes)){const o=K.exec(a.value)?.[1];if(!o||g.locLabels.has(o))continue;const r=t.getAttribute("Id")??void 0;r&&l.loadedAttributes?.[r]?.[a.name]===a.value||T.has(a.value)||i("loclabel-missing",e,`${[t.tagName,r,a.name].filter(Boolean).join(" ")} references $LocLabels:${o}, which has no <LocLabel> in these customizations — the text won't resolve unless another solution defines the label`,r,!0)}const w=new Map;for(const{key:e,el:n}of d){const t=n.getAttribute("Location")??"",a=n.getAttribute("Sequence");if(n.tagName!=="CustomAction"||!t.endsWith("._children")||!a)continue;const o=`${t}|${a}`;w.set(o,[...w.get(o)??[],{key:e,id:n.getAttribute("Id")??e}])}for(const[e,n]of w){if(n.length<2||!n.some(o=>p(o.key)))continue;const[t,a]=e.split("|");i("duplicate-sequence",n.map(o=>o.key),`${n.map(o=>o.id).join(" and ")} have the same Sequence (${a}) in ${t} — their order isn't defined; give one another Sequence`,n[0].id,!0)}for(const{key:e,el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){if(a.name!=="Library"&&!J.has(a.name))continue;const o=/^\/?WebResources\/(.+)$/i.exec(a.value.trim())?.[1];o&&i("webresource-path",e,`${t.tagName} ${t.getAttribute("Id")??""} ${a.name} is the path ${a.value} — use $webresource:${o}, the only form that makes the solution depend on the web resource`.replace(/\s+/g," "),t.getAttribute("Id")??void 0,!0)}if(l.webResources){const e=new Set;for(const{el:n}of u)for(const t of N(n))for(const a of Array.from(t.attributes)){const o=ne.exec(a.value.trim())?.[1],r=o?.toLowerCase();if(!o||!r||oe.has(r)||e.has(r))continue;const c=l.webResources[r];if(!c)continue;const y=t.getAttribute("Id")??void 0;c.exists?!c.inSolution&&!c.managed&&(e.add(r),f.push({severity:"warning",code:"webresource-not-in-solution",message:`Web resource ${o} isn't in the selected solution — the ribbon won't import into another environment without it`,elementId:y})):(e.add(r),f.push({severity:"warning",code:"webresource-missing",message:`Web resource ${o} (${t.tagName} ${a.name}) doesn't exist in this environment — ${J.has(a.name)?"the button will show no icon":"the action or rule that loads it will fail when it runs"}`,elementId:y}))}}const C=new Map,L=e=>{let n=C.get(e);return n||C.set(e,n=new Map),n};for(const[e,n]of Object.entries(l.tabScaling??{})){for(const t of n.maxSizes)L(e).set(t.id,{...t,tag:"MaxSize"});for(const t of n.scales)L(e).set(t.id,{...t,tag:"Scale"})}const F=new Map(Object.entries(l.groupTemplates??{}).map(([e,n])=>[e,ee(n)])),z=new Map(Object.entries(l.templateLayouts??{}));for(const{part:e,el:n}of u)if(e==="templates")for(const t of N(n).filter(a=>a.tagName==="GroupTemplate")){const a=A(t).filter(o=>o.tagName==="Layout").map(o=>o.getAttribute("Title")??"");z.set(t.getAttribute("Id")??"",a)}const j=[];for(const{key:e,el:n}of d){for(const r of Array.from(n.getElementsByTagName("Group"))){const c=r.getAttribute("Template");c&&F.set(r.getAttribute("Id")??"",ee(c))}const t=[],a=Y.exec(n.getAttribute("Location")??"")?.[1],o=A(n).find(r=>r.tagName==="CommandUIDefinition");if(a&&o)for(const r of A(o))t.push([a,r]);for(const r of Array.from(n.getElementsByTagName("Tab")))for(const c of A(r).filter(y=>y.tagName==="Scaling"))for(const y of A(c))t.push([r.getAttribute("Id")??"",y]);for(const[r,c]of t){if(c.tagName!=="MaxSize"&&c.tagName!=="Scale")continue;const y={id:c.getAttribute("Id")??"",tag:c.tagName,groupId:c.getAttribute("GroupId")??"",size:c.getAttribute("Size")??"",sequence:parseInt(c.getAttribute("Sequence")??"",10),key:e};L(r).set(y.id,y),j.push(y)}}for(const[e,n]of C){const t=new Map;for(const a of n.values())Number.isNaN(a.sequence)||t.set(a.sequence,[...t.get(a.sequence)??[],a]);for(const[a,o]of t){const r=[...new Set(o.flatMap(h=>h.key?[h.key]:[]))];if(o.length<2||r.length===0)continue;const c=o.find(h=>h.key&&h.tag==="MaxSize"&&h.id===`${h.groupId}.MaxSize`),y=c?`move group ${c.groupId} to another position (its MaxSize takes the group's Sequence; #66 picks a free one automatically)`:"give each step its own Sequence";i("scaling-collision",r,`Scaling of tab ${e}: ${o.map(h=>`${h.tag} ${h.id}`).join(" and ")} have the same Sequence ${a} — Unified Interface then drops every custom control of the table; ${y}`,o.find(h=>h.key)?.id)}}for(const e of j){const n=F.get(e.groupId),t=n?z.get(n):void 0;!t?.length||t.includes(e.size)||i("scaling-size",e.key??[],`${e.tag} ${e.id} has Size "${e.size}", which isn't a layout of template ${n} used by group ${e.groupId} (${t.join(", ")})`,e.id,!0)}const x=new Set(l.known?.elementIds??[]),M=new Map;for(const{key:e,el:n}of d){if(!(n.getAttribute("Location")??"").endsWith("._children"))continue;const t=A(n).find(o=>o.tagName==="CommandUIDefinition"),a=t?A(t)[0]:void 0;if(!(!a||a.tagName==="MaxSize"||a.tagName==="Scale"))for(const o of N(a)){const r=o.getAttribute("Id");if(!r||o.closest("Scaling"))continue;const c=M.get(r)??[];c.includes(e)||M.set(r,[...c,e])}}for(const[e,n]of M)n.length>1?i("duplicate-id",n,`Id ${e} is added by more than one CustomAction (${n.map(t=>t.replace(/^customActions:ca:/,"")).join(", ")})`,e):m.has(n[0])&&x.has(e)&&i("duplicate-id",n,`Id ${e} is added as a new element, but the ribbon already has an element with this id`,e);if(l.places){const{entityLogicalName:e,tabByCollection:n}=l.places,t=new Set(["Mscrm.Tabs",`Mscrm.SubGrid.${e}.ContextualTabs`]);for(const{key:a,el:o}of d){const r=o.getAttribute("Location")??"",c=/^(.+)\._children$/.exec(r)?.[1];if(!c||Y.test(r)||!p(a))continue;const y=A(o).find(k=>k.tagName==="CommandUIDefinition"),h=y?A(y)[0]:void 0,P=h?.getAttribute("Id")??"";if(!h||!P||!(Pe.has(h.tagName)||Q.has(h.tagName)))continue;const B=c.split("{!EntityLogicalName}").join(e),U=n[B];if(U!==void 0){le(U)&&i("orphan-location",a,`${h.tagName} ${P} is added to ${c}, on the tab ${U}: Unified Interface doesn't show that tab and the ribbon doesn't return what is added there, so it won't show anywhere — add it to the table's main tab instead`,P,!0);continue}const G=k=>k.replace(/\.(Controls|Groups)$/,"");t.has(B)||[c,B,G(c),G(B)].some(k=>M.has(k))||i("orphan-location",a,`${h.tagName} ${P} is added at ${r}, but this table's ribbon has no ${c} — it won't show anywhere (check the Location, or move it to an existing group)`,P,!0)}}const _=l.publisherPrefix?.trim().toLowerCase();if(_&&m.size>0){const e=new Set([...x,...l.known?.commandIds??[],...l.known?.enableRuleIds??[],...l.known?.displayRuleIds??[]]),n=o=>{const r=o.split(".");for(let c=r.length;c>0;c--)if(e.has(r.slice(0,c).join(".")))return!0;return!1},t=o=>{const r=o.toLowerCase();return r.startsWith(`${_}.`)||r.startsWith(`${_}_`)},a=new Set;for(const{part:o,key:r,el:c}of u)if(!(!m.has(r)||o==="templates"||o==="tabDisplayRules"))for(const y of N(c)){if(y!==c&&y.closest("Actions, EnableRules, DisplayRules, EnableRule, DisplayRule"))continue;const h=y.getAttribute("Id")??y.getAttribute("HideActionId");!h||a.has(h)||t(h)||n(h)||(a.add(h),f.push({severity:"warning",code:"id-prefix",message:`${y.tagName} id ${h} doesn't start with the publisher prefix "${_}." — ids without it can collide with other solutions`,elementId:h}))}}return f}export{_e as a,qe as v,Be as w};
|
package/dist/icons/icon.svg
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="4 8 56 48" width="56" height="48">
|
|
2
|
-
<!-- Variant
|
|
3
|
-
Same chassis
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<!-- Variant L — "Insider build" / CBS
|
|
3
|
+
Same K chassis + a two-tone gold triangle in the top-right vertex of
|
|
4
|
+
the hex (#CC8A00 / #F2A100, the cross-tool B2 stamp, #236). Shipped for
|
|
5
|
+
prerelease versions (e.g. 0.6.0-beta.1); see the tool-icon plugin in
|
|
6
|
+
vite.config.ts. -->
|
|
6
7
|
|
|
7
8
|
<path d="M 18 8 L 46 8 L 60 32 L 46 56 L 18 56 L 4 32 Z" fill="#0E5A9C"/>
|
|
8
9
|
<polygon points="46,8 60,32 46,56 18,56" fill="#2B8FD9"/>
|
|
9
10
|
|
|
11
|
+
<!-- Insider stamp: flush with the top and right edges (the right point lies on the edge,
|
|
12
|
+
46 + 14t, 8 + 24t with t = 0.375), split on the blue's diagonal (46,8 to 18,56),
|
|
13
|
+
which crosses the stamp's long side at 43.58,12.15: dark left, light right like the blue -->
|
|
14
|
+
<polygon points="37,8 46,8 43.58,12.15" fill="#CC8A00"/>
|
|
15
|
+
<polygon points="46,8 51.25,17 43.58,12.15" fill="#F2A100"/>
|
|
16
|
+
|
|
10
17
|
<!-- Tool glyph — command bar with three buttons, in white -->
|
|
11
18
|
<rect x="14" y="23" width="36" height="18" rx="3.5" stroke="#fff" stroke-width="2.5" fill="none"/>
|
|
12
19
|
<rect x="19" y="28.5" width="7" height="7" rx="1.5" fill="#fff"/>
|
package/dist/index.html
CHANGED
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Command Bar Studio</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
9
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
11
|
-
<link rel="
|
|
12
|
-
<link rel="stylesheet" crossorigin href="./assets/monaco-DdLsZAcA.css">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="./assets/index-D9lerlVA.css">
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-DRTwBo4g.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="./assets/fluent-ui-CQyNN9H3.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="./assets/preload-helper-PPVm8Dsz.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/dnd-iy5K5XAJ.js">
|
|
11
|
+
<link rel="stylesheet" crossorigin href="./assets/index-D5GCH8nj.css">
|
|
14
12
|
</head>
|
|
15
13
|
<body>
|
|
16
14
|
<div id="root">
|
|
17
|
-
<p
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
<p
|
|
16
|
+
style="
|
|
17
|
+
font-family: "Segoe UI", system-ui, sans-serif;
|
|
18
|
+
padding: 24px;
|
|
19
|
+
max-width: 720px;
|
|
20
|
+
"
|
|
21
|
+
>
|
|
22
|
+
Loading Command Bar Studio… If this message stays, the tool couldn't start: use
|
|
23
|
+
Power Platform ToolBox 1.2.7 or later (desktop app or VS Code extension), and report
|
|
24
|
+
it at github.com/mohsinonxrm/pptb-mxrm-commandbar-studio/issues.
|
|
21
25
|
</p>
|
|
22
26
|
</div>
|
|
23
27
|
</body>
|
package/index.html
CHANGED
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
</head>
|
|
8
8
|
<body>
|
|
9
9
|
<div id="root">
|
|
10
|
-
<p
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
<p
|
|
11
|
+
style="
|
|
12
|
+
font-family: "Segoe UI", system-ui, sans-serif;
|
|
13
|
+
padding: 24px;
|
|
14
|
+
max-width: 720px;
|
|
15
|
+
"
|
|
16
|
+
>
|
|
17
|
+
Loading Command Bar Studio… If this message stays, the tool couldn't start: use
|
|
18
|
+
Power Platform ToolBox 1.2.7 or later (desktop app or VS Code extension), and report
|
|
19
|
+
it at github.com/mohsinonxrm/pptb-mxrm-commandbar-studio/issues.
|
|
14
20
|
</p>
|
|
15
21
|
</div>
|
|
16
22
|
<script type="module" src="/src/main.tsx"></script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohsinonxrm/pptb-commandbar-studio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-beta.2",
|
|
4
4
|
"displayName": "Command Bar Studio",
|
|
5
5
|
"description": "Visual designer for Dataverse classic ribbon / command bar customizations — the spiritual successor to Ribbon Workbench, built for Power Platform ToolBox",
|
|
6
6
|
"author": "Mohsin On xRM",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"lint": "eslint . --max-warnings 0",
|
|
68
68
|
"test": "vitest run",
|
|
69
69
|
"test:watch": "vitest",
|
|
70
|
+
"test:coverage": "vitest run --coverage",
|
|
70
71
|
"validate": "pptb-validate",
|
|
71
72
|
"format": "prettier --write .",
|
|
72
73
|
"format:check": "prettier --check .",
|
|
@@ -93,6 +94,7 @@
|
|
|
93
94
|
"@types/react": "^18.3.21",
|
|
94
95
|
"@types/react-dom": "^18.3.5",
|
|
95
96
|
"@vitejs/plugin-react": "^5.2.0",
|
|
97
|
+
"@vitest/coverage-v8": "^5.0.3",
|
|
96
98
|
"eslint": "^9.25.0",
|
|
97
99
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
98
100
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{y as n,z as Pn}from"./fluent-icons-BqJj6rDi.js";import{p as je,m as Yn,g as Jn,n as Oe,o as Zn,q as Qn,r as es,t as ns,v as ss,x as Ke,y as ts,z as os,A as is,B as as,d as Se,D as rs,F as ls,G as cs,H as bn,I as ds,J as us,K as Xe,L as hs,M as ms,N as X,O as Nn,k as _e,P as Ie,Q as ps,R as bs,S as fn,T as fs,U as Ve,V as gs,W as gn,X as ys,Y as Dn,Z as K,_ as An,$ as ws,a0 as Fe,a1 as xs,a as Be,u as D,a2 as Cs,a3 as vs,a4 as js,a5 as yn}from"./index-Di2_5czx.js";import{a as A,R as se}from"./monaco-BIO15LCS.js";import{w as Rs,v as En}from"./xmlValidator-BkeotXuB.js";import{M as U,f as O,ae as Ss,b as F,B as Tn,F as Re,I as Ln,t as E,D as Is,i as $s,j as ks,k as Ps,l as Ns,a5 as Ds,ao as As,O as wn,an as Es,a1 as Ts,a6 as Ls,d as qe,ap as zs,m as Ms}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";import"./ruleKinds-B9hACGaq.js";import"./crmParameters-rgfZhhzN.js";let xn=0;async function He(e){const t=typeof window<"u"?window.toolboxAPI:void 0;xn++===0&&await Cn(()=>t?.preventClose?.());try{return await e()}finally{--xn===0&&await Cn(()=>t?.releasePreventClose?.())}}const Us=2e3;async function Cn(e){let t;try{await Promise.race([e(),new Promise(o=>t=setTimeout(o,Us))])}catch{}finally{clearTimeout(t)}}function me(e,t){const o=e.match(new RegExp(`\\s${t}="([^"]*)"`));return o?o[1]:null}function vn(e,t,o){const r=e.indexOf(o,t);return e.slice(t,r===-1?void 0:r).match(/<result\s[^>]*>/g)??[]}function jn(e){const t=e.find(o=>me(o,"result")!=="success");if(t){const o=me(t,"errorcode")??"",r=me(t,"errortext")??"unknown error";return{ok:!1,message:`Dataverse rejected the ribbon (${o}): ${r}`}}return null}function Os(e,t){if(!e)return{ok:!1,message:"The import job returned no result data, so the ribbon import could not be verified."};if(t.kind==="application"){const i=e.search(/<ribbon\s[^>]*processed="true"/);return i===-1?{ok:!1,message:"Import completed, but Dataverse did not process the application ribbon."}:jn(vn(e,i,"</ribbon>"))??{ok:!0,message:"Application ribbon imported."}}const o=new Set(t.names.filter(Boolean).map(i=>i.toLowerCase())),r=/<entityRibbon\s[^>]*>/g;let a;for(;a=r.exec(e);){const i=(me(a[0],"id")??"").toLowerCase();if(o.has(i))return me(a[0],"processed")!=="true"?{ok:!1,message:`Dataverse did not process the ribbon for ${i}.`}:jn(vn(e,a.index,"</entityRibbon>"))??{ok:!0,message:`Ribbon for ${i} imported.`}}return{ok:!1,message:`Import completed, but Dataverse did not apply a ribbon for ${t.names.join(" / ")} (no entityRibbon result in the import job). Nothing was changed.`}}const J=window.dataverseAPI;async function Xs(e,t,o){return await o("The import"),J.execute({operationName:"ImportSolution",operationType:"action",parameters:{CustomizationFile:e,ImportJobId:t,OverwriteUnmanagedCustomizations:!0,PublishWorkflows:!1}})}async function Vs(e,t){await t("Publishing");const o=e.map(r=>`<entity>${X(r)}</entity>`).join("");return J.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:`<importexportxml><entities>${o}</entities></importexportxml>`}})}function Rn(e){const t=e.data?.progress;return!!(typeof t=="object"&&t!==null&&t.completed===!0||typeof e.progress=="number"&&e.progress>=100||typeof t=="number"&&t>=100||e.completedon||e.data?.completedon||e.statuscode===30)}function Bs(e){const t=e.titles.map(o=>`<Title languagecode="${o.languageCode}" description="${X(o.description)}"/>`).join("");return`<LocLabel Id="${X(e.id)}"><Titles>${t}</Titles></LocLabel>`}async function zn(e){const t=e.entity?.logicalName??"{!EntityLogicalName}",o={deletedContainerIds:e.plan.deletedContainerIds??[],movedButtons:e.plan.movedButtons??[],editedLocLabelIds:e.plan.editedLocLabelIds??[],editedTabIds:e.plan.editedTabIds??[],resequencedTabs:e.plan.resequencedTabs??[]},r=e.locLabels.filter(l=>o.editedLocLabelIds.includes(l.id)),a=e.languageCode??1033;for(const l of e.plan.renamedLabels??[]){const m=r.find(I=>I.id===l.id)??e.locLabels.find(I=>I.id===l.id),R=[{languageCode:a,description:l.text},...(m?.titles??[]).filter(I=>I.languageCode!==a)],y=r.findIndex(I=>I.id===l.id);y>=0?r[y]={id:l.id,titles:R}:r.push({id:l.id,titles:R})}let i=r.length?je(`<RibbonDiffXml><LocLabels>${r.map(Bs).join("")}</LocLabels></RibbonDiffXml>`):Yn();for(const l of e.locations){const m=Jn({current:l.current,baseline:l.baseline,commands:e.commands,enableRules:e.enableRules,displayRules:e.displayRules,locLabels:e.locLabels,entityLogicalName:t,location:l.current.location,languageCode:e.languageCode});i=Oe(i,je(m))}const d=[],u=[];for(const l of e.locations)for(const m of l.current.tabs){if(!o.editedTabIds.includes(m.id))continue;if(m.tabDisplayRules.length>0){const y=Zn(m,e.entity===null);y&&u.push(y)}const R=new Set(m.tabDisplayRules.map(y=>y.tabCommand));for(const y of l.baseline.tabs.find(I=>I.id===m.id)?.tabDisplayRules??[])R.has(y.tabCommand)||d.push(y.tabCommand)}u.length>0&&(i=Oe(i,je(`<RibbonDiffXml><RuleDefinitions><TabDisplayRules>${u.join("")}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`)));const f=[...e.commands.filter(l=>e.plan.editedCommandIds.includes(l.id)).map(Qn)],$={enable:e.enableRules.filter(l=>e.plan.editedEnableRuleIds.includes(l.id)).map(ns),display:e.displayRules.filter(l=>e.plan.editedDisplayRuleIds.includes(l.id)).map(es)};(f.length||$.enable.length||$.display.length)&&(i=Oe(i,je(`<RibbonDiffXml><CommandDefinitions>${f.join("")}</CommandDefinitions><RuleDefinitions><DisplayRules>${$.display.join("")}</DisplayRules><EnableRules>${$.enable.join("")}</EnableRules></RuleDefinitions></RibbonDiffXml>`)));const S=(l,m)=>{for(const R of Array.from(l.keys()))m.includes(R)||l.delete(R)},v=e.locations.flatMap(l=>l.current.tabs.filter(m=>!l.baseline.tabs.some(R=>R.id===m.id)).map(ss));S(i.commandDefinitions,[...e.plan.editedCommandIds,...v]),S(i.enableRules,e.plan.editedEnableRuleIds),S(i.displayRules,e.plan.editedDisplayRuleIds);const h=await Ke(e.entity?.logicalName??null),C=ts(h),b=e.plan.deletedButtonIds.filter(l=>!C.has(l));if(b.length>0)throw new Error(`Can't delete ${b.join(", ")}: not defined in this table's unmanaged customizations (it comes from a managed solution or the platform). Undo the delete and hide the button instead.`);const w=os(h),P=o.deletedContainerIds.filter(l=>!w.has(l));if(P.length>0)throw new Error(`Can't delete ${P.join(", ")}: not added by this table's unmanaged customizations (it comes from a managed solution or the platform). Undo the delete.`);const j=o.movedButtons.filter(l=>!C.has(l.id)).map(l=>l.id);if(j.length>0)throw new Error(`Can't move ${j.join(", ")}: not defined in this table's unmanaged customizations. Undo the move.`);const W=is(h),Z=(e.plan.uncustomisedCommandIds??[]).filter(l=>h.commandDefinitions.has(l)&&!as(l,W));if(Z.length>0)throw new Error(`Can't uncustomise ${Z.join(", ")}: it is your own command (your customizations' buttons use it and no other solution defines it), so removing it would leave those buttons without a command. Undo the uncustomise.`);const _=new Set;for(const l of e.locations)for(const m of l.current.tabs)for(const R of m.groups)for(const y of Se(R))for(const I of rs(y))_.add(I);const Q=e.plan.uncustomisedCommandIds??[],Y=new Set,ee=new Set;for(const l of e.commands)if(!(!_.has(l.id)||Q.includes(l.id))){l.enableRules.forEach(m=>Y.add(m)),l.displayRules.forEach(m=>ee.add(m));for(const m of l.rawRuleRefs??[]){const R=/^\s*<(EnableRule|DisplayRule)\b[^>]*?\sId="([^"]+)"/.exec(m.xml);R&&(R[1]==="EnableRule"?Y:ee).add(R[2])}}let k=ls(h,i,{retainedCommandIds:_,editedCommandIds:e.plan.editedCommandIds,editedEnableRuleIds:e.plan.editedEnableRuleIds,editedDisplayRuleIds:e.plan.editedDisplayRuleIds,deletedControlIds:e.plan.deletedButtonIds,unhiddenControlIds:e.plan.unhiddenButtonIds,deletedContainerIds:o.deletedContainerIds,movedControls:o.movedButtons,resequencedContainers:o.resequencedTabs,removedTabCommands:d,uncustomisedCommandIds:Q,retainedEnableRuleIds:Y,retainedDisplayRuleIds:ee});for(const l of e.plan.renamedLabels??[])l.newLabel&&(k=cs(k,l.containerId,`$LocLabels:${l.id}`));const c=new Set([...bn(h),...bn(k)].map(l=>l.id)),g={};for(const l of e.locations)for(const[m,R]of Object.entries(l.baseline.scalingByTab??{}))g[m]={maxSizes:R.maxSizes.filter(y=>!c.has(y.id)).map(y=>y.sequence),scales:R.scales.filter(y=>!c.has(y.id)).map(y=>y.sequence)};const L=ds(k,g);if(L.problems.length>0)throw new Error(`Not published: ${L.problems.join("; ")}.`);return k=L.parts,{scalingChanges:L.changes,xml:hs(k),parts:k,elementCount:Xe(k),preservedCount:Xe(h),changedCount:Xe(i),changedKeys:us(h,k),newKeys:Object.keys(k).flatMap(l=>Array.from(k[l].keys()).filter(m=>!h[l].has(m)).map(m=>`${l}:${m}`)),layerDefinitionIds:{commandIds:Array.from(h.commandDefinitions.keys()),enableRuleIds:Array.from(h.enableRules.keys()),displayRuleIds:Array.from(h.displayRules.keys())},layer:h}}function Mn(e,t){const o=[],r={},a={},i={},d={},u=new Set,f=new Set,$=new Set;for(const{current:h,baseline:C}of e.locations)for(const b of[C,h])for(const w of b.tabs)for(const P of w.groups)for(const j of Se(P))for(const W of j.menu?.sections??[])$.add(W.controlsId);for(const{current:h,baseline:C}of e.locations){Object.assign(i,C.templateLayouts);for(const b of C.tabs){o.push(b.id),b.label&&(d[b.id]={Title:b.label});for(const w of b.groups){u.add(w.id),o.push(w.id),w.label&&(d[w.id]={Title:w.label,Label:w.label});for(const P of Se(w))o.push(P.id),P.source&&(d[P.id]=P.source.attributes)}}for(const b of h.tabs)for(const w of b.groups)f.add(w.id);for(const b of[C,h])for(const w of b.tabs)for(const P of w.groups)P.template&&(a[P.id]=P.template)}const S=h=>u.has(h.groupId)&&!f.has(h.groupId);for(const{baseline:h}of e.locations)for(const[C,b]of Object.entries(h.scalingByTab??{}))r[C]={...b,maxSizes:b.maxSizes.filter(w=>!S(w)),scales:b.scales.filter(w=>!S(w))};const v=(h,C)=>{if(!h)return;const b=new Set(C??[]);return h.map(w=>w.id).filter(w=>!b.has(w))};return{changedKeys:t.changedKeys,newKeys:t.newKeys,commands:e.commands,known:{commandIds:v(e.baselineCommands,t.layerDefinitionIds?.commandIds),enableRuleIds:v(e.baselineEnableRules,t.layerDefinitionIds?.enableRuleIds),displayRuleIds:v(e.baselineDisplayRules,t.layerDefinitionIds?.displayRuleIds),elementIds:o},loadedAttributes:d,publisherPrefix:e.publisherPrefix,tabScaling:r,groupTemplates:a,templateLayouts:i,menuControlsIds:$,...e.entity?{places:{entityLogicalName:e.entity.logicalName,tabByCollection:Object.fromEntries(ms(e.locations.map(h=>h.baseline),e.entity.logicalName))}}:{}}}function qs(e,t){return new Promise((o,r)=>{const a=setTimeout(()=>r(new Error(`it didn't finish within ${Math.round(t/1e3)} s`)),t);e.then(i=>{clearTimeout(a),o(i)},i=>{clearTimeout(a),r(i)})})}async function Sn(e,t={}){const o=await zn(e),r=Mn(e,o),a=[],i=Rs(o.parts);if(t.lookupWebResources&&i.length>0)try{r.webResources=await t.lookupWebResources(i)}catch(d){a.push({severity:"warning",code:"webresource-lookup",message:`Couldn't check the ${i.length} referenced web resource(s): ${d instanceof Error?d.message:String(d)}`})}return{findings:[...En(o.parts,r),...a],xml:o.xml}}async function Fs(e,t,o={}){const r=o.attempts??3,a=o.contentKeys??[];let i={missing:[],unexpected:[],differing:[]};for(let u=0;u<r;u++){u>0&&await new Promise(f=>setTimeout(f,o.delayMs??5e3));try{i=Dn(t,await Ke(e),{contentKeys:a})}catch(f){return{ok:!1,missing:[],unexpected:[],differing:[],message:`Couldn't read the published ribbon layer to verify it (${f instanceof Error?f.message:String(f)}).`}}if(i.missing.length===0&&i.unexpected.length===0&&i.differing.length===0){const f=a.length;return{ok:!0,...i,message:"Verified: the published ribbon layer has every element that was imported"+(f>0?`, and the ${f} element(s) this publish changed have the imported content.`:".")}}}const d=u=>u.slice(0,5).join(", ")+(u.length>5?", …":"");return{ok:!1,...i,message:"The published ribbon layer doesn't match what was imported"+(i.missing.length?`; missing: ${d(i.missing)}`:"")+(i.unexpected.length?`; unexpected: ${d(i.unexpected)}`:"")+(i.differing.length?`; different content: ${d(i.differing)}`:"")+". Reload the table and check before publishing again."}}class We extends Error{constructor(t,o,r=!1){const a=r?"another solution import ran in the environment meanwhile, and what it changed may not be published yet":Un(o);super(r?`${t}'s ribbon customizations may have changed in Dataverse since you started publishing: ${a}. Importing could overwrite that change, so nothing was imported. Publish again: the table is published first, so the change is kept.`:`${t}'s ribbon customizations changed in Dataverse since you started publishing (${a}): other ribbon changes for it were published meanwhile, from another session, tool or solution import. Importing would overwrite that change, so nothing was imported. Reload the table to get the change, then publish again.`),this.scopeLabel=t,this.changes=o,this.importRan=r,this.name="RibbonLayerChangedError",this.summary=a}scopeLabel;changes;importRan;summary}function Un(e){const t=o=>o.slice(0,5).join(", ")+(o.length>5?", …":"");return[e.unexpected.length?`added: ${t(e.unexpected)}`:"",e.missing.length?`removed: ${t(e.missing)}`:"",e.differing.length?`changed: ${t(e.differing)}`:""].filter(Boolean).join("; ")}function Ws(e){const t=e instanceof Error?e.message:String(e);return/there is (?:another|a previous) \[(\w+)\] running/i.exec(t)?.[1]??null}const Ks=e=>Object.keys(e).flatMap(t=>Array.from(e[t].keys()).map(o=>`${t}:${o}`));function On(e,t){const o=[],r=[],a=[];for(const i of Object.keys(e)){for(const[d,u]of e[i]){const f=t[i].get(d);f===void 0?o.push(`${i}:${d}`):f!==u&&a.push(`${i}:${d}`)}for(const d of t[i].keys())e[i].has(d)||r.push(`${i}:${d}`)}return{missing:o,unexpected:r,differing:a}}const Xn=e=>e.missing.length+e.unexpected.length+e.differing.length>0;async function _s(e,t,o,r){const a=r.kind==="imported"?r.attempts??3:1;let i={missing:[],unexpected:[],differing:[]};for(let d=0;d<a;d++){d>0&&r.kind==="imported"&&await new Promise(f=>setTimeout(f,r.delayMs??5e3));const u=await Ke(e);if(i=r.kind==="read"?On(o,u):Dn(o,u,{contentKeys:Ks(o)}),!Xn(i))return}throw new We(t,i)}function In(e,t){return He(()=>Hs(e,t)).finally(()=>Nn({afterPublish:!0}))}async function Hs(e,t){const o=e.guard??_e(),r=Ie.getState(),a=e.entity?e.entity.logicalName:"Application ribbon",i={onProgress:t,...e.busy},d=e.entity===null;if(d&&!e.ribbonCustomizationIds?.length)throw new Error("The selected solution does not contain Application Ribbons. Add it in make.powerapps.com (Solutions → your solution → Add existing → Application Ribbons) and reload the solution.");const u=async(c="Publishing customizations…")=>{t?.(c),await gn("Publish",async()=>{d?(await o("Publishing"),await J.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:"<importexportxml><ribbons><ribbon></ribbon></ribbons></importexportxml>"}})):await Vs([e.entity.logicalName],o)},i)},f=e.languageCode??await ps(),$=async c=>{t?.(`Reading existing ribbon customizations for ${a}…`),c&&r.logInfo("publish",`Reading unmanaged ribbon layer for ${a}.`);const g=await zn({...e,languageCode:f}),L=En(g.parts,Mn({...e,publisherPrefix:e.solution.publisherPrefix},g)),l=L.filter(m=>m.severity==="error");if(c||l.length>0){r.logInfo("publish",`RibbonDiffXml for ${a}: ${g.preservedCount} existing element(s) preserved, ${g.changedCount} element(s) from this session, ${g.elementCount} total.`);for(const m of g.scalingChanges)r.logWarn("publish",gs(m));for(const m of L)m.severity==="warning"&&r.logWarn("publish",m.message)}if(l.length>0){for(const m of l)r.logError("publish",m.message);throw new Error(`The pre-publish check found ${l.length} error(s), so nothing was imported: `+l.map(m=>m.message).join("; "))}return g},S=e.publishCustomizations!==!1?await $(!1):null;t?.("Checking that no other solution operation is running…"),await bs(i);const v=await Js(e.solution);let h=!1;const C=c=>(S&&!h&&c instanceof Error&&(c.message+=` (${a} was published first, so customizations imported elsewhere for it and not yet published are now published.)`),c);if(S){r.logInfo("publish",`Publishing ${a} first, so ribbon changes imported elsewhere but not yet published are kept.`);try{await u(`Publishing ${a} first (keeps changes imported elsewhere but not published)…`)}catch(c){throw c instanceof Error&&(c.message=`Publishing ${a} first failed, so nothing was imported: ${c.message}`),c}}let b;try{b=await $(!0)}catch(c){throw S&&c instanceof Error&&!c.message.startsWith("The pre-publish check")&&(c.message=`${a}'s customizations changed when it was published first (changes imported elsewhere and not yet published): ${c.message} Reload the table to get them, then publish again.`),C(c)}if(S){const c=On(S.layer,b.layer);Xn(c)&&r.logInfo("publish",`Publishing ${a} first published ribbon changes imported elsewhere (${Un(c)}); they are kept.`)}const w=e.entity?.schemaName||e.entity?.logicalName||"",P=d?fn({applicationRibbonDiffXml:b.xml}):fn({entities:[{schemaName:w,localizedName:e.entity?.displayName||w,ribbonDiffXml:b.xml}]}),j=d?[{type:50,schemaName:":RibbonDiffXml",behavior:0}]:[{type:1,schemaName:e.entity.logicalName,behavior:2}],W=et({...e.solution,languageCode:f,rootComponents:j,details:v});t?.("Packaging solution ZIP…");const Z=fs({"customizations.xml":Ve(P),"solution.xml":Ve(W),"[Content_Types].xml":Ve('<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml"/></Types>')});let _="";for(let c=0;c<Z.length;c++)_+=String.fromCharCode(Z[c]);const Q=btoa(_),Y=async(c,g)=>{t?.(`Importing ${a} ribbon${c}…`);const L=crypto.randomUUID();r.logInfo("publish",`Importing solution${c} (import job ${L})…`);let l=!1;await gn("Import",async()=>{if(await o("Importing"),l)throw new We(a,{missing:[],unexpected:[],differing:[]},!0);await _s(e.entity?.logicalName??null,a,g.layer,g.as);try{await Xs(Q,L,o)}catch(N){throw ys(N)&&Ws(N)?.toLowerCase()==="import"&&(l=!0),N}h=!0},i);const m=150,R=2e3;let y=await J.getImportJobStatus(L),I=0;for(;!Rn(y)&&I<m;)await new Promise(N=>setTimeout(N,R)),y=await J.getImportJobStatus(L),I++,I%10===0&&t?.(`Still importing… (${I*2}s elapsed)`);if(!Rn(y))throw new Error(`Solution import did not complete within ${m*R/1e3} seconds. Check Solutions › History for import job ${L}.`);t?.("Verifying the import…");const $e=await J.retrieve("importjob",L,["data"]),B=Os($e.data,d?{kind:"application"}:{kind:"entity",names:[w,e.entity.logicalName]});if(!B.ok)throw r.logError("publish",B.message),new Error(B.message);return r.logInfo("publish",B.message),L};let ee;try{ee=await Y("",{layer:b.layer,as:{kind:"read"}})}catch(c){throw C(c)}let k;if(e.publishCustomizations!==!1){await u();{r.logInfo("publish","Refreshing Unified Interface command-bar metadata (second import of the same package)…");try{await Y(" (refreshing Unified Interface metadata)",{layer:b.parts,as:{kind:"imported",delayMs:e.verifyDelayMs}}),await u()}catch(c){if(c instanceof We)k={ok:!1,...c.changes,message:`Your changes were imported and published, but ${a}'s ribbon customizations changed in Dataverse after that (${c.summary}): other changes were published meanwhile. They weren't imported a second time to refresh Unified Interface's command-bar metadata, since that would overwrite the other change, so new or changed buttons may not appear in the app until the table's ribbon is published again. Reload the table to see the other change.`},r.logWarn("publish",k.message);else throw new Error(`Your changes were imported and published, but refreshing Unified Interface's command-bar metadata failed (${c instanceof Error?c.message:String(c)}). New or changed buttons may not appear in the app until you publish again.`)}}k||(t?.("Verifying the published ribbon…"),k=await Fs(e.entity?.logicalName??null,b.parts,{delayMs:e.verifyDelayMs,contentKeys:b.changedKeys}),k.ok?r.logInfo("publish",k.message):r.logWarn("publish",k.message))}else r.logWarn("publish","Imported without publishing. New or changed buttons appear in Unified Interface only after you publish from Command Bar Studio (which re-imports once to refresh the command-bar metadata).");return t?.(e.publishCustomizations!==!1?`${a} ribbon published.`:`${a} ribbon imported (not published).`),{elementCount:b.elementCount,preservedCount:b.preservedCount,importJobId:ee,verification:k,parts:b.parts,changedKeys:b.changedKeys}}function Gs(e,t){return He(()=>Ys(e,t)).finally(()=>Nn({afterPublish:!0}))}async function Ys(e,t){const o=t?.guard??_e(),r=Ie.getState(),a=t?.pollIntervalMs??2e3,i=t?.timeoutMs??600*1e3;e?.("Starting asynchronous publish (PublishAllXmlAsync)..."),r.logInfo("publish","Calling PublishAllXmlAsync action."),await o("Publishing");const u=(await J.execute({operationName:"PublishAllXmlAsync",operationType:"action"}))?.AsyncOperationId;if(!u)throw new Error("PublishAllXmlAsync did not return AsyncOperationId.");r.logInfo("publish",`PublishAllXmlAsync job id: ${u}`),e?.("Async publish job started. Waiting for completion...");const f=Date.now();let $=0,S;for(;Date.now()-f<i;){$+=1;const v=await J.retrieve("asyncoperation",u,["asyncoperationid","statecode","statuscode","name","message","friendlymessage","completedon"]);if(S=v.statuscode,v.statecode===3||!!v.completedon){if(typeof v.statuscode=="number"&&v.statuscode!==30){const C=v.friendlymessage||v.message||`statuscode=${v.statuscode}`;throw new Error(`Asynchronous publish failed: ${C}`)}return e?.("Asynchronous publish completed successfully."),r.logInfo("publish",`PublishAllXmlAsync completed in ${$} poll(s).`),{asyncOperationId:u,statusCode:v.statuscode}}e?.(`Waiting for async publish job... (poll ${$})`),await new Promise(C=>setTimeout(C,a))}throw new Error(`Asynchronous publish timed out after ${Math.round(i/1e3)} seconds (last status: ${S??"unknown"}).`)}const Vn=[["AddressTypeCode","addresstypecode"],["City","city"],["County","county"],["Country","country"],["Fax","fax"],["FreightTermsCode","freighttermscode"],["Latitude","latitude"],["Line1","line1"],["Line2","line2"],["Line3","line3"],["Longitude","longitude"],["Name","name"],["PostalCode","postalcode"],["PostOfficeBox","postofficebox"],["PrimaryContactName","primarycontactname"],["ShippingMethodCode","shippingmethodcode"],["StateOrProvince","stateorprovince"],["Telephone1","telephone1"],["Telephone2","telephone2"],["Telephone3","telephone3"],["UPSZone","upszone"],["UTCOffset","utcoffset"],["UTCConversionTimeZoneCode","utcconversiontimezonecode"]];async function Js(e){let t;try{t=(await J.queryData(`solutions?$select=description&$expand=publisherid&$filter=uniquename eq '${e.uniqueName.replace(/'/g,"''")}'`)).value?.[0]}catch(d){throw new Error(`Couldn't read solution ${e.uniqueName} and its publisher (${d instanceof Error?d.message:String(d)}), so nothing was imported: an import without them would clear the publisher's details.`)}const o=t?.publisherid;if(!t||!o)throw new Error(`Couldn't read solution ${e.uniqueName} and its publisher, so nothing was imported: an import without them would clear the publisher's details.`);const r=o.customizationoptionvalueprefix;if(typeof r!="number")throw new Error(`Couldn't read the option-value prefix of publisher ${e.publisherUniqueName}, so nothing was imported: a wrong one would change the publisher.`);const a=d=>typeof d=="string"?d:"",i=[1,2].map(d=>Object.fromEntries(Vn.map(([,u])=>[u,o[`address${d}_${u}`]]).filter(([,u])=>u!=null&&u!==""))).map((d,u)=>({number:u+1,...d}));return{solutionDescription:a(t.description),publisherDescription:a(o.description),publisherEmail:a(o.emailaddress),publisherWebsite:a(o.supportingwebsiteurl),publisherOptionValuePrefix:r,publisherAddresses:i.filter(d=>Object.keys(d).length>1)}}const Zs=e=>X(e).replace(/\r/g,"
").replace(/\n/g,"
").replace(/\t/g,"	"),$n=(e,t)=>e?`<Descriptions>
|
|
2
|
-
<Description description="${Zs(e)}" languagecode="${t}"/>
|
|
3
|
-
</Descriptions>`:"<Descriptions/>",Qs=e=>e.length===0?"<Addresses/>":`<Addresses>${e.map(t=>`
|
|
4
|
-
<Address>
|
|
5
|
-
<AddressNumber>${t.number}</AddressNumber>${Vn.filter(([,o])=>o in t).map(([o,r])=>`
|
|
6
|
-
<${o}>${X(String(t[r]))}</${o}>`).join("")}
|
|
7
|
-
</Address>`).join("")}
|
|
8
|
-
</Addresses>`;function et(e){const t=e.publisherUniqueName?.trim()||"DefaultPublisher",o=e.publisherName?.trim()||t,r=e.publisherPrefix?.trim()||"new",a=e.languageCode||1033,i=e.friendlyName?.trim()||e.uniqueName,d=e.rootComponents.length===0?"<RootComponents/>":`<RootComponents>
|
|
9
|
-
${e.rootComponents.map(u=>{const f=[`type="${u.type}"`];return u.schemaName&&f.push(`schemaName="${X(u.schemaName)}"`),u.id&&f.push(`id="{${X(u.id)}}"`),f.push(`behavior="${u.behavior}"`),`<RootComponent ${f.join(" ")} />`}).join(`
|
|
10
|
-
`)}
|
|
11
|
-
</RootComponents>`;return`<?xml version="1.0" encoding="utf-8"?>
|
|
12
|
-
<ImportExportXml version="9.1.0.0" SolutionPackageVersion="9.1" languagecode="${a}" generatedBy="CommandBarStudio">
|
|
13
|
-
<SolutionManifest>
|
|
14
|
-
<UniqueName>${X(e.uniqueName)}</UniqueName>
|
|
15
|
-
<LocalizedNames>
|
|
16
|
-
<LocalizedName description="${X(i)}" languagecode="${a}"/>
|
|
17
|
-
</LocalizedNames>
|
|
18
|
-
${$n(e.details.solutionDescription,a)}
|
|
19
|
-
<Version>${X(e.version)}</Version>
|
|
20
|
-
<Managed>0</Managed>
|
|
21
|
-
<Publisher>
|
|
22
|
-
<UniqueName>${X(t)}</UniqueName>
|
|
23
|
-
<LocalizedNames>
|
|
24
|
-
<LocalizedName description="${X(o)}" languagecode="${a}"/>
|
|
25
|
-
</LocalizedNames>
|
|
26
|
-
${$n(e.details.publisherDescription,a)}
|
|
27
|
-
<EMailAddress>${X(e.details.publisherEmail)}</EMailAddress>
|
|
28
|
-
<SupportingWebsiteUrl>${X(e.details.publisherWebsite)}</SupportingWebsiteUrl>
|
|
29
|
-
<CustomizationPrefix>${X(r)}</CustomizationPrefix>
|
|
30
|
-
<CustomizationOptionValuePrefix>${e.details.publisherOptionValuePrefix}</CustomizationOptionValuePrefix>
|
|
31
|
-
${Qs(e.details.publisherAddresses)}
|
|
32
|
-
</Publisher>
|
|
33
|
-
${d}
|
|
34
|
-
<MissingDependencies/>
|
|
35
|
-
</SolutionManifest>
|
|
36
|
-
</ImportExportXml>`}const nt=Pn({root:{display:"flex",flexDirection:"column",gap:E.spacingVerticalS},box:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:E.spacingHorizontalM,rowGap:E.spacingVerticalXS,padding:`${E.spacingVerticalS} ${E.spacingHorizontalM}`,backgroundColor:E.colorNeutralBackground3,borderRadius:E.borderRadiusMedium},label:{color:E.colorNeutralForeground3},value:{display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:E.spacingHorizontalS,minWidth:0},secondary:{color:E.colorNeutralForeground3,wordBreak:"break-all"}});function st({rows:e,confirmWord:t,onConfirmationChange:o,disabled:r}){const a=nt(),[i,d]=A.useState({status:"loading"}),[u,f]=A.useState(""),$=K(j=>j.environment),S=K(j=>j.connectionUrl),v=K(j=>j.connectionVersion);A.useEffect(()=>{let j=!0;return d({status:"loading"}),An().then(W=>j&&d({status:"ready",connection:W})).catch(()=>j&&d({status:"ready",connection:null})),()=>{j=!1}},[$,S,v]);const h=i.status==="ready"?i.connection:null,C=ws(h?.environment),b=i.status==="ready"&&Fe(h?.environment),w=i.status==="ready"&&(!b||xs(u,t)),P=h?.environment;return A.useEffect(()=>{o(w,P)},[w,P,o]),n.jsxs("div",{className:a.root,children:[C&&n.jsx(U,{intent:"warning",children:n.jsxs(O,{children:[n.jsx(Ss,{children:"Production environment"}),"This changes the live environment."]})}),n.jsxs("div",{className:a.box,children:[n.jsx(F,{className:a.label,children:"Environment"}),n.jsx("div",{className:a.value,children:i.status==="loading"?n.jsx(F,{children:"Reading the connection…"}):h?n.jsxs(n.Fragment,{children:[n.jsx(F,{weight:"semibold",children:h.name}),h.environment&&n.jsx(Tn,{size:"small",appearance:C?"filled":"tint",color:C?"warning":"informative",children:h.environment}),n.jsx(F,{size:200,className:a.secondary,children:h.url})]}):n.jsx(F,{children:"Unknown (the tool has no connection)"})}),e.map(j=>n.jsxs("div",{style:{display:"contents"},children:[n.jsx(F,{className:a.label,children:j.label}),n.jsx("div",{className:a.value,children:j.value})]},j.label))]}),b&&n.jsx(Re,{label:n.jsxs(n.Fragment,{children:["Type ",n.jsx("strong",{children:t})," to confirm"]}),hint:"Required on a Production environment.",children:n.jsx(Ln,{value:u,onChange:(j,W)=>f(W.value),disabled:r,autoComplete:"off","aria-label":`Type ${t} to confirm`})})]})}const tt=Pn({content:{display:"flex",flexDirection:"column",gap:E.spacingVerticalM},progressList:{display:"flex",flexDirection:"column",gap:E.spacingVerticalXS},progressRow:{display:"flex",alignItems:"center",gap:E.spacingHorizontalS}}),kn=({findings:e,showScope:t})=>n.jsx("ul",{style:{margin:`${E.spacingVerticalXS} 0 0`,paddingLeft:20},children:e.map((o,r)=>n.jsxs("li",{children:[t&&n.jsxs("strong",{children:[o.scope,": "]}),o.message]},r))}),de=["HomepageGrid","SubGrid","Form"],ot=3e4,mt=()=>{const e=tt(),t=Be(s=>s.bulkPublishOpen),o=Be(s=>s.closeBulkPublish),r=Be(s=>s.openXmlDrawer),a=D(s=>s.ribbons),i=D(s=>s.baseline),d=D(s=>s.commands),u=D(s=>s.displayRules),f=D(s=>s.enableRules),$=D(s=>s.baselineCommands),S=D(s=>s.baselineEnableRules),v=D(s=>s.baselineDisplayRules),h=D(s=>s.locLabels),C=D(s=>s.baselineLocLabels),b=D(s=>s.layers),w=D(s=>s.pendingUnhides),P=D(s=>s.orphans),j=D(s=>s.pendingOrphanDeletes),W=D(s=>s.customisedCommandIds),Z=D(s=>s.uncustomisedCommandIds),_=D(s=>s.baseLanguageCode),Q=D(s=>s.baseLanguageUnknown),Y=D(s=>s.setLayerSnapshot),ee=D(s=>s.markPublished),k=D(s=>s.mutationsSincePublish),c=K(s=>s.activeSolution),g=K(s=>s.activeEntity),L=K(s=>s.connectionUrl),l=K(s=>s.publisherPrefix),m=K(s=>s.solutionRibbonComponentIds),R=Array.isArray(m)&&m.length>0,[y,I]=A.useState(!1),[$e,B]=A.useState({}),[N,ke]=A.useState(!1),[pe,Bn]=A.useState(!1),[ae,Ge]=A.useState("targeted"),[Ye,Pe]=A.useState(!1),Je=ae==="allAsync"&&!Ye,Ze=K(s=>s.connectionName||s.connectionUrl||"this environment"),[Qe,Ne]=A.useState({confirmed:!1}),qn=se.useCallback((s,p)=>Ne({confirmed:s,environment:p}),[]),en=Qe.confirmed,[Fn,nn]=A.useState(0),[sn,re]=A.useState(""),[De,tn]=A.useState(""),[be,on]=A.useState(c?.version??"1.0.0.0"),[fe,ge]=A.useState([]),[Wn,an]=A.useState([]),[Kn,ye]=A.useState([]),rn=se.useMemo(()=>{const p=(be||c?.version||"1.0.0.0").split(".").map(q=>Number.parseInt(q,10)||0);for(;p.length<4;)p.push(0);return p[3]+=1,p.slice(0,4).join(".")},[c?.version,be]);se.useEffect(()=>{on(c?.version??"1.0.0.0")},[c?.version]);const we=se.useCallback((s,p,q)=>Cs({locations:s.map(M=>({current:a[M],baseline:i[M]})),excludeCommandIds:q,locLabels:h,baselineLocLabels:C,layer:b[p]??void 0,unhiddenLayerHideIds:w[p],deletedOrphans:P[p].filter(M=>j[p].includes(M.id)),customisedCommandIds:W,uncustomisedCommandIds:Z[p],commands:d,baselineCommands:$,enableRules:f,baselineEnableRules:S,displayRules:u,baselineDisplayRules:v}),[a,i,d,$,f,S,u,v,h,C,b,w,P,j,W,Z]),H=se.useMemo(()=>g?we(de,"entity"):null,[g,we]),ne=se.useMemo(()=>{const s=new Set;if(g)for(const p of de)for(const q of a[p].tabs)for(const M of q.groups)for(const z of Se(M))z.commandId&&s.add(z.commandId);return we(["Application"],"application",s)},[we,g,a]),le=ne.hasChanges&&R,ue=[...H?.unsupported??[],...ne.unsupported],ln=[...H?.warnings??[],...ne.warnings],G=[...g&&H?.hasChanges?[g.logicalName]:[],...le?["Application ribbon"]:[]],_n=g&&H?.hasChanges?g.logicalName:"application ribbon",[Ae,xe]=A.useState("idle"),[Ee,Te]=A.useState([]),[Hn,Le]=A.useState(""),te=t&&!!c&&ue.length===0&&G.length>0,cn=c?.id,dn=c?.publisherPrefix||l,un=se.useCallback(async()=>{const s={commands:d,enableRules:f,displayRules:u,locLabels:h,baselineCommands:$,baselineEnableRules:S,baselineDisplayRules:v,publisherPrefix:dn,languageCode:_},p={lookupWebResources:M=>vs(M,cn)},q=[];if(g&&H?.hasChanges){const{findings:M}=await Sn({...s,entity:{logicalName:g.logicalName,schemaName:g.schemaName},locations:de.map(z=>({current:a[z],baseline:i[z]})),plan:H},p);q.push(...M.map(z=>({...z,scope:g.logicalName})))}if(le){const{findings:M}=await Sn({...s,entity:null,locations:[{current:a.Application,baseline:i.Application}],plan:ne},p);q.push(...M.map(z=>({...z,scope:"Application ribbon"})))}return q},[g,H,ne,le,a,i,d,f,u,h,$,S,v,dn,cn,_]);se.useEffect(()=>{if(!te||y||N)return;let s=!1;return xe("running"),Le(""),qs(un(),ot).then(p=>{s||(Te(p),xe("done"))}).catch(p=>{s||(Te([]),Le(p instanceof Error?p.message:String(p)),xe("failed"))}),()=>{s=!0}},[te,y,N,un]);const ce=Ee.filter(s=>s.severity==="error"),Ce=Ee.filter(s=>s.severity==="warning"),hn=new Set(Ee.map(s=>s.scope)).size>1,mn=te&&(Ae==="running"||ce.length>0),Gn=()=>He(async()=>{if(!c||ue.length>0||G.length===0||mn||!en||Q||Je)return;I(!0);const s=_e(),p=K.getState().connectionVersion,q=()=>K.getState().connectionVersion!==p,M=await An().catch(()=>null);if(q()){I(!1);return}if(Fe(M?.environment)&&!Fe(Qe.environment)){Ne({confirmed:!1}),nn(x=>x+1),I(!1),Ie.getState().logWarn("publish",`${M?.name??"The connection"} is a Production environment now: type the confirmation to publish.`);return}re(""),ge([]),ye([]),an(G),B(Object.fromEntries(G.map(x=>[x,"pending"])));let z=!1;const oe=[],Me={},ie=[],ve=[],Ue=Ie.getState(),he=x=>x instanceof Error?x.message:String(x);De.trim()&&Ue.logInfo("publish",`Publish comment: ${De.trim()}`);const pn={commands:d,enableRules:f,displayRules:u,locLabels:h,baselineCommands:$,baselineEnableRules:S,baselineDisplayRules:v,publishCustomizations:!0,languageCode:_,solution:{uniqueName:c.uniqueName,friendlyName:c.friendlyName,version:pe?rn:be,publisherUniqueName:c.publisherUniqueName,publisherName:c.publisherName,publisherPrefix:c.publisherPrefix||l,publisherOptionValuePrefix:c.publisherOptionValuePrefix}};if(g&&H?.hasChanges){const x=g.logicalName;B(T=>({...T,[x]:"publishing"}));try{const T=await In({...pn,guard:s,entity:{logicalName:g.logicalName,schemaName:g.schemaName,displayName:g.displayName},locations:de.map(V=>({current:a[V],baseline:i[V]})),plan:H},V=>re(V));oe.push(...de),Me.entity=T.parts,js(L,g.logicalName,T.changedKeys),T.verification&&ve.push({scope:x,result:T.verification}),B(V=>({...V,[x]:"success"}))}catch(T){z=!0,ie.push({scope:x,message:he(T)}),Ue.logError("publish",`Ribbon publish failed (${x}): ${he(T)}`),B(V=>({...V,[x]:"error"}))}}else g&&oe.push(...de);if(le&&!q()){const x="Application ribbon";B(T=>({...T,[x]:"publishing"}));try{const T=await In({...pn,guard:s,entity:null,locations:[{current:a.Application,baseline:i.Application}],ribbonCustomizationIds:m??[],plan:ne},V=>re(V));oe.push("Application"),Me.application=T.parts,T.verification&&ve.push({scope:x,result:T.verification}),B(V=>({...V,[x]:"success"}))}catch(T){z=!0,ie.push({scope:x,message:he(T)}),Ue.logError("publish",`Application ribbon publish failed: ${he(T)}`),B(V=>({...V,[x]:"error"}))}}else ne.hasChanges||oe.push("Application");if(!z&&ae==="allAsync")try{await Gs(x=>re(x),{guard:s})}catch(x){z=!0,ie.push({scope:"Publish all customizations",message:he(x)})}if(q()){le&&!ie.some(x=>x.scope==="Application ribbon")&&ie.push({scope:"Application ribbon",message:"Not published: the tool's connection changed during the publish."}),ye(ve),ge(ie),ke(!1),I(!1);return}if(ee(oe,Me),g&&oe.includes("HomepageGrid")&&H?.hasChanges){const x=await yn(g.logicalName);x&&Y("entity",x)}if(oe.includes("Application")&&le){const x=await yn(null);x&&Y("application",x)}z||re("Done."),ye(ve),ge(ie),ke(!z),I(!1)}),ze=()=>{I(!1),B({}),an([]),ke(!1),re(""),ge([]),ye([]),xe("idle"),Te([]),Le(""),Ne({confirmed:!1}),Ge("targeted"),Pe(!1),tn(""),nn(s=>s+1),o()};return n.jsx(Is,{open:t,onOpenChange:()=>!y&&ze(),children:n.jsxs($s,{style:{maxWidth:"640px",maxHeight:"92vh",display:"flex",flexDirection:"column"},children:[n.jsx(ks,{children:"Publish to Dataverse"}),n.jsxs(Ps,{style:{flex:1,minHeight:0,overflow:"hidden"},children:[n.jsx(Ns,{style:{overflowY:"auto",maxHeight:"100%"},children:n.jsxs("div",{className:e.content,children:[!c&&n.jsx(U,{intent:"warning",children:n.jsx(O,{children:"No solution selected. Please select a solution first."})}),Q&&!N&&n.jsx(U,{intent:"error",layout:"multiline",children:n.jsx(O,{children:"The organization's base language couldn't be read when the table loaded, so labels are shown in English. Reload the table before publishing: publishing now could write English texts as the base language's titles."})}),ue.length>0&&!N&&n.jsx(U,{intent:"error",layout:"multiline",children:n.jsxs(O,{children:[n.jsx("strong",{children:"These changes can't be published yet. Undo them to publish:"}),n.jsx("ul",{style:{margin:`${E.spacingVerticalXS} 0 0`,paddingLeft:20},children:ue.map(s=>n.jsx("li",{children:s},s))})]})}),ln.length>0&&!N&&n.jsx(U,{intent:"info",layout:"multiline",children:n.jsxs(O,{children:[n.jsx("strong",{children:"Good to know:"}),n.jsx("ul",{style:{margin:`${E.spacingVerticalXS} 0 0`,paddingLeft:20},children:ln.map(s=>n.jsx("li",{children:s},s))})]})}),te&&!N&&!y&&Ae==="running"&&n.jsxs("div",{className:e.progressRow,children:[n.jsx(Ds,{size:"tiny"}),n.jsx(F,{children:"Checking the ribbon customizations before publishing…"})]}),te&&!N&&Ae==="failed"&&n.jsx(U,{intent:"warning",layout:"multiline",children:n.jsxs(O,{children:["The pre-publish check couldn't complete (",Hn,"). Publishing runs the check again before anything is imported."]})}),te&&!N&&ce.length>0&&n.jsx(U,{intent:"error",layout:"multiline",children:n.jsxs(O,{children:[n.jsxs("strong",{children:["Publishing is blocked: the pre-publish check found ",ce.length," error",ce.length!==1?"s":"",". Fix"," ",ce.length!==1?"them":"it",", then reopen this dialog:"]}),n.jsx(kn,{findings:ce,showScope:hn})]})}),te&&!N&&Ce.length>0&&n.jsx(U,{intent:"warning",layout:"multiline",children:n.jsxs(O,{children:[n.jsxs("strong",{children:[Ce.length," warning",Ce.length!==1?"s":""," — you can still publish:"]}),n.jsx(kn,{findings:Ce,showScope:hn})]})}),ne.hasChanges&&!R&&!N&&n.jsx(U,{intent:"warning",layout:"multiline",children:n.jsxs(O,{children:["You changed the Application ribbon, but this solution doesn't include the Application Ribbons component, so those changes stay pending. In make.powerapps.com open the solution, choose ",n.jsx("strong",{children:"Add existing → Application Ribbons"}),", then reload here."]})}),n.jsx(U,{intent:"info",layout:"multiline",children:n.jsxs(O,{children:["Publishing writes this table's complete ribbon customization: what is already published, plus your changes. Ribbon changes on this table that were imported elsewhere but ",n.jsx("strong",{children:"not published"})," are published first, so they are kept. Publishing takes about 1–4 minutes (the ribbon is imported twice so Unified Interface picks up the change). Users may need to refresh the page, or navigate away and back, to see the update. You have ",n.jsx("strong",{children:k})," change(s) since the last publish."]})}),fe.length>0&&n.jsx(U,{intent:"error",layout:"multiline",children:n.jsxs(O,{children:[n.jsxs("strong",{children:["Publish failed (",fe.length," error",fe.length!==1?"s":"",")"]}),n.jsx("ul",{style:{margin:`${E.spacingVerticalXS} 0 0`,paddingLeft:20},children:fe.map((s,p)=>n.jsxs("li",{style:{fontFamily:E.fontFamilyMonospace},children:[n.jsxs("strong",{children:[s.scope,":"]})," ",s.message]},p))}),n.jsxs("div",{style:{marginTop:E.spacingVerticalS},children:["Full details are in the ",n.jsx("strong",{children:"Console"})," tab of the bottom panel."]})]})}),!y&&!N&&n.jsxs(n.Fragment,{children:[n.jsx(st,{rows:[{label:"Solution",value:c?n.jsx(F,{weight:"semibold",children:c.friendlyName||c.uniqueName}):n.jsx(F,{children:"None selected"})},{label:"Will publish",value:n.jsx(F,{weight:"semibold",children:G.length>0?G.join(", "):"nothing (there are no changes to publish)"})},{label:"Writes",value:n.jsxs(F,{children:["Publishes ",G.length===1?"it":"them"," first (keeps changes imported elsewhere but not published),"," ",G.length===1?"imports its":"imports each one's"," ribbon customization twice, replacing what the solution's layer has, then publishes"," ",ae==="allAsync"?"every unpublished customization in the environment":G.length===1?"it":"them","."]})}],confirmWord:_n,onConfirmationChange:qn},Fn),n.jsx(Re,{label:"Afterwards",children:n.jsxs(As,{value:ae==="targeted"?"Publish only these ribbons":"Also publish all customizations (PublishAllXmlAsync)",selectedOptions:[ae],onOptionSelect:(s,p)=>{(p.optionValue==="targeted"||p.optionValue==="allAsync")&&(Ge(p.optionValue),Pe(!1))},children:[n.jsx(wn,{value:"targeted",children:"Publish only these ribbons"}),n.jsx(wn,{value:"allAsync",children:"Also publish all customizations (PublishAllXmlAsync)"})]})}),ae==="allAsync"&&n.jsx(U,{intent:"warning",layout:"multiline",children:n.jsxs(O,{children:[n.jsxs(F,{block:!0,children:["This publishes ",n.jsx("strong",{children:"every"})," unpublished customization in"," ",n.jsx("strong",{children:Ze}),", not only these ribbons: forms, views, tables and other people's work in progress included."]}),n.jsx(Es,{checked:Ye,onChange:(s,p)=>Pe(p.checked===!0),label:`Publish all unpublished customizations in ${Ze}`})]})}),n.jsx(Re,{label:"Solution version",children:n.jsx(Ln,{size:"small",value:pe?rn:be,onChange:(s,p)=>on(p.value),disabled:pe})}),n.jsx(Ts,{label:"Increment solution version",checked:pe,onChange:(s,p)=>Bn(p.checked===!0)}),n.jsx(Re,{label:"Publish comment",hint:"Written to the Console log with this publish; it isn't stored in Dataverse.",children:n.jsx(Ls,{resize:"vertical",value:De,onChange:(s,p)=>tn(p.value)})}),n.jsx(qe,{appearance:"subtle",onClick:()=>{r(),ze()},children:"View RibbonDiffXml"})]}),N&&n.jsx(U,{intent:"info",layout:"multiline",children:n.jsx(O,{children:"Unified Interface caches command bars by metadata version, and publishing a ribbon doesn't always change that version. If the app still shows the old command bar, hard-refresh the page (Ctrl+F5) or sign out and back in; it can take several minutes to appear for users who already had the table open."})}),Kn.map(s=>n.jsx(U,{intent:s.result.ok?"success":"warning",layout:"multiline",children:n.jsxs(O,{children:[n.jsxs("strong",{children:[s.scope,":"]})," ",s.result.message]})},s.scope)),(y||N)&&n.jsxs("div",{className:e.progressList,children:[Wn.map(s=>{const p=$e[s]??"pending";return n.jsxs("div",{className:e.progressRow,children:[n.jsx(Tn,{appearance:"filled",color:p==="success"?"success":p==="error"?"danger":p==="publishing"?"informative":"subtle",size:"small",children:p}),n.jsx(F,{children:s}),p==="publishing"&&n.jsx(zs,{thickness:"large",style:{flex:1}})]},s)}),sn&&n.jsx(U,{intent:"info",children:n.jsx(O,{children:sn})})]})]})}),n.jsxs(Ms,{children:[n.jsx(qe,{appearance:"secondary",onClick:ze,disabled:y,children:N?"Close":"Cancel"}),!N&&n.jsx(qe,{appearance:"primary",onClick:()=>{Gn()},disabled:y||!c||G.length===0||ue.length>0||mn||!en||Q||Je,children:y?"Publishing...":"Publish"})]})]})]})})};export{mt as BulkPublishModal,mt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as e,h as N,z as Be,cq as ue}from"./fluent-icons-BqJj6rDi.js";import{a as S,u as b,i as Pe,b as We,d as $e,C as Le,w as Te,E as Oe,e as Ve,f as He,h as Ue,j as _e,k as Xe}from"./index-Di2_5czx.js";import{a as m}from"./monaco-BIO15LCS.js";import{u as Je,C as me}from"./useStableKeys-p2OkzZWO.js";import{M as qe}from"./MonacoEditor-uzfuRCpJ.js";import{ai as Ke,aj as Ge,ak as Ye,b as d,t as n,d as u,al as Qe,ac as Ze,ad as z,a7 as X,F as j,S as J,B as I,M as C,f as w,I as $}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";import"./crmParameters-rgfZhhzN.js";const es=Be({drawer:{width:"640px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:n.spacingVerticalS,padding:n.spacingVerticalM,overflowY:"auto"},actionCard:{border:`1px solid ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,padding:n.spacingVerticalM,display:"flex",flexDirection:"column",gap:n.spacingVerticalS},actionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between"},row:{display:"flex",gap:n.spacingHorizontalS,alignItems:"flex-end"},ruleRow:{display:"inline-flex",alignItems:"center",gap:n.spacingHorizontalXS},ruleRemoveBtn:{minWidth:"20px",width:"20px",height:"20px"},ruleChip:{cursor:"pointer"},rulePills:{display:"flex",flexWrap:"wrap",gap:n.spacingHorizontalXS},versionsList:{display:"flex",flexDirection:"column",gap:n.spacingVerticalXS},versionRow:{border:`1px solid ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,padding:n.spacingVerticalXS,display:"flex",justifyContent:"space-between",gap:n.spacingHorizontalS},versionMeta:{fontSize:n.fontSizeBase100,color:n.colorNeutralForeground3},securityNote:{fontSize:n.fontSizeBase100},readOnly:{border:"none",margin:0,padding:0,minWidth:0,display:"flex",flexDirection:"column",gap:n.spacingVerticalS},codePanel:{border:`1px solid ${n.colorNeutralStroke2}`,borderRadius:n.borderRadiusMedium,padding:n.spacingVerticalS,display:"flex",flexDirection:"column",gap:n.spacingVerticalS}}),ss=[],ds=()=>{const l=es(),L=S(s=>s.commandEditorOpen),k=S(s=>s.commandEditorId),M=S(s=>s.closeCommandEditor),pe=S(s=>s.openCommandEditor),q=S(s=>s.openRuleEditor),he=S(s=>s.openWebResourceBrowser),T=b(s=>s.commands),be=b(s=>s.upsertCommand),xe=b(s=>s.renameCommandId),K=b(s=>s.ribbons),G=b(s=>s.displayRules),Y=b(s=>s.enableRules),je=b(s=>s.past),fe=b(s=>s.upsertEnableRule),ge=b(s=>s.upsertDisplayRule),[f,ve]=m.useState("actions"),[p,Q]=m.useState(""),[ye,Z]=m.useState(""),[Ce,ee]=m.useState(""),[se,A]=m.useState(null),[E,ae]=m.useState(!1),[ne,D]=m.useState(!1),[O,g]=m.useState(null),[re,V]=m.useState(null),[le,F]=m.useState(""),[we,B]=m.useState(!1),[R,ie]=m.useState(null),r=T.find(s=>s.id===k),v=Je(`actions:${r?.id??""}`,r?.actions??ss),Re=Pe(We(r?.id)),Ne=s=>{const a=s.trim();return a.startsWith("$webresource:")?a.slice(13).trim():a},Se=s=>{if(!s)return"";const a=Uint8Array.from(atob(s),o=>o.charCodeAt(0));return new TextDecoder().decode(a)},ze=s=>{const a=new TextEncoder().encode(s);let o="";for(let i=0;i<a.length;i+=1)o+=String.fromCharCode(a[i]);return btoa(o)},ke=s=>{const a=s.split(".").pop()?.toLowerCase()??"";return{html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[a]??3};m.useEffect(()=>{r&&Q(r.id)},[r]),m.useEffect(()=>{L&&k&&!r&&M()},[L,k,r,M]);const P=m.useMemo(()=>r?p.trim()?/\s/.test(p)?"Command ID cannot contain whitespace.":p!==r.id&&T.some(s=>s.id.toLowerCase()===p.toLowerCase())?"A command with this ID already exists.":"":"Command ID is required.":"",[p,r,T]),H=m.useMemo(()=>Object.entries(K).flatMap(([s,a])=>a.tabs.flatMap(o=>o.groups.flatMap(i=>$e(i).filter(c=>c.commandId===k).map(c=>({location:s,tab:o,group:i,button:c}))))),[K,k]),oe=H.length;if(!r)return null;const te=async(s,a)=>{const o=r.actions[s];if(!o||o.kind!=="javascript")return;const i=Ne(o.library);if(!i){g("JavaScript library must be a valid $webresource path."),A(s),ae(a),F(""),ie(null);return}A(s),ae(a),D(!0),g(null),V(null),B(!1),ie(i);try{const c=await He(i);if(!c){F(""),g(`Web resource not found: ${i}`);return}const t=await Ue(c.id);F(Se(t))}catch(c){g(c instanceof Error?c.message:"Failed to load web resource content."),F("")}finally{D(!1)}},Ee=async()=>{if(!E||se===null||!R)return;const s=Xe();D(!0),g(null),V(null);try{const a=await _e(R,ze(le),ke(R),{displayName:R.split("/").pop(),guard:s});V([a.solutionWarning,a.publishWarning].filter(Boolean).join(" ")||null),B(!1)}catch(a){g(a instanceof Error?a.message:"Failed to save web resource content.")}finally{D(!1)}},y=s=>{be({...r,...s})},x=(s,a)=>{const o=[...r.actions];o[s]=a,y({actions:o}),v.update()},W=s=>{y({actions:r.actions.filter((a,o)=>o!==s)}),v.remove(s),A(a=>a===null||a===s?null:a>s?a-1:a)},U=s=>{const a=s==="javascript"?{kind:"javascript",library:"",functionName:"",params:[]}:{kind:"url",address:"https://",params:[]};y({actions:[...r.actions,a]}),v.add()},Fe=(s,a)=>{const o=se===a;if(s.kind==="javascript")return e.jsxs("div",{className:l.actionCard,children:[e.jsxs("div",{className:l.actionHeader,children:[e.jsx(I,{appearance:"filled",color:"success",size:"small",children:"JavaScript"}),e.jsx(u,{appearance:"subtle",size:"small",icon:e.jsx(N,{}),onClick:()=>W(a),"aria-label":"Remove action"})]}),e.jsx(j,{label:"Library (Web Resource)",children:e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[e.jsx($,{style:{flex:1},value:s.library,onChange:(i,c)=>x(a,{...s,library:c.value.replace(/^(\s*\$webresource:\s*)+/i,"$webresource:")}),placeholder:"$webresource:publisher_/scripts/myfile.js"}),e.jsx(u,{appearance:"subtle",size:"small",onClick:()=>{Te.set(i=>{x(a,{...s,library:`$webresource:${i.name}`})}),he()},children:"Browse…"})]})}),e.jsx(j,{label:"Function name",children:e.jsx($,{value:s.functionName,onChange:(i,c)=>x(a,{...s,functionName:c.value}),placeholder:"MyNamespace.myFunction"})}),e.jsx(C,{intent:"info",children:e.jsx(w,{children:"Read-only function preview and Monaco editing are available in the web resource browser integration path."})}),e.jsx(X,{children:"Parameters (positional)"}),e.jsx(me,{params:s.params,onChange:i=>x(a,{...s,params:i}),urlMode:!1}),e.jsxs("div",{className:l.row,children:[e.jsx(u,{appearance:"subtle",size:"small",onClick:()=>{te(a,!1)},children:"Function preview"}),e.jsx(u,{appearance:"subtle",size:"small",onClick:()=>{te(a,!0)},children:"Open in Monaco"})]}),o&&e.jsxs("div",{className:l.codePanel,children:[e.jsxs("div",{className:l.row,children:[e.jsx(d,{weight:"semibold",children:E?"Monaco Editor":"Function Preview"}),R&&e.jsx(d,{size:200,style:{fontFamily:n.fontFamilyMonospace},children:R})]}),O&&e.jsx(C,{intent:"error",children:e.jsx(w,{children:O})}),re&&e.jsx(C,{intent:"warning",children:e.jsx(w,{children:re})}),ne?e.jsx(d,{style:{color:n.colorNeutralForeground3},children:"Loading source…"}):e.jsx("div",{style:{height:240},children:e.jsx(qe,{language:"javascript",value:le,readOnly:!E,onChange:i=>{F(i),B(!0)},options:{wordWrap:"on"}})}),e.jsxs("div",{className:l.row,children:[e.jsx(u,{appearance:"subtle",size:"small",onClick:()=>{A(null),g(null),B(!1)},children:"Close"}),E&&e.jsx(Oe,{prefix:"Saves to"}),E&&e.jsx(u,{appearance:"primary",size:"small",onClick:()=>{Ee()},disabled:!we||ne||!!O,children:"Save Web Resource"})]})]})]},v.keys[a]);if(s.kind==="url"){const i=s.address.trim().startsWith("https://");return e.jsxs("div",{className:l.actionCard,children:[e.jsxs("div",{className:l.actionHeader,children:[e.jsx(I,{appearance:"filled",color:"informative",size:"small",children:"URL"}),e.jsx(u,{appearance:"subtle",size:"small",icon:e.jsx(N,{}),onClick:()=>W(a),"aria-label":"Remove action"})]}),e.jsx(C,{intent:"warning",children:e.jsx(w,{children:e.jsx(d,{className:l.securityNote,children:"⚠ Ampersands in URLs are automatically escaped as & in the generated XML."})})}),e.jsx(j,{label:"Address",validationState:i?"none":"error",validationMessage:i?void 0:"URL must start with https://",children:e.jsx($,{value:s.address,onChange:(c,t)=>x(a,{...s,address:t.value}),placeholder:"https://..."})}),e.jsx(j,{label:"Open in (WinMode)",children:e.jsxs(J,{value:String(s.winMode??0),onChange:(c,t)=>x(a,{...s,winMode:parseInt(t.value)}),children:[e.jsx("option",{value:"0",children:"Navigate (0)"}),e.jsx("option",{value:"1",children:"Dialog (1)"}),e.jsx("option",{value:"2",children:"Popup (2)"})]})}),e.jsx(j,{children:e.jsxs(u,{appearance:s.passParams?"primary":"subtle",size:"small",onClick:()=>x(a,{...s,passParams:s.passParams?void 0:!0}),children:[s.passParams?"✓ PassParams ON":"PassParams OFF"," — appends typename, type, id, orgname…"]})}),e.jsx(X,{children:"Parameters (named)"}),e.jsx(me,{params:s.params,onChange:c=>x(a,{...s,params:c}),urlMode:!0})]},v.keys[a])}return s.kind==="powerFx"||s.kind==="customApi"?e.jsxs("div",{className:l.actionCard,children:[e.jsxs("div",{className:l.actionHeader,children:[e.jsxs(I,{appearance:"filled",color:"danger",size:"small",children:[s.kind==="powerFx"?"Power Fx":"Custom API"," — not supported"]}),e.jsx(u,{appearance:"subtle",size:"small",icon:e.jsx(N,{}),onClick:()=>W(a),"aria-label":"Remove action"})]}),e.jsx(C,{intent:"error",children:e.jsxs(w,{children:["Classic ribbon commands can't run"," ",s.kind==="powerFx"?"Power Fx":"Custom API"," actions, so this command can't be published while it has one. Remove it and use a JavaScript function instead (for example, call the API with ",e.jsx("code",{children:"Xrm.WebApi.online.execute"}),"), or build the command with modern commanding in the app designer."]})})]},v.keys[a]):s.kind==="outlookCommand"||s.kind==="raw"?e.jsxs("div",{className:l.actionCard,children:[e.jsxs("div",{className:l.actionHeader,children:[e.jsx(I,{appearance:"outline",size:"small",children:s.kind==="outlookCommand"?"Outlook command":s.tagName}),e.jsx(u,{appearance:"subtle",size:"small",icon:e.jsx(N,{}),onClick:()=>W(a),"aria-label":"Remove action"})]}),e.jsx(d,{size:200,style:{color:n.colorNeutralForeground3},children:s.kind==="outlookCommand"?`ActionType="${s.actionType}"${s.data?` Data="${s.data}"`:""}`:s.xml})]},v.keys[a]):null},Ie=()=>e.jsxs(e.Fragment,{children:[r.actions.map((s,a)=>Fe(s,a)),r.actions.length===0&&e.jsx(d,{italic:!0,style:{color:n.colorNeutralForeground3},children:"No actions defined — button will do nothing when clicked."}),e.jsxs("div",{className:l.row,children:[e.jsx(j,{label:"Action type",style:{minWidth:"220px"},children:e.jsxs(J,{onChange:(s,a)=>{const o=a.value;o&&U(o)},value:"",children:[e.jsx("option",{value:"",children:"Add action..."}),e.jsx("option",{value:"javascript",children:"JavaScript function"}),e.jsx("option",{value:"url",children:"URL action"})]})}),e.jsx(u,{icon:e.jsx(ue,{}),appearance:"secondary",size:"small",onClick:()=>U("javascript"),children:"Add JavaScript function"}),e.jsx(u,{icon:e.jsx(ue,{}),appearance:"secondary",size:"small",onClick:()=>U("url"),children:"Add URL action"})]})]}),Me=()=>e.jsxs(e.Fragment,{children:[e.jsx(j,{label:"Command ID",children:e.jsx($,{value:p,onChange:(s,a)=>Q(a.value),style:{fontFamily:n.fontFamilyMonospace}})}),P&&e.jsx(d,{style:{color:n.colorPaletteRedForeground1,fontSize:n.fontSizeBase100},children:P}),e.jsx(u,{appearance:"secondary",size:"small",disabled:!p.trim()||!!P||p===r.id,onClick:()=>{if(!p.trim()||P)return;const s=p.trim();xe(r.id,s)&&pe(s)},children:"Apply ID change"}),e.jsx(d,{style:{color:n.colorNeutralForeground3,fontSize:n.fontSizeBase200},children:"Naming convention: Publisher.EntityName.ButtonName.Command"}),e.jsx(C,{intent:"warning",children:e.jsx(w,{children:e.jsxs(d,{className:l.securityNote,children:["⚠ ",e.jsx("strong",{children:"Security:"})," All command definitions are visible in browser source regardless of button visibility. Do not embed sensitive logic, credentials, or privileged information in command parameters or function names."]})})})]}),ce=s=>{const a=s==="enable"?r.enableRules:r.displayRules,o=(s==="enable"?Y:G).map(t=>t.id).filter(t=>!a.includes(t)),i=s==="enable"?ye:Ce,c=()=>{const t=new Set([...Y.map(_=>_.id),...G.map(_=>_.id)]),h=Ve("New",s==="enable"?"Enable":"Display",t);s==="enable"?fe({id:h,steps:[]}):ge({id:h,steps:[]}),q(h,s)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:l.rulePills,children:[a.map(t=>e.jsxs("div",{className:l.ruleRow,children:[e.jsx(I,{appearance:"outline",size:"medium",className:l.ruleChip,onClick:()=>q(t,s),role:"button",tabIndex:0,children:t}),e.jsx(u,{appearance:"subtle",size:"small",className:l.ruleRemoveBtn,icon:e.jsx(N,{}),"aria-label":`Unbind ${t}`,onClick:()=>{y(s==="enable"?{enableRules:r.enableRules.filter(h=>h!==t)}:{displayRules:r.displayRules.filter(h=>h!==t)})}})]},t)),a.length===0&&e.jsxs(d,{italic:!0,style:{color:n.colorNeutralForeground3},children:["No ",s," rules — always ",s==="enable"?"enabled":"visible","."]})]}),e.jsxs("div",{className:l.row,children:[e.jsx(j,{label:`Bind existing ${s} rule`,style:{minWidth:"260px"},children:e.jsxs(J,{value:i,onChange:(t,h)=>s==="enable"?Z(h.value):ee(h.value),children:[e.jsx("option",{value:"",children:"Select a rule…"}),o.map(t=>e.jsx("option",{value:t,children:t},t))]})}),e.jsx(u,{appearance:"secondary",size:"small",disabled:!i,onClick:()=>{i&&(s==="enable"?(y({enableRules:[...r.enableRules,i]}),Z("")):(y({displayRules:[...r.displayRules,i]}),ee("")))},children:"Bind selected"}),e.jsxs(u,{appearance:"subtle",size:"small",onClick:c,children:["Create new ",s," rule"]})]}),s==="enable"&&e.jsx(C,{intent:"info",children:e.jsxs(w,{children:["Disabled buttons are ",e.jsx("strong",{children:"hidden"})," in the modern command bar (Unified Interface). In the classic ribbon, disabled buttons remain visible but do not respond to clicks."]})})]})},Ae=()=>e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:["Referenced by ",e.jsx("strong",{children:oe})," button(s)."]}),H.length>0&&e.jsx("div",{className:l.versionsList,children:H.map(s=>e.jsx("div",{className:l.versionRow,children:e.jsxs("div",{children:[e.jsx(d,{weight:"semibold",style:{fontFamily:n.fontFamilyMonospace},children:s.button.id}),e.jsxs(d,{className:l.versionMeta,children:[s.location," → ",s.tab.label," → ",s.group.label]})]})},`${s.location}:${s.tab.id}:${s.group.id}:${s.button.id}`))})]}),de=je.filter(s=>s.target===r.id||s.detail.includes(r.id)).slice().reverse(),De=()=>e.jsx(e.Fragment,{children:de.length===0?e.jsx(d,{style:{color:n.colorNeutralForeground3},children:"No command-specific history entries yet."}):e.jsx("div",{className:l.versionsList,children:de.map((s,a)=>e.jsxs("div",{className:l.versionRow,children:[e.jsxs("div",{children:[e.jsx(d,{weight:"semibold",children:s.op}),e.jsx(d,{className:l.versionMeta,children:s.detail})]}),e.jsx(d,{className:l.versionMeta,children:new Date(s.ts).toLocaleString()})]},`${s.ts}-${a}`))})});return e.jsxs(Ke,{position:"end",open:L,onOpenChange:()=>M(),className:l.drawer,children:[e.jsx(Ge,{children:e.jsx(Ye,{action:e.jsx(u,{appearance:"subtle",icon:e.jsx(N,{}),onClick:M,"aria-label":"Close command editor"}),children:e.jsx(d,{size:400,weight:"semibold",style:{fontFamily:n.fontFamilyMonospace},children:r.id})})}),e.jsxs(Qe,{className:l.body,children:[e.jsxs(Ze,{selectedValue:f,onTabSelect:(s,a)=>ve(a.value),children:[e.jsx(z,{value:"actions",children:"Actions"}),e.jsx(z,{value:"enableRules",children:"Enable rules"}),e.jsx(z,{value:"displayRules",children:"Display rules"}),e.jsx(z,{value:"settings",children:"Settings"}),e.jsxs(z,{value:"references",children:["References (",oe,")"]}),e.jsx(z,{value:"versions",children:"Versions"})]}),e.jsx(X,{}),e.jsx(Le,{commandId:r.id}),e.jsxs("fieldset",{disabled:Re,className:l.readOnly,children:[f==="actions"&&Ie(),f==="enableRules"&&ce("enable"),f==="displayRules"&&ce("display"),f==="settings"&&Me()]}),f==="references"&&Ae(),f==="versions"&&De()]})]})};export{ds as CommandEditorPanel,ds as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as a,E as ae,z as ne}from"./fluent-icons-BqJj6rDi.js";import{a as p}from"./monaco-BIO15LCS.js";import{a as s,u as c,an as se,Z as le,ao as ie,ab as x,ai as re,ap as ce,d as de}from"./index-Di2_5czx.js";import{t,B as ue,b as I}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const pe=ne({backdrop:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"10vh"},palette:{width:"640px",maxWidth:"90vw",backgroundColor:t.colorNeutralBackground1,borderRadius:t.borderRadiusLarge,boxShadow:t.shadow64,overflow:"hidden"},searchRow:{display:"flex",alignItems:"center",padding:`${t.spacingVerticalM} ${t.spacingHorizontalM}`,borderBottom:`1px solid ${t.colorNeutralStroke1}`,gap:t.spacingHorizontalS},searchInput:{flex:1,border:"none",outline:"none",fontSize:t.fontSizeBase400,backgroundColor:"transparent"},results:{maxHeight:"400px",overflowY:"auto"},group:{paddingTop:t.spacingVerticalXS},groupLabel:{padding:`${t.spacingVerticalXXS} ${t.spacingHorizontalM}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,fontWeight:t.fontWeightSemibold,textTransform:"uppercase",letterSpacing:"0.08em"},item:{display:"flex",alignItems:"center",gap:t.spacingHorizontalS,padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,cursor:"pointer","&:hover":{backgroundColor:t.colorNeutralBackground1Hover}},itemSelected:{backgroundColor:t.colorNeutralBackground1Hover},itemLabel:{flex:1},itemSub:{color:t.colorNeutralForeground3,fontSize:t.fontSizeBase200},footer:{padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,borderTop:`1px solid ${t.colorNeutralStroke1}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,display:"flex",gap:t.spacingHorizontalL}}),ke=()=>{const l=pe(),S=s(e=>e.commandPaletteOpen),j=s(e=>e.setCommandPaletteOpen),D=s(e=>e.openBulkPublish),H=s(e=>e.openXmlDrawer),b=s(e=>e.openImportXml),O=s(e=>e.openCommandEditor),z=s(e=>e.openRuleEditor),P=s(e=>e.openNewGroup),W=s(e=>e.openNewButton),G=s(e=>e.openLocalizationEditor),E=s(e=>e.themeMode),V=s(e=>e.setThemeMode),F=c(e=>e.undo),U=c(e=>e.redo),q=c(e=>e.commands),K=c(e=>e.displayRules),Z=c(e=>e.enableRules),L=c(e=>e.ribbons),w=c(e=>e.locLabels),y=se(),A=le(e=>e.entities),Q=ie(e=>e.requestEntitySwitch),Y=x(e=>e.location),J=x(e=>e.tabId),m=x(e=>e.selectedButtonId),M=x(e=>e.selectedGroupId),[i,R]=p.useState(""),[C,u]=p.useState(0),B=p.useRef(null),n=p.useCallback(()=>{j(!1),R(""),u(0)},[j]);p.useEffect(()=>{S&&setTimeout(()=>B.current?.focus(),50)},[S]);const _=()=>{const e=[],r=L[Y].tabs.find(o=>o.id===J),te=r?.groups[0]?.id??null,N=M??te,X=re(ce(r?.groups.find(o=>o.id===M),m)?.kind),oe=[{id:"publish",label:"Publish all",subtitle:"Save and publish changes to Dataverse",kind:"action",action:()=>{D(),n()}},{id:"view-xml",label:"View RibbonDiffXml",subtitle:"Open XML drawer",kind:"action",action:()=>{H(),n()}},{id:"import-xml",label:"Import XML",subtitle:"Import RibbonDiffXml from clipboard",kind:"action",action:()=>{n();const o="Couldn't read the clipboard here: paste the XML into the editor (Ctrl+V).",g=navigator.clipboard?.readText?.();if(!g)return b("",o);g.then(k=>k.trim().startsWith("<")?b(k):b("","The clipboard doesn't hold XML: paste the XML into the editor."),()=>b("",o))}},{id:"new-group",label:"New group",subtitle:"Create a new ribbon group in current tab",kind:"action",action:()=>{P(),n()}},{id:"new-button",label:"New button",subtitle:N?"Create a new button in selected/current group":"Select a tab/group with at least one group first",kind:"action",action:()=>{N&&(W(N),n())}},{id:"edit-labels",label:"Edit localized labels",subtitle:X?"The selected control is shown read-only":m?"Open localization editor for selected button":"Select a button first",kind:"action",action:()=>{!m||X||(G(m),n())}},{id:"toggle-theme",label:`Toggle theme (${E==="dark"?"Dark":"Light"})`,subtitle:"Switch between light and dark",kind:"action",action:()=>{V(E==="dark"?"light":"dark"),n()}},{id:"undo",label:"Undo",subtitle:"Ctrl+Z",kind:"action",action:()=>{F(),n()}},{id:"redo",label:"Redo",subtitle:"Ctrl+Shift+Z",kind:"action",action:()=>{U(),n()}}];if(e.push(...oe),!i.startsWith("@")&&!i.startsWith("/")){const o=Object.entries(L).flatMap(([g,k])=>k.tabs.flatMap(v=>v.groups.flatMap($=>de($).map(d=>({id:`btn-${d.id}`,label:y(d.label,w,void 0,d.source?.labelToken)||d.id,subtitle:`${g} → ${y(v.label,w,void 0,v.source?.titleToken)} → ${y($.label,w,void 0,$.source?.titleToken)}`,keywords:`${d.label} ${d.id}`,kind:"button",action:()=>{n()}})))));e.push(...o.slice(0,20))}return q.forEach(o=>{e.push({id:`cmd-${o.id}`,label:o.id,subtitle:`${o.actions.length} action(s)`,kind:"command",action:()=>{O(o.id),n()}})}),K.forEach(o=>{e.push({id:`dr-${o.id}`,label:o.id,subtitle:`Display rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{z(o.id,"display"),n()}})}),Z.forEach(o=>{e.push({id:`er-${o.id}`,label:o.id,subtitle:`Enable rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{z(o.id,"enable"),n()}})}),(i.startsWith("@")||!i)&&A.slice(0,30).forEach(o=>{e.push({id:`ent-${o.logicalName}`,label:o.displayName,subtitle:o.logicalName,kind:"entity",action:()=>{Q(o),n()}})}),e},h=i.startsWith("@")||i.startsWith("/")?i.slice(1):i,T=_(),f=h?T.filter(e=>e.label.toLowerCase().includes(h.toLowerCase())||(e.subtitle??"").toLowerCase().includes(h.toLowerCase())||(e.keywords??"").toLowerCase().includes(h.toLowerCase())):T,ee=e=>{e.key==="ArrowDown"?(e.preventDefault(),u(r=>Math.min(r+1,f.length-1))):e.key==="ArrowUp"?(e.preventDefault(),u(r=>Math.max(r-1,0))):e.key==="Enter"?f[C]?.action():e.key==="Escape"&&n()};return S?a.jsx("div",{className:l.backdrop,onClick:n,role:"presentation",children:a.jsxs("div",{className:l.palette,onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[a.jsxs("div",{className:l.searchRow,children:[a.jsx(ae,{style:{color:t.colorNeutralForeground3,flexShrink:0}}),a.jsx("input",{ref:B,className:l.searchInput,value:i,onChange:e=>{R(e.target.value),u(0)},onKeyDown:ee,placeholder:"Search commands, buttons, entities… Use @ for entities, / for actions","aria-label":"Command palette search"})]}),a.jsxs("div",{className:l.results,role:"listbox",children:[f.map((e,r)=>a.jsxs("div",{className:`${l.item} ${r===C?l.itemSelected:""}`,onClick:e.action,role:"option","aria-selected":r===C,onMouseEnter:()=>u(r),children:[a.jsx(ue,{appearance:"outline",size:"small",children:e.kind}),a.jsxs("div",{className:l.itemLabel,children:[a.jsx(I,{children:e.label}),e.subtitle&&a.jsx(I,{className:l.itemSub,block:!0,children:e.subtitle})]})]},e.id)),f.length===0&&a.jsx("div",{className:l.item,children:a.jsx(I,{style:{color:t.colorNeutralForeground3},children:"No results"})})]}),a.jsxs("div",{className:l.footer,children:[a.jsx("span",{children:"↑↓ navigate"}),a.jsx("span",{children:"↵ select"}),a.jsx("span",{children:"Esc close"}),a.jsx("span",{children:"@ entities"}),a.jsx("span",{children:"/ actions"})]})]})}):null};export{ke as CommandPalette,ke as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as e,h as k,bK as C,b4 as D,z as B}from"./fluent-icons-BqJj6rDi.js";import{a as c}from"./monaco-BIO15LCS.js";import{a as u,u as I}from"./index-Di2_5czx.js";import{ai as M,aj as R,ak as H,aa as L,d as N,al as E,b as a,t as o,M as h,f as x,a5 as F,B as z,T as O}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";function $(){return window.dataverseAPI}function P(i){const l=i.map(s=>{const r=s.publisherid,d=s.versionnumber,m=typeof d=="number"?d:Number(d??0)||0;return{solutionId:String(s.solutionid??""),solutionName:String(s.friendlyname??s.uniquename??"Unknown Solution"),publisher:String(r?.friendlyname??r?.customizationprefix??"Unknown Publisher"),managed:!!s.ismanaged,importedOn:s.modifiedon?String(s.modifiedon):void 0,wins:!1,versionNumber:m}});return l.sort((s,r)=>s.versionNumber-r.versionNumber),l.length>0&&(l[l.length-1].wins=!0),l.map(({versionNumber:s,...r})=>r)}async function A(i){if(!i)return null;const r=(await $().getSolutions(["solutionid","friendlyname","uniquename","ismanaged","publisherid","versionnumber","modifiedon"])).value;return r.length<=1?null:{elementId:i,elementKind:"button",solutions:P(r)}}const T=B({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,padding:o.spacingHorizontalM,overflowY:"auto"},solutionRow:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalXS,padding:o.spacingHorizontalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},solutionRowWinner:{border:`2px solid ${o.colorBrandStroke1}`,backgroundColor:o.colorBrandBackground2},solutionHeader:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},elementId:{fontFamily:o.fontFamilyMonospace,fontSize:o.fontSizeBase200,backgroundColor:o.colorNeutralBackground4,padding:`2px ${o.spacingHorizontalXS}`,borderRadius:o.borderRadiusSmall,wordBreak:"break-all"}}),_=()=>{const i=T(),l=u(n=>n.conflictDrawerOpen),s=u(n=>n.conflictElementId),r=u(n=>n.closeConflictDrawer),d=u(n=>n.openXmlDrawer),m=I(n=>n.conflicts),[p,b]=c.useState(null),[j,f]=c.useState(!1),[v,g]=c.useState(null);c.useEffect(()=>{if(!l||!s){b(null),g(null),f(!1);return}let n=!1;return f(!0),g(null),A(s).then(t=>{n||b(t)}).catch(t=>{n||g(t instanceof Error?t.message:"Failed to load conflict layers")}).finally(()=>{n||f(!1)}),()=>{n=!0}},[l,s]);const w=m.filter(n=>n.elementId===s),y=c.useMemo(()=>p||w[0],[p,w]),S=y?[...y.solutions].sort((n,t)=>n.wins===t.wins?0:n.wins?1:-1):[];return e.jsxs(M,{className:i.drawer,open:l,position:"end",onOpenChange:(n,t)=>!t.open&&r(),children:[e.jsx(R,{children:e.jsx(H,{action:e.jsx(N,{appearance:"subtle",icon:e.jsx(k,{}),onClick:r,"aria-label":"Close"}),children:e.jsx(L,{children:"Solution Conflicts"})})}),e.jsx(E,{children:e.jsxs("div",{className:i.body,children:[s&&e.jsxs("div",{children:[e.jsx(a,{size:200,style:{color:o.colorNeutralForeground3},children:"Conflicting element:"}),e.jsx("div",{className:i.elementId,children:s})]}),e.jsx(h,{intent:"warning",children:e.jsx(x,{children:e.jsx(a,{size:200,children:"Multiple solutions customize this element. Dataverse applies them in solution import order — the most recently imported solution wins."})})}),e.jsx(h,{intent:"info",children:e.jsx(x,{children:e.jsxs(a,{size:200,children:[e.jsx("strong",{children:"To resolve:"})," Merge changes into one solution, or use solution layering to control evaluation order. Managed solutions appear as read-only layers — to resolve, merge the customization into your unmanaged solution."]})})}),j&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:o.spacingHorizontalM},children:e.jsx(F,{label:"Loading solution layers..."})}),v&&e.jsx(h,{intent:"error",children:e.jsx(x,{children:v})}),!j&&S.length===0&&e.jsx(a,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"No conflict details available from environment layers."}),S.map((n,t)=>e.jsxs("div",{className:`${i.solutionRow} ${n.wins?i.solutionRowWinner:""}`,children:[e.jsxs("div",{className:i.solutionHeader,children:[e.jsx(a,{weight:"semibold",children:n.solutionName}),n.wins&&e.jsx(z,{appearance:"filled",color:"brand",children:"WINS"}),n.managed&&e.jsx(O,{content:"Managed solution — read-only",relationship:"label",children:e.jsx(C,{style:{color:o.colorNeutralForeground3}})}),e.jsx(z,{appearance:"outline",size:"small",children:n.managed?"Managed":"Unmanaged"})]}),e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Publisher: ",n.publisher]}),n.importedOn&&e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Imported: ",new Date(n.importedOn).toLocaleString()]}),e.jsx("div",{style:{display:"flex",gap:o.spacingHorizontalS,flexWrap:"wrap"},children:e.jsx(N,{appearance:"subtle",size:"small",icon:e.jsx(D,{}),onClick:d,children:"View XML diff"})})]},`${n.solutionId}-${t}`))]})})]})};export{_ as ConflictDrawer,_ as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monaco-BIO15LCS.js","./monaco-DdLsZAcA.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{R as g,a as b,_ as H}from"./monaco-BIO15LCS.js";import{y as s,h as E,z as C}from"./fluent-icons-BqJj6rDi.js";import{a as x,u,g as N}from"./index-Di2_5czx.js";import{ai as O,aj as _,ak as V,aa as $,d as S,al as X,M as I,f as T,b as A,B as D,a5 as G,t as r}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const P=g.lazy(()=>H(()=>import("./monaco-BIO15LCS.js").then(n=>n.i),__vite__mapDeps([0,1]),import.meta.url).then(n=>({default:n.DiffEditor}))),W=["HomepageGrid","SubGrid","Form","Application"],U=C({drawer:{},body:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,overflow:"hidden",gap:r.spacingHorizontalS},statsBar:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,flexShrink:0},toggleRow:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,borderBottom:`1px solid ${r.colorNeutralStroke2}`,flexShrink:0},editorWrap:{flex:1,height:0,minHeight:"400px",overflow:"hidden",position:"relative"}});function F(n,o){const l=n.split(`
|
|
3
|
-
`),c=o.split(`
|
|
4
|
-
`);let d=0,a=0;const f=new Set(l),t=new Set(c);for(const i of c)f.has(i)||d++;for(const i of l)t.has(i)||a++;return{added:d,removed:a}}function B(n,o,l,c,d,a,f){const t=[];for(const i of W){const p=f?o[i]:n[i],m=o[i];try{t.push(`<!-- ${i} -->
|
|
5
|
-
`+N({location:i,current:p,baseline:m,commands:l,displayRules:c,enableRules:d,locLabels:a,entityLogicalName:p.entityLogicalName}))}catch(h){t.push(`<!-- ${i}: Error generating XML: ${String(h)} -->`)}}return t.join(`
|
|
6
|
-
|
|
7
|
-
`)}const Z=()=>{const n=U(),o=x(e=>e.diffViewerOpen),l=x(e=>e.diffViewerMode),c=x(e=>e.closeDiffViewer),d=x(e=>e.themeMode),[a,f]=g.useState(!0),t=u(e=>e.ribbons),i=u(e=>e.baseline),p=u(e=>e.commands),m=u(e=>e.displayRules),h=u(e=>e.enableRules),y=u(e=>e.locLabels),R=d==="dark",j=b.useMemo(()=>B(t,i,p,m,h,y,!0),[o]),w=b.useMemo(()=>B(t,i,p,m,h,y,!1),[o,t,i,p,m,h,y]),{added:k,removed:L}=F(j,w),v=g.useRef(null),z=g.useCallback(e=>{v.current=e,e.updateOptions({renderSideBySide:a})},[]);return g.useEffect(()=>{v.current?.updateOptions({renderSideBySide:a})},[a]),s.jsxs(O,{className:n.drawer,open:o,position:"end",size:"full",onOpenChange:(e,M)=>!M.open&&c(),children:[s.jsx(_,{children:s.jsx(V,{action:s.jsx(S,{appearance:"subtle",icon:s.jsx(E,{}),onClick:c,"aria-label":"Close"}),children:s.jsx($,{children:l==="compare"?"Compare to baseline":"Diff viewer"})})}),s.jsx(X,{style:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,overflow:"hidden"},children:s.jsxs("div",{className:n.body,children:[s.jsx(I,{intent:"info",children:s.jsx(T,{children:s.jsx(A,{size:200,children:l==="compare"?"Showing current state vs. last published baseline.":"Showing the change introduced by this history entry."})})}),s.jsxs("div",{className:n.toggleRow,children:[s.jsxs(D,{appearance:"tint",color:"success",children:["+",k," lines"]}),s.jsxs(D,{appearance:"tint",color:"danger",children:["-",L," lines"]}),s.jsx("div",{style:{flex:1}}),s.jsx(S,{appearance:a?"primary":"subtle",size:"small",onClick:()=>f(!0),children:"Side by side"}),s.jsx(S,{appearance:a?"subtle":"primary",size:"small",onClick:()=>f(!1),children:"Unified"})]}),s.jsx("div",{className:n.editorWrap,children:s.jsx(b.Suspense,{fallback:s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:s.jsx(G,{size:"medium",label:"Loading diff editor…"})}),children:s.jsx(P,{original:j,modified:w,language:"xml",theme:R?"vs-dark":"vs",height:"100%",onMount:z,options:{readOnly:!0,renderSideBySide:a,lineNumbers:"on",minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:"on"}})})})]})})]})};export{Z as DiffViewer,Z as default};
|