@siliconst/metaui 1.4.8 → 1.4.9

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 (45) hide show
  1. package/package.json +1 -1
  2. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost-dbg.js +3 -0
  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.map +1 -1
  5. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js +1 -1
  6. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.js.map +1 -1
  7. package/src/nz/co/siliconst/ui5/metaui/controls/DynamicHost.ts +3 -0
  8. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate-dbg.js.map +1 -1
  9. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.js.map +1 -1
  10. package/src/nz/co/siliconst/ui5/metaui/controls/host/delegates/ODataDelegate.ts +1 -1
  11. package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +2 -2
  12. package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -1
  13. package/src/nz/co/siliconst/ui5/metaui/library-preload.js +7 -6
  14. package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -1
  15. package/src/nz/co/siliconst/ui5/metaui/library.d.ts +13 -0
  16. package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -1
  17. package/src/nz/co/siliconst/ui5/metaui/library.js +1 -1
  18. package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -1
  19. package/src/nz/co/siliconst/ui5/metaui/library.ts +19 -1
  20. package/src/nz/co/siliconst/ui5/metaui/manifest.json +2 -1
  21. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js +5 -3
  22. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin-dbg.js.map +1 -1
  23. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.d.ts.map +1 -1
  24. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.js +1 -1
  25. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.js.map +1 -1
  26. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ArrayPlugin.ts +4 -3
  27. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js +14 -3
  28. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin-dbg.js.map +1 -1
  29. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.d.ts.map +1 -1
  30. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js +1 -1
  31. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.js.map +1 -1
  32. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/BasePlugin.ts +14 -3
  33. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js +5 -3
  34. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin-dbg.js.map +1 -1
  35. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.d.ts.map +1 -1
  36. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.js +1 -1
  37. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.js.map +1 -1
  38. package/src/nz/co/siliconst/ui5/metaui/plugins/controls/ObjectPlugin.ts +4 -3
  39. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder-dbg.js +50 -0
  40. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder-dbg.js.map +1 -0
  41. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.d.ts +19 -0
  42. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.d.ts.map +1 -0
  43. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.js +2 -0
  44. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.js.map +1 -0
  45. package/src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.ts +43 -0
@@ -53,10 +53,11 @@ export class ObjectPlugin extends BasePlugin {
53
53
  updatePath = ctxPath.endsWith("/") ? ctxPath + bindingPath : (ctxPath === "/" ? "/" + bindingPath : ctxPath + "/" + bindingPath);
54
54
  }
55
55
 
56
- const nestedData = parentModel.getProperty(updatePath) || {};
56
+ // Deep clone to prevent live-mutations on the parent model before 'Submit' is clicked
57
+ const nestedData = JSON.parse(JSON.stringify(parentModel.getProperty(updatePath) || {}));
57
58
 
58
- sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/host/GeneratorHost"], (GeneratorHost: typeof import("../../controls/host/GeneratorHost").default) => {
59
- const host = new GeneratorHost({
59
+ sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/DynamicHost"], (DynamicHost: typeof import("../../controls/DynamicHost").default) => {
60
+ const host = new DynamicHost({
60
61
  schemaDefinition: subSchema,
61
62
  data: nestedData,
62
63
  editable: this.isEditable
@@ -0,0 +1,50 @@
1
+ sap.ui.define([], function () {
2
+ "use strict";
3
+
4
+ /**
5
+ * @file ExpressionBuilder.ts
6
+ * @description Safely parses and builds UI5 expression bindings from JSON Schema condition rules.
7
+ */
8
+
9
+ class ExpressionBuilder {
10
+ /**
11
+ * Safely converts a raw condition rule (e.g. "$root.Status === 'NEW'") into a valid UI5
12
+ * expression binding string, preserving relative vs absolute paths.
13
+ *
14
+ * @param rule The raw schema condition rule (e.g., "$root.Category === 'A' || SubCategory === 'B'").
15
+ * @param bindingPath The absolute binding path of the current field (e.g., "/Items/0/Category").
16
+ * @param modelName The UI5 JSONModel name (default "meta").
17
+ * @returns {string} The fully formed UI5 expression binding (e.g., "{= ${meta>/Status} === 'NEW' }").
18
+ */
19
+ static build(rule, bindingPath, modelName = "meta") {
20
+ if (!rule) return "{= true }";
21
+ let parsedRule = rule;
22
+
23
+ // 1. Replace absolute $root paths
24
+ // $root.Status -> ${meta>/Status}
25
+ parsedRule = parsedRule.replace(/\$root\.([a-zA-Z0-9_.]+)/g, (match, path) => {
26
+ return `\${${modelName}>/${path.replace(/\./g, '/')}}`;
27
+ });
28
+
29
+ // 2. Replace relative paths
30
+ parsedRule = parsedRule.replace(/(?<!['"\${a-zA-Z0-9_.>/-])([a-zA-Z_][a-zA-Z0-9_.]+)(?!['"a-zA-Z0-9_.(])/g, (match, path) => {
31
+ const reserved = ["true", "false", "null", "undefined", "Math", "String", "Number", "Array", "Object"];
32
+ if (reserved.includes(path)) return path;
33
+
34
+ // Resolve relative to the current binding path context
35
+ let basePath = bindingPath.startsWith("/") ? bindingPath.substring(1) : bindingPath;
36
+ const parts = basePath.split('/');
37
+ parts.pop();
38
+ const contextPrefix = parts.length > 0 ? parts.join('/') + '/' : '';
39
+ return `\${${modelName}>/${contextPrefix}${path.replace(/\./g, '/')}}`;
40
+ });
41
+ return `{= ${parsedRule} }`;
42
+ }
43
+ }
44
+ var __exports = {
45
+ __esModule: true
46
+ };
47
+ __exports.ExpressionBuilder = ExpressionBuilder;
48
+ return __exports;
49
+ });
50
+ //# sourceMappingURL=ExpressionBuilder-dbg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressionBuilder-dbg.js","names":["ExpressionBuilder","build","rule","bindingPath","modelName","parsedRule","replace","match","path","reserved","includes","basePath","startsWith","substring","parts","split","pop","contextPrefix","length","join","__exports","__esModule"],"sources":["ExpressionBuilder.ts"],"sourcesContent":["/**\n * @file ExpressionBuilder.ts\n * @description Safely parses and builds UI5 expression bindings from JSON Schema condition rules.\n */\n\nexport class ExpressionBuilder {\n /**\n * Safely converts a raw condition rule (e.g. \"$root.Status === 'NEW'\") into a valid UI5 \n * expression binding string, preserving relative vs absolute paths.\n * \n * @param rule The raw schema condition rule (e.g., \"$root.Category === 'A' || SubCategory === 'B'\").\n * @param bindingPath The absolute binding path of the current field (e.g., \"/Items/0/Category\").\n * @param modelName The UI5 JSONModel name (default \"meta\").\n * @returns {string} The fully formed UI5 expression binding (e.g., \"{= ${meta>/Status} === 'NEW' }\").\n */\n public static build(rule: string, bindingPath: string, modelName: string = \"meta\"): string {\n if (!rule) return \"{= true }\";\n\n let parsedRule = rule;\n\n // 1. Replace absolute $root paths\n // $root.Status -> ${meta>/Status}\n parsedRule = parsedRule.replace(/\\$root\\.([a-zA-Z0-9_.]+)/g, (match, path) => {\n return `\\${${modelName}>/${path.replace(/\\./g, '/')}}`;\n });\n\n // 2. Replace relative paths\n parsedRule = parsedRule.replace(/(?<!['\"\\${a-zA-Z0-9_.>/-])([a-zA-Z_][a-zA-Z0-9_.]+)(?!['\"a-zA-Z0-9_.(])/g, (match, path) => {\n const reserved = [\"true\", \"false\", \"null\", \"undefined\", \"Math\", \"String\", \"Number\", \"Array\", \"Object\"];\n if (reserved.includes(path)) return path;\n\n // Resolve relative to the current binding path context\n let basePath = bindingPath.startsWith(\"/\") ? bindingPath.substring(1) : bindingPath;\n const parts = basePath.split('/');\n parts.pop(); \n const contextPrefix = parts.length > 0 ? parts.join('/') + '/' : '';\n \n return `\\${${modelName}>/${contextPrefix}${path.replace(/\\./g, '/')}}`;\n });\n\n return `{= ${parsedRule} }`;\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;;EAEO,MAAMA,iBAAiB,CAAC;IAC3B;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI,OAAcC,KAAKA,CAACC,IAAY,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAU;MACvF,IAAI,CAACF,IAAI,EAAE,OAAO,WAAW;MAE7B,IAAIG,UAAU,GAAGH,IAAI;;MAErB;MACA;MACAG,UAAU,GAAGA,UAAU,CAACC,OAAO,CAAC,2BAA2B,EAAE,CAACC,KAAK,EAAEC,IAAI,KAAK;QAC1E,OAAO,MAAMJ,SAAS,KAAKI,IAAI,CAACF,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG;MAC1D,CAAC,CAAC;;MAEF;MACAD,UAAU,GAAGA,UAAU,CAACC,OAAO,CAAC,0EAA0E,EAAE,CAACC,KAAK,EAAEC,IAAI,KAAK;QACzH,MAAMC,QAAQ,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC;QACtG,IAAIA,QAAQ,CAACC,QAAQ,CAACF,IAAI,CAAC,EAAE,OAAOA,IAAI;;QAExC;QACA,IAAIG,QAAQ,GAAGR,WAAW,CAACS,UAAU,CAAC,GAAG,CAAC,GAAGT,WAAW,CAACU,SAAS,CAAC,CAAC,CAAC,GAAGV,WAAW;QACnF,MAAMW,KAAK,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC;QACjCD,KAAK,CAACE,GAAG,CAAC,CAAC;QACX,MAAMC,aAAa,GAAGH,KAAK,CAACI,MAAM,GAAG,CAAC,GAAGJ,KAAK,CAACK,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE;QAEnE,OAAO,MAAMf,SAAS,KAAKa,aAAa,GAAGT,IAAI,CAACF,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG;MAC1E,CAAC,CAAC;MAEF,OAAO,MAAMD,UAAU,IAAI;IAC/B;EACJ;EAAC,IAAAe,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAApB,iBAAA,GAAAA,iBAAA;EAAA,OAAAoB,SAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ declare module "nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder" {
2
+ /**
3
+ * @file ExpressionBuilder.ts
4
+ * @description Safely parses and builds UI5 expression bindings from JSON Schema condition rules.
5
+ */
6
+ export class ExpressionBuilder {
7
+ /**
8
+ * Safely converts a raw condition rule (e.g. "$root.Status === 'NEW'") into a valid UI5
9
+ * expression binding string, preserving relative vs absolute paths.
10
+ *
11
+ * @param rule The raw schema condition rule (e.g., "$root.Category === 'A' || SubCategory === 'B'").
12
+ * @param bindingPath The absolute binding path of the current field (e.g., "/Items/0/Category").
13
+ * @param modelName The UI5 JSONModel name (default "meta").
14
+ * @returns {string} The fully formed UI5 expression binding (e.g., "{= ${meta>/Status} === 'NEW' }").
15
+ */
16
+ static build(rule: string, bindingPath: string, modelName?: string): string;
17
+ }
18
+ }
19
+ //# sourceMappingURL=ExpressionBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressionBuilder.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/utils/ExpressionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,oDAAoD,CAAC;IACpE;;;OAGG;IAEH,MAAa,iBAAiB;QAC1B;;;;;;;;WAQG;eACW,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAe,GAAG,MAAM;KA2B7F;CAEA"}
@@ -0,0 +1,2 @@
1
+ sap.ui.define([],function(){"use strict";class e{static build(e,t,r="meta"){if(!e)return"{= true }";let n=e;n=n.replace(/\$root\.([a-zA-Z0-9_.]+)/g,(e,t)=>`\${${r}>/${t.replace(/\./g,"/")}}`);n=n.replace(/(?<!['"\${a-zA-Z0-9_.>/-])([a-zA-Z_][a-zA-Z0-9_.]+)(?!['"a-zA-Z0-9_.(])/g,(e,n)=>{const s=["true","false","null","undefined","Math","String","Number","Array","Object"];if(s.includes(n))return n;let u=t.startsWith("/")?t.substring(1):t;const a=u.split("/");a.pop();const i=a.length>0?a.join("/")+"/":"";return`\${${r}>/${i}${n.replace(/\./g,"/")}}`});return`{= ${n} }`}}var t={__esModule:true};t.ExpressionBuilder=e;return t});
2
+ //# sourceMappingURL=ExpressionBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpressionBuilder.js","names":["ExpressionBuilder","build","rule","bindingPath","modelName","parsedRule","replace","match","path","reserved","includes","basePath","startsWith","substring","parts","split","pop","contextPrefix","length","join","__exports","__esModule"],"sources":["ExpressionBuilder.ts"],"sourcesContent":["/**\n * @file ExpressionBuilder.ts\n * @description Safely parses and builds UI5 expression bindings from JSON Schema condition rules.\n */\n\nexport class ExpressionBuilder {\n /**\n * Safely converts a raw condition rule (e.g. \"$root.Status === 'NEW'\") into a valid UI5 \n * expression binding string, preserving relative vs absolute paths.\n * \n * @param rule The raw schema condition rule (e.g., \"$root.Category === 'A' || SubCategory === 'B'\").\n * @param bindingPath The absolute binding path of the current field (e.g., \"/Items/0/Category\").\n * @param modelName The UI5 JSONModel name (default \"meta\").\n * @returns {string} The fully formed UI5 expression binding (e.g., \"{= ${meta>/Status} === 'NEW' }\").\n */\n public static build(rule: string, bindingPath: string, modelName: string = \"meta\"): string {\n if (!rule) return \"{= true }\";\n\n let parsedRule = rule;\n\n // 1. Replace absolute $root paths\n // $root.Status -> ${meta>/Status}\n parsedRule = parsedRule.replace(/\\$root\\.([a-zA-Z0-9_.]+)/g, (match, path) => {\n return `\\${${modelName}>/${path.replace(/\\./g, '/')}}`;\n });\n\n // 2. Replace relative paths\n parsedRule = parsedRule.replace(/(?<!['\"\\${a-zA-Z0-9_.>/-])([a-zA-Z_][a-zA-Z0-9_.]+)(?!['\"a-zA-Z0-9_.(])/g, (match, path) => {\n const reserved = [\"true\", \"false\", \"null\", \"undefined\", \"Math\", \"String\", \"Number\", \"Array\", \"Object\"];\n if (reserved.includes(path)) return path;\n\n // Resolve relative to the current binding path context\n let basePath = bindingPath.startsWith(\"/\") ? bindingPath.substring(1) : bindingPath;\n const parts = basePath.split('/');\n parts.pop(); \n const contextPrefix = parts.length > 0 ? parts.join('/') + '/' : '';\n \n return `\\${${modelName}>/${contextPrefix}${path.replace(/\\./g, '/')}}`;\n });\n\n return `{= ${parsedRule} }`;\n }\n}\n"],"mappings":"yCAKO,MAAMA,EAUT,YAAcC,CAAMC,EAAcC,EAAqBC,EAAoB,QACvE,IAAKF,EAAM,MAAO,YAElB,IAAIG,EAAaH,EAIjBG,EAAaA,EAAWC,QAAQ,4BAA6B,CAACC,EAAOC,IAC1D,MAAMJ,MAAcI,EAAKF,QAAQ,MAAO,SAInDD,EAAaA,EAAWC,QAAQ,2EAA4E,CAACC,EAAOC,KAChH,MAAMC,EAAW,CAAC,OAAQ,QAAS,OAAQ,YAAa,OAAQ,SAAU,SAAU,QAAS,UAC7F,GAAIA,EAASC,SAASF,GAAO,OAAOA,EAGpC,IAAIG,EAAWR,EAAYS,WAAW,KAAOT,EAAYU,UAAU,GAAKV,EACxE,MAAMW,EAAQH,EAASI,MAAM,KAC7BD,EAAME,MACN,MAAMC,EAAgBH,EAAMI,OAAS,EAAIJ,EAAMK,KAAK,KAAO,IAAM,GAEjE,MAAO,MAAMf,MAAca,IAAgBT,EAAKF,QAAQ,MAAO,UAGnE,MAAO,MAAMD,KACjB,EACH,IAAAe,EAAA,CAAAC,WAAA,MAAAD,EAAApB,oBAAA,OAAAoB,CAAA","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @file ExpressionBuilder.ts
3
+ * @description Safely parses and builds UI5 expression bindings from JSON Schema condition rules.
4
+ */
5
+
6
+ export class ExpressionBuilder {
7
+ /**
8
+ * Safely converts a raw condition rule (e.g. "$root.Status === 'NEW'") into a valid UI5
9
+ * expression binding string, preserving relative vs absolute paths.
10
+ *
11
+ * @param rule The raw schema condition rule (e.g., "$root.Category === 'A' || SubCategory === 'B'").
12
+ * @param bindingPath The absolute binding path of the current field (e.g., "/Items/0/Category").
13
+ * @param modelName The UI5 JSONModel name (default "meta").
14
+ * @returns {string} The fully formed UI5 expression binding (e.g., "{= ${meta>/Status} === 'NEW' }").
15
+ */
16
+ public static build(rule: string, bindingPath: string, modelName: string = "meta"): string {
17
+ if (!rule) return "{= true }";
18
+
19
+ let parsedRule = rule;
20
+
21
+ // 1. Replace absolute $root paths
22
+ // $root.Status -> ${meta>/Status}
23
+ parsedRule = parsedRule.replace(/\$root\.([a-zA-Z0-9_.]+)/g, (match, path) => {
24
+ return `\${${modelName}>/${path.replace(/\./g, '/')}}`;
25
+ });
26
+
27
+ // 2. Replace relative paths
28
+ parsedRule = parsedRule.replace(/(?<!['"\${a-zA-Z0-9_.>/-])([a-zA-Z_][a-zA-Z0-9_.]+)(?!['"a-zA-Z0-9_.(])/g, (match, path) => {
29
+ const reserved = ["true", "false", "null", "undefined", "Math", "String", "Number", "Array", "Object"];
30
+ if (reserved.includes(path)) return path;
31
+
32
+ // Resolve relative to the current binding path context
33
+ let basePath = bindingPath.startsWith("/") ? bindingPath.substring(1) : bindingPath;
34
+ const parts = basePath.split('/');
35
+ parts.pop();
36
+ const contextPrefix = parts.length > 0 ? parts.join('/') + '/' : '';
37
+
38
+ return `\${${modelName}>/${contextPrefix}${path.replace(/\./g, '/')}}`;
39
+ });
40
+
41
+ return `{= ${parsedRule} }`;
42
+ }
43
+ }