@mohsinonxrm/pptb-commandbar-studio 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -4
- package/dist/assets/{BulkPublishModal-DqX2QmUD.js → BulkPublishModal-mFfxdo1T.js} +1 -1
- package/dist/assets/{CommandEditorPanel-DidGBtFC.js → CommandEditorPanel-_mV9SqAb.js} +1 -1
- package/dist/assets/{CommandPalette-AuDfsF8l.js → CommandPalette-CK3uU6Ky.js} +1 -1
- package/dist/assets/{ConflictDrawer-DxQ_jd-x.js → ConflictDrawer-BFlon1xn.js} +1 -1
- package/dist/assets/{CrmParameterEditor-BdmP65mF.js → CrmParameterEditor-B84bdjcT.js} +1 -1
- package/dist/assets/{DiffViewer-BZuqvP4f.js → DiffViewer-JSOMstAl.js} +2 -2
- package/dist/assets/{HideInsteadOfDeleteModal-BYHCTZrG.js → HideInsteadOfDeleteModal-DYsP_BRs.js} +1 -1
- package/dist/assets/{IconPickerModal-Bw0C7KwV.js → IconPickerModal-BF3KU0Ux.js} +1 -1
- package/dist/assets/{ImportXmlModal-B8NgiUDZ.js → ImportXmlModal-BYj1QmDX.js} +1 -1
- package/dist/assets/{LocalizationEditor-tmniX5PC.js → LocalizationEditor-SeIMV_0G.js} +1 -1
- package/dist/assets/{MonacoEditor-Bbg9u2FW.js → MonacoEditor-DakCq511.js} +2 -2
- package/dist/assets/{NewButtonModal-BVvlbCv4.js → NewButtonModal-D3iJDvUq.js} +1 -1
- package/dist/assets/{NewGroupModal-CgQy-uo4.js → NewGroupModal-Cfywgyga.js} +1 -1
- package/dist/assets/{NewTabModal-B_2-kwAx.js → NewTabModal-DGNwUnJ5.js} +1 -1
- package/dist/assets/{RuleEditorPanel-BkNwBgaP.js → RuleEditorPanel-BmI_wJKH.js} +1 -1
- package/dist/assets/{ScalingEditorPanel-ezMkzvG1.js → ScalingEditorPanel-VCqXvcQy.js} +1 -1
- package/dist/assets/{TabDisplayRulesPanel-trzExQ1T.js → TabDisplayRulesPanel-D26HGtKC.js} +1 -1
- package/dist/assets/{UrlComposerModal-BlVXHKRM.js → UrlComposerModal-gVBqcCZd.js} +1 -1
- package/dist/assets/{WebResourceBrowser-DaPOZQ5X.js → WebResourceBrowser-Hrw1yujP.js} +1 -1
- package/dist/assets/{XmlDrawer-BI6Wy6kL.js → XmlDrawer-lnZmbePV.js} +1 -1
- package/dist/assets/{cssMode-DdC7kBk-.js → cssMode-BGIqMXMp.js} +1 -1
- package/dist/assets/{dnd-fsSwRnQv.js → dnd-vmvAsOrM.js} +1 -1
- package/dist/assets/{fluent-icons-DxKNRZ1A.js → fluent-icons-4bzebHz-.js} +1 -1
- package/dist/assets/{fluent-ui-D7EtYwEg.js → fluent-ui-lAhdF0Ck.js} +1 -1
- package/dist/assets/{freemarker2-DDn-Wpd6.js → freemarker2-DpL6dihh.js} +1 -1
- package/dist/assets/{handlebars-Ck_SjSJx.js → handlebars-ChRbmRjV.js} +1 -1
- package/dist/assets/{html-BaJUqhKx.js → html-Bt7ZeSoE.js} +1 -1
- package/dist/assets/{htmlMode-CnYhJfhG.js → htmlMode-Uz2nWy9x.js} +1 -1
- package/dist/assets/{index-Bu7BlRFk.js → index-B2t4gwW0.js} +3 -3
- package/dist/assets/{javascript-2UlV1Qbm.js → javascript-Bu0Wr1JA.js} +1 -1
- package/dist/assets/{jsonMode-BmSpB9yr.js → jsonMode-Bc_oOneo.js} +1 -1
- package/dist/assets/{liquid-CE2reFvH.js → liquid-Cj1v6MBK.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-BvbzEddk.js → lspLanguageFeatures-CbQqhnvj.js} +1 -1
- package/dist/assets/{mdx-BvcZv3tC.js → mdx-E7c9inFC.js} +1 -1
- package/dist/assets/{monaco-Bx8A1Vm1.js → monaco-BoSoLy50.js} +180 -179
- package/dist/assets/{python-MTPSN2vk.js → python-C7ICMPw1.js} +1 -1
- package/dist/assets/{razor-Ccq_CgR8.js → razor-xjSsEwAN.js} +1 -1
- package/dist/assets/{server.browser-C3R9jebn.js → server.browser-BZYwcDL4.js} +1 -1
- package/dist/assets/{tsMode-2cv3qhqp.js → tsMode-XBeIdV9f.js} +1 -1
- package/dist/assets/{typescript-BD6t7JEG.js → typescript-sgsLltTO.js} +1 -1
- package/dist/assets/{webResourceService-CvyHBu7T.js → webResourceService-DGt6sRPR.js} +1 -1
- package/dist/assets/{xml-DJGPA7j9.js → xml-DFgHgBBL.js} +1 -1
- package/dist/assets/{xmlValidator-D7JG-eNC.js → xmlValidator-D-tVo-1Z.js} +1 -1
- package/dist/assets/{yaml-Cpl0dvFM.js → yaml-DWfXsscO.js} +1 -1
- package/dist/index.html +5 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monaco-
|
|
2
|
-
import{a as l,R as f,_ as h}from"./monaco-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./monaco-BoSoLy50.js","./monaco-Dprb6f6S.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as l,R as f,_ as h}from"./monaco-BoSoLy50.js";import{z as t}from"./fluent-icons-4bzebHz-.js";import{a as u}from"./index-B2t4gwW0.js";import{a5 as x}from"./fluent-ui-lAhdF0Ck.js";const _=f.lazy(()=>h(()=>import("./monaco-BoSoLy50.js").then(o=>o.i),__vite__mapDeps([0,1]),import.meta.url)),y=({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{y as M};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"./fluent-icons-
|
|
1
|
+
import{z as e}from"./fluent-icons-4bzebHz-.js";import{a as S}from"./monaco-BoSoLy50.js";import{a as B,u as i,X as b,b as p,e as O,Y as z,c as G}from"./index-B2t4gwW0.js";import{D as K,h as Y,i as _,j as q,k as M,F as C,I as U,S as X,T as $,l as H,B as I}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const tt=()=>{const n=B(t=>t.newButtonGroupId),l=B(t=>t.closeNewButton),v=i(t=>t.createButton),w=i(t=>t.upsertCommand),y=i(t=>t.batch),N=b(t=>t.selectButtonInContext),D=p(t=>t.publisherPrefix),E=p(t=>t.activeSolution),s=b(t=>t.location),T=b(t=>t.tabId),k=p(t=>t.activeEntity),R=n!==null,[r,m]=S.useState("New Button"),[h,x]=S.useState("button"),F=()=>{if(!n||!s)return;const t=E?.publisherPrefix?.trim()||D?.trim()||"new",a=k?.logicalName??"global",c=i.getState().ribbons,L=i.getState().commands,f=new Set(L.map(o=>o.id));for(const o of Object.values(c))for(const d of o.tabs)for(const P of d.groups)for(const A of O(P))f.add(A.id);const{id:g,commandId:j}=z(t,a,s,r,f),u=c[s].tabs.find(o=>o.groups.some(d=>d.id===n))?.id??T;if(!c[s].tabs.some(o=>o.id===u)){G.getState().logError("canvas",`Could not add the button: group ${n} was not found.`),l();return}y(()=>{v({location:s,tabId:u,groupId:n,button:{id:g,label:r,kind:h,templateAlias:"o1",commandId:j,hidden:!1,oob:!1,custom:!0,managed:!1}}),w({id:j,enableRules:[],displayRules:[],actions:[]})}),N(s,u,n,g),m("New Button"),x("button"),l()};return e.jsx(K,{open:R,onOpenChange:()=>l(),children:e.jsxs(Y,{children:[e.jsx(_,{children:"New button"}),e.jsxs(q,{children:[e.jsxs(M,{children:[e.jsx(C,{label:"Label",required:!0,children:e.jsx(U,{value:r,onChange:(t,a)=>m(a.value),autoFocus:!0})}),e.jsx(C,{label:"Kind",children:e.jsxs(X,{value:h,onChange:(t,a)=>x(a.value),children:[e.jsx("option",{value:"button",children:"Button"}),e.jsx("option",{value:"flyout",children:"Flyout anchor"}),e.jsx("option",{value:"splitButton",children:"Split button"})]})}),e.jsx($,{size:200,style:{display:"block",marginTop:"8px"},children:"A command definition will be created automatically. You can edit it in the Command Editor."})]}),e.jsxs(H,{children:[e.jsx(I,{appearance:"secondary",onClick:l,children:"Cancel"}),e.jsx(I,{appearance:"primary",onClick:F,disabled:!r.trim(),children:"Create button"})]})]})]})})};export{tt as NewButtonModal,tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"./fluent-icons-
|
|
1
|
+
import{z as e}from"./fluent-icons-4bzebHz-.js";import{a as u}from"./monaco-BoSoLy50.js";import{a as p,u as g,X as d}from"./index-B2t4gwW0.js";import{D as v,h as y,i as w,j as G,k as C,F as x,I as F,S as L,T as S,l as f,B as h}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const z=()=>{const b=p(o=>o.newGroupOpen),a=p(o=>o.closeNewGroup),j=g(o=>o.createGroup),s=d(o=>o.location),n=d(o=>o.tabId),[t,r]=u.useState("New Group"),[i,c]=u.useState("Flexible2"),m=()=>{!s||!n||(j({location:s,tabId:n,group:{label:t,template:i,buttons:[]}}),r("New Group"),c("Flexible2"),a())};return e.jsx(v,{open:b,onOpenChange:()=>a(),children:e.jsxs(y,{children:[e.jsx(w,{children:"New group"}),e.jsxs(G,{children:[e.jsxs(C,{children:[e.jsx(x,{label:"Label",required:!0,children:e.jsx(F,{value:t,onChange:(o,l)=>r(l.value),autoFocus:!0})}),e.jsx(x,{label:"Group template",children:e.jsxs(L,{value:i,onChange:(o,l)=>c(l.value),children:[e.jsx("option",{value:"Flexible2",children:"Flexible2 (recommended)"}),e.jsx("option",{value:"Flexible",children:"Flexible"}),e.jsx("option",{value:"Layout2",children:"Layout2"}),e.jsx("option",{value:"Layout3",children:"Layout3"}),e.jsx("option",{value:"Layout4",children:"Layout4"})]})}),e.jsx(S,{size:200,style:{display:"block",marginTop:"8px"},children:"The group template defines how buttons scale when the ribbon is resized."})]}),e.jsxs(f,{children:[e.jsx(h,{appearance:"secondary",onClick:a,children:"Cancel"}),e.jsx(h,{appearance:"primary",onClick:m,disabled:!t.trim(),children:"Create group"})]})]})]})})};export{z as NewGroupModal,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,h as B,y as F}from"./fluent-icons-
|
|
1
|
+
import{z as e,h as B,y as F}from"./fluent-icons-4bzebHz-.js";import{a as S,R as _}from"./monaco-BoSoLy50.js";import{X as E,u as c,b as N,a as C,Z as O,_ as $,$ as L,a0 as H}from"./index-B2t4gwW0.js";import{D as G,h as U,j as X,i as Z,aa as q,B as h,k as P,M as D,e as I,T as d,F as v,I as w,t as s,l as W}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const Y={HomepageGrid:"home grid",Form:"form",SubGrid:"sub-grid",Application:""},J=F({surface:{width:"480px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:s.spacingHorizontalM},hint:{fontFamily:s.fontFamilyMonospace,fontSize:s.fontSizeBase100,color:s.colorNeutralForeground3,backgroundColor:s.colorNeutralBackground3,padding:`${s.spacingHorizontalXS} ${s.spacingHorizontalS}`,borderRadius:s.borderRadiusMedium}}),se=()=>{const b=J(),[t,p]=S.useState("New Tab"),[g,x]=S.useState(""),o=E(a=>a.location),R=c(a=>a.createTab),u=c(a=>a.ribbons),m=c(a=>a.baseline),j=c(a=>a.layers),z=N(a=>a.activeEntity);N(a=>a.publisherPrefix);const A=C(a=>a.newTabOpen),l=C(a=>a.closeNewTab),y=_.useMemo(()=>O({baseline:m,layers:j},u),[m,j,u]),M=o==="Application"?"global":z?.logicalName??u[o].entityLogicalName,T=$(M,`${o}.${t}`,"Tab",y),n=g.trim(),r=n?L(n)??(/[^a-zA-Z0-9._]/.test(n)?"Use letters, digits, dots and underscores only":y.has(n)?"This ID is already used":null):null,f=n||T,k=()=>{r||(R(o,{id:f,label:t,tabDisplayRules:[],groups:[]}),p("New Tab"),x(""),l())};return e.jsx(G,{open:A,onOpenChange:(a,i)=>!i.open&&l(),children:e.jsx(U,{className:b.surface,children:e.jsxs(X,{children:[e.jsx(Z,{action:e.jsx(h,{appearance:"subtle",icon:e.jsx(B,{}),onClick:l,"aria-label":"Close"}),children:e.jsx(q,{children:"Add Tab"})}),e.jsxs(P,{className:b.body,children:[e.jsx(D,{intent:"info",children:e.jsx(I,{children:e.jsx(d,{size:200,children:o==="Application"?"A tab is shown only where a Tab Display Rule allows it. Add one in Tab rules before publishing.":`The tab gets a Tab Display Rule for this table's ${Y[o]}. You can change it in Tab rules.`})})}),e.jsx(D,{intent:"info",children:e.jsx(I,{children:e.jsx(d,{size:200,children:H})})}),e.jsx(v,{label:"Tab label",required:!0,children:e.jsx(w,{value:t,onChange:(a,i)=>p(i.value),placeholder:"My Tab"})}),e.jsx(v,{label:"Tab ID",hint:"Leave blank to auto-generate from label",validationState:r?"error":"none",validationMessage:r??void 0,children:e.jsx(w,{value:g,onChange:(a,i)=>x(i.value),placeholder:T})}),e.jsxs("div",{children:[e.jsx(d,{size:100,style:{color:s.colorNeutralForeground3},children:"Generated ID:"}),e.jsx("div",{className:b.hint,children:f})]}),e.jsxs(d,{size:200,style:{color:s.colorNeutralForeground3},children:["Location: ",e.jsx("strong",{children:o})]})]}),e.jsxs(W,{children:[e.jsx(h,{appearance:"secondary",onClick:l,children:"Cancel"}),e.jsx(h,{appearance:"primary",disabled:!t.trim()||!!r,onClick:k,children:"Create tab"})]})]})})})};export{se as NewTabModal,se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,y as L,h as X,cq as K}from"./fluent-icons-DxKNRZ1A.js";import{a as I,R as te}from"./monaco-Bx8A1Vm1.js";import{a as _,u as $}from"./index-Bu7BlRFk.js";import{R as se,i as oe,a as V}from"./ruleKinds-B9hACGaq.js";import{T as E,t as o,I as y,B as O,c as q,F as s,S as h,am as w,P as Q,b as Y,d as J,ah as ce,ai as ue,aj as de,ak as pe,M as he,e as me,a7 as H}from"./fluent-ui-D7EtYwEg.js";import{C as xe}from"./CrmParameterEditor-BdmP65mF.js";import{f as Z,D as ye,c as ve,S as je,v as ge,g as Re,C as be}from"./dnd-fsSwRnQv.js";import"./crmParameters-rgfZhhzN.js";const fe=L({root:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS},search:{marginBottom:o.spacingVerticalXS},group:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXXS},groupLabel:{color:o.colorNeutralForeground3,paddingTop:o.spacingVerticalXS},kindButton:{justifyContent:"flex-start",textAlign:"left"}});function Ce(l){switch(l){case"CommandClientTypeRule":return{kind:l,type:"Refresh"};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 ee=({onSelect:l,container:t,insideOr:d=!1})=>{const p=fe(),[c,f]=I.useState(""),R=se.map(x=>({...x,kinds:x.kinds.filter(m=>{if(t&&!oe(m,t,d)||d&&m==="OrRule")return!1;const C=V[m]??m;return!c||C.toLowerCase().includes(c.toLowerCase())||m.toLowerCase().includes(c.toLowerCase())})})).filter(x=>x.kinds.length>0);return e.jsxs("div",{className:p.root,children:[e.jsx(E,{size:100,style:{color:o.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(y,{className:p.search,placeholder:"Search rule kinds…",value:c,onChange:(x,m)=>f(m.value)}),R.map(x=>e.jsxs("div",{className:p.group,children:[e.jsx(E,{size:100,weight:"semibold",className:p.groupLabel,children:x.label}),x.kinds.map(m=>e.jsx(O,{appearance:"subtle",className:p.kindButton,onClick:()=>l(Ce(m)),children:V[m]??m},m))]},x.label))]})},Se=L({step:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,padding:o.spacingVerticalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},header:{display:"flex",alignItems:"center",justifyContent:"space-between"},kindBadge:{flexShrink:0},fields:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS},row:{display:"flex",gap:o.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"},nested:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,paddingLeft:o.spacingHorizontalM,borderLeft:`2px solid ${o.colorBrandStroke2}`},nestedToolbar:{display:"flex",alignItems:"center",gap:o.spacingHorizontalXS},pickerSurface:{minWidth:"300px",maxHeight:"50vh",overflowY:"auto",padding:o.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"],le=({step:l,onChange:t,onRemove:d,container:p})=>{const c=Se(),[f,R]=te.useState(null),x=l.kind!=="OrRule"&&l.kind!=="RawRule",m=x?l.invertResult:void 0,C=x?l.default:void 0,r=a=>{t({...l,...a})},k=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(s,{label:"Type",children:e.jsxs(h,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"Refresh",children:"Refresh (Unified Interface / modern web)"}),e.jsx("option",{value:"Modern",children:"Modern (Dynamics 365 for tablets)"}),e.jsx("option",{value:"Legacy",children:"Legacy (classic ribbon + Outlook list views)"})]})});case"CrmClientTypeRule":return e.jsx(s,{label:"Type",children:e.jsxs(h,{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(s,{label:"State",children:e.jsx(h,{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(s,{label:"Type",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Minimum",children:e.jsx(y,{value:String(l.minimum??""),onChange:(a,n)=>r({minimum:n.value?parseInt(n.value):void 0}),style:{width:"80px"}})}),e.jsx(s,{label:"Maximum",children:e.jsx(y,{type:"number",value:String(l.maximum??""),onChange:(a,n)=>r({maximum:n.value?parseInt(n.value):void 0}),style:{width:"80px"}})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Entity name",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Context",children:e.jsxs(h,{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(s,{label:"Entity name",children:e.jsx(y,{value:l.entityName,onChange:(a,n)=>r({entityName:n.value})})});case"CustomRule":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Library ($webresource:)",children:e.jsx(y,{value:l.library,onChange:(a,n)=>r({library:n.value}),placeholder:"$webresource:..."})}),e.jsx(s,{label:"Function name",children:e.jsx(y,{value:l.functionName,onChange:(a,n)=>r({functionName:n.value})})})]}),e.jsx(s,{label:"Parameters",children:e.jsx(xe,{params:l.params??[],onChange:a=>r({params:a.length?a:void 0})})}),e.jsx(E,{size:100,style:{color:o.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(s,{label:"State",children:e.jsxs(h,{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(s,{label:"Type",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Major",children:e.jsx(y,{type:"number",value:String(l.major),onChange:(a,n)=>r({major:k(n.value)??l.major}),style:{width:"84px"}})}),e.jsx(s,{label:"Minor",children:e.jsx(y,{type:"number",value:String(l.minor??""),onChange:(a,n)=>r({minor:k(n.value)}),style:{width:"84px"}})}),e.jsx(s,{label:"Build",children:e.jsx(y,{type:"number",value:String(l.build??""),onChange:(a,n)=>r({build:k(n.value)}),style:{width:"84px"}})}),e.jsx(s,{label:"Revision",children:e.jsx(y,{type:"number",value:String(l.revision??""),onChange:(a,n)=>r({revision:k(n.value)}),style:{width:"84px"}})})]});case"DeviceTypeRule":return e.jsx(s,{label:"Device type",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Entity (optional)",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Privilege",children:e.jsx(h,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(s,{label:"Depth",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Entity (optional)",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Property",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Field",children:e.jsx(y,{value:l.field,onChange:(a,n)=>r({field:n.value})})}),e.jsx(s,{label:"Value",children:e.jsx(y,{value:l.value,onChange:(a,n)=>r({value:n.value})})})]});case"OrRule":{const a=g=>t({...l,groups:g.filter(b=>b.length>0)}),n=(g,b)=>e.jsxs(Q,{open:f===g,onOpenChange:(v,u)=>R(u.open?g:null),children:[e.jsx(Y,{children:e.jsx(O,{icon:e.jsx(K,{}),appearance:"secondary",size:"small",children:b})}),e.jsx(J,{className:c.pickerSurface,children:e.jsx(ee,{container:p,insideOr:!0,onSelect:v=>{a(g==="new"?[...l.groups,[v]]:l.groups.map((u,S)=>S===g?[...u,v]:u)),R(null)}})})]});return e.jsxs("div",{className:c.nested,children:[l.groups.map((g,b)=>e.jsxs("div",{className:c.nested,children:[e.jsxs(E,{size:100,weight:"semibold",children:[b===0?"Either":"Or",g.length>1?" (all of)":""]}),g.map((v,u)=>e.jsx(le,{step:v,container:p,onChange:S=>a(l.groups.map((T,D)=>D===b?T.map((P,M)=>M===u?S:P):T)),onRemove:()=>a(l.groups.map((S,T)=>T===b?S.filter((D,P)=>P!==u):S))},`${b}-${u}-${v.kind}`)),e.jsx("div",{className:c.nestedToolbar,children:n(b,"And…")})]},b)),e.jsxs("div",{className:c.nestedToolbar,children:[n("new","Add Or branch"),e.jsx(E,{size:100,style:{color:o.colorNeutralForeground3},children:"An OrRule needs at least two branches."})]})]})}case"FeatureControlRule":return e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Feature control bit",children:e.jsx(y,{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(E,{size:100,style:{color:o.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(s,{label:"SKU",children:e.jsxs(h,{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(s,{label:"Setting",children:e.jsx(h,{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:c.row,children:[e.jsxs(s,{label:"Privilege name",children:[e.jsx(y,{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(s,{label:"Depth (optional)",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Option set",children:e.jsx(y,{value:l.optionSet,onChange:(a,n)=>r({optionSet:n.value})})}),e.jsx(s,{label:"State code",children:e.jsx(y,{value:l.stateCode,onChange:(a,n)=>r({stateCode:n.value})})}),e.jsx(s,{label:"Object type code",children:e.jsx(y,{value:l.objectTypeCode,onChange:(a,n)=>r({objectTypeCode:n.value})})})]});case"OutlookItemTrackingRule":return e.jsxs("div",{className:c.row,children:[e.jsx(w,{label:"Tracked in CRM",checked:l.trackedInCrm,onChange:(a,n)=>r({trackedInCrm:n.checked===!0})}),e.jsx(s,{label:"Applies To",children:e.jsx(h,{value:l.appliesTo??"PrimaryEntity",onChange:(a,n)=>r({appliesTo:n.value}),children:e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"})})})]});case"OutlookRenderTypeRule":return e.jsx(s,{label:"Render type",children:e.jsxs(h,{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(s,{label:"Outlook version",children:e.jsxs(h,{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(s,{label:"Address pattern",children:e.jsx(y,{value:l.address,onChange:(a,n)=>r({address:n.value}),placeholder:"main.aspx"})});case"RecordPrivilegeRule":return e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Privilege",children:e.jsx(h,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Applies To",children:e.jsx(h,{value:l.appliesTo,disabled:!0,children:e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})})}),e.jsx(s,{label:"Relationship type",children:e.jsxs(h,{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(E,{size:200,italic:!0,style:{color:o.colorNeutralForeground3},children:[l.kind," — no additional parameters"]})}};return e.jsxs("div",{className:c.step,role:"listitem",children:[e.jsxs("div",{className:c.header,children:[e.jsx(q,{appearance:"outline",size:"small",className:c.kindBadge,children:V[l.kind]??l.kind}),e.jsx(O,{appearance:"subtle",icon:e.jsx(X,{}),size:"small",onClick:d,"aria-label":`Remove ${l.kind} step`})]}),e.jsxs("div",{className:c.fields,children:[A(),e.jsx("div",{className:c.row,children:x&&e.jsxs(e.Fragment,{children:[e.jsx(s,{label:"Default",title:"Value the rule returns when it cannot be evaluated.",children:e.jsxs(h,{value:C===void 0?"":String(C),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:m===!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 — rule always passes.":l.map(B).join(" AND ")}function B(l){const t="invertResult"in l&&l.invertResult?"NOT ":"";switch(l.kind){case"SelectionCountRule":{const d=l.minimum!==void 0?`at least ${l.minimum}`:null,p=l.maximum!==void 0?`at most ${l.maximum}`:null,c=[d,p].filter(Boolean).join(" and "),f=l.appliesTo?` (${l.appliesTo})`:"";return`${t}Selection count is ${c}${f}`}case"EntityRule":{const d=l.entityName??"any entity",p=l.context?` in ${l.context} context`:"",c=l.appliesTo?` (${l.appliesTo})`:"";return`${t}Entity is "${d}"${p}${c}`}case"FormStateRule":return`${t}Form state is "${l.state}"`;case"CommandClientTypeRule":return`${t}Client type is "${l.type}" (${$e(l.type)})`;case"CrmClientTypeRule":return`${t}CRM client type is "${l.type}"`;case"CustomRule":return`${t}Custom rule: ${l.functionName}() from ${l.library}`;case"OrRule":return`(${l.groups.map(p=>p.length===1?B(p[0]):`(${p.map(B).join(" AND ")})`).join(" OR ")})`;case"FeatureControlRule":return`${t}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`${t}User has "${l.privilegeName}" privilege${d}`}case"EntityPrivilegeRule":{const d=l.entityName?` on "${l.entityName}"`:"",p=l.appliesTo?` (${l.appliesTo})`:"";return`${t}User has ${l.privilegeType} privilege${d} at ${l.privilegeDepth} depth${p}`}case"EntityPropertyRule":{const d=l.entityName?` for "${l.entityName}"`:"";return`${t}Entity property "${l.propertyName}" is ${l.propertyValue}${d}`}case"FormTypeRule":return`${t}Form type is "${l.type}"`;case"FormEntityContextRule":return`${t}Form entity context is "${l.entityName}"`;case"ValueRule":return`${t}Field "${l.field}" equals "${l.value}"`;case"SkuRule":return`${t}SKU is "${l.sku}"`;case"HideForTabletExperienceRule":return`${t}Hide for tablet experience`;case"OrganizationSettingRule":return`${t}Organization setting "${l.setting}" is enabled`;case"PageRule":return`${t}Page address matches "${l.address}"`;case"RecordPrivilegeRule":{const d=l.appliesTo?` (${l.appliesTo})`:"";return`${t}User has ${l.privilegeType} privilege on current record${d}`}case"RelationshipTypeRule":{const d=l.relationshipType??"any";return`${t}Relationship type is "${d}" (${l.appliesTo})`}case"ReferencingAttributeRequiredRule":return`${t}Referencing attribute is required`;case"OutlookItemTrackingRule":return`${t}Outlook item is ${l.trackedInCrm?"":"not "}tracked in CRM`;case"OutlookRenderTypeRule":return`${t}Outlook render type is "${l.type}"`;case"OutlookVersionRule":return`${t}Outlook version is "${l.version}"`;case"CrmOfflineAccessStateRule":return`${t}CRM offline state is "${l.state}"`;case"CrmOutlookClientTypeRule":return`${t}CRM Outlook client type is "${l.type}"`;case"CrmOutlookClientVersionRule":return`${t}CRM Outlook client version is ${l.major}.${l.minor??0}+`;case"DeviceTypeRule":return`${t}Device type is "${l.type}"`;case"OptionSetRule":return`${t}Option set "${l.optionSet}" state code is "${l.stateCode}"`;default:return"Unknown rule step"}}function $e(l){switch(l){case"Modern":return"Dynamics 365 tablets";case"Refresh":return"Unified Interface / modern web";case"Legacy":return"Classic ribbon / Outlook list views";default:return l}}let Oe=0;const U=(l,t)=>Array.from({length:t},()=>`${l}#${++Oe}`);function ke(l,t){const[d,p]=I.useState(null),c=I.useMemo(()=>U(l,t.length),[l,t]),f=!!d&&d.scope===l&&d.keys.length===t.length&&(d.items===t||d.pending);d?.pending&&p({...d,items:f?t:d.items,pending:!1});const R=f?d.keys:c,x=m=>p({scope:l,items:t,pending:!0,keys:m});return{keys:R,add:()=>x([...R,...U(l,1)]),remove:m=>x(R.filter((C,r)=>r!==m)),move:(m,C)=>x(Z(R,m,C)),update:()=>x(R)}}const we=L({drawer:{width:"560px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingVerticalS,padding:o.spacingVerticalM,overflowY:"auto"},header:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},stepsList:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,listStyle:"none",padding:0,margin:0},summary:{padding:o.spacingVerticalS,backgroundColor:o.colorNeutralBackground3,borderRadius:o.borderRadiusMedium,fontStyle:"italic",color:o.colorNeutralForeground2,fontSize:o.fontSizeBase200},addRow:{display:"flex",gap:o.spacingHorizontalS},pickerPopover:{maxHeight:"60vh",overflowY:"auto",minWidth:"320px",padding:o.spacingVerticalM},usedBy:{color:o.colorNeutralForeground3,fontSize:o.fontSizeBase200},ruleIdRow:{display:"flex",alignItems:"flex-end",gap:o.spacingHorizontalS},ruleIdInput:{fontFamily:o.fontFamilyMonospace},error:{color:o.colorPaletteRedForeground1,fontSize:o.fontSizeBase100},sortableItem:{listStyle:"none"},sortableInner:{display:"flex",alignItems:"flex-start",gap:o.spacingHorizontalS},dragHandle:{marginTop:o.spacingVerticalS,cursor:"grab"}}),Ie=[],Le=()=>{const l=we(),t=_(i=>i.ruleEditorOpen),d=_(i=>i.ruleEditorId),p=_(i=>i.ruleEditorKind),c=_(i=>i.closeRuleEditor),f=_(i=>i.openRuleEditor),R=$(i=>i.enableRules),x=$(i=>i.displayRules),m=$(i=>i.commands),C=$(i=>i.upsertEnableRule),r=$(i=>i.upsertDisplayRule),k=$(i=>i.renameEnableRuleId),A=$(i=>i.renameDisplayRuleId),[a,n]=I.useState(!1),[g,b]=I.useState(""),v=p==="enable",u=v?R.find(i=>i.id===d):x.find(i=>i.id===d);I.useEffect(()=>{u&&b(u.id)},[u]);const S=ke(`${p}:${u?.id??""}`,u?.steps??Ie),T=S.keys,D=m.filter(i=>v?i.enableRules.includes(d??""):i.displayRules.includes(d??"")).length,P=(i,j)=>{if(!u)return;const N=[...u.steps];N[i]=j,S.update(),v?C({...u,steps:N}):r({...u,steps:N})},M=i=>{if(!u)return;const j=u.steps.filter((N,F)=>F!==i);S.remove(i),v?C({...u,steps:j}):r({...u,steps:j})},ne=i=>{if(!u)return;const j=[...u.steps,i];S.add(),v?C({...u,steps:j}):r({...u,steps:j}),n(!1)},ae=i=>{if(!u||!i.over||i.active.id===i.over.id)return;const j=T.indexOf(String(i.active.id)),N=T.indexOf(String(i.over.id));if(j<0||N<0)return;const F=Z(u.steps,j,N);S.move(j,N),v?C({...u,steps:F}):r({...u,steps:F})};if(!u)return null;const re=Ne(u.steps),ie=(v?R:x).some(i=>i.id===g.trim()&&i.id!==u.id),z=g.trim()?/\s/.test(g)?"Rule ID cannot contain whitespace.":ie?"A rule with this ID already exists.":"":"Rule ID is required.";return e.jsxs(ce,{position:"end",open:t,onOpenChange:()=>c(),className:l.drawer,children:[e.jsx(ue,{children:e.jsx(de,{action:e.jsx(O,{appearance:"subtle",icon:e.jsx(X,{}),onClick:c,"aria-label":"Close rule editor"}),children:e.jsxs("div",{className:l.header,children:[e.jsx(q,{appearance:"filled",color:v?"success":"informative",size:"small",children:v?"Enable":"Display"}),e.jsx(E,{size:400,weight:"semibold",style:{fontFamily:o.fontFamilyMonospace},children:u.id})]})})}),e.jsxs(pe,{className:l.body,children:[e.jsxs(E,{className:l.usedBy,children:["Used by ",D," command(s)"]}),e.jsxs("div",{className:l.ruleIdRow,children:[e.jsx(y,{className:l.ruleIdInput,value:g,onChange:(i,j)=>b(j.value),"aria-label":"Rule ID"}),e.jsx(O,{appearance:"secondary",size:"small",disabled:!g.trim()||!!z||g===u.id,onClick:()=>{const i=g.trim();(v?k(u.id,i):A(u.id,i))&&f(i,v?"enable":"display")},children:"Apply ID change"})]}),z&&e.jsx(E,{className:l.error,children:z}),v&&e.jsx(he,{intent:"warning",children:e.jsx(me,{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(ye,{collisionDetection:ve,onDragEnd:ae,children:e.jsx(je,{items:T,strategy:ge,children:e.jsxs("ol",{className:l.stepsList,role:"list","aria-label":"Rule steps",children:[u.steps.map((i,j)=>e.jsx(Pe,{id:T[j],styles:l,children:e.jsx(le,{step:i,onChange:N=>P(j,N),onRemove:()=>M(j),container:v?"enable":"display"})},T[j])),u.steps.length===0&&e.jsx(E,{italic:!0,style:{color:o.colorNeutralForeground3},children:"No steps yet — all buttons with this rule will be visible/enabled by default."})]})})}),e.jsxs(Q,{open:a,onOpenChange:(i,j)=>n(j.open),children:[e.jsx(Y,{children:e.jsx(O,{icon:e.jsx(K,{}),appearance:"secondary",onClick:()=>n(!0),children:"Add step"})}),e.jsx(J,{className:l.pickerPopover,children:e.jsx(ee,{onSelect:ne,container:v?"enable":"display"})})]}),e.jsx(H,{children:"Plain-English summary"}),e.jsx("div",{className:l.summary,role:"note","aria-label":"Rule summary",children:re})]})]})};function Pe({id:l,children:t,styles:d}){const{attributes:p,listeners:c,setNodeRef:f,setActivatorNodeRef:R,transform:x,transition:m}=Re({id:l});return e.jsx("li",{ref:f,className:d.sortableItem,style:{transform:be.Transform.toString(x),transition:m},children:e.jsxs("div",{className:d.sortableInner,children:[e.jsx(O,{ref:R,appearance:"subtle",size:"small",className:d.dragHandle,...p,...c,"aria-label":"Drag to reorder step",children:"Drag"}),e.jsx("div",{style:{flex:1},children:t})]})})}export{Le as RuleEditorPanel,Le as default};
|
|
1
|
+
import{z as e,y as L,h as X,cq as K}from"./fluent-icons-4bzebHz-.js";import{a as I,R as te}from"./monaco-BoSoLy50.js";import{a as _,u as $}from"./index-B2t4gwW0.js";import{R as se,i as oe,a as V}from"./ruleKinds-B9hACGaq.js";import{T as E,t as o,I as y,B as O,c as q,F as s,S as h,am as w,P as Q,b as Y,d as J,ah as ce,ai as ue,aj as de,ak as pe,M as he,e as me,a7 as H}from"./fluent-ui-lAhdF0Ck.js";import{C as xe}from"./CrmParameterEditor-B84bdjcT.js";import{f as Z,D as ye,c as ve,S as je,v as ge,g as Re,C as be}from"./dnd-vmvAsOrM.js";import"./crmParameters-rgfZhhzN.js";const fe=L({root:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS},search:{marginBottom:o.spacingVerticalXS},group:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXXS},groupLabel:{color:o.colorNeutralForeground3,paddingTop:o.spacingVerticalXS},kindButton:{justifyContent:"flex-start",textAlign:"left"}});function Ce(l){switch(l){case"CommandClientTypeRule":return{kind:l,type:"Refresh"};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 ee=({onSelect:l,container:t,insideOr:d=!1})=>{const p=fe(),[c,f]=I.useState(""),R=se.map(x=>({...x,kinds:x.kinds.filter(m=>{if(t&&!oe(m,t,d)||d&&m==="OrRule")return!1;const C=V[m]??m;return!c||C.toLowerCase().includes(c.toLowerCase())||m.toLowerCase().includes(c.toLowerCase())})})).filter(x=>x.kinds.length>0);return e.jsxs("div",{className:p.root,children:[e.jsx(E,{size:100,style:{color:o.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(y,{className:p.search,placeholder:"Search rule kinds…",value:c,onChange:(x,m)=>f(m.value)}),R.map(x=>e.jsxs("div",{className:p.group,children:[e.jsx(E,{size:100,weight:"semibold",className:p.groupLabel,children:x.label}),x.kinds.map(m=>e.jsx(O,{appearance:"subtle",className:p.kindButton,onClick:()=>l(Ce(m)),children:V[m]??m},m))]},x.label))]})},Se=L({step:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,padding:o.spacingVerticalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},header:{display:"flex",alignItems:"center",justifyContent:"space-between"},kindBadge:{flexShrink:0},fields:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS},row:{display:"flex",gap:o.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"},nested:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,paddingLeft:o.spacingHorizontalM,borderLeft:`2px solid ${o.colorBrandStroke2}`},nestedToolbar:{display:"flex",alignItems:"center",gap:o.spacingHorizontalXS},pickerSurface:{minWidth:"300px",maxHeight:"50vh",overflowY:"auto",padding:o.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"],le=({step:l,onChange:t,onRemove:d,container:p})=>{const c=Se(),[f,R]=te.useState(null),x=l.kind!=="OrRule"&&l.kind!=="RawRule",m=x?l.invertResult:void 0,C=x?l.default:void 0,r=a=>{t({...l,...a})},k=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(s,{label:"Type",children:e.jsxs(h,{value:l.type,onChange:(a,n)=>r({type:n.value}),children:[e.jsx("option",{value:"Refresh",children:"Refresh (Unified Interface / modern web)"}),e.jsx("option",{value:"Modern",children:"Modern (Dynamics 365 for tablets)"}),e.jsx("option",{value:"Legacy",children:"Legacy (classic ribbon + Outlook list views)"})]})});case"CrmClientTypeRule":return e.jsx(s,{label:"Type",children:e.jsxs(h,{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(s,{label:"State",children:e.jsx(h,{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(s,{label:"Type",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Minimum",children:e.jsx(y,{value:String(l.minimum??""),onChange:(a,n)=>r({minimum:n.value?parseInt(n.value):void 0}),style:{width:"80px"}})}),e.jsx(s,{label:"Maximum",children:e.jsx(y,{type:"number",value:String(l.maximum??""),onChange:(a,n)=>r({maximum:n.value?parseInt(n.value):void 0}),style:{width:"80px"}})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Entity name",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Context",children:e.jsxs(h,{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(s,{label:"Entity name",children:e.jsx(y,{value:l.entityName,onChange:(a,n)=>r({entityName:n.value})})});case"CustomRule":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Library ($webresource:)",children:e.jsx(y,{value:l.library,onChange:(a,n)=>r({library:n.value}),placeholder:"$webresource:..."})}),e.jsx(s,{label:"Function name",children:e.jsx(y,{value:l.functionName,onChange:(a,n)=>r({functionName:n.value})})})]}),e.jsx(s,{label:"Parameters",children:e.jsx(xe,{params:l.params??[],onChange:a=>r({params:a.length?a:void 0})})}),e.jsx(E,{size:100,style:{color:o.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(s,{label:"State",children:e.jsxs(h,{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(s,{label:"Type",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Major",children:e.jsx(y,{type:"number",value:String(l.major),onChange:(a,n)=>r({major:k(n.value)??l.major}),style:{width:"84px"}})}),e.jsx(s,{label:"Minor",children:e.jsx(y,{type:"number",value:String(l.minor??""),onChange:(a,n)=>r({minor:k(n.value)}),style:{width:"84px"}})}),e.jsx(s,{label:"Build",children:e.jsx(y,{type:"number",value:String(l.build??""),onChange:(a,n)=>r({build:k(n.value)}),style:{width:"84px"}})}),e.jsx(s,{label:"Revision",children:e.jsx(y,{type:"number",value:String(l.revision??""),onChange:(a,n)=>r({revision:k(n.value)}),style:{width:"84px"}})})]});case"DeviceTypeRule":return e.jsx(s,{label:"Device type",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Entity (optional)",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Privilege",children:e.jsx(h,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(s,{label:"Depth",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Entity (optional)",children:e.jsx(y,{value:l.entityName??"",onChange:(a,n)=>r({entityName:n.value||void 0})})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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(s,{label:"Property",children:e.jsx(h,{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:c.row,children:[e.jsx(s,{label:"Field",children:e.jsx(y,{value:l.field,onChange:(a,n)=>r({field:n.value})})}),e.jsx(s,{label:"Value",children:e.jsx(y,{value:l.value,onChange:(a,n)=>r({value:n.value})})})]});case"OrRule":{const a=g=>t({...l,groups:g.filter(b=>b.length>0)}),n=(g,b)=>e.jsxs(Q,{open:f===g,onOpenChange:(v,u)=>R(u.open?g:null),children:[e.jsx(Y,{children:e.jsx(O,{icon:e.jsx(K,{}),appearance:"secondary",size:"small",children:b})}),e.jsx(J,{className:c.pickerSurface,children:e.jsx(ee,{container:p,insideOr:!0,onSelect:v=>{a(g==="new"?[...l.groups,[v]]:l.groups.map((u,S)=>S===g?[...u,v]:u)),R(null)}})})]});return e.jsxs("div",{className:c.nested,children:[l.groups.map((g,b)=>e.jsxs("div",{className:c.nested,children:[e.jsxs(E,{size:100,weight:"semibold",children:[b===0?"Either":"Or",g.length>1?" (all of)":""]}),g.map((v,u)=>e.jsx(le,{step:v,container:p,onChange:S=>a(l.groups.map((T,D)=>D===b?T.map((P,M)=>M===u?S:P):T)),onRemove:()=>a(l.groups.map((S,T)=>T===b?S.filter((D,P)=>P!==u):S))},`${b}-${u}-${v.kind}`)),e.jsx("div",{className:c.nestedToolbar,children:n(b,"And…")})]},b)),e.jsxs("div",{className:c.nestedToolbar,children:[n("new","Add Or branch"),e.jsx(E,{size:100,style:{color:o.colorNeutralForeground3},children:"An OrRule needs at least two branches."})]})]})}case"FeatureControlRule":return e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Feature control bit",children:e.jsx(y,{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(E,{size:100,style:{color:o.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(s,{label:"SKU",children:e.jsxs(h,{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(s,{label:"Setting",children:e.jsx(h,{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:c.row,children:[e.jsxs(s,{label:"Privilege name",children:[e.jsx(y,{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(s,{label:"Depth (optional)",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Option set",children:e.jsx(y,{value:l.optionSet,onChange:(a,n)=>r({optionSet:n.value})})}),e.jsx(s,{label:"State code",children:e.jsx(y,{value:l.stateCode,onChange:(a,n)=>r({stateCode:n.value})})}),e.jsx(s,{label:"Object type code",children:e.jsx(y,{value:l.objectTypeCode,onChange:(a,n)=>r({objectTypeCode:n.value})})})]});case"OutlookItemTrackingRule":return e.jsxs("div",{className:c.row,children:[e.jsx(w,{label:"Tracked in CRM",checked:l.trackedInCrm,onChange:(a,n)=>r({trackedInCrm:n.checked===!0})}),e.jsx(s,{label:"Applies To",children:e.jsx(h,{value:l.appliesTo??"PrimaryEntity",onChange:(a,n)=>r({appliesTo:n.value}),children:e.jsx("option",{value:"PrimaryEntity",children:"PrimaryEntity"})})})]});case"OutlookRenderTypeRule":return e.jsx(s,{label:"Render type",children:e.jsxs(h,{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(s,{label:"Outlook version",children:e.jsxs(h,{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(s,{label:"Address pattern",children:e.jsx(y,{value:l.address,onChange:(a,n)=>r({address:n.value}),placeholder:"main.aspx"})});case"RecordPrivilegeRule":return e.jsxs("div",{className:c.row,children:[e.jsx(s,{label:"Privilege",children:e.jsx(h,{value:l.privilegeType,onChange:(a,n)=>r({privilegeType:n.value}),children:G.map(a=>e.jsx("option",{value:a,children:a},a))})}),e.jsx(s,{label:"Applies To",children:e.jsxs(h,{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:c.row,children:[e.jsx(s,{label:"Applies To",children:e.jsx(h,{value:l.appliesTo,disabled:!0,children:e.jsx("option",{value:"SelectedEntity",children:"SelectedEntity"})})}),e.jsx(s,{label:"Relationship type",children:e.jsxs(h,{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(E,{size:200,italic:!0,style:{color:o.colorNeutralForeground3},children:[l.kind," — no additional parameters"]})}};return e.jsxs("div",{className:c.step,role:"listitem",children:[e.jsxs("div",{className:c.header,children:[e.jsx(q,{appearance:"outline",size:"small",className:c.kindBadge,children:V[l.kind]??l.kind}),e.jsx(O,{appearance:"subtle",icon:e.jsx(X,{}),size:"small",onClick:d,"aria-label":`Remove ${l.kind} step`})]}),e.jsxs("div",{className:c.fields,children:[A(),e.jsx("div",{className:c.row,children:x&&e.jsxs(e.Fragment,{children:[e.jsx(s,{label:"Default",title:"Value the rule returns when it cannot be evaluated.",children:e.jsxs(h,{value:C===void 0?"":String(C),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:m===!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 — rule always passes.":l.map(B).join(" AND ")}function B(l){const t="invertResult"in l&&l.invertResult?"NOT ":"";switch(l.kind){case"SelectionCountRule":{const d=l.minimum!==void 0?`at least ${l.minimum}`:null,p=l.maximum!==void 0?`at most ${l.maximum}`:null,c=[d,p].filter(Boolean).join(" and "),f=l.appliesTo?` (${l.appliesTo})`:"";return`${t}Selection count is ${c}${f}`}case"EntityRule":{const d=l.entityName??"any entity",p=l.context?` in ${l.context} context`:"",c=l.appliesTo?` (${l.appliesTo})`:"";return`${t}Entity is "${d}"${p}${c}`}case"FormStateRule":return`${t}Form state is "${l.state}"`;case"CommandClientTypeRule":return`${t}Client type is "${l.type}" (${$e(l.type)})`;case"CrmClientTypeRule":return`${t}CRM client type is "${l.type}"`;case"CustomRule":return`${t}Custom rule: ${l.functionName}() from ${l.library}`;case"OrRule":return`(${l.groups.map(p=>p.length===1?B(p[0]):`(${p.map(B).join(" AND ")})`).join(" OR ")})`;case"FeatureControlRule":return`${t}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`${t}User has "${l.privilegeName}" privilege${d}`}case"EntityPrivilegeRule":{const d=l.entityName?` on "${l.entityName}"`:"",p=l.appliesTo?` (${l.appliesTo})`:"";return`${t}User has ${l.privilegeType} privilege${d} at ${l.privilegeDepth} depth${p}`}case"EntityPropertyRule":{const d=l.entityName?` for "${l.entityName}"`:"";return`${t}Entity property "${l.propertyName}" is ${l.propertyValue}${d}`}case"FormTypeRule":return`${t}Form type is "${l.type}"`;case"FormEntityContextRule":return`${t}Form entity context is "${l.entityName}"`;case"ValueRule":return`${t}Field "${l.field}" equals "${l.value}"`;case"SkuRule":return`${t}SKU is "${l.sku}"`;case"HideForTabletExperienceRule":return`${t}Hide for tablet experience`;case"OrganizationSettingRule":return`${t}Organization setting "${l.setting}" is enabled`;case"PageRule":return`${t}Page address matches "${l.address}"`;case"RecordPrivilegeRule":{const d=l.appliesTo?` (${l.appliesTo})`:"";return`${t}User has ${l.privilegeType} privilege on current record${d}`}case"RelationshipTypeRule":{const d=l.relationshipType??"any";return`${t}Relationship type is "${d}" (${l.appliesTo})`}case"ReferencingAttributeRequiredRule":return`${t}Referencing attribute is required`;case"OutlookItemTrackingRule":return`${t}Outlook item is ${l.trackedInCrm?"":"not "}tracked in CRM`;case"OutlookRenderTypeRule":return`${t}Outlook render type is "${l.type}"`;case"OutlookVersionRule":return`${t}Outlook version is "${l.version}"`;case"CrmOfflineAccessStateRule":return`${t}CRM offline state is "${l.state}"`;case"CrmOutlookClientTypeRule":return`${t}CRM Outlook client type is "${l.type}"`;case"CrmOutlookClientVersionRule":return`${t}CRM Outlook client version is ${l.major}.${l.minor??0}+`;case"DeviceTypeRule":return`${t}Device type is "${l.type}"`;case"OptionSetRule":return`${t}Option set "${l.optionSet}" state code is "${l.stateCode}"`;default:return"Unknown rule step"}}function $e(l){switch(l){case"Modern":return"Dynamics 365 tablets";case"Refresh":return"Unified Interface / modern web";case"Legacy":return"Classic ribbon / Outlook list views";default:return l}}let Oe=0;const U=(l,t)=>Array.from({length:t},()=>`${l}#${++Oe}`);function ke(l,t){const[d,p]=I.useState(null),c=I.useMemo(()=>U(l,t.length),[l,t]),f=!!d&&d.scope===l&&d.keys.length===t.length&&(d.items===t||d.pending);d?.pending&&p({...d,items:f?t:d.items,pending:!1});const R=f?d.keys:c,x=m=>p({scope:l,items:t,pending:!0,keys:m});return{keys:R,add:()=>x([...R,...U(l,1)]),remove:m=>x(R.filter((C,r)=>r!==m)),move:(m,C)=>x(Z(R,m,C)),update:()=>x(R)}}const we=L({drawer:{width:"560px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingVerticalS,padding:o.spacingVerticalM,overflowY:"auto"},header:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},stepsList:{display:"flex",flexDirection:"column",gap:o.spacingVerticalXS,listStyle:"none",padding:0,margin:0},summary:{padding:o.spacingVerticalS,backgroundColor:o.colorNeutralBackground3,borderRadius:o.borderRadiusMedium,fontStyle:"italic",color:o.colorNeutralForeground2,fontSize:o.fontSizeBase200},addRow:{display:"flex",gap:o.spacingHorizontalS},pickerPopover:{maxHeight:"60vh",overflowY:"auto",minWidth:"320px",padding:o.spacingVerticalM},usedBy:{color:o.colorNeutralForeground3,fontSize:o.fontSizeBase200},ruleIdRow:{display:"flex",alignItems:"flex-end",gap:o.spacingHorizontalS},ruleIdInput:{fontFamily:o.fontFamilyMonospace},error:{color:o.colorPaletteRedForeground1,fontSize:o.fontSizeBase100},sortableItem:{listStyle:"none"},sortableInner:{display:"flex",alignItems:"flex-start",gap:o.spacingHorizontalS},dragHandle:{marginTop:o.spacingVerticalS,cursor:"grab"}}),Ie=[],Le=()=>{const l=we(),t=_(i=>i.ruleEditorOpen),d=_(i=>i.ruleEditorId),p=_(i=>i.ruleEditorKind),c=_(i=>i.closeRuleEditor),f=_(i=>i.openRuleEditor),R=$(i=>i.enableRules),x=$(i=>i.displayRules),m=$(i=>i.commands),C=$(i=>i.upsertEnableRule),r=$(i=>i.upsertDisplayRule),k=$(i=>i.renameEnableRuleId),A=$(i=>i.renameDisplayRuleId),[a,n]=I.useState(!1),[g,b]=I.useState(""),v=p==="enable",u=v?R.find(i=>i.id===d):x.find(i=>i.id===d);I.useEffect(()=>{u&&b(u.id)},[u]);const S=ke(`${p}:${u?.id??""}`,u?.steps??Ie),T=S.keys,D=m.filter(i=>v?i.enableRules.includes(d??""):i.displayRules.includes(d??"")).length,P=(i,j)=>{if(!u)return;const N=[...u.steps];N[i]=j,S.update(),v?C({...u,steps:N}):r({...u,steps:N})},M=i=>{if(!u)return;const j=u.steps.filter((N,F)=>F!==i);S.remove(i),v?C({...u,steps:j}):r({...u,steps:j})},ne=i=>{if(!u)return;const j=[...u.steps,i];S.add(),v?C({...u,steps:j}):r({...u,steps:j}),n(!1)},ae=i=>{if(!u||!i.over||i.active.id===i.over.id)return;const j=T.indexOf(String(i.active.id)),N=T.indexOf(String(i.over.id));if(j<0||N<0)return;const F=Z(u.steps,j,N);S.move(j,N),v?C({...u,steps:F}):r({...u,steps:F})};if(!u)return null;const re=Ne(u.steps),ie=(v?R:x).some(i=>i.id===g.trim()&&i.id!==u.id),z=g.trim()?/\s/.test(g)?"Rule ID cannot contain whitespace.":ie?"A rule with this ID already exists.":"":"Rule ID is required.";return e.jsxs(ce,{position:"end",open:t,onOpenChange:()=>c(),className:l.drawer,children:[e.jsx(ue,{children:e.jsx(de,{action:e.jsx(O,{appearance:"subtle",icon:e.jsx(X,{}),onClick:c,"aria-label":"Close rule editor"}),children:e.jsxs("div",{className:l.header,children:[e.jsx(q,{appearance:"filled",color:v?"success":"informative",size:"small",children:v?"Enable":"Display"}),e.jsx(E,{size:400,weight:"semibold",style:{fontFamily:o.fontFamilyMonospace},children:u.id})]})})}),e.jsxs(pe,{className:l.body,children:[e.jsxs(E,{className:l.usedBy,children:["Used by ",D," command(s)"]}),e.jsxs("div",{className:l.ruleIdRow,children:[e.jsx(y,{className:l.ruleIdInput,value:g,onChange:(i,j)=>b(j.value),"aria-label":"Rule ID"}),e.jsx(O,{appearance:"secondary",size:"small",disabled:!g.trim()||!!z||g===u.id,onClick:()=>{const i=g.trim();(v?k(u.id,i):A(u.id,i))&&f(i,v?"enable":"display")},children:"Apply ID change"})]}),z&&e.jsx(E,{className:l.error,children:z}),v&&e.jsx(he,{intent:"warning",children:e.jsx(me,{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(ye,{collisionDetection:ve,onDragEnd:ae,children:e.jsx(je,{items:T,strategy:ge,children:e.jsxs("ol",{className:l.stepsList,role:"list","aria-label":"Rule steps",children:[u.steps.map((i,j)=>e.jsx(Pe,{id:T[j],styles:l,children:e.jsx(le,{step:i,onChange:N=>P(j,N),onRemove:()=>M(j),container:v?"enable":"display"})},T[j])),u.steps.length===0&&e.jsx(E,{italic:!0,style:{color:o.colorNeutralForeground3},children:"No steps yet — all buttons with this rule will be visible/enabled by default."})]})})}),e.jsxs(Q,{open:a,onOpenChange:(i,j)=>n(j.open),children:[e.jsx(Y,{children:e.jsx(O,{icon:e.jsx(K,{}),appearance:"secondary",onClick:()=>n(!0),children:"Add step"})}),e.jsx(J,{className:l.pickerPopover,children:e.jsx(ee,{onSelect:ne,container:v?"enable":"display"})})]}),e.jsx(H,{children:"Plain-English summary"}),e.jsx("div",{className:l.summary,role:"note","aria-label":"Rule summary",children:re})]})]})};function Pe({id:l,children:t,styles:d}){const{attributes:p,listeners:c,setNodeRef:f,setActivatorNodeRef:R,transform:x,transition:m}=Re({id:l});return e.jsx("li",{ref:f,className:d.sortableItem,style:{transform:be.Transform.toString(x),transition:m},children:e.jsxs("div",{className:d.sortableInner,children:[e.jsx(O,{ref:R,appearance:"subtle",size:"small",className:d.dragHandle,...p,...c,"aria-label":"Drag to reorder step",children:"Drag"}),e.jsx("div",{style:{flex:1},children:t})]})})}export{Le as RuleEditorPanel,Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,h as O,co as I,cq as C,y as $}from"./fluent-icons-
|
|
1
|
+
import{z as e,h as O,co as I,cq as C,y as $}from"./fluent-icons-4bzebHz-.js";import{a as M,R as X}from"./monaco-BoSoLy50.js";import{a as k,X as H,u as q}from"./index-B2t4gwW0.js";import{ah as A,ai as P,aj as U,aa as G,B as c,ak as Y,T as x,t as l,a7 as R,c as B,F as p,S as j,I as L}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const Z=$({drawer:{width:"600px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:l.spacingHorizontalM,padding:l.spacingHorizontalM,overflowY:"auto"},stepRow:{display:"flex",flexDirection:"column",gap:l.spacingHorizontalXS,padding:l.spacingHorizontalS,border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,backgroundColor:l.colorNeutralBackground2},stepHeader:{display:"flex",alignItems:"center",gap:l.spacingHorizontalS},stepFields:{display:"flex",gap:l.spacingHorizontalS,flexWrap:"wrap",alignItems:"flex-end"},sectionLabel:{color:l.colorNeutralForeground3,textTransform:"uppercase",fontSize:l.fontSizeBase100,letterSpacing:"0.5px",fontWeight:l.fontWeightSemibold},warningNote:{backgroundColor:l.colorStatusWarningBackground1,borderRadius:l.borderRadiusMedium,padding:`${l.spacingHorizontalXS} ${l.spacingHorizontalS}`,fontSize:l.fontSizeBase100}}),D=["Large","LargeLarge","LargeMedium","LargeSmall","MediumLarge","MediumMedium","MediumSmall","SmallMedium","SmallSmall","Popup"],ae=()=>{const o=Z(),b=k(a=>a.scalingEditorOpen),S=k(a=>a.closeScalingEditor),y=H(a=>a.location),u=H(a=>a.tabId),T=q(a=>a.ribbons),_=q(a=>a.setScaling),v=T[y],r=v.tabs.find(a=>a.id===u),h=u?v.scalingByTab?.[u]:void 0,[w,g]=M.useState([]),[N,m]=M.useState([]);X.useEffect(()=>{if(!(!b||!r)){if(h){g([...h.maxSizes]),m([...h.scales]);return}g([{id:`MaxSize.${r.id}.1`,groupId:r.groups[0]?.id??"",size:"Large",sequence:10}]),m([{id:`Scale.${r.id}.1`,groupId:r.groups[0]?.id??"",size:"SmallSmall",sequence:200}])}},[b,r,h]);const d=r?.groups??[],E=()=>{g(a=>[...a,{id:`MaxSize.${a.length+1}`,groupId:d[0]?.id??"",size:"Large",sequence:(a.length+1)*10}])},F=()=>{m(a=>[...a,{id:`Scale.${a.length+1}`,groupId:d[0]?.id??"",size:"SmallSmall",sequence:200+(a.length+1)*10}])},z=(a,i)=>{g(s=>s.map((n,t)=>t===a?{...n,...i}:n))},f=(a,i)=>{m(s=>s.map((n,t)=>t===a?{...n,...i}:n))},W=()=>{_(y,u,{tabId:u,maxSizes:w,scales:N}),S()};return e.jsxs(A,{className:o.drawer,open:b,position:"end",onOpenChange:(a,i)=>!i.open&&S(),children:[e.jsx(P,{children:e.jsx(U,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(O,{}),onClick:S,"aria-label":"Close"}),children:e.jsx(G,{children:"Scaling Editor"})})}),e.jsx(Y,{children:e.jsxs("div",{className:o.body,children:[e.jsxs("div",{className:o.warningNote,children:["⚠ ",e.jsx("strong",{children:"Scaling applies ONLY to the Classic ribbon"})," — forms NOT updated to Unified Interface, and Dynamics 365 for Outlook list views. The modern command bar (Unified Interface) ignores all MaxSize and Scale definitions entirely."]}),r&&e.jsxs(x,{size:200,style:{color:l.colorNeutralForeground3},children:["Tab: ",e.jsx("strong",{children:r.label})," (",r.id,")"]}),e.jsx(R,{}),e.jsxs("div",{children:[e.jsx(x,{className:o.sectionLabel,children:"MaxSize (largest size, shown first)"}),e.jsx(x,{size:100,style:{color:l.colorNeutralForeground3,display:"block",marginBottom:l.spacingHorizontalS},children:"Sequence numbers must be lower than all Scale step sequence numbers."}),w.map((a,i)=>e.jsxs("div",{className:o.stepRow,style:{marginBottom:l.spacingHorizontalXS},children:[e.jsxs("div",{className:o.stepHeader,children:[e.jsxs(B,{appearance:"tint",color:"brand",size:"small",children:["MaxSize ",i+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>g(s=>s.filter((n,t)=>t!==i))})]}),e.jsxs("div",{className:o.stepFields,children:[e.jsx(p,{label:"Group",style:{minWidth:"160px"},children:e.jsxs(j,{size:"small",value:a.groupId,onChange:(s,n)=>z(i,{groupId:n.value}),children:[d.length===0&&e.jsx("option",{value:"",children:"— no groups —"}),d.map(s=>e.jsx("option",{value:s.id,children:s.label||s.id},s.id))]})}),e.jsx(p,{label:"Size",style:{minWidth:"140px"},children:e.jsx(j,{size:"small",value:a.size,onChange:(s,n)=>z(i,{size:n.value}),children:D.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(p,{label:"Sequence",style:{width:"80px"},children:e.jsx(L,{size:"small",type:"number",value:String(a.sequence),onChange:(s,n)=>z(i,{sequence:parseInt(n.value,10)||0})})})]})]},i)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(C,{}),onClick:E,children:"Add MaxSize"})]}),e.jsx(R,{}),e.jsxs("div",{children:[e.jsx(x,{className:o.sectionLabel,children:"Scale steps (collapse order — top-down)"}),e.jsx(x,{size:100,style:{color:l.colorNeutralForeground3,display:"block",marginBottom:l.spacingHorizontalS},children:"Scale elements are applied in document order (top-down when shrinking, bottom-up when growing). Sequence numbers must be higher than all MaxSize sequence numbers."}),N.map((a,i)=>e.jsxs("div",{className:o.stepRow,style:{marginBottom:l.spacingHorizontalXS},children:[e.jsxs("div",{className:o.stepHeader,children:[e.jsxs(B,{appearance:"tint",color:"informative",size:"small",children:["Scale ",i+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>m(s=>s.filter((n,t)=>t!==i))})]}),e.jsxs("div",{className:o.stepFields,children:[e.jsx(p,{label:"Group",style:{minWidth:"160px"},children:e.jsxs(j,{size:"small",value:a.groupId,onChange:(s,n)=>f(i,{groupId:n.value}),children:[d.length===0&&e.jsx("option",{value:"",children:"— no groups —"}),d.map(s=>e.jsx("option",{value:s.id,children:s.label||s.id},s.id))]})}),e.jsx(p,{label:"Size",style:{minWidth:"140px"},children:e.jsx(j,{size:"small",value:a.size,onChange:(s,n)=>f(i,{size:n.value}),children:D.map(s=>e.jsx("option",{value:s,children:s},s))})}),e.jsx(p,{label:"Sequence",style:{width:"80px"},children:e.jsx(L,{size:"small",type:"number",value:String(a.sequence),onChange:(s,n)=>f(i,{sequence:parseInt(n.value,10)||0})})})]})]},i)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(C,{}),onClick:F,children:"Add Scale step"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:l.spacingHorizontalS,paddingTop:l.spacingHorizontalS},children:[e.jsx(c,{appearance:"secondary",onClick:S,children:"Cancel"}),e.jsx(c,{appearance:"primary",onClick:W,children:"Save scaling"})]})]})})]})};export{ae as ScalingEditorPanel,ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,h as X,co as T,cq as I,y as L}from"./fluent-icons-
|
|
1
|
+
import{z as e,h as X,co as T,cq as I,y as L}from"./fluent-icons-4bzebHz-.js";import{a as P,R as V}from"./monaco-BoSoLy50.js";import{a as E,X as w,u as F}from"./index-B2t4gwW0.js";import{ah as Y,ai as J,aj as K,aa as Q,B as c,ak as Z,M as H,e as N,T as p,t as o,c as ee,F as x,I as v,S}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";function C(){return{kind:"EntityRule",appliesTo:"PrimaryEntity",context:"HomePageGrid"}}function A(){return{kind:"PageRule",address:""}}const ae=L({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,padding:o.spacingHorizontalM,overflowY:"auto"},ruleRow:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalXS,padding:o.spacingHorizontalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},ruleHeader:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},stepFields:{display:"flex",gap:o.spacingHorizontalS,alignItems:"flex-end",flexWrap:"wrap"}}),re=()=>{const b=ae(),j=E(a=>a.tabDisplayRulesOpen),h=E(a=>a.closeTabDisplayRules),g=w(a=>a.location),z=w(a=>a.tabId),B=F(a=>a.ribbons),M=F(a=>a.setTabDisplayRules),i=B[g].tabs.find(a=>a.id===z),f=g==="Application",D=!!i?.commandId,[y,d]=P.useState(()=>i?.tabDisplayRules??[]),[k,u]=P.useState(null);V.useEffect(()=>{j&&(u(null),d(i?.tabDisplayRules??[]))},[j,i]);const _=()=>{d(a=>[...a,{tabCommand:i?.commandId??"",rules:[C()]}])},G=a=>{d(l=>l.filter((s,n)=>n!==a))},W=(a,l)=>{D||d(s=>s.map((n,t)=>t===a?{...n,tabCommand:l}:n))},m=(a,l,s)=>{d(n=>n.map((t,r)=>r===a?{...t,rules:t.rules.map((R,U)=>U===l?s:R)}:t))},$=a=>{d(l=>l.map((s,n)=>n===a?{...s,rules:[...s.rules,f?A():C()]}:s))},O=(a,l)=>{d(s=>s.map((n,t)=>t===a?{...n,rules:n.rules.filter((r,R)=>R!==l)}:n))},q=()=>{if(!i){u("No active tab selected.");return}for(const[a,l]of y.entries()){if(!l.tabCommand.trim()){u(`Rule ${a+1}: tabCommand is required.`);return}if(i.commandId&&l.tabCommand!==i.commandId){u(`Rule ${a+1}: tabCommand must match the tab command ID (${i.commandId}).`);return}if(!f&&l.rules.some(s=>s.kind==="PageRule")){u(`Rule ${a+1}: PageRule is only valid for Application ribbon tabs.`);return}}u(null),M(g,z,y),h()};return e.jsxs(Y,{className:b.drawer,open:j,position:"end",onOpenChange:(a,l)=>!l.open&&h(),children:[e.jsx(J,{children:e.jsx(K,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(X,{}),onClick:h,"aria-label":"Close"}),children:e.jsx(Q,{children:"Tab Display Rules"})})}),e.jsx(Z,{children:e.jsxs("div",{className:b.body,children:[k&&e.jsx(H,{intent:"error",children:e.jsx(N,{children:k})}),e.jsx(H,{intent:"info",children:e.jsx(N,{children:e.jsxs(p,{size:200,children:["Tabs are ",e.jsx("strong",{children:"hidden by default"}),". Each Tab Display Rule defines when this tab is shown. The tabCommand must match the tab's Command ID."]})})}),i&&e.jsxs("div",{children:[e.jsxs(p,{size:200,style:{color:o.colorNeutralForeground3},children:["Tab: ",e.jsx("strong",{children:i.label})," (",i.id,")"]}),i.commandId&&e.jsxs(p,{size:200,style:{color:o.colorNeutralForeground3,display:"block"},children:["Command ID:"," ",e.jsx("code",{style:{fontFamily:o.fontFamilyMonospace},children:i.commandId})]})]}),y.length===0&&e.jsx(p,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"No display rules — this tab will be hidden."}),y.map((a,l)=>e.jsxs("div",{className:b.ruleRow,children:[e.jsxs("div",{className:b.ruleHeader,children:[e.jsxs(ee,{appearance:"outline",size:"small",children:["Rule ",l+1]}),e.jsx("div",{style:{flex:1}}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(T,{}),onClick:()=>G(l),"aria-label":"Remove rule"})]}),e.jsx(x,{label:"Tab command ID",hint:"Must match Tab.commandId",children:e.jsx(v,{value:a.tabCommand,onChange:(s,n)=>W(l,n.value),disabled:D,size:"small",style:{fontFamily:o.fontFamilyMonospace}})}),e.jsx(p,{size:100,weight:"semibold",style:{color:o.colorNeutralForeground3},children:"Steps"}),a.rules.map((s,n)=>e.jsxs("div",{className:b.stepFields,children:[e.jsx(x,{label:"Type",style:{minWidth:"140px"},children:e.jsxs(S,{size:"small",value:s.kind,onChange:(t,r)=>{r.value==="PageRule"?m(l,n,A()):m(l,n,C())},children:[e.jsx("option",{value:"EntityRule",children:"Entity Rule"}),f&&e.jsx("option",{value:"PageRule",children:"Page Rule"})]})}),s.kind==="EntityRule"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{label:"Applies to",style:{minWidth:"130px"},children:e.jsxs(S,{size:"small",value:s.appliesTo??"PrimaryEntity",onChange:(t,r)=>m(l,n,{...s,appliesTo:r.value}),children:[e.jsx("option",{value:"PrimaryEntity",children:"Primary entity"}),e.jsx("option",{value:"SelectedEntity",children:"Selected entity"})]})}),e.jsx(x,{label:"Context",style:{minWidth:"160px"},children:e.jsxs(S,{size:"small",value:s.context??"HomePageGrid",onChange:(t,r)=>m(l,n,{...s,context:r.value}),children:[e.jsx("option",{value:"Form",children:"Form"}),e.jsx("option",{value:"HomePageGrid",children:"Home Page Grid"}),e.jsx("option",{value:"SubGridStandard",children:"SubGrid Standard"}),e.jsx("option",{value:"SubGridAssociated",children:"SubGrid Associated"})]})}),e.jsx(x,{label:"Entity (optional)",children:e.jsx(v,{size:"small",value:s.entityName??"",onChange:(t,r)=>m(l,n,{...s,entityName:r.value||void 0}),placeholder:"any"})})]}),s.kind==="PageRule"&&e.jsx(x,{label:"Address pattern",style:{flex:1},children:e.jsx(v,{size:"small",value:s.address,onChange:(t,r)=>m(l,n,{...s,address:r.value}),placeholder:"https://…"})}),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(T,{}),onClick:()=>O(l,n),"aria-label":"Remove step"})]},n)),e.jsx(c,{appearance:"subtle",size:"small",icon:e.jsx(I,{}),onClick:()=>$(l),children:"Add step"}),e.jsx(p,{size:100,style:{color:o.colorNeutralForeground3},children:"Info: EntityRule is valid for entity-scoped tabs. Use PageRule only for globally-scoped application ribbon tabs."})]},l)),e.jsx(c,{appearance:"subtle",icon:e.jsx(I,{}),onClick:_,children:"Add display rule"}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:o.spacingHorizontalS,paddingTop:o.spacingHorizontalS},children:[e.jsx(c,{appearance:"secondary",onClick:h,children:"Cancel"}),e.jsx(c,{appearance:"primary",onClick:q,children:"Save rules"})]})]})})]})};export{re as TabDisplayRulesPanel,re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e,h as D,co as M,cq as L,y as $}from"./fluent-icons-
|
|
1
|
+
import{z as e,h as D,co as M,cq as L,y as $}from"./fluent-icons-4bzebHz-.js";import{a as n,R as A}from"./monaco-BoSoLy50.js";import{a as k}from"./index-B2t4gwW0.js";import{D as F,h as I,j as _,i as T,aa as X,B as c,k as H,F as u,I as j,a1 as O,T as i,t as l,S as V,l as E}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.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://"),[p,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 p&&f.forEach(s=>{a.push(`${s.key}={${s.key}}`)}),a.length>0?`${t}?${a.join("&")}`:t},[t,p,h]),U=n.useMemo(()=>x.replace(/&/g,"&"),[x]),N=()=>{g(a=>[...a,{key:"",value:""}])},P=a=>{g(s=>s.filter((m,o)=>o!==a))},v=(a,s,m)=>{g(o=>o.map((b,B)=>B===a?{...b,[s]:m}:b))},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(T,{action:e.jsx(c,{appearance:"subtle",icon:e.jsx(D,{}),onClick:d,"aria-label":"Close"}),children:e.jsx(X,{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:p,onChange:(a,s)=>C(s.checked)}),p&&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:(m,o)=>v(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:(m,o)=>v(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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as s,h as ee,E as se,bc as le,y as ae,bo as B,cs as j,N as S}from"./fluent-icons-
|
|
1
|
+
import{z as s,h as ee,E as se,bc as le,y as ae,bo as B,cs as j,N as S}from"./fluent-icons-4bzebHz-.js";import{a as n}from"./monaco-BoSoLy50.js";import{a as T,b as oe,ac as re,ad as ne,ae as $,af as te,w as N}from"./index-B2t4gwW0.js";import{l as L,s as ie}from"./webResourceService-DGt6sRPR.js";import{a0 as z,D as ce,h as de,j as ue,i as ge,aa as xe,B as b,k as he,I as pe,S as me,am as fe,M as U,e as _,T as i,t as a,a2 as je,a3 as Se,l as be}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const ye=ae({surface:{width:"780px",maxWidth:"95vw",height:"80vh",maxHeight:"80vh"},body:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",gap:a.spacingHorizontalS},toolbar:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,flexShrink:0},grid:{flex:1,overflow:"hidden"},gridWrap:{height:"100%"},gridRow:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,padding:`${a.spacingVerticalXS} ${a.spacingHorizontalS}`,cursor:"pointer",borderRadius:a.borderRadiusMedium,":hover":{backgroundColor:a.colorNeutralBackground3}},gridRowSelected:{backgroundColor:a.colorBrandBackground2},gridHeader:{display:"flex",alignItems:"center",gap:a.spacingHorizontalS,padding:`${a.spacingVerticalXS} ${a.spacingHorizontalS}`,borderBottom:`1px solid ${a.colorNeutralStroke2}`,flexShrink:0},col1:{width:"24px",flexShrink:0},col2:{width:"32px",flexShrink:0},col3:{flex:1,overflow:"hidden"},col4:{width:"60px",flexShrink:0,textAlign:"right"},col5:{width:"100px",flexShrink:0,color:a.colorNeutralForeground3},nameCell:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},descCell:{fontSize:a.fontSizeBase100,color:a.colorNeutralForeground3,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),we={js:s.jsx(S,{}),ts:s.jsx(S,{}),css:s.jsx(S,{}),html:s.jsx(S,{}),svg:s.jsx(j,{}),png:s.jsx(j,{}),gif:s.jsx(j,{}),jpg:s.jsx(j,{}),xml:s.jsx(B,{}),resx:s.jsx(B,{})};function y(x){return x.split(".").pop()?.toLowerCase()??""}const ve=[{label:"All types",value:"all"},{label:".js",value:"js"},{label:".html",value:"html"},{label:".svg",value:"svg"},{label:".png",value:"png"},{label:".css",value:"css"},{label:".xml",value:"xml"},{label:".resx",value:"resx"}],De=({onSelect:x})=>{const o=ye(),w=T(e=>e.webResourceBrowserOpen),u=T(e=>e.closeWebResourceBrowser),P=oe(e=>e.publisherPrefix),D=n.useRef(null),[I,F]=n.useState([]),[v,h]=n.useState(!1),[H,W]=n.useState(!1),[M,g]=n.useState(null),[E,C]=n.useState(null),[R,A]=n.useState(""),[p,G]=n.useState("all"),[k,X]=n.useState(!0),[m,O]=n.useState(null),f=n.useMemo(()=>{const e=R.toLowerCase();return I.filter(l=>{const r=y(l.name),t=e===""||l.name.toLowerCase().includes(e)||(l.description??"").toLowerCase().includes(e),c=p==="all"||r===p,Z=!k||l.isCustom;return t&&c&&Z})},[I,R,p,k]),d=f.find(e=>e.id===m)??null,V=[z({columnId:"type",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Type"}),renderCell:e=>{const l=y(e.name),r=we[l]??s.jsx(B,{});return s.jsx("div",{className:o.col2,style:{color:a.colorNeutralForeground3},children:r})}}),z({columnId:"name",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Name"}),renderCell:e=>s.jsxs("div",{className:o.col3,children:[s.jsx("div",{className:o.nameCell,children:s.jsx(i,{style:{fontFamily:a.fontFamilyMonospace,fontSize:a.fontSizeBase200},children:e.name})}),e.description&&s.jsx("div",{className:o.descCell,children:e.description})]})}),z({columnId:"modified",renderHeaderCell:()=>s.jsx(i,{size:100,style:{color:a.colorNeutralForeground3},children:"Modified"}),renderCell:e=>s.jsx("div",{className:o.col5,children:s.jsx(i,{size:100,children:e.modifiedOn?new Date(e.modifiedOn).toLocaleDateString():"—"})})})];n.useEffect(()=>{w&&(h(!0),g(null),C(null),L().then(e=>F(e)).catch(e=>g(e instanceof Error?e.message:String(e))).finally(()=>h(!1)))},[w]);const Y=async()=>{h(!0),g(null);try{F(await L())}catch(e){g(e instanceof Error?e.message:String(e))}finally{h(!1)}},q=e=>new Promise((l,r)=>{const t=new FileReader;t.onerror=()=>r(t.error??new Error("Unable to read file")),t.onload=()=>{const c=String(t.result??"");l(c.includes(",")?c.split(",")[1]??"":c)},t.readAsDataURL(e)}),J=e=>{const l=y(e.name);return`${P||"new"}_/${l==="js"||l==="css"||l==="html"||l==="xml"?"scripts":l==="svg"||l==="png"?"icons":"webresources"}/${e.name}`},K=async e=>{W(!0),C(null);try{const l=await q(e),r=y(e.name),t={html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[r]??4,c=await ie(J(e),l,t,{displayName:e.name});await Y(),C(c.solutionWarning??null)}catch(l){g(l instanceof Error?l.message:String(l))}finally{W(!1)}},Q=()=>{d&&(N.invoke(d),x?.(d),u())};return s.jsx(ce,{open:w,onOpenChange:(e,l)=>{l.open||(N.clear(),u())},children:s.jsx(de,{className:o.surface,children:s.jsxs(ue,{style:{height:"100%"},children:[s.jsx(ge,{action:s.jsx(b,{appearance:"subtle",icon:s.jsx(ee,{}),onClick:u,"aria-label":"Close"}),children:s.jsx(xe,{children:"Web Resource Browser"})}),s.jsxs(he,{className:o.body,children:[s.jsx("input",{ref:D,type:"file",accept:".js,.html,.svg,.png,.css,.xml,.resx,.jpg,.gif,.ico,.xsl",style:{display:"none"},onChange:e=>{const l=e.target.files?.[0];e.currentTarget.value="",l&&K(l)}}),s.jsxs("div",{className:o.toolbar,children:[s.jsx(pe,{contentBefore:s.jsx(se,{}),placeholder:"Search by name…",value:R,onChange:(e,l)=>A(l.value),size:"small",style:{flex:1}}),s.jsx(me,{size:"small",value:p,onChange:(e,l)=>G(l.value),style:{width:"100px"},children:ve.map(e=>s.jsx("option",{value:e.value,children:e.label},e.value))}),s.jsx(fe,{label:"Custom only",checked:k,onChange:(e,l)=>X(l.checked===!0)})]}),M&&s.jsx(U,{intent:"error",children:s.jsx(_,{children:M})}),E&&s.jsx(U,{intent:"warning",children:s.jsx(_,{children:E})}),s.jsxs("div",{className:o.grid,children:[v&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM},children:"Loading web resources…"}),!v&&f.length===0&&s.jsx(i,{style:{color:a.colorNeutralForeground3,padding:a.spacingHorizontalM,textAlign:"center"},children:"No web resources found."}),!v&&f.length>0&&s.jsxs(re,{className:o.gridWrap,items:f,columns:V,getRowId:e=>e.id,focusMode:"composite",selectionMode:"single",subtleSelection:!0,selectedItems:m?new Set([m]):new Set,onSelectionChange:(e,l)=>{const r=[...l.selectedItems][0];O(r??null)},children:[s.jsx(ne,{children:s.jsx($,{children:({renderHeaderCell:e})=>s.jsx(je,{children:e()})})}),s.jsx(te,{itemSize:56,height:360,listProps:{width:"100%"},children:({item:e,rowId:l},r)=>s.jsx($,{style:r,className:`${o.gridRow} ${e.id===m?o.gridRowSelected:""}`,onDoubleClick:()=>{O(e.id),N.invoke(e),x?.(e),u()},children:({renderCell:t})=>s.jsx(Se,{children:t(e)})},l)})]})]}),d&&s.jsx("div",{style:{padding:a.spacingHorizontalXS,backgroundColor:a.colorNeutralBackground3,borderRadius:a.borderRadiusMedium,flexShrink:0},children:s.jsxs(i,{size:200,style:{fontFamily:a.fontFamilyMonospace},children:["$webresource:",d.name]})})]}),s.jsxs(be,{children:[s.jsx(b,{appearance:"subtle",icon:s.jsx(le,{}),disabled:H,onClick:()=>D.current?.click(),children:H?"Uploading…":"Upload"}),s.jsx("div",{style:{flex:1}}),s.jsx(b,{appearance:"secondary",onClick:u,children:"Cancel"}),s.jsx(b,{appearance:"primary",disabled:!d,onClick:Q,children:"Select"})]})]})})})};export{De as WebResourceBrowser,De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{z as r,Z as A,h as $,cj as E,be as B,cA as X,bc as O,y as P}from"./fluent-icons-
|
|
1
|
+
import{z as r,Z as A,h as $,cj as E,be as B,cA as X,bc as O,y as P}from"./fluent-icons-4bzebHz-.js";import{a as m}from"./monaco-BoSoLy50.js";import{u as p,a as k,g as F}from"./index-B2t4gwW0.js";import{l as H}from"./webResourceService-DGt6sRPR.js";import{M as U}from"./MonacoEditor-DakCq511.js";import{ah as V,ai as z,aj as G,t as d,B as W,ak as _,M as K,e as Z,ac as Q,ad as q,al as N}from"./fluent-ui-lAhdF0Ck.js";import"./dnd-vmvAsOrM.js";const J=["Add","AddCircle","Alert","AppFolder","Archive","ArrowClockwise","ArrowCounterclockwise","ArrowDown","ArrowExport","ArrowImport","ArrowLeft","ArrowRight","ArrowSync","ArrowUp","Attach","Beaker","Bookmark","Bug","Building","Calculator","CalendarLtr","CalendarMonth","Call","Camera","Cart","Chart","Checkmark","CheckmarkCircle","Circle","ClipboardTask","Clock","Cloud","Code","CodeBlock","Comment","ContactCard","Copy","CreditCard","Crown","Cube","CursorClick","DataBarVertical","Delete","Diamond","Document","DocumentCopy","DocumentEdit","DocumentText","Download","Edit","Emoji","ErrorCircle","Eye","EyeOff","Filter","Flag","Flow","FolderOpen","Globe","Grid","Group","Heart","Home","Image","Info","Key","Library","Link","List","Location","Lock","Mail","Map","MegaphoneLoud","Money","MoreCircle","MoreHorizontal","Note","NoteEdit","NumberCircle1","Open","Organization","Pause","People","PeopleCommunity","Person","PersonAdd","PersonSearch","Phone","Play","Plug","Print","Question","Refresh","Rename","Save","Search","Send","Settings","Share","Shield","ShoppingBag","Sparkle","Star","StarEmphasis","Stop","Table","Tag","TaskList","TextBulletList","TextDescription","ThumbLike","Timer","ToggleLeft","ToggleRight","Tool","Translate","Umbrella","Unlock","Upload","Video","Warning","Wrench"];function I(t,C){const g=[];return g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!o.includes("$LocLabels:"))return{suggestions:[]};const b=o.lastIndexOf("$LocLabels:")+11,s=o.slice(b),i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:p.getState().locLabels.map(u=>({label:u.id,kind:t.languages.CompletionItemKind.Reference,insertText:u.id,range:i,detail:"LocLabel reference"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:[":","$"],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!o.includes("$webresource:"))return{suggestions:[]};const b=o.lastIndexOf("$webresource:")+13,s=o.slice(b),i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:C().map(u=>({label:u,kind:t.languages.CompletionItemKind.File,insertText:u,range:i,detail:"Web resource"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/Command\s*=\s*"[^"]*$/.test(o))return{suggestions:[]};const s=o.match(/Command\s*=\s*"([^"]*)$/)?.[1]??"",i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:p.getState().commands.map(u=>({label:u.id,kind:t.languages.CompletionItemKind.Function,insertText:u.id,range:i,detail:"CommandDefinition"}))}}})),g.push(t.languages.registerCompletionItemProvider("xml",{triggerCharacters:['"'],provideCompletionItems(l,e){const o=l.getValueInRange({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:e.column});if(!/ModernImage\s*=\s*"[^"]*$/.test(o))return{suggestions:[]};const s=o.match(/ModernImage\s*=\s*"([^"]*)$/)?.[1]??"",i={startLineNumber:e.lineNumber,startColumn:e.column-s.length,endLineNumber:e.lineNumber,endColumn:e.column};return{suggestions:J.map(c=>({label:c,kind:t.languages.CompletionItemKind.Color,insertText:c,range:i,detail:"Fluent icon (ModernImage)",documentation:`Renders the ${c}_20_Regular Fluent icon`}))}}})),g}function S(t){t.forEach(C=>C.dispose())}const Y=P({drawer:{width:"960px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",padding:0},infoBar:{flexShrink:0,margin:`${d.spacingVerticalS} ${d.spacingHorizontalM}`},tabRow:{flexShrink:0,padding:`0 ${d.spacingHorizontalM}`},toolbar:{flexShrink:0,display:"flex",alignItems:"center",gap:d.spacingHorizontalS,padding:`${d.spacingVerticalXS} ${d.spacingHorizontalM}`,borderTop:`1px solid ${d.colorNeutralStroke2}`,borderBottom:`1px solid ${d.colorNeutralStroke2}`},editorContainer:{flex:1,minHeight:0,overflow:"hidden"}}),ee=[{label:"Home Grid",value:"HomepageGrid"},{label:"Sub Grid",value:"SubGrid"},{label:"Form",value:"Form"},{label:"Application",value:"Application"}],ce=()=>{const t=Y(),C=k(n=>n.xmlDrawerOpen),g=k(n=>n.closeXmlDrawer),l=p(n=>n.ribbons),e=p(n=>n.baseline),o=p(n=>n.commands),b=p(n=>n.displayRules),s=p(n=>n.enableRules),i=p(n=>n.locLabels),f=k(n=>n.openImportXml),[c,u]=m.useState("HomepageGrid"),[x,y]=m.useState([]),v=m.useRef(null),w=m.useRef(null),h=m.useRef([]);m.useEffect(()=>{C&&H().then(n=>y(n.map(a=>a.name))).catch(()=>y([]))},[C]),m.useEffect(()=>()=>{S(h.current),h.current=[]},[]);const D=m.useCallback((n,a)=>{v.current=n,w.current=a,S(h.current),h.current=I(a,()=>x)},[x]);m.useEffect(()=>{w.current&&(S(h.current),h.current=I(w.current,()=>x))},[x]);const T=()=>{v.current?.getAction("editor.action.formatDocument")?.run()},L=m.useCallback(n=>{try{return`<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
${F({location:n,current:l[n],baseline:e[n],commands:o,displayRules:b,enableRules:s,locLabels:i,entityLogicalName:l[n].entityLogicalName})}`}catch(a){return`<!-- Error generating XML: ${String(a)} -->`}},[l,e,o,b,s,i])(c),j=()=>{navigator.clipboard.writeText(L)},M=()=>{const n=new Blob([L],{type:"application/xml"}),a=URL.createObjectURL(n),R=document.createElement("a");R.href=a,R.download=`RibbonDiffXml_${c}.xml`,R.click(),URL.revokeObjectURL(a)};return r.jsxs(V,{position:"end",open:C,onOpenChange:()=>g(),className:t.drawer,children:[r.jsx(z,{children:r.jsxs(G,{action:r.jsx(W,{appearance:"subtle",icon:r.jsx($,{}),onClick:g,"aria-label":"Close XML drawer"}),children:[r.jsx(A,{style:{marginRight:d.spacingHorizontalS}}),"RibbonDiffXml"]})}),r.jsxs(_,{className:t.body,children:[r.jsx(K,{className:t.infoBar,intent:"info",children:r.jsxs(Z,{children:["This is the ",r.jsx("strong",{children:"RibbonDiffXml"})," that will be packaged into your solution ZIP and imported into Dataverse. It contains only the delta (your changes), not the full ribbon."]})}),r.jsx("div",{className:t.tabRow,children:r.jsx(Q,{selectedValue:c,onTabSelect:(n,a)=>u(a.value),children:ee.map(n=>r.jsx(q,{value:n.value,children:n.label},n.value))})}),r.jsxs("div",{className:t.toolbar,children:[r.jsx(N,{icon:r.jsx(E,{}),onClick:j,children:"Copy"}),r.jsx(N,{icon:r.jsx(B,{}),onClick:M,children:"Download"}),r.jsx(N,{icon:r.jsx(X,{}),onClick:T,children:"Format XML"}),r.jsx(N,{icon:r.jsx(O,{}),onClick:()=>f(L),children:"Import this XML"})]}),r.jsx("div",{className:t.editorContainer,children:r.jsx(U,{language:"xml",value:L,readOnly:!0,height:"100%",onMount:D})})]})]})};export{ce as XmlDrawer,ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as h,d as s}from"./monaco-
|
|
1
|
+
import{c as h,d as s}from"./monaco-BoSoLy50.js";import{C as c,H as u,D as p,a as m,R as f,b as _,c as w,d as k,F as v,e as D,S as P,f as R,g as I}from"./lspLanguageFeatures-CbQqhnvj.js";import{h as b,i as H,j as U,t as y,k as T}from"./lspLanguageFeatures-CbQqhnvj.js";const C=120*1e3;class A{constructor(n){this._defaults=n,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>C&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=h({moduleId:"vs/language/css/cssWorker",createWorker:()=>new Worker(new URL(""+new URL("css.worker-DBVD8oXr.js",import.meta.url).href,import.meta.url),{type:"module"}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...n){let e;return this._getClient().then(a=>{e=a}).then(a=>{if(this._worker)return this._worker.withSyncedResources(n)}).then(a=>e)}}function F(o){const n=[],e=[],a=new A(o);n.push(a);const r=(...t)=>a.getLanguageServiceWorker(...t);function l(){const{languageId:t,modeConfiguration:i}=o;g(e),i.completionItems&&e.push(s.registerCompletionItemProvider(t,new c(r,["/","-",":"]))),i.hovers&&e.push(s.registerHoverProvider(t,new u(r))),i.documentHighlights&&e.push(s.registerDocumentHighlightProvider(t,new p(r))),i.definitions&&e.push(s.registerDefinitionProvider(t,new m(r))),i.references&&e.push(s.registerReferenceProvider(t,new f(r))),i.documentSymbols&&e.push(s.registerDocumentSymbolProvider(t,new _(r))),i.rename&&e.push(s.registerRenameProvider(t,new w(r))),i.colors&&e.push(s.registerColorProvider(t,new k(r))),i.foldingRanges&&e.push(s.registerFoldingRangeProvider(t,new v(r))),i.diagnostics&&e.push(new D(t,r,o.onDidChange)),i.selectionRanges&&e.push(s.registerSelectionRangeProvider(t,new P(r))),i.documentFormattingEdits&&e.push(s.registerDocumentFormattingEditProvider(t,new R(r))),i.documentRangeFormattingEdits&&e.push(s.registerDocumentRangeFormattingEditProvider(t,new I(r)))}return l(),n.push(d(e)),d(n)}function d(o){return{dispose:()=>g(o)}}function g(o){for(;o.length;)o.pop().dispose()}export{c as CompletionAdapter,m as DefinitionAdapter,D as DiagnosticsAdapter,k as DocumentColorAdapter,R as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,b as DocumentLinkAdapter,I as DocumentRangeFormattingEditProvider,_ as DocumentSymbolAdapter,v as FoldingRangeAdapter,u as HoverAdapter,f as ReferenceAdapter,w as RenameAdapter,P as SelectionRangeAdapter,A as WorkerManager,H as fromPosition,U as fromRange,F as setupMode,y as toRange,T as toTextEdit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as l,R as O}from"./monaco-
|
|
1
|
+
import{a as l,R as O}from"./monaco-BoSoLy50.js";import{r as Ne}from"./fluent-ui-lAhdF0Ck.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.
|