@siliconst/metaui 1.0.0 → 1.2.0
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/README.md +134 -123
- package/package.json +22 -34
- package/src/nz/co/siliconst/ui5/metaui/.library +7 -7
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js +300 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts +130 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/controls/GeneratorHost.ts +292 -162
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js +52 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts +29 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/ConditionEngine.ts +49 -40
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js +82 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts +17 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/Engine.ts +82 -56
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js +66 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts +40 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/EventBus.ts +60 -45
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js +73 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts +39 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/PluginRegistry.ts +71 -56
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js +146 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts +25 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/SchemaNormalizer.ts +157 -31
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js +56 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts +37 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/core/StateManager.ts +56 -56
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts +29 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IEventBus.ts +29 -29
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ILayoutManager.ts +21 -26
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts +15 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/IPlugin.ts +14 -33
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts +58 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/interfaces/ISchema.ts +70 -70
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js +24 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts +15 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/BaseLayout.ts +22 -34
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js +99 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts +20 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/FormLayout.ts +97 -60
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js +103 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts +16 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/layouts/TableLayout.ts +119 -102
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js +44 -0
- package/src/nz/co/siliconst/ui5/metaui/library-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js +39 -0
- package/src/nz/co/siliconst/ui5/metaui/library-preload.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts +10 -0
- package/src/nz/co/siliconst/ui5/metaui/library.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/library.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/library.ts +55 -43
- package/src/nz/co/siliconst/ui5/metaui/manifest.json +35 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts +15 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.ts +71 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js +55 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts +24 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.ts +56 -58
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js +42 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.ts +41 -42
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js +69 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DatePlugin.ts +69 -63
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DateTimePlugin.ts +68 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js +67 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/DropdownPlugin.ts +65 -65
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js +56 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/NumberPlugin.ts +56 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js +57 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/StringPlugin.ts +58 -55
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js +43 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/SwitchPlugin.ts +42 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TextAreaPlugin.ts +58 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js +74 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin-dbg.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts +18 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.d.ts.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js +2 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.js.map +1 -0
- package/src/nz/co/siliconst/ui5/metaui/plugins/TimePlugin.ts +71 -0
- package/ui5.yaml +4 -12
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
sap.ui.define(["sap/m/Button"], function (Button) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
class ArrayPlugin {
|
|
5
|
+
render(field, bindingPath, modelName) {
|
|
6
|
+
// In tables, bindingPath is usually passed simply as the key (e.g. 'lineItems' or '/lineItems')
|
|
7
|
+
const propKey = bindingPath.startsWith("/") ? bindingPath.substring(1) : bindingPath;
|
|
8
|
+
return new Button({
|
|
9
|
+
text: "View Records",
|
|
10
|
+
icon: "sap-icon://list",
|
|
11
|
+
press: oEvent => {
|
|
12
|
+
const btn = oEvent.getSource();
|
|
13
|
+
const context = btn.getBindingContext(modelName);
|
|
14
|
+
if (!context) return;
|
|
15
|
+
const rowData = context.getObject();
|
|
16
|
+
const nestedData = rowData[propKey] || [];
|
|
17
|
+
|
|
18
|
+
// Synthesize a v2 schema for the nested array dialog as an object wrapper
|
|
19
|
+
const subSchema = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
[propKey]: {
|
|
23
|
+
type: "array",
|
|
24
|
+
ui: {
|
|
25
|
+
label: field.ui?.label || propKey
|
|
26
|
+
},
|
|
27
|
+
items: field.items || {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {} // inference will handle it if empty
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/GeneratorHost"], GeneratorHost => {
|
|
35
|
+
const host = new GeneratorHost({
|
|
36
|
+
schemaDefinition: subSchema,
|
|
37
|
+
initialData: {
|
|
38
|
+
[propKey]: nestedData
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// V2 Fix: Capture the nested dialog's save event and update the parent model!
|
|
43
|
+
host.attachSubmit(e => {
|
|
44
|
+
const payload = e.getParameter("payload");
|
|
45
|
+
const updatedArray = payload[propKey];
|
|
46
|
+
const parentModel = btn.getModel(modelName);
|
|
47
|
+
const contextPath = btn.getBindingContext(modelName).getPath();
|
|
48
|
+
|
|
49
|
+
// Push changes back to parent model to force UI5 bindings to refresh
|
|
50
|
+
parentModel.setProperty(`${contextPath}/${propKey}`, updatedArray);
|
|
51
|
+
});
|
|
52
|
+
host.openInDialog(`Nested Records: ${field.ui?.label || propKey}`, "Close");
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
validate() {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
onStateChange(newMetadata) {}
|
|
61
|
+
}
|
|
62
|
+
var __exports = {
|
|
63
|
+
__esModule: true
|
|
64
|
+
};
|
|
65
|
+
__exports.ArrayPlugin = ArrayPlugin;
|
|
66
|
+
return __exports;
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=ArrayPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayPlugin-dbg.js","names":["ArrayPlugin","render","field","bindingPath","modelName","propKey","startsWith","substring","Button","text","icon","press","oEvent","btn","getSource","context","getBindingContext","rowData","getObject","nestedData","subSchema","type","properties","ui","label","items","sap","require","GeneratorHost","host","schemaDefinition","initialData","attachSubmit","e","payload","getParameter","updatedArray","parentModel","getModel","contextPath","getPath","setProperty","openInDialog","validate","onStateChange","newMetadata","__exports","__esModule"],"sources":["ArrayPlugin.ts"],"sourcesContent":["/**\n * @file ArrayPlugin.ts\n * @description Renders a button that drills down into a nested table (array) via a recursive Dialog using v2 schema.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport Control from \"sap/ui/core/Control\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\n\nexport class ArrayPlugin implements IPlugin {\n public render(field: IPropertyMetadata, bindingPath: string, modelName: string): Control {\n // In tables, bindingPath is usually passed simply as the key (e.g. 'lineItems' or '/lineItems')\n const propKey = bindingPath.startsWith(\"/\") ? bindingPath.substring(1) : bindingPath;\n \n return new Button({\n text: \"View Records\",\n icon: \"sap-icon://list\",\n press: (oEvent: any) => {\n const btn = oEvent.getSource() as Button;\n const context = btn.getBindingContext(modelName);\n if (!context) return;\n \n const rowData = context.getObject();\n const nestedData = rowData[propKey] || [];\n \n // Synthesize a v2 schema for the nested array dialog as an object wrapper\n const subSchema = {\n type: \"object\",\n properties: {\n [propKey]: {\n type: \"array\",\n ui: { label: field.ui?.label || propKey },\n items: field.items || {\n type: \"object\",\n properties: {} // inference will handle it if empty\n }\n }\n }\n };\n\n sap.ui.require([\"nz/co/siliconst/ui5/metaui/controls/GeneratorHost\"], (GeneratorHost: any) => {\n const host = new GeneratorHost({\n schemaDefinition: subSchema,\n initialData: {\n [propKey]: nestedData\n }\n });\n\n // V2 Fix: Capture the nested dialog's save event and update the parent model!\n host.attachSubmit((e: any) => {\n const payload = e.getParameter(\"payload\");\n const updatedArray = payload[propKey];\n \n const parentModel = btn.getModel(modelName) as JSONModel;\n const contextPath = btn.getBindingContext(modelName).getPath();\n \n // Push changes back to parent model to force UI5 bindings to refresh\n parentModel.setProperty(`${contextPath}/${propKey}`, updatedArray);\n });\n\n host.openInDialog(`Nested Records: ${field.ui?.label || propKey}`, \"Close\");\n });\n }\n });\n }\n\n public validate(): boolean { return true; }\n public onStateChange(newMetadata: IPropertyMetadata): void {}\n}\n"],"mappings":";;;EAWO,MAAMA,WAAW,CAAoB;IACjCC,MAAMA,CAACC,KAAwB,EAAEC,WAAmB,EAAEC,SAAiB,EAAW;MACrF;MACA,MAAMC,OAAO,GAAGF,WAAW,CAACG,UAAU,CAAC,GAAG,CAAC,GAAGH,WAAW,CAACI,SAAS,CAAC,CAAC,CAAC,GAAGJ,WAAW;MAEpF,OAAO,IAAIK,MAAM,CAAC;QACdC,IAAI,EAAE,cAAc;QACpBC,IAAI,EAAE,iBAAiB;QACvBC,KAAK,EAAGC,MAAW,IAAK;UACpB,MAAMC,GAAG,GAAGD,MAAM,CAACE,SAAS,CAAC,CAAW;UACxC,MAAMC,OAAO,GAAGF,GAAG,CAACG,iBAAiB,CAACZ,SAAS,CAAC;UAChD,IAAI,CAACW,OAAO,EAAE;UAEd,MAAME,OAAO,GAAGF,OAAO,CAACG,SAAS,CAAC,CAAC;UACnC,MAAMC,UAAU,GAAGF,OAAO,CAACZ,OAAO,CAAC,IAAI,EAAE;;UAEzC;UACA,MAAMe,SAAS,GAAG;YACdC,IAAI,EAAE,QAAQ;YACdC,UAAU,EAAE;cACR,CAACjB,OAAO,GAAG;gBACPgB,IAAI,EAAE,OAAO;gBACbE,EAAE,EAAE;kBAAEC,KAAK,EAAEtB,KAAK,CAACqB,EAAE,EAAEC,KAAK,IAAInB;gBAAQ,CAAC;gBACzCoB,KAAK,EAAEvB,KAAK,CAACuB,KAAK,IAAI;kBAClBJ,IAAI,EAAE,QAAQ;kBACdC,UAAU,EAAE,CAAC,CAAC,CAAC;gBACnB;cACJ;YACJ;UACJ,CAAC;UAEDI,GAAG,CAACH,EAAE,CAACI,OAAO,CAAC,CAAC,mDAAmD,CAAC,EAAGC,aAAkB,IAAK;YAC1F,MAAMC,IAAI,GAAG,IAAID,aAAa,CAAC;cAC3BE,gBAAgB,EAAEV,SAAS;cAC3BW,WAAW,EAAE;gBACT,CAAC1B,OAAO,GAAGc;cACf;YACJ,CAAC,CAAC;;YAEF;YACAU,IAAI,CAACG,YAAY,CAAEC,CAAM,IAAK;cAC1B,MAAMC,OAAO,GAAGD,CAAC,CAACE,YAAY,CAAC,SAAS,CAAC;cACzC,MAAMC,YAAY,GAAGF,OAAO,CAAC7B,OAAO,CAAC;cAErC,MAAMgC,WAAW,GAAGxB,GAAG,CAACyB,QAAQ,CAAClC,SAAS,CAAc;cACxD,MAAMmC,WAAW,GAAG1B,GAAG,CAACG,iBAAiB,CAACZ,SAAS,CAAC,CAACoC,OAAO,CAAC,CAAC;;cAE9D;cACAH,WAAW,CAACI,WAAW,CAAC,GAAGF,WAAW,IAAIlC,OAAO,EAAE,EAAE+B,YAAY,CAAC;YACtE,CAAC,CAAC;YAEFP,IAAI,CAACa,YAAY,CAAC,mBAAmBxC,KAAK,CAACqB,EAAE,EAAEC,KAAK,IAAInB,OAAO,EAAE,EAAE,OAAO,CAAC;UAC/E,CAAC,CAAC;QACN;MACJ,CAAC,CAAC;IACN;IAEOsC,QAAQA,CAAA,EAAY;MAAE,OAAO,IAAI;IAAE;IACnCC,aAAaA,CAACC,WAA8B,EAAQ,CAAC;EAChE;EAAC,IAAAC,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA9C,WAAA,GAAAA,WAAA;EAAA,OAAA8C,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file ArrayPlugin.ts
|
|
4
|
+
* @description Renders a button that drills down into a nested table (array) via a recursive Dialog using v2 schema.
|
|
5
|
+
*/
|
|
6
|
+
import { IPlugin } from "nz/co/siliconst/ui5/metaui/interfaces/IPlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
export class ArrayPlugin implements IPlugin {
|
|
10
|
+
render(field: IPropertyMetadata, bindingPath: string, modelName: string): Control;
|
|
11
|
+
validate(): boolean;
|
|
12
|
+
onStateChange(newMetadata: IPropertyMetadata): void;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ArrayPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayPlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/ArrayPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,gDAAgD,CAAC;IAChE;;;OAGG;IAEH,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;IACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAClF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAI1C,MAAa,WAAY,YAAW,OAAO;QAChC,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;QAwDjF,QAAQ,IAAI,OAAO;QACnB,aAAa,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;KAC7D;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["sap/m/Button"],function(t){"use strict";class e{render(e,n,s){const o=n.startsWith("/")?n.substring(1):n;return new t({text:"View Records",icon:"sap-icon://list",press:t=>{const n=t.getSource();const i=n.getBindingContext(s);if(!i)return;const r=i.getObject();const a=r[o]||[];const c={type:"object",properties:{[o]:{type:"array",ui:{label:e.ui?.label||o},items:e.items||{type:"object",properties:{}}}}};sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/GeneratorHost"],t=>{const i=new t({schemaDefinition:c,initialData:{[o]:a}});i.attachSubmit(t=>{const e=t.getParameter("payload");const i=e[o];const r=n.getModel(s);const a=n.getBindingContext(s).getPath();r.setProperty(`${a}/${o}`,i)});i.openInDialog(`Nested Records: ${e.ui?.label||o}`,"Close")})}})}validate(){return true}onStateChange(t){}}var n={__esModule:true};n.ArrayPlugin=e;return n});
|
|
2
|
+
//# sourceMappingURL=ArrayPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayPlugin.js","names":["ArrayPlugin","render","field","bindingPath","modelName","propKey","startsWith","substring","Button","text","icon","press","oEvent","btn","getSource","context","getBindingContext","rowData","getObject","nestedData","subSchema","type","properties","ui","label","items","sap","require","GeneratorHost","host","schemaDefinition","initialData","attachSubmit","e","payload","getParameter","updatedArray","parentModel","getModel","contextPath","getPath","setProperty","openInDialog","validate","onStateChange","newMetadata","__exports","__esModule"],"sources":["ArrayPlugin.ts"],"sourcesContent":["/**\n * @file ArrayPlugin.ts\n * @description Renders a button that drills down into a nested table (array) via a recursive Dialog using v2 schema.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport Control from \"sap/ui/core/Control\";\nimport Button from \"sap/m/Button\";\nimport JSONModel from \"sap/ui/model/json/JSONModel\";\n\nexport class ArrayPlugin implements IPlugin {\n public render(field: IPropertyMetadata, bindingPath: string, modelName: string): Control {\n // In tables, bindingPath is usually passed simply as the key (e.g. 'lineItems' or '/lineItems')\n const propKey = bindingPath.startsWith(\"/\") ? bindingPath.substring(1) : bindingPath;\n \n return new Button({\n text: \"View Records\",\n icon: \"sap-icon://list\",\n press: (oEvent: any) => {\n const btn = oEvent.getSource() as Button;\n const context = btn.getBindingContext(modelName);\n if (!context) return;\n \n const rowData = context.getObject();\n const nestedData = rowData[propKey] || [];\n \n // Synthesize a v2 schema for the nested array dialog as an object wrapper\n const subSchema = {\n type: \"object\",\n properties: {\n [propKey]: {\n type: \"array\",\n ui: { label: field.ui?.label || propKey },\n items: field.items || {\n type: \"object\",\n properties: {} // inference will handle it if empty\n }\n }\n }\n };\n\n sap.ui.require([\"nz/co/siliconst/ui5/metaui/controls/GeneratorHost\"], (GeneratorHost: any) => {\n const host = new GeneratorHost({\n schemaDefinition: subSchema,\n initialData: {\n [propKey]: nestedData\n }\n });\n\n // V2 Fix: Capture the nested dialog's save event and update the parent model!\n host.attachSubmit((e: any) => {\n const payload = e.getParameter(\"payload\");\n const updatedArray = payload[propKey];\n \n const parentModel = btn.getModel(modelName) as JSONModel;\n const contextPath = btn.getBindingContext(modelName).getPath();\n \n // Push changes back to parent model to force UI5 bindings to refresh\n parentModel.setProperty(`${contextPath}/${propKey}`, updatedArray);\n });\n\n host.openInDialog(`Nested Records: ${field.ui?.label || propKey}`, \"Close\");\n });\n }\n });\n }\n\n public validate(): boolean { return true; }\n public onStateChange(newMetadata: IPropertyMetadata): void {}\n}\n"],"mappings":"wDAWO,MAAMA,EACFC,OAAOC,EAA0BC,EAAqBC,GAEzD,MAAMC,EAAUF,EAAYG,WAAW,KAAOH,EAAYI,UAAU,GAAKJ,EAEzE,OAAO,IAAIK,EAAO,CACdC,KAAM,eACNC,KAAM,kBACNC,MAAQC,IACJ,MAAMC,EAAMD,EAAOE,YACnB,MAAMC,EAAUF,EAAIG,kBAAkBZ,GACtC,IAAKW,EAAS,OAEd,MAAME,EAAUF,EAAQG,YACxB,MAAMC,EAAaF,EAAQZ,IAAY,GAGvC,MAAMe,EAAY,CACdC,KAAM,SACNC,WAAY,CACRjB,CAACA,GAAU,CACPgB,KAAM,QACNE,GAAI,CAAEC,MAAOtB,EAAMqB,IAAIC,OAASnB,GAChCoB,MAAOvB,EAAMuB,OAAS,CAClBJ,KAAM,SACNC,WAAY,CAAC,MAM7BI,IAAIH,GAAGI,QAAQ,CAAC,qDAAuDC,IACnE,MAAMC,EAAO,IAAID,EAAc,CAC3BE,iBAAkBV,EAClBW,YAAa,CACT1B,CAACA,GAAUc,KAKnBU,EAAKG,aAAcC,IACf,MAAMC,EAAUD,EAAEE,aAAa,WAC/B,MAAMC,EAAeF,EAAQ7B,GAE7B,MAAMgC,EAAcxB,EAAIyB,SAASlC,GACjC,MAAMmC,EAAc1B,EAAIG,kBAAkBZ,GAAWoC,UAGrDH,EAAYI,YAAY,GAAGF,KAAelC,IAAW+B,KAGzDP,EAAKa,aAAa,mBAAmBxC,EAAMqB,IAAIC,OAASnB,IAAW,aAInF,CAEOsC,WAAsB,OAAO,IAAM,CACnCC,cAAcC,GAAuC,EAC/D,IAAAC,EAAA,CAAAC,WAAA,MAAAD,EAAA9C,cAAA,OAAA8C,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ArrayPlugin.ts
|
|
3
|
+
* @description Renders a button that drills down into a nested table (array) via a recursive Dialog using v2 schema.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IPlugin } from "../interfaces/IPlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
import Button from "sap/m/Button";
|
|
10
|
+
import JSONModel from "sap/ui/model/json/JSONModel";
|
|
11
|
+
|
|
12
|
+
export class ArrayPlugin implements IPlugin {
|
|
13
|
+
public render(field: IPropertyMetadata, bindingPath: string, modelName: string): Control {
|
|
14
|
+
// In tables, bindingPath is usually passed simply as the key (e.g. 'lineItems' or '/lineItems')
|
|
15
|
+
const propKey = bindingPath.startsWith("/") ? bindingPath.substring(1) : bindingPath;
|
|
16
|
+
|
|
17
|
+
return new Button({
|
|
18
|
+
text: "View Records",
|
|
19
|
+
icon: "sap-icon://list",
|
|
20
|
+
press: (oEvent: any) => {
|
|
21
|
+
const btn = oEvent.getSource() as Button;
|
|
22
|
+
const context = btn.getBindingContext(modelName);
|
|
23
|
+
if (!context) return;
|
|
24
|
+
|
|
25
|
+
const rowData = context.getObject();
|
|
26
|
+
const nestedData = rowData[propKey] || [];
|
|
27
|
+
|
|
28
|
+
// Synthesize a v2 schema for the nested array dialog as an object wrapper
|
|
29
|
+
const subSchema = {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
[propKey]: {
|
|
33
|
+
type: "array",
|
|
34
|
+
ui: { label: field.ui?.label || propKey },
|
|
35
|
+
items: field.items || {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {} // inference will handle it if empty
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
sap.ui.require(["nz/co/siliconst/ui5/metaui/controls/GeneratorHost"], (GeneratorHost: any) => {
|
|
44
|
+
const host = new GeneratorHost({
|
|
45
|
+
schemaDefinition: subSchema,
|
|
46
|
+
initialData: {
|
|
47
|
+
[propKey]: nestedData
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// V2 Fix: Capture the nested dialog's save event and update the parent model!
|
|
52
|
+
host.attachSubmit((e: any) => {
|
|
53
|
+
const payload = e.getParameter("payload");
|
|
54
|
+
const updatedArray = payload[propKey];
|
|
55
|
+
|
|
56
|
+
const parentModel = btn.getModel(modelName) as JSONModel;
|
|
57
|
+
const contextPath = btn.getBindingContext(modelName).getPath();
|
|
58
|
+
|
|
59
|
+
// Push changes back to parent model to force UI5 bindings to refresh
|
|
60
|
+
parentModel.setProperty(`${contextPath}/${propKey}`, updatedArray);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
host.openInDialog(`Nested Records: ${field.ui?.label || propKey}`, "Close");
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public validate(): boolean { return true; }
|
|
70
|
+
public onStateChange(newMetadata: IPropertyMetadata): void {}
|
|
71
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
sap.ui.define(["../core/EventBus"], function (___core_EventBus) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file BasePlugin.ts
|
|
6
|
+
* @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks for v2 Schema.
|
|
7
|
+
*/
|
|
8
|
+
const EventBus = ___core_EventBus["EventBus"];
|
|
9
|
+
class BasePlugin {
|
|
10
|
+
control = null;
|
|
11
|
+
metadata = null;
|
|
12
|
+
fieldKey = "";
|
|
13
|
+
onStateChange(newMetadata) {
|
|
14
|
+
this.metadata = newMetadata;
|
|
15
|
+
this.applyState();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Helper to apply common UI directives (like readOnly, visibleOn) directly to any control.
|
|
19
|
+
*/
|
|
20
|
+
applyCommonDirectives(control, metadata, modelName = "meta") {
|
|
21
|
+
if (metadata.ui?.readOnly !== undefined && typeof control.setEditable === "function") {
|
|
22
|
+
control.setEditable(!metadata.ui.readOnly);
|
|
23
|
+
}
|
|
24
|
+
if (metadata.ui?.visibleOn) {
|
|
25
|
+
const expr = `{= ${metadata.ui.visibleOn.replace(/\$root\./g, `${modelName}>/`).replace(/\./g, '/')} }`;
|
|
26
|
+
control.bindProperty("visible", {
|
|
27
|
+
parts: [{
|
|
28
|
+
path: "meta>/"
|
|
29
|
+
}],
|
|
30
|
+
formatter: () => false
|
|
31
|
+
});
|
|
32
|
+
// The ConditionEngine handles actual binding injection, but here we can set a fallback or natively bind if we bypass ConditionEngine.
|
|
33
|
+
control.bindProperty("visible", expr);
|
|
34
|
+
}
|
|
35
|
+
if (metadata.ui?.enabledOn && typeof control.setEnabled === "function") {
|
|
36
|
+
const expr = `{= ${metadata.ui.enabledOn.replace(/\$root\./g, `${modelName}>/`).replace(/\./g, '/')} }`;
|
|
37
|
+
control.bindProperty("enabled", expr);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
publishChange(newValue) {
|
|
41
|
+
if (this.metadata && this.fieldKey) {
|
|
42
|
+
EventBus.getInstance().publishFieldChange({
|
|
43
|
+
fieldName: this.fieldKey,
|
|
44
|
+
newValue: newValue
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
var __exports = {
|
|
50
|
+
__esModule: true
|
|
51
|
+
};
|
|
52
|
+
__exports.BasePlugin = BasePlugin;
|
|
53
|
+
return __exports;
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=BasePlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePlugin-dbg.js","names":["EventBus","___core_EventBus","BasePlugin","control","metadata","fieldKey","onStateChange","newMetadata","applyState","applyCommonDirectives","modelName","ui","readOnly","undefined","setEditable","visibleOn","expr","replace","bindProperty","parts","path","formatter","enabledOn","setEnabled","publishChange","newValue","getInstance","publishFieldChange","fieldName","__exports","__esModule"],"sources":["BasePlugin.ts"],"sourcesContent":["/**\n * @file BasePlugin.ts\n * @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks for v2 Schema.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { EventBus } from \"../core/EventBus\";\nimport Control from \"sap/ui/core/Control\";\n\nexport abstract class BasePlugin implements IPlugin {\n protected control: Control | null = null;\n protected metadata: IPropertyMetadata | null = null;\n protected fieldKey: string = \"\";\n\n public abstract render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;\n\n public abstract validate(): boolean;\n\n public onStateChange(newMetadata: IPropertyMetadata): void {\n this.metadata = newMetadata;\n this.applyState();\n }\n\n protected abstract applyState(): void;\n\n /**\n * Helper to apply common UI directives (like readOnly, visibleOn) directly to any control.\n */\n protected applyCommonDirectives(control: any, metadata: IPropertyMetadata, modelName: string = \"meta\"): void {\n if (metadata.ui?.readOnly !== undefined && typeof control.setEditable === \"function\") {\n control.setEditable(!metadata.ui.readOnly);\n }\n\n if (metadata.ui?.visibleOn) {\n const expr = `{= ${metadata.ui.visibleOn.replace(/\\$root\\./g, `${modelName}>/`).replace(/\\./g, '/')} }`;\n control.bindProperty(\"visible\", { parts: [{ path: \"meta>/\" }], formatter: () => false });\n // The ConditionEngine handles actual binding injection, but here we can set a fallback or natively bind if we bypass ConditionEngine.\n control.bindProperty(\"visible\", expr);\n }\n \n if (metadata.ui?.enabledOn && typeof control.setEnabled === \"function\") {\n const expr = `{= ${metadata.ui.enabledOn.replace(/\\$root\\./g, `${modelName}>/`).replace(/\\./g, '/')} }`;\n control.bindProperty(\"enabled\", expr);\n }\n }\n\n protected publishChange(newValue: any): void {\n if (this.metadata && this.fieldKey) {\n EventBus.getInstance().publishFieldChange({\n fieldName: this.fieldKey,\n newValue: newValue\n });\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAOSA,QAAQ,GAAAC,gBAAA;EAGV,MAAeC,UAAU,CAAoB;IACtCC,OAAO,GAAmB,IAAI;IAC9BC,QAAQ,GAA6B,IAAI;IACzCC,QAAQ,GAAW,EAAE;IAMxBC,aAAaA,CAACC,WAA8B,EAAQ;MACvD,IAAI,CAACH,QAAQ,GAAGG,WAAW;MAC3B,IAAI,CAACC,UAAU,CAAC,CAAC;IACrB;IAIA;AACJ;AACA;IACcC,qBAAqBA,CAACN,OAAY,EAAEC,QAA2B,EAAEM,SAAiB,GAAG,MAAM,EAAQ;MACzG,IAAIN,QAAQ,CAACO,EAAE,EAAEC,QAAQ,KAAKC,SAAS,IAAI,OAAOV,OAAO,CAACW,WAAW,KAAK,UAAU,EAAE;QAClFX,OAAO,CAACW,WAAW,CAAC,CAACV,QAAQ,CAACO,EAAE,CAACC,QAAQ,CAAC;MAC9C;MAEA,IAAIR,QAAQ,CAACO,EAAE,EAAEI,SAAS,EAAE;QACxB,MAAMC,IAAI,GAAG,MAAMZ,QAAQ,CAACO,EAAE,CAACI,SAAS,CAACE,OAAO,CAAC,WAAW,EAAE,GAAGP,SAAS,IAAI,CAAC,CAACO,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI;QACvGd,OAAO,CAACe,YAAY,CAAC,SAAS,EAAE;UAAEC,KAAK,EAAE,CAAC;YAAEC,IAAI,EAAE;UAAS,CAAC,CAAC;UAAEC,SAAS,EAAEA,CAAA,KAAM;QAAM,CAAC,CAAC;QACxF;QACAlB,OAAO,CAACe,YAAY,CAAC,SAAS,EAAEF,IAAI,CAAC;MACzC;MAEA,IAAIZ,QAAQ,CAACO,EAAE,EAAEW,SAAS,IAAI,OAAOnB,OAAO,CAACoB,UAAU,KAAK,UAAU,EAAE;QACpE,MAAMP,IAAI,GAAG,MAAMZ,QAAQ,CAACO,EAAE,CAACW,SAAS,CAACL,OAAO,CAAC,WAAW,EAAE,GAAGP,SAAS,IAAI,CAAC,CAACO,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI;QACvGd,OAAO,CAACe,YAAY,CAAC,SAAS,EAAEF,IAAI,CAAC;MACzC;IACJ;IAEUQ,aAAaA,CAACC,QAAa,EAAQ;MACzC,IAAI,IAAI,CAACrB,QAAQ,IAAI,IAAI,CAACC,QAAQ,EAAE;QAChCL,QAAQ,CAAC0B,WAAW,CAAC,CAAC,CAACC,kBAAkB,CAAC;UACtCC,SAAS,EAAE,IAAI,CAACvB,QAAQ;UACxBoB,QAAQ,EAAEA;QACd,CAAC,CAAC;MACN;IACJ;EACJ;EAAC,IAAAI,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAA3B,UAAA,GAAAA,UAAA;EAAA,OAAA2B,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/BasePlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file BasePlugin.ts
|
|
4
|
+
* @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks for v2 Schema.
|
|
5
|
+
*/
|
|
6
|
+
import { IPlugin } from "nz/co/siliconst/ui5/metaui/interfaces/IPlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
export abstract class BasePlugin implements IPlugin {
|
|
10
|
+
protected control: Control | null;
|
|
11
|
+
protected metadata: IPropertyMetadata | null;
|
|
12
|
+
protected fieldKey: string;
|
|
13
|
+
abstract render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
14
|
+
abstract validate(): boolean;
|
|
15
|
+
onStateChange(newMetadata: IPropertyMetadata): void;
|
|
16
|
+
protected abstract applyState(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Helper to apply common UI directives (like readOnly, visibleOn) directly to any control.
|
|
19
|
+
*/
|
|
20
|
+
protected applyCommonDirectives(control: any, metadata: IPropertyMetadata, modelName?: string): void;
|
|
21
|
+
protected publishChange(newValue: any): void;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=BasePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/BasePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,+CAA+C,CAAC;IAC/D;;;OAGG;IAEH,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;IACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C,eAAsB,UAAW,YAAW,OAAO;QAC/C,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;QACzC,SAAS,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAQ;QACpD,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAM;iBAEhB,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;iBAE1F,QAAQ,IAAI,OAAO;QAE5B,aAAa,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;QAK1D,SAAS,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI;QAErC;;WAEG;QACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,GAAE,MAAe,GAAG,IAAI;QAkB5G,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,GAAG,IAAI;KAQ/C;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["../core/EventBus"],function(e){"use strict";const t=e["EventBus"];class i{control=null;metadata=null;fieldKey="";onStateChange(e){this.metadata=e;this.applyState()}applyCommonDirectives(e,t,i="meta"){if(t.ui?.readOnly!==undefined&&typeof e.setEditable==="function"){e.setEditable(!t.ui.readOnly)}if(t.ui?.visibleOn){const a=`{= ${t.ui.visibleOn.replace(/\$root\./g,`${i}>/`).replace(/\./g,"/")} }`;e.bindProperty("visible",{parts:[{path:"meta>/"}],formatter:()=>false});e.bindProperty("visible",a)}if(t.ui?.enabledOn&&typeof e.setEnabled==="function"){const a=`{= ${t.ui.enabledOn.replace(/\$root\./g,`${i}>/`).replace(/\./g,"/")} }`;e.bindProperty("enabled",a)}}publishChange(e){if(this.metadata&&this.fieldKey){t.getInstance().publishFieldChange({fieldName:this.fieldKey,newValue:e})}}}var a={__esModule:true};a.BasePlugin=i;return a});
|
|
2
|
+
//# sourceMappingURL=BasePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePlugin.js","names":["EventBus","___core_EventBus","BasePlugin","control","metadata","fieldKey","onStateChange","newMetadata","this","applyState","applyCommonDirectives","modelName","ui","readOnly","undefined","setEditable","visibleOn","expr","replace","bindProperty","parts","path","formatter","enabledOn","setEnabled","publishChange","newValue","getInstance","publishFieldChange","fieldName","__exports","__esModule"],"sources":["BasePlugin.ts"],"sourcesContent":["/**\n * @file BasePlugin.ts\n * @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks for v2 Schema.\n */\n\nimport { IPlugin } from \"../interfaces/IPlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport { EventBus } from \"../core/EventBus\";\nimport Control from \"sap/ui/core/Control\";\n\nexport abstract class BasePlugin implements IPlugin {\n protected control: Control | null = null;\n protected metadata: IPropertyMetadata | null = null;\n protected fieldKey: string = \"\";\n\n public abstract render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;\n\n public abstract validate(): boolean;\n\n public onStateChange(newMetadata: IPropertyMetadata): void {\n this.metadata = newMetadata;\n this.applyState();\n }\n\n protected abstract applyState(): void;\n\n /**\n * Helper to apply common UI directives (like readOnly, visibleOn) directly to any control.\n */\n protected applyCommonDirectives(control: any, metadata: IPropertyMetadata, modelName: string = \"meta\"): void {\n if (metadata.ui?.readOnly !== undefined && typeof control.setEditable === \"function\") {\n control.setEditable(!metadata.ui.readOnly);\n }\n\n if (metadata.ui?.visibleOn) {\n const expr = `{= ${metadata.ui.visibleOn.replace(/\\$root\\./g, `${modelName}>/`).replace(/\\./g, '/')} }`;\n control.bindProperty(\"visible\", { parts: [{ path: \"meta>/\" }], formatter: () => false });\n // The ConditionEngine handles actual binding injection, but here we can set a fallback or natively bind if we bypass ConditionEngine.\n control.bindProperty(\"visible\", expr);\n }\n \n if (metadata.ui?.enabledOn && typeof control.setEnabled === \"function\") {\n const expr = `{= ${metadata.ui.enabledOn.replace(/\\$root\\./g, `${modelName}>/`).replace(/\\./g, '/')} }`;\n control.bindProperty(\"enabled\", expr);\n }\n }\n\n protected publishChange(newValue: any): void {\n if (this.metadata && this.fieldKey) {\n EventBus.getInstance().publishFieldChange({\n fieldName: this.fieldKey,\n newValue: newValue\n });\n }\n }\n}\n"],"mappings":"4DAAA,MAOSA,EAAQC,EAAA,YAGV,MAAeC,EACRC,QAA0B,KAC1BC,SAAqC,KACrCC,SAAmB,GAMtBC,cAAcC,GACjBC,KAAKJ,SAAWG,EAChBC,KAAKC,YACT,CAOUC,sBAAsBP,EAAcC,EAA6BO,EAAoB,QAC3F,GAAIP,EAASQ,IAAIC,WAAaC,kBAAoBX,EAAQY,cAAgB,WAAY,CAClFZ,EAAQY,aAAaX,EAASQ,GAAGC,SACrC,CAEA,GAAIT,EAASQ,IAAII,UAAW,CACxB,MAAMC,EAAO,MAAMb,EAASQ,GAAGI,UAAUE,QAAQ,YAAa,GAAGP,OAAeO,QAAQ,MAAO,SAC/Ff,EAAQgB,aAAa,UAAW,CAAEC,MAAO,CAAC,CAAEC,KAAM,WAAaC,UAAWA,IAAM,QAEhFnB,EAAQgB,aAAa,UAAWF,EACpC,CAEA,GAAIb,EAASQ,IAAIW,kBAAoBpB,EAAQqB,aAAe,WAAY,CACpE,MAAMP,EAAO,MAAMb,EAASQ,GAAGW,UAAUL,QAAQ,YAAa,GAAGP,OAAeO,QAAQ,MAAO,SAC/Ff,EAAQgB,aAAa,UAAWF,EACpC,CACJ,CAEUQ,cAAcC,GACpB,GAAIlB,KAAKJ,UAAYI,KAAKH,SAAU,CAChCL,EAAS2B,cAAcC,mBAAmB,CACtCC,UAAWrB,KAAKH,SAChBqB,SAAUA,GAElB,CACJ,EACH,IAAAI,EAAA,CAAAC,WAAA,MAAAD,EAAA5B,aAAA,OAAA4B,CAAA","ignoreList":[]}
|
|
@@ -1,58 +1,56 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file BasePlugin.ts
|
|
3
|
-
* @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { IPlugin } from "../interfaces/IPlugin";
|
|
7
|
-
import {
|
|
8
|
-
import { EventBus } from "../core/EventBus";
|
|
9
|
-
import Control from "sap/ui/core/Control";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file BasePlugin.ts
|
|
3
|
+
* @description Abstract foundation for all MetaUI plugins, enforcing lifecycle hooks for v2 Schema.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IPlugin } from "../interfaces/IPlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import { EventBus } from "../core/EventBus";
|
|
9
|
+
import Control from "sap/ui/core/Control";
|
|
10
|
+
|
|
11
|
+
export abstract class BasePlugin implements IPlugin {
|
|
12
|
+
protected control: Control | null = null;
|
|
13
|
+
protected metadata: IPropertyMetadata | null = null;
|
|
14
|
+
protected fieldKey: string = "";
|
|
15
|
+
|
|
16
|
+
public abstract render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
17
|
+
|
|
18
|
+
public abstract validate(): boolean;
|
|
19
|
+
|
|
20
|
+
public onStateChange(newMetadata: IPropertyMetadata): void {
|
|
21
|
+
this.metadata = newMetadata;
|
|
22
|
+
this.applyState();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected abstract applyState(): void;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Helper to apply common UI directives (like readOnly, visibleOn) directly to any control.
|
|
29
|
+
*/
|
|
30
|
+
protected applyCommonDirectives(control: any, metadata: IPropertyMetadata, modelName: string = "meta"): void {
|
|
31
|
+
if (metadata.ui?.readOnly !== undefined && typeof control.setEditable === "function") {
|
|
32
|
+
control.setEditable(!metadata.ui.readOnly);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (metadata.ui?.visibleOn) {
|
|
36
|
+
const expr = `{= ${metadata.ui.visibleOn.replace(/\$root\./g, `${modelName}>/`).replace(/\./g, '/')} }`;
|
|
37
|
+
control.bindProperty("visible", { parts: [{ path: "meta>/" }], formatter: () => false });
|
|
38
|
+
// The ConditionEngine handles actual binding injection, but here we can set a fallback or natively bind if we bypass ConditionEngine.
|
|
39
|
+
control.bindProperty("visible", expr);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (metadata.ui?.enabledOn && typeof control.setEnabled === "function") {
|
|
43
|
+
const expr = `{= ${metadata.ui.enabledOn.replace(/\$root\./g, `${modelName}>/`).replace(/\./g, '/')} }`;
|
|
44
|
+
control.bindProperty("enabled", expr);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected publishChange(newValue: any): void {
|
|
49
|
+
if (this.metadata && this.fieldKey) {
|
|
50
|
+
EventBus.getInstance().publishFieldChange({
|
|
51
|
+
fieldName: this.fieldKey,
|
|
52
|
+
newValue: newValue
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin", "sap/m/CheckBox"], function (___BasePlugin, CheckBox) {
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file BooleanPlugin.ts
|
|
6
|
+
* @description Renders a sap.m.Switch for boolean states.
|
|
7
|
+
*/
|
|
8
|
+
const BasePlugin = ___BasePlugin["BasePlugin"];
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering logic for toggleable booleans.
|
|
11
|
+
*/
|
|
12
|
+
class BooleanPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata, bindingPath, modelName = "meta") {
|
|
14
|
+
this.metadata = fieldMetadata;
|
|
15
|
+
this.control = new CheckBox({
|
|
16
|
+
selected: `{${modelName}>${bindingPath}}`,
|
|
17
|
+
enabled: !fieldMetadata.ui?.readOnly,
|
|
18
|
+
select: oEvent => {
|
|
19
|
+
const val = oEvent.getParameter("selected");
|
|
20
|
+
this.publishChange(val);
|
|
21
|
+
this.validate();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return this.control;
|
|
25
|
+
}
|
|
26
|
+
validate() {
|
|
27
|
+
// Boolean states rarely fail validation.
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
applyState() {
|
|
31
|
+
if (this.control && this.metadata) {
|
|
32
|
+
this.control.setEnabled(!this.metadata.ui?.readOnly);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
var __exports = {
|
|
37
|
+
__esModule: true
|
|
38
|
+
};
|
|
39
|
+
__exports.BooleanPlugin = BooleanPlugin;
|
|
40
|
+
return __exports;
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=BooleanPlugin-dbg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanPlugin-dbg.js","names":["BasePlugin","___BasePlugin","BooleanPlugin","render","fieldMetadata","bindingPath","modelName","metadata","control","CheckBox","selected","enabled","ui","readOnly","select","oEvent","val","getParameter","publishChange","validate","applyState","setEnabled","__exports","__esModule"],"sources":["BooleanPlugin.ts"],"sourcesContent":["/**\n * @file BooleanPlugin.ts\n * @description Renders a sap.m.Switch for boolean states.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport CheckBox from \"sap/m/CheckBox\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Handles rendering logic for toggleable booleans.\n */\nexport class BooleanPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n this.control = new CheckBox({\n selected: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n select: (oEvent: any) => {\n const val = oEvent.getParameter(\"selected\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n // Boolean states rarely fail validation.\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as CheckBox).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":";;;EAAA;AACA;AACA;AACA;EAHA,MAKSA,UAAU,GAAAC,aAAA;EAKnB;AACA;AACA;EACO,MAAMC,aAAa,SAASF,UAAU,CAAC;IACnCG,MAAMA,CAACC,aAAgC,EAAEC,WAAmB,EAAEC,SAAiB,GAAG,MAAM,EAAW;MACtG,IAAI,CAACC,QAAQ,GAAGH,aAAa;MAE7B,IAAI,CAACI,OAAO,GAAG,IAAIC,QAAQ,CAAC;QACxBC,QAAQ,EAAE,IAAIJ,SAAS,IAAID,WAAW,GAAG;QACzCM,OAAO,EAAE,CAACP,aAAa,CAACQ,EAAE,EAAEC,QAAQ;QACpCC,MAAM,EAAGC,MAAW,IAAK;UACrB,MAAMC,GAAG,GAAGD,MAAM,CAACE,YAAY,CAAC,UAAU,CAAC;UAC3C,IAAI,CAACC,aAAa,CAACF,GAAG,CAAC;UACvB,IAAI,CAACG,QAAQ,CAAC,CAAC;QACnB;MACJ,CAAC,CAAC;MAEF,OAAO,IAAI,CAACX,OAAO;IACvB;IAEOW,QAAQA,CAAA,EAAY;MACvB;MACA,OAAO,IAAI;IACf;IAEUC,UAAUA,CAAA,EAAS;MACzB,IAAI,IAAI,CAACZ,OAAO,IAAI,IAAI,CAACD,QAAQ,EAAE;QAC9B,IAAI,CAACC,OAAO,CAAca,UAAU,CAAC,CAAC,IAAI,CAACd,QAAQ,CAACK,EAAE,EAAEC,QAAQ,CAAC;MACtE;IACJ;EACJ;EAAC,IAAAS,SAAA;IAAAC,UAAA;EAAA;EAAAD,SAAA,CAAApB,aAAA,GAAAA,aAAA;EAAA,OAAAoB,SAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin" {
|
|
2
|
+
/**
|
|
3
|
+
* @file BooleanPlugin.ts
|
|
4
|
+
* @description Renders a sap.m.Switch for boolean states.
|
|
5
|
+
*/
|
|
6
|
+
import { BasePlugin } from "nz/co/siliconst/ui5/metaui/plugins/BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "nz/co/siliconst/ui5/metaui/interfaces/ISchema";
|
|
8
|
+
import Control from "sap/ui/core/Control";
|
|
9
|
+
/**
|
|
10
|
+
* Handles rendering logic for toggleable booleans.
|
|
11
|
+
*/
|
|
12
|
+
export class BooleanPlugin extends BasePlugin {
|
|
13
|
+
render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName?: string): Control;
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
protected applyState(): void;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=BooleanPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanPlugin.d.ts","sourceRoot":"../../../../../../../..","sources":["src/nz/co/siliconst/ui5/metaui/plugins/BooleanPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,kDAAkD,CAAC;IAClE;;;OAGG;IAEH,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;IAElF,OAAO,OAAO,MAAM,qBAAqB,CAAC;IAE1C;;OAEG;IACH,MAAa,aAAc,SAAQ,UAAU;QAClC,MAAM,CAAC,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAe,GAAG,OAAO;QAgBlG,QAAQ,IAAI,OAAO;QAK1B,SAAS,CAAC,UAAU,IAAI,IAAI;KAK/B;CAEA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
sap.ui.define(["./BasePlugin","sap/m/CheckBox"],function(e,t){"use strict";const a=e["BasePlugin"];class s extends a{render(e,a,s="meta"){this.metadata=e;this.control=new t({selected:`{${s}>${a}}`,enabled:!e.ui?.readOnly,select:e=>{const t=e.getParameter("selected");this.publishChange(t);this.validate()}});return this.control}validate(){return true}applyState(){if(this.control&&this.metadata){this.control.setEnabled(!this.metadata.ui?.readOnly)}}}var n={__esModule:true};n.BooleanPlugin=s;return n});
|
|
2
|
+
//# sourceMappingURL=BooleanPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanPlugin.js","names":["BasePlugin","___BasePlugin","BooleanPlugin","render","fieldMetadata","bindingPath","modelName","this","metadata","control","CheckBox","selected","enabled","ui","readOnly","select","oEvent","val","getParameter","publishChange","validate","applyState","setEnabled","__exports","__esModule"],"sources":["BooleanPlugin.ts"],"sourcesContent":["/**\n * @file BooleanPlugin.ts\n * @description Renders a sap.m.Switch for boolean states.\n */\n\nimport { BasePlugin } from \"./BasePlugin\";\nimport { IPropertyMetadata } from \"../interfaces/ISchema\";\nimport CheckBox from \"sap/m/CheckBox\";\nimport Control from \"sap/ui/core/Control\";\n\n/**\n * Handles rendering logic for toggleable booleans.\n */\nexport class BooleanPlugin extends BasePlugin {\n public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = \"meta\"): Control {\n this.metadata = fieldMetadata;\n \n this.control = new CheckBox({\n selected: `{${modelName}>${bindingPath}}`,\n enabled: !fieldMetadata.ui?.readOnly,\n select: (oEvent: any) => {\n const val = oEvent.getParameter(\"selected\");\n this.publishChange(val);\n this.validate();\n }\n });\n\n return this.control;\n }\n\n public validate(): boolean {\n // Boolean states rarely fail validation.\n return true;\n }\n\n protected applyState(): void {\n if (this.control && this.metadata) {\n (this.control as CheckBox).setEnabled(!this.metadata.ui?.readOnly);\n }\n }\n}\n"],"mappings":"2EAAA,MAKSA,EAAUC,EAAA,cAQZ,MAAMC,UAAsBF,EACxBG,OAAOC,EAAkCC,EAAqBC,EAAoB,QACrFC,KAAKC,SAAWJ,EAEhBG,KAAKE,QAAU,IAAIC,EAAS,CACxBC,SAAU,IAAIL,KAAaD,KAC3BO,SAAUR,EAAcS,IAAIC,SAC5BC,OAASC,IACL,MAAMC,EAAMD,EAAOE,aAAa,YAChCX,KAAKY,cAAcF,GACnBV,KAAKa,cAIb,OAAOb,KAAKE,OAChB,CAEOW,WAEH,OAAO,IACX,CAEUC,aACN,GAAId,KAAKE,SAAWF,KAAKC,SAAU,CAC9BD,KAAKE,QAAqBa,YAAYf,KAAKC,SAASK,IAAIC,SAC7D,CACJ,EACH,IAAAS,EAAA,CAAAC,WAAA,MAAAD,EAAArB,gBAAA,OAAAqB,CAAA","ignoreList":[]}
|
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file BooleanPlugin.ts
|
|
3
|
-
* @description Renders a sap.m.Switch for boolean states.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { BasePlugin } from "./BasePlugin";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import Control from "sap/ui/core/Control";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Handles rendering logic for toggleable booleans.
|
|
13
|
-
*/
|
|
14
|
-
export class BooleanPlugin extends BasePlugin {
|
|
15
|
-
public render(fieldMetadata:
|
|
16
|
-
this.metadata = fieldMetadata;
|
|
17
|
-
|
|
18
|
-
this.control = new
|
|
19
|
-
|
|
20
|
-
enabled: !fieldMetadata.
|
|
21
|
-
|
|
22
|
-
const val = oEvent.getParameter("
|
|
23
|
-
this.publishChange(val);
|
|
24
|
-
this.validate();
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
return this.control;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public validate(): boolean {
|
|
32
|
-
// Boolean
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
protected applyState(): void {
|
|
37
|
-
if (this.control && this.metadata) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file BooleanPlugin.ts
|
|
3
|
+
* @description Renders a sap.m.Switch for boolean states.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BasePlugin } from "./BasePlugin";
|
|
7
|
+
import { IPropertyMetadata } from "../interfaces/ISchema";
|
|
8
|
+
import CheckBox from "sap/m/CheckBox";
|
|
9
|
+
import Control from "sap/ui/core/Control";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handles rendering logic for toggleable booleans.
|
|
13
|
+
*/
|
|
14
|
+
export class BooleanPlugin extends BasePlugin {
|
|
15
|
+
public render(fieldMetadata: IPropertyMetadata, bindingPath: string, modelName: string = "meta"): Control {
|
|
16
|
+
this.metadata = fieldMetadata;
|
|
17
|
+
|
|
18
|
+
this.control = new CheckBox({
|
|
19
|
+
selected: `{${modelName}>${bindingPath}}`,
|
|
20
|
+
enabled: !fieldMetadata.ui?.readOnly,
|
|
21
|
+
select: (oEvent: any) => {
|
|
22
|
+
const val = oEvent.getParameter("selected");
|
|
23
|
+
this.publishChange(val);
|
|
24
|
+
this.validate();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return this.control;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public validate(): boolean {
|
|
32
|
+
// Boolean states rarely fail validation.
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected applyState(): void {
|
|
37
|
+
if (this.control && this.metadata) {
|
|
38
|
+
(this.control as CheckBox).setEnabled(!this.metadata.ui?.readOnly);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|