@siliconst/metaui 1.4.20 → 1.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/package.json +1 -1
  2. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +8 -3
  3. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js.map +1 -1
  4. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts +8 -0
  5. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts.map +1 -1
  6. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
  7. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
  8. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +2 -3
  9. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js +13 -3
  10. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost-dbg.js.map +1 -1
  11. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts +8 -0
  12. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.d.ts.map +1 -1
  13. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js +1 -1
  14. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.js.map +1 -1
  15. package/src/nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost.ts +9 -4
  16. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js +13 -0
  17. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js.map +1 -1
  18. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts +4 -0
  19. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts.map +1 -1
  20. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js +1 -1
  21. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js.map +1 -1
  22. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.ts +13 -0
  23. package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +8 -4
  24. package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -1
  25. package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +5 -1
  26. package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -1
  27. package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +1 -1
  28. package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -1
  29. package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +9 -4
  30. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +3 -0
  31. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -1
  32. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -1
  33. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +1 -1
  34. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -1
  35. package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts +3 -0
  36. package/src/nz/co/siliconst/ui5/metaui/library-preload.js +9 -6
  37. package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
  38. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper-dbg.js +6 -3
  39. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper-dbg.js.map +1 -1
  40. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.d.ts.map +1 -1
  41. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.js +1 -1
  42. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.js.map +1 -1
  43. package/src/nz/co/siliconst/ui5/metaui/openapi/OpenApiUIMapper.ts +6 -3
  44. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js +48 -0
  45. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin-dbg.js.map +1 -0
  46. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.d.ts +11 -0
  47. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.d.ts.map +1 -0
  48. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js +2 -0
  49. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.js.map +1 -0
  50. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/EmailPlugin.ts +48 -0
  51. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js +58 -0
  52. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin-dbg.js.map +1 -0
  53. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.d.ts +11 -0
  54. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.d.ts.map +1 -0
  55. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js +2 -0
  56. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.js.map +1 -0
  57. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/LinkPlugin.ts +57 -0
  58. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js +49 -0
  59. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin-dbg.js.map +1 -0
  60. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.d.ts +11 -0
  61. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.d.ts.map +1 -0
  62. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js +2 -0
  63. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.js.map +1 -0
  64. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/PasswordPlugin.ts +49 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siliconst/metaui",
3
- "version": "1.4.20",
3
+ "version": "1.4.21",
4
4
  "description": "Dynamic Metadata UI5 Engine",
5
5
  "author": "SiliconStreetDev1",
6
6
  "license": "MIT",
@@ -60,6 +60,14 @@ sap.ui.define(["sap/ui/core/Control", "./host/GeneratorHost", "../utils/Logger",
60
60
  type: "string",
61
61
  defaultValue: null
62
62
  },
63
+ pluginRegistry: {
64
+ type: "object",
65
+ defaultValue: null
66
+ },
67
+ schemaBuilderRegistry: {
68
+ type: "object",
69
+ defaultValue: null
70
+ },
63
71
  data: {
64
72
  type: "object",
65
73
  defaultValue: null,
@@ -406,9 +414,6 @@ sap.ui.define(["sap/ui/core/Control", "./host/GeneratorHost", "../utils/Logger",
406
414
  Control.prototype.setProperty.call(this, "dataJson", str, true);
407
415
  }
408
416
  }
409
- if (eventName === "fieldChange" && this.odataDelegate) {
410
- this.odataDelegate.handleFieldChange(params.fieldPath, params.value);
411
- }
412
417
  }
413
418
  this.fireEvent(eventName, oEvent.getParameters());
414
419
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicHost-dbg.js","names":["GeneratorHost","_interopRequireDefault","__GeneratorHost","Logger","___utils_Logger","ODataDelegate","___host_delegates_ODataDelegate","SchemaBuilderRegistry","___core_SchemaBuilderRegistry","DynamicHost","Control","extend","constructor","prototype","apply","arguments","odataDelegate","_innerHost","_initializedInner","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","schemaDefinitions","schemaTarget","data","bindable","dataJson","liveUpdate","isValid","useMessageManager","modelName","debugMode","editable","inferenceStrategy","aggregations","_content","multiple","visibility","events","beforeSubmit","parameters","payload","addError","preventDefault","submit","payloadJson","cancel","fieldChange","fieldPath","value","validationStateChanged","validationError","message","validationSuccess","error","exception","initODataDelegate","_initODataDelegate","getBindingInfo","dataBinding","path","oContext","getBindingContext","debug","getPath","requestObject","syncToEngine","Object","keys","setBindingContext","_setBindingContext","sModelName","Control.prototype.setBindingContext.call","bindElement","_bindElement","vPath","mParameters","Control.prototype.bindElement.call","model","undefined","oBinding","getElementBinding","attachChange","onBeforeRendering","_onBeforeRendering","schemaRaw","getProperty","startsWith","self","_fetchingSchema","sap","ui","require","BusyIndicator","MessageToast","show","fetch","then","res","ok","Error","status","json","plugin","getBuilderFor","finalSchema","build","Control.prototype.setProperty.call","definitions","hide","invalidate","catch","err","warn","schema","trim","JSON","parse","e","hasSchema","length","hasData","rawDataObj","trace","AIConfig","proxy","getProxy","generateSchema","generatedSchema","props","getMetadata","getProperties","propName","val","Control.prototype.getProperty.call","setProperty","setAggregation","getEvents","eventName","attachEvent","oEvent","params","getParameters","isLive","str","stringify","handleFieldChange","fireEvent","_setProperty","propertyName","suppressInvalidate","openInDialog","_openInDialog","title","submitButtonText","cancelButtonText","dialogWidth","parentView","triggerSubmit","_triggerSubmit","addCustomError","_addCustomError","inner","clearCustomError","_clearCustomError","_getProperty"],"sources":["DynamicHost.ts"],"sourcesContent":["import Control from \"sap/ui/core/Control\";\nimport RenderManager from \"sap/ui/core/RenderManager\";\nimport GeneratorHost from \"./host/GeneratorHost\";\nimport { Logger } from \"../utils/Logger\";\nimport { ODataDelegate } from \"./host/delegates/ODataDelegate\";\nimport ODataV4Context from \"sap/ui/model/odata/v4/Context\";\nimport { SchemaBuilderRegistry } from \"../core/SchemaBuilderRegistry\";\n\n/**\n * A transparent wrapper control (Facade) that automatically chooses between Explicit Schema Mode \n * and Inference Mode based on the presence of a 'schemaDefinition'.\n * \n * This maintains total architectural separation of the modes without forcing developers to \n * use different XML tags.\n * \n * @namespace nz.co.siliconst.ui5.metaui.controls\n */\nexport default class DynamicHost extends Control {\n private odataDelegate: ODataDelegate | null = null;\n\n static readonly metadata = {\n properties: {\n schemaDefinition: { type: \"any\", defaultValue: null },\n schemaDefinitions: { type: \"object\", defaultValue: null },\n schemaTarget: { type: \"string\", defaultValue: null },\n data: { type: \"object\", defaultValue: null, bindable: \"bindable\" },\n dataJson: { type: \"string\", defaultValue: null, bindable: \"bindable\" },\n liveUpdate: { type: \"boolean\", defaultValue: false },\n isValid: { type: \"boolean\", defaultValue: true },\n useMessageManager: { type: \"boolean\", defaultValue: false },\n modelName: { type: \"string\", defaultValue: \"meta\" },\n debugMode: { type: \"boolean\", defaultValue: false },\n editable: { type: \"boolean\", defaultValue: true },\n inferenceStrategy: { type: \"string\", defaultValue: \"RuleBased\" }\n },\n aggregations: {\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\n },\n events: {\n beforeSubmit: {\n parameters: {\n payload: { type: \"object\" },\n addError: { type: \"function\" },\n preventDefault: { type: \"function\" }\n }\n },\n submit: {\n parameters: {\n payload: { type: \"object\" },\n payloadJson: { type: \"string\" }\n }\n },\n cancel: {},\n fieldChange: {\n parameters: {\n fieldPath: { type: \"string\" },\n value: { type: \"any\" },\n payload: { type: \"object\" },\n isValid: { type: \"boolean\" }\n }\n },\n validationStateChanged: { parameters: { isValid: { type: \"boolean\" } } },\n validationError: { parameters: { fieldPath: { type: \"string\" }, message: { type: \"string\" } } },\n validationSuccess: { parameters: { fieldPath: { type: \"string\" } } },\n error: { parameters: { message: { type: \"string\" }, exception: { type: \"object\" } } }\n }\n };\n\n static renderer = {\n apiVersion: 2,\n render(rm: RenderManager, control: DynamicHost) {\n rm.openStart(\"div\", control);\n rm.style(\"width\", \"100%\");\n rm.style(\"height\", \"100%\");\n rm.openEnd();\n\n const content = control.getAggregation(\"_content\") as Control;\n if (content) {\n rm.renderControl(content);\n }\n\n rm.close(\"div\");\n }\n };\n\n /**\n * Internal reference to the generated inner host instance.\n * @private\n */\n private _innerHost: GeneratorHost | null = null;\n\n /**\n * Flag indicating if the inner host has been initialized.\n * @private\n */\n private _initializedInner: boolean = false;\n\n /**\n * Initializes the OData Delegate if an OData context is detected.\n * This allows DynamicHost to seamlessly synchronize metadata and properties from an OData model.\n * @private\n */\n private initODataDelegate(): void {\n if (!this.odataDelegate) {\n // Guard: If the user explicitly bound dataJson, do not steal the context.\n if (this.getBindingInfo(\"dataJson\")) {\n return;\n }\n\n // Guard: If the user explicitly bound 'data' to a specific property path, do not steal the context.\n const dataBinding = this.getBindingInfo(\"data\") as any;\n if (dataBinding && dataBinding.path && dataBinding.path !== \"\") {\n return;\n }\n\n const oContext = this.getBindingContext(\"odata\") || this.getBindingContext();\n if (oContext) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context found for delegate initialization: ${oContext.getPath()}`, \"DynamicHost\");\n if (oContext && (oContext as ODataV4Context).requestObject && typeof (oContext as ODataV4Context).requestObject === \"function\") {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context supports requestObject/getObject. Instantiating ODataDelegate.`, \"DynamicHost\");\n this.odataDelegate = new ODataDelegate(this, oContext as ODataV4Context);\n this.odataDelegate.syncToEngine();\n } else {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context does NOT support requestObject/getObject! Keys: ${Object.keys(oContext)}`, \"DynamicHost\");\n }\n }\n }\n }\n\n /**\n * Standard UI5 method override.\n * Sets the binding context for the control and attempts to initialize the OData delegate\n * if the context points to an OData model.\n * \n * @param {sap.ui.model.Context | null | undefined} oContext The binding context object\n * @param {string} [sModelName] Optional model name\n * @returns {this} The control instance for chaining\n */\n public setBindingContext(oContext: sap.ui.model.Context | null | undefined, sModelName?: string): this {\n super.setBindingContext(oContext, sModelName);\n this.initODataDelegate();\n return this;\n }\n\n /**\n * Standard UI5 method override.\n * Binds the element to the given path and attaches a change listener to re-evaluate\n * the OData delegate when the element binding resolves.\n * \n * @param {string | Record<string, unknown>} vPath The binding path or configuration object\n * @param {object} [mParameters] Optional mapping parameters\n * @returns {this} Reference to this instance for chaining\n */\n public bindElement(vPath: string | Record<string, unknown>, mParameters?: object): this {\n super.bindElement(vPath, mParameters);\n const sModelName = typeof vPath === \"object\" ? vPath.model : undefined;\n const oBinding = this.getElementBinding(sModelName);\n if (oBinding) {\n oBinding.attachChange(() => {\n this.initODataDelegate();\n });\n }\n return this;\n }\n\n /**\n * Standard UI5 Lifecycle Hook.\n * Evaluates the initial properties and spawns the GeneratorHost.\n * It handles the complex lifecycle task of copying all bindings, raw properties, and event listeners \n * down to the inner host perfectly transparently.\n */\n public onBeforeRendering(): void {\n Logger.debug(\"[MetaUI DynamicHost]\", `onBeforeRendering called. _initializedInner: ${this._initializedInner}`, \"DynamicHost\");\n\n this.initODataDelegate();\n\n if (!this._initializedInner) {\n let schemaRaw = this.getProperty(\"schemaDefinition\");\n\n // 1. URL Detection & Fetching\n if (typeof schemaRaw === \"string\" && (schemaRaw.startsWith(\"http://\") || schemaRaw.startsWith(\"https://\"))) {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n \n sap.ui.require([\"sap/ui/core/BusyIndicator\", \"sap/m/MessageToast\"], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }) => {\n BusyIndicator.show(0);\n fetch(schemaRaw as string)\n .then(res => {\n if (!res.ok) throw new Error(\"HTTP \" + res.status);\n return res.json();\n })\n .then(json => {\n const plugin = SchemaBuilderRegistry.getBuilderFor(json);\n const finalSchema = plugin ? plugin.build(json, this.getProperty(\"schemaTarget\")) : json;\n super.setProperty(\"schemaDefinition\", finalSchema, true);\n if (finalSchema.definitions) {\n super.setProperty(\"schemaDefinitions\", finalSchema.definitions, true);\n }\n const self = this as unknown as { _fetchingSchema?: boolean };\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with resolved schema\n })\n .catch(err => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"Failed to fetch remote schema: \" + err, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"Failed to fetch remote schema\");\n super.setProperty(\"schemaDefinition\", null, true); // Fallback to full inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate();\n });\n });\n return; // Abort this render cycle until fetch completes\n }\n\n // 2. Local Plugin Detection (Stringified JSON or Raw Object)\n let schema = schemaRaw;\n if (schema && typeof schema === \"string\" && (schema as string).trim().startsWith(\"{\")) {\n try {\n schema = JSON.parse(schema);\n } catch (e) {\n // Ignore, let standard validation catch it\n }\n }\n\n if (schema && typeof schema === \"object\") {\n const plugin = SchemaBuilderRegistry.getBuilderFor(schema);\n if (plugin) {\n schema = plugin.build(schema, this.getProperty(\"schemaTarget\"));\n // Silently update the wrapper property so the inner host gets the final parsed MetaUI format\n super.setProperty(\"schemaDefinition\", schema, true);\n if (schema.definitions) {\n super.setProperty(\"schemaDefinitions\", schema.definitions, true);\n }\n }\n }\n\n const dataJson = this.getProperty(\"dataJson\");\n const data = this.getProperty(\"data\");\n\n let hasSchema = !!schema;\n if (hasSchema && typeof schema === \"object\" && Object.keys(schema).length === 0) {\n hasSchema = false; // Treat empty object as no schema\n }\n\n const hasData = !!dataJson || !!data;\n\n // 3. AI Schema Inference Detection\n if (hasData && this.getProperty(\"inferenceStrategy\") === \"AI\") {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n\n let rawDataObj = data;\n if (!rawDataObj && dataJson) {\n try { rawDataObj = JSON.parse(dataJson as string); } catch(e: Error) { Logger.trace(\"[DynamicHost] Ignored invalid dataJson parse: \" + e.message); }\n }\n\n if (rawDataObj) {\n sap.ui.require([\n \"sap/ui/core/BusyIndicator\", \n \"sap/m/MessageToast\",\n \"nz/co/siliconst/ui5/metaui/ai/AIConfig\"\n ], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }, AIConfig: { getProxy: () => { generateSchema: (d: unknown, s?: unknown) => Promise<unknown> } }) => {\n BusyIndicator.show(0);\n const proxy = AIConfig.getProxy();\n \n proxy.generateSchema(rawDataObj, schema || undefined)\n .then((generatedSchema: unknown) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n super.setProperty(\"schemaDefinition\", generatedSchema, true);\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with the new schema\n })\n .catch((err: Error) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"AI inference failed, falling back to RuleBased. Error: \" + err.message, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"AI Inference failed, using fallback.\");\n super.setProperty(\"inferenceStrategy\", \"RuleBased\", true); // Fallback to normal inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); \n });\n });\n return; // Abort render cycle until AI is done\n }\n }\n\n Logger.debug(\"[MetaUI DynamicHost]\", `Evaluating boot. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n\n // Only boot if we have either a schema or some data to infer from\n if (hasSchema || hasData) {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Booting inner host. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n }\n // The architectural Facade router logic:\n // We've simplified this! We no longer use HostFactory or separate subclasses.\n // GeneratorHost is fully capable of inferring the schema if none is provided.\n this._innerHost = new GeneratorHost();\n\n // 1. Forward all static values to the spawned host BEFORE mounting.\n // Since we no longer use bindProperty, it's perfectly safe to set raw properties before mounting.\n const props = this.getMetadata().getProperties();\n for (const propName in props) {\n if (propName === \"inferenceStrategy\") continue;\n const val = super.getProperty(propName);\n if (val !== null && val !== undefined) {\n if (propName === \"schemaDefinitions\") {\n Logger.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(val)}`, \"\", \"DynamicHost\");\n }\n this._innerHost.setProperty(propName, val);\n } else if (propName === \"schemaDefinitions\") {\n Logger.warn(`[MetaUI DynamicHost] Warning: schemaDefinitions is null/undefined in Wrapper. Defaulting to empty object in GeneratorHost.`, \"\", \"DynamicHost\");\n }\n }\n\n // 2. Mount so it inherits models and triggers lifecycle.\n this.setAggregation(\"_content\", this._innerHost);\n\n // 3. Forward all event subscriptions.\n // By proxying the events upwards, the developer can subscribe to `<meta:DynamicHost submit=\"...\">` \n // and perfectly receive the inner host's submission event.\n const events = this.getMetadata().getEvents();\n for (const eventName in events) {\n this._innerHost.attachEvent(eventName, (oEvent: sap.ui.base.Event) => {\n // Natively push updated payload out to any bound Fiori Element properties.\n // Using super.setProperty prevents an infinite loop back down to _innerHost.\n if (eventName === \"submit\" || eventName === \"fieldChange\") {\n const params = oEvent.getParameters();\n if (params.payload) {\n const isLive = this.getProperty(\"liveUpdate\") === true;\n if (eventName === \"submit\" || isLive) {\n super.setProperty(\"data\", params.payload, true);\n\n const str = params.payloadJson || JSON.stringify(params.payload, null, 2);\n super.setProperty(\"dataJson\", str, true);\n }\n }\n if (eventName === \"fieldChange\" && this.odataDelegate) {\n this.odataDelegate.handleFieldChange(params.fieldPath, params.value);\n }\n }\n this.fireEvent(eventName, oEvent.getParameters());\n });\n }\n\n this._initializedInner = true;\n }\n }\n }\n\n /**\n * Overrides standard UI5 setProperty to act as a transparent proxy.\n * When a property is updated on the wrapper (either programmatically or via a binding update),\n * it instantly mirrors that value down to the inner instantiated host.\n */\n public setProperty(propertyName: string, value: unknown, suppressInvalidate?: boolean): this {\n if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Wrapper received setProperty: ${propertyName}`, \"DynamicHost\");\n }\n }\n super.setProperty(propertyName, value, suppressInvalidate);\n if (this._innerHost && propertyName !== \"inferenceStrategy\") {\n this._innerHost.setProperty(propertyName, value, suppressInvalidate);\n } else if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `_innerHost not yet initialized when ${propertyName} was set. Booting will happen on next render.`, \"DynamicHost\");\n }\n }\n return this;\n }\n\n\n\n\n\n /**\n * Programmatic API support. Routes dialog commands down to the spawned inner host.\n * If the inner host has not booted yet, it forces initialization immediately.\n * \n * @param {string} [title=\"Form\"] The title of the dialog\n * @param {string} [submitButtonText=\"OK\"] The text for the primary action button\n * @param {string} [cancelButtonText=\"Cancel\"] The text for the cancel button\n * @param {string} [dialogWidth=\"auto\"] The width of the dialog\n * @param {sap.ui.core.Control} [parentView] The parent view to attach the dialog to for model inheritance.\n */\n public openInDialog(title?: string, submitButtonText?: string, cancelButtonText?: string, dialogWidth?: string, parentView?: Control): void {\n if (!this._innerHost) {\n this.onBeforeRendering(); // Force init if they bypassed UI5 rendering\n }\n this._innerHost?.openInDialog(title, submitButtonText, cancelButtonText, dialogWidth, parentView);\n }\n\n /**\n * Proxies submission triggering down to the instantiated generator host.\n * Evaluates the internal Engine validation suite and returns true if structurally sound.\n * \n * @returns {boolean} True if the internal payload passes schema validation, false otherwise.\n */\n public triggerSubmit(): boolean {\n if (!this._innerHost) {\n return false;\n }\n return this._innerHost.triggerSubmit();\n }\n\n /**\n * Injects a custom error message onto a specific field.\n * Useful for injecting custom backend validation errors.\n * \n * @param {string} fieldPath The schema key path to target.\n * @param {string} message The custom error message to display.\n */\n public addCustomError(fieldPath: string, message: string): void {\n const inner = this._innerHost as unknown as { addCustomError?: (p: string, m: string) => void };\n if (inner && typeof inner.addCustomError === \"function\") {\n inner.addCustomError(fieldPath, message);\n }\n }\n\n /**\n * Clears a custom error message from a specific field.\n * \n * @param {string} fieldPath The schema key path to target.\n */\n public clearCustomError(fieldPath: string): void {\n const inner = this._innerHost as unknown as { clearCustomError?: (p: string) => void };\n if (inner && typeof inner.clearCustomError === \"function\") {\n inner.clearCustomError(fieldPath);\n }\n }\n\n /**\n * Overrides standard UI5 getProperty to transparently pull extracted data from the inner host.\n * Ensures that querying the DynamicHost facade for `data` always yields the freshest payload.\n * \n * @param {string} propertyName The name of the property to retrieve\n * @returns {unknown} The property value\n */\n public getProperty(propertyName: string): unknown {\n if (propertyName === \"outputData\") {\n propertyName = \"data\"; // Forward deprecated outputData to data\n }\n if (this._innerHost && (propertyName === \"data\" || propertyName === \"dataJson\")) {\n return this._innerHost.getProperty(propertyName);\n }\n return super.getProperty(propertyName);\n }\n}\n"],"mappings":";;;;;;QAEOA,aAAa,GAAAC,sBAAA,CAAAC,eAAA;EAAA,MACXC,MAAM,GAAAC,eAAA;EAAA,MACNC,aAAa,GAAAC,+BAAA;EAAA,MAEbC,qBAAqB,GAAAC,6BAAA;EAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EARA,MASqBC,WAAW,GAASC,OAAO,CAAAC,MAAA;IAAAC,WAAA,WAAAA,YAAA;MAAAF,OAAA,CAAAG,SAAA,CAAAD,WAAA,CAAAE,KAAA,OAAAC,SAAA;MAAA,KACpCC,aAAa,GAAyB,IAAI;MAmElD;AACJ;AACA;AACA;MAHI,KAIQC,UAAU,GAAyB,IAAI;MAE/C;AACJ;AACA;AACA;MAHI,KAIQC,iBAAiB,GAAY,KAAK;IAAA;IA3BnCC,QAAQ,EAAG;MACdC,UAAU,EAAE,CAAC;MACbC,MAAMA,CAACC,EAAiB,EAAEC,OAAoB,EAAE;QAC5CD,EAAE,CAACE,SAAS,CAAC,KAAK,EAAED,OAAO,CAAC;QAC5BD,EAAE,CAACG,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;QACzBH,EAAE,CAACG,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1BH,EAAE,CAACI,OAAO,CAAC,CAAC;QAEZ,MAAMC,OAAO,GAAGJ,OAAO,CAACK,cAAc,CAAC,UAAU,CAAY;QAC7D,IAAID,OAAO,EAAE;UACTL,EAAE,CAACO,aAAa,CAACF,OAAO,CAAC;QAC7B;QAEAL,EAAE,CAACQ,KAAK,CAAC,KAAK,CAAC;MACnB;IACJ,CAA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AAf,kCAAA,OAAyBe,YAAY;IACzC;EAAC;EAAA,OAlbgB1J,WAAW;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"DynamicHost-dbg.js","names":["GeneratorHost","_interopRequireDefault","__GeneratorHost","Logger","___utils_Logger","ODataDelegate","___host_delegates_ODataDelegate","SchemaBuilderRegistry","___core_SchemaBuilderRegistry","DynamicHost","Control","extend","constructor","prototype","apply","arguments","odataDelegate","_innerHost","_initializedInner","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","schemaDefinitions","schemaTarget","pluginRegistry","schemaBuilderRegistry","data","bindable","dataJson","liveUpdate","isValid","useMessageManager","modelName","debugMode","editable","inferenceStrategy","aggregations","_content","multiple","visibility","events","beforeSubmit","parameters","payload","addError","preventDefault","submit","payloadJson","cancel","fieldChange","fieldPath","value","validationStateChanged","validationError","message","validationSuccess","error","exception","initODataDelegate","_initODataDelegate","getBindingInfo","dataBinding","path","oContext","getBindingContext","debug","getPath","requestObject","syncToEngine","Object","keys","setBindingContext","_setBindingContext","sModelName","Control.prototype.setBindingContext.call","bindElement","_bindElement","vPath","mParameters","Control.prototype.bindElement.call","model","undefined","oBinding","getElementBinding","attachChange","onBeforeRendering","_onBeforeRendering","schemaRaw","getProperty","startsWith","self","_fetchingSchema","sap","ui","require","BusyIndicator","MessageToast","show","fetch","then","res","ok","Error","status","json","plugin","getBuilderFor","finalSchema","build","Control.prototype.setProperty.call","definitions","hide","invalidate","catch","err","warn","schema","trim","JSON","parse","e","hasSchema","length","hasData","rawDataObj","trace","AIConfig","proxy","getProxy","generateSchema","generatedSchema","props","getMetadata","getProperties","propName","val","Control.prototype.getProperty.call","setProperty","setAggregation","getEvents","eventName","attachEvent","oEvent","params","getParameters","isLive","str","stringify","fireEvent","_setProperty","propertyName","suppressInvalidate","openInDialog","_openInDialog","title","submitButtonText","cancelButtonText","dialogWidth","parentView","triggerSubmit","_triggerSubmit","addCustomError","_addCustomError","inner","clearCustomError","_clearCustomError","_getProperty"],"sources":["DynamicHost.ts"],"sourcesContent":["import Control from \"sap/ui/core/Control\";\nimport RenderManager from \"sap/ui/core/RenderManager\";\nimport GeneratorHost from \"./host/GeneratorHost\";\nimport { Logger } from \"../utils/Logger\";\nimport { ODataDelegate } from \"./host/delegates/ODataDelegate\";\nimport ODataV4Context from \"sap/ui/model/odata/v4/Context\";\nimport { SchemaBuilderRegistry } from \"../core/SchemaBuilderRegistry\";\n\n/**\n * A transparent wrapper control (Facade) that automatically chooses between Explicit Schema Mode \n * and Inference Mode based on the presence of a 'schemaDefinition'.\n * \n * This maintains total architectural separation of the modes without forcing developers to \n * use different XML tags.\n * \n * @namespace nz.co.siliconst.ui5.metaui.controls\n */\nexport default class DynamicHost extends Control {\n private odataDelegate: ODataDelegate | null = null;\n\n static readonly metadata = {\n properties: {\n schemaDefinition: { type: \"any\", defaultValue: null },\n schemaDefinitions: { type: \"object\", defaultValue: null },\n schemaTarget: { type: \"string\", defaultValue: null },\n pluginRegistry: { type: \"object\", defaultValue: null },\n schemaBuilderRegistry: { type: \"object\", defaultValue: null },\n data: { type: \"object\", defaultValue: null, bindable: \"bindable\" },\n dataJson: { type: \"string\", defaultValue: null, bindable: \"bindable\" },\n liveUpdate: { type: \"boolean\", defaultValue: false },\n isValid: { type: \"boolean\", defaultValue: true },\n useMessageManager: { type: \"boolean\", defaultValue: false },\n modelName: { type: \"string\", defaultValue: \"meta\" },\n debugMode: { type: \"boolean\", defaultValue: false },\n editable: { type: \"boolean\", defaultValue: true },\n inferenceStrategy: { type: \"string\", defaultValue: \"RuleBased\" }\n },\n aggregations: {\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\n },\n events: {\n beforeSubmit: {\n parameters: {\n payload: { type: \"object\" },\n addError: { type: \"function\" },\n preventDefault: { type: \"function\" }\n }\n },\n submit: {\n parameters: {\n payload: { type: \"object\" },\n payloadJson: { type: \"string\" }\n }\n },\n cancel: {},\n fieldChange: {\n parameters: {\n fieldPath: { type: \"string\" },\n value: { type: \"any\" },\n payload: { type: \"object\" },\n isValid: { type: \"boolean\" }\n }\n },\n validationStateChanged: { parameters: { isValid: { type: \"boolean\" } } },\n validationError: { parameters: { fieldPath: { type: \"string\" }, message: { type: \"string\" } } },\n validationSuccess: { parameters: { fieldPath: { type: \"string\" } } },\n error: { parameters: { message: { type: \"string\" }, exception: { type: \"object\" } } }\n }\n };\n\n static renderer = {\n apiVersion: 2,\n render(rm: RenderManager, control: DynamicHost) {\n rm.openStart(\"div\", control);\n rm.style(\"width\", \"100%\");\n rm.style(\"height\", \"100%\");\n rm.openEnd();\n\n const content = control.getAggregation(\"_content\") as Control;\n if (content) {\n rm.renderControl(content);\n }\n\n rm.close(\"div\");\n }\n };\n\n /**\n * Internal reference to the generated inner host instance.\n * @private\n */\n private _innerHost: GeneratorHost | null = null;\n\n /**\n * Flag indicating if the inner host has been initialized.\n * @private\n */\n private _initializedInner: boolean = false;\n\n /**\n * Initializes the OData Delegate if an OData context is detected.\n * This allows DynamicHost to seamlessly synchronize metadata and properties from an OData model.\n * @private\n */\n private initODataDelegate(): void {\n if (!this.odataDelegate) {\n // Guard: If the user explicitly bound dataJson, do not steal the context.\n if (this.getBindingInfo(\"dataJson\")) {\n return;\n }\n\n // Guard: If the user explicitly bound 'data' to a specific property path, do not steal the context.\n const dataBinding = this.getBindingInfo(\"data\") as any;\n if (dataBinding && dataBinding.path && dataBinding.path !== \"\") {\n return;\n }\n\n const oContext = this.getBindingContext(\"odata\") || this.getBindingContext();\n if (oContext) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context found for delegate initialization: ${oContext.getPath()}`, \"DynamicHost\");\n if (oContext && (oContext as ODataV4Context).requestObject && typeof (oContext as ODataV4Context).requestObject === \"function\") {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context supports requestObject/getObject. Instantiating ODataDelegate.`, \"DynamicHost\");\n this.odataDelegate = new ODataDelegate(this, oContext as ODataV4Context);\n this.odataDelegate.syncToEngine();\n } else {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context does NOT support requestObject/getObject! Keys: ${Object.keys(oContext)}`, \"DynamicHost\");\n }\n }\n }\n }\n\n /**\n * Standard UI5 method override.\n * Sets the binding context for the control and attempts to initialize the OData delegate\n * if the context points to an OData model.\n * \n * @param {sap.ui.model.Context | null | undefined} oContext The binding context object\n * @param {string} [sModelName] Optional model name\n * @returns {this} The control instance for chaining\n */\n public setBindingContext(oContext: sap.ui.model.Context | null | undefined, sModelName?: string): this {\n super.setBindingContext(oContext, sModelName);\n this.initODataDelegate();\n return this;\n }\n\n /**\n * Standard UI5 method override.\n * Binds the element to the given path and attaches a change listener to re-evaluate\n * the OData delegate when the element binding resolves.\n * \n * @param {string | Record<string, unknown>} vPath The binding path or configuration object\n * @param {object} [mParameters] Optional mapping parameters\n * @returns {this} Reference to this instance for chaining\n */\n public bindElement(vPath: string | Record<string, unknown>, mParameters?: object): this {\n super.bindElement(vPath, mParameters);\n const sModelName = typeof vPath === \"object\" ? vPath.model : undefined;\n const oBinding = this.getElementBinding(sModelName);\n if (oBinding) {\n oBinding.attachChange(() => {\n this.initODataDelegate();\n });\n }\n return this;\n }\n\n /**\n * Standard UI5 Lifecycle Hook.\n * Evaluates the initial properties and spawns the GeneratorHost.\n * It handles the complex lifecycle task of copying all bindings, raw properties, and event listeners \n * down to the inner host perfectly transparently.\n */\n public onBeforeRendering(): void {\n Logger.debug(\"[MetaUI DynamicHost]\", `onBeforeRendering called. _initializedInner: ${this._initializedInner}`, \"DynamicHost\");\n\n this.initODataDelegate();\n\n if (!this._initializedInner) {\n let schemaRaw = this.getProperty(\"schemaDefinition\");\n\n // 1. URL Detection & Fetching\n if (typeof schemaRaw === \"string\" && (schemaRaw.startsWith(\"http://\") || schemaRaw.startsWith(\"https://\"))) {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n \n sap.ui.require([\"sap/ui/core/BusyIndicator\", \"sap/m/MessageToast\"], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }) => {\n BusyIndicator.show(0);\n fetch(schemaRaw as string)\n .then(res => {\n if (!res.ok) throw new Error(\"HTTP \" + res.status);\n return res.json();\n })\n .then(json => {\n const plugin = SchemaBuilderRegistry.getBuilderFor(json);\n const finalSchema = plugin ? plugin.build(json, this.getProperty(\"schemaTarget\")) : json;\n super.setProperty(\"schemaDefinition\", finalSchema, true);\n if (finalSchema.definitions) {\n super.setProperty(\"schemaDefinitions\", finalSchema.definitions, true);\n }\n const self = this as unknown as { _fetchingSchema?: boolean };\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with resolved schema\n })\n .catch(err => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"Failed to fetch remote schema: \" + err, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"Failed to fetch remote schema\");\n super.setProperty(\"schemaDefinition\", null, true); // Fallback to full inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate();\n });\n });\n return; // Abort this render cycle until fetch completes\n }\n\n // 2. Local Plugin Detection (Stringified JSON or Raw Object)\n let schema = schemaRaw;\n if (schema && typeof schema === \"string\" && (schema as string).trim().startsWith(\"{\")) {\n try {\n schema = JSON.parse(schema);\n } catch (e) {\n // Ignore, let standard validation catch it\n }\n }\n\n if (schema && typeof schema === \"object\") {\n const plugin = SchemaBuilderRegistry.getBuilderFor(schema);\n if (plugin) {\n schema = plugin.build(schema, this.getProperty(\"schemaTarget\"));\n // Silently update the wrapper property so the inner host gets the final parsed MetaUI format\n super.setProperty(\"schemaDefinition\", schema, true);\n if (schema.definitions) {\n super.setProperty(\"schemaDefinitions\", schema.definitions, true);\n }\n }\n }\n\n const dataJson = this.getProperty(\"dataJson\");\n const data = this.getProperty(\"data\");\n\n let hasSchema = !!schema;\n if (hasSchema && typeof schema === \"object\" && Object.keys(schema).length === 0) {\n hasSchema = false; // Treat empty object as no schema\n }\n\n const hasData = !!dataJson || !!data;\n\n // 3. AI Schema Inference Detection\n if (hasData && this.getProperty(\"inferenceStrategy\") === \"AI\") {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n\n let rawDataObj = data;\n if (!rawDataObj && dataJson) {\n try { rawDataObj = JSON.parse(dataJson as string); } catch(e: Error) { Logger.trace(\"[DynamicHost] Ignored invalid dataJson parse: \" + e.message); }\n }\n\n if (rawDataObj) {\n sap.ui.require([\n \"sap/ui/core/BusyIndicator\", \n \"sap/m/MessageToast\",\n \"nz/co/siliconst/ui5/metaui/ai/AIConfig\"\n ], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }, AIConfig: { getProxy: () => { generateSchema: (d: unknown, s?: unknown) => Promise<unknown> } }) => {\n BusyIndicator.show(0);\n const proxy = AIConfig.getProxy();\n \n proxy.generateSchema(rawDataObj, schema || undefined)\n .then((generatedSchema: unknown) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n super.setProperty(\"schemaDefinition\", generatedSchema, true);\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with the new schema\n })\n .catch((err: Error) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"AI inference failed, falling back to RuleBased. Error: \" + err.message, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"AI Inference failed, using fallback.\");\n super.setProperty(\"inferenceStrategy\", \"RuleBased\", true); // Fallback to normal inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); \n });\n });\n return; // Abort render cycle until AI is done\n }\n }\n\n Logger.debug(\"[MetaUI DynamicHost]\", `Evaluating boot. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n\n // Only boot if we have either a schema or some data to infer from\n if (hasSchema || hasData) {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Booting inner host. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n }\n // The architectural Facade router logic:\n // We've simplified this! We no longer use HostFactory or separate subclasses.\n // GeneratorHost is fully capable of inferring the schema if none is provided.\n this._innerHost = new GeneratorHost();\n\n // 1. Forward all static values to the spawned host BEFORE mounting.\n // Since we no longer use bindProperty, it's perfectly safe to set raw properties before mounting.\n const props = this.getMetadata().getProperties();\n for (const propName in props) {\n if (propName === \"inferenceStrategy\") continue;\n const val = super.getProperty(propName);\n if (val !== null && val !== undefined) {\n if (propName === \"schemaDefinitions\") {\n Logger.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(val)}`, \"\", \"DynamicHost\");\n }\n this._innerHost.setProperty(propName, val);\n } else if (propName === \"schemaDefinitions\") {\n Logger.warn(`[MetaUI DynamicHost] Warning: schemaDefinitions is null/undefined in Wrapper. Defaulting to empty object in GeneratorHost.`, \"\", \"DynamicHost\");\n }\n }\n\n // 2. Mount so it inherits models and triggers lifecycle.\n this.setAggregation(\"_content\", this._innerHost);\n\n // 3. Forward all event subscriptions.\n // By proxying the events upwards, the developer can subscribe to `<meta:DynamicHost submit=\"...\">` \n // and perfectly receive the inner host's submission event.\n const events = this.getMetadata().getEvents();\n for (const eventName in events) {\n this._innerHost.attachEvent(eventName, (oEvent: sap.ui.base.Event) => {\n // Natively push updated payload out to any bound Fiori Element properties.\n // Using super.setProperty prevents an infinite loop back down to _innerHost.\n if (eventName === \"submit\" || eventName === \"fieldChange\") {\n const params = oEvent.getParameters();\n if (params.payload) {\n const isLive = this.getProperty(\"liveUpdate\") === true;\n if (eventName === \"submit\" || isLive) {\n super.setProperty(\"data\", params.payload, true);\n\n const str = params.payloadJson || JSON.stringify(params.payload, null, 2);\n super.setProperty(\"dataJson\", str, true);\n }\n }\n }\n this.fireEvent(eventName, oEvent.getParameters());\n });\n }\n\n this._initializedInner = true;\n }\n }\n }\n\n /**\n * Overrides standard UI5 setProperty to act as a transparent proxy.\n * When a property is updated on the wrapper (either programmatically or via a binding update),\n * it instantly mirrors that value down to the inner instantiated host.\n */\n public setProperty(propertyName: string, value: unknown, suppressInvalidate?: boolean): this {\n if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Wrapper received setProperty: ${propertyName}`, \"DynamicHost\");\n }\n }\n super.setProperty(propertyName, value, suppressInvalidate);\n if (this._innerHost && propertyName !== \"inferenceStrategy\") {\n this._innerHost.setProperty(propertyName, value, suppressInvalidate);\n } else if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `_innerHost not yet initialized when ${propertyName} was set. Booting will happen on next render.`, \"DynamicHost\");\n }\n }\n return this;\n }\n\n\n\n\n\n /**\n * Programmatic API support. Routes dialog commands down to the spawned inner host.\n * If the inner host has not booted yet, it forces initialization immediately.\n * \n * @param {string} [title=\"Form\"] The title of the dialog\n * @param {string} [submitButtonText=\"OK\"] The text for the primary action button\n * @param {string} [cancelButtonText=\"Cancel\"] The text for the cancel button\n * @param {string} [dialogWidth=\"auto\"] The width of the dialog\n * @param {sap.ui.core.Control} [parentView] The parent view to attach the dialog to for model inheritance.\n */\n public openInDialog(title?: string, submitButtonText?: string, cancelButtonText?: string, dialogWidth?: string, parentView?: Control): void {\n if (!this._innerHost) {\n this.onBeforeRendering(); // Force init if they bypassed UI5 rendering\n }\n this._innerHost?.openInDialog(title, submitButtonText, cancelButtonText, dialogWidth, parentView);\n }\n\n /**\n * Proxies submission triggering down to the instantiated generator host.\n * Evaluates the internal Engine validation suite and returns true if structurally sound.\n * \n * @returns {boolean} True if the internal payload passes schema validation, false otherwise.\n */\n public triggerSubmit(): boolean {\n if (!this._innerHost) {\n return false;\n }\n return this._innerHost.triggerSubmit();\n }\n\n /**\n * Injects a custom error message onto a specific field.\n * Useful for injecting custom backend validation errors.\n * \n * @param {string} fieldPath The schema key path to target.\n * @param {string} message The custom error message to display.\n */\n public addCustomError(fieldPath: string, message: string): void {\n const inner = this._innerHost as unknown as { addCustomError?: (p: string, m: string) => void };\n if (inner && typeof inner.addCustomError === \"function\") {\n inner.addCustomError(fieldPath, message);\n }\n }\n\n /**\n * Clears a custom error message from a specific field.\n * \n * @param {string} fieldPath The schema key path to target.\n */\n public clearCustomError(fieldPath: string): void {\n const inner = this._innerHost as unknown as { clearCustomError?: (p: string) => void };\n if (inner && typeof inner.clearCustomError === \"function\") {\n inner.clearCustomError(fieldPath);\n }\n }\n\n /**\n * Overrides standard UI5 getProperty to transparently pull extracted data from the inner host.\n * Ensures that querying the DynamicHost facade for `data` always yields the freshest payload.\n * \n * @param {string} propertyName The name of the property to retrieve\n * @returns {unknown} The property value\n */\n public getProperty(propertyName: string): unknown {\n if (propertyName === \"outputData\") {\n propertyName = \"data\"; // Forward deprecated outputData to data\n }\n if (this._innerHost && (propertyName === \"data\" || propertyName === \"dataJson\")) {\n return this._innerHost.getProperty(propertyName);\n }\n return super.getProperty(propertyName);\n }\n}\n"],"mappings":";;;;;;QAEOA,aAAa,GAAAC,sBAAA,CAAAC,eAAA;EAAA,MACXC,MAAM,GAAAC,eAAA;EAAA,MACNC,aAAa,GAAAC,+BAAA;EAAA,MAEbC,qBAAqB,GAAAC,6BAAA;EAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EARA,MASqBC,WAAW,GAASC,OAAO,CAAAC,MAAA;IAAAC,WAAA,WAAAA,YAAA;MAAAF,OAAA,CAAAG,SAAA,CAAAD,WAAA,CAAAE,KAAA,OAAAC,SAAA;MAAA,KACpCC,aAAa,GAAyB,IAAI;MAqElD;AACJ;AACA;AACA;MAHI,KAIQC,UAAU,GAAyB,IAAI;MAE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ACnH,SAAiB,EAAQ;MAC7C,MAAMiH,KAAK,GAAG,IAAI,CAAChK,UAAmE;MACtF,IAAIgK,KAAK,IAAI,OAAOA,KAAK,CAACC,gBAAgB,KAAK,UAAU,EAAE;QACvDD,KAAK,CAACC,gBAAgB,CAAClH,SAAS,CAAC;MACrC;IACJ,CAAC;IAED;AACJ;AACA;AACA;AACA;AACA;AACA;IACWsC,WAAW,WAAA8E,aAAChB,YAAoB,EAAW;MAC9C,IAAIA,YAAY,KAAK,YAAY,EAAE;QAC/BA,YAAY,GAAG,MAAM,CAAC,CAAC;MAC3B;MACA,IAAI,IAAI,CAACnJ,UAAU,KAAKmJ,YAAY,KAAK,MAAM,IAAIA,YAAY,KAAK,UAAU,CAAC,EAAE;QAC7E,OAAO,IAAI,CAACnJ,UAAU,CAACqF,WAAW,CAAC8D,YAAY,CAAC;MACpD;MACA,OAAAd,kCAAA,OAAyBc,YAAY;IACzC;EAAC;EAAA,OAjbgB3J,WAAW;AAAA","ignoreList":[]}
@@ -26,6 +26,14 @@ declare module "nz/co/siliconst/ui5/metaui/controls/DynamicHost" {
26
26
  type: string;
27
27
  defaultValue: any;
28
28
  };
29
+ pluginRegistry: {
30
+ type: string;
31
+ defaultValue: any;
32
+ };
33
+ schemaBuilderRegistry: {
34
+ type: string;
35
+ defaultValue: any;
36
+ };
29
37
  data: {
30
38
  type: string;
31
39
  defaultValue: any;
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicHost.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IACjE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,aAAa,MAAM,2BAA2B,CAAC;IAOtD;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;QAC5C,OAAO,CAAC,aAAa,CAA8B;QAEnD,MAAM,CAAC,QAAQ,CA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E,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,EAAE,OAAO,GAAG,IAAI;QAqB5F;;;;;;;;;WASG;QACI,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI;QAO3I;;;;;WAKG;QACI,aAAa,IAAI,OAAO;QAO/B;;;;;;WAMG;QACI,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;QAO/D;;;;WAIG;QACI,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;QAOhD;;;;;;WAMG;QACI,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;KASpD;CAEA"}
@@ -1,2 +1,2 @@
1
- sap.ui.define(["sap/ui/core/Control","./host/GeneratorHost","../utils/Logger","./host/delegates/ODataDelegate","../core/SchemaBuilderRegistry"],function(t,e,i,n,a){"use strict";function s(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const o=s(e);const r=i["Logger"];const l=n["ODataDelegate"];const c=a["SchemaBuilderRegistry"];const d=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},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},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"}}}}},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){r.debug("[MetaUI DynamicHost]",`Context found for delegate initialization: ${e.getPath()}`,"DynamicHost");if(e&&e.requestObject&&typeof e.requestObject==="function"){r.debug("[MetaUI DynamicHost]",`Context supports requestObject/getObject. Instantiating ODataDelegate.`,"DynamicHost");this.odataDelegate=new l(this,e);this.odataDelegate.syncToEngine()}else{r.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 s=this.getElementBinding(a);if(s){s.attachChange(()=>{this.initODataDelegate()})}return this},onBeforeRendering:function e(){r.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;sap.ui.require(["sap/ui/core/BusyIndicator","sap/m/MessageToast"],(i,n)=>{i.show(0);fetch(e).then(t=>{if(!t.ok)throw new Error("HTTP "+t.status);return t.json()}).then(e=>{const n=c.getBuilderFor(e);const a=n?n.build(e,this.getProperty("schemaTarget")):e;t.prototype.setProperty.call(this,"schemaDefinition",a,true);if(a.definitions){t.prototype.setProperty.call(this,"schemaDefinitions",a.definitions,true)}const s=this;s._fetchingSchema=false;i.hide();this.invalidate()}).catch(e=>{const a=this;r.warn("[MetaUI DynamicHost]","Failed to fetch remote schema: "+e,"DynamicHost");if(n)n.show("Failed to fetch remote schema");t.prototype.setProperty.call(this,"schemaDefinition",null,true);a._fetchingSchema=false;i.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=c.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 s=!!i;if(s&&typeof i==="object"&&Object.keys(i).length===0){s=false}const l=!!n||!!a;if(l&&this.getProperty("inferenceStrategy")==="AI"){const e=this;if(e._fetchingSchema)return;e._fetchingSchema=true;let s=a;if(!s&&n){try{s=JSON.parse(n)}catch(t){r.trace("[DynamicHost] Ignored invalid dataJson parse: "+t.message)}}if(s){sap.ui.require(["sap/ui/core/BusyIndicator","sap/m/MessageToast","nz/co/siliconst/ui5/metaui/ai/AIConfig"],(e,n,a)=>{e.show(0);const o=a.getProxy();o.generateSchema(s,i||undefined).then(i=>{const n=this;t.prototype.setProperty.call(this,"schemaDefinition",i,true);n._fetchingSchema=false;e.hide();this.invalidate()}).catch(i=>{const a=this;r.warn("[MetaUI DynamicHost]","AI inference failed, falling back to RuleBased. Error: "+i.message,"DynamicHost");if(n)n.show("AI Inference failed, using fallback.");t.prototype.setProperty.call(this,"inferenceStrategy","RuleBased",true);a._fetchingSchema=false;e.hide();this.invalidate()})});return}}r.debug("[MetaUI DynamicHost]",`Evaluating boot. hasSchema: ${s}, hasData: ${l}`,"DynamicHost");if(s||l){if(this.getProperty("debugMode")){r.debug("[MetaUI DynamicHost]",`Booting inner host. hasSchema: ${s}, hasData: ${l}`,"DynamicHost")}this._innerHost=new o;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"){r.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(e)}`,"","DynamicHost")}this._innerHost.setProperty(i,e)}else if(i==="schemaDefinitions"){r.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)}}if(e==="fieldChange"&&this.odataDelegate){this.odataDelegate.handleFieldChange(n.fieldPath,n.value)}}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")){r.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")){r.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,s){if(!this._innerHost){this.onBeforeRendering()}this._innerHost?.openInDialog(e,i,n,a,s)},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 d});
1
+ sap.ui.define(["sap/ui/core/Control","./host/GeneratorHost","../utils/Logger","./host/delegates/ODataDelegate","../core/SchemaBuilderRegistry"],function(t,e,i,n,a){"use strict";function s(t){return t&&t.__esModule&&typeof t.default!=="undefined"?t.default:t}const o=s(e);const r=i["Logger"];const l=n["ODataDelegate"];const c=a["SchemaBuilderRegistry"];const u=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},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"}}}}},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){r.debug("[MetaUI DynamicHost]",`Context found for delegate initialization: ${e.getPath()}`,"DynamicHost");if(e&&e.requestObject&&typeof e.requestObject==="function"){r.debug("[MetaUI DynamicHost]",`Context supports requestObject/getObject. Instantiating ODataDelegate.`,"DynamicHost");this.odataDelegate=new l(this,e);this.odataDelegate.syncToEngine()}else{r.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 s=this.getElementBinding(a);if(s){s.attachChange(()=>{this.initODataDelegate()})}return this},onBeforeRendering:function e(){r.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;sap.ui.require(["sap/ui/core/BusyIndicator","sap/m/MessageToast"],(i,n)=>{i.show(0);fetch(e).then(t=>{if(!t.ok)throw new Error("HTTP "+t.status);return t.json()}).then(e=>{const n=c.getBuilderFor(e);const a=n?n.build(e,this.getProperty("schemaTarget")):e;t.prototype.setProperty.call(this,"schemaDefinition",a,true);if(a.definitions){t.prototype.setProperty.call(this,"schemaDefinitions",a.definitions,true)}const s=this;s._fetchingSchema=false;i.hide();this.invalidate()}).catch(e=>{const a=this;r.warn("[MetaUI DynamicHost]","Failed to fetch remote schema: "+e,"DynamicHost");if(n)n.show("Failed to fetch remote schema");t.prototype.setProperty.call(this,"schemaDefinition",null,true);a._fetchingSchema=false;i.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=c.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 s=!!i;if(s&&typeof i==="object"&&Object.keys(i).length===0){s=false}const l=!!n||!!a;if(l&&this.getProperty("inferenceStrategy")==="AI"){const e=this;if(e._fetchingSchema)return;e._fetchingSchema=true;let s=a;if(!s&&n){try{s=JSON.parse(n)}catch(t){r.trace("[DynamicHost] Ignored invalid dataJson parse: "+t.message)}}if(s){sap.ui.require(["sap/ui/core/BusyIndicator","sap/m/MessageToast","nz/co/siliconst/ui5/metaui/ai/AIConfig"],(e,n,a)=>{e.show(0);const o=a.getProxy();o.generateSchema(s,i||undefined).then(i=>{const n=this;t.prototype.setProperty.call(this,"schemaDefinition",i,true);n._fetchingSchema=false;e.hide();this.invalidate()}).catch(i=>{const a=this;r.warn("[MetaUI DynamicHost]","AI inference failed, falling back to RuleBased. Error: "+i.message,"DynamicHost");if(n)n.show("AI Inference failed, using fallback.");t.prototype.setProperty.call(this,"inferenceStrategy","RuleBased",true);a._fetchingSchema=false;e.hide();this.invalidate()})});return}}r.debug("[MetaUI DynamicHost]",`Evaluating boot. hasSchema: ${s}, hasData: ${l}`,"DynamicHost");if(s||l){if(this.getProperty("debugMode")){r.debug("[MetaUI DynamicHost]",`Booting inner host. hasSchema: ${s}, hasData: ${l}`,"DynamicHost")}this._innerHost=new o;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"){r.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(e)}`,"","DynamicHost")}this._innerHost.setProperty(i,e)}else if(i==="schemaDefinitions"){r.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")){r.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")){r.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,s){if(!this._innerHost){this.onBeforeRendering()}this._innerHost?.openInDialog(e,i,n,a,s)},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 u});
2
2
  //# sourceMappingURL=DynamicHost.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicHost.js","names":["GeneratorHost","_interopRequireDefault","__GeneratorHost","Logger","___utils_Logger","ODataDelegate","___host_delegates_ODataDelegate","SchemaBuilderRegistry","___core_SchemaBuilderRegistry","DynamicHost","Control","extend","constructor","prototype","apply","this","arguments","odataDelegate","_innerHost","_initializedInner","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","schemaDefinitions","schemaTarget","data","bindable","dataJson","liveUpdate","isValid","useMessageManager","modelName","debugMode","editable","inferenceStrategy","aggregations","_content","multiple","visibility","events","beforeSubmit","parameters","payload","addError","preventDefault","submit","payloadJson","cancel","fieldChange","fieldPath","value","validationStateChanged","validationError","message","validationSuccess","error","exception","initODataDelegate","_initODataDelegate","getBindingInfo","dataBinding","path","oContext","getBindingContext","debug","getPath","requestObject","syncToEngine","Object","keys","setBindingContext","_setBindingContext","sModelName","Control.prototype.setBindingContext.call","bindElement","_bindElement","vPath","mParameters","Control.prototype.bindElement.call","model","undefined","oBinding","getElementBinding","attachChange","onBeforeRendering","_onBeforeRendering","schemaRaw","getProperty","startsWith","self","_fetchingSchema","sap","ui","require","BusyIndicator","MessageToast","show","fetch","then","res","ok","Error","status","json","plugin","getBuilderFor","finalSchema","build","Control.prototype.setProperty.call","definitions","hide","invalidate","catch","err","warn","schema","trim","JSON","parse","e","hasSchema","length","hasData","rawDataObj","trace","AIConfig","proxy","getProxy","generateSchema","generatedSchema","props","getMetadata","getProperties","propName","val","Control.prototype.getProperty.call","setProperty","setAggregation","getEvents","eventName","attachEvent","oEvent","params","getParameters","isLive","str","stringify","handleFieldChange","fireEvent","_setProperty","propertyName","suppressInvalidate","openInDialog","_openInDialog","title","submitButtonText","cancelButtonText","dialogWidth","parentView","triggerSubmit","_triggerSubmit","addCustomError","_addCustomError","inner","clearCustomError","_clearCustomError","_getProperty"],"sources":["DynamicHost.ts"],"sourcesContent":["import Control from \"sap/ui/core/Control\";\nimport RenderManager from \"sap/ui/core/RenderManager\";\nimport GeneratorHost from \"./host/GeneratorHost\";\nimport { Logger } from \"../utils/Logger\";\nimport { ODataDelegate } from \"./host/delegates/ODataDelegate\";\nimport ODataV4Context from \"sap/ui/model/odata/v4/Context\";\nimport { SchemaBuilderRegistry } from \"../core/SchemaBuilderRegistry\";\n\n/**\n * A transparent wrapper control (Facade) that automatically chooses between Explicit Schema Mode \n * and Inference Mode based on the presence of a 'schemaDefinition'.\n * \n * This maintains total architectural separation of the modes without forcing developers to \n * use different XML tags.\n * \n * @namespace nz.co.siliconst.ui5.metaui.controls\n */\nexport default class DynamicHost extends Control {\n private odataDelegate: ODataDelegate | null = null;\n\n static readonly metadata = {\n properties: {\n schemaDefinition: { type: \"any\", defaultValue: null },\n schemaDefinitions: { type: \"object\", defaultValue: null },\n schemaTarget: { type: \"string\", defaultValue: null },\n data: { type: \"object\", defaultValue: null, bindable: \"bindable\" },\n dataJson: { type: \"string\", defaultValue: null, bindable: \"bindable\" },\n liveUpdate: { type: \"boolean\", defaultValue: false },\n isValid: { type: \"boolean\", defaultValue: true },\n useMessageManager: { type: \"boolean\", defaultValue: false },\n modelName: { type: \"string\", defaultValue: \"meta\" },\n debugMode: { type: \"boolean\", defaultValue: false },\n editable: { type: \"boolean\", defaultValue: true },\n inferenceStrategy: { type: \"string\", defaultValue: \"RuleBased\" }\n },\n aggregations: {\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\n },\n events: {\n beforeSubmit: {\n parameters: {\n payload: { type: \"object\" },\n addError: { type: \"function\" },\n preventDefault: { type: \"function\" }\n }\n },\n submit: {\n parameters: {\n payload: { type: \"object\" },\n payloadJson: { type: \"string\" }\n }\n },\n cancel: {},\n fieldChange: {\n parameters: {\n fieldPath: { type: \"string\" },\n value: { type: \"any\" },\n payload: { type: \"object\" },\n isValid: { type: \"boolean\" }\n }\n },\n validationStateChanged: { parameters: { isValid: { type: \"boolean\" } } },\n validationError: { parameters: { fieldPath: { type: \"string\" }, message: { type: \"string\" } } },\n validationSuccess: { parameters: { fieldPath: { type: \"string\" } } },\n error: { parameters: { message: { type: \"string\" }, exception: { type: \"object\" } } }\n }\n };\n\n static renderer = {\n apiVersion: 2,\n render(rm: RenderManager, control: DynamicHost) {\n rm.openStart(\"div\", control);\n rm.style(\"width\", \"100%\");\n rm.style(\"height\", \"100%\");\n rm.openEnd();\n\n const content = control.getAggregation(\"_content\") as Control;\n if (content) {\n rm.renderControl(content);\n }\n\n rm.close(\"div\");\n }\n };\n\n /**\n * Internal reference to the generated inner host instance.\n * @private\n */\n private _innerHost: GeneratorHost | null = null;\n\n /**\n * Flag indicating if the inner host has been initialized.\n * @private\n */\n private _initializedInner: boolean = false;\n\n /**\n * Initializes the OData Delegate if an OData context is detected.\n * This allows DynamicHost to seamlessly synchronize metadata and properties from an OData model.\n * @private\n */\n private initODataDelegate(): void {\n if (!this.odataDelegate) {\n // Guard: If the user explicitly bound dataJson, do not steal the context.\n if (this.getBindingInfo(\"dataJson\")) {\n return;\n }\n\n // Guard: If the user explicitly bound 'data' to a specific property path, do not steal the context.\n const dataBinding = this.getBindingInfo(\"data\") as any;\n if (dataBinding && dataBinding.path && dataBinding.path !== \"\") {\n return;\n }\n\n const oContext = this.getBindingContext(\"odata\") || this.getBindingContext();\n if (oContext) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context found for delegate initialization: ${oContext.getPath()}`, \"DynamicHost\");\n if (oContext && (oContext as ODataV4Context).requestObject && typeof (oContext as ODataV4Context).requestObject === \"function\") {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context supports requestObject/getObject. Instantiating ODataDelegate.`, \"DynamicHost\");\n this.odataDelegate = new ODataDelegate(this, oContext as ODataV4Context);\n this.odataDelegate.syncToEngine();\n } else {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context does NOT support requestObject/getObject! Keys: ${Object.keys(oContext)}`, \"DynamicHost\");\n }\n }\n }\n }\n\n /**\n * Standard UI5 method override.\n * Sets the binding context for the control and attempts to initialize the OData delegate\n * if the context points to an OData model.\n * \n * @param {sap.ui.model.Context | null | undefined} oContext The binding context object\n * @param {string} [sModelName] Optional model name\n * @returns {this} The control instance for chaining\n */\n public setBindingContext(oContext: sap.ui.model.Context | null | undefined, sModelName?: string): this {\n super.setBindingContext(oContext, sModelName);\n this.initODataDelegate();\n return this;\n }\n\n /**\n * Standard UI5 method override.\n * Binds the element to the given path and attaches a change listener to re-evaluate\n * the OData delegate when the element binding resolves.\n * \n * @param {string | Record<string, unknown>} vPath The binding path or configuration object\n * @param {object} [mParameters] Optional mapping parameters\n * @returns {this} Reference to this instance for chaining\n */\n public bindElement(vPath: string | Record<string, unknown>, mParameters?: object): this {\n super.bindElement(vPath, mParameters);\n const sModelName = typeof vPath === \"object\" ? vPath.model : undefined;\n const oBinding = this.getElementBinding(sModelName);\n if (oBinding) {\n oBinding.attachChange(() => {\n this.initODataDelegate();\n });\n }\n return this;\n }\n\n /**\n * Standard UI5 Lifecycle Hook.\n * Evaluates the initial properties and spawns the GeneratorHost.\n * It handles the complex lifecycle task of copying all bindings, raw properties, and event listeners \n * down to the inner host perfectly transparently.\n */\n public onBeforeRendering(): void {\n Logger.debug(\"[MetaUI DynamicHost]\", `onBeforeRendering called. _initializedInner: ${this._initializedInner}`, \"DynamicHost\");\n\n this.initODataDelegate();\n\n if (!this._initializedInner) {\n let schemaRaw = this.getProperty(\"schemaDefinition\");\n\n // 1. URL Detection & Fetching\n if (typeof schemaRaw === \"string\" && (schemaRaw.startsWith(\"http://\") || schemaRaw.startsWith(\"https://\"))) {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n \n sap.ui.require([\"sap/ui/core/BusyIndicator\", \"sap/m/MessageToast\"], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }) => {\n BusyIndicator.show(0);\n fetch(schemaRaw as string)\n .then(res => {\n if (!res.ok) throw new Error(\"HTTP \" + res.status);\n return res.json();\n })\n .then(json => {\n const plugin = SchemaBuilderRegistry.getBuilderFor(json);\n const finalSchema = plugin ? plugin.build(json, this.getProperty(\"schemaTarget\")) : json;\n super.setProperty(\"schemaDefinition\", finalSchema, true);\n if (finalSchema.definitions) {\n super.setProperty(\"schemaDefinitions\", finalSchema.definitions, true);\n }\n const self = this as unknown as { _fetchingSchema?: boolean };\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with resolved schema\n })\n .catch(err => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"Failed to fetch remote schema: \" + err, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"Failed to fetch remote schema\");\n super.setProperty(\"schemaDefinition\", null, true); // Fallback to full inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate();\n });\n });\n return; // Abort this render cycle until fetch completes\n }\n\n // 2. Local Plugin Detection (Stringified JSON or Raw Object)\n let schema = schemaRaw;\n if (schema && typeof schema === \"string\" && (schema as string).trim().startsWith(\"{\")) {\n try {\n schema = JSON.parse(schema);\n } catch (e) {\n // Ignore, let standard validation catch it\n }\n }\n\n if (schema && typeof schema === \"object\") {\n const plugin = SchemaBuilderRegistry.getBuilderFor(schema);\n if (plugin) {\n schema = plugin.build(schema, this.getProperty(\"schemaTarget\"));\n // Silently update the wrapper property so the inner host gets the final parsed MetaUI format\n super.setProperty(\"schemaDefinition\", schema, true);\n if (schema.definitions) {\n super.setProperty(\"schemaDefinitions\", schema.definitions, true);\n }\n }\n }\n\n const dataJson = this.getProperty(\"dataJson\");\n const data = this.getProperty(\"data\");\n\n let hasSchema = !!schema;\n if (hasSchema && typeof schema === \"object\" && Object.keys(schema).length === 0) {\n hasSchema = false; // Treat empty object as no schema\n }\n\n const hasData = !!dataJson || !!data;\n\n // 3. AI Schema Inference Detection\n if (hasData && this.getProperty(\"inferenceStrategy\") === \"AI\") {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n\n let rawDataObj = data;\n if (!rawDataObj && dataJson) {\n try { rawDataObj = JSON.parse(dataJson as string); } catch(e: Error) { Logger.trace(\"[DynamicHost] Ignored invalid dataJson parse: \" + e.message); }\n }\n\n if (rawDataObj) {\n sap.ui.require([\n \"sap/ui/core/BusyIndicator\", \n \"sap/m/MessageToast\",\n \"nz/co/siliconst/ui5/metaui/ai/AIConfig\"\n ], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }, AIConfig: { getProxy: () => { generateSchema: (d: unknown, s?: unknown) => Promise<unknown> } }) => {\n BusyIndicator.show(0);\n const proxy = AIConfig.getProxy();\n \n proxy.generateSchema(rawDataObj, schema || undefined)\n .then((generatedSchema: unknown) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n super.setProperty(\"schemaDefinition\", generatedSchema, true);\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with the new schema\n })\n .catch((err: Error) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"AI inference failed, falling back to RuleBased. Error: \" + err.message, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"AI Inference failed, using fallback.\");\n super.setProperty(\"inferenceStrategy\", \"RuleBased\", true); // Fallback to normal inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); \n });\n });\n return; // Abort render cycle until AI is done\n }\n }\n\n Logger.debug(\"[MetaUI DynamicHost]\", `Evaluating boot. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n\n // Only boot if we have either a schema or some data to infer from\n if (hasSchema || hasData) {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Booting inner host. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n }\n // The architectural Facade router logic:\n // We've simplified this! We no longer use HostFactory or separate subclasses.\n // GeneratorHost is fully capable of inferring the schema if none is provided.\n this._innerHost = new GeneratorHost();\n\n // 1. Forward all static values to the spawned host BEFORE mounting.\n // Since we no longer use bindProperty, it's perfectly safe to set raw properties before mounting.\n const props = this.getMetadata().getProperties();\n for (const propName in props) {\n if (propName === \"inferenceStrategy\") continue;\n const val = super.getProperty(propName);\n if (val !== null && val !== undefined) {\n if (propName === \"schemaDefinitions\") {\n Logger.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(val)}`, \"\", \"DynamicHost\");\n }\n this._innerHost.setProperty(propName, val);\n } else if (propName === \"schemaDefinitions\") {\n Logger.warn(`[MetaUI DynamicHost] Warning: schemaDefinitions is null/undefined in Wrapper. Defaulting to empty object in GeneratorHost.`, \"\", \"DynamicHost\");\n }\n }\n\n // 2. Mount so it inherits models and triggers lifecycle.\n this.setAggregation(\"_content\", this._innerHost);\n\n // 3. Forward all event subscriptions.\n // By proxying the events upwards, the developer can subscribe to `<meta:DynamicHost submit=\"...\">` \n // and perfectly receive the inner host's submission event.\n const events = this.getMetadata().getEvents();\n for (const eventName in events) {\n this._innerHost.attachEvent(eventName, (oEvent: sap.ui.base.Event) => {\n // Natively push updated payload out to any bound Fiori Element properties.\n // Using super.setProperty prevents an infinite loop back down to _innerHost.\n if (eventName === \"submit\" || eventName === \"fieldChange\") {\n const params = oEvent.getParameters();\n if (params.payload) {\n const isLive = this.getProperty(\"liveUpdate\") === true;\n if (eventName === \"submit\" || isLive) {\n super.setProperty(\"data\", params.payload, true);\n\n const str = params.payloadJson || JSON.stringify(params.payload, null, 2);\n super.setProperty(\"dataJson\", str, true);\n }\n }\n if (eventName === \"fieldChange\" && this.odataDelegate) {\n this.odataDelegate.handleFieldChange(params.fieldPath, params.value);\n }\n }\n this.fireEvent(eventName, oEvent.getParameters());\n });\n }\n\n this._initializedInner = true;\n }\n }\n }\n\n /**\n * Overrides standard UI5 setProperty to act as a transparent proxy.\n * When a property is updated on the wrapper (either programmatically or via a binding update),\n * it instantly mirrors that value down to the inner instantiated host.\n */\n public setProperty(propertyName: string, value: unknown, suppressInvalidate?: boolean): this {\n if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Wrapper received setProperty: ${propertyName}`, \"DynamicHost\");\n }\n }\n super.setProperty(propertyName, value, suppressInvalidate);\n if (this._innerHost && propertyName !== \"inferenceStrategy\") {\n this._innerHost.setProperty(propertyName, value, suppressInvalidate);\n } else if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `_innerHost not yet initialized when ${propertyName} was set. Booting will happen on next render.`, \"DynamicHost\");\n }\n }\n return this;\n }\n\n\n\n\n\n /**\n * Programmatic API support. Routes dialog commands down to the spawned inner host.\n * If the inner host has not booted yet, it forces initialization immediately.\n * \n * @param {string} [title=\"Form\"] The title of the dialog\n * @param {string} [submitButtonText=\"OK\"] The text for the primary action button\n * @param {string} [cancelButtonText=\"Cancel\"] The text for the cancel button\n * @param {string} [dialogWidth=\"auto\"] The width of the dialog\n * @param {sap.ui.core.Control} [parentView] The parent view to attach the dialog to for model inheritance.\n */\n public openInDialog(title?: string, submitButtonText?: string, cancelButtonText?: string, dialogWidth?: string, parentView?: Control): void {\n if (!this._innerHost) {\n this.onBeforeRendering(); // Force init if they bypassed UI5 rendering\n }\n this._innerHost?.openInDialog(title, submitButtonText, cancelButtonText, dialogWidth, parentView);\n }\n\n /**\n * Proxies submission triggering down to the instantiated generator host.\n * Evaluates the internal Engine validation suite and returns true if structurally sound.\n * \n * @returns {boolean} True if the internal payload passes schema validation, false otherwise.\n */\n public triggerSubmit(): boolean {\n if (!this._innerHost) {\n return false;\n }\n return this._innerHost.triggerSubmit();\n }\n\n /**\n * Injects a custom error message onto a specific field.\n * Useful for injecting custom backend validation errors.\n * \n * @param {string} fieldPath The schema key path to target.\n * @param {string} message The custom error message to display.\n */\n public addCustomError(fieldPath: string, message: string): void {\n const inner = this._innerHost as unknown as { addCustomError?: (p: string, m: string) => void };\n if (inner && typeof inner.addCustomError === \"function\") {\n inner.addCustomError(fieldPath, message);\n }\n }\n\n /**\n * Clears a custom error message from a specific field.\n * \n * @param {string} fieldPath The schema key path to target.\n */\n public clearCustomError(fieldPath: string): void {\n const inner = this._innerHost as unknown as { clearCustomError?: (p: string) => void };\n if (inner && typeof inner.clearCustomError === \"function\") {\n inner.clearCustomError(fieldPath);\n }\n }\n\n /**\n * Overrides standard UI5 getProperty to transparently pull extracted data from the inner host.\n * Ensures that querying the DynamicHost facade for `data` always yields the freshest payload.\n * \n * @param {string} propertyName The name of the property to retrieve\n * @returns {unknown} The property value\n */\n public getProperty(propertyName: string): unknown {\n if (propertyName === \"outputData\") {\n propertyName = \"data\"; // Forward deprecated outputData to data\n }\n if (this._innerHost && (propertyName === \"data\" || propertyName === \"dataJson\")) {\n return this._innerHost.getProperty(propertyName);\n }\n return super.getProperty(propertyName);\n }\n}\n"],"mappings":"wQAEOA,EAAaC,EAAAC,GAAA,MACXC,EAAMC,EAAA,gBACNC,EAAaC,EAAA,uBAEbC,EAAqBC,EAAA,yBAE9B,MASqBC,EAAoB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AAM8G,EAAQlK,KAAKG,WACnB,GAAI+J,UAAgBA,EAAMF,iBAAmB,WAAY,CACrDE,EAAMF,eAAehH,EAAWI,EACpC,CACJ,EAOO+G,iBAAgB,SAAAC,EAACpH,GACpB,MAAMkH,EAAQlK,KAAKG,WACnB,GAAI+J,UAAgBA,EAAMC,mBAAqB,WAAY,CACvDD,EAAMC,iBAAiBnH,EAC3B,CACJ,EASOsC,YAAW,SAAA+E,EAAChB,GACf,GAAIA,IAAiB,aAAc,CAC/BA,EAAe,MACnB,CACA,GAAIrJ,KAAKG,aAAekJ,IAAiB,QAAUA,IAAiB,YAAa,CAC7E,OAAOrJ,KAAKG,WAAWmF,YAAY+D,EACvC,CACA,OAAAf,6BAAAtI,KAAyBqJ,EAC7B,IAAC,OAlbgB3J,CAAW","ignoreList":[]}
1
+ {"version":3,"file":"DynamicHost.js","names":["GeneratorHost","_interopRequireDefault","__GeneratorHost","Logger","___utils_Logger","ODataDelegate","___host_delegates_ODataDelegate","SchemaBuilderRegistry","___core_SchemaBuilderRegistry","DynamicHost","Control","extend","constructor","prototype","apply","this","arguments","odataDelegate","_innerHost","_initializedInner","renderer","apiVersion","render","rm","control","openStart","style","openEnd","content","getAggregation","renderControl","close","metadata","properties","schemaDefinition","type","defaultValue","schemaDefinitions","schemaTarget","pluginRegistry","schemaBuilderRegistry","data","bindable","dataJson","liveUpdate","isValid","useMessageManager","modelName","debugMode","editable","inferenceStrategy","aggregations","_content","multiple","visibility","events","beforeSubmit","parameters","payload","addError","preventDefault","submit","payloadJson","cancel","fieldChange","fieldPath","value","validationStateChanged","validationError","message","validationSuccess","error","exception","initODataDelegate","_initODataDelegate","getBindingInfo","dataBinding","path","oContext","getBindingContext","debug","getPath","requestObject","syncToEngine","Object","keys","setBindingContext","_setBindingContext","sModelName","Control.prototype.setBindingContext.call","bindElement","_bindElement","vPath","mParameters","Control.prototype.bindElement.call","model","undefined","oBinding","getElementBinding","attachChange","onBeforeRendering","_onBeforeRendering","schemaRaw","getProperty","startsWith","self","_fetchingSchema","sap","ui","require","BusyIndicator","MessageToast","show","fetch","then","res","ok","Error","status","json","plugin","getBuilderFor","finalSchema","build","Control.prototype.setProperty.call","definitions","hide","invalidate","catch","err","warn","schema","trim","JSON","parse","e","hasSchema","length","hasData","rawDataObj","trace","AIConfig","proxy","getProxy","generateSchema","generatedSchema","props","getMetadata","getProperties","propName","val","Control.prototype.getProperty.call","setProperty","setAggregation","getEvents","eventName","attachEvent","oEvent","params","getParameters","isLive","str","stringify","fireEvent","_setProperty","propertyName","suppressInvalidate","openInDialog","_openInDialog","title","submitButtonText","cancelButtonText","dialogWidth","parentView","triggerSubmit","_triggerSubmit","addCustomError","_addCustomError","inner","clearCustomError","_clearCustomError","_getProperty"],"sources":["DynamicHost.ts"],"sourcesContent":["import Control from \"sap/ui/core/Control\";\nimport RenderManager from \"sap/ui/core/RenderManager\";\nimport GeneratorHost from \"./host/GeneratorHost\";\nimport { Logger } from \"../utils/Logger\";\nimport { ODataDelegate } from \"./host/delegates/ODataDelegate\";\nimport ODataV4Context from \"sap/ui/model/odata/v4/Context\";\nimport { SchemaBuilderRegistry } from \"../core/SchemaBuilderRegistry\";\n\n/**\n * A transparent wrapper control (Facade) that automatically chooses between Explicit Schema Mode \n * and Inference Mode based on the presence of a 'schemaDefinition'.\n * \n * This maintains total architectural separation of the modes without forcing developers to \n * use different XML tags.\n * \n * @namespace nz.co.siliconst.ui5.metaui.controls\n */\nexport default class DynamicHost extends Control {\n private odataDelegate: ODataDelegate | null = null;\n\n static readonly metadata = {\n properties: {\n schemaDefinition: { type: \"any\", defaultValue: null },\n schemaDefinitions: { type: \"object\", defaultValue: null },\n schemaTarget: { type: \"string\", defaultValue: null },\n pluginRegistry: { type: \"object\", defaultValue: null },\n schemaBuilderRegistry: { type: \"object\", defaultValue: null },\n data: { type: \"object\", defaultValue: null, bindable: \"bindable\" },\n dataJson: { type: \"string\", defaultValue: null, bindable: \"bindable\" },\n liveUpdate: { type: \"boolean\", defaultValue: false },\n isValid: { type: \"boolean\", defaultValue: true },\n useMessageManager: { type: \"boolean\", defaultValue: false },\n modelName: { type: \"string\", defaultValue: \"meta\" },\n debugMode: { type: \"boolean\", defaultValue: false },\n editable: { type: \"boolean\", defaultValue: true },\n inferenceStrategy: { type: \"string\", defaultValue: \"RuleBased\" }\n },\n aggregations: {\n _content: { type: \"sap.ui.core.Control\", multiple: false, visibility: \"hidden\" }\n },\n events: {\n beforeSubmit: {\n parameters: {\n payload: { type: \"object\" },\n addError: { type: \"function\" },\n preventDefault: { type: \"function\" }\n }\n },\n submit: {\n parameters: {\n payload: { type: \"object\" },\n payloadJson: { type: \"string\" }\n }\n },\n cancel: {},\n fieldChange: {\n parameters: {\n fieldPath: { type: \"string\" },\n value: { type: \"any\" },\n payload: { type: \"object\" },\n isValid: { type: \"boolean\" }\n }\n },\n validationStateChanged: { parameters: { isValid: { type: \"boolean\" } } },\n validationError: { parameters: { fieldPath: { type: \"string\" }, message: { type: \"string\" } } },\n validationSuccess: { parameters: { fieldPath: { type: \"string\" } } },\n error: { parameters: { message: { type: \"string\" }, exception: { type: \"object\" } } }\n }\n };\n\n static renderer = {\n apiVersion: 2,\n render(rm: RenderManager, control: DynamicHost) {\n rm.openStart(\"div\", control);\n rm.style(\"width\", \"100%\");\n rm.style(\"height\", \"100%\");\n rm.openEnd();\n\n const content = control.getAggregation(\"_content\") as Control;\n if (content) {\n rm.renderControl(content);\n }\n\n rm.close(\"div\");\n }\n };\n\n /**\n * Internal reference to the generated inner host instance.\n * @private\n */\n private _innerHost: GeneratorHost | null = null;\n\n /**\n * Flag indicating if the inner host has been initialized.\n * @private\n */\n private _initializedInner: boolean = false;\n\n /**\n * Initializes the OData Delegate if an OData context is detected.\n * This allows DynamicHost to seamlessly synchronize metadata and properties from an OData model.\n * @private\n */\n private initODataDelegate(): void {\n if (!this.odataDelegate) {\n // Guard: If the user explicitly bound dataJson, do not steal the context.\n if (this.getBindingInfo(\"dataJson\")) {\n return;\n }\n\n // Guard: If the user explicitly bound 'data' to a specific property path, do not steal the context.\n const dataBinding = this.getBindingInfo(\"data\") as any;\n if (dataBinding && dataBinding.path && dataBinding.path !== \"\") {\n return;\n }\n\n const oContext = this.getBindingContext(\"odata\") || this.getBindingContext();\n if (oContext) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context found for delegate initialization: ${oContext.getPath()}`, \"DynamicHost\");\n if (oContext && (oContext as ODataV4Context).requestObject && typeof (oContext as ODataV4Context).requestObject === \"function\") {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context supports requestObject/getObject. Instantiating ODataDelegate.`, \"DynamicHost\");\n this.odataDelegate = new ODataDelegate(this, oContext as ODataV4Context);\n this.odataDelegate.syncToEngine();\n } else {\n Logger.debug(\"[MetaUI DynamicHost]\", `Context does NOT support requestObject/getObject! Keys: ${Object.keys(oContext)}`, \"DynamicHost\");\n }\n }\n }\n }\n\n /**\n * Standard UI5 method override.\n * Sets the binding context for the control and attempts to initialize the OData delegate\n * if the context points to an OData model.\n * \n * @param {sap.ui.model.Context | null | undefined} oContext The binding context object\n * @param {string} [sModelName] Optional model name\n * @returns {this} The control instance for chaining\n */\n public setBindingContext(oContext: sap.ui.model.Context | null | undefined, sModelName?: string): this {\n super.setBindingContext(oContext, sModelName);\n this.initODataDelegate();\n return this;\n }\n\n /**\n * Standard UI5 method override.\n * Binds the element to the given path and attaches a change listener to re-evaluate\n * the OData delegate when the element binding resolves.\n * \n * @param {string | Record<string, unknown>} vPath The binding path or configuration object\n * @param {object} [mParameters] Optional mapping parameters\n * @returns {this} Reference to this instance for chaining\n */\n public bindElement(vPath: string | Record<string, unknown>, mParameters?: object): this {\n super.bindElement(vPath, mParameters);\n const sModelName = typeof vPath === \"object\" ? vPath.model : undefined;\n const oBinding = this.getElementBinding(sModelName);\n if (oBinding) {\n oBinding.attachChange(() => {\n this.initODataDelegate();\n });\n }\n return this;\n }\n\n /**\n * Standard UI5 Lifecycle Hook.\n * Evaluates the initial properties and spawns the GeneratorHost.\n * It handles the complex lifecycle task of copying all bindings, raw properties, and event listeners \n * down to the inner host perfectly transparently.\n */\n public onBeforeRendering(): void {\n Logger.debug(\"[MetaUI DynamicHost]\", `onBeforeRendering called. _initializedInner: ${this._initializedInner}`, \"DynamicHost\");\n\n this.initODataDelegate();\n\n if (!this._initializedInner) {\n let schemaRaw = this.getProperty(\"schemaDefinition\");\n\n // 1. URL Detection & Fetching\n if (typeof schemaRaw === \"string\" && (schemaRaw.startsWith(\"http://\") || schemaRaw.startsWith(\"https://\"))) {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n \n sap.ui.require([\"sap/ui/core/BusyIndicator\", \"sap/m/MessageToast\"], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }) => {\n BusyIndicator.show(0);\n fetch(schemaRaw as string)\n .then(res => {\n if (!res.ok) throw new Error(\"HTTP \" + res.status);\n return res.json();\n })\n .then(json => {\n const plugin = SchemaBuilderRegistry.getBuilderFor(json);\n const finalSchema = plugin ? plugin.build(json, this.getProperty(\"schemaTarget\")) : json;\n super.setProperty(\"schemaDefinition\", finalSchema, true);\n if (finalSchema.definitions) {\n super.setProperty(\"schemaDefinitions\", finalSchema.definitions, true);\n }\n const self = this as unknown as { _fetchingSchema?: boolean };\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with resolved schema\n })\n .catch(err => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"Failed to fetch remote schema: \" + err, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"Failed to fetch remote schema\");\n super.setProperty(\"schemaDefinition\", null, true); // Fallback to full inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate();\n });\n });\n return; // Abort this render cycle until fetch completes\n }\n\n // 2. Local Plugin Detection (Stringified JSON or Raw Object)\n let schema = schemaRaw;\n if (schema && typeof schema === \"string\" && (schema as string).trim().startsWith(\"{\")) {\n try {\n schema = JSON.parse(schema);\n } catch (e) {\n // Ignore, let standard validation catch it\n }\n }\n\n if (schema && typeof schema === \"object\") {\n const plugin = SchemaBuilderRegistry.getBuilderFor(schema);\n if (plugin) {\n schema = plugin.build(schema, this.getProperty(\"schemaTarget\"));\n // Silently update the wrapper property so the inner host gets the final parsed MetaUI format\n super.setProperty(\"schemaDefinition\", schema, true);\n if (schema.definitions) {\n super.setProperty(\"schemaDefinitions\", schema.definitions, true);\n }\n }\n }\n\n const dataJson = this.getProperty(\"dataJson\");\n const data = this.getProperty(\"data\");\n\n let hasSchema = !!schema;\n if (hasSchema && typeof schema === \"object\" && Object.keys(schema).length === 0) {\n hasSchema = false; // Treat empty object as no schema\n }\n\n const hasData = !!dataJson || !!data;\n\n // 3. AI Schema Inference Detection\n if (hasData && this.getProperty(\"inferenceStrategy\") === \"AI\") {\n const self = this as unknown as { _fetchingSchema?: boolean };\n if (self._fetchingSchema) return; // Prevent re-entry\n self._fetchingSchema = true;\n\n let rawDataObj = data;\n if (!rawDataObj && dataJson) {\n try { rawDataObj = JSON.parse(dataJson as string); } catch(e: Error) { Logger.trace(\"[DynamicHost] Ignored invalid dataJson parse: \" + e.message); }\n }\n\n if (rawDataObj) {\n sap.ui.require([\n \"sap/ui/core/BusyIndicator\", \n \"sap/m/MessageToast\",\n \"nz/co/siliconst/ui5/metaui/ai/AIConfig\"\n ], (BusyIndicator: { show: (n: number) => void, hide: () => void }, MessageToast: { show: (s: string) => void }, AIConfig: { getProxy: () => { generateSchema: (d: unknown, s?: unknown) => Promise<unknown> } }) => {\n BusyIndicator.show(0);\n const proxy = AIConfig.getProxy();\n \n proxy.generateSchema(rawDataObj, schema || undefined)\n .then((generatedSchema: unknown) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n super.setProperty(\"schemaDefinition\", generatedSchema, true);\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); // Force re-render with the new schema\n })\n .catch((err: Error) => {\n const self = this as unknown as { _fetchingSchema?: boolean };\n Logger.warn(\"[MetaUI DynamicHost]\", \"AI inference failed, falling back to RuleBased. Error: \" + err.message, \"DynamicHost\");\n if (MessageToast) MessageToast.show(\"AI Inference failed, using fallback.\");\n super.setProperty(\"inferenceStrategy\", \"RuleBased\", true); // Fallback to normal inference\n self._fetchingSchema = false;\n BusyIndicator.hide();\n this.invalidate(); \n });\n });\n return; // Abort render cycle until AI is done\n }\n }\n\n Logger.debug(\"[MetaUI DynamicHost]\", `Evaluating boot. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n\n // Only boot if we have either a schema or some data to infer from\n if (hasSchema || hasData) {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Booting inner host. hasSchema: ${hasSchema}, hasData: ${hasData}`, \"DynamicHost\");\n }\n // The architectural Facade router logic:\n // We've simplified this! We no longer use HostFactory or separate subclasses.\n // GeneratorHost is fully capable of inferring the schema if none is provided.\n this._innerHost = new GeneratorHost();\n\n // 1. Forward all static values to the spawned host BEFORE mounting.\n // Since we no longer use bindProperty, it's perfectly safe to set raw properties before mounting.\n const props = this.getMetadata().getProperties();\n for (const propName in props) {\n if (propName === \"inferenceStrategy\") continue;\n const val = super.getProperty(propName);\n if (val !== null && val !== undefined) {\n if (propName === \"schemaDefinitions\") {\n Logger.debug(`[MetaUI DynamicHost] Proxying schemaDefinitions: ${Object.keys(val)}`, \"\", \"DynamicHost\");\n }\n this._innerHost.setProperty(propName, val);\n } else if (propName === \"schemaDefinitions\") {\n Logger.warn(`[MetaUI DynamicHost] Warning: schemaDefinitions is null/undefined in Wrapper. Defaulting to empty object in GeneratorHost.`, \"\", \"DynamicHost\");\n }\n }\n\n // 2. Mount so it inherits models and triggers lifecycle.\n this.setAggregation(\"_content\", this._innerHost);\n\n // 3. Forward all event subscriptions.\n // By proxying the events upwards, the developer can subscribe to `<meta:DynamicHost submit=\"...\">` \n // and perfectly receive the inner host's submission event.\n const events = this.getMetadata().getEvents();\n for (const eventName in events) {\n this._innerHost.attachEvent(eventName, (oEvent: sap.ui.base.Event) => {\n // Natively push updated payload out to any bound Fiori Element properties.\n // Using super.setProperty prevents an infinite loop back down to _innerHost.\n if (eventName === \"submit\" || eventName === \"fieldChange\") {\n const params = oEvent.getParameters();\n if (params.payload) {\n const isLive = this.getProperty(\"liveUpdate\") === true;\n if (eventName === \"submit\" || isLive) {\n super.setProperty(\"data\", params.payload, true);\n\n const str = params.payloadJson || JSON.stringify(params.payload, null, 2);\n super.setProperty(\"dataJson\", str, true);\n }\n }\n }\n this.fireEvent(eventName, oEvent.getParameters());\n });\n }\n\n this._initializedInner = true;\n }\n }\n }\n\n /**\n * Overrides standard UI5 setProperty to act as a transparent proxy.\n * When a property is updated on the wrapper (either programmatically or via a binding update),\n * it instantly mirrors that value down to the inner instantiated host.\n */\n public setProperty(propertyName: string, value: unknown, suppressInvalidate?: boolean): this {\n if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `Wrapper received setProperty: ${propertyName}`, \"DynamicHost\");\n }\n }\n super.setProperty(propertyName, value, suppressInvalidate);\n if (this._innerHost && propertyName !== \"inferenceStrategy\") {\n this._innerHost.setProperty(propertyName, value, suppressInvalidate);\n } else if (propertyName === \"data\" || propertyName === \"dataJson\" || propertyName === \"schemaDefinition\" || propertyName === \"schemaDefinitions\") {\n if (this.getProperty(\"debugMode\")) {\n Logger.debug(\"[MetaUI DynamicHost]\", `_innerHost not yet initialized when ${propertyName} was set. Booting will happen on next render.`, \"DynamicHost\");\n }\n }\n return this;\n }\n\n\n\n\n\n /**\n * Programmatic API support. Routes dialog commands down to the spawned inner host.\n * If the inner host has not booted yet, it forces initialization immediately.\n * \n * @param {string} [title=\"Form\"] The title of the dialog\n * @param {string} [submitButtonText=\"OK\"] The text for the primary action button\n * @param {string} [cancelButtonText=\"Cancel\"] The text for the cancel button\n * @param {string} [dialogWidth=\"auto\"] The width of the dialog\n * @param {sap.ui.core.Control} [parentView] The parent view to attach the dialog to for model inheritance.\n */\n public openInDialog(title?: string, submitButtonText?: string, cancelButtonText?: string, dialogWidth?: string, parentView?: Control): void {\n if (!this._innerHost) {\n this.onBeforeRendering(); // Force init if they bypassed UI5 rendering\n }\n this._innerHost?.openInDialog(title, submitButtonText, cancelButtonText, dialogWidth, parentView);\n }\n\n /**\n * Proxies submission triggering down to the instantiated generator host.\n * Evaluates the internal Engine validation suite and returns true if structurally sound.\n * \n * @returns {boolean} True if the internal payload passes schema validation, false otherwise.\n */\n public triggerSubmit(): boolean {\n if (!this._innerHost) {\n return false;\n }\n return this._innerHost.triggerSubmit();\n }\n\n /**\n * Injects a custom error message onto a specific field.\n * Useful for injecting custom backend validation errors.\n * \n * @param {string} fieldPath The schema key path to target.\n * @param {string} message The custom error message to display.\n */\n public addCustomError(fieldPath: string, message: string): void {\n const inner = this._innerHost as unknown as { addCustomError?: (p: string, m: string) => void };\n if (inner && typeof inner.addCustomError === \"function\") {\n inner.addCustomError(fieldPath, message);\n }\n }\n\n /**\n * Clears a custom error message from a specific field.\n * \n * @param {string} fieldPath The schema key path to target.\n */\n public clearCustomError(fieldPath: string): void {\n const inner = this._innerHost as unknown as { clearCustomError?: (p: string) => void };\n if (inner && typeof inner.clearCustomError === \"function\") {\n inner.clearCustomError(fieldPath);\n }\n }\n\n /**\n * Overrides standard UI5 getProperty to transparently pull extracted data from the inner host.\n * Ensures that querying the DynamicHost facade for `data` always yields the freshest payload.\n * \n * @param {string} propertyName The name of the property to retrieve\n * @returns {unknown} The property value\n */\n public getProperty(propertyName: string): unknown {\n if (propertyName === \"outputData\") {\n propertyName = \"data\"; // Forward deprecated outputData to data\n }\n if (this._innerHost && (propertyName === \"data\" || propertyName === \"dataJson\")) {\n return this._innerHost.getProperty(propertyName);\n }\n return super.getProperty(propertyName);\n }\n}\n"],"m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AY,CAClB,OAAO,KACX,CACA,OAAOH,KAAKG,WAAW4J,eAC3B,EASOE,eAAc,SAAAC,EAAChH,EAAmBI,GACrC,MAAM6G,EAAQnK,KAAKG,WACnB,GAAIgK,UAAgBA,EAAMF,iBAAmB,WAAY,CACrDE,EAAMF,eAAe/G,EAAWI,EACpC,CACJ,EAOO8G,iBAAgB,SAAAC,EAACnH,GACpB,MAAMiH,EAAQnK,KAAKG,WACnB,GAAIgK,UAAgBA,EAAMC,mBAAqB,WAAY,CACvDD,EAAMC,iBAAiBlH,EAC3B,CACJ,EASOsC,YAAW,SAAA8E,EAAChB,GACf,GAAIA,IAAiB,aAAc,CAC/BA,EAAe,MACnB,CACA,GAAItJ,KAAKG,aAAemJ,IAAiB,QAAUA,IAAiB,YAAa,CAC7E,OAAOtJ,KAAKG,WAAWqF,YAAY8D,EACvC,CACA,OAAAd,6BAAAxI,KAAyBsJ,EAC7B,IAAC,OAjbgB5J,CAAW","ignoreList":[]}
@@ -23,6 +23,8 @@ export default class DynamicHost extends Control {
23
23
  schemaDefinition: { type: "any", defaultValue: null },
24
24
  schemaDefinitions: { type: "object", defaultValue: null },
25
25
  schemaTarget: { type: "string", defaultValue: null },
26
+ pluginRegistry: { type: "object", defaultValue: null },
27
+ schemaBuilderRegistry: { type: "object", defaultValue: null },
26
28
  data: { type: "object", defaultValue: null, bindable: "bindable" },
27
29
  dataJson: { type: "string", defaultValue: null, bindable: "bindable" },
28
30
  liveUpdate: { type: "boolean", defaultValue: false },
@@ -339,9 +341,6 @@ export default class DynamicHost extends Control {
339
341
  super.setProperty("dataJson", str, true);
340
342
  }
341
343
  }
342
- if (eventName === "fieldChange" && this.odataDelegate) {
343
- this.odataDelegate.handleFieldChange(params.fieldPath, params.value);
344
- }
345
344
  }
346
345
  this.fireEvent(eventName, oEvent.getParameters());
347
346
  });
@@ -48,6 +48,14 @@ sap.ui.define(["sap/ui/core/Control", "../../utils/Logger", "../../core/SchemaNo
48
48
  type: "string",
49
49
  defaultValue: null
50
50
  },
51
+ pluginRegistry: {
52
+ type: "object",
53
+ defaultValue: null
54
+ },
55
+ schemaBuilderRegistry: {
56
+ type: "object",
57
+ defaultValue: null
58
+ },
51
59
  data: {
52
60
  type: "object",
53
61
  defaultValue: null,
@@ -538,11 +546,12 @@ sap.ui.define(["sap/ui/core/Control", "../../utils/Logger", "../../core/SchemaNo
538
546
  }
539
547
  }
540
548
  }
541
- const pathsToLoad = PluginRegistry.getInstance().getPathsToLoad(normalizedSchema);
549
+ const activePluginRegistry = this.getProperty("pluginRegistry") || PluginRegistry.getInstance();
550
+ const pathsToLoad = activePluginRegistry.getPathsToLoad(normalizedSchema);
542
551
  const needsNetworkLoad = Array.from(pathsToLoad).some(path => !sap.ui.require(path));
543
552
  if (needsNetworkLoad) {
544
553
  this.setBusy(true);
545
- await PluginRegistry.getInstance().preloadDependencies(normalizedSchema);
554
+ await activePluginRegistry.preloadDependencies(normalizedSchema);
546
555
  this.setBusy(false);
547
556
  }
548
557
 
@@ -557,7 +566,8 @@ sap.ui.define(["sap/ui/core/Control", "../../utils/Logger", "../../core/SchemaNo
557
566
  if (!this.engine) {
558
567
  const isEditable = this.getProperty("editable") !== false;
559
568
  const useMessageManager = this.getProperty("useMessageManager") === true;
560
- this.engine = new Engine(isEditable, useMessageManager);
569
+ const activePluginRegistry = this.getProperty("pluginRegistry") || PluginRegistry.getInstance();
570
+ this.engine = new Engine(isEditable, useMessageManager, activePluginRegistry);
561
571
  this.engine.host = this;
562
572
  }
563
573
  this.generatedContent = this.engine.build(normalizedSchema, this.stateManager.getModel(), this.activeModelName, this.triggerSubmit.bind(this), this.getId(), this.onInternalFieldChange.bind(this));