@siliconst/metaui 1.4.44 → 1.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +24 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts +24 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +15 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +34 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts +34 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.ts +25 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +31 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +38 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.ts +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js +327 -67
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.d.ts +57 -15
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.ts +375 -65
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +5 -5
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js +10 -15
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts +4 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +10 -15
|
@@ -7,18 +7,18 @@ sap.ui.predefine("nz/co/siliconst/ui5/metaui/constants/MetaUIConstants", [],func
|
|
|
7
7
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/BaseHardwareControl", ["sap/ui/core/Control","./BaseHardwareControlRenderer"],function(e,t){"use strict";function a(e){return e&&e.__esModule&&typeof e.default!=="undefined"?e.default:e}const n=a(t);const r=e.extend("nz.co.siliconst.ui5.metaui.controls.BaseHardwareControl",{renderer:n,metadata:{properties:{value:{type:"any",defaultValue:null},schemaMetadata:{type:"object",defaultValue:null},readOnly:{type:"boolean",defaultValue:false}},aggregations:{_content:{type:"sap.m.VBox",multiple:false,visibility:"hidden"}},events:{capture:{parameters:{value:{type:"any"}}}}},setValueAndFire:function e(t){this.setProperty("value",t,true);this.fireEvent("capture",{value:t})},renderContent:function e(t,a){}});return r});
|
|
8
8
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/BaseHardwareControlRenderer", [],function(){"use strict";var n={apiVersion:2,render:function(n,e){n.openStart("div",e);n.class("sapUiSmallMarginBottom");n.openEnd();const t=e.getAggregation("_content");if(t){n.renderControl(t)}if(typeof e.renderContent==="function"){e.renderContent(n,e)}n.close("div")}};return n});
|
|
9
9
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/CameraControl", ["./BaseHardwareControl","sap/m/Button","sap/m/VBox","sap/ui/core/HTML","sap/m/MessageToast","sap/m/Image","../utils/Logger"],function(e,t,i,s,a,r,n){"use strict";function o(e){return e&&e.__esModule&&typeof e.default!=="undefined"?e.default:e}const l=o(e);const h=n["Logger"];class d extends l{static renderer="nz.co.siliconst.ui5.metaui.controls.BaseHardwareControlRenderer";static metadata={properties:{},events:{}};videoEl=null;mediaStream=null;init(){super.init();this.videoHtml=new s({content:"<video width='400' height='300' autoplay playsinline style='background-color: #000; display: none;'></video>",afterRendering:this.onVideoRendered.bind(this)}).addStyleClass("sapUiSmallMarginBottom");this.previewImage=new r({width:"400px",visible:false}).addStyleClass("sapUiSmallMarginBottom");this.startBtn=new t({icon:"sap-icon://video",text:"Start Camera",press:this.handleStartCameraPress.bind(this)});this.captureBtn=new t({icon:"sap-icon://camera",text:"Capture",visible:false,press:this.captureImage.bind(this)});this.retakeBtn=new t({icon:"sap-icon://undo",text:"Retake",visible:false,press:this.retakeImage.bind(this)});this.vBox=new i({items:[this.videoHtml,this.previewImage,this.startBtn,this.captureBtn,this.retakeBtn]});this.setAggregation("_content",this.vBox)}async onVideoRendered(){const e=this.videoHtml.getDomRef();if(!e)return;this.videoEl=e;const t=this.getProperty("value");if(t&&typeof t==="string"&&t.startsWith("data:image")){this.showPreview(t)}else if(this.captureBtn.getVisible()&&this.videoHtml.getVisible()){this.startCamera()}}handleStartCameraPress(){this.startCamera();this.startBtn.setVisible(false);this.captureBtn.setVisible(true);if(this.videoEl){this.videoEl.style.display="block"}}async startCamera(){try{this.mediaStream=await navigator.mediaDevices.getUserMedia({video:{facingMode:"environment"}});if(this.videoEl){this.videoEl.srcObject=this.mediaStream}}catch(e){h.error("Camera access denied or unavailable",e.message,"CameraControl");a.show("Camera access denied or unavailable.")}}stopCamera(){if(this.mediaStream){this.mediaStream.getTracks().forEach(e=>e.stop());this.mediaStream=null}}captureImage(){if(!this.videoEl)return;const e=document.createElement("canvas");e.width=this.videoEl.videoWidth||400;e.height=this.videoEl.videoHeight||300;const t=e.getContext("2d");if(t){t.drawImage(this.videoEl,0,0,e.width,e.height);const i=e.toDataURL("image/jpeg",.8);this.setValueAndFire(i);this.showPreview(i);a.show("Image captured successfully.")}}retakeImage(){this.setValueAndFire(null);this.previewImage.setVisible(false);this.videoHtml.setVisible(true);this.captureBtn.setVisible(true);this.retakeBtn.setVisible(false)}showPreview(e){this.stopCamera();this.videoHtml.setVisible(false);this.previewImage.setSrc(e);this.previewImage.setVisible(true);this.captureBtn.setVisible(false);this.retakeBtn.setVisible(true)}setValue(e){super.setProperty("value",e);if(e&&typeof e==="string"&&e.startsWith("data:image")){this.showPreview(e)}else if(!e){if(this.previewImage.getVisible()){this.retakeImage()}}return this}exit(){this.stopCamera();super.exit()}}return d});
|
|
10
|
-
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/DynamicHost", ["sap/ui/core/Control","./host/GeneratorHost","../utils/Logger","./host/delegates/ODataDelegate","../core/SchemaBuilderRegistry","sap/ui/core/BusyIndicator","sap/m/MessageToast","sap/m/MessageBox","../services/SchemaProvider","../ai/AIConfig"],function(t,e,i,n,a,o,s,r,l,c){"use strict";function d(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const
|
|
10
|
+
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/DynamicHost", ["sap/ui/core/Control","./host/GeneratorHost","../utils/Logger","./host/delegates/ODataDelegate","../core/SchemaBuilderRegistry","sap/ui/core/BusyIndicator","sap/m/MessageToast","sap/m/MessageBox","../services/SchemaProvider","../ai/AIConfig"],function(t,e,i,n,a,o,s,r,l,c){"use strict";function d(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const u=d(e);const f=i["Logger"];const h=n["ODataDelegate"];const p=a["SchemaBuilderRegistry"];const g=l["SchemaProvider"];const y=c["AIConfig"];const m=t.extend("nz.co.siliconst.ui5.metaui.controls.DynamicHost",{constructor:function e(){t.prototype.constructor.apply(this,arguments);this.odataDelegate=null;this._innerHost=null;this._initializedInner=false},renderer:{apiVersion:2,render(t,e){t.openStart("div",e);t.style("width","100%");t.style("height","100%");t.openEnd();const i=e.getAggregation("_content");if(i){t.renderControl(i)}t.close("div")}},metadata:{properties:{schemaDefinition:{type:"any",defaultValue:null},schemaDefinitions:{type:"object",defaultValue:null},schemaTarget:{type:"string",defaultValue:null},pluginRegistry:{type:"object",defaultValue:null},schemaBuilderRegistry:{type:"object",defaultValue:null},data:{type:"object",defaultValue:null,bindable:"bindable"},dataJson:{type:"string",defaultValue:null,bindable:"bindable"},liveUpdate:{type:"boolean",defaultValue:false},isValid:{type:"boolean",defaultValue:true},useMessageManager:{type:"boolean",defaultValue:false},modelName:{type:"string",defaultValue:"meta"},debugMode:{type:"boolean",defaultValue:false},editable:{type:"boolean",defaultValue:true},layoutBudget:{type:"int",defaultValue:0},inferenceStrategy:{type:"string",defaultValue:"RuleBased"}},aggregations:{_content:{type:"sap.ui.core.Control",multiple:false,visibility:"hidden"}},events:{beforeSubmit:{parameters:{payload:{type:"object"},addError:{type:"function"},preventDefault:{type:"function"}}},submit:{parameters:{payload:{type:"object"},payloadJson:{type:"string"}}},cancel:{},fieldChange:{parameters:{fieldPath:{type:"string"},value:{type:"any"},payload:{type:"object"},isValid:{type:"boolean"}}},validationStateChanged:{parameters:{isValid:{type:"boolean"}}},validationError:{parameters:{fieldPath:{type:"string"},message:{type:"string"}}},validationSuccess:{parameters:{fieldPath:{type:"string"}}},error:{parameters:{message:{type:"string"},exception:{type:"object"}}},beforeLayoutSectionChange:{parameters:{stepIndex:{type:"int"},payload:{type:"object"},preventDefault:{type:"function"},addError:{type:"function"},resumeNavigation:{type:"function"}}}}},initODataDelegate:function t(){if(!this.odataDelegate){if(this.getBindingInfo("dataJson")){return}const t=this.getBindingInfo("data");if(t&&t.path&&t.path!==""){return}const e=this.getBindingContext("odata")||this.getBindingContext();if(e){f.debug("[MetaUI DynamicHost]",`Context found for delegate initialization: ${e.getPath()}`,"DynamicHost");if(e&&e.requestObject&&typeof e.requestObject==="function"){f.debug("[MetaUI DynamicHost]",`Context supports requestObject/getObject. Instantiating ODataDelegate.`,"DynamicHost");this.odataDelegate=new h(this,e);this.odataDelegate.syncToEngine()}else{f.debug("[MetaUI DynamicHost]",`Context does NOT support requestObject/getObject! Keys: ${Object.keys(e)}`,"DynamicHost")}}}},setBindingContext:function e(i,n){t.prototype.setBindingContext.call(this,i,n);this.initODataDelegate();return this},bindElement:function e(i,n){t.prototype.bindElement.call(this,i,n);const a=typeof i==="object"?i.model:undefined;const o=this.getElementBinding(a);if(o){o.attachChange(()=>{this.initODataDelegate()})}return this},onBeforeRendering:function e(){f.debug("[MetaUI DynamicHost]",`onBeforeRendering called. _initializedInner: ${this._initializedInner}`,"DynamicHost");this.initODataDelegate();if(!this._initializedInner){let e=this.getProperty("schemaDefinition");if(typeof e==="string"&&(e.startsWith("http://")||e.startsWith("https://"))){const i=this;if(i._fetchingSchema)return;i._fetchingSchema=true;o.show(0);g.resolve(e).then(e=>{const i=p.getBuilderFor(e);const n=i?i.build(e,this.getProperty("schemaTarget")):e;t.prototype.setProperty.call(this,"schemaDefinition",n,true);if(n.definitions){t.prototype.setProperty.call(this,"schemaDefinitions",n.definitions,true)}const a=this;a._fetchingSchema=false;o.hide();this.invalidate()}).catch(e=>{const i=this;s.show("Failed to fetch remote schema");t.prototype.setProperty.call(this,"schemaDefinition",null,true);i._fetchingSchema=false;o.hide();this.invalidate()});return}let i=e;if(i&&typeof i==="string"&&i.trim().startsWith("{")){try{i=JSON.parse(i)}catch(t){}}if(i&&typeof i==="object"){const e=p.getBuilderFor(i);if(e){i=e.build(i,this.getProperty("schemaTarget"));t.prototype.setProperty.call(this,"schemaDefinition",i,true);if(i.definitions){t.prototype.setProperty.call(this,"schemaDefinitions",i.definitions,true)}}}const n=this.getProperty("dataJson");const a=this.getProperty("data");let l=!!i;if(l&&typeof i==="object"&&Object.keys(i).length===0){l=false}const c=!!n||!!a;if(c&&this.getProperty("inferenceStrategy")==="AI"){const e=this;if(e._fetchingSchema)return;e._fetchingSchema=true;let l=a;if(!l&&n){try{l=JSON.parse(n)}catch(t){const e="Ignored invalid dataJson parse: "+t.message;f.error("[DynamicHost]",e,"DynamicHost");r.error(e,{title:"Invalid JSON Data"})}}if(l){o.show(0);const e=y.getProxy();e.generateSchema(l,i||undefined).then(e=>{const i=this;t.prototype.setProperty.call(this,"schemaDefinition",e,true);i._fetchingSchema=false;o.hide();this.invalidate()}).catch(e=>{const i=this;f.warn("[MetaUI DynamicHost]","AI inference failed, falling back to RuleBased. Error: "+e.message,"DynamicHost");s.show("AI Inference failed, using fallback.");t.prototype.setProperty.call(this,"inferenceStrategy","RuleBased",true);i._fetchingSchema=false;o.hide();this.invalidate()});return}}f.debug("[MetaUI DynamicHost]",`Evaluating boot. hasSchema: ${l}, hasData: ${c}`,"DynamicHost");if(l||c){if(this.getProperty("debugMode")){f.debug("[MetaUI DynamicHost]",`Booting inner host. hasSchema: ${l}, hasData: ${c}`,"DynamicHost")}this._innerHost=new u;const e=this.getMetadata().getProperties();for(const i in e){if(i==="inferenceStrategy")continue;const e=t.prototype.getProperty.call(this,i);if(e!==null&&e!==undefined){if(i==="schemaDefinitions"){f.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(e)}`,"","DynamicHost")}this._innerHost.setProperty(i,e)}else if(i==="schemaDefinitions"){f.warn(`[MetaUI DynamicHost] Warning: schemaDefinitions is null/undefined in Wrapper. Defaulting to empty object in GeneratorHost.`,"","DynamicHost")}}this.setAggregation("_content",this._innerHost);const i=this.getMetadata().getEvents();for(const e in i){this._innerHost.attachEvent(e,i=>{if(e==="submit"||e==="fieldChange"){const n=i.getParameters();if(n.payload){const i=this.getProperty("liveUpdate")===true;if(e==="submit"||i){t.prototype.setProperty.call(this,"data",n.payload,true);const e=n.payloadJson||JSON.stringify(n.payload,null,2);t.prototype.setProperty.call(this,"dataJson",e,true)}}}this.fireEvent(e,i.getParameters())})}this._initializedInner=true}}},setProperty:function e(i,n,a){if(i==="data"||i==="dataJson"||i==="schemaDefinition"||i==="schemaDefinitions"){if(this.getProperty("debugMode")){f.debug("[MetaUI DynamicHost]",`Wrapper received setProperty: ${i}`,"DynamicHost")}}t.prototype.setProperty.call(this,i,n,a);if(this._innerHost&&i!=="inferenceStrategy"){this._innerHost.setProperty(i,n,a)}else if(i==="data"||i==="dataJson"||i==="schemaDefinition"||i==="schemaDefinitions"){if(this.getProperty("debugMode")){f.debug("[MetaUI DynamicHost]",`_innerHost not yet initialized when ${i} was set. Booting will happen on next render.`,"DynamicHost")}}return this},openInDialog:function t(e,i,n,a,o){if(!this._innerHost){this.onBeforeRendering()}this._innerHost?.openInDialog(e,i,n,a,o)},triggerSubmit:function t(){if(!this._innerHost){return false}return this._innerHost.triggerSubmit()},addCustomError:function t(e,i){const n=this._innerHost;if(n&&typeof n.addCustomError==="function"){n.addCustomError(e,i)}},clearCustomError:function t(e){const i=this._innerHost;if(i&&typeof i.clearCustomError==="function"){i.clearCustomError(e)}},getProperty:function e(i){if(i==="outputData"){i="data"}if(this._innerHost&&(i==="data"||i==="dataJson")){return this._innerHost.getProperty(i)}return t.prototype.getProperty.call(this,i)}});return m});
|
|
11
11
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/GeolocationControl", ["./BaseHardwareControl","./BaseHardwareControlRenderer","sap/m/Button","sap/m/Input","sap/m/VBox","sap/m/MessageToast"],function(t,e,o,i,n,s){"use strict";function r(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}function a(t){return new Promise(function(e,o){sap.ui.require([t],function(o){if(!(o&&o.__esModule)){o=o===null||!(typeof o==="object"&&t.endsWith("/library"))?{default:o}:o;Object.defineProperty(o,"__esModule",{value:true})}e(o)},function(t){o(t)})})}const u=r(t);const l=r(e);class c extends u{static renderer=l;init(){super.init();this.locationBtn=new o({icon:"sap-icon://map",text:"Get Location",press:this.getLocation.bind(this)});this.resultInput=new i({editable:false,visible:false});this.vBox=new n({items:[this.locationBtn,this.resultInput]});this.setAggregation("_content",this.vBox)}onBeforeRendering(){const t=this.getProperty("schemaMetadata");if(t&&t.ui&&t.ui.label){this.locationBtn.setText(t.ui.label)}const e=this.getProperty("readOnly");this.locationBtn.setEnabled(!e);const o=this.getProperty("value");if(o){this.resultInput.setValue(o);this.resultInput.setVisible(true)}}getLocation(){if(!navigator.geolocation){s.show("Geolocation is not supported by your browser");return}navigator.geolocation.getCurrentPosition(t=>{const e=`${t.coords.latitude}, ${t.coords.longitude}`;this.resultInput.setValue(e);this.resultInput.setVisible(true);this.setValueAndFire(e);s.show("Location acquired.")},t=>{a("../utils/Logger").then(({Logger:e})=>{e.error("[MetaUI] Geolocation failed or denied",t.message,"GeolocationControl")});s.show("Unable to retrieve your location")})}}return c});
|
|
12
12
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/RichTextControl", ["./BaseHardwareControl","./BaseHardwareControlRenderer","sap/m/VBox","sap/ui/richtexteditor/RichTextEditor"],function(t,e,i,r){"use strict";function n(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const o=n(t);const s=n(e);const h=o.extend("nz.co.siliconst.ui5.metaui.controls.RichTextControl",{renderer:s,init:function t(){o.prototype.init.call(this);this.richTextEditor=new r({width:"100%",height:"300px",showGroupFont:true,showGroupInsert:true,tooltip:"Rich Text Editor",change:t=>{const e=t.getParameter("newValue");this.setValueAndFire(e)}});this.vBox=new i({items:[this.richTextEditor]});this.setAggregation("_content",this.vBox)},onBeforeRendering:function t(){const e=this.getProperty("readOnly");this.richTextEditor.setEditable(!e);const i=this.getProperty("value");if(i!==undefined&&i!==null){if(this.richTextEditor.getValue()!==i){this.richTextEditor.setValue(i)}}},setValue:function t(e){this.setProperty("value",e,true);if(this.richTextEditor&&e!==undefined&&e!==null){if(this.richTextEditor.getValue()!==e){this.richTextEditor.setValue(e)}}return this}});return h});
|
|
13
13
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/SignatureControl", ["./BaseHardwareControl","sap/m/Button","sap/m/VBox","sap/ui/core/HTML","sap/m/MessageToast"],function(t,s,a,i,n){"use strict";function e(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const h=e(t);class r extends h{isDrawing=false;canvasCtx=null;canvasEl=null;init(){super.init();this.canvasHtml=new i({content:"<canvas width='400' height='200' style='border: 1px solid #ccc; background-color: #fff; touch-action: none; cursor: crosshair;'></canvas>",afterRendering:this.onCanvasRendered.bind(this)}).addStyleClass("sapUiSmallMarginBottom");this.clearBtn=new s({icon:"sap-icon://sys-cancel",text:"Clear Signature",press:this.clearSignature.bind(this)});this.vBox=new a({items:[this.canvasHtml,this.clearBtn]});this.setAggregation("_content",this.vBox);this.boundStartDrawing=this.startDrawing.bind(this);this.boundDraw=this.draw.bind(this);this.boundStopDrawing=this.stopDrawing.bind(this);this.boundStartDrawingTouch=this.startDrawingTouch.bind(this);this.boundDrawTouch=this.drawTouch.bind(this)}onCanvasRendered(){const t=this.canvasHtml.getDomRef();if(!t)return;this.canvasEl=t;this.canvasCtx=this.canvasEl.getContext("2d");if(this.canvasCtx){this.canvasCtx.lineWidth=2;this.canvasCtx.lineCap="round";this.canvasCtx.strokeStyle="#000"}this.canvasEl.addEventListener("mousedown",this.boundStartDrawing);this.canvasEl.addEventListener("mousemove",this.boundDraw);this.canvasEl.addEventListener("mouseup",this.boundStopDrawing);this.canvasEl.addEventListener("mouseout",this.boundStopDrawing);this.canvasEl.addEventListener("touchstart",this.boundStartDrawingTouch,{passive:false});this.canvasEl.addEventListener("touchmove",this.boundDrawTouch,{passive:false});this.canvasEl.addEventListener("touchend",this.boundStopDrawing);const s=this.getProperty("value");if(s&&typeof s==="string"&&s.startsWith("data:image")){this.loadImageOntoCanvas(s)}}loadImageOntoCanvas(t){const s=new window.Image;s.onload=()=>{if(this.canvasCtx&&this.canvasEl){this.canvasCtx.clearRect(0,0,this.canvasEl.width,this.canvasEl.height);this.canvasCtx.drawImage(s,0,0,this.canvasEl.width,this.canvasEl.height)}};s.src=t}getCoordinates(t){if(!this.canvasEl)return{x:0,y:0};const s=this.canvasEl.getBoundingClientRect();let a,i;if(t.type.startsWith("touch")){a=t.touches[0].clientX;i=t.touches[0].clientY}else{a=t.clientX;i=t.clientY}return{x:a-s.left,y:i-s.top}}startDrawing(t){this.isDrawing=true;this.draw(t)}startDrawingTouch(t){t.preventDefault();this.isDrawing=true;this.drawTouch(t)}draw(t){if(!this.isDrawing||!this.canvasCtx)return;const s=this.getCoordinates(t);this.canvasCtx.lineTo(s.x,s.y);this.canvasCtx.stroke();this.canvasCtx.beginPath();this.canvasCtx.moveTo(s.x,s.y)}drawTouch(t){if(!this.isDrawing||!this.canvasCtx)return;t.preventDefault();const s=this.getCoordinates(t);this.canvasCtx.lineTo(s.x,s.y);this.canvasCtx.stroke();this.canvasCtx.beginPath();this.canvasCtx.moveTo(s.x,s.y)}stopDrawing(){if(!this.isDrawing)return;this.isDrawing=false;if(this.canvasCtx){this.canvasCtx.beginPath();this.saveSignature()}}clearSignature(){if(this.canvasCtx&&this.canvasEl){this.canvasCtx.clearRect(0,0,this.canvasEl.width,this.canvasEl.height)}this.setValueAndFire(null);n.show("Signature cleared.")}saveSignature(){if(this.canvasEl){const t=this.canvasEl.toDataURL("image/png");this.setValueAndFire(t)}}setValue(t){super.setProperty("value",t);if(t&&typeof t==="string"&&t.startsWith("data:image")){this.loadImageOntoCanvas(t)}else if(!t&&this.canvasCtx&&this.canvasEl){this.canvasCtx.clearRect(0,0,this.canvasEl.width,this.canvasEl.height)}return this}exit(){if(this.canvasEl){this.canvasEl.removeEventListener("mousedown",this.boundStartDrawing);this.canvasEl.removeEventListener("mousemove",this.boundDraw);this.canvasEl.removeEventListener("mouseup",this.boundStopDrawing);this.canvasEl.removeEventListener("mouseout",this.boundStopDrawing);this.canvasEl.removeEventListener("touchstart",this.boundStartDrawingTouch);this.canvasEl.removeEventListener("touchmove",this.boundDrawTouch);this.canvasEl.removeEventListener("touchend",this.boundStopDrawing)}this.canvasEl=null;this.canvasCtx=null;super.exit()}}return r});
|
|
14
14
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/VoiceInputControl", ["./BaseHardwareControl","sap/m/Button","sap/m/VBox","sap/m/TextArea","sap/m/MessageToast","sap/m/HBox","../utils/Logger"],function(t,e,i,s,n,o,r){"use strict";function a(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const c=a(t);const h=r["Logger"];class l extends c{recognition=null;isRecording=false;init(){super.init();this.textArea=new s({rows:3,width:"100%",placeholder:"Dictated text will appear here...",liveChange:t=>{this.setValueAndFire(t.getParameter("value"))}});this.startBtn=new e({icon:"sap-icon://microphone",text:"Start Dictation",type:"Emphasized",press:this.toggleDictation.bind(this)});const t=new o({items:[this.startBtn]}).addStyleClass("sapUiSmallMarginTop");this.vBox=new i({items:[this.textArea,t]});this.setAggregation("_content",this.vBox);this.initSpeechRecognition()}toggleDictation(){if(this.isRecording){this.stopDictation()}else{this.startDictation()}}initSpeechRecognition(){const t=window.SpeechRecognition||window.webkitSpeechRecognition;if(t){this.recognition=new t;this.recognition.continuous=true;this.recognition.interimResults=true;this.recognition.onresult=t=>{let e="";let i="";for(let s=t.resultIndex;s<t.results.length;++s){if(t.results[s].isFinal){e+=t.results[s][0].transcript}else{i+=t.results[s][0].transcript}}const s=this.getProperty("value")||"";const n=s?s+" "+e:e;if(e){this.textArea.setValue(n);this.setValueAndFire(n)}else if(i){this.textArea.setValue(s?s+" "+i:i)}};this.recognition.onstart=()=>{this.isRecording=true;this.startBtn.setIcon("sap-icon://stop");this.startBtn.setText("Stop Recording");this.startBtn.setType("Reject");n.show("Listening... Please speak now.")};this.recognition.onerror=t=>{h.error("Speech recognition error",t.error,"VoiceInputControl");sap.ui.require(["sap/m/MessageBox"],e=>{e.error("Microphone Error: "+t.error+"\n\nPlease ensure you have a working microphone attached and have not blocked access in your browser settings.")});this.stopDictation()};this.recognition.onend=()=>{this.stopDictation()}}else{h.warn("Web Speech API not supported in this browser.","","VoiceInputControl");this.startBtn.setEnabled(false);this.startBtn.setTooltip("Speech Recognition is not supported in this browser.")}}startDictation(){if(!this.recognition)return;try{this.recognition.start();n.show("Requesting microphone access...");this.startBtn.setIcon("sap-icon://stop");this.startBtn.setText("Requesting mic...");this.startBtn.setType("Reject")}catch(t){const e=t;h.error("Failed to start speech recognition",e.message||String(e),"VoiceInputControl");sap.ui.require(["sap/m/MessageBox"],t=>{t.error("Failed to start dictation. Please ensure you have a working microphone and have granted browser permissions.\n\nDetails: "+(e.message||String(e)))});this.stopDictation()}}stopDictation(){if(!this.recognition)return;try{this.recognition.stop()}catch(t){h.warn("Failed to gracefully stop speech recognition.",String(t),"VoiceInputControl")}this.isRecording=false;this.startBtn.setIcon("sap-icon://microphone");this.startBtn.setText("Start Dictation");this.startBtn.setType("Emphasized")}onBeforeRendering(){const t=this.getProperty("readOnly");this.textArea.setEditable(!t);this.startBtn.setEnabled(!t&&!!this.recognition);const e=this.getProperty("value");if(e!==undefined&&e!==null){if(!this.isRecording){this.textArea.setValue(e)}}}exit(){this.stopDictation();if(this.recognition){this.recognition.onstart=null;this.recognition.onresult=null;this.recognition.onerror=null;this.recognition.onend=null;this.recognition=null}super.exit()}}return l});
|
|
15
|
-
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost", ["sap/ui/core/Control","../../utils/Logger","../../core/SchemaNormalizer","../../core/SchemaValidator","../../core/Engine","../../core/StateManager","../../core/PolicyEngine","./delegates/DataSyncDelegate","./delegates/ValidationDelegate","./delegates/DialogDelegate","sap/m/MessageBox","sap/m/MessageStrip","sap/m/VBox","../../core/PluginRegistry","../../core/LayoutScorer","../../core/LayoutMutator","../../core/DefaultLayoutGenerator"],function(e,t,a,i,n,s,r,o,l,g,h,d,u,c,p,y,f){"use strict";const m=t["Logger"];const M=a["SchemaNormalizer"];const b=i["SchemaValidator"];const P=n["Engine"];const v=s["StateManager"];const D=r["PolicyEngine"];const S=o["DataSyncDelegate"];const V=l["ValidationDelegate"];const E=g["DialogDelegate"];const C=c["PluginRegistry"];const w=p["LayoutScorer"];const I=y["LayoutMutator"];const B=f["DefaultLayoutGenerator"];const U=e.extend("nz.co.siliconst.ui5.metaui.controls.host.GeneratorHost",{renderer:{apiVersion:2,render(e,t){e.openStart("div",t);e.style("width","100%");e.style("height","100%");e.openEnd();const a=t.getAggregation("_content");if(a){e.renderControl(a)}e.close("div")}},metadata:{properties:{schemaDefinition:{type:"any",defaultValue:null},schemaDefinitions:{type:"object",defaultValue:{}},schemaTarget:{type:"string",defaultValue:null},pluginRegistry:{type:"object",defaultValue:null},schemaBuilderRegistry:{type:"object",defaultValue:null},data:{type:"object",defaultValue:null,bindable:"bindable"},dataJson:{type:"string",defaultValue:null,bindable:"bindable"},liveUpdate:{type:"boolean",defaultValue:false},isValid:{type:"boolean",defaultValue:true},useMessageManager:{type:"boolean",defaultValue:false},modelName:{type:"string",defaultValue:"meta"},debugMode:{type:"boolean",defaultValue:false},editable:{type:"boolean",defaultValue:true},layoutBudget:{type:"int",defaultValue:0},engineScopeId:{type:"string",defaultValue:null}},aggregations:{_content:{type:"sap.ui.core.Control",multiple:false,visibility:"hidden"}},events:{beforeSubmit:{parameters:{payload:{type:"object"},addError:{type:"function"},preventDefault:{type:"function"}}},submit:{parameters:{payload:{type:"object"},payloadJson:{type:"string"}}},cancel:{},fieldChange:{parameters:{fieldPath:{type:"string"},value:{type:"any"},payload:{type:"object"},isValid:{type:"boolean"}}},validationStateChanged:{parameters:{isValid:{type:"boolean"}}},validationError:{parameters:{fieldPath:{type:"string"},message:{type:"string"}}},validationSuccess:{parameters:{fieldPath:{type:"string"}}},error:{parameters:{message:{type:"string"},exception:{type:"object"}}}}},constructor:function t(a,i){e.prototype.constructor.call(this,a,i);this.stateManager=null;this.generatedContent=null;this.engine=null;this.policyEngine=null;this.policyDebounceTimer=null;this.activeModelName="";this.parsedSchema=null;this._generatePromise=null},init:function t(){e.prototype.init.call(this);this.dataSyncDelegate=new S(this);this.validationDelegate=new V(this);this.dialogDelegate=new E(this);this.onInternalFieldChange=this.onInternalFieldChange.bind(this)},setDebugMode:function e(t){this.setProperty("debugMode",t,true);m.setDebugMode(t);return this},getStateManager:function e(){return this.stateManager},getSchemaDefinition:function e(t){const a=this.getProperty("schemaDefinitions");if(!a||!t)return undefined;let i=t;if(i.startsWith("#/definitions/")){i=i.substring(14)}else if(i.startsWith("#/components/schemas/")){i=i.substring(21)}return a[i]},tearDownGeneratedLayout:function e(){if(this.generatedContent){this.validationDelegate.unregisterObject(this.generatedContent);this.generatedContent.destroy();this.generatedContent=null}},onInternalFieldChange:function e(t,a,i,n){const s=this.stateManager?this.stateManager.extractPayload():{};if(this.getProperty("liveUpdate")===true){if(this.getProperty("debugMode")){m.debug("[MetaUI]","liveUpdate is enabled, pushing outbound payload.","GeneratorHost")}this.dataSyncDelegate.pushToBindings(s)}const r=this.getProperty("isValid");if(t!==r){this.setProperty("isValid",t,true);this.fireEvent("validationStateChanged",{isValid:t});if(this.getProperty("debugMode")){m.debug("[MetaUI]",`Validation state shifted to: ${t}`,"GeneratorHost")}}this.fireEvent("fieldChange",{fieldPath:a||"",value:undefined,payload:s,isValid:t});if(this.policyEngine&&a){if(this.policyDebounceTimer)clearTimeout(this.policyDebounceTimer);this.policyDebounceTimer=setTimeout(()=>{this.evaluatePolicies()},200)}},evaluatePolicies:function e(){if(!this.policyEngine||!this.stateManager||!this.engine)return;const t=this.stateManager.extractPayload();const a=this.policyEngine.evaluate(t);for(const e of a){const t=this.engine.getPluginByPath(e.target);if(t){if((e.property==="visibility"||e.property==="editable")&&e.value===false){this.stateManager.setProperty(e.target,undefined)}switch(e.property){case"visibility":if(t.applyVisibility)t.applyVisibility(e.value);break;case"validity":if(e.value){this.engine.reportPolicyError(e.target,null)}else{this.engine.reportPolicyError(e.target,e.errorMessage||"Validation failed by policy")}break;case"required":if(t.applyRequired)t.applyRequired(e.value);break;case"editable":if(t.applyEditable)t.applyEditable(e.value);break}}}},exit:function e(){if(this.engine){this.engine.destroy();this.engine=null}if(this.stateManager){this.stateManager.getModel().destroy();this.stateManager=null}if(this.generatedContent){this.generatedContent.destroy();this.generatedContent=null}},getParsedSchema:function e(){return this.parsedSchema},onBeforeRendering:function e(){if(this.getProperty("debugMode")){m.debug("[MetaUI GeneratorHost]",`onBeforeRendering called. Engine boot state: schemaDefinition exists = ${!!this.getProperty("schemaDefinition")}, data exists = ${!!this.getProperty("data")}, dataJson exists = ${!!this.getProperty("dataJson")}`,"GeneratorHost")}if(!this.generatedContent){const e=!!this.getProperty("schemaDefinition");const t=!!this.getProperty("dataJson")||!!this.getProperty("data");if(e||t){this.generate()}else{const e="GeneratorHost skipped rendering. Neither 'schemaDefinition' nor 'data' was provided.";m.error("[MetaUI]",e,"GeneratorHost");this.fireEvent("error",{message:e});throw new Error(e)}}},triggerSubmit:function e(){if(this.stateManager&&this.engine){let e=false;this.validationDelegate.removeAllMessages();if(this.policyEngine){this.evaluatePolicies()}const t=this.engine.validateAll(true);if(t.length>0){if(this.getProperty("useMessageManager")===true){this.validationDelegate.pushMessage("","One or more fields failed schema validation. Please review the highlighted fields.")}for(const e of t){if(e.fieldKey&&e.errorMessage){this.validationDelegate.pushMessage(e.fieldKey,e.errorMessage,e.fieldLabel)}}return false}const a=this.stateManager.extractPayload();const i=JSON.stringify(a);this.fireEvent("beforeSubmit",{payload:a,preventDefault:()=>{e=true},addError:(t,a)=>{e=true;if(this.getProperty("useMessageManager")===true){this.validationDelegate.pushMessage(t,a)}if(this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){e.setVisualValidationState(false,a)}}}});if(e){return false}this.dataSyncDelegate.pushToBindings(a);this.fireEvent("submit",{payload:a,payloadJson:i});return true}return false},addCustomError:function e(t,a){this.validationDelegate.addCustomError(t,a);if(this.getProperty("useMessageManager")!==true&&this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){e.setVisualValidationState(false,a)}}},clearCustomError:function e(t){this.validationDelegate.clearCustomError(t);if(this.getProperty("useMessageManager")!==true&&this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){const t=e.validate();e.setVisualValidationState(t.isValid,t.errorMessage)}}},setBusy:function t(a){e.prototype.setBusy.call(this,a);return this},setProperty:function t(a,i,n){if(a==="useMessageManager"&&this.stateManager){this.stateManager.setUseMessageManager(i===true)}if(a==="dataJson"||a==="data"){this.dataSyncDelegate.handleInputDataHotSwap(a,i,n);return this}if(a==="editable"||a==="debugMode"||a==="schemaDefinition"||a==="schemaTarget"){const t=this.getProperty(a);if(t!==i){e.prototype.setProperty.call(this,a,i,n);this.tearDownGeneratedLayout()}return this}return e.prototype.setProperty.call(this,a,i,n)},setBaseProperty:function t(a,i,n){return e.prototype.setProperty.call(this,a,i,n)},generate:async function e(){if(this._generatePromise){return this._generatePromise}this._generatePromise=Promise.resolve().then(async()=>{try{await this._doGenerate()}catch(e){m.error("[MetaUI]","Error in deferred generate: "+e,"GeneratorHost");throw e}finally{this._generatePromise=null}});return this._generatePromise},_doGenerate:async function e(){try{this.tearDownGeneratedLayout();let e=null;if(this.stateManager){e=this.stateManager.extractPayload()}if(this.engine){this.engine.destroy();this.engine=null}if(this.stateManager){this.stateManager.getModel().destroy();this.stateManager=null}let t=this.getProperty("schemaDefinition");if(t&&typeof t==="object"){t=JSON.parse(JSON.stringify(t))}const a=!t||typeof t==="object"&&Object.keys(t).length===0;let i=this.getProperty("data");const n=this.getProperty("dataJson");let s="";if(n){try{i=JSON.parse(n)}catch(e){s="Failed to parse inputDataJson string: "+e.message;m.error("[MetaUI]",s,"GeneratorHost");this.fireEvent("error",{message:s,exception:e});i={}}}else if(typeof i==="string"){try{i=JSON.parse(i)}catch(e){s="Failed to parse inputData string: "+e.message;m.error("[MetaUI]",s,"GeneratorHost");this.fireEvent("error",{message:s,exception:e});i={}}}const r=s?i:e||i;if(!r||Object.keys(r).length===0){if(a){const e="No payload provided and no explicit schema defined. Cannot infer UI.";m.error("[MetaUI]",e,"GeneratorHost");this.fireEvent("error",{message:e});throw new Error(e)}}const o=a?null:t;const l=M.normalize(o,r);this.parsedSchema=l;if(l){if(l.uiPolicies&&l.uiPolicies.length>0){this.policyEngine=new D(l.uiPolicies)}else{this.policyEngine=null}const e=b.validateSchemaStructure(l);if(e.length>0){const t="Schema Structural Errors Found:\n- "+e.join("\n- ");m.error("[MetaUI]",t,"GeneratorHost");if(this.getProperty("debugMode")){h.error(t,{title:"MetaUI Schema Error"});return}}}const g=this.getProperty("schemaDefinitions")||{};let c=t;if(typeof t==="string"&&t.trim()!==""){try{c=JSON.parse(t)}catch(e){}}if(c&&typeof c==="object"&&c.definitions){Object.assign(g,c.definitions);this.setProperty("schemaDefinitions",g,true)}let p;if(Object.keys(g).length>0){p={};for(const e in g){try{p[e]=M.normalize(g[e])}catch(t){m.warn(`[MetaUI] Failed to normalize schema definition '${e}'`,"","GeneratorHost")}}}const y=this.getProperty("layoutBudget");if(B.ensureLayout(l)){m.warn("[MetaUI GeneratorHost] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.")}w.apply(l,y,p);I.apply(l);const f=this.getProperty("pluginRegistry")||C.getInstance();const S=f.getPathsToLoad(l);const V=Array.from(S).some(e=>!sap.ui.require(e));if(V){this.setBusy(true);await f.preloadDependencies(l);this.setBusy(false)}if(l&&r){this.dataSyncDelegate.injectSchemaDefaults(l,r)}this.activeModelName="metaUI_"+this.getId();this.stateManager=new v(r,l,this.activeModelName);this.stateManager.setUseMessageManager(this.getProperty("useMessageManager")===true);this.setModel(this.stateManager.getModel(),this.activeModelName);if(!this.engine){const e=this.getProperty("editable")!==false;const t=this.getProperty("useMessageManager")===true;const a=this.getProperty("pluginRegistry")||C.getInstance();this.engine=new P(e,t,a);this.engine.host=this}this.generatedContent=this.engine.build(l,this.stateManager.getModel(),this.activeModelName,this.triggerSubmit.bind(this),this.getId(),this.onInternalFieldChange.bind(this));if(this.policyEngine){this.evaluatePolicies()}let E=this.generatedContent;const U=l&&Object.keys(l).length>0;if(!U){const e=new d({text:"Warning: The generated UI is blank. Reason: The schema (or inferred schema) contains no valid properties to render.",type:"Warning",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMargin");E=new u({items:[e]})}else if(s){const e=new d({text:"Data Error: "+s+". The form has been rendered with a blank dataset.",type:"Error",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMargin");if(typeof E.insertItem==="function"){E.insertItem(e,0)}else if(typeof E.insertContent==="function"){E.insertContent(e,0)}else{E=new u({items:[e,this.generatedContent]})}}else if(this.engine.hasPartialRenderingErrors){const e=new d({text:"Layout partially rendered. Some fields failed to generate due to configuration errors.",type:"Warning",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMarginBottom");E=new u({items:[e,this.generatedContent]})}this.setAggregation("_content",E);this.validationDelegate.registerObject(this.generatedContent);const G=this.stateManager.extractPayload();this.dataSyncDelegate.pushToBindings(G);this.dialogDelegate.calculateAndApplyOptimalWidth(this.parsedSchema)}catch(e){this.setBusy(false);const t="Fatal crash during layout generation: "+e.message;m.error("[MetaUI]",t,"GeneratorHost");this.fireEvent("error",{message:t,exception:e});this.validationDelegate.mountCrashBoundary(e);throw e}},openInDialog:function e(t="Form",a="OK",i="Cancel",n="auto",s){const r=!!this.generatedContent;this.dialogDelegate.openInDialog(t,a,r,i,n,s)}});return U});
|
|
15
|
+
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost", ["sap/ui/core/Control","../../utils/Logger","../../core/SchemaNormalizer","../../core/SchemaValidator","../../core/Engine","../../core/StateManager","../../core/PolicyEngine","./delegates/DataSyncDelegate","./delegates/ValidationDelegate","./delegates/DialogDelegate","sap/m/MessageBox","sap/m/MessageStrip","sap/m/VBox","../../core/PluginRegistry","../../core/LayoutScorer","../../core/LayoutMutator","../../core/DefaultLayoutGenerator"],function(e,t,a,i,n,s,r,o,l,g,h,d,u,c,p,y,f){"use strict";const m=t["Logger"];const M=a["SchemaNormalizer"];const b=i["SchemaValidator"];const P=n["Engine"];const v=s["StateManager"];const D=r["PolicyEngine"];const S=o["DataSyncDelegate"];const V=l["ValidationDelegate"];const E=g["DialogDelegate"];const C=c["PluginRegistry"];const w=p["LayoutScorer"];const I=y["LayoutMutator"];const B=f["DefaultLayoutGenerator"];const U=e.extend("nz.co.siliconst.ui5.metaui.controls.host.GeneratorHost",{renderer:{apiVersion:2,render(e,t){e.openStart("div",t);e.style("width","100%");e.style("height","100%");e.openEnd();const a=t.getAggregation("_content");if(a){e.renderControl(a)}e.close("div")}},metadata:{properties:{schemaDefinition:{type:"any",defaultValue:null},schemaDefinitions:{type:"object",defaultValue:{}},schemaTarget:{type:"string",defaultValue:null},pluginRegistry:{type:"object",defaultValue:null},schemaBuilderRegistry:{type:"object",defaultValue:null},data:{type:"object",defaultValue:null,bindable:"bindable"},dataJson:{type:"string",defaultValue:null,bindable:"bindable"},liveUpdate:{type:"boolean",defaultValue:false},isValid:{type:"boolean",defaultValue:true},useMessageManager:{type:"boolean",defaultValue:false},modelName:{type:"string",defaultValue:"meta"},debugMode:{type:"boolean",defaultValue:false},editable:{type:"boolean",defaultValue:true},layoutBudget:{type:"int",defaultValue:0},engineScopeId:{type:"string",defaultValue:null}},aggregations:{_content:{type:"sap.ui.core.Control",multiple:false,visibility:"hidden"}},events:{beforeSubmit:{parameters:{payload:{type:"object"},addError:{type:"function"},preventDefault:{type:"function"}}},submit:{parameters:{payload:{type:"object"},payloadJson:{type:"string"}}},cancel:{},fieldChange:{parameters:{fieldPath:{type:"string"},value:{type:"any"},payload:{type:"object"},isValid:{type:"boolean"}}},validationStateChanged:{parameters:{isValid:{type:"boolean"}}},validationError:{parameters:{fieldPath:{type:"string"},message:{type:"string"}}},validationSuccess:{parameters:{fieldPath:{type:"string"}}},error:{parameters:{message:{type:"string"},exception:{type:"object"}}},beforeLayoutSectionChange:{parameters:{stepIndex:{type:"int"},payload:{type:"object"},preventDefault:{type:"function"},addError:{type:"function"},resumeNavigation:{type:"function"}}}}},constructor:function t(a,i){e.prototype.constructor.call(this,a,i);this.stateManager=null;this.generatedContent=null;this.engine=null;this.policyEngine=null;this.policyDebounceTimer=null;this.activeModelName="";this.parsedSchema=null;this._generatePromise=null},init:function t(){e.prototype.init.call(this);this.dataSyncDelegate=new S(this);this.validationDelegate=new V(this);this.dialogDelegate=new E(this);this.onInternalFieldChange=this.onInternalFieldChange.bind(this)},setDebugMode:function e(t){this.setProperty("debugMode",t,true);m.setDebugMode(t);return this},getStateManager:function e(){return this.stateManager},getSchemaDefinition:function e(t){const a=this.getProperty("schemaDefinitions");if(!a||!t)return undefined;let i=t;if(i.startsWith("#/definitions/")){i=i.substring(14)}else if(i.startsWith("#/components/schemas/")){i=i.substring(21)}return a[i]},tearDownGeneratedLayout:function e(){if(this.generatedContent){this.validationDelegate.unregisterObject(this.generatedContent);this.generatedContent.destroy();this.generatedContent=null}},onInternalFieldChange:function e(t,a,i,n){const s=this.stateManager?this.stateManager.extractPayload():{};if(this.getProperty("liveUpdate")===true){if(this.getProperty("debugMode")){m.debug("[MetaUI]","liveUpdate is enabled, pushing outbound payload.","GeneratorHost")}this.dataSyncDelegate.pushToBindings(s)}const r=this.getProperty("isValid");if(t!==r){this.setProperty("isValid",t,true);this.fireEvent("validationStateChanged",{isValid:t});if(this.getProperty("debugMode")){m.debug("[MetaUI]",`Validation state shifted to: ${t}`,"GeneratorHost")}}this.fireEvent("fieldChange",{fieldPath:a||"",value:undefined,payload:s,isValid:t});if(this.policyEngine&&a){if(this.policyDebounceTimer)clearTimeout(this.policyDebounceTimer);this.policyDebounceTimer=setTimeout(()=>{this.evaluatePolicies()},200)}},evaluatePolicies:function e(){if(!this.policyEngine||!this.stateManager||!this.engine)return;const t=this.stateManager.extractPayload();const a=this.policyEngine.evaluate(t);for(const e of a){const t=this.engine.getPluginByPath(e.target);if(t){if((e.property==="visibility"||e.property==="editable")&&e.value===false){this.stateManager.setProperty(e.target,undefined)}switch(e.property){case"visibility":if(t.applyVisibility)t.applyVisibility(e.value);break;case"validity":if(e.value){this.engine.reportPolicyError(e.target,null)}else{this.engine.reportPolicyError(e.target,e.errorMessage||"Validation failed by policy")}break;case"required":if(t.applyRequired)t.applyRequired(e.value);break;case"editable":if(t.applyEditable)t.applyEditable(e.value);break}}}},exit:function e(){if(this.engine){this.engine.destroy();this.engine=null}if(this.stateManager){this.stateManager.getModel().destroy();this.stateManager=null}if(this.generatedContent){this.generatedContent.destroy();this.generatedContent=null}},getParsedSchema:function e(){return this.parsedSchema},onBeforeRendering:function e(){if(this.getProperty("debugMode")){m.debug("[MetaUI GeneratorHost]",`onBeforeRendering called. Engine boot state: schemaDefinition exists = ${!!this.getProperty("schemaDefinition")}, data exists = ${!!this.getProperty("data")}, dataJson exists = ${!!this.getProperty("dataJson")}`,"GeneratorHost")}if(!this.generatedContent){const e=!!this.getProperty("schemaDefinition");const t=!!this.getProperty("dataJson")||!!this.getProperty("data");if(e||t){this.generate()}else{const e="GeneratorHost skipped rendering. Neither 'schemaDefinition' nor 'data' was provided.";m.error("[MetaUI]",e,"GeneratorHost");this.fireEvent("error",{message:e});throw new Error(e)}}},triggerSubmit:function e(){if(this.stateManager&&this.engine){let e=false;this.validationDelegate.removeAllMessages();if(this.policyEngine){this.evaluatePolicies()}const t=this.engine.validateAll(true);if(t.length>0){if(this.getProperty("useMessageManager")===true){this.validationDelegate.pushMessage("","One or more fields failed schema validation. Please review the highlighted fields.")}for(const e of t){if(e.fieldKey&&e.errorMessage){this.validationDelegate.pushMessage(e.fieldKey,e.errorMessage,e.fieldLabel)}}return false}const a=this.stateManager.extractPayload();const i=JSON.stringify(a);this.fireEvent("beforeSubmit",{payload:a,preventDefault:()=>{e=true},addError:(t,a)=>{e=true;if(this.getProperty("useMessageManager")===true){this.validationDelegate.pushMessage(t,a)}if(this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){e.setVisualValidationState(false,a)}}}});if(e){return false}this.dataSyncDelegate.pushToBindings(a);this.fireEvent("submit",{payload:a,payloadJson:i});return true}return false},addCustomError:function e(t,a){this.validationDelegate.addCustomError(t,a);if(this.getProperty("useMessageManager")!==true&&this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){e.setVisualValidationState(false,a)}}},clearCustomError:function e(t){this.validationDelegate.clearCustomError(t);if(this.getProperty("useMessageManager")!==true&&this.engine){const e=this.engine.getPluginByPath(t);if(e&&typeof e.setVisualValidationState==="function"){const t=e.validate();e.setVisualValidationState(t.isValid,t.errorMessage)}}},setBusy:function t(a){e.prototype.setBusy.call(this,a);return this},setProperty:function t(a,i,n){if(a==="useMessageManager"&&this.stateManager){this.stateManager.setUseMessageManager(i===true)}if(a==="dataJson"||a==="data"){this.dataSyncDelegate.handleInputDataHotSwap(a,i,n);return this}if(a==="editable"||a==="debugMode"||a==="schemaDefinition"||a==="schemaTarget"){const t=this.getProperty(a);if(t!==i){e.prototype.setProperty.call(this,a,i,n);this.tearDownGeneratedLayout()}return this}return e.prototype.setProperty.call(this,a,i,n)},setBaseProperty:function t(a,i,n){return e.prototype.setProperty.call(this,a,i,n)},generate:async function e(){if(this._generatePromise){return this._generatePromise}this._generatePromise=Promise.resolve().then(async()=>{try{await this._doGenerate()}catch(e){m.error("[MetaUI]","Error in deferred generate: "+e,"GeneratorHost");throw e}finally{this._generatePromise=null}});return this._generatePromise},_doGenerate:async function e(){try{this.tearDownGeneratedLayout();let e=null;if(this.stateManager){e=this.stateManager.extractPayload()}if(this.engine){this.engine.destroy();this.engine=null}if(this.stateManager){this.stateManager.getModel().destroy();this.stateManager=null}let t=this.getProperty("schemaDefinition");if(t&&typeof t==="object"){t=JSON.parse(JSON.stringify(t))}const a=!t||typeof t==="object"&&Object.keys(t).length===0;let i=this.getProperty("data");const n=this.getProperty("dataJson");let s="";if(n){try{i=JSON.parse(n)}catch(e){s="Failed to parse inputDataJson string: "+e.message;m.error("[MetaUI]",s,"GeneratorHost");this.fireEvent("error",{message:s,exception:e});i={}}}else if(typeof i==="string"){try{i=JSON.parse(i)}catch(e){s="Failed to parse inputData string: "+e.message;m.error("[MetaUI]",s,"GeneratorHost");this.fireEvent("error",{message:s,exception:e});i={}}}const r=s?i:e||i;if(!r||Object.keys(r).length===0){if(a){const e="No payload provided and no explicit schema defined. Cannot infer UI.";m.error("[MetaUI]",e,"GeneratorHost");this.fireEvent("error",{message:e});throw new Error(e)}}const o=a?null:t;const l=M.normalize(o,r);this.parsedSchema=l;if(l){if(l.uiPolicies&&l.uiPolicies.length>0){this.policyEngine=new D(l.uiPolicies)}else{this.policyEngine=null}const e=b.validateSchemaStructure(l);if(e.length>0){const t="Schema Structural Errors Found:\n- "+e.join("\n- ");m.error("[MetaUI]",t,"GeneratorHost");if(this.getProperty("debugMode")){h.error(t,{title:"MetaUI Schema Error"});return}}}const g=this.getProperty("schemaDefinitions")||{};let c=t;if(typeof t==="string"&&t.trim()!==""){try{c=JSON.parse(t)}catch(e){}}if(c&&typeof c==="object"&&c.definitions){Object.assign(g,c.definitions);this.setProperty("schemaDefinitions",g,true)}let p;if(Object.keys(g).length>0){p={};for(const e in g){try{p[e]=M.normalize(g[e])}catch(t){m.warn(`[MetaUI] Failed to normalize schema definition '${e}'`,"","GeneratorHost")}}}const y=this.getProperty("layoutBudget");if(B.ensureLayout(l)){m.warn("[MetaUI GeneratorHost] Missing 'uiLayout' array in schema. Synthesized a default layout mapping to prevent a blank render.")}w.apply(l,y,p);I.apply(l);const f=this.getProperty("pluginRegistry")||C.getInstance();const S=f.getPathsToLoad(l);const V=Array.from(S).some(e=>!sap.ui.require(e));if(V){this.setBusy(true);await f.preloadDependencies(l);this.setBusy(false)}if(l&&r){this.dataSyncDelegate.injectSchemaDefaults(l,r)}this.activeModelName="metaUI_"+this.getId();this.stateManager=new v(r,l,this.activeModelName);this.stateManager.setUseMessageManager(this.getProperty("useMessageManager")===true);this.setModel(this.stateManager.getModel(),this.activeModelName);if(!this.engine){const e=this.getProperty("editable")!==false;const t=this.getProperty("useMessageManager")===true;const a=this.getProperty("pluginRegistry")||C.getInstance();this.engine=new P(e,t,a);this.engine.host=this}this.generatedContent=this.engine.build(l,this.stateManager.getModel(),this.activeModelName,this.triggerSubmit.bind(this),this.getId(),this.onInternalFieldChange.bind(this));if(this.policyEngine){this.evaluatePolicies()}let E=this.generatedContent;const U=l&&Object.keys(l).length>0;if(!U){const e=new d({text:"Warning: The generated UI is blank. Reason: The schema (or inferred schema) contains no valid properties to render.",type:"Warning",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMargin");E=new u({items:[e]})}else if(s){const e=new d({text:"Data Error: "+s+". The form has been rendered with a blank dataset.",type:"Error",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMargin");if(typeof E.insertItem==="function"){E.insertItem(e,0)}else if(typeof E.insertContent==="function"){E.insertContent(e,0)}else{E=new u({items:[e,this.generatedContent]})}}else if(this.engine.hasPartialRenderingErrors){const e=new d({text:"Layout partially rendered. Some fields failed to generate due to configuration errors.",type:"Warning",showIcon:true,showCloseButton:true});e.addStyleClass("sapUiSmallMarginBottom");E=new u({items:[e,this.generatedContent]})}this.setAggregation("_content",E);this.validationDelegate.registerObject(this.generatedContent);const G=this.stateManager.extractPayload();this.dataSyncDelegate.pushToBindings(G);this.dialogDelegate.calculateAndApplyOptimalWidth(this.parsedSchema)}catch(e){this.setBusy(false);const t="Fatal crash during layout generation: "+e.message;m.error("[MetaUI]",t,"GeneratorHost");this.fireEvent("error",{message:t,exception:e});this.validationDelegate.mountCrashBoundary(e);throw e}},openInDialog:function e(t="Form",a="OK",i="Cancel",n="auto",s){const r=!!this.generatedContent;this.dialogDelegate.openInDialog(t,a,r,i,n,s)}});return U});
|
|
16
16
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/delegates/DataSyncDelegate", ["../../../utils/Logger","../../../core/SchemaNormalizer"],function(e,t){"use strict";const s=e["Logger"];const r=t["SchemaNormalizer"];class i{_isSyncing=false;constructor(e){this.host=e}pushToBindings(e){this._isSyncing=true;const t=JSON.stringify(e,null,2);this.host.setProperty("data",e,true);this.host.setProperty("dataJson",t,true);this._isSyncing=false}handleInputDataHotSwap(e,t,i){let o=null;if(typeof t==="string"){try{o=JSON.parse(t)}catch(s){this.host.setBaseProperty(e,t,false);return}}else{o=t}if(o===null){this.host.setBaseProperty(e,t,true);return}if(this._isSyncing){if(this.host.getProperty("debugMode")){s.debug("[MetaUI]",`Dropped echo for ${e} due to active sync lock`,"DataSyncDelegate")}this.host.setBaseProperty(e,t,i);return}if(this.host.getProperty("debugMode")){s.debug("[MetaUI]",`Accepted external injection for ${e}`,"DataSyncDelegate")}this.host.setBaseProperty(e,t,true);const a=this.host.getStateManager();if(!a){this.host.invalidate();return}try{a.getModel().setData(o,false);if(!this.host.getProperty("schemaDefinition")&&typeof this.host.getParsedSchema==="function"){const e=this.host.getParsedSchema();const t=r.inferSchemaFromData(o);if(!this.deepEquals(t,e)){this.host.tearDownGeneratedLayout();this.host.invalidate()}}}catch(t){const r=`Failed to hot-swap ${e}: `+t.message;s.error("[MetaUI]",r,"DataSyncDelegate");throw new Error(r)}}deepEquals(e,t){if(e===t)return true;if(typeof e!=="object"||typeof t!=="object"||e===null||t===null)return false;if(Array.isArray(e)!==Array.isArray(t))return false;const s=Object.keys(e);const r=Object.keys(t);if(s.length!==r.length)return false;for(const i of s){if(!r.includes(i))return false;if(!this.deepEquals(e[i],t[i]))return false}return true}injectSchemaDefaults(e,t,s=0){if(!e||!t||typeof t!=="object"||s>8)return;const r=e;const i=t;if(r.type==="object"&&r.properties){const e=r.properties;for(const t of Object.keys(e)){const r=e[t];if(i[t]===undefined){if(r.default!==undefined){i[t]=r.default}else if(r.type==="object"){const e={};this.injectSchemaDefaults(r,e,s+1);if(Object.keys(e).length>0){i[t]=e}}}else if(typeof i[t]==="object"&&i[t]!==null){this.injectSchemaDefaults(r,i[t],s+1)}}}else if(r.type==="array"&&r.items&&Array.isArray(i)){for(let e=0;e<i.length;e++){if(typeof i[e]==="object"&&i[e]!==null){this.injectSchemaDefaults(r.items,i[e],s+1)}}}}}var o={__esModule:true};o.DataSyncDelegate=i;return o});
|
|
17
17
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/delegates/DialogDelegate", ["sap/m/Dialog","sap/m/Button","sap/m/BusyDialog","../../../utils/Logger"],function(t,e,i,a){"use strict";const o=a["Logger"];class r{activeDialog=null;requestedWidth="auto";calculatedOptimalWidth="auto";constructor(t){this.host=t}async openInDialog(a="Form",r="OK",s,n="Cancel",l="auto",u){this.requestedWidth=l;this.calculatedOptimalWidth=l;const c=new i({text:"Building Form..."});c.open();try{const t=this.host.generate();if(t instanceof Promise){await t}}catch(t){c.close();o.error("[MetaUI] Catastrophic error during pre-generation of dialog content",t.message,"DialogDelegate");return}c.close();const d=this.requestedWidth==="auto"&&this.calculatedOptimalWidth!=="auto"?this.calculatedOptimalWidth:this.requestedWidth;const h=new t({title:a,contentWidth:d,content:[this.host],beginButton:new e({text:r,type:"Emphasized",press:()=>{try{const t=this.host.triggerSubmit();if(t){h.close()}}catch(t){o.error("[MetaUI] Catastrophic error during validation/submit pipeline",t.message,"DialogDelegate");this.host.fireEvent("validationError",{fieldPath:"root",message:t.message})}}}),endButton:new e({text:n,press:()=>{this.host.fireEvent("cancel");h.close()}}),afterClose:()=>{this.activeDialog=null;h.destroy()}});this.activeDialog=h;if(u&&typeof u.addDependent==="function"){u.addDependent(h)}h.open()}calculateAndApplyOptimalWidth(t){const e=this.calculateOptimalDialogWidth(t);this.calculatedOptimalWidth=e;if(this.activeDialog&&this.requestedWidth==="auto"&&e!=="auto"){this.activeDialog.setContentWidth(e)}}calculateOptimalDialogWidth(t){if(!t)return"auto";let e=false;const i=new WeakSet;const a=t=>{if(e)return;if(i.has(t))return;i.add(t);for(const i in t){const o=t[i];if(!o||typeof o!=="object")continue;if(o.type==="array"){e=true;return}if(o.ui?.fullWidth===true){e=true;return}if(o.ui?.widget==="codeEditor"||o.ui?.widget==="textArea"||o.ui?.widget==="richText"){e=true;return}if(o.properties)a(o.properties);if(o.items&&o.items.properties)a(o.items.properties)}i.delete(t)};if(t.type==="array")return"80vw";if(t.properties){a(t.properties)}return e?"80vw":"auto"}}var s={__esModule:true};s.DialogDelegate=r;return s});
|
|
18
18
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate", ["../../../utils/Logger"],function(t){"use strict";const e=t["Logger"];class a{odataType=null;isSyncing=false;constructor(t,e){this.host=t;this.context=e;this.detectODataType();this.host.attachEvent("fieldChange",this.onFieldChange,this)}onFieldChange(t){const e=t.getParameters();if(e.fieldPath&&e.value!==undefined){this.handleFieldChange(e.fieldPath,e.value)}}detectODataType(){const t=this.context.getModel();const e=t.getMetadata().getName();if(e.indexOf("v4")>-1){this.odataType="V4"}else if(e.indexOf("v2")>-1||e.indexOf("ODataModel")>-1){this.odataType="V2"}}syncToEngine(){if(!this.odataType)return;if(this.odataType==="V4"){if(typeof this.context.requestObject==="function"){this.context.requestObject().then(t=>{this.pushPayload(t)}).catch(t=>{e.error("[MetaUI]","Failed to extract V4 Context payload: "+t.message,"ODataDelegate")})}}else if(this.odataType==="V2"){const t=this.context.getObject();if(t){this.pushPayload(t)}}}pushPayload(t){if(!t)return;const e={...t};for(const t of Object.keys(e)){if(t.startsWith("@")||t.startsWith("__")){delete e[t]}}this.isSyncing=true;this.host.setProperty("data",e);this.isSyncing=false}handleFieldChange(t,a){if(this.isSyncing||!this.odataType)return;try{if(this.odataType==="V4"){this.context.setProperty(t,a)}else if(this.odataType==="V2"){const e=this.context.getModel();e.setProperty(t,a,this.context)}if(this.host.getProperty("debugMode")){e.debug("[MetaUI]",`ODataDelegate Patched ${t} = ${a} via ${this.odataType}`,"ODataDelegate")}}catch(t){e.error("[MetaUI]",`Failed to patch OData context: ${t.message}`,"ODataDelegate")}}}var s={__esModule:true};s.ODataDelegate=a;return s});
|
|
19
19
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/controls/host/delegates/ValidationDelegate", ["sap/m/IllustratedMessage","sap/ui/core/Messaging","../../../utils/Logger","sap/ui/core/message/Message","sap/ui/core/library"],function(e,t,s,r,a){"use strict";const o=s["Logger"];class g{constructor(e){this.host=e}registerObject(e){}unregisterObject(e){}removeAllMessages(){const e=this.host.getStateManager();if(e&&this.host.getProperty("useMessageManager")){const s=t;const r=s.getMessageModel().getData();const a=r.filter(t=>t.getMessageProcessor()&&t.getMessageProcessor().getId()===e.getModel().getId());if(a&&a.length>0){s.removeMessages(a)}}}pushMessage(e,s,g){const n=e?`/${e.replace(/^\//,"")}`:"";const i=g||e;const c=e?`Field '${i}': ${s}`:s;if(e){o.warn(`[MetaUI Validation Error] ${c}`)}else{o.warn(`[MetaUI Validation Error] Global - ${s}`)}if(this.host.getProperty("useMessageManager")===true){const e=t;const s=this.host.getStateManager();e.addMessages(new r({message:c,additionalText:i!==n?i:undefined,type:a.MessageType.Error,target:n,processor:s?.getModel()}))}}addCustomError(e,s){if(this.host.getProperty("useMessageManager")!==true){return}const o=this.host.getStateManager();if(!o){return}t.addMessages(new r({message:s,type:a.MessageType.Error,target:`/${e.replace(/^\//,"")}`,processor:o.getModel(),code:"CustomError"}))}clearCustomError(e){if(this.host.getProperty("useMessageManager")!==true){return}const s=this.host.getStateManager();if(!s){return}const r=`/${e.replace(/^\//,"")}`;const a=s.getModel().getId();const o=t.getMessageModel().getData();const g=o.filter(e=>e.getTarget()===r&&e.getCode()==="CustomError"&&e.getMessageProcessor()?.getId()===a);if(g.length>0){t.removeMessages(g)}}mountCrashBoundary(t){o.error("[MetaUI] Engine failed to generate layout. Preventing Launchpad crash.",t.message,"ValidationDelegate");const s=new e({title:"UI Generation Failed",description:"The dynamic schema could not be rendered. Please check the Fiori console for diagnostic logs."});this.host.setAggregation("_content",s)}}var n={__esModule:true};n.ValidationDelegate=g;return n});
|
|
20
20
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator", ["../utils/Logger"],function(e){"use strict";const t=e["Logger"];class r{static ensureLayout(e){if(e.uiLayout&&Array.isArray(e.uiLayout)&&e.uiLayout.length>0){return false}const t=e.type==="array";const r=t?e.items?.properties:e.properties;if(!r||Object.keys(r).length===0){return false}const o=this.generateElementsFromProperties(r,"#/properties");if(t){e.uiLayout=o.filter(e=>e.type==="Control")}else{e.uiLayout=[{type:"Group",label:e.title,elements:o}]}return true}static generateElementsFromProperties(e,r){const o=[];for(const s of Object.keys(e)){try{const t=e[s];const n=`${r}/${s}`;o.push({type:"Control",scope:n})}catch(e){const r=`[MetaUI] DefaultLayoutGenerator failed to synthesize property '${s}': ${e.message}`;t.error(r);throw new Error(r)}}return o}}var o={__esModule:true};o.DefaultLayoutGenerator=r;return o});
|
|
21
|
-
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/Engine", ["./PluginRegistry","sap/m/Text","../utils/Logger","./DefaultLayoutGenerator","./PipelineManager"],function(e,t,i,r,n){"use strict";const
|
|
21
|
+
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/Engine", ["./PluginRegistry","sap/m/Text","../utils/Logger","./DefaultLayoutGenerator","sap/ui/core/Messaging","sap/ui/core/message/Message","sap/ui/core/library","./PipelineManager"],function(e,t,i,s,r,a,n,o){"use strict";const l=e["PluginRegistry"];const g=i["Logger"];const u=s["DefaultLayoutGenerator"];const c=o["GlobalPipeline"];class d{activePlugins=[];templatePlugins=[];validationLedger=new Map;activeMessages=new Map;isEditable=true;hasPartialRenderingErrors=false;useMessageManager=false;constructor(e=true,t=false,i){this.isEditable=e;this.useMessageManager=t;this.pluginRegistry=i||l.getInstance()}build(e,i,s="meta",r,a,n){this.activePlugins=[];this.activeModel=i;this.engineScopeId=a;this.onChange=(e,t,i,s)=>{if(t){this.reportSchemaError(t,e?null:i||"Invalid input")}if(n){n(e,t,i,s)}};try{const t=e.layoutStrategy||(e.type==="array"?"table":"form");const i=this.pluginRegistry.getLayout(t);return i.render(e,s,this,r)}catch(e){this.hasPartialRenderingErrors=true;const i=e.message;g.error("[MetaUI Engine] Critical error during layout generation",i);g.showErrorPopup(`Engine failed to generate the layout.\n\nDetails: ${i}`);return new t({text:"Critical Layout Error"})}}generateField(e,i,s,r=false){try{const t=this.pluginRegistry.getPlugin(e.type||"string",e.ui?.widget);if(typeof t.setEditable==="function"){t.setEditable(this.isEditable)}if(typeof t.setUseMessageManager==="function"){t.setUseMessageManager(this.useMessageManager)}if(!r){this.activePlugins.push({plugin:t,path:i})}else{this.templatePlugins.push({plugin:t,path:i})}const a=r?undefined:this.engineScopeId;const n=t.render(e,i,s,a,this.onChange,this.activeModel);return n}catch(e){this.hasPartialRenderingErrors=true;const s=e.message;g.error(`[MetaUI Engine] Failed to generate field at ${i}`,s);g.showErrorPopup(`Failed to generate field '${i}'.\n\nDetails: ${s}`);return new t({text:`[Error generating field ${i}]`})}}generateLayout(e,i,s){try{if(u.ensureLayout(e)){g.warn(`[MetaUI Engine] Missing 'uiLayout' array in sub-schema for ${s}. Synthesized a default layout mapping.`)}const t=e.layoutStrategy||(e.type==="array"?"table":"form");const r=this.pluginRegistry.getLayout(t);return r.render(e,i,this,undefined,s)}catch(e){this.hasPartialRenderingErrors=true;const i=e.message;g.error(`[MetaUI Engine] Critical error generating sub-layout for ${s}`,i);g.showErrorPopup(`Engine failed to generate a sub-layout.\n\nDetails: ${i}`);return new t({text:"Critical Sub-Layout Error"})}}validateAll(e=false){const t=[];for(const i of this.activePlugins){try{const s=i.plugin.validate();if(e){this.reportSchemaError(i.path,s.isValid?null:s.errorMessage||"Invalid input")}if(!s.isValid){s.fieldKey=s.fieldKey||i.path.replace(/^\//,"");t.push(s);g.error("[MetaUI Validation] Plugin failed validation silently:",i.path||i.plugin.constructor.name)}}catch(e){g.error(`[MetaUI Engine] Error validating plugin at ${i.path}`,e.message)}}if(this.host&&typeof this.host.getStateManager==="function"){const i=this.host.getStateManager();if(i){const s=i.extractPayload();const r=i.getSchema?i.getSchema():this.host.getParsedSchema?.();if(s&&r){const i=this.validatePayloadArrays(r,s,"");if(e){i.forEach(e=>{if(e.fieldKey){this.reportSchemaError(e.fieldKey,e.isValid?null:e.errorMessage||"Invalid input")}})}t.push(...i.filter(e=>!e.isValid))}}}return t}onArrayMutated(e){if(this.host&&typeof this.host.getStateManager==="function"){const t=this.host.getStateManager();if(t&&typeof t.clearArrayMessages==="function"){t.clearArrayMessages(e)}}}validatePayloadArrays(e,t,i){const s=[];if(!e||!t||typeof t!=="object")return s;if(e.type==="object"&&e.properties){for(const r of Object.keys(e.properties)){const a=e.properties[r];if(t[r]!==undefined){const e=i?`${i}/${r}`:r;s.push(...this.validatePayloadArrays(a,t[r],e))}}}else if(e.type==="array"&&e.items&&Array.isArray(t)){t.forEach((t,r)=>{const a=i?`${i}/${r}`:`${r}`;if(e.items.type==="object"&&e.items.properties){for(const i of Object.keys(e.items.properties)){const r=e.items.properties[i];const n=`${a}/${i}`;const o=t?t[i]:undefined;const l=[];const g={};if(r.required)l.push("required");if(r.maxLength!==undefined){l.push("maxLength");g["maxLength"]=r.maxLength}if(r.minLength!==undefined){l.push("minLength");g["minLength"]=r.minLength}if(r.pattern!==undefined){l.push("pattern");g["pattern"]={regex:r.pattern}}if(r.minimum!==undefined||r.maximum!==undefined){l.push("range");g["range"]={min:r.minimum,max:r.maximum}}const u=r.ui?.format;if(u==="email"||u==="url"||u==="iban"){l.push(u)}if(l.length>0){const e=c.executeValidation(o,l,g);if(!e.isValid){s.push({isValid:false,errorMessage:e.errorMessage,fieldKey:n,fieldLabel:r.ui?.label||i})}else{s.push({isValid:true,fieldKey:n})}}}}})}return s}getPluginByPath(e){const t=e.replace(/^\//,"");const i=this.activePlugins.find(e=>e.path.replace(/^\//,"")===t);return i?i.plugin:undefined}reportSchemaError(e,t){const i=e.replace(/^\//,"");if(!this.validationLedger.has(i)){this.validationLedger.set(i,{schemaError:null,policyError:null})}this.validationLedger.get(i).schemaError=t;this.resolveVisualState(i)}reportPolicyError(e,t){const i=e.replace(/^\//,"");if(!this.validationLedger.has(i)){this.validationLedger.set(i,{schemaError:null,policyError:null})}this.validationLedger.get(i).policyError=t;this.resolveVisualState(i)}resolveVisualState(e){const t=this.getPluginByPath(e);const i=this.validationLedger.get(e);if(!i)return;const s=i.policyError!==null||i.schemaError!==null;const o=i.policyError||i.schemaError;if(t&&typeof t.setVisualValidationState==="function"){t.setVisualValidationState(!s,s?o||undefined:undefined)}else{this.setNativeControlError(e,s?o||undefined:undefined)}if(this.useMessageManager){const i=this.activeMessages.get(e);if(i){r.removeMessages(i);this.activeMessages.delete(e)}if(s){const i=`/${e}`;const s=this.host&&typeof this.host.getStateManager==="function"?this.host.getStateManager()?.getModel():undefined;const l=typeof t?.getFieldLabel==="function"?t.getFieldLabel():undefined;const g=l||e;const u=`Field '${g}': ${o||"Validation Error"}`;const c=new a({message:u,additionalText:g!==i?g:undefined,type:n.MessageType.Error,target:i,processor:s});r.addMessages(c);this.activeMessages.set(e,c)}}}setNativeControlError(e,t){if(this.host&&this.host.generatedContent){const i=this.host.generatedContent;this.traverseAndSetError(i,e,t)}}traverseAndSetError(e,t,i){if(!e)return;const s=[e.getBindingInfo("value"),e.getBindingInfo("selectedKey"),e.getBindingInfo("dateValue"),e.getBindingInfo("selected")];for(const r of s){if(r&&r.parts&&r.parts.length>0){const s=r.parts[0].path;if(s===t||t.endsWith(s)){const r=e.getBindingContext(this.host.activeModelName);if(r){const a=r.getPath()+"/"+s;const n=a.replace(/^\//,"");if(n===t){if(typeof e.setValueState==="function"){e.setValueState(i?"Error":"None");if(typeof e.setValueStateText==="function"){e.setValueStateText(i||"")}}}}}}}if(typeof e.getAggregation==="function"&&typeof e.getMetadata==="function"){const s=e.getMetadata().getAggregations();for(const r in s){const s=e.getAggregation(r);if(Array.isArray(s)){s.forEach(e=>this.traverseAndSetError(e,t,i))}else if(s){this.traverseAndSetError(s,t,i)}}}}destroy(){for(const e of this.activePlugins){if(typeof e.plugin.destroy==="function"){e.plugin.destroy()}}for(const e of this.templatePlugins){if(typeof e.plugin.destroy==="function"){e.plugin.destroy()}}if(this.useMessageManager&&this.activeMessages.size>0){r.removeMessages(Array.from(this.activeMessages.values()))}this.validationLedger.clear();this.activeMessages.clear();this.activePlugins=[];this.templatePlugins=[]}}var h={__esModule:true};h.Engine=d;return h});
|
|
22
22
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/LayoutMutator", ["./SchemaNormalizer","../constants/MetaUIConstants"],function(e,t){"use strict";const s=e["SchemaNormalizer"];const o=t["RENDER_MODE"];const n=t["SCHEMA_TYPE"];class p{static apply(e){if(!e||!e.uiLayout||!Array.isArray(e.uiLayout)){return}e.uiLayout=this.expandElements(e.uiLayout,e)}static expandElements(e,t){const p=[];for(const r of e){if(r.type==="Group"){if(r.elements){r.elements=this.expandElements(r.elements,t)}p.push(r)}else if(r.type==="Control"){if(!r.scope){p.push(r);continue}try{const{meta:e,bindingPath:i}=s.resolveScope(t,r.scope);const a=!!e?.ui?.widget;const u=e?.type===n.OBJECT&&e.ui?.renderMode===o.INLINE&&!a;if(u&&e.properties){const s={...r,type:"Group",label:r.label||e.ui?.label||i.split("/").pop(),elements:[]};delete s.scope;for(const t of Object.keys(e.properties)){s.elements.push({type:"Control",scope:`${r.scope}/properties/${t}`})}s.elements=this.expandElements(s.elements,t);p.push(s)}else{p.push(r)}}catch(e){p.push(r)}}else{p.push(r)}}return p}}var r={__esModule:true};r.LayoutMutator=p;return r});
|
|
23
23
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/LayoutScorer", ["./PluginRegistry","../utils/Logger","../constants/MetaUIConstants"],function(e,t,r){"use strict";const i=e["PluginRegistry"];const o=t["Logger"];const s=r["RENDER_MODE"];const n=r["SCHEMA_TYPE"];const u=r["OPENAPI_PREFIX"];const d=r["WIDGET_TYPE"];class c{static apply(e,t,r){if(!e||t<=0)return;const i=new WeakSet;const o=new Set;if(e.properties){for(const s in e.properties){const u=e.properties[s];if(u.type===n.OBJECT||u.type===n.ARRAY||u.$ref){this._scoreNode(u,t,i,o,s,r)}}}}static _scoreNode(e,t,r,c,a,g){if(!e||typeof e!==n.OBJECT)return 0;if(r.has(e)){o.warn(`[MetaUI LayoutScorer] Circular reference detected at '${a}'. Forcing dialog mode to prevent crash.`,"","LayoutScorer");e.ui=e.ui||{};e.ui.renderMode=s.DIALOG;e.ui.layoutBudget=t;return 1}r.add(e);if(e.$ref&&g){let i=e.$ref;if(i.startsWith(u.DEFINITIONS))i=i.substring(u.DEFINITIONS.length);else if(i.startsWith(u.COMPONENTS_SCHEMAS))i=i.substring(u.COMPONENTS_SCHEMAS.length);if(c.has(i)){o.warn(`[MetaUI LayoutScorer] Circular OpenAPI $ref detected at '${a}' for '${i}'. Forcing dialog mode to prevent crash.`,"","LayoutScorer");e.ui=e.ui||{};e.ui.renderMode=s.DIALOG;return 1}const n=g[i];if(n){c.add(i);const o=JSON.parse(JSON.stringify(n));const u=this._scoreNode(o,t,r,c,a,g);c.delete(i);e.ui=e.ui||{};e.ui.layoutBudget=t;if(u<=t){Object.assign(e,o);delete e.$ref;if(e.ui?.widget===d.REFERENCE)delete e.ui.widget;e.ui.renderMode=s.INLINE;r.delete(e);return u}else{e.ui.renderMode=s.DIALOG;r.delete(e);return 1}}}if(e.type===n.ARRAY){let o=i.getInstance().getPluginScore(n.ARRAY,e.ui?.widget);if(e.items){const i=e.items;if(i.type===n.OBJECT||i.type===n.ARRAY||i.$ref){o+=this._scoreNode(i,t,r,c,`${a}/items`,g)}}e.ui=e.ui||{};e.ui.layoutBudget=t;if(o<=t){e.ui.renderMode=s.INLINE;r.delete(e);return o}else{e.ui.renderMode=s.DIALOG;r.delete(e);return 1}}let l=0;if(e.properties){for(const o in e.properties){const s=e.properties[o];if(s.type===n.OBJECT||s.type===n.ARRAY||s.$ref){l+=this._scoreNode(s,t,r,c,`${a}/${o}`,g)}else{l+=i.getInstance().getPluginScore(s.type||n.STRING,s.ui?.widget)}}}else{l+=i.getInstance().getPluginScore(n.OBJECT,e.ui?.widget)}e.ui=e.ui||{};e.ui.layoutBudget=t;r.delete(e);if(l<=t){e.ui.renderMode=s.INLINE;return l}else{e.ui.renderMode=s.DIALOG;return 1}}}var a={__esModule:true};a.LayoutScorer=c;return a});
|
|
24
24
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/PipelineManager", ["./Registry","../plugins/validators/PatternValidatorPlugin","../plugins/validators/MinLengthValidatorPlugin","../plugins/validators/RangeValidatorPlugin","../plugins/validators/UrlValidatorPlugin","../plugins/validators/IbanValidatorPlugin","../plugins/validators/EmailValidatorPlugin","../plugins/formatters/DateFormatterPlugin","../plugins/formatters/PhoneFormatterPlugin","../plugins/formatters/TextCaseFormatterPlugin","../utils/Logger"],function(e,t,r,i,a,s,n,l,o,g,u){"use strict";const d=e["Registry"];const c=t["PatternValidatorPlugin"];const f=r["MinLengthValidatorPlugin"];const P=i["RangeValidatorPlugin"];const h=a["UrlValidatorPlugin"];const m=s["IbanValidatorPlugin"];const V=n["EmailValidatorPlugin"];const v=l["DateFormatterPlugin"];const p=o["PhoneFormatterPlugin"];const w=g["TextCaseFormatterPlugin"];const M=u["Logger"];class x{validate(e,t){if(e===null||e===undefined||e===""){return{isValid:false,errorMessage:"This field is required."}}return{isValid:true}}}class y{validate(e,t){if(typeof e==="string"&&t&&typeof t==="number"){if(e.length>t){return{isValid:false,errorMessage:`Maximum length is ${t} characters.`}}}return{isValid:true}}}class F{formatters=new d("Formatters");parsers=new d("Parsers");validators=new d("Validators");constructor(){this.validators.register("required",new x);this.validators.register("maxLength",new y);this.validators.register("pattern",new c);this.validators.register("minLength",new f);this.validators.register("range",new P);this.validators.register("url",new h);this.validators.register("iban",new m);this.validators.register("email",new V);this.formatters.register("date",new v);this.formatters.register("phone",new p);this.formatters.register("textCase",new w)}executeValidation(e,t,r){const i=e===null||e===undefined||e==="";const a=t.includes("required");if(i&&!a){return{isValid:true}}for(const i of t){const t=this.validators.get(i);if(t){const a=r?r[i]:undefined;try{const r=t.validate(e,a);if(!r.isValid){return r}}catch(e){const t=e.message;M.error(`[MetaUI] PipelineManager: Validator '${i}' crashed during execution.`,t);return{isValid:false,errorMessage:`System validation error: ${t}`}}}else{M.warn(`[MetaUI] PipelineManager: Requested validator '${i}' not found in registry.`)}}return{isValid:true}}}const L=new F;var b={__esModule:true};b.PipelineManager=F;b.GlobalPipeline=L;return b});
|
|
@@ -32,7 +32,7 @@ sap.ui.predefine("nz/co/siliconst/ui5/metaui/core/StateManager", ["sap/ui/model/
|
|
|
32
32
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/layouts/CompactLayout", ["sap/m/VBox","sap/m/Label","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,r){"use strict";const o=a["SchemaNormalizer"];const i=r["Logger"];class s{render(t,a,r,s){const n=new e({renderType:"Bare"});n.addStyleClass("sapUiTinyMargin");if(!t.uiLayout||!Array.isArray(t.uiLayout)){i.warn("[MetaUI] Missing 'uiLayout' array in schema. CompactLayout will not render any fields.");return n}const l=[];const p=e=>{if(e.type==="Group"){if(e.label){const t=new sap.m.Title({text:e.label,level:"H5"});t.addStyleClass("sapUiTinyMarginTop sapUiTinyMarginBottom");n.addItem(t)}if(e.elements&&Array.isArray(e.elements)){e.elements.forEach(p)}}else if(e.type==="Control"){if(!e.scope||!e.scope.startsWith("#/properties/")){i.error(`[MetaUI] Invalid scope '${e.scope}' in uiLayout Control.`,"","CompactLayout");return}const{meta:s,bindingPath:p,propKey:c}=o.resolveScope(t,e.scope);if(!s){i.error(`[MetaUI] Property '${c}' not found in schema definitions.`,"","CompactLayout");return}const y=s.items?.type==="object"||s.items?.properties;const u=!!s.ui?.widget;const d=s.type==="array"&&y&&!u;if(d){i.debug("[MetaUI CompactLayout]",`Routing property '${c}' to Table Sub-Layout.`,"CompactLayout");l.push({scope:p,meta:s,label:e.label})}else{i.debug("[MetaUI CompactLayout]",`Rendering scalar field '${p}'.`,"CompactLayout");this._renderScalarField(n,e,p,s,a,r)}}else{i.warn(`[MetaUI] Unsupported layout element type '${e.type}'.`,"","CompactLayout")}};t.uiLayout.forEach(p);l.forEach(e=>{try{const t={type:"array",title:e.label||e.meta.ui?.label||e.scope,items:e.meta.items||{type:"object",properties:{}},uiLayout:e.meta.items?.uiLayout};const o=r.generateLayout(t,a,`/${e.scope}`);if(o){o.addStyleClass("sapUiTinyMarginTop");n.addItem(o)}}catch(t){const a=t.message;i.error(`[MetaUI] Failed to render array field ${e.scope}`,a,"CompactLayout");i.showErrorPopup(`Failed to render array field '${e.scope}'.\n\nDetails: ${a}`)}});return n}_renderScalarField(a,r,o,s,n,l){try{const i=r.label||s.ui?.label||o;const p=new t({text:i,required:s.required});p.addStyleClass("sapUiTinyMarginTop");const c={...s};if(r.widget){c.ui={...s.ui,widget:r.widget}}const y=l.generateField(c,`/${o}`,n);y.addStyleClass("sapUiTinyMarginBottom");const u=new e({renderType:"Bare",items:[p,y]});a.addItem(u)}catch(e){const t=e.message;i.error(`[MetaUI] Failed to render field ${o}`,t,"CompactLayout");i.showErrorPopup(`Failed to render field '${o}'.\n\nDetails: ${t}`)}}}var n={__esModule:true};n.CompactLayout=s;return n});
|
|
33
33
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/layouts/FormLayout", ["sap/ui/layout/form/SimpleForm","sap/m/Label","sap/ui/core/Title","sap/m/VBox","../core/SchemaNormalizer","../utils/Logger","../core/PluginRegistry"],function(e,t,a,r,o,i,n){"use strict";const s=o["SchemaNormalizer"];const l=i["Logger"];const u=n["PluginRegistry"];class d{render(t,o,i,n){const u=new r({renderType:"Bare"});const d=new e({editable:true,title:t.title,layout:"ResponsiveGridLayout",labelSpanXL:4,labelSpanL:4,labelSpanM:4,labelSpanS:12,adjustLabelSpan:false,emptySpanXL:0,emptySpanL:0,emptySpanM:0,emptySpanS:0,columnsXL:1,columnsL:1,columnsM:1,singleContainerFullSize:false});if(!t.uiLayout||!Array.isArray(t.uiLayout)){l.warn("[MetaUI] Missing 'uiLayout' array in schema. Form will not render any fields.");u.addItem(d);return u}let p=false;const y=e=>{if(e.type==="Group"){if(e.label){d.addContent(new a({text:e.label}))}if(e.elements&&Array.isArray(e.elements)){e.elements.forEach(y)}}else if(e.type==="Control"){if(!e.scope||!e.scope.startsWith("#/properties/")){l.error(`[MetaUI] Invalid scope '${e.scope}' in uiLayout Control.`,"","FormLayout");return}const{meta:a,bindingPath:r,propKey:n}=s.resolveScope(t,e.scope);if(!a){l.error(`[MetaUI] Property '${n}' not found in schema definitions.`,"","FormLayout");return}const u=a.items?.type==="object"||a.items?.properties;const y=!!a.ui?.widget;const c=a.type==="array"&&u&&!y;if(c){l.debug("[MetaUI FormLayout]",`Routing property '${n}' to Table Sub-Layout inline.`,"FormLayout");p=true;try{const t={type:"array",title:e.label||a.ui?.label||n,items:a.items||{type:"object",properties:{}},uiLayout:a.items?.uiLayout};const s=i.generateLayout(t,o,`/${r}`);if(s){sap.ui.require(["sap/ui/layout/GridData"],e=>{s.setLayoutData(new e({span:"XL12 L12 M12 S12"}))});d.addContent(s)}}catch(e){const t=e.message;l.error(`[MetaUI] Failed to render inline array field ${r}`,t,"FormLayout");l.showErrorPopup(`Failed to render array field '${r}'.\n\nDetails: ${t}`)}}else{p=true;l.debug("[MetaUI FormLayout]",`Rendering scalar field '${r}'.`,"FormLayout");this._renderScalarField(d,e,r,a,o,i)}}else{l.warn(`[MetaUI] Unsupported layout element type '${e.type}'.`,"","FormLayout")}};t.uiLayout.forEach(y);if(p){u.addItem(d)}return u}_renderScalarField(e,a,r,o,i,n){try{const s=a.label||o.ui?.label||r;const l=new t({text:s,required:o.required});const d={...o};if(a.widget){d.ui={...o.ui,widget:a.widget}}const p=n.generateField(d,`/${r}`,i);const y=u.getInstance().isPluginNativelyWide(d.type||"string",d.ui?.widget);const c=d.ui?.fullWidth!==undefined?d.ui?.fullWidth:y;if(c){sap.ui.require(["sap/ui/layout/GridData"],e=>{p.setLayoutData(new e({span:"XL12 L12 M12 S12"}))})}e.addContent(l);e.addContent(p)}catch(e){const t=e.message;l.error(`[MetaUI] Failed to render field ${r}`,t,"FormLayout");l.showErrorPopup(`Failed to render field '${r}'.\n\nDetails: ${t}`)}}}var p={__esModule:true};p.FormLayout=d;return p});
|
|
34
34
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/layouts/TableLayout", ["sap/m/Table","sap/m/Column","sap/m/Text","sap/m/ColumnListItem","sap/m/Toolbar","sap/m/Title","sap/m/ToolbarSpacer","sap/m/Button","../core/SchemaNormalizer","../utils/Logger","../constants/MetaUIConstants"],function(e,t,o,a,r,n,s,i,l,p,c){"use strict";const u=l["SchemaNormalizer"];const d=p["Logger"];const f=c["WIDGET_TYPE"];const y=c["SCHEMA_TYPE"];class m{render(l,p,c,m,b="/"){let g=l.items;if(g&&!g.properties&&g.ui?.widget===f.REFERENCE&&g.$ref){d.debug(`[MetaUI] TableLayout detecting reference widget for ${b}. Resolving ${g.$ref}`,"","TableLayout");const e=c.host;if(e&&typeof e.getSchemaDefinition==="function"){const t=e.getSchemaDefinition(g.$ref);d.debug(`[MetaUI] Resolved schema for ${g.$ref}: ${!!t} ${t?Object.keys(t):""}`,"","TableLayout");if(t&&t.properties){g=t}else{d.error(`[MetaUI] TableLayout resolved schema but it has no properties!`,"","TableLayout")}}else{d.error(`[MetaUI] TableLayout cannot resolve ${g.$ref} because engine.host.getSchemaDefinition is missing! host: ${e?.getMetadata().getName()}`,"","TableLayout")}}const h=g&&!g.properties&&["string","number","boolean"].includes(g.type);if(l.type!==y.ARRAY||!g||!g.properties&&!h){d.error(`[MetaUI] TableLayout fatal error! schema.type: ${l.type}, itemsSchema: ${!!g}, properties: ${g?!!g.properties:false}`,"","TableLayout");throw new Error("[MetaUI] TableLayout requires an array schema with items.properties or primitive items.")}const T=e=>{if(e.type==="object"&&e.properties){const t={};for(const o of Object.keys(e.properties)){t[o]=T(e.properties[o])}return t}else if(e.type==="array"){return[]}else if(e.type==="string"){return e.default!==undefined?e.default:e.enum?e.enum[0]:""}else if(e.type==="number"){return e.default!==undefined?e.default:0}else if(e.type==="boolean"){return e.default!==undefined?e.default:false}return""};const w=l.title||"Table";const L=p;const $=b;const I=new e({headerToolbar:new r({content:[new n({text:w}),new s,...!c.isEditable?[]:[new i({text:"Add Row",icon:"sap-icon://add",press:e=>{const t=e.getSource();const o=t.getParent()?.getParent();const a=o.getModel(L);const r=o.getBindingInfo("items");if(!r||!r.path)return;const n=a.getProperty(r.path);const s=Array.isArray(n)?n:[];const i=[...s,T(g)];a.setProperty(r.path,i);if(c.onChange){c.onChange(true,$.replace(/^\//,""))}}})]]}),fixedLayout:false,mode:!c.isEditable?"None":"Delete",delete:e=>{const t=e.getParameter("listItem");const o=t.getBindingContext(L)?.getPath();if(!o)return;const a=t.getModel(L);const r=o.split("/");const n=parseInt(r.pop()||"0",10);let s=r.join("/");if(s==="")s="/";const i=a.getProperty(s);const l=Array.isArray(i)?i:[];const p=[...l];p.splice(n,1);a.setProperty(s,p);if(c.onChange){c.onChange(true,$.replace(/^\//,""))}if(typeof c.onArrayMutated==="function"){c.onArrayMutated(s)}}});const M=[];const E=g.properties;const P=l.uiLayout;if(h){I.addColumn(new t({header:new o({text:"Value"})}));const e=c.generateField(g,"",L||"meta",true);M.push(e)}else if(P&&Array.isArray(P)){P.forEach(e=>{if(e.type==="Control"&&e.scope){const{meta:a,bindingPath:r,propKey:n}=u.resolveScope({type:"object",properties:E},e.scope);if(!a){d.error(`[MetaUI] Property '${n}' not found in schema definitions for Table.`,"","TableLayout")}else{I.addColumn(new t({header:new o({text:e.label||a.ui?.label||n}),demandPopin:!a.ui?.isKey,minScreenWidth:a.ui?.isKey?"":"Tablet",popinDisplay:"Inline"}));const s={...a};if(e.widget){s.ui={...a.ui,widget:e.widget}}const i=c.generateField(s,r,L||"meta",true);M.push(i)}}else{d.warn(`[MetaUI] Unsupported layout element type '${e.type}' in Table.`,"","TableLayout")}})}else{d.debug("[MetaUI TableLayout]","No uiLayout provided. Falling back to rendering all properties as columns.","TableLayout");Object.keys(E).forEach(e=>{try{const a=E[e];const r=!!a.ui?.isKey;const n=new t({header:new o({text:a.ui?.label||e}),demandPopin:!r,minScreenWidth:r?"":"Tablet",popinDisplay:"Inline"});I.addColumn(n);const s=c.generateField(a,e,L||"meta",true);M.push(s)}catch(t){const a=t.message;d.error(`[MetaUI] Failed to render fallback column ${e}`,a,"TableLayout");d.showErrorPopup(`Failed to render fallback table column '${e}'.\n\nDetails: ${a}`);M.push(new o({text:"Error"}))}})}const C=new a({cells:M});I.bindItems({path:$,model:L,template:C,templateShareable:false});return I}}var b={__esModule:true};b.TableLayout=m;return b});
|
|
35
|
-
sap.ui.predefine("nz/co/siliconst/ui5/metaui/layouts/WizardLayout", ["sap/m/
|
|
35
|
+
sap.ui.predefine("nz/co/siliconst/ui5/metaui/layouts/WizardLayout", ["sap/ui/layout/form/SimpleForm","sap/m/Label","sap/m/VBox","sap/m/HBox","sap/m/Button","sap/m/ProgressIndicator","sap/m/Title","sap/ui/core/Title","sap/m/Text","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,r,n,i,o,s,l,u,d){"use strict";const p=u["SchemaNormalizer"];const c=d["Logger"];class m{render(e,t,s,u){if(!e.uiLayout||!Array.isArray(e.uiLayout)){c.warn("[MetaUI WizardLayout] Missing 'uiLayout' array in schema. Cannot build step navigator.","","WizardLayout");return new a}const d=e.uiLayout.filter(e=>e.type==="Group"||e.type==="WizardStep");if(d.length===0){c.warn("[MetaUI WizardLayout] No Group or WizardStep elements found in uiLayout.","","WizardLayout");return new a}const p=d.length;const m=[];const y=[];d.forEach(a=>{const r=[];const n=this._buildStepForm(a,e,t,s,r);m.push(n);y.push(r)});let f=0;const S=new o({level:"H3"});const g=new l;const h=new i({showValue:false,state:"None",height:"0.5rem"}).addStyleClass("metaUIWizardProgress");const L=new a({width:"100%"}).addStyleClass("metaUIWizardContent");const w=new n({text:"Previous",icon:"sap-icon://navigation-left-arrow",enabled:false,press:()=>W(f-1)});const z=new n({type:"Emphasized",text:p===1?"Complete":"Next Step",icon:"sap-icon://navigation-right-arrow",iconFirst:false,press:()=>I()});const W=e=>{if(e<0||e>=p){c.error("[MetaUI WizardLayout]",`Invalid navigation target: step ${e}`,"WizardLayout");return}f=e;const t=d[f];const a=f===p-1;S.setText(t.label||`Step ${f+1}`);g.setText(`Step ${f+1} of ${p}`);h.setPercentValue((f+1)/p*100);L.removeAllItems();L.addItem(m[f]);w.setEnabled(f>0);z.setText(a?"Complete":"Next Step");z.setIcon(a?"sap-icon://accept":"sap-icon://navigation-right-arrow")};const I=()=>{if(!this._validateStep(y[f],s)){c.debug("[MetaUI WizardLayout]",`Step ${f} failed local validation. Blocking navigation.`,"WizardLayout");return}if(f===p-1){if(u)u();return}const e=s.host;if(!e){W(f+1);return}const t=e.getStateManager();const a=t?t.extractPayload():{};let r=false;let n=false;const i=()=>{if(!n){n=true;W(f+1)}};e.fireEvent("beforeLayoutSectionChange",{stepIndex:f,payload:a,preventDefault:()=>{r=true},addError:(e,t)=>{r=true;const a=s.getPluginByPath(e);if(a&&typeof a.setVisualValidationState==="function"){a.setVisualValidationState(false,t)}},resumeNavigation:()=>{i()}});if(!r){i()}};W(0);const v=new r({width:"100%",justifyContent:"SpaceBetween",alignItems:"Center",items:[w,z]}).addStyleClass("sapUiSmallMarginTop");const b=new a({width:"100%",items:[new r({justifyContent:"SpaceBetween",alignItems:"Center",width:"100%",items:[S,g]}),h]}).addStyleClass("sapUiSmallMarginBottom");return new a({width:"100%",items:[b,L,v]})}_validateStep(e,t){let a=true;for(const r of e){const e=t.getPluginByPath(r);if(!e)continue;const n=e.validate();if(!n.isValid){t.reportSchemaError(r,n.errorMessage||"This field is required.");a=false}else{t.reportSchemaError(r,null)}}return a}_buildStepForm(t,a,r,n,i){const o=new e({editable:true,layout:"ResponsiveGridLayout",labelSpanXL:4,labelSpanL:4,labelSpanM:4,labelSpanS:12,adjustLabelSpan:false,emptySpanXL:0,emptySpanL:0,emptySpanM:0,emptySpanS:0,columnsXL:1,columnsL:1,columnsM:1,singleContainerFullSize:false});if(t.elements&&Array.isArray(t.elements)){t.elements.forEach(e=>{this._renderElementInForm(o,e,a,r,n,i)})}return o}_renderElementInForm(e,a,r,n,i,o){if(a.type==="Group"){if(a.label){e.addContent(new s({text:a.label}))}if(a.elements&&Array.isArray(a.elements)){a.elements.forEach(t=>{this._renderElementInForm(e,t,r,n,i,o)})}return}if(a.type==="Control"){if(!a.scope||!a.scope.startsWith("#/properties/")){c.error(`[MetaUI WizardLayout] Invalid scope '${a.scope}' — must start with '#/properties/'.`,"","WizardLayout");return}const{meta:s,bindingPath:l,propKey:u}=p.resolveScope(r,a.scope);if(!s){c.error(`[MetaUI WizardLayout] Property '${u}' not found in schema.`,"","WizardLayout");return}try{const r=a.label||s.ui?.label||u;const d=new t({text:r,required:s.required===true});const p={...s};if(a.widget){p.ui={...s.ui||{},widget:a.widget}}const c=`/${l}`;const m=i.generateField(p,c,n);o.push(c);if(p.ui?.fullWidth){sap.ui.require(["sap/ui/layout/GridData"],e=>{m.setLayoutData(new e({span:"XL12 L12 M12 S12"}))})}e.addContent(d);e.addContent(m)}catch(a){c.error(`[MetaUI WizardLayout] Failed to render field '${u}'`,a.message,"WizardLayout");e.addContent(new t({text:u}))}return}c.warn(`[MetaUI WizardLayout] Unsupported element type '${a.type}' inside a wizard step.`,"","WizardLayout")}}var y={__esModule:true};y.WizardLayout=m;return y});
|
|
36
36
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/library", ["sap/ui/core/Core","nz/co/siliconst/ui5/metaui/plugins/controls/StringPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/NumberPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/DropdownPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/MultiInputPlugin","nz/co/siliconst/ui5/metaui/plugins/controls/DatePlugin","nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator","nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder","nz/co/siliconst/ui5/metaui/layouts/FormLayout","nz/co/siliconst/ui5/metaui/layouts/TableLayout","nz/co/siliconst/ui5/metaui/layouts/WizardLayout","nz/co/siliconst/ui5/metaui/layouts/CompactLayout","nz/co/siliconst/ui5/metaui/ai/BaseAIGenerator","nz/co/siliconst/ui5/metaui/ai/MockLLMProxy","nz/co/siliconst/ui5/metaui/ai/RestLLMProxy","nz/co/siliconst/ui5/metaui/ai/AIConfig"],function(i,o,n,t,s,u,c,l,a,e,r,m,z,p,g,y,C,L,P){"use strict";i.initLibrary({name:"nz.co.siliconst.ui5.metaui",version:"1.0.0",dependencies:["sap.ui.core","sap.m","sap.ui.layout","sap.ui.table"],controls:["nz.co.siliconst.ui5.metaui.controls.DynamicHost","nz.co.siliconst.ui5.metaui.controls.host.GeneratorHost","nz.co.siliconst.ui5.metaui.controls.BaseHardwareControl","nz.co.siliconst.ui5.metaui.controls.CameraControl","nz.co.siliconst.ui5.metaui.controls.BarcodeScannerControl","nz.co.siliconst.ui5.metaui.controls.SignatureControl","nz.co.siliconst.ui5.metaui.controls.VoiceInputControl","nz.co.siliconst.ui5.metaui.controls.GeolocationControl","nz.co.siliconst.ui5.metaui.controls.RichTextControl"],elements:[],interfaces:[],noLibraryCSS:true});var d=window.nz.co.siliconst.ui5.metaui;return d});
|
|
37
37
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/openapi/OpenApiBuilder", ["../utils/Logger","./OpenApiParserFactory","./heuristics/OpenApiHeuristicEngine"],function(e,r,t){"use strict";const n=e["Logger"];const i=r["OpenApiParserFactory"];const s=t["OpenApiHeuristicEngine"];class o{canHandle(e){const r=e;return!!(r&&(r.openapi||r.swagger))}build(e,r){return o.build(e,r)}static async fetchAndBuild(e,r){try{const t=await fetch(e);if(!t.ok){throw new Error(`HTTP error! status: ${t.status}`)}const n=await t.json();return this.build(n,r)}catch(e){const r="Failed to fetch Swagger JSON from URL: "+e.message;n.error("[MetaUI OpenApiBuilder]",r);throw new Error(r)}}static build(e,r){if(!e||typeof e!=="object"){throw new Error("[MetaUI OpenApiBuilder] Invalid Swagger root object provided.")}const t=new s;t.run(e);const n=i.getParser(e);return n.parse(e,r)}}var a={__esModule:true};a.OpenApiBuilder=o;return a});
|
|
38
38
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/openapi/OpenApiParserFactory", ["./parsers/OpenApi2Parser","./parsers/OpenApi3Parser","../utils/Logger"],function(e,r,n){"use strict";const t=e["OpenApi2Parser"];const s=r["OpenApi3Parser"];const a=n["Logger"];class p{static getParser(e){if(!e||typeof e!=="object"){a.error("[MetaUI OpenApiParserFactory] Invalid OpenAPI document provided.");return new s}const r=e;if(r.swagger==="2.0"){return new t}if(r.openapi&&typeof r.openapi==="string"&&r.openapi.startsWith("3")){return new s}a.warn("[MetaUI OpenApiParserFactory] Unable to strictly determine OpenAPI version. Defaulting to OpenAPI 3.0 Parser.");return new s}}var i={__esModule:true};i.OpenApiParserFactory=p;return i});
|
|
@@ -49,7 +49,7 @@ sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/actions/SubmitFormActionPlu
|
|
|
49
49
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/actions/UrlNavigationActionPlugin", ["../controls/BasePlugin","sap/m/Button","sap/m/library"],function(t,e,n){"use strict";const a=t["BasePlugin"];const s=n.URLHelper;class i extends a{render(t,n,a="meta"){this.metadata=t;this.control=new e({text:t.ui?.label||"Open Link",icon:"sap-icon://action",press:()=>{const e=t.ui?.args||"https://sap.com";s.redirect(e,true)}});return this.control}getValue(){return null}applyState(){if(this.control&&this.metadata){this.control.setEnabled(!this.metadata.ui?.readOnly)}}}var r={__esModule:true};r.UrlNavigationActionPlugin=i;return r});
|
|
50
50
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin", ["./BasePlugin","sap/m/Button","../../constants/MetaUIConstants"],function(t,e,i){"use strict";const s=t["BasePlugin"];const n=i["SCHEMA_TYPE"];const a=i["UI5_EVENT"];class o extends s{render(t,i,s="meta",o,r){this.onChange=r;this.metadata=t;const u=i.startsWith("/")?i.substring(1):i;const l={type:n.ARRAY,title:t.ui?.label||u,items:t.items||{type:n.OBJECT,properties:{}}};if(t.uiLayout){l.uiLayout=t.uiLayout}this.control=new e({id:this.generateStableId(o,i),text:!this.isEditable?"View Records":"Edit Records",icon:!this.isEditable?"sap-icon://display":"sap-icon://list",press:e=>{const n=e.getSource();const o=n.getModel(s);if(!o)return;const r=n.getBindingContext(s);let c=i;if(r&&!i.startsWith("/")){const t=r.getPath();c=t.endsWith("/")?t+i:t==="/"?"/"+i:t+"/"+i}const d=JSON.parse(JSON.stringify(o.getProperty(c)||[]));sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/DynamicHost"],e=>{const i=new e({schemaDefinition:l,schemaDefinitions:undefined,data:d,editable:this.isEditable,layoutBudget:this.metadata?.ui?.layoutBudget||0});if(!!this.isEditable){i.attachEvent(a.SUBMIT,t=>{const e=t.getParameter("payload");o.setProperty(c,e);if(this.onChange){this.onChange(true,u)}})}const s=t.ui?.dialogButtonText||(!this.isEditable?"Close":"OK");i.openInDialog(`Nested Records: ${t.ui?.label||u}`,s)})}});this.applyCommonDirectives(this.control,t,s);return this.control}getValue(){return null}applyState(){}}var r={__esModule:true};r.ArrayPlugin=o;return r});
|
|
51
51
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/BarcodeScannerPlugin", ["../controls/BasePlugin","sap/m/HBox","sap/m/Input","sap/ndc/BarcodeScannerButton","sap/m/Text"],function(t,e,i,n,s){"use strict";const a=t["BasePlugin"];class o extends a{render(t,a,o="meta",r,l){this.onChange=l;this.metadata=t;this.fieldKey=a.replace("/","");this.modelName=o;if(!this.isEditable){this.control=new s({id:this.generateStableId(r,a),text:this.generateBindingInfo(a,o)});this.applyCommonDirectives(this.control,t,o);return this.control}this.inputControl=new i({id:this.generateStableId(r,a+"-input"),value:this.generateBindingInfo(a,o),editable:!t.ui?.readOnly,width:"100%",change:()=>{const t=this.validate();if(this.onChange){this.onChange(t.isValid,this.fieldKey,t.errorMessage)}}});const h=new n({id:this.generateStableId(r,a+"-btn"),scanSuccess:t=>{const e=t.getParameter("text");if(e){this.inputControl.setValue(e);const t=this.validate();if(this.onChange){this.onChange(t.isValid,this.fieldKey,t.errorMessage)}}}});this.control=new e({id:this.generateStableId(r,a),items:[this.inputControl,h],width:"100%"}).addStyleClass("sapUiSmallMarginBottom");this.applyCommonDirectives(this.control,t,o);return this.control}getValue(){return this.inputControl?this.inputControl.getProperty("value"):null}applyState(){if(this.inputControl&&this.metadata){if(!this.isEditable)return;this.inputControl.setEditable(!this.metadata.ui?.readOnly)}}}var r={__esModule:true};r.BarcodeScannerPlugin=o;return r});
|
|
52
|
-
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin", ["../../core/PipelineManager","sap/ui/core/library","../../utils/Logger"],function(e,t,i){"use strict";const a=e["GlobalPipeline"];const
|
|
52
|
+
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin", ["../../core/PipelineManager","sap/ui/core/library","../../utils/Logger"],function(e,t,i){"use strict";const a=e["GlobalPipeline"];const n=i["Logger"];class s{control=null;BLOCKED_PROPS=["value","text","selectedKey","selected","dateValue","editable","enabled","visible","valueState","valueStateText","items","content","pages","formElements","change","press","select","submit"];metadata=null;fieldKey="";modelName="meta";isEditable=true;useMessageManager=false;policyInvalidMessage=null;setEditable(e){this.isEditable=e}getFieldLabel(){return this.metadata?.ui?.label||this.fieldKey}setUseMessageManager(e){this.useMessageManager=e}generateStableId(e,t){if(!e)return undefined;const i=t.replace(/^\//,"").replace(/\//g,"-");return`${e}--${i}`}generateBindingInfo(e,t,i,a){return{path:e,model:t,...i?{type:i}:{},...a||{}}}validate(){if(!this.control||!this.metadata)return{isValid:true};if(typeof this.control.getVisible==="function"){if(!this.control.getVisible()){return{isValid:true}}}if(this.policyInvalidMessage){return{isValid:false,errorMessage:this.policyInvalidMessage,fieldKey:this.fieldKey}}const e=[];const t={maxLength:this.metadata.maxLength};const i=this._isDynamicallyRequired!==undefined?this._isDynamicallyRequired:this.metadata.required;if(i){e.push("required")}if(this.metadata.maxLength)e.push("maxLength");if(this.metadata.minLength){e.push("minLength");t["minLength"]=this.metadata.minLength}if(this.metadata.pattern){e.push("pattern");t["pattern"]=this.metadata.pattern}if(this.metadata.minimum!==undefined||this.metadata.maximum!==undefined){e.push("range");t["range"]={min:this.metadata.minimum,max:this.metadata.maximum}}const n=this.metadata.ui?.format;if(n==="email"||n==="url"||n==="iban"){e.push(n)}if(this.metadata.ui?.validators){for(const i of this.metadata.ui.validators){if(typeof i==="string"){e.push(i)}else if(i&&i.name){e.push(i.name);if(i.args!==undefined){t[i.name]=i.args}}}}if(e.length===0){return{isValid:true,errorMessage:undefined,fieldKey:this.fieldKey}}const s=this.getValue();const l=a.executeValidation(s,e,t);return{isValid:l.isValid,errorMessage:l.errorMessage,fieldKey:this.fieldKey,fieldLabel:this.metadata?.ui?.label}}setVisualValidationState(e,i){if(!this.control)return;const a=this.control;if(typeof a.setValueState==="function"){a.setValueState(e?t.ValueState.None:t.ValueState.Error);if(typeof a.setValueStateText==="function"){a.setValueStateText(e?"":i||"")}}else{}}applyError(e){this.policyInvalidMessage=e;this.setVisualValidationState(false,e)}clearError(){this.policyInvalidMessage=null;this.setVisualValidationState(true)}applyVisibility(e){const t=this.control;if(t&&typeof t.setVisible==="function"){t.setVisible(e)}}applyRequired(e){this._isDynamicallyRequired=e;const t=this.control;if(t&&typeof t.setRequired==="function"){t.setRequired(e)}}applyEditable(e){const t=this.control;if(t&&typeof t.setEditable==="function"){t.setEditable(e)}else if(t&&typeof t.setEnabled==="function"){t.setEnabled(e)}}onStateChange(e){this.metadata=e;this.applyState()}applyCommonDirectives(e,t,i="meta"){const a=e;if(t.ui?.readOnly!==undefined&&typeof a.setEditable==="function"){a.setEditable(!t.ui.readOnly)}if(t.ui?.visibleOn){const a=`{= ${t.ui.visibleOn.replace(/\$root\./g,`${i}>/`).replace(/\./g,"/")} }`;e.bindProperty("visible",{parts:[{path:"meta>/"}],formatter:()=>false});e.bindProperty("visible",a)}if(t.ui?.enabledOn&&typeof a.setEnabled==="function"){const a=`{= ${t.ui.enabledOn.replace(/\$root\./g,`${i}>/`).replace(/\./g,"/")} }`;e.bindProperty("enabled",a)}if(t.ui?.controlProps){n.debug(`[BasePlugin] controlProps found for ${this.fieldKey}: `+JSON.stringify(t.ui.controlProps),"BasePlugin");const a=this.mainControl||e;const s=a;if(typeof s.getMetadata==="function"){const e=s.getMetadata();const l={};for(const[a,s]of Object.entries(t.ui.controlProps)){if(this.BLOCKED_PROPS.includes(a)){n.warn(`[BasePlugin] Cannot apply controlProps '${a}' for field '${this.fieldKey}' - ILLEGAL OVERRIDE (Property is protected by sandbox)`);continue}if(typeof e.hasAggregation==="function"&&e.hasAggregation(a)){n.warn(`[BasePlugin] Cannot apply controlProps '${a}' for field '${this.fieldKey}' - ILLEGAL OVERRIDE (Cannot hijack aggregations)`);continue}if(typeof e.hasEvent==="function"&&e.hasEvent(a)){n.warn(`[BasePlugin] Cannot apply controlProps '${a}' for field '${this.fieldKey}' - ILLEGAL OVERRIDE (Cannot hijack events)`);continue}if(typeof s==="string"&&s.startsWith("{")&&s.endsWith("}")){const e=s.replace(/metaui>/g,`${i}>`);l[a]=e}else{l[a]=s}}try{const e=a;if(typeof e.applySettings==="function"){e.applySettings(l)}}catch(t){n.warn(`[BasePlugin] Failed to apply controlProps for field '${this.fieldKey}' on control ${e.getName()}: ${t.message}`)}}}}destroy(){if(this.control&&typeof this.control.destroy==="function"){this.control.destroy();this.control=null}}}var l={__esModule:true};l.BasePlugin=s;return l});
|
|
53
53
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/BooleanPlugin", ["./BasePlugin","sap/m/CheckBox","sap/m/Switch","sap/m/Text"],function(t,e,i,s){"use strict";const n=t["BasePlugin"];class a extends n{render(t,n,a="meta",r,o){this.BLOCKED_PROPS=this.BLOCKED_PROPS.filter(t=>t!=="text");this.onChange=o;this.metadata=t;this.fieldKey=n.startsWith("/")?n.substring(1):n;if(!this.isEditable){this.control=new s({id:this.generateStableId(r,n),text:this.generateBindingInfo(n,a,undefined,{formatter:t=>t?"Yes":"No"})});this.applyCommonDirectives(this.control,t,a);return this.control}const l=t=>{const e=t.getParameter("state")??t.getParameter("selected");const i=this.validate();if(this.onChange){this.onChange(i.isValid,this.fieldKey,i.errorMessage)}};if(t.ui?.widget==="switch"){this.control=new i({id:this.generateStableId(r,n),state:this.generateBindingInfo(n,a),enabled:!t.ui?.readOnly,change:l})}else{this.control=new e({id:this.generateStableId(r,n),width:"100%",selected:this.generateBindingInfo(n,a),enabled:!t.ui?.readOnly,select:l})}this.applyCommonDirectives(this.control,t,a);return this.control}getValue(){if(!this.control)return false;if(this.control instanceof i){return this.control.getState()}return this.control.getSelected()}applyState(){if(this.control&&this.metadata){if(!this.isEditable)return;if(this.control instanceof i){this.control.setEnabled(!this.metadata.ui?.readOnly)}else{this.control.setEnabled(!this.metadata.ui?.readOnly)}}}}var r={__esModule:true};r.BooleanPlugin=a;return r});
|
|
54
54
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/CameraPlugin", ["../controls/BasePlugin","../../controls/CameraControl","sap/m/Image"],function(t,e,i){"use strict";function a(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const n=t["BasePlugin"];const s=a(e);class r extends n{render(t,e,a="meta",n,r){this.onChange=r;this.metadata=t;this.fieldKey=e.replace("/","");this.modelName=a;if(!this.isEditable){this.control=new i({id:this.generateStableId(n,e),src:this.generateBindingInfo(e,a),width:"400px",alt:t.ui?.label||"Image"});this.applyCommonDirectives(this.control,t,a);return this.control}this.control=new s({id:this.generateStableId(n,e),value:this.generateBindingInfo(e,a),schemaMetadata:t,readOnly:!!t.ui?.readOnly});this.applyCommonDirectives(this.control,t,a);this.control.attachEvent("capture",()=>{const t=this.validate();if(this.onChange){this.onChange(t.isValid,this.fieldKey,t.errorMessage)}});return this.control}getValue(){return this.control?this.control.getProperty("value"):null}applyState(){if(this.control&&this.metadata){if(!this.isEditable)return;this.control.setProperty("readOnly",!!this.metadata.ui?.readOnly)}}}var o={__esModule:true};o.CameraPlugin=r;return o});
|
|
55
55
|
sap.ui.predefine("nz/co/siliconst/ui5/metaui/plugins/controls/CodeEditorPlugin", ["./BasePlugin","sap/ui/codeeditor/CodeEditor","sap/m/HBox","sap/m/Button","sap/m/Dialog","sap/m/FlexItemData"],function(t,e,i,s,a,o){"use strict";const n=t["BasePlugin"];class r extends n{detectLanguage(t){if(!t||typeof t!=="string")return"javascript";const e=t.trim();if(e==="")return"javascript";if(e.startsWith("{")||e.startsWith("[")){try{JSON.parse(e);return"json"}catch(t){}}if(/^\s*<[\s\S]*>\s*$/.test(e)){return"xml"}return"javascript"}adjustHeight(){if(!this.codeEditorRef)return;if(this.metadata?.ui?.rows)return;const t=this.codeEditorRef.getProperty("value")||"";const e=t.split(/\r\n|\r|\n/).length;const i=Math.max(100,e*18+20);this.codeEditorRef.setHeight(i+"px")}render(t,n,r="meta",d,h){this.onChange=h;this.metadata=t;this.fieldKey=n.replace("/","");const c=t.ui?.rows;const l=t.ui?.expandable!==false;const u=c?c*18+20+"px":"200px";const f=new e({id:this.generateStableId(d,n),value:this.generateBindingInfo(n,r),type:t.ui?.args||"javascript",editable:!this.isEditable?false:!t.ui?.readOnly,height:u,width:"100%",change:()=>{const e=this.validate();if(this.onChange){this.onChange(e.isValid,this.fieldKey,e.errorMessage)}if(!t.ui?.args){const t=this.codeEditorRef.getProperty("value");const e=this.detectLanguage(t);if(this.codeEditorRef.getType()!==e){this.codeEditorRef.setType(e)}}this.adjustHeight()}});this.codeEditorRef=f;this.mainControl=f;if(l){const d=new s({icon:"sap-icon://full-screen",type:"Transparent",tooltip:"Expand Code Editor",press:()=>{const i=new a({title:t.title||t.ui?.label||"Edit Code",contentWidth:"80%",contentHeight:"80%",verticalScrolling:false,resizable:true,content:new e({value:this.generateBindingInfo(n,r),type:this.codeEditorRef.getType(),width:"100%",height:"100%",editable:!this.isEditable?false:!t.ui?.readOnly}),beginButton:new s({text:"Close",press:()=>i.close()}),afterClose:()=>i.destroy()});this.control?.addDependent(i);i.open()}});f.setLayoutData(new o({growFactor:1}));this.control=new i({width:"100%",alignItems:"Start",items:[f,d]})}else{this.control=f}this.codeEditorRef.attachEventOnce("modelContextChange",()=>{const e=this.codeEditorRef.getBinding("value");const i=()=>{if(this.codeEditorRef){const e=this.codeEditorRef.getProperty("value");if(!t.ui?.args){this.codeEditorRef.setType(this.detectLanguage(e))}this.adjustHeight();this.applyState()}};if(e){e.attachChange(i)}i()});this.applyCommonDirectives(this.control,t,r);return this.control}getValue(){return this.codeEditorRef?this.codeEditorRef.getProperty("value"):null}applyState(){if(this.codeEditorRef&&this.metadata){if(!this.isEditable){this.codeEditorRef.setEditable(false)}else{this.codeEditorRef.setEditable(!this.metadata.ui?.readOnly)}}}}var d={__esModule:true};d.CodeEditorPlugin=r;return d});
|