@sap/ux-ui5-tooling 1.3.3 → 1.3.5

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.
@@ -4,8 +4,8 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta name="theme-color" content="#000000" />
7
- <meta name="description" content="Web page for rendering SAP Fiori Tools Control Editor App" />
8
-
7
+ <meta name="description" content="Web page for rendering SAP Fiori Tools Control Property Editor" />
8
+ <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
9
9
  <title>Control Property Editor</title>
10
10
  </head>
11
11
  <body>
@@ -13,10 +13,10 @@
13
13
  <div id="root"></div>
14
14
  <script>
15
15
  function onScriptLoad() {
16
- app.start({previewUrl: '<%- previewUrl %>', rootElementId: '<%- rootElementId %>'});
16
+ app.start({ previewUrl: '<%- previewUrl %>', rootElementId: 'root' });
17
17
  }
18
- </script>
19
- <script src="./propertyeditor/vendor.js"></script>
20
- <script src="./propertyeditor/app.js" onload="onScriptLoad()"></script>
18
+ </script>
19
+ <script src="./editor/vendor.js"></script>
20
+ <script src="./editor/app.js" onload="onScriptLoad()"></script>
21
21
  </body>
22
- </html>
22
+ </html>
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{init:()=>f});const n="post-message-action";function o(e,t){function o(){return"function"==typeof e?e():e}function r(e){const r=o();var i;r&&e.origin===r.origin&&e.source===r&&((i=e.data).type===n&&"object"==typeof i.action?t(e.data.action):console.warn("Unknown message received",e.data))}return window.addEventListener("message",r),{dispose:function(){window.removeEventListener("message",r)},sendAction:function(e){const t=o();if(!t)return;const r={type:n,action:e};t.postMessage(r,t.origin)}}}const r="string",i="input";const a=(s="[ext]",function(e){const t=[s,e].join(" ");function n(e){return{type:t,payload:e}}var o;return n.type=t,n.match=(o=t,function(e){return(null==e?void 0:e.type)===o}),n});var s;const c=a("select-control"),p=a("change-property");function u(e){const t={primitiveType:"any",ui5Type:null,enumValues:null,isArray:!1};if(!e)return;const n=e.getType();if(!n)return;const o=n.getName();if(o){if(o.indexOf("[]")>0)t.primitiveType=o.substring(0,o.indexOf("[]")),t.isArray=!0;else if("void"===o||"object"===o)t.primitiveType=o;else if("any"===o)t.primitiveType="any";else if("boolean"===o||"string"===o||"int"===o||"float"===o)t.primitiveType=o;else{const e=window.sap.ui.base.DataType,n=e.getType(o);if(n&&!(n instanceof e))return t;Object.getPrototypeOf(n).getName()?t.primitiveType=Object.getPrototypeOf(n).getName():t.primitiveType="enum",t.ui5Type=o,"enum"===t.primitiveType&&(t.enumValues=jQuery.sap.getObject(t.ui5Type))}return t}}function l(e){return!e.isArray&&"any"!==e.primitiveType}function y(e){if(!("object"==typeof e&&e instanceof Object)||Array.isArray(e))return"function"==typeof e?"":e;try{return JSON.stringify(e)}catch(t){return t instanceof Error&&t.message.toLowerCase().includes("converting circular structure to json")?"<Circular JSON cannot be displayed>":e}}function d(e){return!(!e.startsWith("{")||!e.endsWith("}"))}function f(e){console.log("Initializing Control Property Editor");const{rta:t}=e;try{const{sendAction:n}=o(window.parent,(async function(t){p.match(t)&&await async function(e,t){const{layer:n,componentId:o,rta:r,generator:i}=e,a=sap.ui.getCore().byId(t.controlId);if(!a)return;const s={layer:n,developerMode:!0,baseId:o,projectId:"",scenario:"FE_FROM_SCRATCH"},c="string"==typeof t.value&&d(t.value)?"BindProperty":"Property",p="string"==typeof t.value&&d(t.value)?{propertyName:t.propertyName,newBinding:t.value}:{propertyName:t.propertyName,newValue:t.value},u=await sap.ui.rta.command.CommandFactory.getCommandFor(a,c,p,null,s);u.getPreparedChange().getDefinition().support.generator=i,await r.getCommandStack().pushAndExecute(u)}(e,t.payload)}));t.attachSelectionChange(function(e){return function(t){const n=t.getParameter("selection");if(Array.isArray(n)&&1===n.length){const t=sap.ui.getCore().byId(n[0].getId());if(t){const n=function(e,t){var n;const o=e.getMetadata(),a=o.getName(),s=sap.ui.fl.Utils.checkControlId(e),c=t.getDesignTimeMetadata().getData().properties,p=o.getAllProperties(),d=Object.keys(p),f=[];for(const o of d){const a=p[o],d=u(a);if(!d)continue;let g=!1;c&&c[a.name]&&(g=c[a.name].ignore);const m={id:e.getId(),name:a.name,newValue:e.getProperty(a.name)},b=e.getBindingInfo(m.name);void 0!==(null==b?void 0:b.bindingString)&&(m.newValue=b.bindingString);const v=t.isSelectable()&&l(d)&&s&&!g,w=y(m.newValue);switch(d.primitiveType){case"enum":if("string"==typeof w){const e=null!==(n=d.enumValues)&&void 0!==n?n:{},t=Object.keys(e).map((t=>({key:t,text:e[t]})));f.push({type:r,editor:"dropdown",name:a.name,value:w,isEnabled:v,options:t})}break;case"string":"string"==typeof w&&f.push({type:r,editor:i,name:a.name,value:w,isEnabled:v});break;case"float":"number"==typeof w&&f.push({type:"number",editor:i,name:a.name,value:w,isEnabled:v});break;case"boolean":"boolean"==typeof w&&f.push({type:"boolean",editor:"checkbox",name:a.name,value:w,isEnabled:v})}}return{id:e.getId(),type:a,properties:f.sort(((e,t)=>e.name>t.name?1:-1))}}(t.getElementInstance(),t),o=c(n);e(o)}}}}(n))}catch(e){console.error("Error during initialization of Control Property Editor",e)}}self["ui5-adaptation"]=t})();