@mohsinonxrm/pptb-commandbar-studio 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/assets/{BulkPublishModal-_JCQ9G-Z.js → BulkPublishModal-DlglMah4.js} +1 -1
  2. package/dist/assets/{CommandEditorPanel-BfdeUs_f.js → CommandEditorPanel-4pYnil3i.js} +1 -1
  3. package/dist/assets/{CommandPalette-D2Kh5NZ1.js → CommandPalette-iYxzI2G_.js} +1 -1
  4. package/dist/assets/{ConflictDrawer-BLiuWHeb.js → ConflictDrawer-DBPRRkoa.js} +1 -1
  5. package/dist/assets/{DiffViewer-BVDCd534.js → DiffViewer-DFBJPZKA.js} +1 -1
  6. package/dist/assets/{IconPickerModal-BAiIRU4A.js → IconPickerModal-Bg0Zc8UZ.js} +1 -1
  7. package/dist/assets/{ImportXmlModal-D-Ns-mYi.js → ImportXmlModal-BccMoaDv.js} +1 -1
  8. package/dist/assets/{LocalizationEditor-C-TZ2Vqd.js → LocalizationEditor-DVZy2uLy.js} +1 -1
  9. package/dist/assets/{MonacoEditor-5dvTziHE.js → MonacoEditor-DFYisBG6.js} +1 -1
  10. package/dist/assets/{NewButtonModal-DOTUaBiJ.js → NewButtonModal-D5Hz1yx4.js} +1 -1
  11. package/dist/assets/{NewGroupModal-CXy9X9y5.js → NewGroupModal-BgTVG-VJ.js} +1 -1
  12. package/dist/assets/{NewTabModal-DiGzXYTp.js → NewTabModal-7-ZPcPi-.js} +1 -1
  13. package/dist/assets/{RuleEditorPanel-DT_uPW8s.js → RuleEditorPanel-BwQzOQBe.js} +1 -1
  14. package/dist/assets/{ScalingEditorPanel-BFnC7t_K.js → ScalingEditorPanel-B221zNLL.js} +1 -1
  15. package/dist/assets/{TabDisplayRulesPanel-CdKjedy-.js → TabDisplayRulesPanel-drKzEO_E.js} +1 -1
  16. package/dist/assets/{UrlComposerModal-DFtXdVW3.js → UrlComposerModal-Bnifp4oB.js} +1 -1
  17. package/dist/assets/{WebResourceBrowser-FvaNo4rt.js → WebResourceBrowser-qtcNTNge.js} +1 -1
  18. package/dist/assets/{XmlDrawer-BXAxH3A8.js → XmlDrawer-CN941TbU.js} +1 -1
  19. package/dist/assets/editor.worker-CdQrwHl8.js +26 -0
  20. package/dist/assets/index-DjHxPFpB.js +6 -0
  21. package/dist/index.html +1 -1
  22. package/dist/stats.html +1 -1
  23. package/npm-shrinkwrap.json +3 -2
  24. package/package.json +20 -2
  25. package/dist/assets/index-G361fmC5.js +0 -6
@@ -1,4 +1,4 @@
1
- import{cw as i,cx as Pe}from"./fluent-icons-DiKr_qRE.js";import{r as S,b as pe}from"./monaco-BLZnQb2P.js";import{d as _,h as X,z as je,s as ee,i as se,u as I}from"./index-G361fmC5.js";import{g as Ce,w as $e,e as $,s as me}from"./xmlGenerator-DEaVrfZJ.js";import{d as ve,h as Ie,i as Re,f as ke,g as Le,u as q,w as O,a1 as N,Q as ie,a as T,C as oe,F as te,n as ze,O as be,I as Xe,J as De,R as Ee,B as Me,A as Te,e as Ue}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const x=window.dataverseAPI;function de(e){const t=e.data?.progress;return!!(typeof t=="object"&&t!==null&&t.completed===!0||typeof e.progress=="number"&&e.progress>=100||typeof t=="number"&&t>=100||e.completedon||e.data?.completedon||e.statuscode===30)}async function he(e,t){const n=_.getState();t?.("Generating RibbonDiffXml…"),n.logInfo("publish",`Generating RibbonDiffXml for ${e.entityLogicalName}.`);const b=Ce({current:e.current,baseline:e.baseline,commands:e.commands,enableRules:e.enableRules,displayRules:e.displayRules,locLabels:e.locLabels,entityLogicalName:e.entityLogicalName,location:e.current.location}),h=X.getState().formRibbonScope,m=X.getState().selectedFormId,c=e.current.location==="Application"?"application":e.current.location==="Form"&&h==="form"?"form":"entity",R=$e(b,e.entityLogicalName,c,c==="form"?m:void 0),g=[];if(c==="entity"&&e.entityLogicalName?g.push({type:1,schemaName:e.entityLogicalName,behavior:2}):c==="form"&&e.entityLogicalName&&m&&(g.push({type:1,schemaName:e.entityLogicalName,behavior:2}),g.push({type:60,id:m,behavior:0})),c==="application"&&e.ribbonCustomizationIds?.length)for(const p of e.ribbonCustomizationIds)g.push({type:50,id:p,behavior:0});const w=Fe({uniqueName:e.solutionUniqueName,publisherUniqueName:e.publisherUniqueName,publisherName:e.publisherName,publisherPrefix:e.publisherPrefix,version:e.solutionVersion,rootComponents:g});t?.("Packaging solution ZIP…"),n.logInfo("publish","Packaging solution ZIP...");const l=je({"customizations.xml":ee(R),"solution.xml":ee(w),"[Content_Types].xml":ee('<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml"/></Types>')});let P="";for(let p=0;p<l.length;p++)P+=String.fromCharCode(l[p]);const a=btoa(P);t?.("Importing solution…"),n.logInfo("publish","Importing solution via deploySolution...");const u=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`;n.logInfo("publish",`Import job id: ${u}`),await x.deploySolution(a,{importJobId:u,overwriteUnmanagedCustomizations:!0,publishWorkflows:!1}),t?.("Waiting for import to complete…"),n.logInfo("publish",`Polling import job ${u}...`);const f=150,j=2e3;let k=await x.getImportJobStatus(u),v=0;for(;!de(k)&&v<f;)await new Promise(p=>setTimeout(p,j)),k=await x.getImportJobStatus(u),v++,v%15===0&&t?.(`Still importing… (${v*2}s elapsed)`);if(!de(k)){const p=Math.round(f*j/1e3);throw n.logError("publish",`Solution import did not complete within ${p}s. Check Solutions › History in maker.powerapps.com for job ${u} — the import may still succeed there.`),new Error(`Solution import did not signal completion within ${p} seconds. Check Solutions › History for job ${u}.`)}if(e.publishCustomizations!==!1){t?.("Publishing customizations…"),n.logInfo("publish","Publishing customizations...");const p=new Date;e.entityLogicalName&&e.entityLogicalName!=="{!EntityLogicalName}"?await x.publishCustomizations(e.entityLogicalName):await x.publishCustomizations(),await Ve(e.entityLogicalName,p,n,t)}t?.("Published successfully!"),n.logInfo("publish","Publish completed successfully.")}async function Ve(e,t,n,b){const c=e&&e!=="{!EntityLogicalName}"?`entityname eq '${e}'`:null,g=`ribbonmetadatasettoprocess?$select=entityname,processedon,completedon,exceptionmessage,retrycount,status&$orderby=createdon desc&$top=10&$filter=createdon gt ${t.toISOString().replace(/\.\d+Z$/,"Z")}`+(c?` and (${c})`:"");for(let w=0;w<15;w++){await new Promise(l=>setTimeout(l,2e3));try{const l=await x.queryData(g),P=Array.isArray(l)?l:Array.isArray(l?.value)?l.value:[];if(P.length===0)continue;const a=P.find(f=>f.exceptionmessage);if(a){const j=`Ribbon-metadata compile failed for ${a.entityname||e}: `+a.exceptionmessage;throw n.logError("publish",j),b?.(`⚠ ${j}`),new Error(j)}const u=P.find(f=>f.completedon||f.processedon||f.status===4);if(u){const f=u.entityname||e;n.logInfo("publish",`Ribbon metadata compiled successfully for ${f}.`);return}w===Math.floor(15/2)&&(b?.("Waiting for ribbon-metadata compilation…"),n.logInfo("publish","Ribbon metadata job found; waiting for completion…"))}catch(l){if(l instanceof Error&&l.message.includes("Ribbon-metadata compile failed"))throw l;n.logWarn("publish",`Could not read ribbonmetadatasettoprocess (${l instanceof Error?l.message:String(l)}). Ribbon metadata verification skipped.`);return}}n.logInfo("publish","Ribbon metadata job not observed within 30 s. The publish appears complete — open the entity to confirm your changes are live.")}function qe(e){const t=e.entityLogicalNames.map(b=>`<entity>${$(b)}</entity>`).join(""),n=e.publishDependencies?"<nodes/><securityroles/><settings/><workflows/><templates/><plugins/><sdkmessageprocessingsteps/><serviceendpoints/><webresources/>":"<nodes/>";return`<importexportxml><entities>${t}</entities>${n}</importexportxml>`}async function Oe(e,t){const n=_.getState(),b=e.entityLogicalNames.filter(Boolean);if(b.length===0){e.includeApplicationRibbon&&(t?.("Publishing all customizations..."),await x.publishCustomizations());return}const h=qe({entityLogicalNames:b,publishDependencies:e.publishDependencies});t?.("Publishing selected components with PublishXml..."),n.logInfo("publish",`PublishXml request for ${b.length} table(s).`);try{await x.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:h}}),e.includeApplicationRibbon&&(t?.("Publishing application ribbon..."),await x.publishCustomizations()),n.logInfo("publish","PublishXml completed successfully.")}catch(m){n.logWarn("publish",`PublishXml failed, falling back to publishCustomizations(): ${m instanceof Error?m.message:String(m)}`);for(const c of b)t?.(`Fallback publish for ${c}...`),await x.publishCustomizations(c);e.includeApplicationRibbon&&(t?.("Fallback publish for application ribbon..."),await x.publishCustomizations())}}async function Be(e,t){const n=_.getState(),b=2e3,h=600*1e3;e?.("Starting asynchronous publish (PublishAllXmlAsync)..."),n.logInfo("publish","Calling PublishAllXmlAsync action.");const c=(await x.execute({operationName:"PublishAllXmlAsync",operationType:"action"}))?.AsyncOperationId;if(!c)throw new Error("PublishAllXmlAsync did not return AsyncOperationId.");n.logInfo("publish",`PublishAllXmlAsync job id: ${c}`),e?.("Async publish job started. Waiting for completion...");const R=Date.now();let g=0,w;for(;Date.now()-R<h;){g+=1;const l=await x.retrieve("asyncoperation",c,["asyncoperationid","statecode","statuscode","name","message","friendlymessage","completedon"]);if(w=l.statuscode,l.statecode===3||!!l.completedon){if(typeof l.statuscode=="number"&&l.statuscode!==30){const a=l.friendlymessage||l.message||`statuscode=${l.statuscode}`;throw new Error(`Asynchronous publish failed: ${a}`)}return e?.("Asynchronous publish completed successfully."),n.logInfo("publish",`PublishAllXmlAsync completed in ${g} poll(s).`),{asyncOperationId:c,statusCode:l.statuscode}}e?.(`Waiting for async publish job... (poll ${g})`),await new Promise(a=>setTimeout(a,b))}throw new Error(`Asynchronous publish timed out after ${Math.round(h/1e3)} seconds (last status: ${w??"unknown"}).`)}function Fe(e){const t=e.publisherUniqueName?.trim()||"DefaultPublisher",n=e.publisherName?.trim()||t,b=e.publisherPrefix?.trim()||"new",h=e.rootComponents.length===0?"<RootComponents/>":`<RootComponents>
1
+ import{cw as i,cx as Pe}from"./fluent-icons-DiKr_qRE.js";import{r as S,b as pe}from"./monaco-BLZnQb2P.js";import{d as _,h as X,z as je,s as ee,i as se,u as I}from"./index-DjHxPFpB.js";import{g as Ce,w as $e,e as $,s as me}from"./xmlGenerator-DEaVrfZJ.js";import{d as ve,h as Ie,i as Re,f as ke,g as Le,u as q,w as O,a1 as N,Q as ie,a as T,C as oe,F as te,n as ze,O as be,I as Xe,J as De,R as Ee,B as Me,A as Te,e as Ue}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const x=window.dataverseAPI;function de(e){const t=e.data?.progress;return!!(typeof t=="object"&&t!==null&&t.completed===!0||typeof e.progress=="number"&&e.progress>=100||typeof t=="number"&&t>=100||e.completedon||e.data?.completedon||e.statuscode===30)}async function he(e,t){const n=_.getState();t?.("Generating RibbonDiffXml…"),n.logInfo("publish",`Generating RibbonDiffXml for ${e.entityLogicalName}.`);const b=Ce({current:e.current,baseline:e.baseline,commands:e.commands,enableRules:e.enableRules,displayRules:e.displayRules,locLabels:e.locLabels,entityLogicalName:e.entityLogicalName,location:e.current.location}),h=X.getState().formRibbonScope,m=X.getState().selectedFormId,c=e.current.location==="Application"?"application":e.current.location==="Form"&&h==="form"?"form":"entity",R=$e(b,e.entityLogicalName,c,c==="form"?m:void 0),g=[];if(c==="entity"&&e.entityLogicalName?g.push({type:1,schemaName:e.entityLogicalName,behavior:2}):c==="form"&&e.entityLogicalName&&m&&(g.push({type:1,schemaName:e.entityLogicalName,behavior:2}),g.push({type:60,id:m,behavior:0})),c==="application"&&e.ribbonCustomizationIds?.length)for(const p of e.ribbonCustomizationIds)g.push({type:50,id:p,behavior:0});const w=Fe({uniqueName:e.solutionUniqueName,publisherUniqueName:e.publisherUniqueName,publisherName:e.publisherName,publisherPrefix:e.publisherPrefix,version:e.solutionVersion,rootComponents:g});t?.("Packaging solution ZIP…"),n.logInfo("publish","Packaging solution ZIP...");const l=je({"customizations.xml":ee(R),"solution.xml":ee(w),"[Content_Types].xml":ee('<?xml version="1.0" encoding="utf-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml"/></Types>')});let P="";for(let p=0;p<l.length;p++)P+=String.fromCharCode(l[p]);const a=btoa(P);t?.("Importing solution…"),n.logInfo("publish","Importing solution via deploySolution...");const u=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`;n.logInfo("publish",`Import job id: ${u}`),await x.deploySolution(a,{importJobId:u,overwriteUnmanagedCustomizations:!0,publishWorkflows:!1}),t?.("Waiting for import to complete…"),n.logInfo("publish",`Polling import job ${u}...`);const f=150,j=2e3;let k=await x.getImportJobStatus(u),v=0;for(;!de(k)&&v<f;)await new Promise(p=>setTimeout(p,j)),k=await x.getImportJobStatus(u),v++,v%15===0&&t?.(`Still importing… (${v*2}s elapsed)`);if(!de(k)){const p=Math.round(f*j/1e3);throw n.logError("publish",`Solution import did not complete within ${p}s. Check Solutions › History in maker.powerapps.com for job ${u} — the import may still succeed there.`),new Error(`Solution import did not signal completion within ${p} seconds. Check Solutions › History for job ${u}.`)}if(e.publishCustomizations!==!1){t?.("Publishing customizations…"),n.logInfo("publish","Publishing customizations...");const p=new Date;e.entityLogicalName&&e.entityLogicalName!=="{!EntityLogicalName}"?await x.publishCustomizations(e.entityLogicalName):await x.publishCustomizations(),await Ve(e.entityLogicalName,p,n,t)}t?.("Published successfully!"),n.logInfo("publish","Publish completed successfully.")}async function Ve(e,t,n,b){const c=e&&e!=="{!EntityLogicalName}"?`entityname eq '${e}'`:null,g=`ribbonmetadatasettoprocess?$select=entityname,processedon,completedon,exceptionmessage,retrycount,status&$orderby=createdon desc&$top=10&$filter=createdon gt ${t.toISOString().replace(/\.\d+Z$/,"Z")}`+(c?` and (${c})`:"");for(let w=0;w<15;w++){await new Promise(l=>setTimeout(l,2e3));try{const l=await x.queryData(g),P=Array.isArray(l)?l:Array.isArray(l?.value)?l.value:[];if(P.length===0)continue;const a=P.find(f=>f.exceptionmessage);if(a){const j=`Ribbon-metadata compile failed for ${a.entityname||e}: `+a.exceptionmessage;throw n.logError("publish",j),b?.(`⚠ ${j}`),new Error(j)}const u=P.find(f=>f.completedon||f.processedon||f.status===4);if(u){const f=u.entityname||e;n.logInfo("publish",`Ribbon metadata compiled successfully for ${f}.`);return}w===Math.floor(15/2)&&(b?.("Waiting for ribbon-metadata compilation…"),n.logInfo("publish","Ribbon metadata job found; waiting for completion…"))}catch(l){if(l instanceof Error&&l.message.includes("Ribbon-metadata compile failed"))throw l;n.logWarn("publish",`Could not read ribbonmetadatasettoprocess (${l instanceof Error?l.message:String(l)}). Ribbon metadata verification skipped.`);return}}n.logInfo("publish","Ribbon metadata job not observed within 30 s. The publish appears complete — open the entity to confirm your changes are live.")}function qe(e){const t=e.entityLogicalNames.map(b=>`<entity>${$(b)}</entity>`).join(""),n=e.publishDependencies?"<nodes/><securityroles/><settings/><workflows/><templates/><plugins/><sdkmessageprocessingsteps/><serviceendpoints/><webresources/>":"<nodes/>";return`<importexportxml><entities>${t}</entities>${n}</importexportxml>`}async function Oe(e,t){const n=_.getState(),b=e.entityLogicalNames.filter(Boolean);if(b.length===0){e.includeApplicationRibbon&&(t?.("Publishing all customizations..."),await x.publishCustomizations());return}const h=qe({entityLogicalNames:b,publishDependencies:e.publishDependencies});t?.("Publishing selected components with PublishXml..."),n.logInfo("publish",`PublishXml request for ${b.length} table(s).`);try{await x.execute({operationName:"PublishXml",operationType:"action",parameters:{ParameterXml:h}}),e.includeApplicationRibbon&&(t?.("Publishing application ribbon..."),await x.publishCustomizations()),n.logInfo("publish","PublishXml completed successfully.")}catch(m){n.logWarn("publish",`PublishXml failed, falling back to publishCustomizations(): ${m instanceof Error?m.message:String(m)}`);for(const c of b)t?.(`Fallback publish for ${c}...`),await x.publishCustomizations(c);e.includeApplicationRibbon&&(t?.("Fallback publish for application ribbon..."),await x.publishCustomizations())}}async function Be(e,t){const n=_.getState(),b=2e3,h=600*1e3;e?.("Starting asynchronous publish (PublishAllXmlAsync)..."),n.logInfo("publish","Calling PublishAllXmlAsync action.");const c=(await x.execute({operationName:"PublishAllXmlAsync",operationType:"action"}))?.AsyncOperationId;if(!c)throw new Error("PublishAllXmlAsync did not return AsyncOperationId.");n.logInfo("publish",`PublishAllXmlAsync job id: ${c}`),e?.("Async publish job started. Waiting for completion...");const R=Date.now();let g=0,w;for(;Date.now()-R<h;){g+=1;const l=await x.retrieve("asyncoperation",c,["asyncoperationid","statecode","statuscode","name","message","friendlymessage","completedon"]);if(w=l.statuscode,l.statecode===3||!!l.completedon){if(typeof l.statuscode=="number"&&l.statuscode!==30){const a=l.friendlymessage||l.message||`statuscode=${l.statuscode}`;throw new Error(`Asynchronous publish failed: ${a}`)}return e?.("Asynchronous publish completed successfully."),n.logInfo("publish",`PublishAllXmlAsync completed in ${g} poll(s).`),{asyncOperationId:c,statusCode:l.statuscode}}e?.(`Waiting for async publish job... (poll ${g})`),await new Promise(a=>setTimeout(a,b))}throw new Error(`Asynchronous publish timed out after ${Math.round(h/1e3)} seconds (last status: ${w??"unknown"}).`)}function Fe(e){const t=e.publisherUniqueName?.trim()||"DefaultPublisher",n=e.publisherName?.trim()||t,b=e.publisherPrefix?.trim()||"new",h=e.rootComponents.length===0?"<RootComponents/>":`<RootComponents>
2
2
  ${e.rootComponents.map(m=>{const c=[`type="${m.type}"`];return m.schemaName&&c.push(`schemaName="${$(m.schemaName)}"`),m.id&&c.push(`id="{${$(m.id)}}"`),c.push(`behavior="${m.behavior}"`),`<RootComponent ${c.join(" ")} />`}).join(`
3
3
  `)}
4
4
  </RootComponents>`;return`<?xml version="1.0" encoding="utf-8"?>
@@ -1 +1 @@
1
- import{cw as e,x as Ee,h as Me,aw as z,a as U,cx as xe}from"./fluent-icons-DiKr_qRE.js";import{r as j}from"./monaco-BLZnQb2P.js";import{i as B,u as R,w as De,g as Le}from"./index-G361fmC5.js";import{S as V,F as v,I as S,C as We,B as L,a as m,Q as x,a1 as l,x as $e,l as Te,m as _e,k as Ue,K as Ve,T as E,j as ee,u as M,w as D}from"./fluent-ui-kUA2U4Gr.js";import{M as pe}from"./MonacoEditor-5dvTziHE.js";import{l as He,a as Oe,s as Xe}from"./webResourceService-Ck07E3GN.js";import"./dnd-DHB99ZH7.js";const qe=xe({root:{display:"flex",flexDirection:"column",gap:l.spacingVerticalXS},param:{display:"flex",gap:l.spacingHorizontalS,alignItems:"flex-end",padding:l.spacingVerticalXS,border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium},typeSelect:{width:"140px",flexShrink:0},valueField:{flex:1},actions:{display:"flex",gap:l.spacingHorizontalXS,flexShrink:0},addButton:{alignSelf:"flex-start"},hint:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase100}}),Je=[{label:"Context",values:["PrimaryControl","PrimaryControlId","SelectedControl","CommandProperties"]},{label:"Record",values:["PrimaryEntityTypeCode","PrimaryEntityTypeName","FirstPrimaryItemId","PrimaryItemIds"]},{label:"Selection context",values:["SelectedEntityTypeCode","SelectedEntityTypeName","FirstSelectedItemId"]},{label:"Grid selection",values:["SelectedControlSelectedItemCount","SelectedControlSelectedItemIds","SelectedControlSelectedItemReferences","SelectedControlAllItemCount","SelectedControlAllItemIds","SelectedControlAllItemReferences","SelectedControlUnselectedItemCount","SelectedControlUnselectedItemIds","SelectedControlUnselectedItemReferences"]},{label:"Org/User",values:["OrgName","OrgLcid","UserLcid"]}],he=({params:n,onChange:F,urlMode:N=!1})=>{const y=qe(),C=(i,p)=>{const h=[...n];h[i]=p,F(h)},H=i=>{F(n.filter((p,h)=>h!==i))},O=(i,p)=>{const h=[...n],d=i+p;d<0||d>=h.length||([h[i],h[d]]=[h[d],h[i]],F(h))},W=()=>{F([...n,{kind:"CrmParameter",value:"PrimaryControl"}])};return e.jsxs("div",{className:y.root,children:[n.map((i,p)=>e.jsxs("div",{className:y.param,children:[e.jsx("div",{className:y.typeSelect,children:e.jsxs(V,{value:i.kind,onChange:(h,d)=>{const f=d.value;f==="CrmParameter"?C(p,{kind:f,value:"PrimaryControl"}):f==="BoolParameter"?C(p,{kind:f,value:!1}):f==="IntParameter"||f==="DecimalParameter"?C(p,{kind:f,value:0}):C(p,{kind:"StringParameter",value:""})},children:[e.jsx("option",{value:"CrmParameter",children:"CrmParameter"}),e.jsx("option",{value:"StringParameter",children:"String"}),e.jsx("option",{value:"BoolParameter",children:"Boolean"}),e.jsx("option",{value:"IntParameter",children:"Integer"}),e.jsx("option",{value:"DecimalParameter",children:"Decimal"})]})}),N&&e.jsx(v,{label:"Name (querystring key)",style:{width:"130px",flexShrink:0},children:e.jsx(S,{value:i.name??"",onChange:(h,d)=>C(p,{...i,name:d.value||void 0}),placeholder:"key"})}),e.jsx("div",{className:y.valueField,children:i.kind==="CrmParameter"?e.jsx(V,{value:i.value,onChange:(h,d)=>C(p,{...i,value:d.value}),children:Je.map(h=>h.values.map(d=>e.jsx("option",{value:d,children:d},d)))}):i.kind==="BoolParameter"?e.jsx(We,{checked:i.value,onChange:(h,d)=>C(p,{...i,value:d.checked}),label:"true"}):e.jsx(S,{type:i.kind==="StringParameter"?"text":"number",value:String(i.value),onChange:(h,d)=>{const f=i.kind==="StringParameter"?d.value:i.kind==="IntParameter"?parseInt(d.value):parseFloat(d.value);C(p,{...i,value:f})}})}),N&&i.kind==="CrmParameter"&&!i.name&&e.jsx(L,{appearance:"filled",color:"warning",size:"small",title:"Name required for URL actions"}),e.jsxs("div",{className:y.actions,children:[e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(Ee,{}),onClick:()=>O(p,-1),disabled:p===0,"aria-label":"Move up"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(Me,{}),onClick:()=>O(p,1),disabled:p===n.length-1,"aria-label":"Move down"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>H(p),"aria-label":"Remove parameter"})]})]},p)),N&&e.jsxs(x,{className:y.hint,children:["For URL actions, each CrmParameter must have a ",e.jsx("code",{children:"name"})," attribute (querystring key)."]}),e.jsx(m,{className:y.addButton,appearance:"secondary",size:"small",icon:e.jsx(U,{}),onClick:W,children:"Add parameter"})]})},Ge=xe({drawer:{width:"640px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:l.spacingVerticalS,padding:l.spacingVerticalM,overflowY:"auto"},actionCard:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalM,display:"flex",flexDirection:"column",gap:l.spacingVerticalS},actionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between"},row:{display:"flex",gap:l.spacingHorizontalS,alignItems:"flex-end"},ruleRow:{display:"inline-flex",alignItems:"center",gap:l.spacingHorizontalXS},ruleRemoveBtn:{minWidth:"20px",width:"20px",height:"20px"},ruleChip:{cursor:"pointer"},rulePills:{display:"flex",flexWrap:"wrap",gap:l.spacingHorizontalXS},versionsList:{display:"flex",flexDirection:"column",gap:l.spacingVerticalXS},versionRow:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalXS,display:"flex",justifyContent:"space-between",gap:l.spacingHorizontalS},versionMeta:{fontSize:l.fontSizeBase100,color:l.colorNeutralForeground3},securityNote:{fontSize:l.fontSizeBase100},codePanel:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalS,display:"flex",flexDirection:"column",gap:l.spacingVerticalS}}),ls=()=>{const n=Ge(),F=B(s=>s.commandEditorOpen),N=B(s=>s.commandEditorId),y=B(s=>s.closeCommandEditor),C=B(s=>s.openCommandEditor),H=B(s=>s.openRuleEditor),O=B(s=>s.openWebResourceBrowser),W=R(s=>s.commands),i=R(s=>s.upsertCommand),p=R(s=>s.renameCommandId),h=R(s=>s.ribbons),d=R(s=>s.displayRules),f=R(s=>s.enableRules),be=R(s=>s.past),je=R(s=>s.upsertEnableRule),ve=R(s=>s.upsertDisplayRule),[P,fe]=j.useState("actions"),[w,se]=j.useState(""),[ge,ae]=j.useState(""),[ye,le]=j.useState(""),[ne,Q]=j.useState(null),[X,re]=j.useState(!1),[ie,q]=j.useState(!1),[Y,I]=j.useState(null),[te,$]=j.useState(""),[Ce,J]=j.useState(!1),[A,oe]=j.useState(null),t=W.find(s=>s.id===N),we=s=>{const a=s.trim();return a.startsWith("$webresource:")?a.slice(13).trim():a},Re=s=>{if(!s)return"";const a=Uint8Array.from(atob(s),u=>u.charCodeAt(0));return new TextDecoder().decode(a)},Se=s=>{const a=new TextEncoder().encode(s);let u="";for(let r=0;r<a.length;r+=1)u+=String.fromCharCode(a[r]);return btoa(u)},Ne=s=>{const a=s.split(".").pop()?.toLowerCase()??"";return{html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[a]??3};j.useEffect(()=>{t&&se(t.id)},[t]);const G=j.useMemo(()=>t?w.trim()?/\s/.test(w)?"Command ID cannot contain whitespace.":w!==t.id&&W.some(s=>s.id.toLowerCase()===w.toLowerCase())?"A command with this ID already exists.":"":"Command ID is required.":"",[w,t,W]),Z=j.useMemo(()=>Object.entries(h).flatMap(([s,a])=>a.tabs.flatMap(u=>u.groups.flatMap(r=>r.buttons.filter(o=>o.commandId===N).map(o=>({location:s,tab:u,group:r,button:o}))))),[h,N]),ce=Z.length;if(!t)return null;const de=async(s,a)=>{const u=t.actions[s];if(!u||u.kind!=="javascript")return;const r=we(u.library);if(!r){I("JavaScript library must be a valid $webresource path."),Q(s),re(a),$(""),oe(null);return}Q(s),re(a),q(!0),I(null),J(!1),oe(r);try{const o=await He(r);if(!o){$(""),I(`Web resource not found: ${r}`);return}const c=await Oe(o.id);$(Re(c))}catch(o){I(o instanceof Error?o.message:"Failed to load web resource content."),$("")}finally{q(!1)}},Pe=async()=>{if(!(!X||ne===null||!A)){q(!0),I(null);try{await Xe(A,Se(te),Ne(A),A.split("/").pop()),J(!1)}catch(s){I(s instanceof Error?s.message:"Failed to save web resource content.")}finally{q(!1)}}},k=s=>{i({...t,...s})},g=(s,a)=>{const u=[...t.actions];u[s]=a,k({actions:u})},K=s=>{k({actions:t.actions.filter((a,u)=>u!==s)})},T=s=>{const a=s==="javascript"?{kind:"javascript",library:"$webresource:",functionName:"",params:[]}:s==="url"?{kind:"url",address:"https://",passParams:!1,params:[]}:s==="powerFx"?{kind:"powerFx",expression:""}:{kind:"customApi",actionName:"",boundParameter:"",inputParameters:[],outputParameters:[]};k({actions:[...t.actions,a]})},Ie=(s,a)=>{const u=ne===a;if(s.kind==="javascript")return e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"success",size:"small",children:"JavaScript"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Library (Web Resource)",children:e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[e.jsx(S,{style:{flex:1},value:s.library,onChange:(r,o)=>g(a,{...s,library:o.value}),placeholder:"$webresource:publisher_/scripts/myfile.js"}),e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{De.set(r=>{g(a,{...s,library:`$webresource:${r.name}`})}),O()},children:"Browse…"})]})}),e.jsx(v,{label:"Function name",children:e.jsx(S,{value:s.functionName,onChange:(r,o)=>g(a,{...s,functionName:o.value}),placeholder:"MyNamespace.myFunction"})}),e.jsx(M,{intent:"info",children:e.jsx(D,{children:"Read-only function preview and Monaco editing are available in the web resource browser integration path."})}),e.jsx(ee,{children:"Parameters (positional)"}),e.jsx(he,{params:s.params,onChange:r=>g(a,{...s,params:r}),urlMode:!1}),e.jsxs("div",{className:n.row,children:[e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{de(a,!1)},children:"Function preview"}),e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{de(a,!0)},children:"Open in Monaco"})]}),u&&e.jsxs("div",{className:n.codePanel,children:[e.jsxs("div",{className:n.row,children:[e.jsx(x,{weight:"semibold",children:X?"Monaco Editor":"Function Preview"}),A&&e.jsx(x,{size:200,style:{fontFamily:l.fontFamilyMonospace},children:A})]}),Y&&e.jsx(M,{intent:"error",children:e.jsx(D,{children:Y})}),ie?e.jsx(x,{style:{color:l.colorNeutralForeground3},children:"Loading source…"}):e.jsx("div",{style:{height:240},children:e.jsx(pe,{language:"javascript",value:te,readOnly:!X,onChange:r=>{$(r),J(!0)},options:{wordWrap:"on"}})}),e.jsxs("div",{className:n.row,children:[e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{Q(null),I(null),J(!1)},children:"Close"}),X&&e.jsx(m,{appearance:"primary",size:"small",onClick:()=>{Pe()},disabled:!Ce||ie||!!Y,children:"Save Web Resource"})]})]})]},a);if(s.kind==="url"){const r=s.address.trim().startsWith("https://");return e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"informative",size:"small",children:"URL"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(M,{intent:"warning",children:e.jsx(D,{children:e.jsx(x,{className:n.securityNote,children:"⚠ Ampersands in URLs are automatically escaped as & in the generated XML."})})}),e.jsx(v,{label:"Address",validationState:r?"none":"error",validationMessage:r?void 0:"URL must start with https://",children:e.jsx(S,{value:s.address,onChange:(o,c)=>g(a,{...s,address:c.value}),placeholder:"https://..."})}),e.jsx(v,{label:"Open in (WinMode)",children:e.jsxs(V,{value:String(s.winMode??0),onChange:(o,c)=>g(a,{...s,winMode:parseInt(c.value)}),children:[e.jsx("option",{value:"0",children:"Navigate (0)"}),e.jsx("option",{value:"1",children:"Dialog (1)"}),e.jsx("option",{value:"2",children:"Popup (2)"})]})}),e.jsx(v,{children:e.jsxs(m,{appearance:s.passParams?"primary":"subtle",size:"small",onClick:()=>g(a,{...s,passParams:!s.passParams}),children:[s.passParams?"✓ PassParams ON":"PassParams OFF"," — appends typename, type, id, orgname…"]})}),e.jsx(ee,{children:"Parameters (named)"}),e.jsx(he,{params:s.params,onChange:o=>g(a,{...s,params:o}),urlMode:!0})]},a)}return s.kind==="powerFx"?e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"brand",size:"small",children:"Power Fx"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Expression",children:e.jsx("div",{style:{height:120,border:`1px solid ${l.colorNeutralStroke1}`,borderRadius:l.borderRadiusMedium,overflow:"hidden"},children:e.jsx(pe,{language:"javascript",value:s.expression,onChange:r=>g(a,{...s,expression:r??""}),options:{minimap:{enabled:!1},lineNumbers:"off",fontSize:13,scrollBeyondLastLine:!1,wordWrap:"on",lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,renderLineHighlight:"none"}})})}),e.jsx(M,{intent:"info",children:e.jsxs(D,{children:["Variables: ",e.jsx("code",{children:"ThisRecord"}),", ",e.jsx("code",{children:"Selection"}),", ",e.jsx("code",{children:"Self"}),". Power Fx rules can return a Promise on Unified Interface (resolves false after 10 s if unresolved)."]})})]},a):s.kind==="customApi"?e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"warning",size:"small",children:"Custom API"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Action logical name",children:e.jsx(S,{value:s.actionName,onChange:(r,o)=>g(a,{...s,actionName:o.value}),placeholder:"new_ExecuteBusinessAction"})}),e.jsx(v,{label:"Bound parameter (optional)",children:e.jsx(S,{value:s.boundParameter??"",onChange:(r,o)=>g(a,{...s,boundParameter:o.value}),placeholder:"Target"})}),e.jsx(v,{label:"Input parameters (name=value per line)",children:e.jsx(S,{value:s.inputParameters.map(r=>`${r.name}=${r.value}`).join("; "),onChange:(r,o)=>{const c=o.value.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[_,...Be]=b.split("=");return{name:(_??"").trim(),value:Be.join("=").trim()}}).filter(b=>b.name.length>0);g(a,{...s,inputParameters:c})},placeholder:"ParamA=ValueA; ParamB=ValueB"})})]},a):null},ke=()=>e.jsxs(e.Fragment,{children:[t.actions.map((s,a)=>Ie(s,a)),t.actions.length===0&&e.jsx(x,{italic:!0,style:{color:l.colorNeutralForeground3},children:"No actions defined — button will do nothing when clicked."}),e.jsxs("div",{className:n.row,children:[e.jsx(v,{label:"Action type",style:{minWidth:"220px"},children:e.jsxs(V,{onChange:(s,a)=>{const u=a.value;u&&T(u)},value:"",children:[e.jsx("option",{value:"",children:"Add action..."}),e.jsx("option",{value:"javascript",children:"JavaScript function"}),e.jsx("option",{value:"url",children:"URL action"}),e.jsx("option",{value:"powerFx",children:"Power Fx expression"}),e.jsx("option",{value:"customApi",children:"Custom action / Web API"})]})}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("javascript"),children:"Add JavaScript function"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("url"),children:"Add URL action"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("powerFx"),children:"Add Power Fx action"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("customApi"),children:"Add Custom API action"})]})]}),ze=()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{label:"Command ID",children:e.jsx(S,{value:w,onChange:(s,a)=>se(a.value),style:{fontFamily:l.fontFamilyMonospace}})}),G&&e.jsx(x,{style:{color:l.colorPaletteRedForeground1,fontSize:l.fontSizeBase100},children:G}),e.jsx(m,{appearance:"secondary",size:"small",disabled:!w.trim()||!!G||w===t.id,onClick:()=>{if(!w.trim()||G)return;const s=w.trim();p(t.id,s)&&C(s)},children:"Apply ID change"}),e.jsx(x,{style:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase200},children:"Naming convention: Publisher.EntityName.ButtonName.Command"}),e.jsx(M,{intent:"warning",children:e.jsx(D,{children:e.jsxs(x,{className:n.securityNote,children:["⚠ ",e.jsx("strong",{children:"Security:"})," All command definitions are visible in browser source regardless of button visibility. Do not embed sensitive logic, credentials, or privileged information in command parameters or function names."]})})})]}),ue=s=>{const a=s==="enable"?t.enableRules:t.displayRules,u=(s==="enable"?f:d).map(c=>c.id).filter(c=>!a.includes(c)),r=s==="enable"?ge:ye,o=()=>{const c=new Set([...f.map(_=>_.id),...d.map(_=>_.id)]),b=Le("New",s==="enable"?"Enable":"Display",c);s==="enable"?je({id:b,steps:[]}):ve({id:b,steps:[]}),H(b,s)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:n.rulePills,children:[a.map(c=>e.jsxs("div",{className:n.ruleRow,children:[e.jsx(L,{appearance:"outline",size:"medium",className:n.ruleChip,onClick:()=>H(c,s),role:"button",tabIndex:0,children:c}),e.jsx(m,{appearance:"subtle",size:"small",className:n.ruleRemoveBtn,icon:e.jsx(z,{}),"aria-label":`Unbind ${c}`,onClick:()=>{k(s==="enable"?{enableRules:t.enableRules.filter(b=>b!==c)}:{displayRules:t.displayRules.filter(b=>b!==c)})}})]},c)),a.length===0&&e.jsxs(x,{italic:!0,style:{color:l.colorNeutralForeground3},children:["No ",s," rules — always ",s==="enable"?"enabled":"visible","."]})]}),e.jsxs("div",{className:n.row,children:[e.jsx(v,{label:`Bind existing ${s} rule`,style:{minWidth:"260px"},children:e.jsxs(V,{value:r,onChange:(c,b)=>s==="enable"?ae(b.value):le(b.value),children:[e.jsx("option",{value:"",children:"Select a rule…"}),u.map(c=>e.jsx("option",{value:c,children:c},c))]})}),e.jsx(m,{appearance:"secondary",size:"small",disabled:!r,onClick:()=>{r&&(s==="enable"?(k({enableRules:[...t.enableRules,r]}),ae("")):(k({displayRules:[...t.displayRules,r]}),le("")))},children:"Bind selected"}),e.jsxs(m,{appearance:"subtle",size:"small",onClick:o,children:["Create new ",s," rule"]})]}),s==="enable"&&e.jsx(M,{intent:"info",children:e.jsxs(D,{children:["Disabled buttons are ",e.jsx("strong",{children:"hidden"})," in the modern command bar (Unified Interface). In the classic ribbon, disabled buttons remain visible but do not respond to clicks."]})})]})},Fe=()=>e.jsxs(e.Fragment,{children:[e.jsxs(x,{children:["Referenced by ",e.jsx("strong",{children:ce})," button(s)."]}),Z.length>0&&e.jsx("div",{className:n.versionsList,children:Z.map(s=>e.jsx("div",{className:n.versionRow,children:e.jsxs("div",{children:[e.jsx(x,{weight:"semibold",style:{fontFamily:l.fontFamilyMonospace},children:s.button.id}),e.jsxs(x,{className:n.versionMeta,children:[s.location," → ",s.tab.label," → ",s.group.label]})]})},`${s.location}:${s.tab.id}:${s.group.id}:${s.button.id}`))})]}),me=be.filter(s=>s.target===t.id||s.detail.includes(t.id)).slice().reverse(),Ae=()=>e.jsx(e.Fragment,{children:me.length===0?e.jsx(x,{style:{color:l.colorNeutralForeground3},children:"No command-specific history entries yet."}):e.jsx("div",{className:n.versionsList,children:me.map((s,a)=>e.jsxs("div",{className:n.versionRow,children:[e.jsxs("div",{children:[e.jsx(x,{weight:"semibold",children:s.op}),e.jsx(x,{className:n.versionMeta,children:s.detail})]}),e.jsx(x,{className:n.versionMeta,children:new Date(s.ts).toLocaleString()})]},`${s.ts}-${a}`))})});return e.jsxs($e,{position:"end",open:F,onOpenChange:()=>y(),className:n.drawer,children:[e.jsx(Te,{children:e.jsx(_e,{action:e.jsx(m,{appearance:"subtle",icon:e.jsx(z,{}),onClick:y,"aria-label":"Close command editor"}),children:e.jsx(x,{size:400,weight:"semibold",style:{fontFamily:l.fontFamilyMonospace},children:t.id})})}),e.jsxs(Ue,{className:n.body,children:[e.jsxs(Ve,{selectedValue:P,onTabSelect:(s,a)=>fe(a.value),children:[e.jsx(E,{value:"actions",children:"Actions"}),e.jsx(E,{value:"enableRules",children:"Enable rules"}),e.jsx(E,{value:"displayRules",children:"Display rules"}),e.jsx(E,{value:"settings",children:"Settings"}),e.jsxs(E,{value:"references",children:["References (",ce,")"]}),e.jsx(E,{value:"versions",children:"Versions"})]}),e.jsx(ee,{}),P==="actions"&&ke(),P==="enableRules"&&ue("enable"),P==="displayRules"&&ue("display"),P==="settings"&&ze(),P==="references"&&Fe(),P==="versions"&&Ae()]})]})};export{ls as CommandEditorPanel,ls as default};
1
+ import{cw as e,x as Ee,h as Me,aw as z,a as U,cx as xe}from"./fluent-icons-DiKr_qRE.js";import{r as j}from"./monaco-BLZnQb2P.js";import{i as B,u as R,w as De,g as Le}from"./index-DjHxPFpB.js";import{S as V,F as v,I as S,C as We,B as L,a as m,Q as x,a1 as l,x as $e,l as Te,m as _e,k as Ue,K as Ve,T as E,j as ee,u as M,w as D}from"./fluent-ui-kUA2U4Gr.js";import{M as pe}from"./MonacoEditor-DFYisBG6.js";import{l as He,a as Oe,s as Xe}from"./webResourceService-Ck07E3GN.js";import"./dnd-DHB99ZH7.js";const qe=xe({root:{display:"flex",flexDirection:"column",gap:l.spacingVerticalXS},param:{display:"flex",gap:l.spacingHorizontalS,alignItems:"flex-end",padding:l.spacingVerticalXS,border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium},typeSelect:{width:"140px",flexShrink:0},valueField:{flex:1},actions:{display:"flex",gap:l.spacingHorizontalXS,flexShrink:0},addButton:{alignSelf:"flex-start"},hint:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase100}}),Je=[{label:"Context",values:["PrimaryControl","PrimaryControlId","SelectedControl","CommandProperties"]},{label:"Record",values:["PrimaryEntityTypeCode","PrimaryEntityTypeName","FirstPrimaryItemId","PrimaryItemIds"]},{label:"Selection context",values:["SelectedEntityTypeCode","SelectedEntityTypeName","FirstSelectedItemId"]},{label:"Grid selection",values:["SelectedControlSelectedItemCount","SelectedControlSelectedItemIds","SelectedControlSelectedItemReferences","SelectedControlAllItemCount","SelectedControlAllItemIds","SelectedControlAllItemReferences","SelectedControlUnselectedItemCount","SelectedControlUnselectedItemIds","SelectedControlUnselectedItemReferences"]},{label:"Org/User",values:["OrgName","OrgLcid","UserLcid"]}],he=({params:n,onChange:F,urlMode:N=!1})=>{const y=qe(),C=(i,p)=>{const h=[...n];h[i]=p,F(h)},H=i=>{F(n.filter((p,h)=>h!==i))},O=(i,p)=>{const h=[...n],d=i+p;d<0||d>=h.length||([h[i],h[d]]=[h[d],h[i]],F(h))},W=()=>{F([...n,{kind:"CrmParameter",value:"PrimaryControl"}])};return e.jsxs("div",{className:y.root,children:[n.map((i,p)=>e.jsxs("div",{className:y.param,children:[e.jsx("div",{className:y.typeSelect,children:e.jsxs(V,{value:i.kind,onChange:(h,d)=>{const f=d.value;f==="CrmParameter"?C(p,{kind:f,value:"PrimaryControl"}):f==="BoolParameter"?C(p,{kind:f,value:!1}):f==="IntParameter"||f==="DecimalParameter"?C(p,{kind:f,value:0}):C(p,{kind:"StringParameter",value:""})},children:[e.jsx("option",{value:"CrmParameter",children:"CrmParameter"}),e.jsx("option",{value:"StringParameter",children:"String"}),e.jsx("option",{value:"BoolParameter",children:"Boolean"}),e.jsx("option",{value:"IntParameter",children:"Integer"}),e.jsx("option",{value:"DecimalParameter",children:"Decimal"})]})}),N&&e.jsx(v,{label:"Name (querystring key)",style:{width:"130px",flexShrink:0},children:e.jsx(S,{value:i.name??"",onChange:(h,d)=>C(p,{...i,name:d.value||void 0}),placeholder:"key"})}),e.jsx("div",{className:y.valueField,children:i.kind==="CrmParameter"?e.jsx(V,{value:i.value,onChange:(h,d)=>C(p,{...i,value:d.value}),children:Je.map(h=>h.values.map(d=>e.jsx("option",{value:d,children:d},d)))}):i.kind==="BoolParameter"?e.jsx(We,{checked:i.value,onChange:(h,d)=>C(p,{...i,value:d.checked}),label:"true"}):e.jsx(S,{type:i.kind==="StringParameter"?"text":"number",value:String(i.value),onChange:(h,d)=>{const f=i.kind==="StringParameter"?d.value:i.kind==="IntParameter"?parseInt(d.value):parseFloat(d.value);C(p,{...i,value:f})}})}),N&&i.kind==="CrmParameter"&&!i.name&&e.jsx(L,{appearance:"filled",color:"warning",size:"small",title:"Name required for URL actions"}),e.jsxs("div",{className:y.actions,children:[e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(Ee,{}),onClick:()=>O(p,-1),disabled:p===0,"aria-label":"Move up"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(Me,{}),onClick:()=>O(p,1),disabled:p===n.length-1,"aria-label":"Move down"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>H(p),"aria-label":"Remove parameter"})]})]},p)),N&&e.jsxs(x,{className:y.hint,children:["For URL actions, each CrmParameter must have a ",e.jsx("code",{children:"name"})," attribute (querystring key)."]}),e.jsx(m,{className:y.addButton,appearance:"secondary",size:"small",icon:e.jsx(U,{}),onClick:W,children:"Add parameter"})]})},Ge=xe({drawer:{width:"640px",maxWidth:"90vw"},body:{display:"flex",flexDirection:"column",gap:l.spacingVerticalS,padding:l.spacingVerticalM,overflowY:"auto"},actionCard:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalM,display:"flex",flexDirection:"column",gap:l.spacingVerticalS},actionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between"},row:{display:"flex",gap:l.spacingHorizontalS,alignItems:"flex-end"},ruleRow:{display:"inline-flex",alignItems:"center",gap:l.spacingHorizontalXS},ruleRemoveBtn:{minWidth:"20px",width:"20px",height:"20px"},ruleChip:{cursor:"pointer"},rulePills:{display:"flex",flexWrap:"wrap",gap:l.spacingHorizontalXS},versionsList:{display:"flex",flexDirection:"column",gap:l.spacingVerticalXS},versionRow:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalXS,display:"flex",justifyContent:"space-between",gap:l.spacingHorizontalS},versionMeta:{fontSize:l.fontSizeBase100,color:l.colorNeutralForeground3},securityNote:{fontSize:l.fontSizeBase100},codePanel:{border:`1px solid ${l.colorNeutralStroke2}`,borderRadius:l.borderRadiusMedium,padding:l.spacingVerticalS,display:"flex",flexDirection:"column",gap:l.spacingVerticalS}}),ls=()=>{const n=Ge(),F=B(s=>s.commandEditorOpen),N=B(s=>s.commandEditorId),y=B(s=>s.closeCommandEditor),C=B(s=>s.openCommandEditor),H=B(s=>s.openRuleEditor),O=B(s=>s.openWebResourceBrowser),W=R(s=>s.commands),i=R(s=>s.upsertCommand),p=R(s=>s.renameCommandId),h=R(s=>s.ribbons),d=R(s=>s.displayRules),f=R(s=>s.enableRules),be=R(s=>s.past),je=R(s=>s.upsertEnableRule),ve=R(s=>s.upsertDisplayRule),[P,fe]=j.useState("actions"),[w,se]=j.useState(""),[ge,ae]=j.useState(""),[ye,le]=j.useState(""),[ne,Q]=j.useState(null),[X,re]=j.useState(!1),[ie,q]=j.useState(!1),[Y,I]=j.useState(null),[te,$]=j.useState(""),[Ce,J]=j.useState(!1),[A,oe]=j.useState(null),t=W.find(s=>s.id===N),we=s=>{const a=s.trim();return a.startsWith("$webresource:")?a.slice(13).trim():a},Re=s=>{if(!s)return"";const a=Uint8Array.from(atob(s),u=>u.charCodeAt(0));return new TextDecoder().decode(a)},Se=s=>{const a=new TextEncoder().encode(s);let u="";for(let r=0;r<a.length;r+=1)u+=String.fromCharCode(a[r]);return btoa(u)},Ne=s=>{const a=s.split(".").pop()?.toLowerCase()??"";return{html:1,css:2,js:3,xml:4,png:5,jpg:6,gif:7,xsl:9,ico:10,svg:11,resx:12}[a]??3};j.useEffect(()=>{t&&se(t.id)},[t]);const G=j.useMemo(()=>t?w.trim()?/\s/.test(w)?"Command ID cannot contain whitespace.":w!==t.id&&W.some(s=>s.id.toLowerCase()===w.toLowerCase())?"A command with this ID already exists.":"":"Command ID is required.":"",[w,t,W]),Z=j.useMemo(()=>Object.entries(h).flatMap(([s,a])=>a.tabs.flatMap(u=>u.groups.flatMap(r=>r.buttons.filter(o=>o.commandId===N).map(o=>({location:s,tab:u,group:r,button:o}))))),[h,N]),ce=Z.length;if(!t)return null;const de=async(s,a)=>{const u=t.actions[s];if(!u||u.kind!=="javascript")return;const r=we(u.library);if(!r){I("JavaScript library must be a valid $webresource path."),Q(s),re(a),$(""),oe(null);return}Q(s),re(a),q(!0),I(null),J(!1),oe(r);try{const o=await He(r);if(!o){$(""),I(`Web resource not found: ${r}`);return}const c=await Oe(o.id);$(Re(c))}catch(o){I(o instanceof Error?o.message:"Failed to load web resource content."),$("")}finally{q(!1)}},Pe=async()=>{if(!(!X||ne===null||!A)){q(!0),I(null);try{await Xe(A,Se(te),Ne(A),A.split("/").pop()),J(!1)}catch(s){I(s instanceof Error?s.message:"Failed to save web resource content.")}finally{q(!1)}}},k=s=>{i({...t,...s})},g=(s,a)=>{const u=[...t.actions];u[s]=a,k({actions:u})},K=s=>{k({actions:t.actions.filter((a,u)=>u!==s)})},T=s=>{const a=s==="javascript"?{kind:"javascript",library:"$webresource:",functionName:"",params:[]}:s==="url"?{kind:"url",address:"https://",passParams:!1,params:[]}:s==="powerFx"?{kind:"powerFx",expression:""}:{kind:"customApi",actionName:"",boundParameter:"",inputParameters:[],outputParameters:[]};k({actions:[...t.actions,a]})},Ie=(s,a)=>{const u=ne===a;if(s.kind==="javascript")return e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"success",size:"small",children:"JavaScript"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Library (Web Resource)",children:e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:[e.jsx(S,{style:{flex:1},value:s.library,onChange:(r,o)=>g(a,{...s,library:o.value}),placeholder:"$webresource:publisher_/scripts/myfile.js"}),e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{De.set(r=>{g(a,{...s,library:`$webresource:${r.name}`})}),O()},children:"Browse…"})]})}),e.jsx(v,{label:"Function name",children:e.jsx(S,{value:s.functionName,onChange:(r,o)=>g(a,{...s,functionName:o.value}),placeholder:"MyNamespace.myFunction"})}),e.jsx(M,{intent:"info",children:e.jsx(D,{children:"Read-only function preview and Monaco editing are available in the web resource browser integration path."})}),e.jsx(ee,{children:"Parameters (positional)"}),e.jsx(he,{params:s.params,onChange:r=>g(a,{...s,params:r}),urlMode:!1}),e.jsxs("div",{className:n.row,children:[e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{de(a,!1)},children:"Function preview"}),e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{de(a,!0)},children:"Open in Monaco"})]}),u&&e.jsxs("div",{className:n.codePanel,children:[e.jsxs("div",{className:n.row,children:[e.jsx(x,{weight:"semibold",children:X?"Monaco Editor":"Function Preview"}),A&&e.jsx(x,{size:200,style:{fontFamily:l.fontFamilyMonospace},children:A})]}),Y&&e.jsx(M,{intent:"error",children:e.jsx(D,{children:Y})}),ie?e.jsx(x,{style:{color:l.colorNeutralForeground3},children:"Loading source…"}):e.jsx("div",{style:{height:240},children:e.jsx(pe,{language:"javascript",value:te,readOnly:!X,onChange:r=>{$(r),J(!0)},options:{wordWrap:"on"}})}),e.jsxs("div",{className:n.row,children:[e.jsx(m,{appearance:"subtle",size:"small",onClick:()=>{Q(null),I(null),J(!1)},children:"Close"}),X&&e.jsx(m,{appearance:"primary",size:"small",onClick:()=>{Pe()},disabled:!Ce||ie||!!Y,children:"Save Web Resource"})]})]})]},a);if(s.kind==="url"){const r=s.address.trim().startsWith("https://");return e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"informative",size:"small",children:"URL"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(M,{intent:"warning",children:e.jsx(D,{children:e.jsx(x,{className:n.securityNote,children:"⚠ Ampersands in URLs are automatically escaped as & in the generated XML."})})}),e.jsx(v,{label:"Address",validationState:r?"none":"error",validationMessage:r?void 0:"URL must start with https://",children:e.jsx(S,{value:s.address,onChange:(o,c)=>g(a,{...s,address:c.value}),placeholder:"https://..."})}),e.jsx(v,{label:"Open in (WinMode)",children:e.jsxs(V,{value:String(s.winMode??0),onChange:(o,c)=>g(a,{...s,winMode:parseInt(c.value)}),children:[e.jsx("option",{value:"0",children:"Navigate (0)"}),e.jsx("option",{value:"1",children:"Dialog (1)"}),e.jsx("option",{value:"2",children:"Popup (2)"})]})}),e.jsx(v,{children:e.jsxs(m,{appearance:s.passParams?"primary":"subtle",size:"small",onClick:()=>g(a,{...s,passParams:!s.passParams}),children:[s.passParams?"✓ PassParams ON":"PassParams OFF"," — appends typename, type, id, orgname…"]})}),e.jsx(ee,{children:"Parameters (named)"}),e.jsx(he,{params:s.params,onChange:o=>g(a,{...s,params:o}),urlMode:!0})]},a)}return s.kind==="powerFx"?e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"brand",size:"small",children:"Power Fx"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Expression",children:e.jsx("div",{style:{height:120,border:`1px solid ${l.colorNeutralStroke1}`,borderRadius:l.borderRadiusMedium,overflow:"hidden"},children:e.jsx(pe,{language:"javascript",value:s.expression,onChange:r=>g(a,{...s,expression:r??""}),options:{minimap:{enabled:!1},lineNumbers:"off",fontSize:13,scrollBeyondLastLine:!1,wordWrap:"on",lineDecorationsWidth:4,lineNumbersMinChars:0,glyphMargin:!1,folding:!1,renderLineHighlight:"none"}})})}),e.jsx(M,{intent:"info",children:e.jsxs(D,{children:["Variables: ",e.jsx("code",{children:"ThisRecord"}),", ",e.jsx("code",{children:"Selection"}),", ",e.jsx("code",{children:"Self"}),". Power Fx rules can return a Promise on Unified Interface (resolves false after 10 s if unresolved)."]})})]},a):s.kind==="customApi"?e.jsxs("div",{className:n.actionCard,children:[e.jsxs("div",{className:n.actionHeader,children:[e.jsx(L,{appearance:"filled",color:"warning",size:"small",children:"Custom API"}),e.jsx(m,{appearance:"subtle",size:"small",icon:e.jsx(z,{}),onClick:()=>K(a),"aria-label":"Remove action"})]}),e.jsx(v,{label:"Action logical name",children:e.jsx(S,{value:s.actionName,onChange:(r,o)=>g(a,{...s,actionName:o.value}),placeholder:"new_ExecuteBusinessAction"})}),e.jsx(v,{label:"Bound parameter (optional)",children:e.jsx(S,{value:s.boundParameter??"",onChange:(r,o)=>g(a,{...s,boundParameter:o.value}),placeholder:"Target"})}),e.jsx(v,{label:"Input parameters (name=value per line)",children:e.jsx(S,{value:s.inputParameters.map(r=>`${r.name}=${r.value}`).join("; "),onChange:(r,o)=>{const c=o.value.split(";").map(b=>b.trim()).filter(Boolean).map(b=>{const[_,...Be]=b.split("=");return{name:(_??"").trim(),value:Be.join("=").trim()}}).filter(b=>b.name.length>0);g(a,{...s,inputParameters:c})},placeholder:"ParamA=ValueA; ParamB=ValueB"})})]},a):null},ke=()=>e.jsxs(e.Fragment,{children:[t.actions.map((s,a)=>Ie(s,a)),t.actions.length===0&&e.jsx(x,{italic:!0,style:{color:l.colorNeutralForeground3},children:"No actions defined — button will do nothing when clicked."}),e.jsxs("div",{className:n.row,children:[e.jsx(v,{label:"Action type",style:{minWidth:"220px"},children:e.jsxs(V,{onChange:(s,a)=>{const u=a.value;u&&T(u)},value:"",children:[e.jsx("option",{value:"",children:"Add action..."}),e.jsx("option",{value:"javascript",children:"JavaScript function"}),e.jsx("option",{value:"url",children:"URL action"}),e.jsx("option",{value:"powerFx",children:"Power Fx expression"}),e.jsx("option",{value:"customApi",children:"Custom action / Web API"})]})}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("javascript"),children:"Add JavaScript function"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("url"),children:"Add URL action"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("powerFx"),children:"Add Power Fx action"}),e.jsx(m,{icon:e.jsx(U,{}),appearance:"secondary",size:"small",onClick:()=>T("customApi"),children:"Add Custom API action"})]})]}),ze=()=>e.jsxs(e.Fragment,{children:[e.jsx(v,{label:"Command ID",children:e.jsx(S,{value:w,onChange:(s,a)=>se(a.value),style:{fontFamily:l.fontFamilyMonospace}})}),G&&e.jsx(x,{style:{color:l.colorPaletteRedForeground1,fontSize:l.fontSizeBase100},children:G}),e.jsx(m,{appearance:"secondary",size:"small",disabled:!w.trim()||!!G||w===t.id,onClick:()=>{if(!w.trim()||G)return;const s=w.trim();p(t.id,s)&&C(s)},children:"Apply ID change"}),e.jsx(x,{style:{color:l.colorNeutralForeground3,fontSize:l.fontSizeBase200},children:"Naming convention: Publisher.EntityName.ButtonName.Command"}),e.jsx(M,{intent:"warning",children:e.jsx(D,{children:e.jsxs(x,{className:n.securityNote,children:["⚠ ",e.jsx("strong",{children:"Security:"})," All command definitions are visible in browser source regardless of button visibility. Do not embed sensitive logic, credentials, or privileged information in command parameters or function names."]})})})]}),ue=s=>{const a=s==="enable"?t.enableRules:t.displayRules,u=(s==="enable"?f:d).map(c=>c.id).filter(c=>!a.includes(c)),r=s==="enable"?ge:ye,o=()=>{const c=new Set([...f.map(_=>_.id),...d.map(_=>_.id)]),b=Le("New",s==="enable"?"Enable":"Display",c);s==="enable"?je({id:b,steps:[]}):ve({id:b,steps:[]}),H(b,s)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:n.rulePills,children:[a.map(c=>e.jsxs("div",{className:n.ruleRow,children:[e.jsx(L,{appearance:"outline",size:"medium",className:n.ruleChip,onClick:()=>H(c,s),role:"button",tabIndex:0,children:c}),e.jsx(m,{appearance:"subtle",size:"small",className:n.ruleRemoveBtn,icon:e.jsx(z,{}),"aria-label":`Unbind ${c}`,onClick:()=>{k(s==="enable"?{enableRules:t.enableRules.filter(b=>b!==c)}:{displayRules:t.displayRules.filter(b=>b!==c)})}})]},c)),a.length===0&&e.jsxs(x,{italic:!0,style:{color:l.colorNeutralForeground3},children:["No ",s," rules — always ",s==="enable"?"enabled":"visible","."]})]}),e.jsxs("div",{className:n.row,children:[e.jsx(v,{label:`Bind existing ${s} rule`,style:{minWidth:"260px"},children:e.jsxs(V,{value:r,onChange:(c,b)=>s==="enable"?ae(b.value):le(b.value),children:[e.jsx("option",{value:"",children:"Select a rule…"}),u.map(c=>e.jsx("option",{value:c,children:c},c))]})}),e.jsx(m,{appearance:"secondary",size:"small",disabled:!r,onClick:()=>{r&&(s==="enable"?(k({enableRules:[...t.enableRules,r]}),ae("")):(k({displayRules:[...t.displayRules,r]}),le("")))},children:"Bind selected"}),e.jsxs(m,{appearance:"subtle",size:"small",onClick:o,children:["Create new ",s," rule"]})]}),s==="enable"&&e.jsx(M,{intent:"info",children:e.jsxs(D,{children:["Disabled buttons are ",e.jsx("strong",{children:"hidden"})," in the modern command bar (Unified Interface). In the classic ribbon, disabled buttons remain visible but do not respond to clicks."]})})]})},Fe=()=>e.jsxs(e.Fragment,{children:[e.jsxs(x,{children:["Referenced by ",e.jsx("strong",{children:ce})," button(s)."]}),Z.length>0&&e.jsx("div",{className:n.versionsList,children:Z.map(s=>e.jsx("div",{className:n.versionRow,children:e.jsxs("div",{children:[e.jsx(x,{weight:"semibold",style:{fontFamily:l.fontFamilyMonospace},children:s.button.id}),e.jsxs(x,{className:n.versionMeta,children:[s.location," → ",s.tab.label," → ",s.group.label]})]})},`${s.location}:${s.tab.id}:${s.group.id}:${s.button.id}`))})]}),me=be.filter(s=>s.target===t.id||s.detail.includes(t.id)).slice().reverse(),Ae=()=>e.jsx(e.Fragment,{children:me.length===0?e.jsx(x,{style:{color:l.colorNeutralForeground3},children:"No command-specific history entries yet."}):e.jsx("div",{className:n.versionsList,children:me.map((s,a)=>e.jsxs("div",{className:n.versionRow,children:[e.jsxs("div",{children:[e.jsx(x,{weight:"semibold",children:s.op}),e.jsx(x,{className:n.versionMeta,children:s.detail})]}),e.jsx(x,{className:n.versionMeta,children:new Date(s.ts).toLocaleString()})]},`${s.ts}-${a}`))})});return e.jsxs($e,{position:"end",open:F,onOpenChange:()=>y(),className:n.drawer,children:[e.jsx(Te,{children:e.jsx(_e,{action:e.jsx(m,{appearance:"subtle",icon:e.jsx(z,{}),onClick:y,"aria-label":"Close command editor"}),children:e.jsx(x,{size:400,weight:"semibold",style:{fontFamily:l.fontFamilyMonospace},children:t.id})})}),e.jsxs(Ue,{className:n.body,children:[e.jsxs(Ve,{selectedValue:P,onTabSelect:(s,a)=>fe(a.value),children:[e.jsx(E,{value:"actions",children:"Actions"}),e.jsx(E,{value:"enableRules",children:"Enable rules"}),e.jsx(E,{value:"displayRules",children:"Display rules"}),e.jsx(E,{value:"settings",children:"Settings"}),e.jsxs(E,{value:"references",children:["References (",ce,")"]}),e.jsx(E,{value:"versions",children:"Versions"})]}),e.jsx(ee,{}),P==="actions"&&ke(),P==="enableRules"&&ue("enable"),P==="displayRules"&&ue("display"),P==="settings"&&ze(),P==="references"&&Fe(),P==="versions"&&Ae()]})]})};export{ls as CommandEditorPanel,ls as default};
@@ -1 +1 @@
1
- import{cw as a,bL as te,cx as oe}from"./fluent-icons-DiKr_qRE.js";import{r as u}from"./monaco-BLZnQb2P.js";import{i,u as c,h as E,e as b}from"./index-G361fmC5.js";import{a1 as t,B as ae,Q as S}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const ne=oe({backdrop:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"10vh"},palette:{width:"640px",maxWidth:"90vw",backgroundColor:t.colorNeutralBackground1,borderRadius:t.borderRadiusLarge,boxShadow:t.shadow64,overflow:"hidden"},searchRow:{display:"flex",alignItems:"center",padding:`${t.spacingVerticalM} ${t.spacingHorizontalM}`,borderBottom:`1px solid ${t.colorNeutralStroke1}`,gap:t.spacingHorizontalS},searchInput:{flex:1,border:"none",outline:"none",fontSize:t.fontSizeBase400,backgroundColor:"transparent"},results:{maxHeight:"400px",overflowY:"auto"},group:{paddingTop:t.spacingVerticalXS},groupLabel:{padding:`${t.spacingVerticalXXS} ${t.spacingHorizontalM}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,fontWeight:t.fontWeightSemibold,textTransform:"uppercase",letterSpacing:"0.08em"},item:{display:"flex",alignItems:"center",gap:t.spacingHorizontalS,padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,cursor:"pointer","&:hover":{backgroundColor:t.colorNeutralBackground1Hover}},itemSelected:{backgroundColor:t.colorNeutralBackground1Hover},itemLabel:{flex:1},itemSub:{color:t.colorNeutralForeground3,fontSize:t.fontSizeBase200},footer:{padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,borderTop:`1px solid ${t.colorNeutralStroke1}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,display:"flex",gap:t.spacingHorizontalL}}),de=()=>{const l=ne(),m=i(e=>e.commandPaletteOpen),w=i(e=>e.setCommandPaletteOpen),R=i(e=>e.openBulkPublish),B=i(e=>e.openXmlDrawer),M=i(e=>e.openImportXml),L=i(e=>e.openCommandEditor),N=i(e=>e.openRuleEditor),X=i(e=>e.openNewGroup),D=i(e=>e.openNewButton),T=i(e=>e.openLocalizationEditor),v=i(e=>e.themeMode),H=i(e=>e.setThemeMode),P=c(e=>e.undo),W=c(e=>e.redo),O=c(e=>e.commands),G=c(e=>e.displayRules),V=c(e=>e.enableRules),y=c(e=>e.ribbons),F=E(e=>e.entities),A=E(e=>e.setActiveEntity),U=b(e=>e.location),Q=b(e=>e.tabId),h=b(e=>e.selectedButtonId),K=b(e=>e.selectedGroupId),[s,C]=u.useState(""),[g,d]=u.useState(0),$=u.useRef(null),n=u.useCallback(()=>{w(!1),C(""),d(0)},[w]);u.useEffect(()=>{m&&setTimeout(()=>$.current?.focus(),50)},[m]);const Z=()=>{const e=[],Y=y[U].tabs.find(o=>o.id===Q)?.groups[0]?.id??null,x=K??Y,J=[{id:"publish",label:"Publish all",subtitle:"Save and publish changes to Dataverse",kind:"action",action:()=>{R(),n()}},{id:"view-xml",label:"View RibbonDiffXml",subtitle:"Open XML drawer",kind:"action",action:()=>{B(),n()}},{id:"import-xml",label:"Import XML",subtitle:"Import RibbonDiffXml from clipboard",kind:"action",action:()=>{M(),n()}},{id:"new-group",label:"New group",subtitle:"Create a new ribbon group in current tab",kind:"action",action:()=>{X(),n()}},{id:"new-button",label:"New button",subtitle:x?"Create a new button in selected/current group":"Select a tab/group with at least one group first",kind:"action",action:()=>{x&&(D(x),n())}},{id:"edit-labels",label:"Edit localized labels",subtitle:h?"Open localization editor for selected button":"Select a button first",kind:"action",action:()=>{h&&(T(h),n())}},{id:"toggle-theme",label:`Toggle theme (${v==="dark"?"Dark":"Light"})`,subtitle:"Switch between light and dark",kind:"action",action:()=>{H(v==="dark"?"light":"dark"),n()}},{id:"undo",label:"Undo",subtitle:"Ctrl+Z",kind:"action",action:()=>{P(),n()}},{id:"redo",label:"Redo",subtitle:"Ctrl+Shift+Z",kind:"action",action:()=>{W(),n()}}];if(e.push(...J),!s.startsWith("@")&&!s.startsWith("/")){const o=Object.entries(y).flatMap(([_,ee])=>ee.tabs.flatMap(j=>j.groups.flatMap(z=>z.buttons.map(k=>({id:`btn-${k.id}`,label:k.label||k.id,subtitle:`${_} → ${j.label} → ${z.label}`,kind:"button",action:()=>{n()}})))));e.push(...o.slice(0,20))}return O.forEach(o=>{e.push({id:`cmd-${o.id}`,label:o.id,subtitle:`${o.actions.length} action(s)`,kind:"command",action:()=>{L(o.id),n()}})}),G.forEach(o=>{e.push({id:`dr-${o.id}`,label:o.id,subtitle:`Display rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{N(o.id,"display"),n()}})}),V.forEach(o=>{e.push({id:`er-${o.id}`,label:o.id,subtitle:`Enable rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{N(o.id,"enable"),n()}})}),(s.startsWith("@")||!s)&&F.slice(0,30).forEach(o=>{e.push({id:`ent-${o.logicalName}`,label:o.displayName,subtitle:o.logicalName,kind:"entity",action:()=>{A(o),n()}})}),e},f=s.startsWith("@")||s.startsWith("/")?s.slice(1):s,I=Z(),p=f?I.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())||(e.subtitle??"").toLowerCase().includes(f.toLowerCase())):I,q=e=>{e.key==="ArrowDown"?(e.preventDefault(),d(r=>Math.min(r+1,p.length-1))):e.key==="ArrowUp"?(e.preventDefault(),d(r=>Math.max(r-1,0))):e.key==="Enter"?p[g]?.action():e.key==="Escape"&&n()};return m?a.jsx("div",{className:l.backdrop,onClick:n,role:"presentation",children:a.jsxs("div",{className:l.palette,onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[a.jsxs("div",{className:l.searchRow,children:[a.jsx(te,{style:{color:t.colorNeutralForeground3,flexShrink:0}}),a.jsx("input",{ref:$,className:l.searchInput,value:s,onChange:e=>{C(e.target.value),d(0)},onKeyDown:q,placeholder:"Search commands, buttons, entities… Use @ for entities, / for actions","aria-label":"Command palette search"})]}),a.jsxs("div",{className:l.results,role:"listbox",children:[p.map((e,r)=>a.jsxs("div",{className:`${l.item} ${r===g?l.itemSelected:""}`,onClick:e.action,role:"option","aria-selected":r===g,onMouseEnter:()=>d(r),children:[a.jsx(ae,{appearance:"outline",size:"small",children:e.kind}),a.jsxs("div",{className:l.itemLabel,children:[a.jsx(S,{children:e.label}),e.subtitle&&a.jsx(S,{className:l.itemSub,block:!0,children:e.subtitle})]})]},e.id)),p.length===0&&a.jsx("div",{className:l.item,children:a.jsx(S,{style:{color:t.colorNeutralForeground3},children:"No results"})})]}),a.jsxs("div",{className:l.footer,children:[a.jsx("span",{children:"↑↓ navigate"}),a.jsx("span",{children:"↵ select"}),a.jsx("span",{children:"Esc close"}),a.jsx("span",{children:"@ entities"}),a.jsx("span",{children:"/ actions"})]})]})}):null};export{de as CommandPalette,de as default};
1
+ import{cw as a,bL as te,cx as oe}from"./fluent-icons-DiKr_qRE.js";import{r as u}from"./monaco-BLZnQb2P.js";import{i,u as c,h as E,e as b}from"./index-DjHxPFpB.js";import{a1 as t,B as ae,Q as S}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const ne=oe({backdrop:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.5)",zIndex:1e3,display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"10vh"},palette:{width:"640px",maxWidth:"90vw",backgroundColor:t.colorNeutralBackground1,borderRadius:t.borderRadiusLarge,boxShadow:t.shadow64,overflow:"hidden"},searchRow:{display:"flex",alignItems:"center",padding:`${t.spacingVerticalM} ${t.spacingHorizontalM}`,borderBottom:`1px solid ${t.colorNeutralStroke1}`,gap:t.spacingHorizontalS},searchInput:{flex:1,border:"none",outline:"none",fontSize:t.fontSizeBase400,backgroundColor:"transparent"},results:{maxHeight:"400px",overflowY:"auto"},group:{paddingTop:t.spacingVerticalXS},groupLabel:{padding:`${t.spacingVerticalXXS} ${t.spacingHorizontalM}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,fontWeight:t.fontWeightSemibold,textTransform:"uppercase",letterSpacing:"0.08em"},item:{display:"flex",alignItems:"center",gap:t.spacingHorizontalS,padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,cursor:"pointer","&:hover":{backgroundColor:t.colorNeutralBackground1Hover}},itemSelected:{backgroundColor:t.colorNeutralBackground1Hover},itemLabel:{flex:1},itemSub:{color:t.colorNeutralForeground3,fontSize:t.fontSizeBase200},footer:{padding:`${t.spacingVerticalXS} ${t.spacingHorizontalM}`,borderTop:`1px solid ${t.colorNeutralStroke1}`,color:t.colorNeutralForeground3,fontSize:t.fontSizeBase100,display:"flex",gap:t.spacingHorizontalL}}),de=()=>{const l=ne(),m=i(e=>e.commandPaletteOpen),w=i(e=>e.setCommandPaletteOpen),R=i(e=>e.openBulkPublish),B=i(e=>e.openXmlDrawer),M=i(e=>e.openImportXml),L=i(e=>e.openCommandEditor),N=i(e=>e.openRuleEditor),X=i(e=>e.openNewGroup),D=i(e=>e.openNewButton),T=i(e=>e.openLocalizationEditor),v=i(e=>e.themeMode),H=i(e=>e.setThemeMode),P=c(e=>e.undo),W=c(e=>e.redo),O=c(e=>e.commands),G=c(e=>e.displayRules),V=c(e=>e.enableRules),y=c(e=>e.ribbons),F=E(e=>e.entities),A=E(e=>e.setActiveEntity),U=b(e=>e.location),Q=b(e=>e.tabId),h=b(e=>e.selectedButtonId),K=b(e=>e.selectedGroupId),[s,C]=u.useState(""),[g,d]=u.useState(0),$=u.useRef(null),n=u.useCallback(()=>{w(!1),C(""),d(0)},[w]);u.useEffect(()=>{m&&setTimeout(()=>$.current?.focus(),50)},[m]);const Z=()=>{const e=[],Y=y[U].tabs.find(o=>o.id===Q)?.groups[0]?.id??null,x=K??Y,J=[{id:"publish",label:"Publish all",subtitle:"Save and publish changes to Dataverse",kind:"action",action:()=>{R(),n()}},{id:"view-xml",label:"View RibbonDiffXml",subtitle:"Open XML drawer",kind:"action",action:()=>{B(),n()}},{id:"import-xml",label:"Import XML",subtitle:"Import RibbonDiffXml from clipboard",kind:"action",action:()=>{M(),n()}},{id:"new-group",label:"New group",subtitle:"Create a new ribbon group in current tab",kind:"action",action:()=>{X(),n()}},{id:"new-button",label:"New button",subtitle:x?"Create a new button in selected/current group":"Select a tab/group with at least one group first",kind:"action",action:()=>{x&&(D(x),n())}},{id:"edit-labels",label:"Edit localized labels",subtitle:h?"Open localization editor for selected button":"Select a button first",kind:"action",action:()=>{h&&(T(h),n())}},{id:"toggle-theme",label:`Toggle theme (${v==="dark"?"Dark":"Light"})`,subtitle:"Switch between light and dark",kind:"action",action:()=>{H(v==="dark"?"light":"dark"),n()}},{id:"undo",label:"Undo",subtitle:"Ctrl+Z",kind:"action",action:()=>{P(),n()}},{id:"redo",label:"Redo",subtitle:"Ctrl+Shift+Z",kind:"action",action:()=>{W(),n()}}];if(e.push(...J),!s.startsWith("@")&&!s.startsWith("/")){const o=Object.entries(y).flatMap(([_,ee])=>ee.tabs.flatMap(j=>j.groups.flatMap(z=>z.buttons.map(k=>({id:`btn-${k.id}`,label:k.label||k.id,subtitle:`${_} → ${j.label} → ${z.label}`,kind:"button",action:()=>{n()}})))));e.push(...o.slice(0,20))}return O.forEach(o=>{e.push({id:`cmd-${o.id}`,label:o.id,subtitle:`${o.actions.length} action(s)`,kind:"command",action:()=>{L(o.id),n()}})}),G.forEach(o=>{e.push({id:`dr-${o.id}`,label:o.id,subtitle:`Display rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{N(o.id,"display"),n()}})}),V.forEach(o=>{e.push({id:`er-${o.id}`,label:o.id,subtitle:`Enable rule — ${o.steps.length} step(s)`,kind:"rule",action:()=>{N(o.id,"enable"),n()}})}),(s.startsWith("@")||!s)&&F.slice(0,30).forEach(o=>{e.push({id:`ent-${o.logicalName}`,label:o.displayName,subtitle:o.logicalName,kind:"entity",action:()=>{A(o),n()}})}),e},f=s.startsWith("@")||s.startsWith("/")?s.slice(1):s,I=Z(),p=f?I.filter(e=>e.label.toLowerCase().includes(f.toLowerCase())||(e.subtitle??"").toLowerCase().includes(f.toLowerCase())):I,q=e=>{e.key==="ArrowDown"?(e.preventDefault(),d(r=>Math.min(r+1,p.length-1))):e.key==="ArrowUp"?(e.preventDefault(),d(r=>Math.max(r-1,0))):e.key==="Enter"?p[g]?.action():e.key==="Escape"&&n()};return m?a.jsx("div",{className:l.backdrop,onClick:n,role:"presentation",children:a.jsxs("div",{className:l.palette,onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[a.jsxs("div",{className:l.searchRow,children:[a.jsx(te,{style:{color:t.colorNeutralForeground3,flexShrink:0}}),a.jsx("input",{ref:$,className:l.searchInput,value:s,onChange:e=>{C(e.target.value),d(0)},onKeyDown:q,placeholder:"Search commands, buttons, entities… Use @ for entities, / for actions","aria-label":"Command palette search"})]}),a.jsxs("div",{className:l.results,role:"listbox",children:[p.map((e,r)=>a.jsxs("div",{className:`${l.item} ${r===g?l.itemSelected:""}`,onClick:e.action,role:"option","aria-selected":r===g,onMouseEnter:()=>d(r),children:[a.jsx(ae,{appearance:"outline",size:"small",children:e.kind}),a.jsxs("div",{className:l.itemLabel,children:[a.jsx(S,{children:e.label}),e.subtitle&&a.jsx(S,{className:l.itemSub,block:!0,children:e.subtitle})]})]},e.id)),p.length===0&&a.jsx("div",{className:l.item,children:a.jsx(S,{style:{color:t.colorNeutralForeground3},children:"No results"})})]}),a.jsxs("div",{className:l.footer,children:[a.jsx("span",{children:"↑↓ navigate"}),a.jsx("span",{children:"↵ select"}),a.jsx("span",{children:"Esc close"}),a.jsx("span",{children:"@ entities"}),a.jsx("span",{children:"/ actions"})]})]})}):null};export{de as CommandPalette,de as default};
@@ -1 +1 @@
1
- import{cw as e,aw as k,b9 as C,bl as D,cx as B}from"./fluent-icons-DiKr_qRE.js";import{r as d}from"./monaco-BLZnQb2P.js";import{i as u,u as I}from"./index-G361fmC5.js";import{x as M,l as R,m as H,H as L,a as N,k as E,Q as a,a1 as o,u as x,w as h,G as F,B as z,V as O}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function $(){return window.dataverseAPI}function P(i){const l=i.map(s=>{const r=s.publisherid,c=s.versionnumber,m=typeof c=="number"?c:Number(c??0)||0;return{solutionId:String(s.solutionid??""),solutionName:String(s.friendlyname??s.uniquename??"Unknown Solution"),publisher:String(r?.friendlyname??r?.customizationprefix??"Unknown Publisher"),managed:!!s.ismanaged,importedOn:s.modifiedon?String(s.modifiedon):void 0,wins:!1,versionNumber:m}});return l.sort((s,r)=>s.versionNumber-r.versionNumber),l.length>0&&(l[l.length-1].wins=!0),l.map(({versionNumber:s,...r})=>r)}async function A(i){if(!i)return null;const r=(await $().getSolutions(["solutionid","friendlyname","uniquename","ismanaged","publisherid","versionnumber","modifiedon"])).value;return r.length<=1?null:{elementId:i,elementKind:"button",solutions:P(r)}}const W=B({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,padding:o.spacingHorizontalM,overflowY:"auto"},solutionRow:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalXS,padding:o.spacingHorizontalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},solutionRowWinner:{border:`2px solid ${o.colorBrandStroke1}`,backgroundColor:o.colorBrandBackground2},solutionHeader:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},elementId:{fontFamily:o.fontFamilyMonospace,fontSize:o.fontSizeBase200,backgroundColor:o.colorNeutralBackground4,padding:`2px ${o.spacingHorizontalXS}`,borderRadius:o.borderRadiusSmall,wordBreak:"break-all"}}),_=()=>{const i=W(),l=u(n=>n.conflictDrawerOpen),s=u(n=>n.conflictElementId),r=u(n=>n.closeConflictDrawer),c=u(n=>n.openXmlDrawer),m=I(n=>n.conflicts),[p,b]=d.useState(null),[j,f]=d.useState(!1),[w,g]=d.useState(null);d.useEffect(()=>{if(!l||!s){b(null),g(null),f(!1);return}let n=!1;return f(!0),g(null),A(s).then(t=>{n||b(t)}).catch(t=>{n||g(t instanceof Error?t.message:"Failed to load conflict layers")}).finally(()=>{n||f(!1)}),()=>{n=!0}},[l,s]);const v=m.filter(n=>n.elementId===s),y=d.useMemo(()=>p||v[0],[p,v]),S=y?[...y.solutions].sort((n,t)=>n.wins===t.wins?0:n.wins?1:-1):[];return e.jsxs(M,{className:i.drawer,open:l,position:"end",onOpenChange:(n,t)=>!t.open&&r(),children:[e.jsx(R,{children:e.jsx(H,{action:e.jsx(N,{appearance:"subtle",icon:e.jsx(k,{}),onClick:r,"aria-label":"Close"}),children:e.jsx(L,{children:"Solution Conflicts"})})}),e.jsx(E,{children:e.jsxs("div",{className:i.body,children:[s&&e.jsxs("div",{children:[e.jsx(a,{size:200,style:{color:o.colorNeutralForeground3},children:"Conflicting element:"}),e.jsx("div",{className:i.elementId,children:s})]}),e.jsx(x,{intent:"warning",children:e.jsx(h,{children:e.jsx(a,{size:200,children:"Multiple solutions customize this element. Dataverse applies them in solution import order — the most recently imported solution wins."})})}),e.jsx(x,{intent:"info",children:e.jsx(h,{children:e.jsxs(a,{size:200,children:[e.jsx("strong",{children:"To resolve:"})," Merge changes into one solution, or use solution layering to control evaluation order. Managed solutions appear as read-only layers — to resolve, merge the customization into your unmanaged solution."]})})}),j&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:o.spacingHorizontalM},children:e.jsx(F,{label:"Loading solution layers..."})}),w&&e.jsx(x,{intent:"error",children:e.jsx(h,{children:w})}),!j&&S.length===0&&e.jsx(a,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"No conflict details available from environment layers."}),S.map((n,t)=>e.jsxs("div",{className:`${i.solutionRow} ${n.wins?i.solutionRowWinner:""}`,children:[e.jsxs("div",{className:i.solutionHeader,children:[e.jsx(a,{weight:"semibold",children:n.solutionName}),n.wins&&e.jsx(z,{appearance:"filled",color:"brand",children:"WINS"}),n.managed&&e.jsx(O,{content:"Managed solution — read-only",relationship:"label",children:e.jsx(C,{style:{color:o.colorNeutralForeground3}})}),e.jsx(z,{appearance:"outline",size:"small",children:n.managed?"Managed":"Unmanaged"})]}),e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Publisher: ",n.publisher]}),n.importedOn&&e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Imported: ",new Date(n.importedOn).toLocaleString()]}),e.jsx("div",{style:{display:"flex",gap:o.spacingHorizontalS,flexWrap:"wrap"},children:e.jsx(N,{appearance:"subtle",size:"small",icon:e.jsx(D,{}),onClick:c,children:"View XML diff"})})]},`${n.solutionId}-${t}`))]})})]})};export{_ as ConflictDrawer,_ as default};
1
+ import{cw as e,aw as k,b9 as C,bl as D,cx as B}from"./fluent-icons-DiKr_qRE.js";import{r as d}from"./monaco-BLZnQb2P.js";import{i as u,u as I}from"./index-DjHxPFpB.js";import{x as M,l as R,m as H,H as L,a as N,k as E,Q as a,a1 as o,u as x,w as h,G as F,B as z,V as O}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function $(){return window.dataverseAPI}function P(i){const l=i.map(s=>{const r=s.publisherid,c=s.versionnumber,m=typeof c=="number"?c:Number(c??0)||0;return{solutionId:String(s.solutionid??""),solutionName:String(s.friendlyname??s.uniquename??"Unknown Solution"),publisher:String(r?.friendlyname??r?.customizationprefix??"Unknown Publisher"),managed:!!s.ismanaged,importedOn:s.modifiedon?String(s.modifiedon):void 0,wins:!1,versionNumber:m}});return l.sort((s,r)=>s.versionNumber-r.versionNumber),l.length>0&&(l[l.length-1].wins=!0),l.map(({versionNumber:s,...r})=>r)}async function A(i){if(!i)return null;const r=(await $().getSolutions(["solutionid","friendlyname","uniquename","ismanaged","publisherid","versionnumber","modifiedon"])).value;return r.length<=1?null:{elementId:i,elementKind:"button",solutions:P(r)}}const W=B({drawer:{width:"560px",maxWidth:"95vw"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,padding:o.spacingHorizontalM,overflowY:"auto"},solutionRow:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalXS,padding:o.spacingHorizontalS,border:`1px solid ${o.colorNeutralStroke2}`,borderRadius:o.borderRadiusMedium,backgroundColor:o.colorNeutralBackground2},solutionRowWinner:{border:`2px solid ${o.colorBrandStroke1}`,backgroundColor:o.colorBrandBackground2},solutionHeader:{display:"flex",alignItems:"center",gap:o.spacingHorizontalS},elementId:{fontFamily:o.fontFamilyMonospace,fontSize:o.fontSizeBase200,backgroundColor:o.colorNeutralBackground4,padding:`2px ${o.spacingHorizontalXS}`,borderRadius:o.borderRadiusSmall,wordBreak:"break-all"}}),_=()=>{const i=W(),l=u(n=>n.conflictDrawerOpen),s=u(n=>n.conflictElementId),r=u(n=>n.closeConflictDrawer),c=u(n=>n.openXmlDrawer),m=I(n=>n.conflicts),[p,b]=d.useState(null),[j,f]=d.useState(!1),[w,g]=d.useState(null);d.useEffect(()=>{if(!l||!s){b(null),g(null),f(!1);return}let n=!1;return f(!0),g(null),A(s).then(t=>{n||b(t)}).catch(t=>{n||g(t instanceof Error?t.message:"Failed to load conflict layers")}).finally(()=>{n||f(!1)}),()=>{n=!0}},[l,s]);const v=m.filter(n=>n.elementId===s),y=d.useMemo(()=>p||v[0],[p,v]),S=y?[...y.solutions].sort((n,t)=>n.wins===t.wins?0:n.wins?1:-1):[];return e.jsxs(M,{className:i.drawer,open:l,position:"end",onOpenChange:(n,t)=>!t.open&&r(),children:[e.jsx(R,{children:e.jsx(H,{action:e.jsx(N,{appearance:"subtle",icon:e.jsx(k,{}),onClick:r,"aria-label":"Close"}),children:e.jsx(L,{children:"Solution Conflicts"})})}),e.jsx(E,{children:e.jsxs("div",{className:i.body,children:[s&&e.jsxs("div",{children:[e.jsx(a,{size:200,style:{color:o.colorNeutralForeground3},children:"Conflicting element:"}),e.jsx("div",{className:i.elementId,children:s})]}),e.jsx(x,{intent:"warning",children:e.jsx(h,{children:e.jsx(a,{size:200,children:"Multiple solutions customize this element. Dataverse applies them in solution import order — the most recently imported solution wins."})})}),e.jsx(x,{intent:"info",children:e.jsx(h,{children:e.jsxs(a,{size:200,children:[e.jsx("strong",{children:"To resolve:"})," Merge changes into one solution, or use solution layering to control evaluation order. Managed solutions appear as read-only layers — to resolve, merge the customization into your unmanaged solution."]})})}),j&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:o.spacingHorizontalM},children:e.jsx(F,{label:"Loading solution layers..."})}),w&&e.jsx(x,{intent:"error",children:e.jsx(h,{children:w})}),!j&&S.length===0&&e.jsx(a,{style:{color:o.colorNeutralForeground3,textAlign:"center"},children:"No conflict details available from environment layers."}),S.map((n,t)=>e.jsxs("div",{className:`${i.solutionRow} ${n.wins?i.solutionRowWinner:""}`,children:[e.jsxs("div",{className:i.solutionHeader,children:[e.jsx(a,{weight:"semibold",children:n.solutionName}),n.wins&&e.jsx(z,{appearance:"filled",color:"brand",children:"WINS"}),n.managed&&e.jsx(O,{content:"Managed solution — read-only",relationship:"label",children:e.jsx(C,{style:{color:o.colorNeutralForeground3}})}),e.jsx(z,{appearance:"outline",size:"small",children:n.managed?"Managed":"Unmanaged"})]}),e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Publisher: ",n.publisher]}),n.importedOn&&e.jsxs(a,{size:200,style:{color:o.colorNeutralForeground3},children:["Imported: ",new Date(n.importedOn).toLocaleString()]}),e.jsx("div",{style:{display:"flex",gap:o.spacingHorizontalS,flexWrap:"wrap"},children:e.jsx(N,{appearance:"subtle",size:"small",icon:e.jsx(D,{}),onClick:c,children:"View XML diff"})})]},`${n.solutionId}-${t}`))]})})]})};export{_ as ConflictDrawer,_ as default};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-BLZnQb2P.js","assets/monaco-Dvl_Svmm.css"])))=>i.map(i=>d[i]);
2
- import{b as g,r as b,_ as M}from"./monaco-BLZnQb2P.js";import{cw as s,aw as E,cx as C}from"./fluent-icons-DiKr_qRE.js";import{i as x,u as m}from"./index-G361fmC5.js";import{g as N}from"./xmlGenerator-DEaVrfZJ.js";import{x as O,l as _,m as V,H as $,a as S,k as X,u as I,w as G,Q as T,B as D,G as A,a1 as r}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const P=g.lazy(()=>M(()=>import("./monaco-BLZnQb2P.js").then(n=>n.i),__vite__mapDeps([0,1])).then(n=>({default:n.DiffEditor}))),W=["HomepageGrid","SubGrid","Form","Application"],U=C({drawer:{},body:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,overflow:"hidden",gap:r.spacingHorizontalS},statsBar:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,flexShrink:0},toggleRow:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,borderBottom:`1px solid ${r.colorNeutralStroke2}`,flexShrink:0},editorWrap:{flex:1,height:0,minHeight:"400px",overflow:"hidden",position:"relative"}});function F(n,o){const l=n.split(`
2
+ import{b as g,r as b,_ as M}from"./monaco-BLZnQb2P.js";import{cw as s,aw as E,cx as C}from"./fluent-icons-DiKr_qRE.js";import{i as x,u as m}from"./index-DjHxPFpB.js";import{g as N}from"./xmlGenerator-DEaVrfZJ.js";import{x as O,l as _,m as V,H as $,a as S,k as X,u as I,w as G,Q as T,B as D,G as A,a1 as r}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const P=g.lazy(()=>M(()=>import("./monaco-BLZnQb2P.js").then(n=>n.i),__vite__mapDeps([0,1])).then(n=>({default:n.DiffEditor}))),W=["HomepageGrid","SubGrid","Form","Application"],U=C({drawer:{},body:{display:"flex",flexDirection:"column",flex:"1 1 auto",minHeight:0,overflow:"hidden",gap:r.spacingHorizontalS},statsBar:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,flexShrink:0},toggleRow:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingVerticalXS} ${r.spacingHorizontalM}`,borderBottom:`1px solid ${r.colorNeutralStroke2}`,flexShrink:0},editorWrap:{flex:1,height:0,minHeight:"400px",overflow:"hidden",position:"relative"}});function F(n,o){const l=n.split(`
3
3
  `),c=o.split(`
4
4
  `);let d=0,t=0;const f=new Set(l),a=new Set(c);for(const i of c)f.has(i)||d++;for(const i of l)a.has(i)||t++;return{added:d,removed:t}}function B(n,o,l,c,d,t,f){const a=[];for(const i of W){const p=f?o[i]:n[i],u=o[i];try{a.push(`<!-- ${i} -->
5
5
  `+N({location:i,current:p,baseline:u,commands:l,displayRules:c,enableRules:d,locLabels:t,entityLogicalName:p.entityLogicalName}))}catch(h){a.push(`<!-- ${i}: Error generating XML: ${String(h)} -->`)}}return a.join(`
@@ -1 +1 @@
1
- import{cw as o,aw as re,bL as E,ad as ae,cx as se}from"./fluent-icons-DiKr_qRE.js";import{r as t,b as te}from"./monaco-BLZnQb2P.js";import{i as M,u as ne,e as C,h as ie,F as le,d as ce,f as de}from"./index-G361fmC5.js";import{b as U,s as G,p as ue}from"./webResourceService-Ck07E3GN.js";import{d as ge,h as pe,f as he,i as me,H as be,a as k,g as ye,K as fe,T as L,I as F,b as we,O as xe,J as Se,a1 as r,Q as y,B as Ce,e as ke}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function _(s){return s.replace(/([A-Z])/g,(n,i,c)=>(c>0?"_":"")+n.toLowerCase())}function ve(s){const n=new TextEncoder().encode(s);let i="";for(let c=0;c<n.length;c++)i+=String.fromCharCode(n[c]);return btoa(i)}const je=[{category:"Actions",keywords:["Add","Delete","Edit","Save","Copy","Paste","Undo","Redo","Send","Print","Refresh"]},{category:"Communication",keywords:["Mail","Chat","Phone","Call","Message"]},{category:"Navigation",keywords:["Arrow","Chevron","Navigation","Home","Back","Forward"]},{category:"System",keywords:["Settings","Info","Warning","Dismiss","Question","Checkmark","Error"]},{category:"Security",keywords:["Lock","Shield","Key","Fingerprint"]},{category:"People",keywords:["Person","People","Contact","User"]},{category:"Business",keywords:["Building","Briefcase","Money","Credit","Cart","Tag","Receipt"]},{category:"Files",keywords:["Document","Folder","Attach","Upload","Download","File"]},{category:"Web",keywords:["Globe","Link","Open","Browser","World"]},{category:"Time",keywords:["Calendar","Clock","Timer","History"]},{category:"Rating",keywords:["Star","Heart","Thumb"]},{category:"View",keywords:["Eye","Zoom","View","Window","Preview"]},{category:"Layout",keywords:["Grid","List","Table","Panel","Column","Row"]},{category:"Development",keywords:["Code","Bug","Branch","Wrench","Tool","Terminal"]},{category:"Media",keywords:["Play","Pause","Stop","Video","Audio","Camera"]},{category:"Analytics",keywords:["Chart","Data","Poll","Graph","Trend"]}],Re=["Add","Delete","Edit","Save","Copy","Cut","ClipboardPaste","Share","Mail","Chat","Phone","Search","Filter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","ChevronDown","ChevronUp","Navigation","Home","Settings","Info","Warning","Checkmark","Dismiss","QuestionCircle","LockClosed","LockOpen","Shield","Person","People","PersonAdd","Building","Briefcase","Money","CreditCard","Cart","Tag","Document","DocumentBulletList","Folder","FolderOpen","Attach","ArrowDownload","ArrowUpload","Globe","Link","Open","Calendar","Clock","Timer","Star","Heart","ThumbLike","ThumbDislike","Eye","EyeOff","ZoomIn","ZoomOut","Maximize","Minimize","Grid","List","Table","TableSimple","Code","Bug","Play","Pause","Stop","Refresh","ArrowSync","ArrowUndo","ArrowRedo","Printer","Send","Rocket","Sparkle","Trophy","Lightbulb","Bot","DataBar","ChartMultiple","Poll"];function Be(s){for(const n of je)if(n.keywords.some(i=>s.includes(i)))return n.category;return"General"}const O=Re.map(s=>({name:s,category:Be(s)})),Ae=["All",...Array.from(new Set(O.map(s=>s.category))).sort()],Ie=se({surface:{width:"720px",maxWidth:"95vw",height:"min(580px, 90vh)",maxHeight:"90vh",overflow:"hidden"},dialogBody:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},body:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflow:"hidden",gap:r.spacingHorizontalS},toolbar:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,flexWrap:"wrap",flexShrink:0},categoryPicker:{minWidth:"180px",maxWidth:"220px"},iconGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(72px, 1fr))",gap:r.spacingHorizontalXS,overflowY:"auto",flex:1,minHeight:0,padding:r.spacingHorizontalXS},iconTile:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px",padding:r.spacingHorizontalXS,borderRadius:r.borderRadiusMedium,border:"1px solid transparent",cursor:"pointer",minHeight:"64px",":hover":{backgroundColor:r.colorNeutralBackground3,border:`1px solid ${r.colorNeutralStroke1}`}},iconTileSelected:{backgroundColor:r.colorBrandBackground2,border:`1px solid ${r.colorBrandStroke1}`},iconLabel:{fontSize:r.fontSizeBase100,textAlign:"center",lineHeight:1.2,wordBreak:"break-word",color:r.colorNeutralForeground2},webResourceList:{flex:1,overflowY:"auto"},webResourceRow:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingHorizontalXS} ${r.spacingHorizontalS}`,cursor:"pointer",borderRadius:r.borderRadiusMedium,":hover":{backgroundColor:r.colorNeutralBackground3}},uploadArea:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:r.spacingHorizontalM,border:`2px dashed ${r.colorNeutralStroke2}`,borderRadius:r.borderRadiusMedium,color:r.colorNeutralForeground3}}),$e=()=>{const s=Ie(),n=M(e=>e.iconPickerOpen),i=M(e=>e.closeIconPicker),c=ne(e=>e.setButtonProp),f=C(e=>e.selectedButtonId),w=C(e=>e.selectedGroupId),v=C(e=>e.tabId),j=C(e=>e.location),D=ie(e=>e.publisherPrefix),[d,$]=t.useState("fluent"),[R,V]=t.useState(""),[x,X]=t.useState("All"),[B,Z]=t.useState("regular"),[l,Q]=t.useState(null),[b,A]=t.useState(""),[z,I]=t.useState([]),[H,W]=t.useState(!1),[T,Y]=t.useState(""),[P,S]=t.useState(!1);te.useEffect(()=>{!n||d!=="webresource"||(W(!0),U("svg").then(e=>I(e)).catch(()=>I([])).finally(()=>W(!1)))},[n,d]);const q=t.useMemo(()=>{const e=T.toLowerCase();return z.filter(a=>!e||a.name.toLowerCase().includes(e))},[T,z]),K=t.useMemo(()=>{const e=R.toLowerCase();return O.filter(a=>(x==="All"||a.category===x)&&(e===""||a.name.toLowerCase().includes(e)))},[R,x]),J=async()=>{if(!l||!f||!w)return;const e=D||"new",a=_(l),u=ce.getState();S(!0);try{const g=await de(l,32);if(!g)throw new Error(`Could not serialize Fluent icon "${l}"`);const p=`${e}_/icons/${a}.svg`,N=ve(g),{id:h}=await G(p,N,11,`${a}.svg`);try{await ue(h)}catch(m){u.logWarn("webresource",`Created icon web resource ${p} but publish failed: ${m instanceof Error?m.message:String(m)}. It will publish with the next Publish.`)}c(j,v,w,f,{icon:a,image16:`$webresource:${p}`,image32:`$webresource:${p}`}),u.logInfo("webresource",`Icon web resource ready: ${p}`)}catch(g){u.logWarn("webresource",`Fluent icon "${l}" could not be uploaded as a web resource (${g instanceof Error?g.message:String(g)}). Using preview-only; add a real icon via the Web resource tab.`),c(j,v,w,f,{icon:a,image16:void 0,image32:void 0})}finally{S(!1),i()}},ee=()=>{!b||!f||!w||(c(j,v,w,f,{image16:b,image32:b}),i())},oe=async e=>{S(!0);try{const a=await new Promise((p,N)=>{const h=new FileReader;h.onerror=()=>N(h.error??new Error("Failed to read SVG")),h.onload=()=>{const m=String(h.result??"");p(m.includes(",")?m.split(",")[1]??"":m)},h.readAsDataURL(e)}),u=`${D??"new"}_/icons/${e.name}`;await G(u,a,11,e.name),A(`$webresource:${u}`),$("webresource");const g=await U("svg");I(g)}finally{S(!1)}};return o.jsx(ge,{open:n,onOpenChange:(e,a)=>!a.open&&i(),children:o.jsx(pe,{className:s.surface,children:o.jsxs(he,{className:s.dialogBody,children:[o.jsx(me,{action:o.jsx(k,{appearance:"subtle",icon:o.jsx(re,{}),onClick:i,"aria-label":"Close"}),children:o.jsx(be,{children:"Choose Icon"})}),o.jsxs(ye,{className:s.body,children:[o.jsxs(fe,{selectedValue:d,onTabSelect:(e,a)=>$(a.value),size:"small",children:[o.jsx(L,{value:"fluent",children:"Fluent icons"}),o.jsx(L,{value:"webresource",children:"Web resources"}),o.jsx(L,{value:"upload",children:"Upload SVG"})]}),d==="fluent"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:s.toolbar,children:[o.jsx(F,{contentBefore:o.jsx(E,{}),placeholder:"Search icons…",value:R,onChange:(e,a)=>V(a.value),size:"small",style:{flex:1}}),o.jsx(we,{className:s.categoryPicker,placeholder:"Category",value:x,onOptionSelect:(e,a)=>X(String(a.optionValue??"All")),children:Ae.map(e=>o.jsx(xe,{value:e,text:e,children:e},e))}),o.jsx(Se,{label:B==="regular"?"Regular":"Filled",checked:B==="filled",onChange:(e,a)=>Z(a.checked?"filled":"regular")})]}),o.jsx("div",{className:s.iconGrid,children:K.map(e=>o.jsxs("div",{className:`${s.iconTile} ${l===e.name?s.iconTileSelected:""}`,onClick:()=>Q(e.name),role:"option","aria-selected":l===e.name,title:`${e.name} — ${e.category}`,children:[o.jsx(le,{name:_(e.name),size:24,variant:B}),o.jsx("span",{className:s.iconLabel,children:e.name})]},e.name))}),l&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:r.spacingHorizontalXS,backgroundColor:r.colorNeutralBackground3,borderRadius:r.borderRadiusMedium,flexShrink:0},children:[o.jsxs(y,{size:200,style:{fontFamily:r.fontFamilyMonospace},children:['ModernImage="',l,'"']}),o.jsx(Ce,{appearance:"tint",color:"success",children:"Selected"})]})]}),d==="webresource"&&o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:r.spacingHorizontalS,flex:1},children:[o.jsx(F,{contentBefore:o.jsx(E,{}),placeholder:"Search SVG web resources...",value:T,onChange:(e,a)=>Y(a.value),size:"small"}),o.jsxs("div",{className:s.webResourceList,children:[H&&o.jsx(y,{size:200,style:{color:r.colorNeutralForeground3},children:"Loading web resources..."}),!H&&q.slice(0,200).map(e=>{const a=`$webresource:${e.name}`,u=b===a;return o.jsx("div",{className:s.webResourceRow,onClick:()=>A(a),style:{backgroundColor:u?r.colorBrandBackground2:void 0},children:o.jsx(y,{size:200,style:{fontFamily:r.fontFamilyMonospace},children:a})},e.id)})]}),o.jsx(F,{placeholder:"$webresource:publisher_/icons/…",value:b,onChange:(e,a)=>A(a.value)}),o.jsx(y,{size:100,style:{color:r.colorNeutralForeground3},children:"Both image16 and image32 will be set to this path. Use SVG for best results across all DPI levels."})]}),d==="upload"&&o.jsxs("div",{className:s.uploadArea,children:[o.jsx(ae,{fontSize:48,style:{opacity:.4}}),o.jsx(y,{children:"Drag an SVG file here, or click to browse"}),o.jsx(y,{size:200,style:{color:r.colorNeutralForeground3},children:"The file will be uploaded as a web resource in the active solution."}),o.jsx("input",{type:"file",accept:".svg",style:{display:"none"},id:"icon-upload-input",onChange:e=>{const a=e.target.files?.[0];a&&oe(a)}}),o.jsx("label",{htmlFor:"icon-upload-input",style:{display:"inline-block",cursor:"pointer",padding:"6px 12px",background:r.colorBrandBackground,color:r.colorNeutralForegroundOnBrand,borderRadius:r.borderRadiusMedium,fontSize:r.fontSizeBase300},children:P?"Uploading...":"Browse for SVG"})]})]}),o.jsxs(ke,{children:[o.jsx(k,{appearance:"secondary",onClick:i,children:"Cancel"}),d==="fluent"&&o.jsx(k,{appearance:"primary",disabled:!l||P,onClick:()=>{J()},children:P?"Adding icon…":`Use ${l??"icon"}`}),d==="webresource"&&o.jsx(k,{appearance:"primary",disabled:!b,onClick:ee,children:"Use web resource"})]})]})})})};export{$e as IconPickerModal,$e as default};
1
+ import{cw as o,aw as re,bL as E,ad as ae,cx as se}from"./fluent-icons-DiKr_qRE.js";import{r as t,b as te}from"./monaco-BLZnQb2P.js";import{i as M,u as ne,e as C,h as ie,F as le,d as ce,f as de}from"./index-DjHxPFpB.js";import{b as U,s as G,p as ue}from"./webResourceService-Ck07E3GN.js";import{d as ge,h as pe,f as he,i as me,H as be,a as k,g as ye,K as fe,T as L,I as F,b as we,O as xe,J as Se,a1 as r,Q as y,B as Ce,e as ke}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function _(s){return s.replace(/([A-Z])/g,(n,i,c)=>(c>0?"_":"")+n.toLowerCase())}function ve(s){const n=new TextEncoder().encode(s);let i="";for(let c=0;c<n.length;c++)i+=String.fromCharCode(n[c]);return btoa(i)}const je=[{category:"Actions",keywords:["Add","Delete","Edit","Save","Copy","Paste","Undo","Redo","Send","Print","Refresh"]},{category:"Communication",keywords:["Mail","Chat","Phone","Call","Message"]},{category:"Navigation",keywords:["Arrow","Chevron","Navigation","Home","Back","Forward"]},{category:"System",keywords:["Settings","Info","Warning","Dismiss","Question","Checkmark","Error"]},{category:"Security",keywords:["Lock","Shield","Key","Fingerprint"]},{category:"People",keywords:["Person","People","Contact","User"]},{category:"Business",keywords:["Building","Briefcase","Money","Credit","Cart","Tag","Receipt"]},{category:"Files",keywords:["Document","Folder","Attach","Upload","Download","File"]},{category:"Web",keywords:["Globe","Link","Open","Browser","World"]},{category:"Time",keywords:["Calendar","Clock","Timer","History"]},{category:"Rating",keywords:["Star","Heart","Thumb"]},{category:"View",keywords:["Eye","Zoom","View","Window","Preview"]},{category:"Layout",keywords:["Grid","List","Table","Panel","Column","Row"]},{category:"Development",keywords:["Code","Bug","Branch","Wrench","Tool","Terminal"]},{category:"Media",keywords:["Play","Pause","Stop","Video","Audio","Camera"]},{category:"Analytics",keywords:["Chart","Data","Poll","Graph","Trend"]}],Re=["Add","Delete","Edit","Save","Copy","Cut","ClipboardPaste","Share","Mail","Chat","Phone","Search","Filter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","ChevronDown","ChevronUp","Navigation","Home","Settings","Info","Warning","Checkmark","Dismiss","QuestionCircle","LockClosed","LockOpen","Shield","Person","People","PersonAdd","Building","Briefcase","Money","CreditCard","Cart","Tag","Document","DocumentBulletList","Folder","FolderOpen","Attach","ArrowDownload","ArrowUpload","Globe","Link","Open","Calendar","Clock","Timer","Star","Heart","ThumbLike","ThumbDislike","Eye","EyeOff","ZoomIn","ZoomOut","Maximize","Minimize","Grid","List","Table","TableSimple","Code","Bug","Play","Pause","Stop","Refresh","ArrowSync","ArrowUndo","ArrowRedo","Printer","Send","Rocket","Sparkle","Trophy","Lightbulb","Bot","DataBar","ChartMultiple","Poll"];function Be(s){for(const n of je)if(n.keywords.some(i=>s.includes(i)))return n.category;return"General"}const O=Re.map(s=>({name:s,category:Be(s)})),Ae=["All",...Array.from(new Set(O.map(s=>s.category))).sort()],Ie=se({surface:{width:"720px",maxWidth:"95vw",height:"min(580px, 90vh)",maxHeight:"90vh",overflow:"hidden"},dialogBody:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},body:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflow:"hidden",gap:r.spacingHorizontalS},toolbar:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,flexWrap:"wrap",flexShrink:0},categoryPicker:{minWidth:"180px",maxWidth:"220px"},iconGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(72px, 1fr))",gap:r.spacingHorizontalXS,overflowY:"auto",flex:1,minHeight:0,padding:r.spacingHorizontalXS},iconTile:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"4px",padding:r.spacingHorizontalXS,borderRadius:r.borderRadiusMedium,border:"1px solid transparent",cursor:"pointer",minHeight:"64px",":hover":{backgroundColor:r.colorNeutralBackground3,border:`1px solid ${r.colorNeutralStroke1}`}},iconTileSelected:{backgroundColor:r.colorBrandBackground2,border:`1px solid ${r.colorBrandStroke1}`},iconLabel:{fontSize:r.fontSizeBase100,textAlign:"center",lineHeight:1.2,wordBreak:"break-word",color:r.colorNeutralForeground2},webResourceList:{flex:1,overflowY:"auto"},webResourceRow:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:`${r.spacingHorizontalXS} ${r.spacingHorizontalS}`,cursor:"pointer",borderRadius:r.borderRadiusMedium,":hover":{backgroundColor:r.colorNeutralBackground3}},uploadArea:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:r.spacingHorizontalM,border:`2px dashed ${r.colorNeutralStroke2}`,borderRadius:r.borderRadiusMedium,color:r.colorNeutralForeground3}}),$e=()=>{const s=Ie(),n=M(e=>e.iconPickerOpen),i=M(e=>e.closeIconPicker),c=ne(e=>e.setButtonProp),f=C(e=>e.selectedButtonId),w=C(e=>e.selectedGroupId),v=C(e=>e.tabId),j=C(e=>e.location),D=ie(e=>e.publisherPrefix),[d,$]=t.useState("fluent"),[R,V]=t.useState(""),[x,X]=t.useState("All"),[B,Z]=t.useState("regular"),[l,Q]=t.useState(null),[b,A]=t.useState(""),[z,I]=t.useState([]),[H,W]=t.useState(!1),[T,Y]=t.useState(""),[P,S]=t.useState(!1);te.useEffect(()=>{!n||d!=="webresource"||(W(!0),U("svg").then(e=>I(e)).catch(()=>I([])).finally(()=>W(!1)))},[n,d]);const q=t.useMemo(()=>{const e=T.toLowerCase();return z.filter(a=>!e||a.name.toLowerCase().includes(e))},[T,z]),K=t.useMemo(()=>{const e=R.toLowerCase();return O.filter(a=>(x==="All"||a.category===x)&&(e===""||a.name.toLowerCase().includes(e)))},[R,x]),J=async()=>{if(!l||!f||!w)return;const e=D||"new",a=_(l),u=ce.getState();S(!0);try{const g=await de(l,32);if(!g)throw new Error(`Could not serialize Fluent icon "${l}"`);const p=`${e}_/icons/${a}.svg`,N=ve(g),{id:h}=await G(p,N,11,`${a}.svg`);try{await ue(h)}catch(m){u.logWarn("webresource",`Created icon web resource ${p} but publish failed: ${m instanceof Error?m.message:String(m)}. It will publish with the next Publish.`)}c(j,v,w,f,{icon:a,image16:`$webresource:${p}`,image32:`$webresource:${p}`}),u.logInfo("webresource",`Icon web resource ready: ${p}`)}catch(g){u.logWarn("webresource",`Fluent icon "${l}" could not be uploaded as a web resource (${g instanceof Error?g.message:String(g)}). Using preview-only; add a real icon via the Web resource tab.`),c(j,v,w,f,{icon:a,image16:void 0,image32:void 0})}finally{S(!1),i()}},ee=()=>{!b||!f||!w||(c(j,v,w,f,{image16:b,image32:b}),i())},oe=async e=>{S(!0);try{const a=await new Promise((p,N)=>{const h=new FileReader;h.onerror=()=>N(h.error??new Error("Failed to read SVG")),h.onload=()=>{const m=String(h.result??"");p(m.includes(",")?m.split(",")[1]??"":m)},h.readAsDataURL(e)}),u=`${D??"new"}_/icons/${e.name}`;await G(u,a,11,e.name),A(`$webresource:${u}`),$("webresource");const g=await U("svg");I(g)}finally{S(!1)}};return o.jsx(ge,{open:n,onOpenChange:(e,a)=>!a.open&&i(),children:o.jsx(pe,{className:s.surface,children:o.jsxs(he,{className:s.dialogBody,children:[o.jsx(me,{action:o.jsx(k,{appearance:"subtle",icon:o.jsx(re,{}),onClick:i,"aria-label":"Close"}),children:o.jsx(be,{children:"Choose Icon"})}),o.jsxs(ye,{className:s.body,children:[o.jsxs(fe,{selectedValue:d,onTabSelect:(e,a)=>$(a.value),size:"small",children:[o.jsx(L,{value:"fluent",children:"Fluent icons"}),o.jsx(L,{value:"webresource",children:"Web resources"}),o.jsx(L,{value:"upload",children:"Upload SVG"})]}),d==="fluent"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:s.toolbar,children:[o.jsx(F,{contentBefore:o.jsx(E,{}),placeholder:"Search icons…",value:R,onChange:(e,a)=>V(a.value),size:"small",style:{flex:1}}),o.jsx(we,{className:s.categoryPicker,placeholder:"Category",value:x,onOptionSelect:(e,a)=>X(String(a.optionValue??"All")),children:Ae.map(e=>o.jsx(xe,{value:e,text:e,children:e},e))}),o.jsx(Se,{label:B==="regular"?"Regular":"Filled",checked:B==="filled",onChange:(e,a)=>Z(a.checked?"filled":"regular")})]}),o.jsx("div",{className:s.iconGrid,children:K.map(e=>o.jsxs("div",{className:`${s.iconTile} ${l===e.name?s.iconTileSelected:""}`,onClick:()=>Q(e.name),role:"option","aria-selected":l===e.name,title:`${e.name} — ${e.category}`,children:[o.jsx(le,{name:_(e.name),size:24,variant:B}),o.jsx("span",{className:s.iconLabel,children:e.name})]},e.name))}),l&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:r.spacingHorizontalS,padding:r.spacingHorizontalXS,backgroundColor:r.colorNeutralBackground3,borderRadius:r.borderRadiusMedium,flexShrink:0},children:[o.jsxs(y,{size:200,style:{fontFamily:r.fontFamilyMonospace},children:['ModernImage="',l,'"']}),o.jsx(Ce,{appearance:"tint",color:"success",children:"Selected"})]})]}),d==="webresource"&&o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:r.spacingHorizontalS,flex:1},children:[o.jsx(F,{contentBefore:o.jsx(E,{}),placeholder:"Search SVG web resources...",value:T,onChange:(e,a)=>Y(a.value),size:"small"}),o.jsxs("div",{className:s.webResourceList,children:[H&&o.jsx(y,{size:200,style:{color:r.colorNeutralForeground3},children:"Loading web resources..."}),!H&&q.slice(0,200).map(e=>{const a=`$webresource:${e.name}`,u=b===a;return o.jsx("div",{className:s.webResourceRow,onClick:()=>A(a),style:{backgroundColor:u?r.colorBrandBackground2:void 0},children:o.jsx(y,{size:200,style:{fontFamily:r.fontFamilyMonospace},children:a})},e.id)})]}),o.jsx(F,{placeholder:"$webresource:publisher_/icons/…",value:b,onChange:(e,a)=>A(a.value)}),o.jsx(y,{size:100,style:{color:r.colorNeutralForeground3},children:"Both image16 and image32 will be set to this path. Use SVG for best results across all DPI levels."})]}),d==="upload"&&o.jsxs("div",{className:s.uploadArea,children:[o.jsx(ae,{fontSize:48,style:{opacity:.4}}),o.jsx(y,{children:"Drag an SVG file here, or click to browse"}),o.jsx(y,{size:200,style:{color:r.colorNeutralForeground3},children:"The file will be uploaded as a web resource in the active solution."}),o.jsx("input",{type:"file",accept:".svg",style:{display:"none"},id:"icon-upload-input",onChange:e=>{const a=e.target.files?.[0];a&&oe(a)}}),o.jsx("label",{htmlFor:"icon-upload-input",style:{display:"inline-block",cursor:"pointer",padding:"6px 12px",background:r.colorBrandBackground,color:r.colorNeutralForegroundOnBrand,borderRadius:r.borderRadiusMedium,fontSize:r.fontSizeBase300},children:P?"Uploading...":"Browse for SVG"})]})]}),o.jsxs(ke,{children:[o.jsx(k,{appearance:"secondary",onClick:i,children:"Cancel"}),d==="fluent"&&o.jsx(k,{appearance:"primary",disabled:!l||P,onClick:()=>{J()},children:P?"Adding icon…":`Use ${l??"icon"}`}),d==="webresource"&&o.jsx(k,{appearance:"primary",disabled:!b,onClick:ee,children:"Use web resource"})]})]})})})};export{$e as IconPickerModal,$e as default};
@@ -1,3 +1,3 @@
1
- import{cw as s}from"./fluent-icons-DiKr_qRE.js";import{r as g}from"./monaco-BLZnQb2P.js";import{i as A,u as j,e as C}from"./index-G361fmC5.js";import{M as $}from"./MonacoEditor-5dvTziHE.js";import{d as v,h as T,i as w,f as O,g as H,K as M,T as S,j as X,u as I,w as R,e as k,a as y}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function h(i,p){const l=i.indexOf(p);return l<0?void 0:`Line ${i.slice(0,l).split(/\r?\n/).length}`}function B(i,p,l){const c=[],a=new DOMParser().parseFromString(i,"application/xml"),r=a.querySelector("parsererror");if(r){const n=r.textContent?.trim()??"Unknown",e=n.match(/line\s+(\d+)/i);return c.push({message:`XML parse error: ${n}`,lineHint:e?`Line ${e[1]}`:void 0}),c}const o=new Set([]);a.querySelectorAll("[Id]").forEach(n=>{const e=n.getAttribute("Id")??"";if(/\s/.test(e)){const t=h(i,`Id="${e}"`);c.push({message:`Element ID "${e}" contains invalid whitespace characters`,elementId:e,lineHint:t})}}),a.querySelectorAll("[LabelText]").forEach(n=>{const e=n.getAttribute("LabelText")??"",t=e.match(/^\$LocLabels:(.+)$/);if(t&&o.size>0&&!o.has(t[1])){const d=n.getAttribute("Id")??"",m=h(i,d?`Id="${d}"`:`LabelText="${e}"`);c.push({message:`Button label reference "$LocLabels:${t[1]}" has no matching LocLabel entry`,elementId:d||void 0,lineHint:m})}}),(i.includes("& ")||i.includes(`&
1
+ import{cw as s}from"./fluent-icons-DiKr_qRE.js";import{r as g}from"./monaco-BLZnQb2P.js";import{i as A,u as j,e as C}from"./index-DjHxPFpB.js";import{M as $}from"./MonacoEditor-DFYisBG6.js";import{d as v,h as T,i as w,f as O,g as H,K as M,T as S,j as X,u as I,w as R,e as k,a as y}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";function h(i,p){const l=i.indexOf(p);return l<0?void 0:`Line ${i.slice(0,l).split(/\r?\n/).length}`}function B(i,p,l){const c=[],a=new DOMParser().parseFromString(i,"application/xml"),r=a.querySelector("parsererror");if(r){const n=r.textContent?.trim()??"Unknown",e=n.match(/line\s+(\d+)/i);return c.push({message:`XML parse error: ${n}`,lineHint:e?`Line ${e[1]}`:void 0}),c}const o=new Set([]);a.querySelectorAll("[Id]").forEach(n=>{const e=n.getAttribute("Id")??"";if(/\s/.test(e)){const t=h(i,`Id="${e}"`);c.push({message:`Element ID "${e}" contains invalid whitespace characters`,elementId:e,lineHint:t})}}),a.querySelectorAll("[LabelText]").forEach(n=>{const e=n.getAttribute("LabelText")??"",t=e.match(/^\$LocLabels:(.+)$/);if(t&&o.size>0&&!o.has(t[1])){const d=n.getAttribute("Id")??"",m=h(i,d?`Id="${d}"`:`LabelText="${e}"`);c.push({message:`Button label reference "$LocLabels:${t[1]}" has no matching LocLabel entry`,elementId:d||void 0,lineHint:m})}}),(i.includes("& ")||i.includes(`&
2
2
  `))&&c.push({message:'URL may contain an unescaped "&" — all ampersands in XML must be written as &amp;',lineHint:h(i,"& ")??h(i,`&
3
3
  `)}),a.querySelectorAll("Group").forEach(n=>{const e=[];n.querySelectorAll(":scope > Controls > Button, :scope > Controls > FlyoutAnchor, :scope > Controls > SplitButton").forEach(t=>{const d=parseInt(t.getAttribute("Sequence")??"0",10);if(e.includes(d)){const m=n.getAttribute("Id")??"?";c.push({message:`Two elements share Sequence "${d}" in group "${m}"`,elementId:m,lineHint:h(i,`Sequence="${d}"`)})}e.push(d)})});const u=new Set(["EntityPrivilegeRule","EntityPropertyRule","DeviceTypeRule","OptionSetRule","CrmOutlookClientVersionRule"]);return a.querySelectorAll("EnableRules > EnableRule").forEach(n=>{const e=n.getAttribute("Id")??"";u.forEach(t=>{n.querySelector(t)&&c.push({message:`Enable rule "${e}" contains "${t}" which is only valid in DisplayRules per the schema`,elementId:e,lineHint:h(i,`<${t}`)})})}),a.querySelectorAll("OrRule").forEach(n=>{const e=n.querySelectorAll(":scope > Or").length;e<2&&c.push({message:`OrRule requires at least 2 <Or> children (found ${e})`,lineHint:h(i,"<OrRule")})}),c}function P(i,p){const l=j.getState(),c=C.getState().location,a=new DOMParser().parseFromString(i,"application/xml");if(!a.querySelector("parsererror")&&(a.querySelectorAll("CommandDefinition").forEach(r=>{const o=r.getAttribute("Id");if(!o)return;const u=[],n=[];r.querySelectorAll("EnableRules > EnableRule").forEach(e=>{const t=e.getAttribute("Id");t&&u.push(t)}),r.querySelectorAll("DisplayRules > DisplayRule").forEach(e=>{const t=e.getAttribute("Id");t&&n.push(t)}),l.upsertCommand({id:o,enableRules:u,displayRules:n,actions:[]})}),a.querySelectorAll("LocLabel").forEach(r=>{const o=r.getAttribute("Id");if(!o)return;const u=[];r.querySelectorAll("Title").forEach(n=>{const e=Number(n.getAttribute("languagecode")??0),t=n.getAttribute("description")??"";e&&u.push({languageCode:e,description:t})}),l.upsertLocLabel({id:o,titles:u})}),a.querySelectorAll("EnableRules > EnableRule").forEach(r=>{const o=r.getAttribute("Id");o&&l.upsertEnableRule({id:o,steps:[]})}),a.querySelectorAll("DisplayRules > DisplayRule").forEach(r=>{const o=r.getAttribute("Id");o&&l.upsertDisplayRule({id:o,steps:[]})}),p==="replace")){const r=structuredClone(l.ribbons),o=r[c];a.querySelectorAll("CustomAction").forEach(u=>{const n=u.getAttribute("Location")??"",e=Number(u.getAttribute("Sequence")??0),t=u.querySelector("CommandUIDefinition > Button");if(!t)return;const d=t.getAttribute("Id")??"",m=t.getAttribute("LabelText")??d,E=t.getAttribute("Command")??"",q=t.getAttribute("TemplateAlias")??"o1";if(!d)return;let x=!1;for(const L of o.tabs){for(const f of L.groups)if(n.startsWith(f.id)){f.buttons.find(D=>D.id===d)||f.buttons.push({id:d,label:m,commandId:E,templateAlias:q,sequence:e,kind:"button",hidden:!1,oob:!1,custom:!0,managed:!1}),x=!0;break}if(x)break}}),l.loadRibbons(r)}}const Y=()=>{const i=A(e=>e.importXmlOpen),p=A(e=>e.closeImportXml),[l,c]=g.useState(""),[b,a]=g.useState([]),[r,o]=g.useState("replace"),u=()=>{const e=B(l);return a(e),e.length===0},n=()=>{u()&&(P(l,r),p())};return s.jsx(v,{open:i,onOpenChange:()=>p(),children:s.jsxs(T,{style:{maxWidth:"960px",width:"92vw",height:"80vh",maxHeight:"860px"},children:[s.jsx(w,{children:"Import RibbonDiffXml"}),s.jsxs(O,{style:{height:"100%",display:"flex",flexDirection:"column"},children:[s.jsxs(H,{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:[s.jsxs(M,{selectedValue:r,onTabSelect:(e,t)=>o(t.value),children:[s.jsx(S,{value:"replace",children:"Replace current"}),s.jsx(S,{value:"append",children:"Merge / append"})]}),s.jsx(X,{style:{margin:"8px 0"}}),s.jsx("div",{style:{flex:1,minHeight:0},children:s.jsx($,{language:"xml",value:l,onChange:c,readOnly:!1,height:"100%",options:{wordWrap:"on",lineNumbers:"on",padding:{top:8}}})}),b.length>0&&s.jsx("div",{style:{marginTop:"8px",display:"flex",flexDirection:"column",gap:"4px"},children:b.map((e,t)=>s.jsx(I,{intent:"error",children:s.jsxs(R,{children:[e.message,e.lineHint?` (${e.lineHint})`:""]})},t))}),b.length===0&&l&&s.jsx(I,{intent:"success",children:s.jsx(R,{children:"XML is valid."})})]}),s.jsxs(k,{children:[s.jsx(y,{appearance:"secondary",onClick:p,children:"Cancel"}),s.jsx(y,{appearance:"secondary",onClick:u,disabled:!l.trim(),children:"Validate"}),s.jsx(y,{appearance:"primary",onClick:n,disabled:!l.trim(),children:"Import"})]})]})]})})};export{Y as ImportXmlModal,Y as default};
@@ -1 +1 @@
1
- import{cw as a,aw as X,a as U,ar as O,cx as _,c7 as K}from"./fluent-icons-DiKr_qRE.js";import{r as z,b as E}from"./monaco-BLZnQb2P.js";import{i as y,u as T}from"./index-G361fmC5.js";import{d as M,h as P,f as V,i as G,H as J,B as w,a as h,g as Q,I as Y,Q as R,a1 as o,V as $,e as q}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const m={1033:{name:"English (US)",flag:"🇺🇸"},1031:{name:"German",flag:"🇩🇪"},1034:{name:"Spanish",flag:"🇪🇸"},1036:{name:"French",flag:"🇫🇷"},1040:{name:"Italian",flag:"🇮🇹"},1041:{name:"Japanese",flag:"🇯🇵"},1042:{name:"Korean",flag:"🇰🇷"},1043:{name:"Dutch",flag:"🇳🇱"},1044:{name:"Norwegian",flag:"🇳🇴"},1045:{name:"Polish",flag:"🇵🇱"},1046:{name:"Portuguese (Brazil)",flag:"🇧🇷"},1049:{name:"Russian",flag:"🇷🇺"},1053:{name:"Swedish",flag:"🇸🇪"},1054:{name:"Thai",flag:"🇹🇭"},1055:{name:"Turkish",flag:"🇹🇷"},1057:{name:"Indonesian",flag:"🇮🇩"},1058:{name:"Ukrainian",flag:"🇺🇦"},1066:{name:"Vietnamese",flag:"🇻🇳"},2052:{name:"Chinese (Simplified)",flag:"🇨🇳"},3082:{name:"Spanish (Spain)",flag:"🇪🇸"}},Z=Object.keys(m).map(Number),ee=_({surface:{width:"760px",maxWidth:"95vw",maxHeight:"80vh"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,overflowY:"auto"},chipRow:{display:"flex",flexWrap:"wrap",gap:o.spacingHorizontalXS,alignItems:"center"},chip:{cursor:"pointer",userSelect:"none"},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"left",fontSize:o.fontSizeBase100,fontWeight:o.fontWeightSemibold,color:o.colorNeutralForeground3,paddingBottom:o.spacingHorizontalXS,borderBottom:`1px solid ${o.colorNeutralStroke2}`},td:{verticalAlign:"top",paddingTop:o.spacingHorizontalXS,paddingBottom:o.spacingHorizontalXS,paddingRight:o.spacingHorizontalS,borderBottom:`1px solid ${o.colorNeutralStroke3}`},langCell:{whiteSpace:"nowrap",width:"160px"},actionCell:{width:"40px"},insertBreakBtn:{fontSize:o.fontSizeBase100,height:"20px",minWidth:"unset",padding:`0 ${o.spacingHorizontalXS}`},noteBar:{backgroundColor:o.colorNeutralBackground3,borderRadius:o.borderRadiusMedium,padding:`${o.spacingHorizontalXS} ${o.spacingHorizontalS}`,fontSize:o.fontSizeBase100,color:o.colorNeutralForeground3}}),se=()=>{const n=ee(),g=y(e=>e.localizationEditorOpen),s=y(e=>e.localizationEditorButtonId),p=y(e=>e.closeLocalizationEditor),u=T(e=>e.locLabels),C=T(e=>e.upsertLocLabel),f=s?`${s}.LabelText`:null,x=s?`${s}.ToolTipTitle`:null,b=s?`${s}.ToolTipDescription`:null,v=z.useCallback(()=>{const e=u.find(i=>i.id===f),l=u.find(i=>i.id===x),t=u.find(i=>i.id===b),d=new Set([1033]);return e?.titles.forEach(i=>d.add(i.languageCode)),l?.titles.forEach(i=>d.add(i.languageCode)),t?.titles.forEach(i=>d.add(i.languageCode)),Array.from(d).sort((i,r)=>i===1033?-1:r===1033?1:i-r).map(i=>({lcid:i,label:e?.titles.find(r=>r.languageCode===i)?.description??"",tooltipTitle:l?.titles.find(r=>r.languageCode===i)?.description??"",tooltipBody:t?.titles.find(r=>r.languageCode===i)?.description??""}))},[u,f,x,b]),[c,j]=z.useState([]),[B,N]=z.useState("");E.useEffect(()=>{g&&j(v())},[g,v]);const S=(e,l,t)=>{j(d=>d.map(i=>i.lcid===e?{...i,[l]:t}:i))},k=(e,l,t)=>{if(!t)return;const d=t.selectionStart??t.value.length,i=t.selectionEnd??t.value.length,r=c.find(W=>W.lcid===e)?.[l]??"",F=r.slice(0,d)+"​​"+r.slice(i);S(e,l,F)},I=()=>{const e=parseInt(B,10);!e||c.find(l=>l.lcid===e)||(j(l=>[...l,{lcid:e,label:"",tooltipTitle:"",tooltipBody:""}]),N(""))},L=e=>{e!==1033&&j(l=>l.filter(t=>t.lcid!==e))},H=()=>{if(!f||!x||!b)return;const e=l=>c.filter(t=>t[l]).map(t=>({languageCode:t.lcid,description:t[l]}));e("label").length>0&&C({id:f,titles:e("label")}),e("tooltipTitle").length>0&&C({id:x,titles:e("tooltipTitle")}),e("tooltipBody").length>0&&C({id:b,titles:e("tooltipBody")}),p()},A=c.find(e=>e.lcid===1033);return a.jsx(M,{open:g,onOpenChange:(e,l)=>!l.open&&p(),children:a.jsx(P,{className:n.surface,children:a.jsxs(V,{children:[a.jsxs(G,{action:a.jsx(h,{appearance:"subtle",icon:a.jsx(X,{}),onClick:p,"aria-label":"Close"}),children:[a.jsxs(J,{children:["Translations — ",A?.label||s||"Button"]}),a.jsxs(w,{appearance:"tint",size:"small",style:{marginLeft:8},children:[c.length," language",c.length!==1?"s":""]})]}),a.jsxs(Q,{className:n.body,children:[a.jsxs("div",{className:n.chipRow,children:[c.map(e=>{const l=m[e.lcid];return a.jsxs(w,{className:n.chip,appearance:e.label?"filled":"outline",color:e.label?"brand":"informative",size:"medium",children:[l?.flag??"🌐"," ",l?.name??`LCID ${e.lcid}`,e.lcid!==1033&&a.jsx("span",{style:{marginLeft:4,cursor:"pointer",opacity:.7},onClick:()=>L(e.lcid),"aria-label":`Remove ${l?.name}`,children:"×"})]},e.lcid)}),a.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[a.jsx(Y,{size:"small",style:{width:"180px"},placeholder:"LCID or language…",value:B,onChange:(e,l)=>N(l.value),list:"lcid-list",onKeyDown:e=>e.key==="Enter"&&I()}),a.jsx("datalist",{id:"lcid-list",children:Z.filter(e=>!c.find(l=>l.lcid===e)).map(e=>a.jsxs("option",{value:String(e),children:[m[e]?.flag," ",m[e]?.name," (",e,")"]},e))}),a.jsx(h,{size:"small",appearance:"subtle",icon:a.jsx(U,{}),onClick:I,"aria-label":"Add language"})]})]}),a.jsx("div",{className:n.noteBar,children:'💡 LCID 1033 (English US) is the base language and cannot be removed. Use "Insert ​​" to force a line break in long labels.'}),a.jsxs("table",{className:n.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:n.th,style:{width:"160px"},children:"Language"}),a.jsx("th",{className:n.th,children:"Label"}),a.jsx("th",{className:n.th,children:"Tooltip title"}),a.jsx("th",{className:n.th,children:"Tooltip body"}),a.jsx("th",{className:n.th,style:{width:"40px"}})]})}),a.jsx("tbody",{children:c.map(e=>{const l=m[e.lcid];return a.jsxs("tr",{children:[a.jsxs("td",{className:`${n.td} ${n.langCell}`,children:[a.jsxs(R,{size:200,children:[l?.flag??"🌐"," ",l?.name??`LCID ${e.lcid}`]}),a.jsx("br",{}),a.jsx(R,{size:100,style:{color:o.colorNeutralForeground3},children:e.lcid})]}),a.jsx("td",{className:n.td,children:a.jsx(D,{value:e.label,onChange:t=>S(e.lcid,"label",t),onInsertBreak:t=>k(e.lcid,"label",t)})}),a.jsx("td",{className:n.td,children:a.jsx(D,{value:e.tooltipTitle,onChange:t=>S(e.lcid,"tooltipTitle",t),onInsertBreak:t=>k(e.lcid,"tooltipTitle",t)})}),a.jsx("td",{className:n.td,children:a.jsx(ae,{value:e.tooltipBody,onChange:t=>S(e.lcid,"tooltipBody",t)})}),a.jsx("td",{className:`${n.td} ${n.actionCell}`,children:e.lcid!==1033&&a.jsx($,{content:"Remove this language",relationship:"label",children:a.jsx(h,{appearance:"subtle",size:"small",icon:a.jsx(O,{}),onClick:()=>L(e.lcid),"aria-label":"Remove language"})})})]},e.lcid)})})]})]}),a.jsxs(q,{children:[a.jsx(h,{appearance:"secondary",onClick:p,children:"Cancel"}),a.jsx(h,{appearance:"primary",onClick:H,children:"Save translations"})]})]})})})};function D({value:n,onChange:g,onInsertBreak:s}){const p=E.useRef(null);return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[a.jsx("input",{ref:p,style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box"},value:n,onChange:u=>g(u.target.value)}),a.jsx($,{content:"Insert Dataverse line break (​​)",relationship:"label",children:a.jsxs("button",{type:"button",onClick:()=>s(p.current),style:{fontSize:11,border:"none",background:"none",color:"var(--colorNeutralForeground3)",cursor:"pointer",padding:0,textAlign:"left",display:"flex",alignItems:"center",gap:2},children:[a.jsx(K,{fontSize:12})," Insert ⏎"]})})]})}function ae({value:n,onChange:g}){return a.jsx("textarea",{style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box",resize:"vertical",minHeight:"42px"},value:n,onChange:s=>g(s.target.value),rows:2})}export{se as LocalizationEditor,se as default};
1
+ import{cw as a,aw as X,a as U,ar as O,cx as _,c7 as K}from"./fluent-icons-DiKr_qRE.js";import{r as z,b as E}from"./monaco-BLZnQb2P.js";import{i as y,u as T}from"./index-DjHxPFpB.js";import{d as M,h as P,f as V,i as G,H as J,B as w,a as h,g as Q,I as Y,Q as R,a1 as o,V as $,e as q}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const m={1033:{name:"English (US)",flag:"🇺🇸"},1031:{name:"German",flag:"🇩🇪"},1034:{name:"Spanish",flag:"🇪🇸"},1036:{name:"French",flag:"🇫🇷"},1040:{name:"Italian",flag:"🇮🇹"},1041:{name:"Japanese",flag:"🇯🇵"},1042:{name:"Korean",flag:"🇰🇷"},1043:{name:"Dutch",flag:"🇳🇱"},1044:{name:"Norwegian",flag:"🇳🇴"},1045:{name:"Polish",flag:"🇵🇱"},1046:{name:"Portuguese (Brazil)",flag:"🇧🇷"},1049:{name:"Russian",flag:"🇷🇺"},1053:{name:"Swedish",flag:"🇸🇪"},1054:{name:"Thai",flag:"🇹🇭"},1055:{name:"Turkish",flag:"🇹🇷"},1057:{name:"Indonesian",flag:"🇮🇩"},1058:{name:"Ukrainian",flag:"🇺🇦"},1066:{name:"Vietnamese",flag:"🇻🇳"},2052:{name:"Chinese (Simplified)",flag:"🇨🇳"},3082:{name:"Spanish (Spain)",flag:"🇪🇸"}},Z=Object.keys(m).map(Number),ee=_({surface:{width:"760px",maxWidth:"95vw",maxHeight:"80vh"},body:{display:"flex",flexDirection:"column",gap:o.spacingHorizontalM,overflowY:"auto"},chipRow:{display:"flex",flexWrap:"wrap",gap:o.spacingHorizontalXS,alignItems:"center"},chip:{cursor:"pointer",userSelect:"none"},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"left",fontSize:o.fontSizeBase100,fontWeight:o.fontWeightSemibold,color:o.colorNeutralForeground3,paddingBottom:o.spacingHorizontalXS,borderBottom:`1px solid ${o.colorNeutralStroke2}`},td:{verticalAlign:"top",paddingTop:o.spacingHorizontalXS,paddingBottom:o.spacingHorizontalXS,paddingRight:o.spacingHorizontalS,borderBottom:`1px solid ${o.colorNeutralStroke3}`},langCell:{whiteSpace:"nowrap",width:"160px"},actionCell:{width:"40px"},insertBreakBtn:{fontSize:o.fontSizeBase100,height:"20px",minWidth:"unset",padding:`0 ${o.spacingHorizontalXS}`},noteBar:{backgroundColor:o.colorNeutralBackground3,borderRadius:o.borderRadiusMedium,padding:`${o.spacingHorizontalXS} ${o.spacingHorizontalS}`,fontSize:o.fontSizeBase100,color:o.colorNeutralForeground3}}),se=()=>{const n=ee(),g=y(e=>e.localizationEditorOpen),s=y(e=>e.localizationEditorButtonId),p=y(e=>e.closeLocalizationEditor),u=T(e=>e.locLabels),C=T(e=>e.upsertLocLabel),f=s?`${s}.LabelText`:null,x=s?`${s}.ToolTipTitle`:null,b=s?`${s}.ToolTipDescription`:null,v=z.useCallback(()=>{const e=u.find(i=>i.id===f),l=u.find(i=>i.id===x),t=u.find(i=>i.id===b),d=new Set([1033]);return e?.titles.forEach(i=>d.add(i.languageCode)),l?.titles.forEach(i=>d.add(i.languageCode)),t?.titles.forEach(i=>d.add(i.languageCode)),Array.from(d).sort((i,r)=>i===1033?-1:r===1033?1:i-r).map(i=>({lcid:i,label:e?.titles.find(r=>r.languageCode===i)?.description??"",tooltipTitle:l?.titles.find(r=>r.languageCode===i)?.description??"",tooltipBody:t?.titles.find(r=>r.languageCode===i)?.description??""}))},[u,f,x,b]),[c,j]=z.useState([]),[B,N]=z.useState("");E.useEffect(()=>{g&&j(v())},[g,v]);const S=(e,l,t)=>{j(d=>d.map(i=>i.lcid===e?{...i,[l]:t}:i))},k=(e,l,t)=>{if(!t)return;const d=t.selectionStart??t.value.length,i=t.selectionEnd??t.value.length,r=c.find(W=>W.lcid===e)?.[l]??"",F=r.slice(0,d)+"​​"+r.slice(i);S(e,l,F)},I=()=>{const e=parseInt(B,10);!e||c.find(l=>l.lcid===e)||(j(l=>[...l,{lcid:e,label:"",tooltipTitle:"",tooltipBody:""}]),N(""))},L=e=>{e!==1033&&j(l=>l.filter(t=>t.lcid!==e))},H=()=>{if(!f||!x||!b)return;const e=l=>c.filter(t=>t[l]).map(t=>({languageCode:t.lcid,description:t[l]}));e("label").length>0&&C({id:f,titles:e("label")}),e("tooltipTitle").length>0&&C({id:x,titles:e("tooltipTitle")}),e("tooltipBody").length>0&&C({id:b,titles:e("tooltipBody")}),p()},A=c.find(e=>e.lcid===1033);return a.jsx(M,{open:g,onOpenChange:(e,l)=>!l.open&&p(),children:a.jsx(P,{className:n.surface,children:a.jsxs(V,{children:[a.jsxs(G,{action:a.jsx(h,{appearance:"subtle",icon:a.jsx(X,{}),onClick:p,"aria-label":"Close"}),children:[a.jsxs(J,{children:["Translations — ",A?.label||s||"Button"]}),a.jsxs(w,{appearance:"tint",size:"small",style:{marginLeft:8},children:[c.length," language",c.length!==1?"s":""]})]}),a.jsxs(Q,{className:n.body,children:[a.jsxs("div",{className:n.chipRow,children:[c.map(e=>{const l=m[e.lcid];return a.jsxs(w,{className:n.chip,appearance:e.label?"filled":"outline",color:e.label?"brand":"informative",size:"medium",children:[l?.flag??"🌐"," ",l?.name??`LCID ${e.lcid}`,e.lcid!==1033&&a.jsx("span",{style:{marginLeft:4,cursor:"pointer",opacity:.7},onClick:()=>L(e.lcid),"aria-label":`Remove ${l?.name}`,children:"×"})]},e.lcid)}),a.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[a.jsx(Y,{size:"small",style:{width:"180px"},placeholder:"LCID or language…",value:B,onChange:(e,l)=>N(l.value),list:"lcid-list",onKeyDown:e=>e.key==="Enter"&&I()}),a.jsx("datalist",{id:"lcid-list",children:Z.filter(e=>!c.find(l=>l.lcid===e)).map(e=>a.jsxs("option",{value:String(e),children:[m[e]?.flag," ",m[e]?.name," (",e,")"]},e))}),a.jsx(h,{size:"small",appearance:"subtle",icon:a.jsx(U,{}),onClick:I,"aria-label":"Add language"})]})]}),a.jsx("div",{className:n.noteBar,children:'💡 LCID 1033 (English US) is the base language and cannot be removed. Use "Insert ​​" to force a line break in long labels.'}),a.jsxs("table",{className:n.table,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{className:n.th,style:{width:"160px"},children:"Language"}),a.jsx("th",{className:n.th,children:"Label"}),a.jsx("th",{className:n.th,children:"Tooltip title"}),a.jsx("th",{className:n.th,children:"Tooltip body"}),a.jsx("th",{className:n.th,style:{width:"40px"}})]})}),a.jsx("tbody",{children:c.map(e=>{const l=m[e.lcid];return a.jsxs("tr",{children:[a.jsxs("td",{className:`${n.td} ${n.langCell}`,children:[a.jsxs(R,{size:200,children:[l?.flag??"🌐"," ",l?.name??`LCID ${e.lcid}`]}),a.jsx("br",{}),a.jsx(R,{size:100,style:{color:o.colorNeutralForeground3},children:e.lcid})]}),a.jsx("td",{className:n.td,children:a.jsx(D,{value:e.label,onChange:t=>S(e.lcid,"label",t),onInsertBreak:t=>k(e.lcid,"label",t)})}),a.jsx("td",{className:n.td,children:a.jsx(D,{value:e.tooltipTitle,onChange:t=>S(e.lcid,"tooltipTitle",t),onInsertBreak:t=>k(e.lcid,"tooltipTitle",t)})}),a.jsx("td",{className:n.td,children:a.jsx(ae,{value:e.tooltipBody,onChange:t=>S(e.lcid,"tooltipBody",t)})}),a.jsx("td",{className:`${n.td} ${n.actionCell}`,children:e.lcid!==1033&&a.jsx($,{content:"Remove this language",relationship:"label",children:a.jsx(h,{appearance:"subtle",size:"small",icon:a.jsx(O,{}),onClick:()=>L(e.lcid),"aria-label":"Remove language"})})})]},e.lcid)})})]})]}),a.jsxs(q,{children:[a.jsx(h,{appearance:"secondary",onClick:p,children:"Cancel"}),a.jsx(h,{appearance:"primary",onClick:H,children:"Save translations"})]})]})})})};function D({value:n,onChange:g,onInsertBreak:s}){const p=E.useRef(null);return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[a.jsx("input",{ref:p,style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box"},value:n,onChange:u=>g(u.target.value)}),a.jsx($,{content:"Insert Dataverse line break (​​)",relationship:"label",children:a.jsxs("button",{type:"button",onClick:()=>s(p.current),style:{fontSize:11,border:"none",background:"none",color:"var(--colorNeutralForeground3)",cursor:"pointer",padding:0,textAlign:"left",display:"flex",alignItems:"center",gap:2},children:[a.jsx(K,{fontSize:12})," Insert ⏎"]})})]})}function ae({value:n,onChange:g}){return a.jsx("textarea",{style:{width:"100%",fontFamily:"inherit",fontSize:13,padding:"3px 6px",border:"1px solid var(--colorNeutralStroke1)",borderRadius:4,boxSizing:"border-box",resize:"vertical",minHeight:"42px"},value:n,onChange:s=>g(s.target.value),rows:2})}export{se as LocalizationEditor,se as default};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-BLZnQb2P.js","assets/monaco-Dvl_Svmm.css"])))=>i.map(i=>d[i]);
2
- import{r as l,b as f,_ as h}from"./monaco-BLZnQb2P.js";import{cw as t}from"./fluent-icons-DiKr_qRE.js";import{i as u}from"./index-G361fmC5.js";import{G as x}from"./fluent-ui-kUA2U4Gr.js";const _=f.lazy(()=>h(()=>import("./monaco-BLZnQb2P.js").then(o=>o.i),__vite__mapDeps([0,1]))),v=({language:o,value:r,onChange:s,readOnly:a=!1,height:i="100%",options:n={},onMount:m})=>{const d=u(e=>e.themeMode)==="dark"?"vs-dark":"vs",c={readOnly:a,minimap:{enabled:!1},wordWrap:o==="xml"?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,...n},p=e=>{s&&e!==void 0&&s(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:m})})};export{v as M};
2
+ import{r as l,b as f,_ as h}from"./monaco-BLZnQb2P.js";import{cw as t}from"./fluent-icons-DiKr_qRE.js";import{i as u}from"./index-DjHxPFpB.js";import{G as x}from"./fluent-ui-kUA2U4Gr.js";const _=f.lazy(()=>h(()=>import("./monaco-BLZnQb2P.js").then(o=>o.i),__vite__mapDeps([0,1]))),v=({language:o,value:r,onChange:s,readOnly:a=!1,height:i="100%",options:n={},onMount:m})=>{const d=u(e=>e.themeMode)==="dark"?"vs-dark":"vs",c={readOnly:a,minimap:{enabled:!1},wordWrap:o==="xml"?"on":"off",scrollBeyondLastLine:!1,automaticLayout:!0,...n},p=e=>{s&&e!==void 0&&s(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:m})})};export{v as M};
@@ -1 +1 @@
1
- import{cw as e}from"./fluent-icons-DiKr_qRE.js";import{r as b}from"./monaco-BLZnQb2P.js";import{i as f,u as j,e as l,h as c}from"./index-G361fmC5.js";import{d as $,h as E,i as k,f as F,g as P,F as g,I as R,S as T,Q as A,e as L,a as B}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const z=()=>{const n=f(t=>t.newButtonGroupId),a=f(t=>t.closeNewButton),C=j(t=>t.createButton),S=j(t=>t.upsertCommand),v=l(t=>t.selectButtonInContext),y=c(t=>t.publisherPrefix),I=c(t=>t.activeSolution),i=l(t=>t.location),r=l(t=>t.tabId),w=c(t=>t.activeEntity),N=n!==null,[s,u]=b.useState("New Button"),[d,p]=b.useState("button"),D=()=>{if(!n||!i)return;const t=I?.publisherPrefix?.trim()||y?.trim()||"new",o=w?.logicalName??"global",m=s.replace(/\s+/g,""),x=`${t}.${o}.${m}.Button`,h=`${t}.${o}.${m}.Command`;C({location:i,tabId:r,groupId:n,button:{id:x,label:s,kind:d,sequence:50,templateAlias:"o1",commandId:h,hidden:!1,oob:!1,custom:!0,managed:!1}}),S({id:h,enableRules:[],displayRules:[],actions:[]}),v(i,r,n,x),u("New Button"),p("button"),a()};return e.jsx($,{open:N,onOpenChange:()=>a(),children:e.jsxs(E,{children:[e.jsx(k,{children:"New button"}),e.jsxs(F,{children:[e.jsxs(P,{children:[e.jsx(g,{label:"Label",required:!0,children:e.jsx(R,{value:s,onChange:(t,o)=>u(o.value),autoFocus:!0})}),e.jsx(g,{label:"Kind",children:e.jsxs(T,{value:d,onChange:(t,o)=>p(o.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(A,{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(L,{children:[e.jsx(B,{appearance:"secondary",onClick:a,children:"Cancel"}),e.jsx(B,{appearance:"primary",onClick:D,disabled:!s.trim(),children:"Create button"})]})]})]})})};export{z as NewButtonModal,z as default};
1
+ import{cw as e}from"./fluent-icons-DiKr_qRE.js";import{r as b}from"./monaco-BLZnQb2P.js";import{i as f,u as j,e as l,h as c}from"./index-DjHxPFpB.js";import{d as $,h as E,i as k,f as F,g as P,F as g,I as R,S as T,Q as A,e as L,a as B}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const z=()=>{const n=f(t=>t.newButtonGroupId),a=f(t=>t.closeNewButton),C=j(t=>t.createButton),S=j(t=>t.upsertCommand),v=l(t=>t.selectButtonInContext),y=c(t=>t.publisherPrefix),I=c(t=>t.activeSolution),i=l(t=>t.location),r=l(t=>t.tabId),w=c(t=>t.activeEntity),N=n!==null,[s,u]=b.useState("New Button"),[d,p]=b.useState("button"),D=()=>{if(!n||!i)return;const t=I?.publisherPrefix?.trim()||y?.trim()||"new",o=w?.logicalName??"global",m=s.replace(/\s+/g,""),x=`${t}.${o}.${m}.Button`,h=`${t}.${o}.${m}.Command`;C({location:i,tabId:r,groupId:n,button:{id:x,label:s,kind:d,sequence:50,templateAlias:"o1",commandId:h,hidden:!1,oob:!1,custom:!0,managed:!1}}),S({id:h,enableRules:[],displayRules:[],actions:[]}),v(i,r,n,x),u("New Button"),p("button"),a()};return e.jsx($,{open:N,onOpenChange:()=>a(),children:e.jsxs(E,{children:[e.jsx(k,{children:"New button"}),e.jsxs(F,{children:[e.jsxs(P,{children:[e.jsx(g,{label:"Label",required:!0,children:e.jsx(R,{value:s,onChange:(t,o)=>u(o.value),autoFocus:!0})}),e.jsx(g,{label:"Kind",children:e.jsxs(T,{value:d,onChange:(t,o)=>p(o.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(A,{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(L,{children:[e.jsx(B,{appearance:"secondary",onClick:a,children:"Cancel"}),e.jsx(B,{appearance:"primary",onClick:D,disabled:!s.trim(),children:"Create button"})]})]})]})})};export{z as NewButtonModal,z as default};
@@ -1 +1 @@
1
- import{cw as e}from"./fluent-icons-DiKr_qRE.js";import{r as u}from"./monaco-BLZnQb2P.js";import{i as p,u as G,h as d,e as x}from"./index-G361fmC5.js";import{d as S,h as C,i as F,f as L,g as N,F as h,I as D,S as I,Q as T,e as E,a as b}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const B=()=>{const m=p(o=>o.newGroupOpen),s=p(o=>o.closeNewGroup),j=G(o=>o.createGroup),g=d(o=>o.publisherPrefix),l=x(o=>o.location),n=x(o=>o.tabId),y=d(o=>o.activeEntity),[a,i]=u.useState("New Group"),[r,c]=u.useState("Flexible2"),f=()=>{if(!l||!n)return;const o=g||"new",t=y?.logicalName??"global",v=a.replace(/\s+/g,""),w=`${o}.${t}.${v}.Group`;j({location:l,tabId:n,group:{id:w,label:a,sequence:50,template:r,buttons:[]}}),i("New Group"),c("Flexible2"),s()};return e.jsx(S,{open:m,onOpenChange:()=>s(),children:e.jsxs(C,{children:[e.jsx(F,{children:"New group"}),e.jsxs(L,{children:[e.jsxs(N,{children:[e.jsx(h,{label:"Label",required:!0,children:e.jsx(D,{value:a,onChange:(o,t)=>i(t.value),autoFocus:!0})}),e.jsx(h,{label:"Group template",children:e.jsxs(I,{value:r,onChange:(o,t)=>c(t.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(T,{size:200,style:{display:"block",marginTop:"8px"},children:"The group template defines how buttons scale when the ribbon is resized."})]}),e.jsxs(E,{children:[e.jsx(b,{appearance:"secondary",onClick:s,children:"Cancel"}),e.jsx(b,{appearance:"primary",onClick:f,disabled:!a.trim(),children:"Create group"})]})]})]})})};export{B as NewGroupModal,B as default};
1
+ import{cw as e}from"./fluent-icons-DiKr_qRE.js";import{r as u}from"./monaco-BLZnQb2P.js";import{i as p,u as G,h as d,e as x}from"./index-DjHxPFpB.js";import{d as S,h as C,i as F,f as L,g as N,F as h,I as D,S as I,Q as T,e as E,a as b}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const B=()=>{const m=p(o=>o.newGroupOpen),s=p(o=>o.closeNewGroup),j=G(o=>o.createGroup),g=d(o=>o.publisherPrefix),l=x(o=>o.location),n=x(o=>o.tabId),y=d(o=>o.activeEntity),[a,i]=u.useState("New Group"),[r,c]=u.useState("Flexible2"),f=()=>{if(!l||!n)return;const o=g||"new",t=y?.logicalName??"global",v=a.replace(/\s+/g,""),w=`${o}.${t}.${v}.Group`;j({location:l,tabId:n,group:{id:w,label:a,sequence:50,template:r,buttons:[]}}),i("New Group"),c("Flexible2"),s()};return e.jsx(S,{open:m,onOpenChange:()=>s(),children:e.jsxs(C,{children:[e.jsx(F,{children:"New group"}),e.jsxs(L,{children:[e.jsxs(N,{children:[e.jsx(h,{label:"Label",required:!0,children:e.jsx(D,{value:a,onChange:(o,t)=>i(t.value),autoFocus:!0})}),e.jsx(h,{label:"Group template",children:e.jsxs(I,{value:r,onChange:(o,t)=>c(t.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(T,{size:200,style:{display:"block",marginTop:"8px"},children:"The group template defines how buttons scale when the ribbon is resized."})]}),e.jsxs(E,{children:[e.jsx(b,{appearance:"secondary",onClick:s,children:"Cancel"}),e.jsx(b,{appearance:"primary",onClick:f,disabled:!a.trim(),children:"Create group"})]})]})]})})};export{B as NewGroupModal,B as default};
@@ -1 +1 @@
1
- import{cw as e,aw as k,cx as I}from"./fluent-icons-DiKr_qRE.js";import{r as x}from"./monaco-BLZnQb2P.js";import{e as z,u as B,h as g,i as m}from"./index-G361fmC5.js";import{d as F,h as M,f as R,i as $,H as E,a as i,g as H,u as A,w as L,Q as r,F as j,I as f,a1 as s,e as O}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const _=I({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}}),W=()=>{const l=_(),[n,c]=x.useState("New Tab"),[d,u]=x.useState(""),b=z(a=>a.location),y=B(a=>a.createTab),T=g(a=>a.activeEntity),S=g(a=>a.publisherPrefix),N=m(a=>a.newTabOpen),t=m(a=>a.closeNewTab),w=S||"new",C=T?.logicalName??"entity",D=n.replace(/\s+/g,""),p=`${w}.${C}.${D}.Tab`,h=d||p,v=()=>{y(b,{id:h,label:n,sequence:100,tabDisplayRules:[],groups:[]}),c("New Tab"),u(""),t()};return e.jsx(F,{open:N,onOpenChange:(a,o)=>!o.open&&t(),children:e.jsx(M,{className:l.surface,children:e.jsxs(R,{children:[e.jsx($,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(k,{}),onClick:t,"aria-label":"Close"}),children:e.jsx(E,{children:"Add Tab"})}),e.jsxs(H,{className:l.body,children:[e.jsx(A,{intent:"info",children:e.jsx(L,{children:e.jsx(r,{size:200,children:"Tabs are hidden by default. Add a Tab Display Rule to make the tab visible."})})}),e.jsx(j,{label:"Tab label",required:!0,children:e.jsx(f,{value:n,onChange:(a,o)=>c(o.value),placeholder:"My Tab"})}),e.jsx(j,{label:"Tab ID",hint:"Leave blank to auto-generate from label",children:e.jsx(f,{value:d,onChange:(a,o)=>u(o.value),placeholder:p})}),e.jsxs("div",{children:[e.jsx(r,{size:100,style:{color:s.colorNeutralForeground3},children:"Generated ID:"}),e.jsx("div",{className:l.hint,children:h})]}),e.jsxs(r,{size:200,style:{color:s.colorNeutralForeground3},children:["Location: ",e.jsx("strong",{children:b})]})]}),e.jsxs(O,{children:[e.jsx(i,{appearance:"secondary",onClick:t,children:"Cancel"}),e.jsx(i,{appearance:"primary",disabled:!n.trim(),onClick:v,children:"Create tab"})]})]})})})};export{W as NewTabModal,W as default};
1
+ import{cw as e,aw as k,cx as I}from"./fluent-icons-DiKr_qRE.js";import{r as x}from"./monaco-BLZnQb2P.js";import{e as z,u as B,h as g,i as m}from"./index-DjHxPFpB.js";import{d as F,h as M,f as R,i as $,H as E,a as i,g as H,u as A,w as L,Q as r,F as j,I as f,a1 as s,e as O}from"./fluent-ui-kUA2U4Gr.js";import"./dnd-DHB99ZH7.js";const _=I({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}}),W=()=>{const l=_(),[n,c]=x.useState("New Tab"),[d,u]=x.useState(""),b=z(a=>a.location),y=B(a=>a.createTab),T=g(a=>a.activeEntity),S=g(a=>a.publisherPrefix),N=m(a=>a.newTabOpen),t=m(a=>a.closeNewTab),w=S||"new",C=T?.logicalName??"entity",D=n.replace(/\s+/g,""),p=`${w}.${C}.${D}.Tab`,h=d||p,v=()=>{y(b,{id:h,label:n,sequence:100,tabDisplayRules:[],groups:[]}),c("New Tab"),u(""),t()};return e.jsx(F,{open:N,onOpenChange:(a,o)=>!o.open&&t(),children:e.jsx(M,{className:l.surface,children:e.jsxs(R,{children:[e.jsx($,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(k,{}),onClick:t,"aria-label":"Close"}),children:e.jsx(E,{children:"Add Tab"})}),e.jsxs(H,{className:l.body,children:[e.jsx(A,{intent:"info",children:e.jsx(L,{children:e.jsx(r,{size:200,children:"Tabs are hidden by default. Add a Tab Display Rule to make the tab visible."})})}),e.jsx(j,{label:"Tab label",required:!0,children:e.jsx(f,{value:n,onChange:(a,o)=>c(o.value),placeholder:"My Tab"})}),e.jsx(j,{label:"Tab ID",hint:"Leave blank to auto-generate from label",children:e.jsx(f,{value:d,onChange:(a,o)=>u(o.value),placeholder:p})}),e.jsxs("div",{children:[e.jsx(r,{size:100,style:{color:s.colorNeutralForeground3},children:"Generated ID:"}),e.jsx("div",{className:l.hint,children:h})]}),e.jsxs(r,{size:200,style:{color:s.colorNeutralForeground3},children:["Location: ",e.jsx("strong",{children:b})]})]}),e.jsxs(O,{children:[e.jsx(i,{appearance:"secondary",onClick:t,children:"Cancel"}),e.jsx(i,{appearance:"primary",disabled:!n.trim(),onClick:v,children:"Create tab"})]})]})})})};export{W as NewTabModal,W as default};