@mohsinonxrm/pptb-commandbar-studio 0.6.2 → 0.7.0-beta.1

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +24 -1
  3. package/SECURITY.md +5 -2
  4. package/dist/assets/BulkPublishModal-CF7sSmBT.js +29 -0
  5. package/dist/assets/CommandEditorPanel-1tDOtoTt.js +1 -0
  6. package/dist/assets/CommandPalette-BBM1PJH0.js +1 -0
  7. package/dist/assets/{ConflictDrawer-BFlon1xn.js → ConflictDrawer-CjObt6DP.js} +1 -1
  8. package/dist/assets/{CrmParameterEditor-B84bdjcT.js → CrmParameterEditor-CQD0gNNH.js} +1 -1
  9. package/dist/assets/{DiffViewer-JSOMstAl.js → DiffViewer-Dfu_9b4v.js} +2 -2
  10. package/dist/assets/{HideInsteadOfDeleteModal-DYsP_BRs.js → HideInsteadOfDeleteModal-C64qc-fw.js} +1 -1
  11. package/dist/assets/IconPickerModal-D6hQ_Aqx.js +1 -0
  12. package/dist/assets/ImportXmlModal-DXwUce5n.js +1 -0
  13. package/dist/assets/{LocalizationEditor-SeIMV_0G.js → LocalizationEditor-DXqbD2ZN.js} +1 -1
  14. package/dist/assets/{MonacoEditor-DakCq511.js → MonacoEditor-CBUJNFgC.js} +2 -2
  15. package/dist/assets/NewButtonModal-B_ugATAS.js +1 -0
  16. package/dist/assets/NewGroupModal-Dvg8CSJr.js +1 -0
  17. package/dist/assets/NewTabModal-CjMNMXb5.js +1 -0
  18. package/dist/assets/{RuleEditorPanel-BmI_wJKH.js → RuleEditorPanel-B5or3M9d.js} +1 -1
  19. package/dist/assets/ScalingEditorPanel-CzQtkicj.js +1 -0
  20. package/dist/assets/TabDisplayRulesPanel-BqzSpzqp.js +1 -0
  21. package/dist/assets/{UrlComposerModal-gVBqcCZd.js → UrlComposerModal-BDP57HQn.js} +1 -1
  22. package/dist/assets/WebResourceBrowser-BK_G_Q_c.js +1 -0
  23. package/dist/assets/XmlDrawer-C4lJ7_MF.js +2 -0
  24. package/dist/assets/codicon-DF1abBS2.ttf +0 -0
  25. package/dist/assets/{css.worker-DBVD8oXr.js → css.worker-C_6RgliQ.js} +37 -33
  26. package/dist/assets/cssMode-yNaVDuBb.js +1 -0
  27. package/dist/assets/{dnd-vmvAsOrM.js → dnd-BmqIZ1-i.js} +1 -1
  28. package/dist/assets/editor.worker-D1TDBLlL.js +30 -0
  29. package/dist/assets/{fluent-icons-4bzebHz-.js → fluent-icons-DUgjkNjy.js} +1 -1
  30. package/dist/assets/{fluent-ui-lAhdF0Ck.js → fluent-ui-Dde22_ZN.js} +2 -2
  31. package/dist/assets/{freemarker2-DpL6dihh.js → freemarker2-CzWSO7cF.js} +3 -3
  32. package/dist/assets/{handlebars-ChRbmRjV.js → handlebars-BpG2O9CH.js} +1 -1
  33. package/dist/assets/{html-Bt7ZeSoE.js → html-Bm7ESfBq.js} +1 -1
  34. package/dist/assets/{html.worker-CwpTb9lJ.js → html.worker-CLyYFd_g.js} +53 -49
  35. package/dist/assets/htmlMode--CmpAV7s.js +1 -0
  36. package/dist/assets/index-CL8TmfXp.js +139 -0
  37. package/dist/assets/{javascript-Bu0Wr1JA.js → javascript-DYy3TIq5.js} +1 -1
  38. package/dist/assets/json.worker-BggoxaER.js +62 -0
  39. package/dist/assets/{jsonMode-Bc_oOneo.js → jsonMode-DwsyQ3o1.js} +4 -4
  40. package/dist/assets/{liquid-Cj1v6MBK.js → liquid-qkuWCPaY.js} +1 -1
  41. package/dist/assets/{lspLanguageFeatures-CbQqhnvj.js → lspLanguageFeatures-Cgd9CNvq.js} +1 -1
  42. package/dist/assets/{mdx-E7c9inFC.js → mdx-CtHfOclF.js} +1 -1
  43. package/dist/assets/monaco-BIO15LCS.js +1005 -0
  44. package/dist/assets/monaco-DdLsZAcA.css +1 -0
  45. package/dist/assets/{python-C7ICMPw1.js → python-CazlH6B-.js} +1 -1
  46. package/dist/assets/{razor-xjSsEwAN.js → razor-BfGfB6aB.js} +1 -1
  47. package/dist/assets/{server.browser-BZYwcDL4.js → server.browser-xEJRzS2D.js} +1 -1
  48. package/dist/assets/{ts.worker-BH9nVgjN.js → ts.worker-BrLZGe_E.js} +225 -221
  49. package/dist/assets/{tsMode-XBeIdV9f.js → tsMode-BZv6gTt6.js} +3 -3
  50. package/dist/assets/{typescript-sgsLltTO.js → typescript-BgDL1fzP.js} +1 -1
  51. package/dist/assets/useReplaceWebResourceConfirm-Dx7RdpEN.js +1 -0
  52. package/dist/assets/workers-BZ4mXA5s.js +1 -0
  53. package/dist/assets/{xml-DFgHgBBL.js → xml-Cl6spsD4.js} +1 -1
  54. package/dist/assets/xmlValidator-DvDaU5OO.js +3 -0
  55. package/dist/assets/{yaml-DWfXsscO.js → yaml-El-x4GhS.js} +1 -1
  56. package/dist/icons/icon.svg +7 -4
  57. package/dist/index.html +6 -6
  58. package/package.json +3 -3
  59. package/dist/assets/BulkPublishModal-mFfxdo1T.js +0 -29
  60. package/dist/assets/CommandEditorPanel-_mV9SqAb.js +0 -1
  61. package/dist/assets/CommandPalette-CK3uU6Ky.js +0 -1
  62. package/dist/assets/IconPickerModal-BF3KU0Ux.js +0 -1
  63. package/dist/assets/ImportXmlModal-BYj1QmDX.js +0 -1
  64. package/dist/assets/NewButtonModal-D3iJDvUq.js +0 -1
  65. package/dist/assets/NewGroupModal-Cfywgyga.js +0 -1
  66. package/dist/assets/NewTabModal-DGNwUnJ5.js +0 -1
  67. package/dist/assets/ScalingEditorPanel-VCqXvcQy.js +0 -1
  68. package/dist/assets/TabDisplayRulesPanel-D26HGtKC.js +0 -1
  69. package/dist/assets/WebResourceBrowser-Hrw1yujP.js +0 -1
  70. package/dist/assets/XmlDrawer-lnZmbePV.js +0 -2
  71. package/dist/assets/codicon-ngg6Pgfi.ttf +0 -0
  72. package/dist/assets/cssMode-BGIqMXMp.js +0 -1
  73. package/dist/assets/editor.worker-1APKdqmi.js +0 -26
  74. package/dist/assets/htmlMode-Uz2nWy9x.js +0 -1
  75. package/dist/assets/index-B2t4gwW0.js +0 -139
  76. package/dist/assets/json.worker-BoL8UZqY.js +0 -58
  77. package/dist/assets/monaco-BoSoLy50.js +0 -919
  78. package/dist/assets/monaco-Dprb6f6S.css +0 -1
  79. package/dist/assets/webResourceService-DGt6sRPR.js +0 -1
  80. package/dist/assets/xmlValidator-D-tVo-1Z.js +0 -3
@@ -1 +0,0 @@
1
- import{z as l}from"./fluent-icons-4bzebHz-.js";import{a as X}from"./monaco-BoSoLy50.js";import{a1 as Te,x as Be,a2 as He,a3 as ze,a4 as Fe,a5 as _e,a6 as Pe,a as ae,u as Ue,X as We,b as Je}from"./index-B2t4gwW0.js";import{a as Ye}from"./xmlValidator-D-tVo-1Z.js";import{M as Ke}from"./MonacoEditor-DakCq511.js";import{D as Ve,h as Qe,i as Ze,j as et,k as tt,T as De,M,e as q,ap as le,l as ot,B as Z}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";import"./ruleKinds-B9hACGaq.js";import"./crmParameters-rgfZhhzN.js";const fe=["HomepageGrid","SubGrid","Form"],ce=[...fe,"Application"],de=new Set(["Button","FlyoutAnchor","SplitButton","TextBox","ComboBox","CheckBox"]),ue=new Set(["flyout","splitButton"]),pe=/^Mscrm\.(HomepageGrid|SubGrid|Form)\.([^.]+)\./,Ie="._children",nt=/<(EnableRule|DisplayRule)\b[^>]*?\sId="([^"]+)"/,me=/\$LocLabels:([^"'\s<]+)/g,Le="cbs.import.Tab",st="cbs.import.Group",ve=(a,g)=>JSON.stringify(a)===JSON.stringify(g);function O(a){return a?Array.from(a.children):[]}function it(a){return Object.fromEntries(Array.from(a.attributes).map(g=>[g.name,g.value]))}function rt(a,g,c){const m=a.documentElement;if(m.tagName==="RibbonDiffXml")return m;const S=Array.from(a.getElementsByTagName("RibbonDiffXml")),A=Array.from(a.querySelectorAll("Entities > Entity")).flatMap(r=>{const $=O(r),N=$.find(L=>L.tagName==="RibbonDiffXml"),w=$.find(L=>L.tagName==="Name")?.textContent?.trim()??"";return N?[{name:w,rdx:N}]:[]}),R=S.find(r=>r.parentElement===m);if(A.length===0&&!R){if(S.length===1)return S[0];throw new Error(S.length===0?"No <RibbonDiffXml> element found.":`The XML has ${S.length} <RibbonDiffXml> elements and none belongs to a table or the application ribbon — paste just one.`)}const I=[...A.map(r=>r.name||"(unnamed table)"),...R?["the application ribbon"]:[]].join(", ");if(c){if(R)return R;throw new Error(`The XML has no application ribbon RibbonDiffXml (it has: ${I}). Open that table's ribbon to import its customizations.`)}const y=A.find(r=>r.name.toLowerCase()===g.toLowerCase());if(y)return y.rdx;throw new Error(`The XML has no RibbonDiffXml for ${g||"the loaded table"} (it has: ${I}). Load that table, or open the application ribbon for the application ribbon's customizations.`)}function at(a){switch(a){case"HomePageGrid":return"HomepageGrid";case"Form":return"Form";case"SubGridStandard":case"SubGridAssociated":return"SubGrid";default:return}}function lt(a){const g=a.languageCode??1033,c=a.entityLogicalName,m=new DOMParser().parseFromString(a.xml,"application/xml");if(m.querySelector("parsererror"))throw new Error("The XML is not well-formed.");const S=a.activeLocation==="Application",A=rt(m,c,S),R=new XMLSerializer,I=R.serializeToString(A),y=[],r=[],$=[],N=!!c&&new RegExp(`Mscrm\\.(HomepageGrid|SubGrid|Form)\\.${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\.`,"i").test(I),w=S&&!(A===m.documentElement&&N);A!==m.documentElement?$.push(`Imported the RibbonDiffXml of ${w?"the application ribbon":c} from the document.`):S&&!w&&$.push(`The XML's Locations name the ${c} table, so it was imported as that table's customizations, not the application ribbon's.`);const L=w?"Application":fe.includes(a.activeLocation)?a.activeLocation:"HomepageGrid",v=Te(I,a.activeLocation,c),x=(e,t,o)=>{const s=new Map,n=new Map;for(const f of t)s.set(f.id,f),n.set(f.id,(n.get(f.id)??0)+1);for(const[f,b]of n)b>1&&$.push(`${o} ${f} is defined ${b} times in the XML — the last one was used.`);const u=Array.from(s.values()),i=[...e],p=[];let h=0;for(const f of u){const b=i.findIndex(T=>T.id===f.id);if(b>=0&&ve(i[b],f)){h++;continue}y.push(`${o} ${f.id} ${b>=0?"updated":"added"}`),b>=0?i[b]=f:i.push(f),p.push(f.id)}return{out:i,changedIds:p,unchanged:h}},d=x(a.commands,v.commands,"Command"),C=x(a.enableRules,v.enableRules,"Enable rule"),k=x(a.displayRules,v.displayRules,"Display rule"),B=x(a.locLabels,v.locLabels,"Label"),H=B.out,be=d.unchanged+C.unchanged+k.unchanged+B.unchanged,G=(e,t)=>e&&Pe(e,H,g)||t,D=JSON.parse(JSON.stringify(a.ribbons));let j=!1,z=0;const ee=new Set,te=e=>{if(w)return ce.slice().reverse();const t=pe.exec(e),o=t&&t[2]!=="{!EntityLogicalName}"?t[1]:L;return[o,...fe.filter(s=>s!==o),"Application"]},F=(e,t)=>{w&&e!=="Application"?$.push(`${t} is on the table's ribbon (${e}), not the application ribbon: the change is published with the table.`):!w&&e==="Application"&&$.push(`${t} was found only on the application ribbon: the change is published to the application ribbon and affects every table.`)},oe=[],E=(e,t)=>{e&&e!==t&&oe.push(e)},_=e=>{for(const t of te(e))for(const o of D[t].tabs){const s=o.groups.find(n=>n.id===e);if(s)return{location:t,tab:o,group:s}}},P=e=>{for(const t of te(e)){const o=D[t].tabs.find(s=>s.id===e);if(o)return{location:t,tab:o}}},U=e=>{for(const t of te(e)){const o=[];for(const s of D[t].tabs)for(const n of s.groups)for(const u of n.buttons)u.id===e&&o.push({group:n,button:u});if(o.length>0)return{location:t,found:o}}},W=(e,t)=>{const o=pe.exec(t);let s="it isn't in the loaded ribbon";o&&o[2]!=="{!EntityLogicalName}"&&c&&o[2]!==c?s=`it belongs to the ${o[2]} table, but ${c} is loaded`:(o?.[2]==="{!EntityLogicalName}"||t.startsWith("Mscrm.Global"))&&(s="it belongs to the application ribbon, which isn't loaded with it"),r.push(`${e}: Location "${t}" not found — ${s}.`)},je=O(A.querySelector(":scope > RuleDefinitions > TabDisplayRules")).map(e=>R.serializeToString(e)).join(""),ne=e=>Te(`<RibbonDiffXml><UI><Ribbon><Tabs>${e}</Tabs></Ribbon></UI><RuleDefinitions><TabDisplayRules>${je}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`,a.activeLocation,c,H).ribbon.tabs[0],J=e=>R.serializeToString(e),ge=e=>ne(`<Tab Id="${Le}"><Groups><Group Id="${st}"><Controls>${J(e)}</Controls></Group></Groups></Tab>`)?.groups[0]?.buttons.find(t=>t.id===e.getAttribute("Id")),ye=e=>{const t=e.source;t&&(e.label=G(t.labelToken,e.id),t.tooltipTitleToken&&(e.tooltipTitle=G(t.tooltipTitleToken,"")),t.tooltipBodyToken&&(e.tooltipBody=G(t.tooltipBodyToken,"")))},Y=e=>{for(const t of e.source?.xml?[e.source.xml]:Object.values(e.source?.attributes??{}))for(const[,o]of t.matchAll(me))H.some(s=>s.id===o)||r.push(`${e.id}: references label ${o}, which neither the XML nor the loaded ribbon defines — add its <LocLabel> or the publish will fail.`)},$e=e=>({titleToken:e.getAttribute("Title")??void 0,attributes:it(e)}),xe=(e,t)=>(_e(e,{origin:"unmanaged"}),e.hidden=!1,t!==void 0&&!e.source?.attributes.Sequence&&(e.sequence=t),ye(e),Y(e),e),se=e=>r.push(`${e}: flyout / split buttons and their menus can't be imported yet (#27).`),Ne=(e,t)=>{const o=new Set(Array.from(e.querySelectorAll("Menu *")).map(n=>n.getAttribute("Id")).filter(n=>!!n)),s=[];for(const n of t?.buttons??[])o.has(n.id)||(ue.has(n.kind)?se(n.id):s.push(xe(n)));return s},K=(e,t)=>{const o=e.findIndex(s=>s.sequence>t.sequence);e.splice(o<0?e.length:o,0,t)},Ae=(e,t,o)=>{const s=U(e),n=ge(t);if(!s||!n)return!1;ye(n),Y(n),F(s.location,e);for(const{group:u,button:i}of s.found){if(n.kind!==i.kind)return r.push(`${e}: changing a <${t.tagName}> into another kind of control isn't supported.`),!0;if(ue.has(i.kind))return se(e),!0;const p=JSON.parse(JSON.stringify(i));Object.assign(i,{label:n.label,tooltipTitle:n.tooltipTitle,tooltipBody:n.tooltipBody,icon:n.icon,image16:n.image16,image32:n.image32,commandId:n.commandId,templateAlias:n.templateAlias||i.templateAlias,source:structuredClone(n.source)});const h=n.source?.attributes.Sequence?n.sequence:o;h!==void 0&&h!==i.sequence&&(i.origin==="unmanaged"?(u.buttons.splice(u.buttons.indexOf(i),1),i.sequence=h,K(u.buttons,i)):r.push(`${e}: Sequence ${h} not applied — only your own buttons can be re-ordered.`)),Fe(p,i)||p.sequence!==i.sequence?(j=!0,y.push(`Updated ${i.label} (${e}) on ${s.location}`),n.templateAlias||$.push(`${e}: the override has no TemplateAlias — ${i.templateAlias} from the loaded control is kept.`)):(Object.assign(i,p),ve(p.source?.attributes,n.source?.attributes)?z++:r.push(`${e}: the override only changes attributes CBS doesn't publish yet (label, tooltip, icon, command and template alias are).`))}return!0},Se=(e,t,o,s)=>{const n=t.getAttribute("Id");if(!n)return r.push(`CustomAction ${e.getAttribute("Id")}: the control has no Id.`);const u=U(n);if(u){u.found.some(h=>h.group.id===o)||r.push(`${n}: already in group ${u.found[0].group.id} — updated there, not moved to ${o}.`),Ae(n,t,s)&&E(e.getAttribute("Id"),`${n}.Override.CustomAction`);return}const i=_(o);if(!i)return W(`${n}`,e.getAttribute("Location")??"");const p=ge(t);if(!p)return r.push(`${n}: couldn't read the <${t.tagName}>.`);if(ue.has(p.kind))return se(n);K(i.group.buttons,xe(p,s)),F(i.location,n),E(e.getAttribute("Id"),`${n}.CustomAction`),j=!0,y.push(`Added ${p.label} (${n}) to ${i.group.id} on ${i.location}`)},Ce=(e,t)=>{const o=ne(`<Tab Id="${Le}"><Groups>${J(e)}</Groups></Tab>`)?.groups[0];if(!o)return;const s=$e(e);return Y({id:o.id,source:s}),{...o,label:G(s.titleToken,o.id),source:s,sequence:e.getAttribute("Sequence")===null?t??o.sequence:o.sequence,buttons:Ne(e,o)}},Ee=(e,t,o,s)=>{const n=t.getAttribute("Id");if(!n)return r.push(`CustomAction ${e.getAttribute("Id")}: the group has no Id.`);if(_(n)){r.push(`Group ${n} already exists — it was left as is (re-titling groups isn't supported).`);for(const h of O(t.querySelector(":scope > Controls")))de.has(h.tagName)?Se(e,h,n,void 0):He(ze[h.tagName])&&r.push(`${h.getAttribute("Id")??"(no Id)"}: adding a <${h.tagName}> to an existing group isn't supported — Command Bar Studio shows it read-only.`);return}const i=P(o);if(!i)return W(`Group ${n}`,e.getAttribute("Location")??"");const p=Ce(t,s);if(!p)return r.push(`Group ${n}: couldn't read the <Group>.`);K(i.tab.groups,p),F(i.location,n),E(e.getAttribute("Id"),`${n}.CustomAction`),j=!0,y.push(`Added group ${p.label} (${n}) with ${p.buttons.length} control(s) to ${o} on ${i.location}`)},Oe=(e,t,o)=>{const s=t.getAttribute("Id");if(!s)return r.push(`CustomAction ${e.getAttribute("Id")}: the tab has no Id.`);if(P(s))return r.push(`Tab ${s} already exists — it was left as is.`);const n=ne(J(t));if(!n)return r.push(`Tab ${s}: couldn't read the <Tab>.`);const u=n.tabDisplayRules.flatMap(T=>T.rules.map(we=>we.kind==="EntityRule"?at(we.context):void 0)),i=w?"Application":u.find(T=>!!T)??pe.exec(s)?.[1]??L,h=Array.from(t.querySelectorAll(":scope > Groups > Group")).map(T=>Ce(T,void 0)).filter(T=>!!T),f=$e(t);Y({id:s,source:f});const b={...n,label:G(f.titleToken,s),source:f,sequence:t.getAttribute("Sequence")===null?o??n.sequence:n.sequence,groups:h};K(D[i].tabs,b),E(e.getAttribute("Id"),`${s}.CustomAction`),b.commandId&&(ee.add(b.commandId),d.out.some(T=>T.id===b.commandId)||(d.out.push({id:b.commandId,enableRules:[],displayRules:[],actions:[]}),d.changedIds.push(b.commandId),$.push(`Tab ${s}: its Command ${b.commandId} has no CommandDefinition in the XML — an empty one was added.`))),j=!0,y.push(`Added tab ${b.label} (${s}) with ${h.length} group(s) to ${i}`),t.querySelector(":scope > Scaling > Scale")&&r.push(`Tab ${s}: its <Scale> steps weren't imported — CBS writes a default MaxSize for each group.`)},Ge=e=>{const t=e.getAttribute("Location")??"",o=U(t);if(o){const s=o.found.filter(n=>!n.button.hidden);for(const n of s)n.button.hidden=!0;s.length>0?(F(o.location,t),E(e.getAttribute("HideActionId"),`${t}.HideAction`),j=!0,y.push(`Hid ${s[0].button.label} (${t}) on ${o.location}`)):z++;return}if(_(t)||P(t))return r.push(`Hiding ${t}: hiding whole groups or tabs isn't supported yet — hide their buttons.`);r.push(`Hiding ${t}: not found in the loaded ribbon (it may belong to another table, or already be hidden by your customizations).`)},Xe=e=>{const t=e.getAttribute("Id")??"(no Id)",o=e.getAttribute("Location")??"",s=e.getAttribute("Sequence"),n=s===null?void 0:parseInt(s,10),u=O(e.querySelector(":scope > CommandUIDefinition"))[0];if(!u)return r.push(`CustomAction ${t}: no <CommandUIDefinition> content.`);const i=u.tagName;if(o.endsWith(Ie)){const p=o.slice(0,-Ie.length);return p.endsWith(".Controls")&&de.has(i)?Se(e,u,p.slice(0,-9),n):p.endsWith(".Groups")&&i==="Group"?Ee(e,u,p.slice(0,-7),n):p==="Mscrm.Tabs"&&i==="Tab"?Oe(e,u,n):p.endsWith(".Scaling")&&(i==="MaxSize"||i==="Scale")?r.push(`CustomAction ${t}: <${i}> scaling isn't imported — CBS writes a default MaxSize for each new group.`):r.push(`CustomAction ${t}: a <${i}> at "${o}" isn't supported.`)}if(de.has(i)&&u.getAttribute("Id")===o){if(Ae(o,u,n)){E(t,`${o}.Override.CustomAction`);return}return W(`Override ${t}`,o)}return U(o)||_(o)||P(o)?r.push(`CustomAction ${t}: replacing ${o} with a <${i}> isn't supported — only overriding a control with the same Id is.`):W(`CustomAction ${t}`,o)},Me=O(A.querySelector(":scope > CustomActions"));for(const e of Me)e.tagName==="CustomAction"?Xe(e):e.tagName==="HideCustomAction"?Ge(e):r.push(`<${e.tagName}> in CustomActions isn't supported.`);const V=new Set;for(const e of ce)for(const t of D[e].tabs)for(const o of t.groups)for(const s of o.buttons)for(const n of Be(s))V.add(n);for(const e of ee)V.add(e);const ie=new Set,re=new Set;for(const e of d.out)if(V.has(e.id)){e.enableRules.forEach(t=>ie.add(t)),e.displayRules.forEach(t=>re.add(t));for(const t of e.rawRuleRefs??[]){const o=nt.exec(t.xml);o&&(o[1]==="EnableRule"?ie:re).add(o[2])}}const Q=(e,t,o,s)=>{for(const n of e)t.has(n)||r.push(`${o} ${n} was imported but ${s}, so it won't be published.`)};Q(d.changedIds,V,"Command","no button on the loaded ribbon uses it"),Q(C.changedIds,ie,"Enable rule","no command a button uses references it"),Q(k.changedIds,re,"Display rule","no command a button uses references it");const Re=new Set(Array.from(J(A).matchAll(me),e=>e[1]));for(const e of ce)for(const t of D[e].tabs)for(const o of t.groups)for(const s of o.buttons)for(const n of Object.values(s.source?.attributes??{}))for(const u of n.matchAll(me))Re.add(u[1]);Q(B.changedIds,Re,"Label","nothing references it");const qe=Array.from(A.querySelectorAll(":scope > RuleDefinitions > TabDisplayRules > TabDisplayRule"));for(const e of qe){const t=e.getAttribute("TabCommand")??"";ee.has(t)||r.push(`TabDisplayRule for ${t}: only the display rules of tabs this import adds are imported.`);const o=O(e).filter(s=>s.tagName!=="EntityRule"&&s.tagName!=="PageRule");o.length>0&&r.push(`TabDisplayRule for ${t}: ${o.map(s=>`<${s.tagName}>`).join(", ")} not imported — only EntityRule and PageRule are supported.`)}oe.length>0&&$.push(`Ids normalised: CBS publishes CustomAction / HideCustomAction ids as {control}.CustomAction, {control}.Override.CustomAction and {control}.HideAction, so ${oe.join(", ")} will be written under those ids.`),be+z>0&&y.push(`${be+z} control(s) / definition(s) were already up to date`);const ke=j||d.changedIds.length+C.changedIds.length+k.changedIds.length+B.changedIds.length>0;return{ribbons:j?D:a.ribbons,commands:d.out,enableRules:C.out,displayRules:k.out,locLabels:H,applied:y,notApplied:r,notes:$,changed:ke}}function ct(a,g){const c=Ue.getState(),m=lt({xml:a,ribbons:c.ribbons,commands:c.commands,enableRules:c.enableRules,displayRules:c.displayRules,locLabels:c.locLabels,entityLogicalName:Je.getState().activeEntity?.logicalName??c.ribbons.HomepageGrid.entityLogicalName,activeLocation:We.getState().location,languageCode:c.baseLanguageCode});return g&&m.changed&&c.applyImport(m,`${m.applied.length} change(s)`),m}const he=({items:a})=>l.jsx("ul",{style:{margin:"4px 0 0",paddingLeft:"20px",maxHeight:"160px",overflowY:"auto"},children:a.map((g,c)=>l.jsx("li",{children:l.jsx(De,{size:200,children:g})},c))}),$t=()=>{const a=ae(d=>d.importXmlOpen),g=ae(d=>d.importXmlSeed),c=ae(d=>d.closeImportXml),[m,S]=X.useState(""),[A,R]=X.useState([]),[I,y]=X.useState(null),[r,$]=X.useState("");X.useEffect(()=>{a&&(S(g),R([]),y(null),$(""))},[a,g]);const N=d=>{S(d),I?.imported||y(null)},w=()=>{const d=Ye(m);return R(d),d.every(C=>C.severity==="warning")},L=d=>{if(w()){$("");try{y({result:ct(m,d),imported:d})}catch(C){y(null),$(C instanceof Error?C.message:String(C))}}},v=I?.imported===!0,x=I?.result;return l.jsx(Ve,{open:a,onOpenChange:()=>c(),children:l.jsxs(Qe,{style:{maxWidth:"960px",width:"92vw",height:"80vh",maxHeight:"860px"},children:[l.jsx(Ze,{children:"Import RibbonDiffXml"}),l.jsxs(et,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[l.jsxs(tt,{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:"8px"},children:[l.jsx(De,{size:200,children:"Paste a RibbonDiffXml (for example from Ribbon Workbench or a solution's customizations.xml — the loaded table's part is used, or the application ribbon's when that is on screen). Commands, rules and labels are added or replaced by id; new buttons, groups and tabs are added to the loaded ribbon; overrides and hides edit the existing controls. Everything imported becomes one unpublished change, which Undo takes back as a whole."}),l.jsx("div",{style:{flex:1,minHeight:0},children:l.jsx(Ke,{language:"xml",value:m,onChange:N,readOnly:v,height:"100%",options:{wordWrap:"on",lineNumbers:"on",padding:{top:8}}})}),A.length>0&&l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:A.map((d,C)=>l.jsx(M,{intent:d.severity==="warning"?"warning":"error",children:l.jsxs(q,{children:[d.message,d.lineHint?` (${d.lineHint})`:""]})},C))}),r&&l.jsx(M,{intent:"error",children:l.jsx(q,{children:r})}),x&&l.jsx(M,{intent:x.changed?"success":"info",layout:"multiline",children:l.jsxs(q,{children:[l.jsx(le,{children:v?x.changed?"Imported — review the changes, then publish":"Nothing to import — the session already has all of it":"Preview — nothing has changed yet"}),x.applied.length>0&&l.jsx(he,{items:x.applied})]})}),x&&x.notes.length>0&&l.jsx(M,{intent:"info",layout:"multiline",children:l.jsxs(q,{children:[l.jsx(le,{children:"Good to know"}),l.jsx(he,{items:x.notes})]})}),x&&x.notApplied.length>0&&l.jsx(M,{intent:"warning",layout:"multiline",children:l.jsxs(q,{children:[l.jsx(le,{children:v?"Not imported / won't be published":"Can't be imported / won't be published"}),l.jsx(he,{items:x.notApplied})]})})]}),l.jsx(ot,{children:v?l.jsx(Z,{appearance:"primary",onClick:c,children:"Close"}):l.jsxs(l.Fragment,{children:[l.jsx(Z,{appearance:"secondary",onClick:c,children:"Cancel"}),l.jsx(Z,{appearance:"secondary",onClick:()=>L(!1),disabled:!m.trim(),children:"Preview"}),l.jsx(Z,{appearance:"primary",onClick:()=>L(!0),disabled:!m.trim(),children:"Import"})]})})]})]})})};export{$t as ImportXmlModal,$t as default};
@@ -1 +0,0 @@
1
- import{z as e}from"./fluent-icons-4bzebHz-.js";import{a as S}from"./monaco-BoSoLy50.js";import{a as B,u as i,X as b,b as p,e as O,Y as z,c as G}from"./index-B2t4gwW0.js";import{D as K,h as Y,i as _,j as q,k as M,F as C,I as U,S as X,T as $,l as H,B as I}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const tt=()=>{const n=B(t=>t.newButtonGroupId),l=B(t=>t.closeNewButton),v=i(t=>t.createButton),w=i(t=>t.upsertCommand),y=i(t=>t.batch),N=b(t=>t.selectButtonInContext),D=p(t=>t.publisherPrefix),E=p(t=>t.activeSolution),s=b(t=>t.location),T=b(t=>t.tabId),k=p(t=>t.activeEntity),R=n!==null,[r,m]=S.useState("New Button"),[h,x]=S.useState("button"),F=()=>{if(!n||!s)return;const t=E?.publisherPrefix?.trim()||D?.trim()||"new",a=k?.logicalName??"global",c=i.getState().ribbons,L=i.getState().commands,f=new Set(L.map(o=>o.id));for(const o of Object.values(c))for(const d of o.tabs)for(const P of d.groups)for(const A of O(P))f.add(A.id);const{id:g,commandId:j}=z(t,a,s,r,f),u=c[s].tabs.find(o=>o.groups.some(d=>d.id===n))?.id??T;if(!c[s].tabs.some(o=>o.id===u)){G.getState().logError("canvas",`Could not add the button: group ${n} was not found.`),l();return}y(()=>{v({location:s,tabId:u,groupId:n,button:{id:g,label:r,kind:h,templateAlias:"o1",commandId:j,hidden:!1,oob:!1,custom:!0,managed:!1}}),w({id:j,enableRules:[],displayRules:[],actions:[]})}),N(s,u,n,g),m("New Button"),x("button"),l()};return e.jsx(K,{open:R,onOpenChange:()=>l(),children:e.jsxs(Y,{children:[e.jsx(_,{children:"New button"}),e.jsxs(q,{children:[e.jsxs(M,{children:[e.jsx(C,{label:"Label",required:!0,children:e.jsx(U,{value:r,onChange:(t,a)=>m(a.value),autoFocus:!0})}),e.jsx(C,{label:"Kind",children:e.jsxs(X,{value:h,onChange:(t,a)=>x(a.value),children:[e.jsx("option",{value:"button",children:"Button"}),e.jsx("option",{value:"flyout",children:"Flyout anchor"}),e.jsx("option",{value:"splitButton",children:"Split button"})]})}),e.jsx($,{size:200,style:{display:"block",marginTop:"8px"},children:"A command definition will be created automatically. You can edit it in the Command Editor."})]}),e.jsxs(H,{children:[e.jsx(I,{appearance:"secondary",onClick:l,children:"Cancel"}),e.jsx(I,{appearance:"primary",onClick:F,disabled:!r.trim(),children:"Create button"})]})]})]})})};export{tt as NewButtonModal,tt as default};
@@ -1 +0,0 @@
1
- import{z as e}from"./fluent-icons-4bzebHz-.js";import{a as u}from"./monaco-BoSoLy50.js";import{a as p,u as g,X as d}from"./index-B2t4gwW0.js";import{D as v,h as y,i as w,j as G,k as C,F as x,I as F,S as L,T as S,l as f,B as h}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const z=()=>{const b=p(o=>o.newGroupOpen),a=p(o=>o.closeNewGroup),j=g(o=>o.createGroup),s=d(o=>o.location),n=d(o=>o.tabId),[t,r]=u.useState("New Group"),[i,c]=u.useState("Flexible2"),m=()=>{!s||!n||(j({location:s,tabId:n,group:{label:t,template:i,buttons:[]}}),r("New Group"),c("Flexible2"),a())};return e.jsx(v,{open:b,onOpenChange:()=>a(),children:e.jsxs(y,{children:[e.jsx(w,{children:"New group"}),e.jsxs(G,{children:[e.jsxs(C,{children:[e.jsx(x,{label:"Label",required:!0,children:e.jsx(F,{value:t,onChange:(o,l)=>r(l.value),autoFocus:!0})}),e.jsx(x,{label:"Group template",children:e.jsxs(L,{value:i,onChange:(o,l)=>c(l.value),children:[e.jsx("option",{value:"Flexible2",children:"Flexible2 (recommended)"}),e.jsx("option",{value:"Flexible",children:"Flexible"}),e.jsx("option",{value:"Layout2",children:"Layout2"}),e.jsx("option",{value:"Layout3",children:"Layout3"}),e.jsx("option",{value:"Layout4",children:"Layout4"})]})}),e.jsx(S,{size:200,style:{display:"block",marginTop:"8px"},children:"The group template defines how buttons scale when the ribbon is resized."})]}),e.jsxs(f,{children:[e.jsx(h,{appearance:"secondary",onClick:a,children:"Cancel"}),e.jsx(h,{appearance:"primary",onClick:m,disabled:!t.trim(),children:"Create group"})]})]})]})})};export{z as NewGroupModal,z as default};
@@ -1 +0,0 @@
1
- import{z as e,h as B,y as F}from"./fluent-icons-4bzebHz-.js";import{a as S,R as _}from"./monaco-BoSoLy50.js";import{X as E,u as c,b as N,a as C,Z as O,_ as $,$ as L,a0 as H}from"./index-B2t4gwW0.js";import{D as G,h as U,j as X,i as Z,aa as q,B as h,k as P,M as D,e as I,T as d,F as v,I as w,t as s,l as W}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const Y={HomepageGrid:"home grid",Form:"form",SubGrid:"sub-grid",Application:""},J=F({surface:{width:"480px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:s.spacingHorizontalM},hint:{fontFamily:s.fontFamilyMonospace,fontSize:s.fontSizeBase100,color:s.colorNeutralForeground3,backgroundColor:s.colorNeutralBackground3,padding:`${s.spacingHorizontalXS} ${s.spacingHorizontalS}`,borderRadius:s.borderRadiusMedium}}),se=()=>{const b=J(),[t,p]=S.useState("New Tab"),[g,x]=S.useState(""),o=E(a=>a.location),R=c(a=>a.createTab),u=c(a=>a.ribbons),m=c(a=>a.baseline),j=c(a=>a.layers),z=N(a=>a.activeEntity);N(a=>a.publisherPrefix);const A=C(a=>a.newTabOpen),l=C(a=>a.closeNewTab),y=_.useMemo(()=>O({baseline:m,layers:j},u),[m,j,u]),M=o==="Application"?"global":z?.logicalName??u[o].entityLogicalName,T=$(M,`${o}.${t}`,"Tab",y),n=g.trim(),r=n?L(n)??(/[^a-zA-Z0-9._]/.test(n)?"Use letters, digits, dots and underscores only":y.has(n)?"This ID is already used":null):null,f=n||T,k=()=>{r||(R(o,{id:f,label:t,tabDisplayRules:[],groups:[]}),p("New Tab"),x(""),l())};return e.jsx(G,{open:A,onOpenChange:(a,i)=>!i.open&&l(),children:e.jsx(U,{className:b.surface,children:e.jsxs(X,{children:[e.jsx(Z,{action:e.jsx(h,{appearance:"subtle",icon:e.jsx(B,{}),onClick:l,"aria-label":"Close"}),children:e.jsx(q,{children:"Add Tab"})}),e.jsxs(P,{className:b.body,children:[e.jsx(D,{intent:"info",children:e.jsx(I,{children:e.jsx(d,{size:200,children:o==="Application"?"A tab is shown only where a Tab Display Rule allows it. Add one in Tab rules before publishing.":`The tab gets a Tab Display Rule for this table's ${Y[o]}. You can change it in Tab rules.`})})}),e.jsx(D,{intent:"info",children:e.jsx(I,{children:e.jsx(d,{size:200,children:H})})}),e.jsx(v,{label:"Tab label",required:!0,children:e.jsx(w,{value:t,onChange:(a,i)=>p(i.value),placeholder:"My Tab"})}),e.jsx(v,{label:"Tab ID",hint:"Leave blank to auto-generate from label",validationState:r?"error":"none",validationMessage:r??void 0,children:e.jsx(w,{value:g,onChange:(a,i)=>x(i.value),placeholder:T})}),e.jsxs("div",{children:[e.jsx(d,{size:100,style:{color:s.colorNeutralForeground3},children:"Generated ID:"}),e.jsx("div",{className:b.hint,children:f})]}),e.jsxs(d,{size:200,style:{color:s.colorNeutralForeground3},children:["Location: ",e.jsx("strong",{children:o})]})]}),e.jsxs(W,{children:[e.jsx(h,{appearance:"secondary",onClick:l,children:"Cancel"}),e.jsx(h,{appearance:"primary",disabled:!t.trim()||!!r,onClick:k,children:"Create tab"})]})]})})})};export{se as NewTabModal,se as default};
@@ -1 +0,0 @@
1
- import{z as e,h as O,co as I,cq as C,y as $}from"./fluent-icons-4bzebHz-.js";import{a as M,R as X}from"./monaco-BoSoLy50.js";import{a as k,X as H,u as q}from"./index-B2t4gwW0.js";import{ah as A,ai as P,aj as U,aa as G,B as c,ak as Y,T as x,t as l,a7 as R,c as B,F as p,S as j,I as L}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const Z=$({drawer:{width:"600px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:l.spacingHorizontalM,padding:l.spacingHorizontalM,overflowY:"auto"},stepRow:{display:"flex",flexDirection:"column",gap:l.spacingHorizontalXS,padding:l.spacingHorizontalS,border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,backgroundColor:l.colorNeutralBackground2},stepHeader:{display:"flex",alignItems:"center",gap:l.spacingHorizontalS},stepFields:{display:"flex",gap:l.spacingHorizontalS,flexWrap:"wrap",alignItems:"flex-end"},sectionLabel:{color:l.colorNeutralForeground3,textTransform:"uppercase",fontSize:l.fontSizeBase100,letterSpacing:"0.5px",fontWeight:l.fontWeightSemibold},warningNote:{backgroundColor:l.colorStatusWarningBackground1,borderRadius:l.borderRadiusMedium,padding:`${l.spacingHorizontalXS} ${l.spacingHorizontalS}`,fontSize:l.fontSizeBase100}}),D=["Large","LargeLarge","LargeMedium","LargeSmall","MediumLarge","MediumMedium","MediumSmall","SmallMedium","SmallSmall","Popup"],ae=()=>{const o=Z(),b=k(a=>a.scalingEditorOpen),S=k(a=>a.closeScalingEditor),y=H(a=>a.location),u=H(a=>a.tabId),T=q(a=>a.ribbons),_=q(a=>a.setScaling),v=T[y],r=v.tabs.find(a=>a.id===u),h=u?v.scalingByTab?.[u]:void 0,[w,g]=M.useState([]),[N,m]=M.useState([]);X.useEffect(()=>{if(!(!b||!r)){if(h){g([...h.maxSizes]),m([...h.scales]);return}g([{id:`MaxSize.${r.id}.1`,groupId:r.groups[0]?.id??"",size:"Large",sequence:10}]),m([{id:`Scale.${r.id}.1`,groupId:r.groups[0]?.id??"",size:"SmallSmall",sequence:200}])}},[b,r,h]);const d=r?.groups??[],E=()=>{g(a=>[...a,{id:`MaxSize.${a.length+1}`,groupId:d[0]?.id??"",size:"Large",sequence:(a.length+1)*10}])},F=()=>{m(a=>[...a,{id:`Scale.${a.length+1}`,groupId:d[0]?.id??"",size:"SmallSmall",sequence:200+(a.length+1)*10}])},z=(a,i)=>{g(s=>s.map((n,t)=>t===a?{...n,...i}:n))},f=(a,i)=>{m(s=>s.map((n,t)=>t===a?{...n,...i}:n))},W=()=>{_(y,u,{tabId:u,maxSizes:w,scales:N}),S()};return e.jsxs(A,{className:o.drawer,open:b,position:"end",onOpenChange:(a,i)=>!i.open&&S(),children:[e.jsx(P,{children:e.jsx(U,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(O,{}),onClick:S,"aria-label":"Close"}),children:e.jsx(G,{children:"Scaling Editor"})})}),e.jsx(Y,{children:e.jsxs("div",{className:o.body,children:[e.jsxs("div",{className:o.warningNote,children:["⚠ ",e.jsx("strong",{children:"Scaling applies ONLY to the Classic ribbon"})," — forms NOT updated to Unified Interface, and Dynamics 365 for Outlook list views. The modern command bar (Unified Interface) ignores all MaxSize and Scale definitions entirely."]}),r&&e.jsxs(x,{size:200,style:{color:l.colorNeutralForeground3},children:["Tab: ",e.jsx("strong",{children:r.label})," (",r.id,")"]}),e.jsx(R,{}),e.jsxs("div",{children:[e.jsx(x,{className:o.sectionLabel,children:"MaxSize (largest size, shown first)"}),e.jsx(x,{size:100,style:{color:l.colorNeutralForeground3,display:"block",marginBottom:l.spacingHorizontalS},children:"Sequence numbers must be lower than all Scale step sequence numbers."}),w.map((a,i)=>e.jsxs("div",{className:o.stepRow,style:{marginBottom:l.spacingHorizontalXS},children:[e.jsxs("div",{className:o.stepHeader,children:[e.jsxs(B,{appearance:"tint",color:"brand",size:"small",children:["MaxSize ",i+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>g(s=>s.filter((n,t)=>t!==i))})]}),e.jsxs("div",{className:o.stepFields,children:[e.jsx(p,{label:"Group",style:{minWidth:"160px"},children:e.jsxs(j,{size:"small",value:a.groupId,onChange:(s,n)=>z(i,{groupId:n.value}),children:[d.length===0&&e.jsx("option",{value:"",children:"— no groups —"}),d.map(s=>e.jsx("option",{value:s.id,children:s.label||s.id},s.id))]})}),e.jsx(p,{label:"Size",style:{minWidth:"140px"},children:e.jsx(j,{size:"small",value:a.size,onChange:(s,n)=>z(i,{size:n.value}),children:D.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(p,{label:"Sequence",style:{width:"80px"},children:e.jsx(L,{size:"small",type:"number",value:String(a.sequence),onChange:(s,n)=>z(i,{sequence:parseInt(n.value,10)||0})})})]})]},i)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(C,{}),onClick:E,children:"Add MaxSize"})]}),e.jsx(R,{}),e.jsxs("div",{children:[e.jsx(x,{className:o.sectionLabel,children:"Scale steps (collapse order — top-down)"}),e.jsx(x,{size:100,style:{color:l.colorNeutralForeground3,display:"block",marginBottom:l.spacingHorizontalS},children:"Scale elements are applied in document order (top-down when shrinking, bottom-up when growing). Sequence numbers must be higher than all MaxSize sequence numbers."}),N.map((a,i)=>e.jsxs("div",{className:o.stepRow,style:{marginBottom:l.spacingHorizontalXS},children:[e.jsxs("div",{className:o.stepHeader,children:[e.jsxs(B,{appearance:"tint",color:"informative",size:"small",children:["Scale ",i+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>m(s=>s.filter((n,t)=>t!==i))})]}),e.jsxs("div",{className:o.stepFields,children:[e.jsx(p,{label:"Group",style:{minWidth:"160px"},children:e.jsxs(j,{size:"small",value:a.groupId,onChange:(s,n)=>f(i,{groupId:n.value}),children:[d.length===0&&e.jsx("option",{value:"",children:"— no groups —"}),d.map(s=>e.jsx("option",{value:s.id,children:s.label||s.id},s.id))]})}),e.jsx(p,{label:"Size",style:{minWidth:"140px"},children:e.jsx(j,{size:"small",value:a.size,onChange:(s,n)=>f(i,{size:n.value}),children:D.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(p,{label:"Sequence",style:{width:"80px"},children:e.jsx(L,{size:"small",type:"number",value:String(a.sequence),onChange:(s,n)=>f(i,{sequence:parseInt(n.value,10)||0})})})]})]},i)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(C,{}),onClick:F,children:"Add Scale step"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:l.spacingHorizontalS,paddingTop:l.spacingHorizontalS},children:[e.jsx(c,{appearance:"secondary",onClick:S,children:"Cancel"}),e.jsx(c,{appearance:"primary",onClick:W,children:"Save scaling"})]})]})})]})};export{ae as ScalingEditorPanel,ae as default};
@@ -1 +0,0 @@
1
- import{z as e,h as X,co as T,cq as I,y as L}from"./fluent-icons-4bzebHz-.js";import{a as P,R as V}from"./monaco-BoSoLy50.js";import{a as E,X as w,u as F}from"./index-B2t4gwW0.js";import{ah as Y,ai as J,aj as K,aa as Q,B as c,ak as Z,M as H,e as N,T as p,t as o,c as ee,F as x,I as v,S}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";function C(){return{kind:"EntityRule",appliesTo:"PrimaryEntity",context:"HomePageGrid"}}function A(){return{kind:"PageRule",address:""}}const ae=L({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,padding:o.spacingHorizontalM,overflowY:"auto"},ruleRow:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalXS,padding:o.spacingHorizontalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},ruleHeader:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},stepFields:{display:"flex",gap:o.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"}}),re=()=>{const b=ae(),j=E(a=>a.tabDisplayRulesOpen),h=E(a=>a.closeTabDisplayRules),g=w(a=>a.location),z=w(a=>a.tabId),B=F(a=>a.ribbons),M=F(a=>a.setTabDisplayRules),i=B[g].tabs.find(a=>a.id===z),f=g==="Application",D=!!i?.commandId,[y,d]=P.useState(()=>i?.tabDisplayRules??[]),[k,u]=P.useState(null);V.useEffect(()=>{j&&(u(null),d(i?.tabDisplayRules??[]))},[j,i]);const _=()=>{d(a=>[...a,{tabCommand:i?.commandId??"",rules:[C()]}])},G=a=>{d(l=>l.filter((s,n)=>n!==a))},W=(a,l)=>{D||d(s=>s.map((n,t)=>t===a?{...n,tabCommand:l}:n))},m=(a,l,s)=>{d(n=>n.map((t,r)=>r===a?{...t,rules:t.rules.map((R,U)=>U===l?s:R)}:t))},$=a=>{d(l=>l.map((s,n)=>n===a?{...s,rules:[...s.rules,f?A():C()]}:s))},O=(a,l)=>{d(s=>s.map((n,t)=>t===a?{...n,rules:n.rules.filter((r,R)=>R!==l)}:n))},q=()=>{if(!i){u("No active tab selected.");return}for(const[a,l]of y.entries()){if(!l.tabCommand.trim()){u(`Rule ${a+1}: tabCommand is required.`);return}if(i.commandId&&l.tabCommand!==i.commandId){u(`Rule ${a+1}: tabCommand must match the tab command ID (${i.commandId}).`);return}if(!f&&l.rules.some(s=>s.kind==="PageRule")){u(`Rule ${a+1}: PageRule is only valid for Application ribbon tabs.`);return}}u(null),M(g,z,y),h()};return e.jsxs(Y,{className:b.drawer,open:j,position:"end",onOpenChange:(a,l)=>!l.open&&h(),children:[e.jsx(J,{children:e.jsx(K,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(X,{}),onClick:h,"aria-label":"Close"}),children:e.jsx(Q,{children:"Tab Display Rules"})})}),e.jsx(Z,{children:e.jsxs("div",{className:b.body,children:[k&&e.jsx(H,{intent:"error",children:e.jsx(N,{children:k})}),e.jsx(H,{intent:"info",children:e.jsx(N,{children:e.jsxs(p,{size:200,children:["Tabs are ",e.jsx("strong",{children:"hidden by default"}),". Each Tab Display Rule defines when this tab is shown. The tabCommand must match the tab's Command ID."]})})}),i&&e.jsxs("div",{children:[e.jsxs(p,{size:200,style:{color:o.colorNeutralForeground3},children:["Tab: ",e.jsx("strong",{children:i.label})," (",i.id,")"]}),i.commandId&&e.jsxs(p,{size:200,style:{color:o.colorNeutralForeground3,display:"block"},children:["Command ID:"," ",e.jsx("code",{style:{fontFamily:o.fontFamilyMonospace},children:i.commandId})]})]}),y.length===0&&e.jsx(p,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"No display rules — this tab will be hidden."}),y.map((a,l)=>e.jsxs("div",{className:b.ruleRow,children:[e.jsxs("div",{className:b.ruleHeader,children:[e.jsxs(ee,{appearance:"outline",size:"small",children:["Rule ",l+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(T,{}),onClick:()=>G(l),"aria-label":"Remove rule"})]}),e.jsx(x,{label:"Tab command ID",hint:"Must match Tab.commandId",children:e.jsx(v,{value:a.tabCommand,onChange:(s,n)=>W(l,n.value),disabled:D,size:"small",style:{fontFamily:o.fontFamilyMonospace}})}),e.jsx(p,{size:100,weight:"semibold",style:{color:o.colorNeutralForeground3},children:"Steps"}),a.rules.map((s,n)=>e.jsxs("div",{className:b.stepFields,children:[e.jsx(x,{label:"Type",style:{minWidth:"140px"},children:e.jsxs(S,{size:"small",value:s.kind,onChange:(t,r)=>{r.value==="PageRule"?m(l,n,A()):m(l,n,C())},children:[e.jsx("option",{value:"EntityRule",children:"Entity Rule"}),f&&e.jsx("option",{value:"PageRule",children:"Page Rule"})]})}),s.kind==="EntityRule"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:"Applies to",style:{minWidth:"130px"},children:e.jsxs(S,{size:"small",value:s.appliesTo??"PrimaryEntity",onChange:(t,r)=>m(l,n,{...s,appliesTo:r.value}),children:[e.jsx("option",{value:"PrimaryEntity",children:"Primary entity"}),e.jsx("option",{value:"SelectedEntity",children:"Selected entity"})]})}),e.jsx(x,{label:"Context",style:{minWidth:"160px"},children:e.jsxs(S,{size:"small",value:s.context??"HomePageGrid",onChange:(t,r)=>m(l,n,{...s,context:r.value}),children:[e.jsx("option",{value:"Form",children:"Form"}),e.jsx("option",{value:"HomePageGrid",children:"Home Page Grid"}),e.jsx("option",{value:"SubGridStandard",children:"SubGrid Standard"}),e.jsx("option",{value:"SubGridAssociated",children:"SubGrid Associated"})]})}),e.jsx(x,{label:"Entity (optional)",children:e.jsx(v,{size:"small",value:s.entityName??"",onChange:(t,r)=>m(l,n,{...s,entityName:r.value||void 0}),placeholder:"any"})})]}),s.kind==="PageRule"&&e.jsx(x,{label:"Address pattern",style:{flex:1},children:e.jsx(v,{size:"small",value:s.address,onChange:(t,r)=>m(l,n,{...s,address:r.value}),placeholder:"https://…"})}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(T,{}),onClick:()=>O(l,n),"aria-label":"Remove step"})]},n)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>$(l),children:"Add step"}),e.jsx(p,{size:100,style:{color:o.colorNeutralForeground3},children:"Info: EntityRule is valid for entity-scoped tabs. Use PageRule only for globally-scoped application ribbon tabs."})]},l)),e.jsx(c,{appearance:"subtle",icon:e.jsx(I,{}),onClick:_,children:"Add display rule"}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:o.spacingHorizontalS,paddingTop:o.spacingHorizontalS},children:[e.jsx(c,{appearance:"secondary",onClick:h,children:"Cancel"}),e.jsx(c,{appearance:"primary",onClick:q,children:"Save rules"})]})]})})]})};export{re as TabDisplayRulesPanel,re as default};
@@ -1 +0,0 @@
1
- import{z as s,h as ee,E as se,bc as le,y as ae,bo as B,cs as j,N as S}from"./fluent-icons-4bzebHz-.js";import{a as n}from"./monaco-BoSoLy50.js";import{a as T,b as oe,ac as re,ad as ne,ae as $,af as te,w as N}from"./index-B2t4gwW0.js";import{l as L,s as ie}from"./webResourceService-DGt6sRPR.js";import{a0 as z,D as ce,h as de,j as ue,i as ge,aa as xe,B as b,k as he,I as pe,S as me,am as fe,M as U,e as _,T as i,t as a,a2 as je,a3 as Se,l as be}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const ye=ae({surface:{width:"780px",maxWidth:"95vw",height:"80vh",maxHeight:"80vh"},body:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",gap:a.spacingHorizontalS},toolbar:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,flexShrink:0},grid:{flex:1,overflow:"hidden"},gridWrap:{height:"100%"},gridRow:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,padding:`${a.spacingVerticalXS} ${a.spacingHorizontalS}`,cursor:"pointer",borderRadius:a.borderRadiusMedium,":hover":{backgroundColor:a.colorNeutralBackground3}},gridRowSelected:{backgroundColor:a.colorBrandBackground2},gridHeader:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,padding:`${a.spacingVerticalXS} ${a.spacingHorizontalS}`,borderBottom:`1px solid ${a.colorNeutralStroke2}`,flexShrink:0},col1:{width:"24px",flexShrink:0},col2:{width:"32px",flexShrink:0},col3:{flex:1,overflow:"hidden"},col4:{width:"60px",flexShrink:0,textAlign:"right"},col5:{width:"100px",flexShrink:0,color:a.colorNeutralForeground3},nameCell:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},descCell:{fontSize:a.fontSizeBase100,color:a.colorNeutralForeground3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),we={js:s.jsx(S,{}),ts:s.jsx(S,{}),css:s.jsx(S,{}),html:s.jsx(S,{}),svg:s.jsx(j,{}),png:s.jsx(j,{}),gif:s.jsx(j,{}),jpg:s.jsx(j,{}),xml:s.jsx(B,{}),resx:s.jsx(B,{})};function y(x){return x.split(".").pop()?.toLowerCase()??""}const ve=[{label:"All types",value:"all"},{label:".js",value:"js"},{label:".html",value:"html"},{label:".svg",value:"svg"},{label:".png",value:"png"},{label:".css",value:"css"},{label:".xml",value:"xml"},{label:".resx",value:"resx"}],De=({onSelect:x})=>{const o=ye(),w=T(e=>e.webResourceBrowserOpen),u=T(e=>e.closeWebResourceBrowser),P=oe(e=>e.publisherPrefix),D=n.useRef(null),[I,F]=n.useState([]),[v,h]=n.useState(!1),[H,W]=n.useState(!1),[M,g]=n.useState(null),[E,C]=n.useState(null),[R,A]=n.useState(""),[p,G]=n.useState("all"),[k,X]=n.useState(!0),[m,O]=n.useState(null),f=n.useMemo(()=>{const e=R.toLowerCase();return I.filter(l=>{const r=y(l.name),t=e===""||l.name.toLowerCase().includes(e)||(l.description??"").toLowerCase().includes(e),c=p==="all"||r===p,Z=!k||l.isCustom;return t&&c&&Z})},[I,R,p,k]),d=f.find(e=>e.id===m)??null,V=[z({columnId:"type",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Type"}),renderCell:e=>{const l=y(e.name),r=we[l]??s.jsx(B,{});return s.jsx("div",{className:o.col2,style:{color:a.colorNeutralForeground3},children:r})}}),z({columnId:"name",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Name"}),renderCell:e=>s.jsxs("div",{className:o.col3,children:[s.jsx("div",{className:o.nameCell,children:s.jsx(i,{style:{fontFamily:a.fontFamilyMonospace,fontSize:a.fontSizeBase200},children:e.name})}),e.description&&s.jsx("div",{className:o.descCell,children:e.description})]})}),z({columnId:"modified",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Modified"}),renderCell:e=>s.jsx("div",{className:o.col5,children:s.jsx(i,{size:100,children:e.modifiedOn?new Date(e.modifiedOn).toLocaleDateString():"—"})})})];n.useEffect(()=>{w&&(h(!0),g(null),C(null),L().then(e=>F(e)).catch(e=>g(e instanceof Error?e.message:String(e))).finally(()=>h(!1)))},[w]);const Y=async()=>{h(!0),g(null);try{F(await L())}catch(e){g(e instanceof Error?e.message:String(e))}finally{h(!1)}},q=e=>new Promise((l,r)=>{const t=new FileReader;t.onerror=()=>r(t.error??new Error("Unable to read file")),t.onload=()=>{const c=String(t.result??"");l(c.includes(",")?c.split(",")[1]??"":c)},t.readAsDataURL(e)}),J=e=>{const l=y(e.name);return`${P||"new"}_/${l==="js"||l==="css"||l==="html"||l==="xml"?"scripts":l==="svg"||l==="png"?"icons":"webresources"}/${e.name}`},K=async e=>{W(!0),C(null);try{const l=await q(e),r=y(e.name),t={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[r]??4,c=await ie(J(e),l,t,{displayName:e.name});await Y(),C(c.solutionWarning??null)}catch(l){g(l instanceof Error?l.message:String(l))}finally{W(!1)}},Q=()=>{d&&(N.invoke(d),x?.(d),u())};return s.jsx(ce,{open:w,onOpenChange:(e,l)=>{l.open||(N.clear(),u())},children:s.jsx(de,{className:o.surface,children:s.jsxs(ue,{style:{height:"100%"},children:[s.jsx(ge,{action:s.jsx(b,{appearance:"subtle",icon:s.jsx(ee,{}),onClick:u,"aria-label":"Close"}),children:s.jsx(xe,{children:"Web Resource Browser"})}),s.jsxs(he,{className:o.body,children:[s.jsx("input",{ref:D,type:"file",accept:".js,.html,.svg,.png,.css,.xml,.resx,.jpg,.gif,.ico,.xsl",style:{display:"none"},onChange:e=>{const l=e.target.files?.[0];e.currentTarget.value="",l&&K(l)}}),s.jsxs("div",{className:o.toolbar,children:[s.jsx(pe,{contentBefore:s.jsx(se,{}),placeholder:"Search by name…",value:R,onChange:(e,l)=>A(l.value),size:"small",style:{flex:1}}),s.jsx(me,{size:"small",value:p,onChange:(e,l)=>G(l.value),style:{width:"100px"},children:ve.map(e=>s.jsx("option",{value:e.value,children:e.label},e.value))}),s.jsx(fe,{label:"Custom only",checked:k,onChange:(e,l)=>X(l.checked===!0)})]}),M&&s.jsx(U,{intent:"error",children:s.jsx(_,{children:M})}),E&&s.jsx(U,{intent:"warning",children:s.jsx(_,{children:E})}),s.jsxs("div",{className:o.grid,children:[v&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM},children:"Loading web resources…"}),!v&&f.length===0&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM,textAlign:"center"},children:"No web resources found."}),!v&&f.length>0&&s.jsxs(re,{className:o.gridWrap,items:f,columns:V,getRowId:e=>e.id,focusMode:"composite",selectionMode:"single",subtleSelection:!0,selectedItems:m?new Set([m]):new Set,onSelectionChange:(e,l)=>{const r=[...l.selectedItems][0];O(r??null)},children:[s.jsx(ne,{children:s.jsx($,{children:({renderHeaderCell:e})=>s.jsx(je,{children:e()})})}),s.jsx(te,{itemSize:56,height:360,listProps:{width:"100%"},children:({item:e,rowId:l},r)=>s.jsx($,{style:r,className:`${o.gridRow} ${e.id===m?o.gridRowSelected:""}`,onDoubleClick:()=>{O(e.id),N.invoke(e),x?.(e),u()},children:({renderCell:t})=>s.jsx(Se,{children:t(e)})},l)})]})]}),d&&s.jsx("div",{style:{padding:a.spacingHorizontalXS,backgroundColor:a.colorNeutralBackground3,borderRadius:a.borderRadiusMedium,flexShrink:0},children:s.jsxs(i,{size:200,style:{fontFamily:a.fontFamilyMonospace},children:["$webresource:",d.name]})})]}),s.jsxs(be,{children:[s.jsx(b,{appearance:"subtle",icon:s.jsx(le,{}),disabled:H,onClick:()=>D.current?.click(),children:H?"Uploading…":"Upload"}),s.jsx("div",{style:{flex:1}}),s.jsx(b,{appearance:"secondary",onClick:u,children:"Cancel"}),s.jsx(b,{appearance:"primary",disabled:!d,onClick:Q,children:"Select"})]})]})})})};export{De as WebResourceBrowser,De as default};
@@ -1,2 +0,0 @@
1
- import{z as r,Z as A,h as $,cj as E,be as B,cA as X,bc as O,y as P}from"./fluent-icons-4bzebHz-.js";import{a as m}from"./monaco-BoSoLy50.js";import{u as p,a as k,g as F}from"./index-B2t4gwW0.js";import{l as H}from"./webResourceService-DGt6sRPR.js";import{M as U}from"./MonacoEditor-DakCq511.js";import{ah as V,ai as z,aj as G,t as d,B as W,ak as _,M as K,e as Z,ac as Q,ad as q,al as N}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const J=["Add","AddCircle","Alert","AppFolder","Archive","ArrowClockwise","ArrowCounterclockwise","ArrowDown","ArrowExport","ArrowImport","ArrowLeft","ArrowRight","ArrowSync","ArrowUp","Attach","Beaker","Bookmark","Bug","Building","Calculator","CalendarLtr","CalendarMonth","Call","Camera","Cart","Chart","Checkmark","CheckmarkCircle","Circle","ClipboardTask","Clock","Cloud","Code","CodeBlock","Comment","ContactCard","Copy","CreditCard","Crown","Cube","CursorClick","DataBarVertical","Delete","Diamond","Document","DocumentCopy","DocumentEdit","DocumentText","Download","Edit","Emoji","ErrorCircle","Eye","EyeOff","Filter","Flag","Flow","FolderOpen","Globe","Grid","Group","Heart","Home","Image","Info","Key","Library","Link","List","Location","Lock","Mail","Map","MegaphoneLoud","Money","MoreCircle","MoreHorizontal","Note","NoteEdit","NumberCircle1","Open","Organization","Pause","People","PeopleCommunity","Person","PersonAdd","PersonSearch","Phone","Play","Plug","Print","Question","Refresh","Rename","Save","Search","Send","Settings","Share","Shield","ShoppingBag","Sparkle","Star","StarEmphasis","Stop","Table","Tag","TaskList","TextBulletList","TextDescription","ThumbLike","Timer","ToggleLeft","ToggleRight","Tool","Translate","Umbrella","Unlock","Upload","Video","Warning","Wrench"];function I(t,C){const g=[];return g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!o.includes("$LocLabels:"))return{suggestions:[]};const b=o.lastIndexOf("$LocLabels:")+11,s=o.slice(b),i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:p.getState().locLabels.map(u=>({label:u.id,kind:t.languages.CompletionItemKind.Reference,insertText:u.id,range:i,detail:"LocLabel reference"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!o.includes("$webresource:"))return{suggestions:[]};const b=o.lastIndexOf("$webresource:")+13,s=o.slice(b),i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:C().map(u=>({label:u,kind:t.languages.CompletionItemKind.File,insertText:u,range:i,detail:"Web resource"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/Command\s*=\s*"[^"]*$/.test(o))return{suggestions:[]};const s=o.match(/Command\s*=\s*"([^"]*)$/)?.[1]??"",i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:p.getState().commands.map(u=>({label:u.id,kind:t.languages.CompletionItemKind.Function,insertText:u.id,range:i,detail:"CommandDefinition"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/ModernImage\s*=\s*"[^"]*$/.test(o))return{suggestions:[]};const s=o.match(/ModernImage\s*=\s*"([^"]*)$/)?.[1]??"",i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:J.map(c=>({label:c,kind:t.languages.CompletionItemKind.Color,insertText:c,range:i,detail:"Fluent icon (ModernImage)",documentation:`Renders the ${c}_20_Regular Fluent icon`}))}}})),g}function S(t){t.forEach(C=>C.dispose())}const Y=P({drawer:{width:"960px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",padding:0},infoBar:{flexShrink:0,margin:`${d.spacingVerticalS} ${d.spacingHorizontalM}`},tabRow:{flexShrink:0,padding:`0 ${d.spacingHorizontalM}`},toolbar:{flexShrink:0,display:"flex",alignItems:"center",gap:d.spacingHorizontalS,padding:`${d.spacingVerticalXS} ${d.spacingHorizontalM}`,borderTop:`1px solid ${d.colorNeutralStroke2}`,borderBottom:`1px solid ${d.colorNeutralStroke2}`},editorContainer:{flex:1,minHeight:0,overflow:"hidden"}}),ee=[{label:"Home Grid",value:"HomepageGrid"},{label:"Sub Grid",value:"SubGrid"},{label:"Form",value:"Form"},{label:"Application",value:"Application"}],ce=()=>{const t=Y(),C=k(n=>n.xmlDrawerOpen),g=k(n=>n.closeXmlDrawer),l=p(n=>n.ribbons),e=p(n=>n.baseline),o=p(n=>n.commands),b=p(n=>n.displayRules),s=p(n=>n.enableRules),i=p(n=>n.locLabels),f=k(n=>n.openImportXml),[c,u]=m.useState("HomepageGrid"),[x,y]=m.useState([]),v=m.useRef(null),w=m.useRef(null),h=m.useRef([]);m.useEffect(()=>{C&&H().then(n=>y(n.map(a=>a.name))).catch(()=>y([]))},[C]),m.useEffect(()=>()=>{S(h.current),h.current=[]},[]);const D=m.useCallback((n,a)=>{v.current=n,w.current=a,S(h.current),h.current=I(a,()=>x)},[x]);m.useEffect(()=>{w.current&&(S(h.current),h.current=I(w.current,()=>x))},[x]);const T=()=>{v.current?.getAction("editor.action.formatDocument")?.run()},L=m.useCallback(n=>{try{return`<?xml version="1.0" encoding="utf-8"?>
2
- ${F({location:n,current:l[n],baseline:e[n],commands:o,displayRules:b,enableRules:s,locLabels:i,entityLogicalName:l[n].entityLogicalName})}`}catch(a){return`<!-- Error generating XML: ${String(a)} -->`}},[l,e,o,b,s,i])(c),j=()=>{navigator.clipboard.writeText(L)},M=()=>{const n=new Blob([L],{type:"application/xml"}),a=URL.createObjectURL(n),R=document.createElement("a");R.href=a,R.download=`RibbonDiffXml_${c}.xml`,R.click(),URL.revokeObjectURL(a)};return r.jsxs(V,{position:"end",open:C,onOpenChange:()=>g(),className:t.drawer,children:[r.jsx(z,{children:r.jsxs(G,{action:r.jsx(W,{appearance:"subtle",icon:r.jsx($,{}),onClick:g,"aria-label":"Close XML drawer"}),children:[r.jsx(A,{style:{marginRight:d.spacingHorizontalS}}),"RibbonDiffXml"]})}),r.jsxs(_,{className:t.body,children:[r.jsx(K,{className:t.infoBar,intent:"info",children:r.jsxs(Z,{children:["This is the ",r.jsx("strong",{children:"RibbonDiffXml"})," that will be packaged into your solution ZIP and imported into Dataverse. It contains only the delta (your changes), not the full ribbon."]})}),r.jsx("div",{className:t.tabRow,children:r.jsx(Q,{selectedValue:c,onTabSelect:(n,a)=>u(a.value),children:ee.map(n=>r.jsx(q,{value:n.value,children:n.label},n.value))})}),r.jsxs("div",{className:t.toolbar,children:[r.jsx(N,{icon:r.jsx(E,{}),onClick:j,children:"Copy"}),r.jsx(N,{icon:r.jsx(B,{}),onClick:M,children:"Download"}),r.jsx(N,{icon:r.jsx(X,{}),onClick:T,children:"Format XML"}),r.jsx(N,{icon:r.jsx(O,{}),onClick:()=>f(L),children:"Import this XML"})]}),r.jsx("div",{className:t.editorContainer,children:r.jsx(U,{language:"xml",value:L,readOnly:!0,height:"100%",onMount:D})})]})]})};export{ce as XmlDrawer,ce as default};
Binary file
@@ -1 +0,0 @@
1
- import{c as h,d as s}from"./monaco-BoSoLy50.js";import{C as c,H as u,D as p,a as m,R as f,b as _,c as w,d as k,F as v,e as D,S as P,f as R,g as I}from"./lspLanguageFeatures-CbQqhnvj.js";import{h as b,i as H,j as U,t as y,k as T}from"./lspLanguageFeatures-CbQqhnvj.js";const C=120*1e3;class A{constructor(n){this._defaults=n,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>C&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=h({moduleId:"vs/language/css/cssWorker",createWorker:()=>new Worker(new URL(""+new URL("css.worker-DBVD8oXr.js",import.meta.url).href,import.meta.url),{type:"module"}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...n){let e;return this._getClient().then(a=>{e=a}).then(a=>{if(this._worker)return this._worker.withSyncedResources(n)}).then(a=>e)}}function F(o){const n=[],e=[],a=new A(o);n.push(a);const r=(...t)=>a.getLanguageServiceWorker(...t);function l(){const{languageId:t,modeConfiguration:i}=o;g(e),i.completionItems&&e.push(s.registerCompletionItemProvider(t,new c(r,["/","-",":"]))),i.hovers&&e.push(s.registerHoverProvider(t,new u(r))),i.documentHighlights&&e.push(s.registerDocumentHighlightProvider(t,new p(r))),i.definitions&&e.push(s.registerDefinitionProvider(t,new m(r))),i.references&&e.push(s.registerReferenceProvider(t,new f(r))),i.documentSymbols&&e.push(s.registerDocumentSymbolProvider(t,new _(r))),i.rename&&e.push(s.registerRenameProvider(t,new w(r))),i.colors&&e.push(s.registerColorProvider(t,new k(r))),i.foldingRanges&&e.push(s.registerFoldingRangeProvider(t,new v(r))),i.diagnostics&&e.push(new D(t,r,o.onDidChange)),i.selectionRanges&&e.push(s.registerSelectionRangeProvider(t,new P(r))),i.documentFormattingEdits&&e.push(s.registerDocumentFormattingEditProvider(t,new R(r))),i.documentRangeFormattingEdits&&e.push(s.registerDocumentRangeFormattingEditProvider(t,new I(r)))}return l(),n.push(d(e)),d(n)}function d(o){return{dispose:()=>g(o)}}function g(o){for(;o.length;)o.pop().dispose()}export{c as CompletionAdapter,m as DefinitionAdapter,D as DiagnosticsAdapter,k as DocumentColorAdapter,R as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,b as DocumentLinkAdapter,I as DocumentRangeFormattingEditProvider,_ as DocumentSymbolAdapter,v as FoldingRangeAdapter,u as HoverAdapter,f as ReferenceAdapter,w as RenameAdapter,P as SelectionRangeAdapter,A as WorkerManager,H as fromPosition,U as fromRange,F as setupMode,y as toRange,T as toTextEdit};