@siliconst/metaui 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +40 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts +6 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +44 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js +122 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts +49 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.ts +118 -0
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js +24 -8
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.d.ts +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/DefaultLayoutGenerator.ts +26 -9
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +45 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +10 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +45 -2
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout-dbg.js +10 -6
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/CompactLayout.ts +5 -5
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +10 -6
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +5 -5
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +22 -29
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts +18 -29
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js +8 -4
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout-dbg.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.d.ts.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.js +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.js.map +1 -1
- package/src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.ts +3 -3
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +8 -7
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListItem", "sap/m/Toolbar", "sap/m/Title", "sap/m/ToolbarSpacer", "sap/m/Button", "../utils/Logger"], function (Table, Column, Text, ColumnListItem, Toolbar, Title, ToolbarSpacer, Button, ___utils_Logger) {
|
|
1
|
+
sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListItem", "sap/m/Toolbar", "sap/m/Title", "sap/m/ToolbarSpacer", "sap/m/Button", "../core/SchemaNormalizer", "../utils/Logger"], function (Table, Column, Text, ColumnListItem, Toolbar, Title, ToolbarSpacer, Button, ___core_SchemaNormalizer, ___utils_Logger) {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
const SchemaNormalizer = ___core_SchemaNormalizer["SchemaNormalizer"];
|
|
4
5
|
const Logger = ___utils_Logger["Logger"];
|
|
5
6
|
/**
|
|
6
7
|
* Layout Manager responsible for generating a responsive SAP Fiori Table.
|
|
@@ -72,30 +73,28 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
72
73
|
if (layoutElements && Array.isArray(layoutElements)) {
|
|
73
74
|
// Only render columns defined in uiLayout
|
|
74
75
|
layoutElements.forEach(element => {
|
|
75
|
-
if (element.type === "Control") {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
if (element.type === "Control" && element.scope) {
|
|
77
|
+
const {
|
|
78
|
+
meta: fieldMeta,
|
|
79
|
+
bindingPath,
|
|
80
|
+
propKey
|
|
81
|
+
} = SchemaNormalizer.resolveScope({
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: props
|
|
84
|
+
}, element.scope);
|
|
82
85
|
if (!fieldMeta) {
|
|
83
86
|
Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, "", "TableLayout");
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const column = new Column({
|
|
87
|
+
} else {
|
|
88
|
+
// The architectural boundary: Table Layout orchestrates the columns and aggregation binding,
|
|
89
|
+
// but delegates the actual cell rendering to the Engine's Field Plugins.
|
|
90
|
+
table.addColumn(new Column({
|
|
89
91
|
header: new Text({
|
|
90
92
|
text: element.label || fieldMeta.ui?.label || propKey
|
|
91
93
|
}),
|
|
92
|
-
demandPopin: !isKey,
|
|
93
|
-
minScreenWidth: isKey ? "" : "Tablet",
|
|
94
|
+
demandPopin: !fieldMeta.ui?.isKey,
|
|
95
|
+
minScreenWidth: fieldMeta.ui?.isKey ? "" : "Tablet",
|
|
94
96
|
popinDisplay: "Inline"
|
|
95
|
-
});
|
|
96
|
-
table.addColumn(column);
|
|
97
|
-
|
|
98
|
-
// Override widget if specified in the layout element
|
|
97
|
+
}));
|
|
99
98
|
const effectiveMeta = {
|
|
100
99
|
...fieldMeta
|
|
101
100
|
};
|
|
@@ -106,19 +105,13 @@ sap.ui.define(["sap/m/Table", "sap/m/Column", "sap/m/Text", "sap/m/ColumnListIte
|
|
|
106
105
|
};
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
//
|
|
110
|
-
|
|
108
|
+
// We pass the activeModel as actualModelName down. But the path must be relative to the
|
|
109
|
+
// table row binding context, so we just use the bindingPath (e.g. "id" or "header/id")
|
|
110
|
+
const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || "meta", true);
|
|
111
111
|
templateCells.push(control);
|
|
112
|
-
} catch (error) {
|
|
113
|
-
const msg = error.message;
|
|
114
|
-
Logger.error(`[MetaUI] Failed to render column ${propKey}`, msg, "TableLayout");
|
|
115
|
-
Logger.showErrorPopup(`Failed to render table column '${propKey}'.\n\nDetails: ${msg}`);
|
|
116
|
-
templateCells.push(new Text({
|
|
117
|
-
text: "Error"
|
|
118
|
-
}));
|
|
119
112
|
}
|
|
120
113
|
} else {
|
|
121
|
-
Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'
|
|
114
|
+
Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, "", "TableLayout");
|
|
122
115
|
}
|
|
123
116
|
});
|
|
124
117
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout-dbg.js","names":["Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","type","items","properties","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isDisplayMode","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","startsWith","error","propKey","replace","fieldMeta","isKey","ui","column","Column","header","Text","label","demandPopin","minScreenWidth","popinDisplay","addColumn","effectiveMeta","widget","control","generateField","push","msg","message","showErrorPopup","warn","debug","Object","keys","key","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n if (schema.type !== \"array\" || !schema.items || !schema.items.properties) {\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(engine.isDisplayMode ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: engine.isDisplayMode ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n }\n });\n\n const templateCells: Control[] = [];\n const props = schema.items.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control for Table.`, \"\", \"TableLayout\");\n return;\n }\n\n const propKey = element.scope.replace(\"#/properties/\", \"\");\n const fieldMeta = props[propKey];\n\n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n return;\n }\n\n try {\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // Use engine to generate fields natively and track validation\n const control = engine.generateField(effectiveMeta, propKey, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render column ${propKey}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render table column '${propKey}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' inside TableLayout. Only 'Control' is supported for columns.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"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,CAAC;MAEF,OAAOrF,KAAK;IAChB;EACJ;EAAC,IAAAsF,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAArG,WAAA,GAAAA,WAAA;EAAA,OAAAqG,SAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","type","items","properties","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isDisplayMode","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","error","addColumn","Column","header","Text","label","ui","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","widget","control","generateField","push","warn","debug","Object","keys","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n if (schema.type !== \"array\" || !schema.items || !schema.items.properties) {\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(engine.isDisplayMode ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: engine.isDisplayMode ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n }\n });\n\n const templateCells: Control[] = [];\n const props = schema.items.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":";;;QAkBSA,gBAAgB,GAAAC,wBAAA;EAAA,MAChBC,MAAM,GAAAC,eAAA;EAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACO,MAAMC,WAAW,CAA2B;IAC/C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACWC,MAAMA,CAACC,MAAe,EAAEC,SAAiB,EAAEC,MAAc,EAAEC,QAAqB,EAAEC,WAAmB,GAAG,GAAG,EAAW;MACzH,IAAIJ,MAAM,CAACK,IAAI,KAAK,OAAO,IAAI,CAACL,MAAM,CAACM,KAAK,IAAI,CAACN,MAAM,CAACM,KAAK,CAACC,UAAU,EAAE;QACtE,MAAM,IAAIC,KAAK,CAAC,sEAAsE,CAAC;MAC3F;MAEA,MAAMC,UAAU,GAAGT,MAAM,CAACU,KAAK,IAAI,OAAO;MAC1C,MAAMC,eAAe,GAAGV,SAAS;MACjC,MAAMW,UAAU,GAAGR,WAAW;MAE9B,MAAMS,KAAK,GAAG,IAAIC,KAAK,CAAC;QACpBC,aAAa,EAAE,IAAIC,OAAO,CAAC;UACvBC,OAA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QACrBK,iBAAiB,EAAE;MACvB,CAAC,CAAC;MAEF,OAAOrF,KAAK;IAChB;EACJ;EAAC,IAAAsF,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAArG,WAAA,GAAAA,WAAA;EAAA,OAAAqG,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAehE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"TableLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAehE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAC1C,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;IAIhE;;;;;;;OAOG;IACH,MAAa,WAAY,YAAW,cAAc;QAC9C;;;;;;;;;;WAUG;QACI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,EAAE,WAAW,GAAE,MAAY,GAAG,OAAO;KAuI/H;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/Table","sap/m/Column","sap/m/Text","sap/m/ColumnListItem","sap/m/Toolbar","sap/m/Title","sap/m/ToolbarSpacer","sap/m/Button","../utils/Logger"],function(e,t,o,
|
|
1
|
+
sap.ui.define(["sap/m/Table","sap/m/Column","sap/m/Text","sap/m/ColumnListItem","sap/m/Toolbar","sap/m/Title","sap/m/ToolbarSpacer","sap/m/Button","../core/SchemaNormalizer","../utils/Logger"],function(e,t,o,a,n,r,s,i,l,p){"use strict";const c=l["SchemaNormalizer"];const d=p["Logger"];class u{render(l,p,u,m,y="/"){if(l.type!=="array"||!l.items||!l.items.properties){throw new Error("[MetaUI] TableLayout requires an array schema with items.properties.")}const b=l.title||"Table";const g=p;const h=y;const f=new e({headerToolbar:new n({content:[new r({text:b}),new s,...u.isDisplayMode?[]:[new i({text:"Add Row",icon:"sap-icon://add",press:e=>{const t=e.getSource();const o=t.getParent().getParent();const a=o.getModel(g);const n=o.getBindingInfo("items");if(!n||!n.path)return;const r=a.getProperty(n.path);const s=Array.isArray(r)?r:[];const i=[...s,{}];a.setProperty(n.path,i)}})]]}),fixedLayout:false,mode:u.isDisplayMode?"None":"Delete",delete:e=>{const t=e.getParameter("listItem");const o=t.getBindingContext(g).getPath();const a=t.getModel(g);const n=o.split("/");const r=parseInt(n.pop()||"0",10);let s=n.join("/");if(s==="")s="/";const i=a.getProperty(s);const l=Array.isArray(i)?i:[];const p=[...l];p.splice(r,1);a.setProperty(s,p)}});const w=[];const T=l.items.properties;const L=l.uiLayout;if(L&&Array.isArray(L)){L.forEach(e=>{if(e.type==="Control"&&e.scope){const{meta:a,bindingPath:n,propKey:r}=c.resolveScope({type:"object",properties:T},e.scope);if(!a){d.error(`[MetaUI] Property '${r}' not found in schema definitions for Table.`,"","TableLayout")}else{f.addColumn(new t({header:new o({text:e.label||a.ui?.label||r}),demandPopin:!a.ui?.isKey,minScreenWidth:a.ui?.isKey?"":"Tablet",popinDisplay:"Inline"}));const s={...a};if(e.widget){s.ui={...a.ui,widget:e.widget}}const i=u.generateField(s,n,g||"meta",true);w.push(i)}}else{d.warn(`[MetaUI] Unsupported layout element type '${e.type}' in Table.`,"","TableLayout")}})}else{d.debug("[MetaUI TableLayout]","No uiLayout provided. Falling back to rendering all properties as columns.","TableLayout");Object.keys(T).forEach(e=>{try{const a=T[e];const n=!!a.ui?.isKey;const r=new t({header:new o({text:a.ui?.label||e}),demandPopin:!n,minScreenWidth:n?"":"Tablet",popinDisplay:"Inline"});f.addColumn(r);const s=u.generateField(a,e,g||"meta",true);w.push(s)}catch(t){const a=t.message;d.error(`[MetaUI] Failed to render fallback column ${e}`,a,"TableLayout");d.showErrorPopup(`Failed to render fallback table column '${e}'.\n\nDetails: ${a}`);w.push(new o({text:"Error"}))}})}const P=new a({cells:w});f.bindItems({path:h,model:g,template:P,templateShareable:false});return f}}var m={__esModule:true};m.TableLayout=u;return m});
|
|
2
2
|
//# sourceMappingURL=TableLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableLayout.js","names":["Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","type","items","properties","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isDisplayMode","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","startsWith","error","propKey","replace","fieldMeta","isKey","ui","column","Column","header","Text","label","demandPopin","minScreenWidth","popinDisplay","addColumn","effectiveMeta","widget","control","generateField","push","msg","message","showErrorPopup","warn","debug","Object","keys","key","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n if (schema.type !== \"array\" || !schema.items || !schema.items.properties) {\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(engine.isDisplayMode ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: engine.isDisplayMode ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n }\n });\n\n const templateCells: Control[] = [];\n const props = schema.items.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control for Table.`, \"\", \"TableLayout\");\n return;\n }\n\n const propKey = element.scope.replace(\"#/properties/\", \"\");\n const fieldMeta = props[propKey];\n\n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n return;\n }\n\n try {\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n // Override widget if specified in the layout element\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // Use engine to generate fields natively and track validation\n const control = engine.generateField(effectiveMeta, propKey, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render column ${propKey}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render table column '${propKey}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' inside TableLayout. Only 'Control' is supported for columns.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":"qNAkBSA,EAAMC,EAAA,UAUR,MAAMC,EAYFC,OAAOC,EAAiBC,EAAmBC,EAAgBC,EAAuBC,EAAsB,KAC3G,GAAIJ,EAAOK,OAAS,UAAYL,EAAOM,QAAUN,EAAOM,MAAMC,WAAY,CACtE,MAAM,I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AAYV,EAAMkC,GACxB,MAAMvB,IAAUD,EAAUE,IAAID,MAE9B,MAAME,EAAS,IAAIC,EAAO,CACtBC,OAAQ,IAAIC,EAAK,CAAEvD,KAAMiD,EAAUE,IAAIK,OAASiB,IAChDhB,aAAcP,EACdQ,eAAgBR,EAAQ,GAAK,SAC7BS,aAAc,WAElBjE,EAAMkE,UAAUR,GAEhB,MAAMW,EAAUhF,EAAOiF,cAAcf,EAAWwB,EAAKjF,GAAmB,OAAQ,MAChF8C,EAAc2B,KAAKF,EACvB,CAAE,MAAOjB,GACL,MAAMoB,EAAOpB,EAAgBqB,QAC7B1F,EAAOqE,MAAM,6CAA6C2B,IAAOP,EAAK,eACtEzF,EAAO2F,eAAe,2CAA2CK,mBAAqBP,KACtF5B,EAAc2B,KAAK,IAAIV,EAAK,CAAEvD,KAAM,UACxC,GAER,CAIA,MAAM0E,EAAc,IAAIC,EAAe,CACnCC,MAAOtC,IAGX5C,EAAMmF,UAAU,CACZ9D,KAAMtB,EACNkB,MAAOnB,EACPsF,SAAUJ,EACVK,kBAAmB,QAGvB,OAAOrF,CACX,EACH,IAAAsF,EAAA,CAAAC,WAAA,MAAAD,EAAArG,cAAA,OAAAqG,CAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"TableLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","TableLayout","render","schema","modelName","engine","onSubmit","bindingPath","type","items","properties","Error","tableTitle","title","actualModelName","actualPath","table","Table","headerToolbar","Toolbar","content","Title","text","ToolbarSpacer","isDisplayMode","Button","icon","press","oEvent","btn","getSource","tbl","getParent","model","getModel","info","getBindingInfo","path","rawData","getProperty","data","Array","isArray","newData","setProperty","fixedLayout","mode","delete","item","getParameter","getBindingContext","getPath","splitPaths","split","index","parseInt","pop","arrayPath","join","splice","templateCells","props","layoutElements","uiLayout","forEach","element","scope","meta","fieldMeta","propKey","resolveScope","error","addColumn","Column","header","Text","label","ui","demandPopin","isKey","minScreenWidth","popinDisplay","effectiveMeta","widget","control","generateField","push","warn","debug","Object","keys","key","column","msg","message","showErrorPopup","rowTemplate","ColumnListItem","cells","bindItems","template","templateShareable","__exports","__esModule"],"sources":["TableLayout.ts"],"sourcesContent":["/**\n * @file TableLayout.ts\n * @description Generates a responsive SAP Fiori Table layout for v2 schema.\n */\n\nimport Table from \"sap/m/Table\";\nimport Column from \"sap/m/Column\";\nimport Text from \"sap/m/Text\";\nimport ColumnListItem from \"sap/m/ColumnListItem\";\nimport Toolbar from \"sap/m/Toolbar\";\nimport Title from \"sap/m/Title\";\nimport ToolbarSpacer from \"sap/m/ToolbarSpacer\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\nimport Control from \"sap/ui/core/Control\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Table.\n * It is automatically utilized by the Engine when the schema root or property is of type 'array'.\n * Includes built-in support for adding and deleting rows via dynamic data binding manipulation.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class TableLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema array properties into a UI5 Table.\n * \n * @param schema The active JSON schema array definition.\n * @param modelName The UI5 JSONModel name used for data binding.\n * @param engine The central orchestrator for delegating column plugin generation.\n * @param onSubmit Optional submit hook.\n * @param bindingPath The JSON path representing the array within the payload.\n * @returns {Control} The generated sap.m.Table control.\n * @throws {Error} If the provided schema is not of type 'array'.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void, bindingPath: string = \"/\"): Control {\n if (schema.type !== \"array\" || !schema.items || !schema.items.properties) {\n throw new Error(\"[MetaUI] TableLayout requires an array schema with items.properties.\");\n }\n\n const tableTitle = schema.title || \"Table\";\n const actualModelName = modelName;\n const actualPath = bindingPath;\n\n const table = new Table({\n headerToolbar: new Toolbar({\n content: [\n new Title({ text: tableTitle }),\n new ToolbarSpacer(),\n ...(engine.isDisplayMode ? [] : [\n new Button({\n text: \"Add Row\",\n icon: \"sap-icon://add\",\n press: (oEvent: sap.ui.base.Event) => {\n const btn = oEvent.getSource();\n const tbl = btn.getParent().getParent() as Table;\n const model = tbl.getModel(actualModelName) as JSONModel;\n const info = tbl.getBindingInfo(\"items\");\n if (!info || !info.path) return;\n\n const rawData = model.getProperty(info.path);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data, {}];\n model.setProperty(info.path, newData);\n }\n })\n ])\n ]\n }),\n fixedLayout: false,\n mode: engine.isDisplayMode ? \"None\" : \"Delete\",\n delete: (oEvent: sap.ui.base.Event) => {\n const item = oEvent.getParameter(\"listItem\");\n const path = item.getBindingContext(actualModelName).getPath();\n const model = item.getModel(actualModelName) as JSONModel;\n\n const splitPaths = path.split(\"/\");\n const index = parseInt(splitPaths.pop() || \"0\", 10);\n let arrayPath = splitPaths.join(\"/\");\n if (arrayPath === \"\") arrayPath = \"/\";\n\n const rawData = model.getProperty(arrayPath);\n const data = Array.isArray(rawData) ? rawData : [];\n const newData = [...data];\n newData.splice(index, 1);\n model.setProperty(arrayPath, newData);\n }\n });\n\n const templateCells: Control[] = [];\n const props = schema.items.properties;\n const layoutElements = schema.uiLayout;\n\n if (layoutElements && Array.isArray(layoutElements)) {\n // Only render columns defined in uiLayout\n layoutElements.forEach((element: ILayoutElement) => {\n if (element.type === \"Control\" && element.scope) {\n const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(\n { type: \"object\", properties: props } as ISchema, \n element.scope\n );\n \n if (!fieldMeta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, \"\", \"TableLayout\");\n } else {\n // The architectural boundary: Table Layout orchestrates the columns and aggregation binding,\n // but delegates the actual cell rendering to the Engine's Field Plugins.\n table.addColumn(new Column({\n header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),\n demandPopin: !fieldMeta.ui?.isKey,\n minScreenWidth: fieldMeta.ui?.isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n }));\n\n const effectiveMeta = { ...fieldMeta };\n if (element.widget) {\n effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };\n }\n\n // We pass the activeModel as actualModelName down. But the path must be relative to the \n // table row binding context, so we just use the bindingPath (e.g. \"id\" or \"header/id\")\n const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || \"meta\", true);\n templateCells.push(control);\n }\n } else {\n Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, \"\", \"TableLayout\");\n }\n });\n } else {\n Logger.debug(\"[MetaUI TableLayout]\", \"No uiLayout provided. Falling back to rendering all properties as columns.\", \"TableLayout\");\n // Fallback: If no uiLayout is provided, render all properties as columns\n Object.keys(props).forEach((key) => {\n try {\n const fieldMeta = props[key];\n const isKey = !!fieldMeta.ui?.isKey;\n\n const column = new Column({\n header: new Text({ text: fieldMeta.ui?.label || key }),\n demandPopin: !isKey,\n minScreenWidth: isKey ? \"\" : \"Tablet\",\n popinDisplay: \"Inline\"\n });\n table.addColumn(column);\n\n const control = engine.generateField(fieldMeta, key, actualModelName || \"meta\", true);\n templateCells.push(control);\n } catch (error) {\n const msg = (error as Error).message;\n Logger.error(`[MetaUI] Failed to render fallback column ${key}`, msg, \"TableLayout\");\n Logger.showErrorPopup(`Failed to render fallback table column '${key}'.\\n\\nDetails: ${msg}`);\n templateCells.push(new Text({ text: \"Error\" }));\n }\n });\n }\n\n\n\n const rowTemplate = new ColumnListItem({\n cells: templateCells\n });\n\n table.bindItems({\n path: actualPath,\n model: actualModelName,\n template: rowTemplate,\n templateShareable: false\n });\n\n return table;\n }\n}\n"],"mappings":"kPAkBSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,UAUR,MAAMC,EAYFC,OAAOC,EAAiBC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AAQ,GAAK,SAC7BE,aAAc,WAElBjE,EAAMwD,UAAUoB,GAEhB,MAAMR,EAAU/E,EAAOgF,cAAcjB,EAAWuB,EAAK7E,GAAmB,OAAQ,MAChF8C,EAAc0B,KAAKF,EACvB,CAAE,MAAOb,GACL,MAAMsB,EAAOtB,EAAgBuB,QAC7B/F,EAAOwE,MAAM,6CAA6CoB,IAAOE,EAAK,eACtE9F,EAAOgG,eAAe,2CAA2CJ,mBAAqBE,KACtFjC,EAAc0B,KAAK,IAAIX,EAAK,CAAErD,KAAM,UACxC,GAER,CAIA,MAAM0E,EAAc,IAAIC,EAAe,CACnCC,MAAOtC,IAGX5C,EAAMmF,UAAU,CACZ9D,KAAMtB,EACNkB,MAAOnB,EACPsF,SAAUJ,EACVK,kBAAmB,QAGvB,OAAOrF,CACX,EACH,IAAAsF,EAAA,CAAAC,WAAA,MAAAD,EAAArG,cAAA,OAAAqG,CAAA","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ import Control from "sap/ui/core/Control";
|
|
|
16
16
|
import { IPropertyMetadata, ISchema, ILayoutElement } from "../interfaces/ISchema";
|
|
17
17
|
import { ILayoutManager } from "../interfaces/ILayoutManager";
|
|
18
18
|
import { Engine } from "../core/Engine";
|
|
19
|
+
import { SchemaNormalizer } from "../core/SchemaNormalizer";
|
|
19
20
|
import { Logger } from "../utils/Logger";
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -99,48 +100,36 @@ export class TableLayout implements ILayoutManager {
|
|
|
99
100
|
if (layoutElements && Array.isArray(layoutElements)) {
|
|
100
101
|
// Only render columns defined in uiLayout
|
|
101
102
|
layoutElements.forEach((element: ILayoutElement) => {
|
|
102
|
-
if (element.type === "Control") {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const propKey = element.scope.replace("#/properties/", "");
|
|
109
|
-
const fieldMeta = props[propKey];
|
|
110
|
-
|
|
103
|
+
if (element.type === "Control" && element.scope) {
|
|
104
|
+
const { meta: fieldMeta, bindingPath, propKey } = SchemaNormalizer.resolveScope(
|
|
105
|
+
{ type: "object", properties: props } as ISchema,
|
|
106
|
+
element.scope
|
|
107
|
+
);
|
|
108
|
+
|
|
111
109
|
if (!fieldMeta) {
|
|
112
110
|
Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions for Table.`, "", "TableLayout");
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const isKey = !!fieldMeta.ui?.isKey;
|
|
118
|
-
|
|
119
|
-
const column = new Column({
|
|
111
|
+
} else {
|
|
112
|
+
// The architectural boundary: Table Layout orchestrates the columns and aggregation binding,
|
|
113
|
+
// but delegates the actual cell rendering to the Engine's Field Plugins.
|
|
114
|
+
table.addColumn(new Column({
|
|
120
115
|
header: new Text({ text: element.label || fieldMeta.ui?.label || propKey }),
|
|
121
|
-
demandPopin: !isKey,
|
|
122
|
-
minScreenWidth: isKey ? "" : "Tablet",
|
|
116
|
+
demandPopin: !fieldMeta.ui?.isKey,
|
|
117
|
+
minScreenWidth: fieldMeta.ui?.isKey ? "" : "Tablet",
|
|
123
118
|
popinDisplay: "Inline"
|
|
124
|
-
});
|
|
125
|
-
table.addColumn(column);
|
|
119
|
+
}));
|
|
126
120
|
|
|
127
|
-
// Override widget if specified in the layout element
|
|
128
121
|
const effectiveMeta = { ...fieldMeta };
|
|
129
122
|
if (element.widget) {
|
|
130
123
|
effectiveMeta.ui = { ...fieldMeta.ui, widget: element.widget };
|
|
131
124
|
}
|
|
132
125
|
|
|
133
|
-
//
|
|
134
|
-
|
|
126
|
+
// We pass the activeModel as actualModelName down. But the path must be relative to the
|
|
127
|
+
// table row binding context, so we just use the bindingPath (e.g. "id" or "header/id")
|
|
128
|
+
const control = engine.generateField(effectiveMeta, bindingPath, actualModelName || "meta", true);
|
|
135
129
|
templateCells.push(control);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
const msg = (error as Error).message;
|
|
138
|
-
Logger.error(`[MetaUI] Failed to render column ${propKey}`, msg, "TableLayout");
|
|
139
|
-
Logger.showErrorPopup(`Failed to render table column '${propKey}'.\n\nDetails: ${msg}`);
|
|
140
|
-
templateCells.push(new Text({ text: "Error" }));
|
|
141
130
|
}
|
|
142
131
|
} else {
|
|
143
|
-
Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}'
|
|
132
|
+
Logger.warn(`[MetaUI] Unsupported layout element type '${element.type}' in Table.`, "", "TableLayout");
|
|
144
133
|
}
|
|
145
134
|
});
|
|
146
135
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/Wizard", "sap/m/WizardStep", "sap/ui/layout/form/SimpleForm", "sap/m/Label", "../utils/Logger"], function (Wizard, WizardStep, SimpleForm, Label, ___utils_Logger) {
|
|
1
|
+
sap.ui.define(["sap/m/Wizard", "sap/m/WizardStep", "sap/ui/layout/form/SimpleForm", "sap/m/Label", "../core/SchemaNormalizer", "../utils/Logger"], function (Wizard, WizardStep, SimpleForm, Label, ___core_SchemaNormalizer, ___utils_Logger) {
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
+
const SchemaNormalizer = ___core_SchemaNormalizer["SchemaNormalizer"];
|
|
4
5
|
const Logger = ___utils_Logger["Logger"];
|
|
5
6
|
/**
|
|
6
7
|
* Layout Manager responsible for generating a responsive SAP Fiori Wizard.
|
|
@@ -74,8 +75,11 @@ sap.ui.define(["sap/m/Wizard", "sap/m/WizardStep", "sap/ui/layout/form/SimpleFor
|
|
|
74
75
|
Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, "", "WizardLayout");
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
|
-
const
|
|
78
|
-
|
|
78
|
+
const {
|
|
79
|
+
meta,
|
|
80
|
+
bindingPath,
|
|
81
|
+
propKey
|
|
82
|
+
} = SchemaNormalizer.resolveScope(schema, element.scope);
|
|
79
83
|
if (!meta) {
|
|
80
84
|
Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, "", "WizardLayout");
|
|
81
85
|
return;
|
|
@@ -95,7 +99,7 @@ sap.ui.define(["sap/m/Wizard", "sap/m/WizardStep", "sap/ui/layout/form/SimpleFor
|
|
|
95
99
|
widget: element.widget
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
|
-
const control = engine.generateField(effectiveMeta, `/${
|
|
102
|
+
const control = engine.generateField(effectiveMeta, `/${bindingPath}`, modelName);
|
|
99
103
|
if (effectiveMeta.ui?.fullWidth) {
|
|
100
104
|
sap.ui.require(["sap/ui/layout/GridData"], GridData => {
|
|
101
105
|
control.setLayoutData(new GridData({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout-dbg.js","names":["Logger","___utils_Logger","WizardLayout","render","schema","modelName","engine","onSubmit","wizard","Wizard","renderMode","showNextButton","complete","uiLayout","Array","isArray","warn","forEach","element","type","step","WizardStep","title","label","validated","form","SimpleForm","editable","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","elements","childElement","_renderElementInForm","addContent","addStep","scope","startsWith","error","
|
|
1
|
+
{"version":3,"file":"WizardLayout-dbg.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","WizardLayout","render","schema","modelName","engine","onSubmit","wizard","Wizard","renderMode","showNextButton","complete","uiLayout","Array","isArray","warn","forEach","element","type","step","WizardStep","title","label","validated","form","SimpleForm","editable","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","elements","childElement","_renderElementInForm","addContent","addStep","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","labelText","ui","Label","text","required","effectiveMeta","widget","control","generateField","fullWidth","sap","require","GridData","setLayoutData","span","message","__exports","__esModule"],"sources":["WizardLayout.ts"],"sourcesContent":["/**\n * @file WizardLayout.ts\n * @description Generates a fully responsive SAP Fiori Wizard layout.\n */\n\nimport Wizard from \"sap/m/Wizard\";\nimport WizardStep from \"sap/m/WizardStep\";\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Wizard.\n * It segments the schema fields into discrete Wizard Steps based on `uiLayout` elements \n * of type `Group` or `WizardStep`.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class WizardLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a paginated UI5 Wizard using uiLayout.\n * \n * @param schema The active JSON schema object.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Hook executed when the Wizard's native 'complete' event is fired.\n * @returns {Control} The generated sap.m.Wizard control.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const wizard = new Wizard({\n renderMode: \"Page\",\n showNextButton: true,\n complete: function() {\n if (onSubmit) onSubmit();\n }\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in wizard schema. Wizard will not render any steps.\");\n return wizard;\n }\n\n schema.uiLayout.forEach((element: ILayoutElement) => {\n if (element.type === \"Group\" || element.type === \"WizardStep\") {\n const step = new WizardStep({\n title: element.label || \"Step\",\n validated: true // The PipelineManager handles global validation, wizard step validation can be local later\n });\n\n const form = new SimpleForm({\n editable: true,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(childElement => {\n this._renderElementInForm(form, childElement, schema, modelName, engine);\n });\n }\n\n step.addContent(form);\n wizard.addStep(step);\n } else {\n Logger.warn(`[MetaUI] Top-level element '${element.type}' inside WizardLayout must be 'Group' or 'WizardStep'.`, \"\", \"WizardLayout\");\n }\n });\n\n return wizard;\n }\n\n private _renderElementInForm(form: SimpleForm, element: ILayoutElement, schema: ISchema, modelName: string, engine: Engine): void {\n if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"WizardLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"WizardLayout\");\n return;\n }\n\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${bindingPath}`, modelName);\n\n if (effectiveMeta.ui?.fullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: any) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n Logger.error(`[MetaUI] Failed to render Wizard field ${propKey}`, (error as Error).message, \"WizardLayout\");\n form.addContent(new Label({ text: propKey }));\n }\n } else {\n Logger.warn(`[MetaUI] Nested groups within Wizard steps are not fully supported in SimpleForm y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,CAAC;YAAEC,IAAI,EAAEL;UAAQ,CAAC,CAAC,CAAC;QACjD;MACJ,CAAC,MAAM;QACHpD,MAAM,CAACgB,IAAI,CAAC,uFAAuF,EAAE,EAAE,EAAE,cAAc,CAAC;MAC5H;IACJ;EACJ;EAAC,IAAAsD,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAApE,YAAA,GAAAA,YAAA;EAAA,OAAAoE,SAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IAWjE,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"WizardLayout.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/layouts/WizardLayout.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,iDAAiD,CAAC;IAWjE,OAAO,EAAqB,OAAO,EAAkB,MAAM,+CAA+C,CAAC;IAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;IACtF,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAC;IAGhE,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C;;;;;;;OAOG;IACH,MAAa,YAAa,YAAW,cAAc;QAC/C;;;;;;;;WAQG;QACI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO;QA+CjG,OAAO,CAAC,oBAAoB;KA4C/B;CAEA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
sap.ui.define(["sap/m/Wizard","sap/m/WizardStep","sap/ui/layout/form/SimpleForm","sap/m/Label","../utils/Logger"],function(e,t,a,r,n){"use strict";const
|
|
1
|
+
sap.ui.define(["sap/m/Wizard","sap/m/WizardStep","sap/ui/layout/form/SimpleForm","sap/m/Label","../core/SchemaNormalizer","../utils/Logger"],function(e,t,a,r,n,i){"use strict";const o=n["SchemaNormalizer"];const s=i["Logger"];class l{render(r,n,i,o){const l=new e({renderMode:"Page",showNextButton:true,complete:function(){if(o)o()}});if(!r.uiLayout||!Array.isArray(r.uiLayout)){s.warn("[MetaUI] Missing 'uiLayout' array in wizard schema. Wizard will not render any steps.");return l}r.uiLayout.forEach(e=>{if(e.type==="Group"||e.type==="WizardStep"){const o=new t({title:e.label||"Step",validated:true});const s=new a({editable:true,layout:"ResponsiveGridLayout",labelSpanXL:4,labelSpanL:4,labelSpanM:4,labelSpanS:12,adjustLabelSpan:false,emptySpanXL:0,emptySpanL:0,emptySpanM:0,emptySpanS:0,columnsXL:1,columnsL:1,columnsM:1,singleContainerFullSize:false});if(e.elements&&Array.isArray(e.elements)){e.elements.forEach(e=>{this._renderElementInForm(s,e,r,n,i)})}o.addContent(s);l.addStep(o)}else{s.warn(`[MetaUI] Top-level element '${e.type}' inside WizardLayout must be 'Group' or 'WizardStep'.`,"","WizardLayout")}});return l}_renderElementInForm(e,t,a,n,i){if(t.type==="Control"){if(!t.scope||!t.scope.startsWith("#/properties/")){s.error(`[MetaUI] Invalid scope '${t.scope}' in uiLayout Control.`,"","WizardLayout");return}const{meta:l,bindingPath:u,propKey:d}=o.resolveScope(a,t.scope);if(!l){s.error(`[MetaUI] Property '${d}' not found in schema definitions.`,"","WizardLayout");return}try{const a=t.label||l.ui?.label||d;const o=new r({text:a,required:l.required});const s={...l};if(t.widget){s.ui={...l.ui,widget:t.widget}}const p=i.generateField(s,`/${u}`,n);if(s.ui?.fullWidth){sap.ui.require(["sap/ui/layout/GridData"],e=>{p.setLayoutData(new e({span:"XL12 L12 M12 S12"}))})}e.addContent(o);e.addContent(p)}catch(t){s.error(`[MetaUI] Failed to render Wizard field ${d}`,t.message,"WizardLayout");e.addContent(new r({text:d}))}}else{s.warn(`[MetaUI] Nested groups within Wizard steps are not fully supported in SimpleForm yet.`,"","WizardLayout")}}}var u={__esModule:true};u.WizardLayout=l;return u});
|
|
2
2
|
//# sourceMappingURL=WizardLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.js","names":["Logger","___utils_Logger","WizardLayout","render","schema","modelName","engine","onSubmit","wizard","Wizard","renderMode","showNextButton","complete","uiLayout","Array","isArray","warn","forEach","element","type","step","WizardStep","title","label","validated","form","SimpleForm","editable","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","elements","childElement","this","_renderElementInForm","addContent","addStep","scope","startsWith","error","
|
|
1
|
+
{"version":3,"file":"WizardLayout.js","names":["SchemaNormalizer","___core_SchemaNormalizer","Logger","___utils_Logger","WizardLayout","render","schema","modelName","engine","onSubmit","wizard","Wizard","renderMode","showNextButton","complete","uiLayout","Array","isArray","warn","forEach","element","type","step","WizardStep","title","label","validated","form","SimpleForm","editable","layout","labelSpanXL","labelSpanL","labelSpanM","labelSpanS","adjustLabelSpan","emptySpanXL","emptySpanL","emptySpanM","emptySpanS","columnsXL","columnsL","columnsM","singleContainerFullSize","elements","childElement","this","_renderElementInForm","addContent","addStep","scope","startsWith","error","meta","bindingPath","propKey","resolveScope","labelText","ui","Label","text","required","effectiveMeta","widget","control","generateField","fullWidth","sap","require","GridData","setLayoutData","span","message","__exports","__esModule"],"sources":["WizardLayout.ts"],"sourcesContent":["/**\n * @file WizardLayout.ts\n * @description Generates a fully responsive SAP Fiori Wizard layout.\n */\n\nimport Wizard from \"sap/m/Wizard\";\nimport WizardStep from \"sap/m/WizardStep\";\nimport SimpleForm from \"sap/ui/layout/form/SimpleForm\";\nimport Label from \"sap/m/Label\";\nimport VBox from \"sap/m/VBox\";\nimport { IPropertyMetadata, ISchema, ILayoutElement } from \"../interfaces/ISchema\";\nimport { ILayoutManager } from \"../interfaces/ILayoutManager\";\nimport { Engine } from \"../core/Engine\";\nimport { SchemaNormalizer } from \"../core/SchemaNormalizer\";\nimport { Logger } from \"../utils/Logger\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Layout Manager responsible for generating a responsive SAP Fiori Wizard.\n * It segments the schema fields into discrete Wizard Steps based on `uiLayout` elements \n * of type `Group` or `WizardStep`.\n * \n * @namespace nz.co.siliconst.ui5.metaui.layouts\n * @public\n */\nexport class WizardLayout implements ILayoutManager {\n /**\n * Renders the JSON Schema properties into a paginated UI5 Wizard using uiLayout.\n * \n * @param schema The active JSON schema object.\n * @param modelName The bound UI5 model name.\n * @param engine The central orchestrator for delegating plugin generation.\n * @param onSubmit Hook executed when the Wizard's native 'complete' event is fired.\n * @returns {Control} The generated sap.m.Wizard control.\n */\n public render(schema: ISchema, modelName: string, engine: Engine, onSubmit?: () => void): Control {\n const wizard = new Wizard({\n renderMode: \"Page\",\n showNextButton: true,\n complete: function() {\n if (onSubmit) onSubmit();\n }\n });\n\n if (!schema.uiLayout || !Array.isArray(schema.uiLayout)) {\n Logger.warn(\"[MetaUI] Missing 'uiLayout' array in wizard schema. Wizard will not render any steps.\");\n return wizard;\n }\n\n schema.uiLayout.forEach((element: ILayoutElement) => {\n if (element.type === \"Group\" || element.type === \"WizardStep\") {\n const step = new WizardStep({\n title: element.label || \"Step\",\n validated: true // The PipelineManager handles global validation, wizard step validation can be local later\n });\n\n const form = new SimpleForm({\n editable: true,\n layout: \"ResponsiveGridLayout\",\n labelSpanXL: 4, labelSpanL: 4, labelSpanM: 4, labelSpanS: 12,\n adjustLabelSpan: false,\n emptySpanXL: 0, emptySpanL: 0, emptySpanM: 0, emptySpanS: 0,\n columnsXL: 1, columnsL: 1, columnsM: 1,\n singleContainerFullSize: false\n });\n \n if (element.elements && Array.isArray(element.elements)) {\n element.elements.forEach(childElement => {\n this._renderElementInForm(form, childElement, schema, modelName, engine);\n });\n }\n\n step.addContent(form);\n wizard.addStep(step);\n } else {\n Logger.warn(`[MetaUI] Top-level element '${element.type}' inside WizardLayout must be 'Group' or 'WizardStep'.`, \"\", \"WizardLayout\");\n }\n });\n\n return wizard;\n }\n\n private _renderElementInForm(form: SimpleForm, element: ILayoutElement, schema: ISchema, modelName: string, engine: Engine): void {\n if (element.type === \"Control\") {\n if (!element.scope || !element.scope.startsWith(\"#/properties/\")) {\n Logger.error(`[MetaUI] Invalid scope '${element.scope}' in uiLayout Control.`, \"\", \"WizardLayout\");\n return;\n }\n \n const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);\n \n if (!meta) {\n Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, \"\", \"WizardLayout\");\n return;\n }\n\n try {\n const labelText = element.label || meta.ui?.label || propKey;\n const label = new Label({\n text: labelText,\n required: meta.required\n });\n\n const effectiveMeta = { ...meta };\n if (element.widget) {\n effectiveMeta.ui = { ...meta.ui, widget: element.widget };\n }\n\n const control = engine.generateField(effectiveMeta, `/${bindingPath}`, modelName);\n\n if (effectiveMeta.ui?.fullWidth) {\n sap.ui.require([\"sap/ui/layout/GridData\"], (GridData: any) => {\n control.setLayoutData(new GridData({ span: \"XL12 L12 M12 S12\" }));\n });\n }\n\n form.addContent(label);\n form.addContent(control);\n } catch (error) {\n Logger.error(`[MetaUI] Failed to render Wizard field ${propKey}`, (error as Error).message, \"WizardLayout\");\n form.addContent(new Label({ text: propKey }));\n }\n } else {\n Logger.warn(`[MetaUI] Nested groups within Wizard steps are not fully supported in SimpleForm yet.`, \"\", \"WizardLayout\");\n }\n }\n}\n"],"mappings":"sLAaSA,EAAgBC,EAAA,0BAChBC,EAAMC,EAAA,UAWR,MAAMC,EAUFC,OAAOC,EAAiBC,EAAmBC,EAAgB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EAAOkD,MAAM,sBAAsBG,sCAA6C,GAAI,gBACpF,MACJ,CAEA,IACI,MAAME,EAAYrC,EAAQK,OAAS4B,EAAKK,IAAIjC,OAAS8B,EACrD,MAAM9B,EAAQ,IAAIkC,EAAM,CACpBC,KAAMH,EACNI,SAAUR,EAAKQ,WAGnB,MAAMC,EAAgB,IAAKT,GAC3B,GAAIjC,EAAQ2C,OAAQ,CAChBD,EAAcJ,GAAK,IAAKL,EAAKK,GAAIK,OAAQ3C,EAAQ2C,OACrD,CAEA,MAAMC,EAAUxD,EAAOyD,cAAcH,EAAe,IAAIR,IAAe/C,GAEvE,GAAIuD,EAAcJ,IAAIQ,UAAW,CAC7BC,IAAIT,GAAGU,QAAQ,CAAC,0BAA4BC,IACxCL,EAAQM,cAAc,IAAID,EAAS,CAAEE,KAAM,uBAEnD,CAEA5C,EAAKqB,WAAWvB,GAChBE,EAAKqB,WAAWgB,EACpB,CAAE,MAAOZ,GACLlD,EAAOkD,MAAM,0CAA0CG,IAAYH,EAAgBoB,QAAS,gBAC5F7C,EAAKqB,WAAW,IAAIW,EAAM,CAAEC,KAAML,IACtC,CACJ,KAAO,CACHrD,EAAOgB,KAAK,wFAAyF,GAAI,eAC7G,CACJ,EACH,IAAAuD,EAAA,CAAAC,WAAA,MAAAD,EAAArE,eAAA,OAAAqE,CAAA","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ import VBox from "sap/m/VBox";
|
|
|
11
11
|
import { IPropertyMetadata, ISchema, ILayoutElement } from "../interfaces/ISchema";
|
|
12
12
|
import { ILayoutManager } from "../interfaces/ILayoutManager";
|
|
13
13
|
import { Engine } from "../core/Engine";
|
|
14
|
+
import { SchemaNormalizer } from "../core/SchemaNormalizer";
|
|
14
15
|
import { Logger } from "../utils/Logger";
|
|
15
16
|
import Control from "sap/ui/core/Control";
|
|
16
17
|
|
|
@@ -86,8 +87,7 @@ export class WizardLayout implements ILayoutManager {
|
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
const propKey =
|
|
90
|
-
const meta = schema.properties?.[propKey];
|
|
90
|
+
const { meta, bindingPath, propKey } = SchemaNormalizer.resolveScope(schema, element.scope);
|
|
91
91
|
|
|
92
92
|
if (!meta) {
|
|
93
93
|
Logger.error(`[MetaUI] Property '${propKey}' not found in schema definitions.`, "", "WizardLayout");
|
|
@@ -106,7 +106,7 @@ export class WizardLayout implements ILayoutManager {
|
|
|
106
106
|
effectiveMeta.ui = { ...meta.ui, widget: element.widget };
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
const control = engine.generateField(effectiveMeta, `/${
|
|
109
|
+
const control = engine.generateField(effectiveMeta, `/${bindingPath}`, modelName);
|
|
110
110
|
|
|
111
111
|
if (effectiveMeta.ui?.fullWidth) {
|
|
112
112
|
sap.ui.require(["sap/ui/layout/GridData"], (GridData: any) => {
|