@mohsinonxrm/pptb-commandbar-studio 0.7.0-beta.3 → 0.8.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.
- package/CHANGELOG.md +141 -0
- package/README.md +13 -10
- package/dist/assets/BulkPublishModal-mJ41AWew.js +36 -0
- package/dist/assets/CommandEditorPanel-BiP1kPHY.js +1 -0
- package/dist/assets/CommandPalette-q51_0qRZ.js +1 -0
- package/dist/assets/{ConflictDrawer-DAQi31Y8.js → ConflictDrawer-CdWv_PbN.js} +1 -1
- package/dist/assets/{DiffViewer-DVIsuwXy.js → DiffViewer-BQP5f73U.js} +1 -1
- package/dist/assets/HideInsteadOfDeleteModal-C9r6ah5p.js +1 -0
- package/dist/assets/IconPickerModal-B81Tnf5i.js +1 -0
- package/dist/assets/{ImportXmlModal-2-0E4Ib_.js → ImportXmlModal-C0cMaS59.js} +1 -1
- package/dist/assets/LocalizationEditor-DniDtrZV.js +1 -0
- package/dist/assets/{MonacoEditor-DGzdcWNE.js → MonacoEditor-uzfuRCpJ.js} +1 -1
- package/dist/assets/{NewButtonModal-CKKbFpLd.js → NewButtonModal-BXpX1Ld5.js} +1 -1
- package/dist/assets/{NewGroupModal-BpXuxZKo.js → NewGroupModal-Bh7lXq52.js} +1 -1
- package/dist/assets/{NewTabModal-CoBSto1f.js → NewTabModal-Pntdk3in.js} +1 -1
- package/dist/assets/RuleEditorPanel-BUGKgc0N.js +1 -0
- package/dist/assets/{ScalingEditorPanel-L_j0ox4f.js → ScalingEditorPanel-p3-Yw3CO.js} +1 -1
- package/dist/assets/TabDisplayRulesPanel-CSNshwaw.js +1 -0
- package/dist/assets/{UrlComposerModal-BhcG5L1S.js → UrlComposerModal-WKSTwUcW.js} +1 -1
- package/dist/assets/WebResourceBrowser-BK-gVU2g.js +1 -0
- package/dist/assets/XmlDrawer-CQJElnD1.js +2 -0
- package/dist/assets/{dnd-BmqIZ1-i.js → dnd-Cq8OftAq.js} +1 -1
- package/dist/assets/fluent-icons-BqJj6rDi.js +1 -0
- package/dist/assets/{fluent-ui-Dde22_ZN.js → fluent-ui-QADO660t.js} +1 -1
- package/dist/assets/index-Di2_5czx.js +136 -0
- package/dist/assets/{useReplaceWebResourceConfirm-Mb36NTI7.js → useReplaceWebResourceConfirm-BUWBVNSC.js} +1 -1
- package/dist/assets/useStableKeys-p2OkzZWO.js +1 -0
- package/dist/assets/xmlValidator-BkeotXuB.js +3 -0
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/dist/assets/BulkPublishModal-B0Ecmiq1.js +0 -36
- package/dist/assets/CommandEditorPanel-FdBZ2zNj.js +0 -1
- package/dist/assets/CommandPalette-BL4yGqtx.js +0 -1
- package/dist/assets/CrmParameterEditor-CQD0gNNH.js +0 -1
- package/dist/assets/HideInsteadOfDeleteModal-BBfhx5dO.js +0 -1
- package/dist/assets/IconPickerModal-D97ew6l_.js +0 -1
- package/dist/assets/LocalizationEditor-7sYCHKMx.js +0 -1
- package/dist/assets/RuleEditorPanel-Dg2vnxrc.js +0 -1
- package/dist/assets/TabDisplayRulesPanel-W1SMJTlj.js +0 -1
- package/dist/assets/WebResourceBrowser-CQemLOXD.js +0 -1
- package/dist/assets/XmlDrawer-BOOdH0HN.js +0 -2
- package/dist/assets/fluent-icons-DUgjkNjy.js +0 -1
- package/dist/assets/index-DUEHURiA.js +0 -136
- package/dist/assets/xmlValidator-BB2o3QUU.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as a}from"./fluent-icons-DUgjkNjy.js";import{a as k}from"./monaco-BIO15LCS.js";import{ag as Te,D as Be,ah as He,ai as ze,aj as Fe,ak as _e,al as Pe,a as Z,u as Ue,aa as We,Y as Je}from"./index-DUEHURiA.js";import{a as Ye}from"./xmlValidator-BB2o3QUU.js";import{M as Ke}from"./MonacoEditor-DGzdcWNE.js";import{D as Ve,i as Qe,j as Ze,k as et,l as tt,b as De,M as G,f as X,ae as le,m as ot,d as ee}from"./fluent-ui-Dde22_ZN.js";import"./dnd-BmqIZ1-i.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=(l,y)=>JSON.stringify(l)===JSON.stringify(y);function M(l){return l?Array.from(l.children):[]}function it(l){return Object.fromEntries(Array.from(l.attributes).map(y=>[y.name,y.value]))}function rt(l,y,c){const f=l.documentElement;if(f.tagName==="RibbonDiffXml")return f;const $=Array.from(l.getElementsByTagName("RibbonDiffXml")),S=Array.from(l.querySelectorAll("Entities > Entity")).flatMap(r=>{const A=M(r),v=A.find(D=>D.tagName==="RibbonDiffXml"),w=A.find(D=>D.tagName==="Name")?.textContent?.trim()??"";return v?[{name:w,rdx:v}]:[]}),R=$.find(r=>r.parentElement===f);if(S.length===0&&!R){if($.length===1)return $[0];throw new Error($.length===0?"No <RibbonDiffXml> element found.":`The XML has ${$.length} <RibbonDiffXml> elements and none belongs to a table or the application ribbon — paste just one.`)}const L=[...S.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: ${L}). Open that table's ribbon to import its customizations.`)}const x=S.find(r=>r.name.toLowerCase()===y.toLowerCase());if(x)return x.rdx;throw new Error(`The XML has no RibbonDiffXml for ${y||"the loaded table"} (it has: ${L}). Load that table, or open the application ribbon for the application ribbon's customizations.`)}function at(l){switch(l){case"HomePageGrid":return"HomepageGrid";case"Form":return"Form";case"SubGridStandard":case"SubGridAssociated":return"SubGrid";default:return}}function lt(l){const y=l.languageCode??1033,c=l.entityLogicalName,f=new DOMParser().parseFromString(l.xml,"application/xml");if(f.querySelector("parsererror"))throw new Error("The XML is not well-formed.");const $=l.activeLocation==="Application",S=rt(f,c,$),R=new XMLSerializer,L=R.serializeToString(S),x=[],r=[],A=[],v=!!c&&new RegExp(`Mscrm\\.(HomepageGrid|SubGrid|Form)\\.${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\.`,"i").test(L),w=$&&!(S===f.documentElement&&v);S!==f.documentElement?A.push(`Imported the RibbonDiffXml of ${w?"the application ribbon":c} from the document.`):$&&!w&&A.push(`The XML's Locations name the ${c} table, so it was imported as that table's customizations, not the application ribbon's.`);const D=w?"Application":fe.includes(l.activeLocation)?l.activeLocation:"HomepageGrid",j=Te(L,l.activeLocation,c),I=(e,t,o)=>{const s=new Map,n=new Map;for(const b of t)s.set(b.id,b),n.set(b.id,(n.get(b.id)??0)+1);for(const[b,g]of n)g>1&&A.push(`${o} ${b} is defined ${g} times in the XML — the last one was used.`);const u=Array.from(s.values()),i=[...e],p=[];let h=0;for(const b of u){const g=i.findIndex(T=>T.id===b.id);if(g>=0&&ve(i[g],b)){h++;continue}x.push(`${o} ${b.id} ${g>=0?"updated":"added"}`),g>=0?i[g]=b:i.push(b),p.push(b.id)}return{out:i,changedIds:p,unchanged:h}},m=I(l.commands,j.commands,"Command"),d=I(l.enableRules,j.enableRules,"Enable rule"),C=I(l.displayRules,j.displayRules,"Display rule"),B=I(l.locLabels,j.locLabels,"Label"),H=B.out,be=m.unchanged+d.unchanged+C.unchanged+B.unchanged,q=(e,t)=>e&&Pe(e,H,y)||t,N=JSON.parse(JSON.stringify(l.ribbons));let E=!1,z=0;const te=new Set,oe=e=>{if(w)return ce.slice().reverse();const t=pe.exec(e),o=t&&t[2]!=="{!EntityLogicalName}"?t[1]:D;return[o,...fe.filter(s=>s!==o),"Application"]},F=(e,t)=>{w&&e!=="Application"?A.push(`${t} is on the table's ribbon (${e}), not the application ribbon: the change is published with the table.`):!w&&e==="Application"&&A.push(`${t} was found only on the application ribbon: the change is published to the application ribbon and affects every table.`)},ne=[],O=(e,t)=>{e&&e!==t&&ne.push(e)},_=e=>{for(const t of oe(e))for(const o of N[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 oe(e)){const o=N[t].tabs.find(s=>s.id===e);if(o)return{location:t,tab:o}}},U=e=>{for(const t of oe(e)){const o=[];for(const s of N[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=M(S.querySelector(":scope > RuleDefinitions > TabDisplayRules")).map(e=>R.serializeToString(e)).join(""),se=e=>Te(`<RibbonDiffXml><UI><Ribbon><Tabs>${e}</Tabs></Ribbon></UI><RuleDefinitions><TabDisplayRules>${je}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`,l.activeLocation,c,H).ribbon.tabs[0],J=e=>R.serializeToString(e),ge=e=>se(`<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=q(t.labelToken,e.id),t.tooltipTitleToken&&(e.tooltipTitle=q(t.tooltipTitleToken,"")),t.tooltipBodyToken&&(e.tooltipBody=q(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),ie=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)?ie(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 ie(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?(E=!0,x.push(`Updated ${i.label} (${e}) on ${s.location}`),n.templateAlias||A.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)&&O(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 ie(n);K(i.group.buttons,xe(p,s)),F(i.location,n),O(e.getAttribute("Id"),`${n}.CustomAction`),E=!0,x.push(`Added ${p.label} (${n}) to ${i.group.id} on ${i.location}`)},Ce=(e,t)=>{const o=se(`<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:q(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 M(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),O(e.getAttribute("Id"),`${n}.CustomAction`),E=!0,x.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=se(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]??D,h=Array.from(t.querySelectorAll(":scope > Groups > Group")).map(T=>Ce(T,void 0)).filter(T=>!!T),b=$e(t);Y({id:s,source:b});const g={...n,label:q(b.titleToken,s),source:b,sequence:t.getAttribute("Sequence")===null?o??n.sequence:n.sequence,groups:h};K(N[i].tabs,g),O(e.getAttribute("Id"),`${s}.CustomAction`),g.commandId&&(te.add(g.commandId),m.out.some(T=>T.id===g.commandId)||(m.out.push({id:g.commandId,enableRules:[],displayRules:[],actions:[]}),m.changedIds.push(g.commandId),A.push(`Tab ${s}: its Command ${g.commandId} has no CommandDefinition in the XML — an empty one was added.`))),E=!0,x.push(`Added tab ${g.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),O(e.getAttribute("HideActionId"),`${t}.HideAction`),E=!0,x.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=M(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)){O(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=M(S.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 N[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 te)V.add(e);const re=new Set,ae=new Set;for(const e of m.out)if(V.has(e.id)){e.enableRules.forEach(t=>re.add(t)),e.displayRules.forEach(t=>ae.add(t));for(const t of e.rawRuleRefs??[]){const o=nt.exec(t.xml);o&&(o[1]==="EnableRule"?re:ae).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(m.changedIds,V,"Command","no button on the loaded ribbon uses it"),Q(d.changedIds,re,"Enable rule","no command a button uses references it"),Q(C.changedIds,ae,"Display rule","no command a button uses references it");const Re=new Set(Array.from(J(S).matchAll(me),e=>e[1]));for(const e of ce)for(const t of N[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(S.querySelectorAll(":scope > RuleDefinitions > TabDisplayRules > TabDisplayRule"));for(const e of qe){const t=e.getAttribute("TabCommand")??"";te.has(t)||r.push(`TabDisplayRule for ${t}: only the display rules of tabs this import adds are imported.`);const o=M(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.`)}ne.length>0&&A.push(`Ids normalised: CBS publishes CustomAction / HideCustomAction ids as {control}.CustomAction, {control}.Override.CustomAction and {control}.HideAction, so ${ne.join(", ")} will be written under those ids.`),be+z>0&&x.push(`${be+z} control(s) / definition(s) were already up to date`);const ke=E||m.changedIds.length+d.changedIds.length+C.changedIds.length+B.changedIds.length>0;return{ribbons:E?N:l.ribbons,commands:m.out,enableRules:d.out,displayRules:C.out,locLabels:H,applied:x,notApplied:r,notes:A,changed:ke}}function ct(l,y){const c=Ue.getState(),f=lt({xml:l,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 y&&f.changed&&c.applyImport(f,`${f.applied.length} change(s)`),f}const he=({items:l})=>a.jsx("ul",{style:{margin:"4px 0 0",paddingLeft:"20px",maxHeight:"160px",overflowY:"auto"},children:l.map((y,c)=>a.jsx("li",{children:a.jsx(De,{size:200,children:y})},c))}),$t=()=>{const l=Z(d=>d.importXmlOpen),y=Z(d=>d.importXmlSeed),c=Z(d=>d.importXmlNote),f=Z(d=>d.closeImportXml),[$,S]=k.useState(""),[R,L]=k.useState([]),[x,r]=k.useState(null),[A,v]=k.useState("");k.useEffect(()=>{l&&(S(y),L([]),r(null),v(""))},[l,y]);const w=d=>{S(d),x?.imported||r(null)},D=()=>{const d=Ye($);return L(d),d.every(C=>C.severity==="warning")},j=d=>{if(D()){v("");try{r({result:ct($,d),imported:d})}catch(C){r(null),v(C instanceof Error?C.message:String(C))}}},I=x?.imported===!0,m=x?.result;return a.jsx(Ve,{open:l,onOpenChange:()=>f(),children:a.jsxs(Qe,{style:{maxWidth:"960px",width:"92vw",height:"80vh",maxHeight:"860px"},children:[a.jsx(Ze,{children:"Import RibbonDiffXml"}),a.jsxs(et,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsxs(tt,{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:"8px"},children:[a.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."}),c&&!$&&a.jsx(G,{intent:"info",children:a.jsx(X,{children:c})}),a.jsx("div",{style:{flex:1,minHeight:0},children:a.jsx(Ke,{language:"xml",value:$,onChange:w,readOnly:I,height:"100%",options:{wordWrap:"on",lineNumbers:"on",padding:{top:8}}})}),R.length>0&&a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:R.map((d,C)=>a.jsx(G,{intent:d.severity==="warning"?"warning":"error",children:a.jsxs(X,{children:[d.message,d.lineHint?` (${d.lineHint})`:""]})},C))}),A&&a.jsx(G,{intent:"error",children:a.jsx(X,{children:A})}),m&&a.jsx(G,{intent:m.changed?"success":"info",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:I?m.changed?"Imported — review the changes, then publish":"Nothing to import — the session already has all of it":"Preview — nothing has changed yet"}),m.applied.length>0&&a.jsx(he,{items:m.applied})]})}),m&&m.notes.length>0&&a.jsx(G,{intent:"info",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:"Good to know"}),a.jsx(he,{items:m.notes})]})}),m&&m.notApplied.length>0&&a.jsx(G,{intent:"warning",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:I?"Not imported / won't be published":"Can't be imported / won't be published"}),a.jsx(he,{items:m.notApplied})]})})]}),a.jsx(ot,{children:I?a.jsx(ee,{appearance:"primary",onClick:f,children:"Close"}):a.jsxs(a.Fragment,{children:[a.jsx(ee,{appearance:"secondary",onClick:f,children:"Cancel"}),a.jsx(ee,{appearance:"secondary",onClick:()=>j(!1),disabled:!$.trim(),children:"Preview"}),a.jsx(ee,{appearance:"primary",onClick:()=>j(!0),disabled:!$.trim(),children:"Import"})]})})]})]})})};export{$t as ImportXmlModal,$t as default};
|
|
1
|
+
import{y as a}from"./fluent-icons-BqJj6rDi.js";import{a as k}from"./monaco-BIO15LCS.js";import{ah as Te,D as Be,ai as He,aj as ze,ak as Fe,al as _e,am as Pe,a as Q,u as Ue,ab as We,Z as Je}from"./index-Di2_5czx.js";import{a as Ye}from"./xmlValidator-BkeotXuB.js";import{M as Ke}from"./MonacoEditor-uzfuRCpJ.js";import{D as Ve,i as Ze,j as Qe,k as et,l as tt,b as De,M as G,f as X,ae as le,m as ot,d as ee}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.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=(l,y)=>JSON.stringify(l)===JSON.stringify(y);function M(l){return l?Array.from(l.children):[]}function it(l){return Object.fromEntries(Array.from(l.attributes).map(y=>[y.name,y.value]))}function rt(l,y,c){const f=l.documentElement;if(f.tagName==="RibbonDiffXml")return f;const $=Array.from(l.getElementsByTagName("RibbonDiffXml")),S=Array.from(l.querySelectorAll("Entities > Entity")).flatMap(r=>{const A=M(r),v=A.find(D=>D.tagName==="RibbonDiffXml"),R=A.find(D=>D.tagName==="Name")?.textContent?.trim()??"";return v?[{name:R,rdx:v}]:[]}),w=$.find(r=>r.parentElement===f);if(S.length===0&&!w){if($.length===1)return $[0];throw new Error($.length===0?"No <RibbonDiffXml> element found.":`The XML has ${$.length} <RibbonDiffXml> elements and none belongs to a table or the application ribbon — paste just one.`)}const L=[...S.map(r=>r.name||"(unnamed table)"),...w?["the application ribbon"]:[]].join(", ");if(c){if(w)return w;throw new Error(`The XML has no application ribbon RibbonDiffXml (it has: ${L}). Open that table's ribbon to import its customizations.`)}const x=S.find(r=>r.name.toLowerCase()===y.toLowerCase());if(x)return x.rdx;throw new Error(`The XML has no RibbonDiffXml for ${y||"the loaded table"} (it has: ${L}). Load that table, or open the application ribbon for the application ribbon's customizations.`)}function at(l){switch(l){case"HomePageGrid":return"HomepageGrid";case"Form":return"Form";case"SubGridStandard":case"SubGridAssociated":return"SubGrid";default:return}}function lt(l){const y=l.languageCode??1033,c=l.entityLogicalName,f=new DOMParser().parseFromString(l.xml,"application/xml");if(f.querySelector("parsererror"))throw new Error("The XML is not well-formed.");const $=l.activeLocation==="Application",S=rt(f,c,$),w=new XMLSerializer,L=w.serializeToString(S),x=[],r=[],A=[],v=!!c&&new RegExp(`Mscrm\\.(HomepageGrid|SubGrid|Form)\\.${c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\.`,"i").test(L),R=$&&!(S===f.documentElement&&v);S!==f.documentElement?A.push(`Imported the RibbonDiffXml of ${R?"the application ribbon":c} from the document.`):$&&!R&&A.push(`The XML's Locations name the ${c} table, so it was imported as that table's customizations, not the application ribbon's.`);const D=R?"Application":fe.includes(l.activeLocation)?l.activeLocation:"HomepageGrid",j=Te(L,l.activeLocation,c),I=(e,t,o)=>{const s=new Map,n=new Map;for(const b of t)s.set(b.id,b),n.set(b.id,(n.get(b.id)??0)+1);for(const[b,g]of n)g>1&&A.push(`${o} ${b} is defined ${g} times in the XML — the last one was used.`);const u=Array.from(s.values()),i=[...e],p=[];let h=0;for(const b of u){const g=i.findIndex(T=>T.id===b.id);if(g>=0&&ve(i[g],b)){h++;continue}x.push(`${o} ${b.id} ${g>=0?"updated":"added"}`),g>=0?i[g]=b:i.push(b),p.push(b.id)}return{out:i,changedIds:p,unchanged:h}},m=I(l.commands,j.commands,"Command"),d=I(l.enableRules,j.enableRules,"Enable rule"),C=I(l.displayRules,j.displayRules,"Display rule"),B=I(l.locLabels,j.locLabels,"Label"),H=B.out,be=m.unchanged+d.unchanged+C.unchanged+B.unchanged,q=(e,t)=>e&&Pe(e,H,y)||t,N=JSON.parse(JSON.stringify(l.ribbons));let E=!1,z=0;const te=new Set,oe=e=>{if(R)return ce.slice().reverse();const t=pe.exec(e),o=t&&t[2]!=="{!EntityLogicalName}"?t[1]:D;return[o,...fe.filter(s=>s!==o),"Application"]},F=(e,t)=>{R&&e!=="Application"?A.push(`${t} is on the table's ribbon (${e}), not the application ribbon: the change is published with the table.`):!R&&e==="Application"&&A.push(`${t} was found only on the application ribbon: the change is published to the application ribbon and affects every table.`)},ne=[],O=(e,t)=>{e&&e!==t&&ne.push(e)},_=e=>{for(const t of oe(e))for(const o of N[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 oe(e)){const o=N[t].tabs.find(s=>s.id===e);if(o)return{location:t,tab:o}}},U=e=>{for(const t of oe(e)){const o=[];for(const s of N[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=M(S.querySelector(":scope > RuleDefinitions > TabDisplayRules")).map(e=>w.serializeToString(e)).join(""),se=e=>Te(`<RibbonDiffXml><UI><Ribbon><Tabs>${e}</Tabs></Ribbon></UI><RuleDefinitions><TabDisplayRules>${je}</TabDisplayRules></RuleDefinitions></RibbonDiffXml>`,l.activeLocation,c,H).ribbon.tabs[0],J=e=>w.serializeToString(e),ge=e=>se(`<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=q(t.labelToken,e.id),t.tooltipTitleToken&&(e.tooltipTitle=q(t.tooltipTitleToken,"")),t.tooltipBodyToken&&(e.tooltipBody=q(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 its text won't show unless another solution defines it (the pre-publish check warns).`)},$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),ie=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)?ie(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 ie(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?(E=!0,x.push(`Updated ${i.label} (${e}) on ${s.location}`),n.templateAlias||A.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)&&O(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 ie(n);K(i.group.buttons,xe(p,s)),F(i.location,n),O(e.getAttribute("Id"),`${n}.CustomAction`),E=!0,x.push(`Added ${p.label} (${n}) to ${i.group.id} on ${i.location}`)},Ce=(e,t)=>{const o=se(`<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:q(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 M(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),O(e.getAttribute("Id"),`${n}.CustomAction`),E=!0,x.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=se(J(t));if(!n)return r.push(`Tab ${s}: couldn't read the <Tab>.`);const u=n.tabDisplayRules.flatMap(T=>T.rules.map(Re=>Re.kind==="EntityRule"?at(Re.context):void 0)),i=R?"Application":u.find(T=>!!T)??pe.exec(s)?.[1]??D,h=Array.from(t.querySelectorAll(":scope > Groups > Group")).map(T=>Ce(T,void 0)).filter(T=>!!T),b=$e(t);Y({id:s,source:b});const g={...n,label:q(b.titleToken,s),source:b,sequence:t.getAttribute("Sequence")===null?o??n.sequence:n.sequence,groups:h};K(N[i].tabs,g),O(e.getAttribute("Id"),`${s}.CustomAction`),g.commandId&&(te.add(g.commandId),m.out.some(T=>T.id===g.commandId)||(m.out.push({id:g.commandId,enableRules:[],displayRules:[],actions:[]}),m.changedIds.push(g.commandId),A.push(`Tab ${s}: its Command ${g.commandId} has no CommandDefinition in the XML — an empty one was added.`))),E=!0,x.push(`Added tab ${g.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),O(e.getAttribute("HideActionId"),`${t}.HideAction`),E=!0,x.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=M(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)){O(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=M(S.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 N[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 te)V.add(e);const re=new Set,ae=new Set;for(const e of m.out)if(V.has(e.id)){e.enableRules.forEach(t=>re.add(t)),e.displayRules.forEach(t=>ae.add(t));for(const t of e.rawRuleRefs??[]){const o=nt.exec(t.xml);o&&(o[1]==="EnableRule"?re:ae).add(o[2])}}const Z=(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.`)};Z(m.changedIds,V,"Command","no button on the loaded ribbon uses it"),Z(d.changedIds,re,"Enable rule","no command a button uses references it"),Z(C.changedIds,ae,"Display rule","no command a button uses references it");const we=new Set(Array.from(J(S).matchAll(me),e=>e[1]));for(const e of ce)for(const t of N[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))we.add(u[1]);Z(B.changedIds,we,"Label","nothing references it");const qe=Array.from(S.querySelectorAll(":scope > RuleDefinitions > TabDisplayRules > TabDisplayRule"));for(const e of qe){const t=e.getAttribute("TabCommand")??"";te.has(t)||r.push(`TabDisplayRule for ${t}: only the display rules of tabs this import adds are imported.`);const o=M(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.`)}ne.length>0&&A.push(`Ids normalised: CBS publishes CustomAction / HideCustomAction ids as {control}.CustomAction, {control}.Override.CustomAction and {control}.HideAction, so ${ne.join(", ")} will be written under those ids.`),be+z>0&&x.push(`${be+z} control(s) / definition(s) were already up to date`);const ke=E||m.changedIds.length+d.changedIds.length+C.changedIds.length+B.changedIds.length>0;return{ribbons:E?N:l.ribbons,commands:m.out,enableRules:d.out,displayRules:C.out,locLabels:H,applied:x,notApplied:r,notes:A,changed:ke}}function ct(l,y){const c=Ue.getState(),f=lt({xml:l,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 y&&f.changed&&c.applyImport(f,`${f.applied.length} change(s)`),f}const he=({items:l})=>a.jsx("ul",{style:{margin:"4px 0 0",paddingLeft:"20px",maxHeight:"160px",overflowY:"auto"},children:l.map((y,c)=>a.jsx("li",{children:a.jsx(De,{size:200,children:y})},c))}),$t=()=>{const l=Q(d=>d.importXmlOpen),y=Q(d=>d.importXmlSeed),c=Q(d=>d.importXmlNote),f=Q(d=>d.closeImportXml),[$,S]=k.useState(""),[w,L]=k.useState([]),[x,r]=k.useState(null),[A,v]=k.useState("");k.useEffect(()=>{l&&(S(y),L([]),r(null),v(""))},[l,y]);const R=d=>{S(d),x?.imported||r(null)},D=()=>{const d=Ye($);return L(d),d.every(C=>C.severity==="warning")},j=d=>{if(D()){v("");try{r({result:ct($,d),imported:d})}catch(C){r(null),v(C instanceof Error?C.message:String(C))}}},I=x?.imported===!0,m=x?.result;return a.jsx(Ve,{open:l,onOpenChange:()=>f(),children:a.jsxs(Ze,{style:{maxWidth:"960px",width:"92vw",height:"80vh",maxHeight:"860px"},children:[a.jsx(Qe,{children:"Import RibbonDiffXml"}),a.jsxs(et,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[a.jsxs(tt,{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",gap:"8px"},children:[a.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."}),c&&!$&&a.jsx(G,{intent:"info",children:a.jsx(X,{children:c})}),a.jsx("div",{style:{flex:1,minHeight:0},children:a.jsx(Ke,{language:"xml",value:$,onChange:R,readOnly:I,height:"100%",options:{wordWrap:"on",lineNumbers:"on",padding:{top:8}}})}),w.length>0&&a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:w.map((d,C)=>a.jsx(G,{intent:d.severity==="warning"?"warning":"error",children:a.jsxs(X,{children:[d.message,d.lineHint?` (${d.lineHint})`:""]})},C))}),A&&a.jsx(G,{intent:"error",children:a.jsx(X,{children:A})}),m&&a.jsx(G,{intent:m.changed?"success":"info",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:I?m.changed?"Imported — review the changes, then publish":"Nothing to import — the session already has all of it":"Preview — nothing has changed yet"}),m.applied.length>0&&a.jsx(he,{items:m.applied})]})}),m&&m.notes.length>0&&a.jsx(G,{intent:"info",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:"Good to know"}),a.jsx(he,{items:m.notes})]})}),m&&m.notApplied.length>0&&a.jsx(G,{intent:"warning",layout:"multiline",children:a.jsxs(X,{children:[a.jsx(le,{children:I?"Not imported / won't be published":"Can't be imported / won't be published"}),a.jsx(he,{items:m.notApplied})]})})]}),a.jsx(ot,{children:I?a.jsx(ee,{appearance:"primary",onClick:f,children:"Close"}):a.jsxs(a.Fragment,{children:[a.jsx(ee,{appearance:"secondary",onClick:f,children:"Cancel"}),a.jsx(ee,{appearance:"secondary",onClick:()=>j(!1),disabled:!$.trim(),children:"Preview"}),a.jsx(ee,{appearance:"primary",onClick:()=>j(!0),disabled:!$.trim(),children:"Import"})]})})]})]})})};export{$t as ImportXmlModal,$t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as t,h as J,cq as V,co as Y,z as Q,d6 as Z}from"./fluent-icons-BqJj6rDi.js";import{R,a as L}from"./monaco-BIO15LCS.js";import{a as N,u as S,d as ee,aq as w,ar as te,as as oe,at as le}from"./index-Di2_5czx.js";import{D as ae,i as ie,k as ne,j as se,aa as re,B as W,d as z,l as de,I as ce,b as X,t as s,T as U,m as pe}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const y={1033:{name:"English (US)",flag:"🇺🇸"},1031:{name:"German",flag:"🇩🇪"},1034:{name:"Spanish",flag:"🇪🇸"},1036:{name:"French",flag:"🇫🇷"},1040:{name:"Italian",flag:"🇮🇹"},1041:{name:"Japanese",flag:"🇯🇵"},1042:{name:"Korean",flag:"🇰🇷"},1043:{name:"Dutch",flag:"🇳🇱"},1044:{name:"Norwegian",flag:"🇳🇴"},1045:{name:"Polish",flag:"🇵🇱"},1046:{name:"Portuguese (Brazil)",flag:"🇧🇷"},1049:{name:"Russian",flag:"🇷🇺"},1053:{name:"Swedish",flag:"🇸🇪"},1054:{name:"Thai",flag:"🇹🇭"},1055:{name:"Turkish",flag:"🇹🇷"},1057:{name:"Indonesian",flag:"🇮🇩"},1058:{name:"Ukrainian",flag:"🇺🇦"},1066:{name:"Vietnamese",flag:"🇻🇳"},2052:{name:"Chinese (Simplified)",flag:"🇨🇳"},3082:{name:"Spanish (Spain)",flag:"🇪🇸"}},ge=Object.keys(y).map(Number),ue=Q({surface:{width:"760px",maxWidth:"95vw",maxHeight:"80vh"},body:{display:"flex",flexDirection:"column",gap:s.spacingHorizontalM,overflowY:"auto"},chipRow:{display:"flex",flexWrap:"wrap",gap:s.spacingHorizontalXS,alignItems:"center"},chip:{cursor:"pointer",userSelect:"none"},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"left",fontSize:s.fontSizeBase100,fontWeight:s.fontWeightSemibold,color:s.colorNeutralForeground3,paddingBottom:s.spacingHorizontalXS,borderBottom:`1px solid ${s.colorNeutralStroke2}`},td:{verticalAlign:"top",paddingTop:s.spacingHorizontalXS,paddingBottom:s.spacingHorizontalXS,paddingRight:s.spacingHorizontalS,borderBottom:`1px solid ${s.colorNeutralStroke3}`},langCell:{whiteSpace:"nowrap",width:"160px"},actionCell:{width:"40px"},insertBreakBtn:{fontSize:s.fontSizeBase100,height:"20px",minWidth:"unset",padding:`0 ${s.spacingHorizontalXS}`},noteBar:{backgroundColor:s.colorNeutralBackground3,borderRadius:s.borderRadiusMedium,padding:`${s.spacingHorizontalXS} ${s.spacingHorizontalS}`,fontSize:s.fontSizeBase100,color:s.colorNeutralForeground3}}),Se=()=>{const i=ue(),u=N(e=>e.localizationEditorOpen),h=N(e=>e.localizationEditorButtonId),f=N(e=>e.closeLocalizationEditor),p=S(e=>e.locLabels),B=S(e=>e.upsertLocLabel),_=S(e=>e.batch),K=S(e=>e.setButtonProp),D=S(e=>e.ribbons),d=S(e=>e.baseLanguageCode),C=R.useMemo(()=>{if(h){for(const[e,o]of Object.entries(D))for(const a of o.tabs)for(const c of a.groups)for(const l of ee(c))if(l.id===h)return{button:l,location:e,tabId:a.id,groupId:c.id}}},[D,h]),n=C?.button,j=n?.source,b=n?w(j?.labelToken,te(n.id),n.label,p,d):null,m=n?w(j?.tooltipTitleToken,oe(n.id),n.tooltipTitle,p,d):null,x=n?w(j?.tooltipBodyToken,le(n.id),n.tooltipBody,p,d):null,T=n?[[b,j?.labelToken],[m,j?.tooltipTitleToken],[x,j?.tooltipBodyToken]].filter(([e,o])=>e===null&&o).map(([,e])=>e.slice(11)).filter((e,o,a)=>a.indexOf(e)===o):[],E=L.useCallback(()=>{const e=p.find(l=>l.id===b),o=p.find(l=>l.id===m),a=p.find(l=>l.id===x),c=new Set([d]);return e?.titles.forEach(l=>c.add(l.languageCode)),o?.titles.forEach(l=>c.add(l.languageCode)),a?.titles.forEach(l=>c.add(l.languageCode)),Array.from(c).sort((l,r)=>l===d?-1:r===d?1:l-r).map(l=>l===d?{lcid:l,label:n?.label??"",tooltipTitle:n?.tooltipTitle??"",tooltipBody:n?.tooltipBody??""}:{lcid:l,label:e?.titles.find(r=>r.languageCode===l)?.description??"",tooltipTitle:o?.titles.find(r=>r.languageCode===l)?.description??"",tooltipBody:a?.titles.find(r=>r.languageCode===l)?.description??""})},[p,b,m,x,d,n]),[g,k]=L.useState([]),[$,H]=L.useState("");R.useEffect(()=>{u&&k(E())},[u,E]);const I=(e,o,a)=>{k(c=>c.map(l=>l.lcid===e?{...l,[o]:a}:l))},A=(e,o,a)=>{if(!a)return;const c=a.selectionStart??a.value.length,l=a.selectionEnd??a.value.length,r=g.find(G=>G.lcid===e)?.[o]??"",v=r.slice(0,c)+""+r.slice(l);I(e,o,v)},F=()=>{const e=parseInt($,10);!e||g.find(o=>o.lcid===e)||(k(o=>[...o,{lcid:e,label:"",tooltipTitle:"",tooltipBody:""}]),H(""))},O=e=>{e!==d&&k(o=>o.filter(a=>a.lcid!==e))},M=()=>{if(!n)return;const e=l=>g.filter(r=>r[l]).map(r=>({languageCode:r.lcid,description:r[l]})),o=g.find(l=>l.lcid===d),a={};o&&b&&o.label&&o.label!==n.label&&(a.label=o.label),o&&m&&o.tooltipTitle!==(n.tooltipTitle??"")&&(a.tooltipTitle=o.tooltipTitle||void 0),o&&x&&o.tooltipBody!==(n.tooltipBody??"")&&(a.tooltipBody=o.tooltipBody||void 0);const c=(l,r)=>!!l&&(p.some(v=>v.id===l)||e(r).some(v=>v.languageCode!==d));_(()=>{C&&Object.keys(a).length>0&&K(C.location,C.tabId,C.groupId,n.id,a),b&&c(b,"label")&&e("label").length>0&&B({id:b,titles:e("label")}),m&&c(m,"tooltipTitle")&&e("tooltipTitle").length>0&&B({id:m,titles:e("tooltipTitle")}),x&&c(x,"tooltipBody")&&e("tooltipBody").length>0&&B({id:x,titles:e("tooltipBody")})}),f()},q=g.find(e=>e.lcid===d);return t.jsx(ae,{open:u,onOpenChange:(e,o)=>!o.open&&f(),children:t.jsx(ie,{className:i.surface,children:t.jsxs(ne,{children:[t.jsxs(se,{action:t.jsx(z,{appearance:"subtle",icon:t.jsx(J,{}),onClick:f,"aria-label":"Close"}),children:[t.jsxs(re,{children:["Translations — ",q?.label||h||"Button"]}),t.jsxs(W,{appearance:"tint",size:"small",style:{marginLeft:8},children:[g.length," language",g.length!==1?"s":""]})]}),t.jsxs(de,{className:i.body,children:[t.jsxs("div",{className:i.chipRow,children:[g.map(e=>{const o=y[e.lcid];return t.jsxs(W,{className:i.chip,appearance:e.label?"filled":"outline",color:e.label?"brand":"informative",size:"medium",children:[o?.flag??"🌐"," ",o?.name??`LCID ${e.lcid}`,e.lcid!==d&&t.jsx("span",{style:{marginLeft:4,cursor:"pointer",opacity:.7},onClick:()=>O(e.lcid),"aria-label":`Remove ${o?.name}`,children:"×"})]},e.lcid)}),t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[t.jsx(ce,{size:"small",style:{width:"180px"},placeholder:"LCID or language…",value:$,onChange:(e,o)=>H(o.value),list:"lcid-list",onKeyDown:e=>e.key==="Enter"&&F()}),t.jsx("datalist",{id:"lcid-list",children:ge.filter(e=>!g.find(o=>o.lcid===e)).map(e=>t.jsxs("option",{value:String(e),children:[y[e]?.flag," ",y[e]?.name," (",e,")"]},e))}),t.jsx(z,{size:"small",appearance:"subtle",icon:t.jsx(V,{}),onClick:F,"aria-label":"Add language"})]})]}),t.jsxs("div",{className:i.noteBar,children:["💡 LCID ",d," (",y[d]?.name??"base language",`) is the organisation's base language and cannot be removed. Use "Insert " to force a line break in long labels.`]}),T.length>0&&t.jsxs("div",{className:i.noteBar,children:[T.join(", ")," ",T.length===1?"is a label":"are labels"," of another solution, shared with the controls that use ",T.length===1?"it":"them",", so ",T.length===1?"it isn't":"they aren't"," edited here. Change the text in Properties to give this button a label of its own, then add translations."]}),t.jsxs("table",{className:i.table,children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{className:i.th,style:{width:"160px"},children:"Language"}),t.jsx("th",{className:i.th,children:"Label"}),t.jsx("th",{className:i.th,children:"Tooltip title"}),t.jsx("th",{className:i.th,children:"Tooltip body"}),t.jsx("th",{className:i.th,style:{width:"40px"}})]})}),t.jsx("tbody",{children:g.map(e=>{const o=y[e.lcid];return t.jsxs("tr",{children:[t.jsxs("td",{className:`${i.td} ${i.langCell}`,children:[t.jsxs(X,{size:200,children:[o?.flag??"🌐"," ",o?.name??`LCID ${e.lcid}`]}),t.jsx("br",{}),t.jsx(X,{size:100,style:{color:s.colorNeutralForeground3},children:e.lcid})]}),t.jsx("td",{className:i.td,children:t.jsx(P,{value:e.label,disabled:!b,onChange:a=>I(e.lcid,"label",a),onInsertBreak:a=>A(e.lcid,"label",a)})}),t.jsx("td",{className:i.td,children:t.jsx(P,{value:e.tooltipTitle,disabled:!m,onChange:a=>I(e.lcid,"tooltipTitle",a),onInsertBreak:a=>A(e.lcid,"tooltipTitle",a)})}),t.jsx("td",{className:i.td,children:t.jsx(he,{value:e.tooltipBody,disabled:!x,onChange:a=>I(e.lcid,"tooltipBody",a)})}),t.jsx("td",{className:`${i.td} ${i.actionCell}`,children:e.lcid!==d&&t.jsx(U,{content:"Remove this language",relationship:"label",children:t.jsx(z,{appearance:"subtle",size:"small",icon:t.jsx(Y,{}),onClick:()=>O(e.lcid),"aria-label":"Remove language"})})})]},e.lcid)})})]})]}),t.jsxs(pe,{children:[t.jsx(z,{appearance:"secondary",onClick:f,children:"Cancel"}),t.jsx(z,{appearance:"primary",onClick:M,children:"Save translations"})]})]})})})};function P({value:i,disabled:u,onChange:h,onInsertBreak:f}){const p=R.useRef(null);return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("input",{ref:p,style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box"},value:i,disabled:u,onChange:B=>h(B.target.value)}),t.jsx(U,{content:"Insert Dataverse line break ()",relationship:"label",children:t.jsxs("button",{type:"button",disabled:u,onClick:()=>f(p.current),style:{fontSize:11,border:"none",background:"none",color:"var(--colorNeutralForeground3)",cursor:"pointer",padding:0,textAlign:"left",display:"flex",alignItems:"center",gap:2},children:[t.jsx(Z,{fontSize:12})," Insert ⏎"]})})]})}function he({value:i,disabled:u,onChange:h}){return t.jsx("textarea",{style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box",resize:"vertical",minHeight:"42px"},value:i,disabled:u,onChange:f=>h(f.target.value),rows:2})}export{Se as LocalizationEditor,Se as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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{a as l,R as f,_ as h}from"./monaco-BIO15LCS.js";import{y as t}from"./fluent-icons-
|
|
2
|
+
import{a as l,R as f,_ as h}from"./monaco-BIO15LCS.js";import{y as t}from"./fluent-icons-BqJj6rDi.js";import{a as u}from"./index-Di2_5czx.js";import{a5 as x}from"./fluent-ui-QADO660t.js";const _=f.lazy(()=>h(()=>import("./monaco-BIO15LCS.js").then(o=>o.i),__vite__mapDeps([0,1]),import.meta.url)),v=({language:o,value:r,onChange:a,readOnly:s=!1,height:i="100%",options:m={},onMount:n})=>{const d=u(e=>e.themeMode)==="dark"?"vs-dark":"vs",c={readOnly:s,minimap:{enabled:!1},wordWrap:o==="xml"?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,...m},p=e=>{a&&e!==void 0&&a(e)};return t.jsx(l.Suspense,{fallback:t.jsx(x,{size:"medium",label:"Loading editor…"}),children:t.jsx(_,{height:i,language:o,value:r,theme:d,options:c,onChange:p,onMount:n})})};export{v as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e}from"./fluent-icons-
|
|
1
|
+
import{y as e}from"./fluent-icons-BqJj6rDi.js";import{a as S}from"./monaco-BIO15LCS.js";import{a as B,u as i,ab as b,Z as m,d as O,ac as G,P as K}from"./index-Di2_5czx.js";import{D as _,i as q,j as z,k as M,l as U,F as C,I as Y,S as Z,b as $,m as H,d as I}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.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=m(t=>t.publisherPrefix),E=m(t=>t.activeSolution),s=b(t=>t.location),k=b(t=>t.tabId),P=m(t=>t.activeEntity),R=n!==null,[r,p]=S.useState("New Button"),[x,h]=S.useState("button"),T=()=>{if(!n||!s)return;const t=E?.publisherPrefix?.trim()||D?.trim()||"new",a=P?.logicalName??"global",c=i.getState().ribbons,F=i.getState().commands,f=new Set(F.map(o=>o.id));for(const o of Object.values(c))for(const d of o.tabs)for(const L of d.groups)for(const A of O(L))f.add(A.id);const{id:g,commandId:j}=G(t,a,s,r,f),u=c[s].tabs.find(o=>o.groups.some(d=>d.id===n))?.id??k;if(!c[s].tabs.some(o=>o.id===u)){K.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:x,templateAlias:"o1",commandId:j,hidden:!1,oob:!1,custom:!0,managed:!1}}),w({id:j,enableRules:[],displayRules:[],actions:[]})}),N(s,u,n,g),p("New Button"),h("button"),l()};return e.jsx(_,{open:R,onOpenChange:()=>l(),children:e.jsxs(q,{children:[e.jsx(z,{children:"New button"}),e.jsxs(M,{children:[e.jsxs(U,{children:[e.jsx(C,{label:"Label",required:!0,children:e.jsx(Y,{value:r,onChange:(t,a)=>p(a.value),autoFocus:!0})}),e.jsx(C,{label:"Kind",children:e.jsxs(Z,{value:x,onChange:(t,a)=>h(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:T,disabled:!r.trim(),children:"Create button"})]})]})]})})};export{tt as NewButtonModal,tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e}from"./fluent-icons-
|
|
1
|
+
import{y as e}from"./fluent-icons-BqJj6rDi.js";import{a as u}from"./monaco-BIO15LCS.js";import{a as p,u as g,ab as d}from"./index-Di2_5czx.js";import{D as y,i as v,j as w,k as G,l as C,F as x,I as F,S as L,b as S,m as f,d as h}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const O=()=>{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(y,{open:b,onOpenChange:()=>a(),children:e.jsxs(v,{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{O as NewGroupModal,O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e,h as B,z as F}from"./fluent-icons-
|
|
1
|
+
import{y as e,h as B,z as F}from"./fluent-icons-BqJj6rDi.js";import{a as S,R as E}from"./monaco-BIO15LCS.js";import{ab as _,u as c,Z as N,a as C,ad as O,ae as L,af as $,ag as H}from"./index-Di2_5czx.js";import{D as G,i as U,k as Z,j as q,aa as P,d as p,l as W,M as D,f as I,b as d,F as v,I as w,t as s,m as X}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.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,h]=S.useState("New Tab"),[g,x]=S.useState(""),o=_(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=E.useMemo(()=>O({baseline:m,layers:j},u),[m,j,u]),M=o==="Application"?"global":z?.logicalName??u[o].entityLogicalName,f=L(M,`${o}.${t}`,"Tab",y),n=g.trim(),r=n?$(n)??(/[^a-zA-Z0-9._]/.test(n)?"Use letters, digits, dots and underscores only":y.has(n)?"This ID is already used":null):null,T=n||f,k=()=>{r||(R(o,{id:T,label:t,tabDisplayRules:[],groups:[]}),h("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(Z,{children:[e.jsx(q,{action:e.jsx(p,{appearance:"subtle",icon:e.jsx(B,{}),onClick:l,"aria-label":"Close"}),children:e.jsx(P,{children:"Add Tab"})}),e.jsxs(W,{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)=>h(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:f})}),e.jsxs("div",{children:[e.jsx(d,{size:100,style:{color:s.colorNeutralForeground3},children:"Generated ID:"}),e.jsx("div",{className:b.hint,children:T})]}),e.jsxs(d,{size:200,style:{color:s.colorNeutralForeground3},children:["Location: ",e.jsx("strong",{children:o})]})]}),e.jsxs(X,{children:[e.jsx(p,{appearance:"secondary",onClick:l,children:"Cancel"}),e.jsx(p,{appearance:"primary",disabled:!t.trim()||!!r,onClick:k,children:"Create tab"})]})]})})})};export{se as NewTabModal,se as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as e,z as L,h as U,cq as X}from"./fluent-icons-BqJj6rDi.js";import{a as F,R as re}from"./monaco-BIO15LCS.js";import{a as P,u as O}from"./index-Di2_5czx.js";import{R as ie,i as te,a as V}from"./ruleKinds-B9hACGaq.js";import{b as f,t as s,I as m,d as k,B as K,F as t,S as p,an as w,P as q,c as Q,e as Y,ai as se,aj as oe,ak as ce,al as ue,M as de,f as pe,a7 as H}from"./fluent-ui-QADO660t.js";import{C as he,u as me}from"./useStableKeys-p2OkzZWO.js";import{D as xe,c as ye,S as ve,v as je,f as ge,g as Re,C as be}from"./dnd-Cq8OftAq.js";import"./crmParameters-rgfZhhzN.js";const fe=L({root:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXS},search:{marginBottom:s.spacingVerticalXS},group:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXXS},groupLabel:{color:s.colorNeutralForeground3,paddingTop:s.spacingVerticalXS},kindButton:{justifyContent:"flex-start",textAlign:"left"}});function Ce(l){switch(l){case"CommandClientTypeRule":return{kind:l,type:"Modern"};case"CrmClientTypeRule":return{kind:l,type:"Web"};case"FormStateRule":return{kind:l,state:"Existing"};case"FormTypeRule":return{kind:l,type:"Main"};case"SelectionCountRule":return{kind:l,minimum:1};case"EntityRule":return{kind:l};case"CustomRule":return{kind:l,library:"$webresource:",functionName:""};case"ValueRule":return{kind:l,field:"",value:""};case"SkuRule":return{kind:l,sku:"Online"};case"OrRule":return{kind:l,groups:[[{kind:"FormStateRule",state:"Existing"}],[{kind:"FormStateRule",state:"Create"}]]};case"FeatureControlRule":return{kind:l,featureControlBit:"",expectedValue:!0};case"OrganizationSettingRule":return{kind:l,setting:"IsSharepointEnabled"};case"EntityPrivilegeRule":return{kind:l,privilegeType:"Read",privilegeDepth:"Basic"};case"EntityPropertyRule":return{kind:l,propertyName:"IsCustomizable",propertyValue:!0};case"RecordPrivilegeRule":return{kind:l,privilegeType:"Read"};case"RelationshipTypeRule":return{kind:l,appliesTo:"SelectedEntity"};case"MiscellaneousPrivilegeRule":return{kind:l,privilegeName:"ExportToExcel"};case"FormEntityContextRule":return{kind:l,entityName:""};case"PageRule":return{kind:l,address:""};case"CrmOfflineAccessStateRule":return{kind:l,state:"Online"};case"CrmOutlookClientTypeRule":return{kind:l,type:"CrmForOutlook"};case"CrmOutlookClientVersionRule":return{kind:l,major:15,minor:0,build:0,revision:0};case"DeviceTypeRule":return{kind:l,type:"Web"};case"OptionSetRule":return{kind:l,optionSet:"",stateCode:"",objectTypeCode:""};case"OutlookItemTrackingRule":return{kind:l,trackedInCrm:!0};case"OutlookRenderTypeRule":return{kind:l,type:"Web"};case"OutlookVersionRule":return{kind:l,version:"2010"};case"HideForTabletExperienceRule":return{kind:l};case"ReferencingAttributeRequiredRule":return{kind:l};default:return{kind:l}}}const J=({onSelect:l,container:c,insideOr:d=!1})=>{const h=fe(),[u,E]=F.useState(""),T=ie.map(v=>({...v,kinds:v.kinds.filter(j=>{if(c&&!te(j,c,d)||d&&j==="OrRule")return!1;const N=V[j]??j;return!u||N.toLowerCase().includes(u.toLowerCase())||j.toLowerCase().includes(u.toLowerCase())})})).filter(v=>v.kinds.length>0);return e.jsxs("div",{className:h.root,children:[e.jsx(f,{size:100,style:{color:s.colorNeutralForeground3},children:"Quick action rules are OOB references and should be bound by ID (for example, Mscrm.ShowOnQuickAction), not created as custom step kinds."}),e.jsx(m,{className:h.search,placeholder:"Search rule kinds…",value:u,onChange:(v,j)=>E(j.value)}),T.map(v=>e.jsxs("div",{className:h.group,children:[e.jsx(f,{size:100,weight:"semibold",className:h.groupLabel,children:v.label}),v.kinds.map(j=>e.jsx(k,{appearance:"subtle",className:h.kindButton,onClick:()=>l(Ce(j)),children:V[j]??j},j))]},v.label))]})},Se=L({step:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXS,padding:s.spacingVerticalS,border:`1px solid ${s.colorNeutralStroke2}`,borderRadius:s.borderRadiusMedium,backgroundColor:s.colorNeutralBackground2},header:{display:"flex",alignItems:"center",justifyContent:"space-between"},kindBadge:{flexShrink:0},fields:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXS},row:{display:"flex",gap:s.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"},nested:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXS,paddingLeft:s.spacingHorizontalM,borderLeft:`2px solid ${s.colorBrandStroke2}`},nestedToolbar:{display:"flex",alignItems:"center",gap:s.spacingHorizontalXS},pickerSurface:{minWidth:"300px",maxHeight:"50vh",overflowY:"auto",padding:s.spacingVerticalS}}),G=["Create","Read","Write","Delete","Assign","Share","Append","AppendTo"],W=["None","Basic","Local","Deep","Global"],Ee=["DuplicateDetectionEnabled","GridFiltersEnabled","HasStateCode","IsConnectionsEnabled","MailMergeEnabled","WorksWithQueue","HasActivities","IsActivity","HasNotes","IsCustomizable","IsActivityParty","HasEmailAddresses","IsChildEntity","IsImportable","IsEnabledForCharts","IsBusinessProcessEnabled","HasFeedback","IsBPFEntity"],Te=["ExportToExcel","MailMerge","GoOffline","OfflineSynchronize","PublishReports"],Z=({step:l,onChange:c,onRemove:d,container:h})=>{const u=Se(),[E,T]=re.useState(null),v=l.kind!=="OrRule"&&l.kind!=="RawRule",j=v?l.invertResult:void 0,N=v?l.default:void 0,r=a=>{c({...l,...a})},$=a=>{if(!a.trim())return;const n=parseInt(a,10);return Number.isNaN(n)?void 0:n},A=()=>{switch(l.kind){case"CommandClientTypeRule":return e.jsx(t,{label:"Type",children:e.jsxs(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"Modern",children:"Modern (Unified Interface: web, tablets and phones)"}),e.jsx("option",{value:"Refresh",children:"Refresh (legacy updated web client)"}),e.jsx("option",{value:"Legacy",children:"Legacy (classic ribbon + Outlook list views)"})]})});case"CrmClientTypeRule":return e.jsx(t,{label:"Type",children:e.jsxs(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"Web",children:"Web"}),e.jsx("option",{value:"Outlook",children:"Outlook"})]})});case"FormStateRule":return e.jsx(t,{label:"State",children:e.jsx(p,{value:l.state,onChange:(a,n)=>r({state:n.value}),children:["Create","Existing","ReadOnly","Disabled","BulkEdit"].map(a=>e.jsx("option",{value:a,children:a},a))})});case"FormTypeRule":return e.jsx(t,{label:"Type",children:e.jsx(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:["Main","Preview","AppointmentBook","Dashboard","Quick","QuickCreate","Card","MainInteractionCentric"].map(a=>e.jsx("option",{value:a,children:a},a))})});case"SelectionCountRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Minimum",children:e.jsx(m,{type:"number",value:String(l.minimum??""),onChange:(a,n)=>r({minimum:$(n.value)}),style:{width:"80px"}})}),e.jsx(t,{label:"Maximum",children:e.jsx(m,{type:"number",value:String(l.maximum??""),onChange:(a,n)=>r({maximum:$(n.value)}),style:{width:"80px"}})}),e.jsx(t,{label:"Applies To",children:e.jsxs(p,{value:l.appliesTo??"",onChange:(a,n)=>r({appliesTo:n.value}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"}),e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})]})})]});case"EntityRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Entity name",children:e.jsx(m,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(t,{label:"Applies To",children:e.jsxs(p,{value:l.appliesTo??"",onChange:(a,n)=>r({appliesTo:n.value}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"}),e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})]})}),e.jsx(t,{label:"Context",children:e.jsxs(p,{value:l.context??"",onChange:(a,n)=>r({context:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"Form",children:"Form"}),e.jsx("option",{value:"HomePageGrid",children:"HomePageGrid"}),e.jsx("option",{value:"SubGridStandard",children:"SubGridStandard"}),e.jsx("option",{value:"SubGridAssociated",children:"SubGridAssociated"})]})})]});case"FormEntityContextRule":return e.jsx(t,{label:"Entity name",children:e.jsx(m,{value:l.entityName,onChange:(a,n)=>r({entityName:n.value})})});case"CustomRule":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Library ($webresource:)",children:e.jsx(m,{value:l.library,onChange:(a,n)=>r({library:n.value}),placeholder:"$webresource:..."})}),e.jsx(t,{label:"Function name",children:e.jsx(m,{value:l.functionName,onChange:(a,n)=>r({functionName:n.value})})})]}),e.jsx(t,{label:"Parameters",children:e.jsx(he,{params:l.params??[],onChange:a=>r({params:a.length?a:void 0})})}),e.jsx(f,{size:100,style:{color:s.colorNeutralForeground3},children:"Async support: on Unified Interface, custom rules can return Promise<boolean>; unresolved promises default to false after 10 seconds."})]});case"CrmOfflineAccessStateRule":return e.jsx(t,{label:"State",children:e.jsxs(p,{value:l.state,onChange:(a,n)=>r({state:n.value}),children:[e.jsx("option",{value:"Online",children:"Online"}),e.jsx("option",{value:"Offline",children:"Offline"})]})});case"CrmOutlookClientTypeRule":return e.jsx(t,{label:"Type",children:e.jsxs(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"CrmForOutlook",children:"CrmForOutlook"}),e.jsx("option",{value:"CrmForOutlookOfflineAccess",children:"CrmForOutlookOfflineAccess"})]})});case"CrmOutlookClientVersionRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Major",children:e.jsx(m,{type:"number",value:String(l.major),onChange:(a,n)=>r({major:$(n.value)??l.major}),style:{width:"84px"}})}),e.jsx(t,{label:"Minor",children:e.jsx(m,{type:"number",value:String(l.minor??""),onChange:(a,n)=>r({minor:$(n.value)}),style:{width:"84px"}})}),e.jsx(t,{label:"Build",children:e.jsx(m,{type:"number",value:String(l.build??""),onChange:(a,n)=>r({build:$(n.value)}),style:{width:"84px"}})}),e.jsx(t,{label:"Revision",children:e.jsx(m,{type:"number",value:String(l.revision??""),onChange:(a,n)=>r({revision:$(n.value)}),style:{width:"84px"}})})]});case"DeviceTypeRule":return e.jsx(t,{label:"Device type",children:e.jsxs(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"None",children:"None"}),e.jsx("option",{value:"Phone",children:"Phone"}),e.jsx("option",{value:"Tablet",children:"Tablet"}),e.jsx("option",{value:"Web",children:"Web"}),e.jsx("option",{value:"Outlook",children:"Outlook"}),e.jsx("option",{value:"InteractionCentric",children:"InteractionCentric"})]})});case"EntityPrivilegeRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Entity (optional)",children:e.jsx(m,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(t,{label:"Applies To",children:e.jsxs(p,{value:l.appliesTo??"",onChange:(a,n)=>r({appliesTo:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"}),e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})]})}),e.jsx(t,{label:"Privilege",children:e.jsx(p,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(t,{label:"Depth",children:e.jsx(p,{value:l.privilegeDepth,onChange:(a,n)=>r({privilegeDepth:n.value}),children:W.map(a=>e.jsx("option",{value:a,children:a},a))})})]});case"EntityPropertyRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Entity (optional)",children:e.jsx(m,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(t,{label:"Applies To",children:e.jsxs(p,{value:l.appliesTo??"",onChange:(a,n)=>r({appliesTo:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"}),e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})]})}),e.jsx(t,{label:"Property",children:e.jsx(p,{value:l.propertyName,onChange:(a,n)=>r({propertyName:n.value}),children:Ee.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(w,{label:"Property value",checked:l.propertyValue,onChange:(a,n)=>r({propertyValue:n.checked===!0})})]});case"ValueRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Field",children:e.jsx(m,{value:l.field,onChange:(a,n)=>r({field:n.value})})}),e.jsx(t,{label:"Value",children:e.jsx(m,{value:l.value,onChange:(a,n)=>r({value:n.value})})})]});case"OrRule":{const a=g=>c({...l,groups:g.filter(R=>R.length>0)}),n=(g,R)=>e.jsxs(q,{open:E===g,onOpenChange:(x,o)=>T(o.open?g:null),children:[e.jsx(Q,{children:e.jsx(k,{icon:e.jsx(X,{}),appearance:"secondary",size:"small",children:R})}),e.jsx(Y,{className:u.pickerSurface,children:e.jsx(J,{container:h,insideOr:!0,onSelect:x=>{a(g==="new"?[...l.groups,[x]]:l.groups.map((o,b)=>b===g?[...o,x]:o)),T(null)}})})]});return e.jsxs("div",{className:u.nested,children:[l.groups.map((g,R)=>e.jsxs("div",{className:u.nested,children:[e.jsxs(f,{size:100,weight:"semibold",children:[R===0?"Either":"Or",g.length>1?" (all of)":""]}),g.map((x,o)=>e.jsx(Z,{step:x,container:h,onChange:b=>a(l.groups.map((C,_)=>_===R?C.map((I,M)=>M===o?b:I):C)),onRemove:()=>a(l.groups.map((b,C)=>C===R?b.filter((_,I)=>I!==o):b))},`${R}-${o}-${x.kind}`)),e.jsx("div",{className:u.nestedToolbar,children:n(R,"And…")})]},R)),e.jsxs("div",{className:u.nestedToolbar,children:[n("new","Add Or branch"),e.jsx(f,{size:100,style:{color:s.colorNeutralForeground3},children:"An OrRule needs at least two branches."})]})]})}case"FeatureControlRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Feature control bit",children:e.jsx(m,{value:l.featureControlBit,onChange:(a,n)=>r({featureControlBit:n.value})})}),e.jsx(w,{label:"Expected value",checked:l.expectedValue,onChange:(a,n)=>r({expectedValue:n.checked===!0})})]});case"RawRule":return e.jsxs(e.Fragment,{children:[e.jsx(f,{size:100,style:{color:s.colorNeutralForeground3},children:"Command Bar Studio doesn't edit this rule; it is kept exactly as loaded."}),e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontSize:"11px"},children:l.xml})]});case"SkuRule":return e.jsx(t,{label:"SKU",children:e.jsxs(p,{value:l.sku,onChange:(a,n)=>r({sku:n.value}),children:[e.jsx("option",{value:"Online",children:"Online"}),e.jsx("option",{value:"OnPremise",children:"OnPremise"}),e.jsx("option",{value:"Spla",children:"Spla"})]})});case"OrganizationSettingRule":return e.jsx(t,{label:"Setting",children:e.jsx(p,{value:l.setting,onChange:(a,n)=>r({setting:n.value}),children:["IsSharepointEnabled","IsSOPIntegrationEnabled","IsFiscalCalendarDefined","IsReadFormModeDefined","IsBPFEntityCustomizationFeatureEnabled"].map(a=>e.jsx("option",{value:a,children:a},a))})});case"MiscellaneousPrivilegeRule":return e.jsxs("div",{className:u.row,children:[e.jsxs(t,{label:"Privilege name",children:[e.jsx(m,{value:l.privilegeName,onChange:(a,n)=>r({privilegeName:n.value}),placeholder:"ExportToExcel",list:"misc-privilege-suggestions"}),e.jsx("datalist",{id:"misc-privilege-suggestions",children:Te.map(a=>e.jsx("option",{value:a},a))})]}),e.jsx(t,{label:"Depth (optional)",children:e.jsxs(p,{value:l.privilegeDepth??"",onChange:(a,n)=>r({privilegeDepth:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),W.map(a=>e.jsx("option",{value:a,children:a},a))]})})]});case"OptionSetRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Option set",children:e.jsx(m,{value:l.optionSet,onChange:(a,n)=>r({optionSet:n.value})})}),e.jsx(t,{label:"State code",children:e.jsx(m,{value:l.stateCode,onChange:(a,n)=>r({stateCode:n.value})})}),e.jsx(t,{label:"Object type code",children:e.jsx(m,{value:l.objectTypeCode,onChange:(a,n)=>r({objectTypeCode:n.value})})})]});case"OutlookItemTrackingRule":return e.jsxs("div",{className:u.row,children:[e.jsx(w,{label:"Tracked in CRM",checked:l.trackedInCrm,onChange:(a,n)=>r({trackedInCrm:n.checked===!0})}),e.jsx(t,{label:"Applies To",children:e.jsx(p,{value:l.appliesTo??"PrimaryEntity",onChange:(a,n)=>r({appliesTo:n.value}),children:e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"})})})]});case"OutlookRenderTypeRule":return e.jsx(t,{label:"Render type",children:e.jsxs(p,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"Web",children:"Web"}),e.jsx("option",{value:"Outlook",children:"Outlook"})]})});case"OutlookVersionRule":return e.jsx(t,{label:"Outlook version",children:e.jsxs(p,{value:l.version,onChange:(a,n)=>r({version:n.value}),children:[e.jsx("option",{value:"2003",children:"2003"}),e.jsx("option",{value:"2007",children:"2007"}),e.jsx("option",{value:"2010",children:"2010"})]})});case"PageRule":return e.jsx(t,{label:"Address pattern",children:e.jsx(m,{value:l.address,onChange:(a,n)=>r({address:n.value}),placeholder:"main.aspx"})});case"RecordPrivilegeRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Privilege",children:e.jsx(p,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(t,{label:"Applies To",children:e.jsxs(p,{value:l.appliesTo??"",onChange:(a,n)=>r({appliesTo:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Default"}),e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"})]})})]});case"RelationshipTypeRule":return e.jsxs("div",{className:u.row,children:[e.jsx(t,{label:"Applies To",children:e.jsx(p,{value:l.appliesTo,disabled:!0,children:e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})})}),e.jsx(t,{label:"Relationship type",children:e.jsxs(p,{value:l.relationshipType??"",onChange:(a,n)=>r({relationshipType:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"OneToMany",children:"OneToMany"}),e.jsx("option",{value:"ManyToMany",children:"ManyToMany"}),e.jsx("option",{value:"NoRelationship",children:"NoRelationship"})]})}),e.jsx(w,{label:"Allow custom relationship",checked:l.allowCustomRelationship===!0,onChange:(a,n)=>r({allowCustomRelationship:n.checked===!0})}),e.jsx(w,{label:"Allow system relationship",checked:l.allowSystemRelationship===!0,onChange:(a,n)=>r({allowSystemRelationship:n.checked===!0})})]});default:return e.jsxs(f,{size:200,italic:!0,style:{color:s.colorNeutralForeground3},children:[l.kind," — no additional parameters"]})}};return e.jsxs("div",{className:u.step,role:"listitem",children:[e.jsxs("div",{className:u.header,children:[e.jsx(K,{appearance:"outline",size:"small",className:u.kindBadge,children:V[l.kind]??l.kind}),e.jsx(k,{appearance:"subtle",icon:e.jsx(U,{}),size:"small",onClick:d,"aria-label":`Remove ${l.kind} step`})]}),e.jsxs("div",{className:u.fields,children:[A(),e.jsx("div",{className:u.row,children:v&&e.jsxs(e.Fragment,{children:[e.jsx(t,{label:"Default",title:"Value the rule returns when it cannot be evaluated.",children:e.jsxs(p,{value:N===void 0?"":String(N),onChange:(a,n)=>r({default:n.value===""?void 0:n.value==="true"}),children:[e.jsx("option",{value:"",children:"(not set)"}),e.jsx("option",{value:"true",children:"true"}),e.jsx("option",{value:"false",children:"false"})]})}),e.jsx(w,{label:"Invert result",checked:j===!0,title:"Reverse the evaluated result.",onChange:(a,n)=>r({invertResult:n.checked===!0?!0:void 0})})]})})]})]})};function Ne(l){return l.length===0?"No steps defined — a rule needs at least one before it can be published.":l.map(B).join(" AND ")}function B(l){const c="invertResult"in l&&l.invertResult?"NOT ":"";switch(l.kind){case"SelectionCountRule":{const d=l.minimum!==void 0?`at least ${l.minimum}`:null,h=l.maximum!==void 0?`at most ${l.maximum}`:null,u=[d,h].filter(Boolean).join(" and "),E=l.appliesTo?` (${l.appliesTo})`:"";return`${c}Selection count is ${u}${E}`}case"EntityRule":{const d=l.entityName??"any entity",h=l.context?` in ${l.context} context`:"",u=l.appliesTo?` (${l.appliesTo})`:"";return`${c}Entity is "${d}"${h}${u}`}case"FormStateRule":return`${c}Form state is "${l.state}"`;case"CommandClientTypeRule":return`${c}Client type is "${l.type}" (${$e(l.type)})`;case"CrmClientTypeRule":return`${c}CRM client type is "${l.type}"`;case"CustomRule":return`${c}Custom rule: ${l.functionName}() from ${l.library}`;case"OrRule":return`(${l.groups.map(h=>h.length===1?B(h[0]):`(${h.map(B).join(" AND ")})`).join(" OR ")})`;case"FeatureControlRule":return`${c}Feature "${l.featureControlBit}" is ${l.expectedValue?"on":"off"}`;case"RawRule":return`${l.tagName} (kept as XML)`;case"MiscellaneousPrivilegeRule":{const d=l.privilegeDepth?` at ${l.privilegeDepth} depth`:"";return`${c}User has "${l.privilegeName}" privilege${d}`}case"EntityPrivilegeRule":{const d=l.entityName?` on "${l.entityName}"`:"",h=l.appliesTo?` (${l.appliesTo})`:"";return`${c}User has ${l.privilegeType} privilege${d} at ${l.privilegeDepth} depth${h}`}case"EntityPropertyRule":{const d=l.entityName?` for "${l.entityName}"`:"";return`${c}Entity property "${l.propertyName}" is ${l.propertyValue}${d}`}case"FormTypeRule":return`${c}Form type is "${l.type}"`;case"FormEntityContextRule":return`${c}Form entity context is "${l.entityName}"`;case"ValueRule":return`${c}Field "${l.field}" equals "${l.value}"`;case"SkuRule":return`${c}SKU is "${l.sku}"`;case"HideForTabletExperienceRule":return`${c}Hide for tablet experience`;case"OrganizationSettingRule":return`${c}Organization setting "${l.setting}" is enabled`;case"PageRule":return`${c}Page address matches "${l.address}"`;case"RecordPrivilegeRule":{const d=l.appliesTo?` (${l.appliesTo})`:"";return`${c}User has ${l.privilegeType} privilege on current record${d}`}case"RelationshipTypeRule":{const d=l.relationshipType??"any";return`${c}Relationship type is "${d}" (${l.appliesTo})`}case"ReferencingAttributeRequiredRule":return`${c}Referencing attribute is required`;case"OutlookItemTrackingRule":return`${c}Outlook item is ${l.trackedInCrm?"":"not "}tracked in CRM`;case"OutlookRenderTypeRule":return`${c}Outlook render type is "${l.type}"`;case"OutlookVersionRule":return`${c}Outlook version is "${l.version}"`;case"CrmOfflineAccessStateRule":return`${c}CRM offline state is "${l.state}"`;case"CrmOutlookClientTypeRule":return`${c}CRM Outlook client type is "${l.type}"`;case"CrmOutlookClientVersionRule":return`${c}CRM Outlook client version is ${l.major}.${l.minor??0}+`;case"DeviceTypeRule":return`${c}Device type is "${l.type}"`;case"OptionSetRule":return`${c}Option set "${l.optionSet}" state code is "${l.stateCode}"`;default:return"Unknown rule step"}}function $e(l){switch(l){case"Modern":return"Unified Interface";case"Refresh":return"legacy updated web client";case"Legacy":return"Classic ribbon / Outlook list views";default:return l}}const Oe=L({drawer:{width:"560px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:s.spacingVerticalS,padding:s.spacingVerticalM,overflowY:"auto"},header:{display:"flex",alignItems:"center",gap:s.spacingHorizontalS},stepsList:{display:"flex",flexDirection:"column",gap:s.spacingVerticalXS,listStyle:"none",padding:0,margin:0},summary:{padding:s.spacingVerticalS,backgroundColor:s.colorNeutralBackground3,borderRadius:s.borderRadiusMedium,fontStyle:"italic",color:s.colorNeutralForeground2,fontSize:s.fontSizeBase200},addRow:{display:"flex",gap:s.spacingHorizontalS},pickerPopover:{maxHeight:"60vh",overflowY:"auto",minWidth:"320px",padding:s.spacingVerticalM},usedBy:{color:s.colorNeutralForeground3,fontSize:s.fontSizeBase200},ruleIdRow:{display:"flex",alignItems:"flex-end",gap:s.spacingHorizontalS},ruleIdInput:{fontFamily:s.fontFamilyMonospace},error:{color:s.colorPaletteRedForeground1,fontSize:s.fontSizeBase100},sortableItem:{listStyle:"none"},sortableInner:{display:"flex",alignItems:"flex-start",gap:s.spacingHorizontalS},dragHandle:{marginTop:s.spacingVerticalS,cursor:"grab"}}),ke=[],Ve=()=>{const l=Oe(),c=P(i=>i.ruleEditorOpen),d=P(i=>i.ruleEditorId),h=P(i=>i.ruleEditorKind),u=P(i=>i.closeRuleEditor),E=P(i=>i.openRuleEditor),T=O(i=>i.enableRules),v=O(i=>i.displayRules),j=O(i=>i.commands),N=O(i=>i.upsertEnableRule),r=O(i=>i.upsertDisplayRule),$=O(i=>i.renameEnableRuleId),A=O(i=>i.renameDisplayRuleId),[a,n]=F.useState(!1),[g,R]=F.useState(""),x=h==="enable",o=x?T.find(i=>i.id===d):v.find(i=>i.id===d);F.useEffect(()=>{o&&R(o.id)},[o]);const b=me(`${h}:${o?.id??""}`,o?.steps??ke),C=b.keys,_=j.filter(i=>x?i.enableRules.includes(d??""):i.displayRules.includes(d??"")).length,I=(i,y)=>{if(!o)return;const S=[...o.steps];S[i]=y,b.update(),x?N({...o,steps:S}):r({...o,steps:S})},M=i=>{if(!o)return;const y=o.steps.filter((S,D)=>D!==i);b.remove(i),x?N({...o,steps:y}):r({...o,steps:y})},ee=i=>{if(!o)return;const y=[...o.steps,i];b.add(),x?N({...o,steps:y}):r({...o,steps:y}),n(!1)},le=i=>{if(!o||!i.over||i.active.id===i.over.id)return;const y=C.indexOf(String(i.active.id)),S=C.indexOf(String(i.over.id));if(y<0||S<0)return;const D=ge(o.steps,y,S);b.move(y,S),x?N({...o,steps:D}):r({...o,steps:D})};if(!o)return null;const ne=Ne(o.steps),ae=(x?T:v).some(i=>i.id===g.trim()&&i.id!==o.id),z=g.trim()?/\s/.test(g)?"Rule ID cannot contain whitespace.":ae?"A rule with this ID already exists.":"":"Rule ID is required.";return e.jsxs(se,{position:"end",open:c,onOpenChange:()=>u(),className:l.drawer,children:[e.jsx(oe,{children:e.jsx(ce,{action:e.jsx(k,{appearance:"subtle",icon:e.jsx(U,{}),onClick:u,"aria-label":"Close rule editor"}),children:e.jsxs("div",{className:l.header,children:[e.jsx(K,{appearance:"filled",color:x?"success":"informative",size:"small",children:x?"Enable":"Display"}),e.jsx(f,{size:400,weight:"semibold",style:{fontFamily:s.fontFamilyMonospace},children:o.id})]})})}),e.jsxs(ue,{className:l.body,children:[e.jsxs(f,{className:l.usedBy,children:["Used by ",_," command(s)"]}),e.jsxs("div",{className:l.ruleIdRow,children:[e.jsx(m,{className:l.ruleIdInput,value:g,onChange:(i,y)=>R(y.value),"aria-label":"Rule ID"}),e.jsx(k,{appearance:"secondary",size:"small",disabled:!g.trim()||!!z||g===o.id,onClick:()=>{const i=g.trim();(x?$(o.id,i):A(o.id,i))&&E(i,x?"enable":"display")},children:"Apply ID change"})]}),z&&e.jsx(f,{className:l.error,children:z}),x&&e.jsx(de,{intent:"warning",children:e.jsx(pe,{children:"Enable rules have a restricted set of allowed step types. Display-only rule kinds are disabled."})}),e.jsx(H,{children:"Steps (ALL must pass)"}),e.jsx(xe,{collisionDetection:ye,onDragEnd:le,children:e.jsx(ve,{items:C,strategy:je,children:e.jsxs("ol",{className:l.stepsList,role:"list","aria-label":"Rule steps",children:[o.steps.map((i,y)=>e.jsx(we,{id:C[y],styles:l,children:e.jsx(Z,{step:i,onChange:S=>I(y,S),onRemove:()=>M(y),container:x?"enable":"display"})},C[y])),o.steps.length===0&&e.jsx(f,{italic:!0,style:{color:s.colorNeutralForeground3},children:"No steps yet. A rule needs at least one step: add one before you publish, or remove the rule from its commands."})]})})}),e.jsxs(q,{open:a,onOpenChange:(i,y)=>n(y.open),children:[e.jsx(Q,{children:e.jsx(k,{icon:e.jsx(X,{}),appearance:"secondary",onClick:()=>n(!0),children:"Add step"})}),e.jsx(Y,{className:l.pickerPopover,children:e.jsx(J,{onSelect:ee,container:x?"enable":"display"})})]}),e.jsx(H,{children:"Plain-English summary"}),e.jsx("div",{className:l.summary,role:"note","aria-label":"Rule summary",children:ne})]})]})};function we({id:l,children:c,styles:d}){const{attributes:h,listeners:u,setNodeRef:E,setActivatorNodeRef:T,transform:v,transition:j}=Re({id:l});return e.jsx("li",{ref:E,className:d.sortableItem,style:{transform:be.Transform.toString(v),transition:j},children:e.jsxs("div",{className:d.sortableInner,children:[e.jsx(k,{ref:T,appearance:"subtle",size:"small",className:d.dragHandle,...h,...u,"aria-label":"Drag to reorder step",children:"Drag"}),e.jsx("div",{style:{flex:1},children:c})]})})}export{Ve as RuleEditorPanel,Ve as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e,h as O,co as I,cq as C,z as $}from"./fluent-icons-
|
|
1
|
+
import{y as e,h as O,co as I,cq as C,z as $}from"./fluent-icons-BqJj6rDi.js";import{a as M,R as X}from"./monaco-BIO15LCS.js";import{a as k,ab as H,u as q}from"./index-Di2_5czx.js";import{ai as A,aj as P,ak as U,aa as G,d as c,al as Y,b as x,t as l,a7 as R,B,F as p,S as j,I as L}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.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),_=q(a=>a.ribbons),E=q(a=>a.setScaling),v=_[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??[],F=()=>{g(a=>[...a,{id:`MaxSize.${a.length+1}`,groupId:d[0]?.id??"",size:"Large",sequence:(a.length+1)*10}])},T=()=>{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=()=>{E(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:F,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:T,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as e,h as $,co as q,cq as L,z as U}from"./fluent-icons-BqJj6rDi.js";import{a as k,R as V}from"./monaco-BIO15LCS.js";import{a as D,ab as H,u as f,aC as X}from"./index-Di2_5czx.js";import{ai as Y,aj as J,ak as K,aa as Q,d as m,al as Z,M as R,f as w,b as c,t as s,B as ee,F as h,S,I as P}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";function A(r){return(r??[]).flatMap(b=>b.rules)}function E(){return{kind:"EntityRule",appliesTo:"PrimaryEntity",context:"HomePageGrid"}}function F(){return{kind:"PageRule",address:""}}const ae=U({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:s.spacingHorizontalM,padding:s.spacingHorizontalM,overflowY:"auto"},ruleRow:{display:"flex",flexDirection:"column",gap:s.spacingHorizontalXS,padding:s.spacingHorizontalS,border:`1px solid ${s.colorNeutralStroke2}`,borderRadius:s.borderRadiusMedium,backgroundColor:s.colorNeutralBackground2},ruleHeader:{display:"flex",alignItems:"center",gap:s.spacingHorizontalS},stepFields:{display:"flex",gap:s.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"}}),oe=()=>{const r=ae(),b=D(a=>a.tabDisplayRulesOpen),j=D(a=>a.closeTabDisplayRules),x=H(a=>a.location),g=H(a=>a.tabId),I=f(a=>a.ribbons),B=f(a=>a.setTabDisplayRules),z=I[x],i=z.tabs.find(a=>a.id===g),u=x==="Application",C=f(a=>!a.baseline[x]?.tabs.some(l=>l.id===g)),N=f(a=>X(a,x)),o=!!i&&!C&&N!==void 0&&!N.includes(g),[p,v]=k.useState(()=>A(i?.tabDisplayRules)),[T,y]=k.useState(null);V.useEffect(()=>{b&&(y(null),v(A(i?.tabDisplayRules)))},[b,i]);const d=(a,l)=>{v(t=>t.map((n,W)=>W===a?l:n))},M=()=>{v(a=>[...a,u?F():E()])},_=a=>{v(l=>l.filter((t,n)=>n!==a))},G=()=>{if(!i){y("No active tab selected.");return}for(const[a,l]of p.entries()){if(l.kind==="PageRule"&&!u){y(`Step ${a+1}: a page rule is only valid on application ribbon tabs.`);return}if(l.kind==="PageRule"&&!l.address.trim()){y(`Step ${a+1}: enter the page address.`);return}}y(null),B(x,g,p.length>0?[{tabCommand:i.commandId??"",rules:p}]:[]),j()},O=a=>[...new Set([z.entityLogicalName,a.entityName].filter(l=>!!l))];return e.jsxs(Y,{className:r.drawer,open:b,position:"end",onOpenChange:(a,l)=>!l.open&&j(),children:[e.jsx(J,{children:e.jsx(K,{action:e.jsx(m,{appearance:"subtle",icon:e.jsx($,{}),onClick:j,"aria-label":"Close"}),children:e.jsx(Q,{children:"Tab Display Rules"})})}),e.jsx(Z,{children:e.jsxs("div",{className:r.body,children:[T&&e.jsx(R,{intent:"error",children:e.jsx(w,{children:T})}),e.jsx(R,{intent:"info",children:e.jsx(w,{children:e.jsxs(c,{size:200,children:["Tabs are ",e.jsx("strong",{children:"hidden by default"}),". A tab's display rule says where it's shown, and is bound to the tab's Command."]})})}),i&&e.jsxs("div",{children:[e.jsxs(c,{size:200,style:{color:s.colorNeutralForeground3},children:["Tab: ",e.jsx("strong",{children:i.label})," (",i.id,")"]}),i.commandId&&e.jsxs(c,{size:200,style:{color:s.colorNeutralForeground3,display:"block"},children:["Command ID:"," ",e.jsx("code",{style:{fontFamily:s.fontFamilyMonospace},children:i.commandId})]})]}),o&&e.jsx(R,{intent:"warning",children:e.jsx(w,{children:e.jsx(c,{size:200,children:"This tab isn't added by your customizations, so its display rule can't be changed here."})})}),p.length===0&&e.jsx(c,{style:{color:s.colorNeutralForeground3,textAlign:"center"},children:o?"This tab has no display rule of its own.":C&&!u?"No steps: when you publish, this new tab gets the default rule for its location (this table, where the tab is).":"No steps: this tab will be hidden."}),p.length>0&&e.jsxs("div",{className:r.ruleRow,children:[e.jsxs("div",{className:r.ruleHeader,children:[e.jsx(ee,{appearance:"outline",size:"small",children:"Display rule"}),e.jsx(c,{size:200,style:{color:s.colorNeutralForeground3},children:"The tab shows where any step matches."})]}),p.map((a,l)=>e.jsxs("div",{className:r.stepFields,children:[e.jsx(h,{label:"Type",style:{minWidth:"140px"},children:e.jsxs(S,{size:"small",value:a.kind,disabled:o,onChange:(t,n)=>{n.value==="PageRule"?d(l,F()):d(l,E())},children:[e.jsx("option",{value:"EntityRule",children:"Entity Rule"}),u&&e.jsx("option",{value:"PageRule",children:"Page Rule"})]})}),a.kind==="EntityRule"&&e.jsxs(e.Fragment,{children:[e.jsx(h,{label:"Applies to",style:{minWidth:"130px"},children:e.jsxs(S,{size:"small",value:a.appliesTo??"",disabled:o,onChange:(t,n)=>d(l,{...a,appliesTo:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),e.jsx("option",{value:"PrimaryEntity",children:"Primary entity"}),e.jsx("option",{value:"SelectedEntity",children:"Selected entity"})]})}),e.jsx(h,{label:"Context",style:{minWidth:"160px"},children:e.jsxs(S,{size:"small",value:a.context??"",disabled:o,onChange:(t,n)=>d(l,{...a,context:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),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"})]})}),u?e.jsx(h,{label:"Table (optional)",children:e.jsx(P,{size:"small",value:a.entityName??"",disabled:o,onChange:(t,n)=>d(l,{...a,entityName:n.value||void 0}),placeholder:"any"})}):e.jsx(h,{label:"Table",children:e.jsxs(S,{size:"small",value:a.entityName??"",disabled:o,onChange:(t,n)=>d(l,{...a,entityName:n.value||void 0}),children:[e.jsx("option",{value:"",children:"Any"}),O(a).map(t=>e.jsx("option",{value:t,children:t},t))]})})]}),a.kind==="PageRule"&&e.jsx(h,{label:"Address pattern",style:{flex:1},children:e.jsx(P,{size:"small",value:a.address,disabled:o,onChange:(t,n)=>d(l,{...a,address:n.value}),placeholder:"https://…"})}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(q,{}),disabled:o,onClick:()=>_(l),"aria-label":"Remove step"})]},l))]}),e.jsx(m,{appearance:"subtle",icon:e.jsx(L,{}),onClick:M,disabled:o||!i,children:"Add step"}),e.jsx(c,{size:100,style:{color:s.colorNeutralForeground3},children:u?"Entity rules and page rules are both valid on application ribbon tabs.":"A table's tabs take entity rules only."}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:s.spacingHorizontalS,paddingTop:s.spacingHorizontalS},children:[e.jsx(m,{appearance:"secondary",onClick:j,children:"Cancel"}),e.jsx(m,{appearance:"primary",onClick:G,disabled:o,children:"Save rules"})]})]})})]})};export{oe as TabDisplayRulesPanel,oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as e,h as D,co as M,cq as L,z as $}from"./fluent-icons-
|
|
1
|
+
import{y as e,h as D,co as M,cq as L,z as $}from"./fluent-icons-BqJj6rDi.js";import{a as n,R as A}from"./monaco-BIO15LCS.js";import{a as k}from"./index-Di2_5czx.js";import{D as F,i as I,k as _,j as X,aa as T,d as c,l as H,F as u,I as j,a1 as O,b as i,t as l,S as V,m as E}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const q=$({surface:{width:"720px",maxWidth:"95vw",maxHeight:"84vh",height:"84vh"},body:{display:"flex",flexDirection:"column",gap:l.spacingHorizontalM,overflowY:"auto"},paramRow:{display:"flex",alignItems:"flex-end",gap:l.spacingHorizontalS},urlPreview:{fontFamily:l.fontFamilyMonospace,fontSize:l.fontSizeBase200,backgroundColor:l.colorNeutralBackground3,padding:`${l.spacingVerticalXS} ${l.spacingHorizontalS}`,borderRadius:l.borderRadiusMedium,wordBreak:"break-all",border:`1px solid ${l.colorNeutralStroke2}`},passParamsTable:{display:"grid",gridTemplateColumns:"120px 1fr",gap:`${l.spacingVerticalXS} ${l.spacingHorizontalS}`,fontSize:l.fontSizeBase200},warnNote:{backgroundColor:l.colorStatusWarningBackground1,borderRadius:l.borderRadiusMedium,padding:`${l.spacingVerticalXS} ${l.spacingHorizontalS}`,fontSize:l.fontSizeBase100}}),f=[{key:"typename",desc:"Logical name of the table"},{key:"type",desc:"Entity type code (integer — may vary between orgs)"},{key:"id",desc:"GUID of the primary record"},{key:"orgname",desc:"Unique organization name"},{key:"userlcid",desc:"User's language LCID"},{key:"orglcid",desc:"Organization's base language LCID"}],W=[{label:"New tab (Navigate)",value:"0"},{label:"Dialog",value:"1"},{label:"Popup",value:"2"}],Z=()=>{const r=q(),S=k(a=>a.urlComposerOpen),d=k(a=>a.closeUrlComposer),[t,z]=n.useState("https://"),[m,C]=n.useState(!1),[w,R]=n.useState("0"),[h,g]=n.useState([]),x=n.useMemo(()=>{const a=[...h].filter(s=>s.key.trim()).map(s=>`${encodeURIComponent(s.key)}={${s.value||s.key}}`);return m&&f.forEach(s=>{a.push(`${s.key}={${s.key}}`)}),a.length>0?`${t}?${a.join("&")}`:t},[t,m,h]),U=n.useMemo(()=>x.replace(/&/g,"&"),[x]),N=()=>{g(a=>[...a,{key:"",value:""}])},P=a=>{g(s=>s.filter((p,o)=>o!==a))},b=(a,s,p)=>{g(o=>o.map((v,B)=>B===a?{...v,[s]:p}:v))},y=t.startsWith("https://");return e.jsx(F,{open:S,onOpenChange:(a,s)=>!s.open&&d(),children:e.jsx(I,{className:r.surface,children:e.jsxs(_,{style:{height:"100%"},children:[e.jsx(X,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(D,{}),onClick:d,"aria-label":"Close"}),children:e.jsx(T,{children:"URL Action Composer"})}),e.jsxs(H,{className:r.body,children:[e.jsx(u,{label:"Base URL",required:!0,validationState:y?"none":"error",validationMessage:y?void 0:"URL must start with https://",children:e.jsx(j,{value:t,onChange:(a,s)=>z(s.value),placeholder:"https://contoso.com/page"})}),e.jsxs("div",{className:r.warnNote,children:["⚠ Ampersands in URLs must be escaped as ",e.jsx("code",{children:"&"})," in XML. CBS handles this automatically when generating XML."]}),e.jsx(O,{label:"PassParams — append standard record context parameters",checked:m,onChange:(a,s)=>C(s.checked)}),m&&e.jsxs("div",{children:[e.jsx(i,{size:200,weight:"semibold",children:"Standard PassParams:"}),e.jsx("div",{className:r.passParamsTable,children:f.map(a=>e.jsxs(A.Fragment,{children:[e.jsx("code",{style:{fontFamily:l.fontFamilyMonospace,fontSize:l.fontSizeBase200},children:a.key}),e.jsx(i,{size:100,style:{color:l.colorNeutralForeground3},children:a.desc})]},a.key))}),e.jsxs(i,{size:100,style:{color:l.colorStatusWarningForeground1,marginTop:l.spacingVerticalXS,display:"block"},children:["Note: Use ",e.jsx("code",{children:"typename"})," instead of ",e.jsx("code",{children:"type"})," for reliability — type codes can differ between environments."]})]}),e.jsxs("div",{children:[e.jsx(i,{weight:"semibold",size:200,children:"Custom query parameters"}),e.jsxs(i,{size:100,style:{color:l.colorNeutralForeground3,display:"block",marginBottom:l.spacingVerticalXS},children:["Each parameter becomes a querystring key=value pair. Use CRM tokens like"," ",e.jsx("code",{children:"{id}"}),"."]}),h.map((a,s)=>e.jsxs("div",{className:r.paramRow,style:{marginBottom:l.spacingHorizontalXS},children:[e.jsx(u,{label:"Key",style:{flex:1},children:e.jsx(j,{size:"small",value:a.key,onChange:(p,o)=>b(s,"key",o.value),placeholder:"paramName"})}),e.jsx(u,{label:"Value / token",style:{flex:1},children:e.jsx(j,{size:"small",value:a.value,onChange:(p,o)=>b(s,"value",o.value),placeholder:"static value or {id}"})}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(M,{}),onClick:()=>P(s),"aria-label":"Remove parameter",style:{marginBottom:"4px"}})]},s)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(L,{}),onClick:N,children:"Add parameter"})]}),e.jsx(u,{label:"Open in",children:e.jsx(V,{value:w,onChange:(a,s)=>R(s.value),children:W.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))})}),e.jsxs("div",{children:[e.jsx(i,{size:200,weight:"semibold",style:{display:"block",marginBottom:"4px"},children:"URL preview (tokens shown literally):"}),e.jsx("div",{className:r.urlPreview,children:x})]}),e.jsxs("div",{children:[e.jsxs(i,{size:200,weight:"semibold",style:{display:"block",marginBottom:"4px"},children:["XML-encoded URL (",e.jsx("code",{children:"&"})," → ",e.jsx("code",{children:"&"}),"):"]}),e.jsx("div",{className:r.urlPreview,children:U})]})]}),e.jsxs(E,{children:[e.jsx(c,{appearance:"secondary",onClick:d,children:"Cancel"}),e.jsx(c,{appearance:"primary",disabled:!y,onClick:d,children:"Apply URL"})]})]})})})};export{Z as UrlComposerModal,Z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{y as s,h as se,E as le,ba as ae,z as oe,bm as D,c_ as S,L as b}from"./fluent-icons-BqJj6rDi.js";import{a as T,Z as re,l as U,aD as ne,aE as te,aF as _,aG as ie,w as z,E as ce,j as de,ax as ue,P as ge,k as xe}from"./index-Di2_5czx.js";import{a as t}from"./monaco-BIO15LCS.js";import{u as pe}from"./useReplaceWebResourceConfirm-BUWBVNSC.js";import{a0 as B,D as he,i as me,k as fe,j as je,aa as Se,d as y,l as be,I as ye,S as we,an as ve,M as G,f as P,b as i,t as a,a2 as Ce,a3 as Re,m as ke}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const Ne=oe({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"}}),ze={js:s.jsx(b,{}),ts:s.jsx(b,{}),css:s.jsx(b,{}),html:s.jsx(b,{}),svg:s.jsx(S,{}),png:s.jsx(S,{}),gif:s.jsx(S,{}),jpg:s.jsx(S,{}),xml:s.jsx(D,{}),resx:s.jsx(D,{})};function w(x){return x.split(".").pop()?.toLowerCase()??""}const Be=[{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"}],Me=({onSelect:x})=>{const n=Ne(),E=pe(),v=T(e=>e.webResourceBrowserOpen),u=T(e=>e.closeWebResourceBrowser),A=re(e=>e.publisherPrefix),F=t.useRef(null),[I,W]=t.useState([]),[C,p]=t.useState(!1),[H,M]=t.useState(!1),[$,g]=t.useState(null),[O,R]=t.useState(null),[k,X]=t.useState(""),[h,V]=t.useState("all"),[N,Y]=t.useState(!0),[m,L]=t.useState(null),f=t.useMemo(()=>{const e=k.toLowerCase();return I.filter(l=>{const o=w(l.name),r=e===""||l.name.toLowerCase().includes(e)||(l.description??"").toLowerCase().includes(e),c=h==="all"||o===h,j=!N||l.isCustom;return r&&c&&j})},[I,k,h,N]),d=f.find(e=>e.id===m)??null,q=[B({columnId:"type",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Type"}),renderCell:e=>{const l=w(e.name),o=ze[l]??s.jsx(D,{});return s.jsx("div",{className:n.col2,style:{color:a.colorNeutralForeground3},children:o})}}),B({columnId:"name",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Name"}),renderCell:e=>s.jsxs("div",{className:n.col3,children:[s.jsx("div",{className:n.nameCell,children:s.jsx(i,{style:{fontFamily:a.fontFamilyMonospace,fontSize:a.fontSizeBase200},children:e.name})}),e.description&&s.jsx("div",{className:n.descCell,children:e.description})]})}),B({columnId:"modified",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Modified"}),renderCell:e=>s.jsx("div",{className:n.col5,children:s.jsx(i,{size:100,children:e.modifiedOn?new Date(e.modifiedOn).toLocaleDateString():"—"})})})];t.useEffect(()=>{v&&(p(!0),g(null),R(null),U().then(e=>W(e)).catch(e=>g(e instanceof Error?e.message:String(e))).finally(()=>p(!1)))},[v]);const Z=async()=>{p(!0),g(null);try{W(await U())}catch(e){g(e instanceof Error?e.message:String(e))}finally{p(!1)}},J=e=>new Promise((l,o)=>{const r=new FileReader;r.onerror=()=>o(r.error??new Error("Unable to read file")),r.onload=()=>{const c=String(r.result??"");l(c.includes(",")?c.split(",")[1]??"":c)},r.readAsDataURL(e)}),K=e=>{const l=w(e.name);return`${A||"new"}_/${l==="js"||l==="css"||l==="html"||l==="xml"?"scripts":l==="svg"||l==="png"?"icons":"webresources"}/${e.name}`},Q=async e=>{const l=xe();M(!0),R(null);try{const o=await J(e),r=w(e.name),c={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[r]??4,j=await de(K(e),o,c,{displayName:e.name,guard:l,onExisting:E.onExisting});await Z(),R([j.solutionWarning,j.publishWarning].filter(Boolean).join(" ")||null)}catch(o){if(o instanceof ue)return;const r=o instanceof Error?o.message:String(o);g(r),ge.getState().logError("webresource",`Upload of ${e.name} failed: ${r}`)}finally{M(!1)}},ee=()=>{d&&(z.invoke(d),x?.(d),u())};return s.jsxs(s.Fragment,{children:[E.dialog,s.jsx(he,{open:v,onOpenChange:(e,l)=>{l.open||(z.clear(),u())},children:s.jsx(me,{className:n.surface,children:s.jsxs(fe,{style:{height:"100%"},children:[s.jsx(je,{action:s.jsx(y,{appearance:"subtle",icon:s.jsx(se,{}),onClick:u,"aria-label":"Close"}),children:s.jsx(Se,{children:"Web Resource Browser"})}),s.jsxs(be,{className:n.body,children:[s.jsx("input",{ref:F,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&&Q(l)}}),s.jsxs("div",{className:n.toolbar,children:[s.jsx(ye,{contentBefore:s.jsx(le,{}),placeholder:"Search by name…",value:k,onChange:(e,l)=>X(l.value),size:"small",style:{flex:1}}),s.jsx(we,{size:"small",value:h,onChange:(e,l)=>V(l.value),style:{width:"100px"},children:Be.map(e=>s.jsx("option",{value:e.value,children:e.label},e.value))}),s.jsx(ve,{label:"Custom only",checked:N,onChange:(e,l)=>Y(l.checked===!0)})]}),$&&s.jsx(G,{intent:"error",children:s.jsx(P,{children:$})}),O&&s.jsx(G,{intent:"warning",children:s.jsx(P,{children:O})}),s.jsxs("div",{className:n.grid,children:[C&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM},children:"Loading web resources…"}),!C&&f.length===0&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM,textAlign:"center"},children:"No web resources found."}),!C&&f.length>0&&s.jsxs(ne,{className:n.gridWrap,items:f,columns:q,getRowId:e=>e.id,focusMode:"composite",selectionMode:"single",subtleSelection:!0,selectedItems:m?new Set([m]):new Set,onSelectionChange:(e,l)=>{const o=[...l.selectedItems][0];L(o??null)},children:[s.jsx(te,{children:s.jsx(_,{children:({renderHeaderCell:e})=>s.jsx(Ce,{children:e()})})}),s.jsx(ie,{itemSize:56,height:360,listProps:{width:"100%"},children:({item:e,rowId:l},o)=>s.jsx(_,{style:o,className:`${n.gridRow} ${e.id===m?n.gridRowSelected:""}`,onDoubleClick:()=>{L(e.id),z.invoke(e),x?.(e),u()},children:({renderCell:r})=>s.jsx(Re,{children:r(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(ke,{fluid:!0,children:[s.jsx(y,{appearance:"subtle",icon:s.jsx(ae,{}),disabled:H,onClick:()=>F.current?.click(),children:H?"Uploading…":"Upload"}),s.jsx(ce,{prefix:"Uploads to"}),s.jsx("div",{style:{flex:1}}),s.jsx(y,{appearance:"secondary",onClick:u,children:"Cancel"}),s.jsx(y,{appearance:"primary",disabled:!d,onClick:ee,children:"Select"})]})]})})})]})};export{Me as WebResourceBrowser,Me as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{y as t,X as H,h as O,ci as V,bc as z,d5 as G,ba as U,z as W}from"./fluent-icons-BqJj6rDi.js";import{a as s}from"./monaco-BIO15LCS.js";import{u as h,a as v,l as _,g as K,c as Q,s as Z}from"./index-Di2_5czx.js";import{M as q}from"./MonacoEditor-uzfuRCpJ.js";import{ai as J,aj as Y,ak as ee,t as d,d as ne,al as te,M as j,f as $,ac as re,ad as ae,am as y}from"./fluent-ui-QADO660t.js";import"./dnd-Cq8OftAq.js";const oe=["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 A(r,g){const b=[];return b.push(r.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,n){const a=l.getValueInRange({startLineNumber:n.lineNumber,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column});if(!a.includes("$LocLabels:"))return{suggestions:[]};const C=a.lastIndexOf("$LocLabels:")+11,c=a.slice(C),u={startLineNumber:n.lineNumber,startColumn:n.column-c.length,endLineNumber:n.lineNumber,endColumn:n.column};return{suggestions:h.getState().locLabels.map(m=>({label:m.id,kind:r.languages.CompletionItemKind.Reference,insertText:m.id,range:u,detail:"LocLabel reference"}))}}})),b.push(r.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,n){const a=l.getValueInRange({startLineNumber:n.lineNumber,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column});if(!a.includes("$webresource:"))return{suggestions:[]};const C=a.lastIndexOf("$webresource:")+13,c=a.slice(C),u={startLineNumber:n.lineNumber,startColumn:n.column-c.length,endLineNumber:n.lineNumber,endColumn:n.column};return{suggestions:g().map(m=>({label:m,kind:r.languages.CompletionItemKind.File,insertText:m,range:u,detail:"Web resource"}))}}})),b.push(r.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,n){const a=l.getValueInRange({startLineNumber:n.lineNumber,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column});if(!/Command\s*=\s*"[^"]*$/.test(a))return{suggestions:[]};const c=a.match(/Command\s*=\s*"([^"]*)$/)?.[1]??"",u={startLineNumber:n.lineNumber,startColumn:n.column-c.length,endLineNumber:n.lineNumber,endColumn:n.column};return{suggestions:h.getState().commands.map(m=>({label:m.id,kind:r.languages.CompletionItemKind.Function,insertText:m.id,range:u,detail:"CommandDefinition"}))}}})),b.push(r.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,n){const a=l.getValueInRange({startLineNumber:n.lineNumber,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column});if(!/ModernImage\s*=\s*"[^"]*$/.test(a))return{suggestions:[]};const c=a.match(/ModernImage\s*=\s*"([^"]*)$/)?.[1]??"",u={startLineNumber:n.lineNumber,startColumn:n.column-c.length,endLineNumber:n.lineNumber,endColumn:n.column};return{suggestions:oe.map(i=>({label:i,kind:r.languages.CompletionItemKind.Color,insertText:i,range:u,detail:"Fluent icon (ModernImage)",documentation:`Renders the ${i}_20_Regular Fluent icon`}))}}})),b}function I(r){r.forEach(g=>g.dispose())}const se=W({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"}}),le=[{label:"Home Grid",value:"HomepageGrid"},{label:"Sub Grid",value:"SubGrid"},{label:"Form",value:"Form"},{label:"Application",value:"Application"}],Ce=()=>{const r=se(),g=v(e=>e.xmlDrawerOpen),b=v(e=>e.closeXmlDrawer),l=h(e=>e.ribbons),n=h(e=>e.baseline),a=h(e=>e.commands),C=h(e=>e.displayRules),c=h(e=>e.enableRules),u=h(e=>e.locLabels),N=v(e=>e.openImportXml),[i,m]=s.useState("HomepageGrid"),[S,p]=s.useState(null),[E,T]=s.useState(!1),f=s.useRef(0);s.useEffect(()=>{f.current++,p(null)},[i,g]);const[w,D]=s.useState([]),M=s.useRef(null),R=s.useRef(null),x=s.useRef([]);s.useEffect(()=>{g&&_().then(e=>D(e.map(o=>o.name))).catch(()=>D([]))},[g]),s.useEffect(()=>()=>{I(x.current),x.current=[]},[]);const X=s.useCallback((e,o)=>{M.current=e,R.current=o,I(x.current),x.current=A(o,()=>w)},[w]);s.useEffect(()=>{R.current&&(I(x.current),x.current=A(R.current,()=>w))},[w]);const B=()=>{M.current?.getAction("editor.action.formatDocument")?.run()},k=s.useCallback(e=>{try{return`<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
${K({location:e,current:l[e],baseline:n[e],commands:a,displayRules:C,enableRules:c,locLabels:u,entityLogicalName:l[e].entityLogicalName})}`}catch(o){return`<!-- Error generating XML: ${String(o)} -->`}},[l,n,a,C,c,u])(i);s.useEffect(()=>{f.current++,p(null)},[k]);const F=async()=>{const e=f.current,o=await Q(k);e===f.current&&p(o.ok?{intent:"success",text:"Copied the XML to the clipboard."}:{intent:"error",text:`Couldn't copy (${o.error}). Click in the XML, press Ctrl+A, then Ctrl+C.`})},P=async()=>{const e=f.current,o=`RibbonDiffXml_${i}.xml`;T(!0),p(null);try{const L=await Z(o,k,[{name:"XML",extensions:["xml"]}]);if(e!==f.current)return;L.ok&&L.path?p({intent:"success",text:`Saved to ${L.path}.`}):L.ok?p({intent:"success",text:`Started downloading ${o}. If no file appears, use Copy.`}):L.canceled?p(null):p({intent:"error",text:`Couldn't save the file (${L.error}). Use Copy instead.`})}finally{T(!1)}};return t.jsxs(J,{position:"end",open:g,onOpenChange:()=>b(),className:r.drawer,children:[t.jsx(Y,{children:t.jsxs(ee,{action:t.jsx(ne,{appearance:"subtle",icon:t.jsx(O,{}),onClick:b,"aria-label":"Close XML drawer"}),children:[t.jsx(H,{style:{marginRight:d.spacingHorizontalS}}),"RibbonDiffXml"]})}),t.jsxs(te,{className:r.body,children:[t.jsx(j,{className:r.infoBar,intent:"info",children:t.jsxs($,{children:["This is the ",t.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."]})}),t.jsx("div",{className:r.tabRow,children:t.jsx(re,{selectedValue:i,onTabSelect:(e,o)=>m(o.value),children:le.map(e=>t.jsx(ae,{value:e.value,children:e.label},e.value))})}),t.jsxs("div",{className:r.toolbar,children:[t.jsx(y,{icon:t.jsx(V,{}),onClick:()=>{F()},children:"Copy"}),t.jsx(y,{icon:t.jsx(z,{}),disabled:E,onClick:()=>{P()},children:"Download"}),t.jsx(y,{icon:t.jsx(G,{}),onClick:B,children:"Format XML"}),t.jsx(y,{icon:t.jsx(U,{}),onClick:()=>N(k),children:"Import this XML"})]}),S&&t.jsx(j,{intent:S.intent,className:r.infoBar,role:"status",children:t.jsx($,{children:S.text})}),t.jsx("div",{className:r.editorContainer,children:t.jsx(q,{language:"xml",value:k,readOnly:!0,height:"100%",onMount:X})})]})]})};export{Ce as XmlDrawer,Ce as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l,R as O}from"./monaco-BIO15LCS.js";import{r as Ne}from"./fluent-ui-
|
|
1
|
+
import{a as l,R as O}from"./monaco-BIO15LCS.js";import{r as Ne}from"./fluent-ui-QADO660t.js";function En(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return l.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const rt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function we(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function mt(e){return"nodeType"in e}function z(e){var t,n;return e?we(e)?e:mt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function yt(e){const{Document:t}=z(e);return e instanceof t}function Be(e){return we(e)?!1:e instanceof z(e).HTMLElement}function Wt(e){return e instanceof z(e).SVGElement}function xe(e){return e?we(e)?e.document:mt(e)?yt(e)?e:Be(e)||Wt(e)?e.ownerDocument:document:document:document}const V=rt?l.useLayoutEffect:l.useEffect;function ot(e){const t=l.useRef(e);return V(()=>{t.current=e}),l.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function An(){const e=l.useRef(null),t=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Pe(e,t){t===void 0&&(t=[e]);const n=l.useRef(e);return V(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=l.useRef();return l.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function _e(e){const t=ot(e),n=l.useRef(null),r=l.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function Qe(e){const t=l.useRef();return l.useEffect(()=>{t.current=e},[e]),t.current}let dt={};function $e(e,t){return l.useMemo(()=>{if(t)return t;const n=dt[e]==null?0:dt[e]+1;return dt[e]=n,e+"-"+n},[e,t])}function Ht(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[c,u]of a){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const ye=Ht(1),Ze=Ht(-1);function Mn(e){return"clientX"in e&&"clientY"in e}function it(e){if(!e)return!1;const{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function In(e){if(!e)return!1;const{TouchEvent:t}=z(e.target);return t&&e instanceof t}function et(e){if(In(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Mn(e)?{x:e.clientX,y:e.clientY}:null}const fe=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[fe.Translate.toString(e),fe.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Tt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function On(e){return e.matches(Tt)?e:e.querySelector(Tt)}const Nn={display:"none"};function Tn(e){let{id:t,value:n}=e;return O.createElement("div",{id:t,style:Nn},n)}function Ln(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return O.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function kn(){const[e,t]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Vt=l.createContext(null);function Pn(e){const t=l.useContext(Vt);l.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function zn(){const[e]=l.useState(()=>new Set),t=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const Bn={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|