@sap/ux-specification 1.124.35 → 1.124.37
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/CHANGELOG.md +68 -0
- package/dist/documentation/v2/v2-AnalyticalListPage.html +2 -2
- package/dist/documentation/v2/v2-ApplicationV2.html +2 -2
- package/dist/documentation/v2/v2-ListReport.html +2 -2
- package/dist/documentation/v2/v2-ListReportNew.html +2 -2
- package/dist/documentation/v2/v2-ObjectPage.html +2 -2
- package/dist/documentation/v2/v2-OverviewPage.html +2 -2
- package/dist/documentation/v4/v4-ApplicationV4.html +2 -2
- package/dist/documentation/v4/v4-BuildingBlocks.html +2 -2
- package/dist/documentation/v4/v4-FreestylePage.html +2 -2
- package/dist/documentation/v4/v4-ListReport.html +2 -2
- package/dist/documentation/v4/v4-ObjectPage.html +2 -2
- package/dist/index-min.js +278 -269
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v2/ListReportNewConfig.json +202 -7
- package/dist/schemas/v4/ApplicationV4.json +14 -0
- package/dist/schemas/v4/BuildingBlocksConfig.json +75 -4
- package/dist/specification/package.json +10 -10
- package/dist/specification/scripts/macros/corrections.d.ts +1 -0
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +126 -2
- package/dist/specification/scripts/macros/corrections.js.map +1 -1
- package/dist/specification/scripts/macros/schema.d.ts.map +1 -1
- package/dist/specification/scripts/macros/schema.js +36 -10
- package/dist/specification/scripts/macros/schema.js.map +1 -1
- package/dist/specification/scripts/schema/to-json-schema.js +1 -1
- package/dist/specification/scripts/schema/to-json-schema.js.map +1 -1
- package/dist/specification/src/api.d.ts.map +1 -1
- package/dist/specification/src/api.js +39 -3
- package/dist/specification/src/api.js.map +1 -1
- package/dist/specification/src/ftfs/ftfs.d.ts +8 -0
- package/dist/specification/src/ftfs/ftfs.d.ts.map +1 -1
- package/dist/specification/src/ftfs/ftfs.js +1 -0
- package/dist/specification/src/ftfs/ftfs.js.map +1 -1
- package/dist/specification/src/ftfs/index.d.ts +1 -1
- package/dist/specification/src/ftfs/index.d.ts.map +1 -1
- package/dist/specification/src/ftfs/index.js +2 -1
- package/dist/specification/src/ftfs/index.js.map +1 -1
- package/dist/specification/src/ftfs/parser/model/TreeModel.d.ts.map +1 -1
- package/dist/specification/src/ftfs/parser/model/TreeModel.js +3 -1
- package/dist/specification/src/ftfs/parser/model/TreeModel.js.map +1 -1
- package/dist/specification/src/i18n/i18n.d.ts.map +1 -1
- package/dist/specification/src/i18n/i18n.js +2 -1
- package/dist/specification/src/i18n/i18n.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/Decorator.d.ts +91 -0
- package/dist/specification/src/sync/common/decoration/Decorator.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/Decorator.js +139 -0
- package/dist/specification/src/sync/common/decoration/Decorator.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/condition-evaluator.d.ts +95 -0
- package/dist/specification/src/sync/common/decoration/condition-evaluator.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/condition-evaluator.js +210 -0
- package/dist/specification/src/sync/common/decoration/condition-evaluator.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts +5 -22
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +6 -48
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +26 -106
- package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.d.ts +4 -0
- package/dist/specification/src/sync/common/decoration/index.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.js +4 -0
- package/dist/specification/src/sync/common/decoration/index.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/interfaces.d.ts +38 -0
- package/dist/specification/src/sync/common/decoration/interfaces.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/interfaces.js +3 -0
- package/dist/specification/src/sync/common/decoration/interfaces.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Enums.d.ts +18 -0
- package/dist/specification/src/sync/common/decoration/steps/Enums.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Enums.js +50 -0
- package/dist/specification/src/sync/common/decoration/steps/Enums.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Hide.d.ts +18 -0
- package/dist/specification/src/sync/common/decoration/steps/Hide.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Hide.js +46 -0
- package/dist/specification/src/sync/common/decoration/steps/Hide.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Message.d.ts +26 -0
- package/dist/specification/src/sync/common/decoration/steps/Message.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Message.js +77 -0
- package/dist/specification/src/sync/common/decoration/steps/Message.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Readonly.d.ts +18 -0
- package/dist/specification/src/sync/common/decoration/steps/Readonly.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Readonly.js +43 -0
- package/dist/specification/src/sync/common/decoration/steps/Readonly.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Validity.d.ts +18 -0
- package/dist/specification/src/sync/common/decoration/steps/Validity.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/Validity.js +68 -0
- package/dist/specification/src/sync/common/decoration/steps/Validity.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/enum-utils.d.ts +19 -0
- package/dist/specification/src/sync/common/decoration/steps/enum-utils.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/enum-utils.js +48 -0
- package/dist/specification/src/sync/common/decoration/steps/enum-utils.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/index.d.ts +6 -0
- package/dist/specification/src/sync/common/decoration/steps/index.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/steps/index.js +14 -0
- package/dist/specification/src/sync/common/decoration/steps/index.js.map +1 -0
- package/dist/specification/src/sync/common/i18n.json +22 -0
- package/dist/specification/src/sync/common/importProject.d.ts.map +1 -1
- package/dist/specification/src/sync/common/importProject.js +2 -0
- package/dist/specification/src/sync/common/importProject.js.map +1 -1
- package/dist/specification/src/sync/v2/export/controls/Fragment.d.ts +4 -5
- package/dist/specification/src/sync/v2/export/controls/Fragment.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/controls/Fragment.js +29 -20
- package/dist/specification/src/sync/v2/export/controls/Fragment.js.map +1 -1
- package/dist/specification/src/sync/v2/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/export.js +3 -2
- package/dist/specification/src/sync/v2/export/export.js.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPage.js +48 -19
- package/dist/specification/src/sync/v2/export/exportPage.js.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts +2 -0
- package/dist/specification/src/sync/v2/export/exportPageGeneric.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/exportPageGeneric.js +17 -6
- package/dist/specification/src/sync/v2/export/exportPageGeneric.js.map +1 -1
- package/dist/specification/src/sync/v2/export/view-controller-generator.d.ts +54 -6
- package/dist/specification/src/sync/v2/export/view-controller-generator.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/export/view-controller-generator.js +106 -12
- package/dist/specification/src/sync/v2/export/view-controller-generator.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js +7 -7
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/objectPage.js +56 -2
- package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js +2 -2
- package/dist/specification/src/sync/v2/generate/schemaAdaptation.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/FilterBar.js +4 -4
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiEdit.d.ts +12 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiEdit.d.ts.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiEdit.js +167 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiEdit.js.map +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiTable.js +3 -3
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/MultiTable.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts +59 -2
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js +582 -7
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js +1 -0
- package/dist/specification/src/sync/v2/genericSchemaHandling/controls/index.js.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js +29 -6
- package/dist/specification/src/sync/v2/genericSchemaHandling/pages/pageAccess.js.map +1 -1
- package/dist/specification/src/sync/v2/types.d.ts +2 -0
- package/dist/specification/src/sync/v2/types.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/types.js.map +1 -1
- package/dist/specification/src/sync/v2/utils.d.ts +25 -0
- package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/utils.js +28 -4
- package/dist/specification/src/sync/v2/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/application.d.ts +12 -0
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +26 -1
- package/dist/specification/src/sync/v4/application.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +3 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +10 -7
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/fpmCustomPage.d.ts +1 -0
- package/dist/specification/src/sync/v4/export/fpmCustomPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/fpmCustomPage.js +212 -46
- package/dist/specification/src/sync/v4/export/fpmCustomPage.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/app.d.ts +11 -0
- package/dist/specification/src/sync/v4/generate/app.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/app.js +31 -0
- package/dist/specification/src/sync/v4/generate/app.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts +13 -0
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js +93 -13
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/annotations.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.js +4 -3
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/extensions.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js +29 -27
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/generator.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js +12 -3
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +17 -23
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.js +20 -0
- package/dist/specification/src/sync/v4/import/pages/fpmCustomPage.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts +2 -4
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.js +2 -1
- package/dist/specification/src/sync/v4/sync-rules/App.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts +2 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +3 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +119 -127
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +172 -171
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +7 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/macros.d.ts +19 -0
- package/dist/specification/src/sync/v4/utils/macros.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/macros.js +34 -0
- package/dist/specification/src/sync/v4/utils/macros.js.map +1 -1
- package/dist/specification/test/test-utils/utils.d.ts.map +1 -1
- package/dist/specification/test/test-utils/utils.js +4 -0
- package/dist/specification/test/test-utils/utils.js.map +1 -1
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts +2 -2
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts.map +1 -1
- package/dist/specification/test/unit/decorators/validity-test-utils.js +6 -6
- package/dist/specification/test/unit/decorators/validity-test-utils.js.map +1 -1
- package/dist/templates/AnalyticalTableColumnsExtension.xml +3 -3
- package/dist/templates/GridTableColumnsExtension.xml +3 -3
- package/dist/templates/ResponsiveTableColumnsExtension.xml +2 -2
- package/dist/templates/TreeTableColumnsExtension.xml +4 -4
- package/dist/templates/fragment.xml +3 -3
- package/dist/templates/view.xml +3 -3
- package/dist/types/src/apiTypes.d.ts +15 -5
- package/dist/types/src/apiTypes.d.ts.map +1 -1
- package/dist/types/src/apiTypes.js +1 -0
- package/dist/types/src/apiTypes.js.map +1 -1
- package/dist/types/src/common/types.d.ts +1 -0
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js.map +1 -1
- package/dist/types/src/common/webapp/manifest/Manifest.d.ts +2 -1
- package/dist/types/src/common/webapp/manifest/Manifest.d.ts.map +1 -1
- package/dist/types/src/common/webapp/manifest/Manifest.js +1 -0
- package/dist/types/src/common/webapp/manifest/Manifest.js.map +1 -1
- package/dist/types/src/v4/application.d.ts +15 -0
- package/dist/types/src/v4/application.d.ts.map +1 -1
- package/dist/types/src/v4/application.js +10 -0
- package/dist/types/src/v4/application.js.map +1 -1
- package/package.json +11 -11
|
@@ -10,13 +10,13 @@ const i18next_1 = __importDefault(require("i18next"));
|
|
|
10
10
|
const jsonpath_plus_1 = require("jsonpath-plus");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Inlined to avoid circular dependency issues.
|
|
13
|
+
* Appends a message to a schema element's message array.
|
|
14
|
+
* Inlined here to avoid circular dependency issues.
|
|
15
15
|
*
|
|
16
|
-
* @param element - The schema element
|
|
17
|
-
* @param message - The message
|
|
18
|
-
* @param message.text - The message text
|
|
19
|
-
* @param message.deletable - Whether the
|
|
16
|
+
* @param element - The schema element that will receive the message
|
|
17
|
+
* @param message - The message content and options
|
|
18
|
+
* @param message.text - The translated message text to display
|
|
19
|
+
* @param message.deletable - Whether the user can dismiss the message (default: false)
|
|
20
20
|
*/
|
|
21
21
|
function addMessageToSchema(element, { text, deletable = false }) {
|
|
22
22
|
if (!element[ux_specification_types_1.SchemaTag.messages]) {
|
|
@@ -26,9 +26,9 @@ function addMessageToSchema(element, { text, deletable = false }) {
|
|
|
26
26
|
}
|
|
27
27
|
class BaseConstruct {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Creates the base construct with access to the app schema, app/page configuration, and logger.
|
|
30
30
|
*
|
|
31
|
-
* @param settings -
|
|
31
|
+
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
32
32
|
*/
|
|
33
33
|
constructor(settings) {
|
|
34
34
|
const { app, appSchema, page, logger } = settings || {};
|
|
@@ -59,9 +59,9 @@ class BaseConstruct {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Returns the shared context (appSchema, app, page, logger) for use by subclasses or callers.
|
|
63
63
|
*
|
|
64
|
-
* @returns The
|
|
64
|
+
* @returns The current settings object
|
|
65
65
|
*/
|
|
66
66
|
getSettings() {
|
|
67
67
|
return {
|
|
@@ -75,9 +75,9 @@ class BaseConstruct {
|
|
|
75
75
|
exports.BaseConstruct = BaseConstruct;
|
|
76
76
|
class BaseClass extends BaseConstruct {
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Looks up the matching schema definition by class name and stores it as the base.
|
|
79
79
|
*
|
|
80
|
-
* @param settings -
|
|
80
|
+
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
81
81
|
*/
|
|
82
82
|
constructor(settings) {
|
|
83
83
|
super(settings);
|
|
@@ -91,36 +91,36 @@ class BaseClass extends BaseConstruct {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* Returns the class name used to look up the matching schema definition.
|
|
95
95
|
*
|
|
96
|
-
* @returns The name of
|
|
96
|
+
* @returns The constructor name of this class
|
|
97
97
|
*/
|
|
98
98
|
getClassName() {
|
|
99
99
|
return this.constructor.name;
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* Returns the name stored at construction time for the schema definition lookup.
|
|
103
103
|
*
|
|
104
|
-
* @returns The base name
|
|
104
|
+
* @returns The base definition name
|
|
105
105
|
*/
|
|
106
106
|
getBaseName() {
|
|
107
107
|
return this.base.name;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Returns the schema definition that decorators are applied to.
|
|
111
111
|
*
|
|
112
|
-
* @returns The
|
|
112
|
+
* @returns The JSON schema definition for this class
|
|
113
113
|
*/
|
|
114
114
|
getBase() {
|
|
115
115
|
return this.base.definition;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
118
|
+
* Builds an annotation path like `/<EntityType>/@<Term>#<Qualifier>` and stores it on the schema definition.
|
|
119
119
|
*
|
|
120
|
-
* @param entityTypeName -
|
|
121
|
-
* @param term -
|
|
122
|
-
* @param qualifier -
|
|
123
|
-
* @returns
|
|
120
|
+
* @param entityTypeName - The OData entity type name (e.g. "SalesOrderItem")
|
|
121
|
+
* @param term - The annotation term (e.g. "com.sap.vocabularies.UI.v1.LineItem")
|
|
122
|
+
* @param qualifier - Optional qualifier to disambiguate multiple annotations of the same term
|
|
123
|
+
* @returns The built annotation path, or undefined if entityTypeName is empty
|
|
124
124
|
*/
|
|
125
125
|
createAnnotationPath(entityTypeName, term, qualifier) {
|
|
126
126
|
if (!entityTypeName) {
|
|
@@ -137,9 +137,9 @@ class BaseClass extends BaseConstruct {
|
|
|
137
137
|
exports.BaseClass = BaseClass;
|
|
138
138
|
class Decorator extends BaseClass {
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
140
|
+
* Sets up the decorator context as non-enumerable so it stays hidden from serialization.
|
|
141
141
|
*
|
|
142
|
-
* @param settings -
|
|
142
|
+
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
143
143
|
*/
|
|
144
144
|
constructor(settings) {
|
|
145
145
|
super(settings);
|
|
@@ -152,17 +152,11 @@ class Decorator extends BaseClass {
|
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
155
|
+
* Builds the decorator context from app, page, and custom values, then applies all
|
|
156
|
+
* decorators (enums, message, hide, readonly) to the schema definition.
|
|
156
157
|
*
|
|
157
|
-
*
|
|
158
|
-
* -
|
|
159
|
-
* - `page`: The Page configuration (from `this.page.config`)
|
|
160
|
-
* - `custom`: Custom context provided by the caller.
|
|
161
|
-
*
|
|
162
|
-
* @param customContext - Optional custom context for decorator conditions.
|
|
163
|
-
* Use this for runtime-specific conditions like table state, section state, etc.
|
|
164
|
-
* @param definition - Optional custom definition to apply decorators to.
|
|
165
|
-
* If provided, decorators are applied to this definition instead of the one from appSchema.
|
|
158
|
+
* @param customContext - Specific values (e.g. table state, section state) used for condition evaluation
|
|
159
|
+
* @param definition - Override the schema definition to decorate (defaults to getBase())
|
|
166
160
|
* @example
|
|
167
161
|
* ```typescript
|
|
168
162
|
* // Basic initialization (app and page auto-injected)
|
|
@@ -179,21 +173,22 @@ class Decorator extends BaseClass {
|
|
|
179
173
|
*/
|
|
180
174
|
init(customContext, definition) {
|
|
181
175
|
this.decoratorContext = {
|
|
182
|
-
app: this.app
|
|
183
|
-
page: this.page
|
|
184
|
-
custom: customContext
|
|
176
|
+
app: this.app,
|
|
177
|
+
page: this.page,
|
|
178
|
+
custom: customContext,
|
|
179
|
+
schema: this.appSchema
|
|
185
180
|
};
|
|
186
181
|
// @ToDo activate for actual use of minUI5Version.
|
|
187
182
|
// const minUi5Version = this.app?.getMinUI5Version();
|
|
188
183
|
this.applyDecorators(undefined, undefined, definition);
|
|
189
184
|
}
|
|
190
185
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
186
|
+
* Resolves a dotted property path (e.g. `page.isALP`, `custom.items[0].name`) against
|
|
187
|
+
* the decorator context using JSONPath. The path must start with a known source prefix
|
|
188
|
+
* (`app`, `page`, or `custom`).
|
|
194
189
|
*
|
|
195
|
-
* @param propertyPath -
|
|
196
|
-
* @returns
|
|
190
|
+
* @param propertyPath - Dotted path with source prefix, supports full JSONPath syntax
|
|
191
|
+
* @returns The resolved `{ key, value }` pair, or undefined if the path does not resolve
|
|
197
192
|
* @example
|
|
198
193
|
* ```typescript
|
|
199
194
|
* // With decoratorContext = {
|
|
@@ -239,14 +234,11 @@ class Decorator extends BaseClass {
|
|
|
239
234
|
}
|
|
240
235
|
}
|
|
241
236
|
/**
|
|
242
|
-
* Evaluates
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* @param condition
|
|
246
|
-
* @
|
|
247
|
-
* @param condition.expectedValue - Optional expected value for equality check
|
|
248
|
-
* @param condition.negate - Optional flag to invert the condition result
|
|
249
|
-
* @returns Object containing whether condition passed and the dependency value
|
|
237
|
+
* Evaluates one condition: resolves the path, applies the check (custom function,
|
|
238
|
+
* equality, or truthy), and optionally negates the result (for `not()` conditions).
|
|
239
|
+
*
|
|
240
|
+
* @param condition - A single condition with path, expected value, and optional negate flag
|
|
241
|
+
* @returns Whether the condition passed along with the resolved value and key
|
|
250
242
|
*/
|
|
251
243
|
evaluateSingleCondition(condition) {
|
|
252
244
|
// Handle special __always__ path (from @hide(true))
|
|
@@ -276,16 +268,17 @@ class Decorator extends BaseClass {
|
|
|
276
268
|
return { passed, value, key };
|
|
277
269
|
}
|
|
278
270
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* @param
|
|
283
|
-
* @param
|
|
284
|
-
* @param
|
|
285
|
-
* @param i18nProperties
|
|
286
|
-
* @param i18nProperties.
|
|
271
|
+
* Translates and attaches a message to a schema property.
|
|
272
|
+
* Supports both the new `MessageConfig` format (from `msg()` helper) and the legacy `DependsOnMessage` format.
|
|
273
|
+
*
|
|
274
|
+
* @param condition - The decorator metadata or enum value condition containing the message definition
|
|
275
|
+
* @param decoratedClass - The decorated class instance, used for legacy function-based message text
|
|
276
|
+
* @param definition - The schema property definition to attach the message to
|
|
277
|
+
* @param i18nProperties - Context for i18n translation (propertyName, evaluation context)
|
|
278
|
+
* @param i18nProperties.propertyName - The property name used as i18n parameter
|
|
279
|
+
* @param i18nProperties.context - The evaluation context string used as i18n parameter
|
|
287
280
|
*/
|
|
288
|
-
addConditionalMessage(condition,
|
|
281
|
+
addConditionalMessage(condition, decoratedClass, definition, i18nProperties) {
|
|
289
282
|
// Handle new MessageConfig format (from msg() helper)
|
|
290
283
|
const metadata = condition;
|
|
291
284
|
if (metadata.messageConfig && (0, decoration_1.isMessageConfig)(metadata.messageConfig)) {
|
|
@@ -301,7 +294,7 @@ class Decorator extends BaseClass {
|
|
|
301
294
|
}
|
|
302
295
|
let messageText;
|
|
303
296
|
if (typeof condition.message.text === 'function') {
|
|
304
|
-
messageText = condition.message.text(
|
|
297
|
+
messageText = condition.message.text(decoratedClass);
|
|
305
298
|
}
|
|
306
299
|
else if (typeof condition.message.text === 'string') {
|
|
307
300
|
messageText = condition.message.text;
|
|
@@ -316,10 +309,10 @@ class Decorator extends BaseClass {
|
|
|
316
309
|
addMessageToSchema(definition, { text: messageText, deletable: condition.message.deletable });
|
|
317
310
|
}
|
|
318
311
|
/**
|
|
319
|
-
* Resolves PathNode values in message params to their actual values from the decorator context.
|
|
312
|
+
* Resolves any `PathNode` values in message params to their actual values from the decorator context.
|
|
320
313
|
*
|
|
321
|
-
* @param params -
|
|
322
|
-
* @returns
|
|
314
|
+
* @param params - Message parameters that may contain PathNode references
|
|
315
|
+
* @returns A new params object with PathNode values replaced by their resolved context values
|
|
323
316
|
*/
|
|
324
317
|
resolveMessageParams(params) {
|
|
325
318
|
if (!params) {
|
|
@@ -339,10 +332,11 @@ class Decorator extends BaseClass {
|
|
|
339
332
|
return resolved;
|
|
340
333
|
}
|
|
341
334
|
/**
|
|
342
|
-
*
|
|
335
|
+
* Builds a human-readable context string from the evaluation results that did not pass.
|
|
336
|
+
* Used for diagnostic messages showing which conditions were unmet.
|
|
343
337
|
*
|
|
344
|
-
* @param results - The evaluation results
|
|
345
|
-
* @returns
|
|
338
|
+
* @param results - The condition evaluation results to summarize
|
|
339
|
+
* @returns A comma-separated string of `key: value` pairs for failed conditions
|
|
346
340
|
*/
|
|
347
341
|
getContextForMessage(results) {
|
|
348
342
|
return results
|
|
@@ -351,10 +345,10 @@ class Decorator extends BaseClass {
|
|
|
351
345
|
.join(', ');
|
|
352
346
|
}
|
|
353
347
|
/**
|
|
354
|
-
* Evaluates
|
|
348
|
+
* Evaluates one item inside an AND group — either a single condition or a nested OR group.
|
|
355
349
|
*
|
|
356
|
-
* @param conditionItem -
|
|
357
|
-
* @returns
|
|
350
|
+
* @param conditionItem - A single condition or a nested `{ __orConditions }` group
|
|
351
|
+
* @returns Whether the item passed and the detailed evaluation results
|
|
358
352
|
*/
|
|
359
353
|
evaluateAndConditionItem(conditionItem) {
|
|
360
354
|
// Check if this is a nested OR group
|
|
@@ -367,11 +361,11 @@ class Decorator extends BaseClass {
|
|
|
367
361
|
return { passed: result.passed, results: [result] };
|
|
368
362
|
}
|
|
369
363
|
/**
|
|
370
|
-
* Evaluates OR conditions
|
|
371
|
-
*
|
|
364
|
+
* Evaluates OR conditions — passes when at least one item (single condition or nested AND group) matches.
|
|
365
|
+
* Short-circuits on the first passing item.
|
|
372
366
|
*
|
|
373
|
-
* @param orConditions - Array of
|
|
374
|
-
* @returns
|
|
367
|
+
* @param orConditions - Array of conditions or nested AND groups to evaluate
|
|
368
|
+
* @returns Whether any condition passed and the collected evaluation results
|
|
375
369
|
*/
|
|
376
370
|
evaluateOrConditions(orConditions) {
|
|
377
371
|
const allResults = [];
|
|
@@ -408,11 +402,11 @@ class Decorator extends BaseClass {
|
|
|
408
402
|
return { passed: false, results: allResults };
|
|
409
403
|
}
|
|
410
404
|
/**
|
|
411
|
-
* Evaluates AND conditions (
|
|
412
|
-
*
|
|
405
|
+
* Evaluates AND conditions — passes only when every item (single condition or nested OR group) matches.
|
|
406
|
+
* Continues even after a failure to collect all results for diagnostic context.
|
|
413
407
|
*
|
|
414
|
-
* @param andConditions - Array of
|
|
415
|
-
* @returns
|
|
408
|
+
* @param andConditions - Array of conditions or nested OR groups that must all pass
|
|
409
|
+
* @returns Whether all conditions passed and the collected evaluation results
|
|
416
410
|
*/
|
|
417
411
|
evaluateAndConditions(andConditions) {
|
|
418
412
|
const allResults = [];
|
|
@@ -428,10 +422,11 @@ class Decorator extends BaseClass {
|
|
|
428
422
|
return { passed: allPassed, results: allResults };
|
|
429
423
|
}
|
|
430
424
|
/**
|
|
431
|
-
*
|
|
425
|
+
* Entry point for condition evaluation. Dispatches to OR, AND, or single evaluation
|
|
426
|
+
* depending on the shape of the condition metadata.
|
|
432
427
|
*
|
|
433
|
-
* @param conditionInfo - The condition metadata
|
|
434
|
-
* @returns
|
|
428
|
+
* @param conditionInfo - The decorator condition metadata (single, AND, or OR)
|
|
429
|
+
* @returns Whether the condition passed and a diagnostic context string
|
|
435
430
|
*/
|
|
436
431
|
evaluateCondition(conditionInfo) {
|
|
437
432
|
let passed = false;
|
|
@@ -458,12 +453,12 @@ class Decorator extends BaseClass {
|
|
|
458
453
|
return { passed, context };
|
|
459
454
|
}
|
|
460
455
|
/**
|
|
461
|
-
*
|
|
462
|
-
*
|
|
456
|
+
* Yields each property from a schema definition for decorator processing.
|
|
457
|
+
* Returns early if the definition has no properties or the target is falsy.
|
|
463
458
|
*
|
|
464
|
-
* @param schemaDefinition - The schema definition to
|
|
465
|
-
* @param target -
|
|
466
|
-
* @yields Property name and definition for each property in the schema
|
|
459
|
+
* @param schemaDefinition - The schema definition whose properties to iterate
|
|
460
|
+
* @param target - Guard object — iteration is skipped if falsy
|
|
461
|
+
* @yields Property name and its definition for each property in the schema
|
|
467
462
|
*/
|
|
468
463
|
*iterateProperties(schemaDefinition, target) {
|
|
469
464
|
if (!schemaDefinition?.properties || !target) {
|
|
@@ -475,42 +470,45 @@ class Decorator extends BaseClass {
|
|
|
475
470
|
}
|
|
476
471
|
}
|
|
477
472
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
* the message decorator
|
|
473
|
+
* Hides properties whose `@hide` conditions pass.
|
|
474
|
+
* Multiple `@hide` decorators use OR semantics — any passing condition hides the property.
|
|
475
|
+
* Skipped when the `@message` decorator already added messages to the property.
|
|
481
476
|
*
|
|
482
|
-
* @param schemaDefinition - The schema definition to
|
|
483
|
-
* @param
|
|
477
|
+
* @param schemaDefinition - The schema definition to process
|
|
478
|
+
* @param decoratedClass - The decorated class instance carrying `@hide` metadata
|
|
484
479
|
*/
|
|
485
|
-
applyHideDecorator(schemaDefinition,
|
|
486
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition,
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
|
|
490
|
-
// Hide when condition IS met (passed=true means hide)
|
|
480
|
+
applyHideDecorator(schemaDefinition, decoratedClass) {
|
|
481
|
+
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
482
|
+
const hideConditions = Reflect.getMetadata(decoration_1.metadataKeys.hide, decoratedClass, propertyName);
|
|
483
|
+
if (hideConditions) {
|
|
484
|
+
// Hide when ANY condition IS met (OR semantics across multiple @hide decorators)
|
|
491
485
|
// But only if no messages were added by the message decorator
|
|
492
486
|
const hasMessages = Array.isArray(property[ux_specification_types_1.SchemaTag.messages]) && property[ux_specification_types_1.SchemaTag.messages].length > 0;
|
|
493
|
-
|
|
494
|
-
|
|
487
|
+
for (const condition of hideConditions) {
|
|
488
|
+
const { passed } = this.evaluateCondition(condition);
|
|
489
|
+
if (passed && !hasMessages) {
|
|
490
|
+
property[ux_specification_types_1.SchemaTag.hidden] = true;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
495
493
|
}
|
|
496
494
|
}
|
|
497
495
|
}
|
|
498
496
|
}
|
|
499
497
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
498
|
+
* Shows messages on properties whose `@message` conditions pass.
|
|
499
|
+
* Must run before `applyHideDecorator` so hide can detect existing messages.
|
|
502
500
|
*
|
|
503
|
-
* @param schemaDefinition - The schema definition to
|
|
504
|
-
* @param
|
|
501
|
+
* @param schemaDefinition - The schema definition to process
|
|
502
|
+
* @param decoratedClass - The decorated class instance carrying `@message` metadata
|
|
505
503
|
*/
|
|
506
|
-
applyMessageDecorator(schemaDefinition,
|
|
507
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition,
|
|
508
|
-
const
|
|
509
|
-
if (
|
|
510
|
-
for (const
|
|
511
|
-
const { passed, context } = this.evaluateCondition(
|
|
512
|
-
if (passed && (
|
|
513
|
-
this.addConditionalMessage(
|
|
504
|
+
applyMessageDecorator(schemaDefinition, decoratedClass) {
|
|
505
|
+
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
506
|
+
const messageConditions = Reflect.getMetadata(decoration_1.metadataKeys.message, decoratedClass, propertyName);
|
|
507
|
+
if (messageConditions) {
|
|
508
|
+
for (const condition of messageConditions) {
|
|
509
|
+
const { passed, context } = this.evaluateCondition(condition);
|
|
510
|
+
if (passed && (condition.message || condition.messageConfig)) {
|
|
511
|
+
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
514
512
|
propertyName,
|
|
515
513
|
context
|
|
516
514
|
});
|
|
@@ -520,45 +518,48 @@ class Decorator extends BaseClass {
|
|
|
520
518
|
}
|
|
521
519
|
}
|
|
522
520
|
/**
|
|
523
|
-
*
|
|
524
|
-
*
|
|
521
|
+
* Marks properties as read-only whose `@readonly` conditions pass.
|
|
522
|
+
* Multiple `@readonly` decorators use OR semantics — any passing condition makes the property read-only.
|
|
525
523
|
*
|
|
526
|
-
* @param schemaDefinition - The schema definition to
|
|
527
|
-
* @param
|
|
524
|
+
* @param schemaDefinition - The schema definition to process
|
|
525
|
+
* @param decoratedClass - The decorated class instance carrying `@readonly` metadata
|
|
528
526
|
*/
|
|
529
|
-
applyReadonlyDecorator(schemaDefinition,
|
|
530
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition,
|
|
531
|
-
const
|
|
532
|
-
if (
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
527
|
+
applyReadonlyDecorator(schemaDefinition, decoratedClass) {
|
|
528
|
+
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
529
|
+
const readonlyConditions = Reflect.getMetadata(decoration_1.metadataKeys.readonly, decoratedClass, propertyName);
|
|
530
|
+
if (readonlyConditions) {
|
|
531
|
+
// Readonly when ANY condition IS met (OR semantics across multiple @readonly decorators)
|
|
532
|
+
for (const condition of readonlyConditions) {
|
|
533
|
+
const { passed } = this.evaluateCondition(condition);
|
|
534
|
+
if (passed) {
|
|
535
|
+
property.readOnly = true;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
536
538
|
}
|
|
537
539
|
}
|
|
538
540
|
}
|
|
539
541
|
}
|
|
540
542
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* If multiple @enums decorators exist on the same property, the first matching condition wins.
|
|
543
|
+
* Restricts enum values on properties whose `@enums` conditions pass.
|
|
544
|
+
* When multiple `@enums` decorators exist on the same property, the first matching condition wins.
|
|
544
545
|
*
|
|
545
|
-
* @param schemaDefinition - The schema definition to
|
|
546
|
-
* @param
|
|
546
|
+
* @param schemaDefinition - The schema definition to process
|
|
547
|
+
* @param decoratedClass - The decorated class instance carrying `@enums` metadata
|
|
547
548
|
*/
|
|
548
|
-
applyEnumsDecorator(schemaDefinition,
|
|
549
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition,
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
549
|
+
applyEnumsDecorator(schemaDefinition, decoratedClass) {
|
|
550
|
+
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
551
|
+
const enumsConditions = Reflect.getMetadata(decoration_1.metadataKeys.enums, decoratedClass, propertyName);
|
|
552
|
+
if (!enumsConditions?.length) {
|
|
552
553
|
continue;
|
|
553
554
|
}
|
|
554
555
|
// Find first matching condition (first match wins)
|
|
555
|
-
for (const
|
|
556
|
-
const { passed } = this.evaluateCondition(
|
|
556
|
+
for (const condition of enumsConditions) {
|
|
557
|
+
const { passed } = this.evaluateCondition(condition);
|
|
557
558
|
if (passed) {
|
|
558
559
|
const currentEnumValues = this.resolveEnumFromProperty(property);
|
|
559
560
|
if (currentEnumValues) {
|
|
560
561
|
// Filter to only allowed values that exist in original enum
|
|
561
|
-
const filteredValues =
|
|
562
|
+
const filteredValues = condition.allowedValues.filter((v) => currentEnumValues.includes(v));
|
|
562
563
|
this.applyFilteredEnumToProperty(property, filteredValues);
|
|
563
564
|
}
|
|
564
565
|
break; // First match wins, stop processing
|
|
@@ -567,11 +568,11 @@ class Decorator extends BaseClass {
|
|
|
567
568
|
}
|
|
568
569
|
}
|
|
569
570
|
/**
|
|
570
|
-
*
|
|
571
|
+
* Reads the `@validity` metadata stored on a property of the decorated class.
|
|
571
572
|
*
|
|
572
|
-
* @param target - The
|
|
573
|
-
* @param propertyName - The property
|
|
574
|
-
* @returns The validity
|
|
573
|
+
* @param target - The decorated class instance
|
|
574
|
+
* @param propertyName - The property to read validity metadata from
|
|
575
|
+
* @returns The validity constraints (since, enum restrictions), or undefined if none
|
|
575
576
|
*/
|
|
576
577
|
getValidityMetadata(target, propertyName) {
|
|
577
578
|
let validityInfo;
|
|
@@ -581,11 +582,10 @@ class Decorator extends BaseClass {
|
|
|
581
582
|
return validityInfo;
|
|
582
583
|
}
|
|
583
584
|
/**
|
|
584
|
-
*
|
|
585
|
-
* Handles both inline enums and $ref to enum definitions.
|
|
585
|
+
* Returns the enum values from a property definition, resolving `$ref` to a shared enum definition if needed.
|
|
586
586
|
*
|
|
587
|
-
* @param property - The property definition
|
|
588
|
-
* @returns The enum array or undefined if not
|
|
587
|
+
* @param property - The schema property definition (may have inline `enum` or a `$ref`)
|
|
588
|
+
* @returns The enum values array, or undefined if the property is not an enum
|
|
589
589
|
*/
|
|
590
590
|
resolveEnumFromProperty(property) {
|
|
591
591
|
// Check for inline enum
|
|
@@ -604,12 +604,11 @@ class Decorator extends BaseClass {
|
|
|
604
604
|
return undefined;
|
|
605
605
|
}
|
|
606
606
|
/**
|
|
607
|
-
*
|
|
608
|
-
* For
|
|
609
|
-
* For inline enum properties, updates the enum directly.
|
|
607
|
+
* Writes filtered enum values to a property definition.
|
|
608
|
+
* For `$ref` properties, inlines the enum, copies the type, and removes the `$ref`.
|
|
610
609
|
*
|
|
611
|
-
* @param property - The property definition to update
|
|
612
|
-
* @param filteredEnum - The
|
|
610
|
+
* @param property - The schema property definition to update
|
|
611
|
+
* @param filteredEnum - The allowed enum values after filtering
|
|
613
612
|
*/
|
|
614
613
|
applyFilteredEnumToProperty(property, filteredEnum) {
|
|
615
614
|
if (property.$ref) {
|
|
@@ -631,19 +630,19 @@ class Decorator extends BaseClass {
|
|
|
631
630
|
}
|
|
632
631
|
}
|
|
633
632
|
/**
|
|
634
|
-
*
|
|
633
|
+
* Hides properties and filters enum values that require a UI5 version higher than the app's minimum.
|
|
635
634
|
*
|
|
636
|
-
* @param schemaDefinition The schema definition to
|
|
637
|
-
* @param
|
|
638
|
-
* @param minUI5Version The minimum UI5 version to
|
|
635
|
+
* @param schemaDefinition - The schema definition to process
|
|
636
|
+
* @param decoratedClass - The decorated class instance carrying `@validity` metadata
|
|
637
|
+
* @param minUI5Version - The app's minimum UI5 version to check against
|
|
639
638
|
*/
|
|
640
|
-
applyValidityDecorator(schemaDefinition,
|
|
641
|
-
if (!schemaDefinition?.properties || !
|
|
639
|
+
applyValidityDecorator(schemaDefinition, decoratedClass, minUI5Version) {
|
|
640
|
+
if (!schemaDefinition?.properties || !decoratedClass || !minUI5Version) {
|
|
642
641
|
return;
|
|
643
642
|
}
|
|
644
643
|
for (const propertyName in schemaDefinition.properties) {
|
|
645
644
|
const property = schemaDefinition.properties[propertyName];
|
|
646
|
-
const validityInfo = this.getValidityMetadata(
|
|
645
|
+
const validityInfo = this.getValidityMetadata(decoratedClass, propertyName);
|
|
647
646
|
// Check if property has a 'since' requirement that exceeds the app's minUI5Version
|
|
648
647
|
if (validityInfo?.since && !(0, utils_1.compareUI5Versions)(minUI5Version, validityInfo.since)) {
|
|
649
648
|
property[ux_specification_types_1.SchemaTag.hidden] = true;
|
|
@@ -664,7 +663,7 @@ class Decorator extends BaseClass {
|
|
|
664
663
|
if (condition.since && minUI5Version) {
|
|
665
664
|
if (!(0, utils_1.compareUI5Versions)(minUI5Version, condition.since)) {
|
|
666
665
|
if (condition.message) {
|
|
667
|
-
this.addConditionalMessage(condition,
|
|
666
|
+
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
668
667
|
propertyName: enumValueStr
|
|
669
668
|
});
|
|
670
669
|
}
|
|
@@ -673,9 +672,9 @@ class Decorator extends BaseClass {
|
|
|
673
672
|
}
|
|
674
673
|
// Check property dependency using dependsOn function
|
|
675
674
|
if (condition.dependsOn) {
|
|
676
|
-
if (!condition.dependsOn(
|
|
675
|
+
if (!condition.dependsOn(decoratedClass)) {
|
|
677
676
|
if (condition.message) {
|
|
678
|
-
this.addConditionalMessage(condition,
|
|
677
|
+
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
679
678
|
propertyName: enumValueStr
|
|
680
679
|
});
|
|
681
680
|
}
|
|
@@ -693,11 +692,11 @@ class Decorator extends BaseClass {
|
|
|
693
692
|
}
|
|
694
693
|
}
|
|
695
694
|
/**
|
|
696
|
-
*
|
|
695
|
+
* Marks the schema definition as a view node if the `@isViewNode` decorator is present on the target.
|
|
697
696
|
*
|
|
698
|
-
* @param schemaDefinition The schema definition to
|
|
699
|
-
* @param target The
|
|
700
|
-
* @param propertyName
|
|
697
|
+
* @param schemaDefinition - The schema definition to tag
|
|
698
|
+
* @param target - The class constructor or prototype carrying the decorator
|
|
699
|
+
* @param propertyName - Optional property name for property-level decorators
|
|
701
700
|
*/
|
|
702
701
|
applyIsViewNodeDecorator(schemaDefinition, target, propertyName) {
|
|
703
702
|
const isViewNode = Reflect.getMetadata(decoration_1.metadataKeys.isViewNode, target, propertyName);
|
|
@@ -707,11 +706,11 @@ class Decorator extends BaseClass {
|
|
|
707
706
|
}
|
|
708
707
|
}
|
|
709
708
|
/**
|
|
710
|
-
*
|
|
709
|
+
* Sets the schema `description` field from the `@description` decorator if present on the target.
|
|
711
710
|
*
|
|
712
|
-
* @param schemaDefinition - The schema definition to
|
|
713
|
-
* @param target - The
|
|
714
|
-
* @param propertyName -
|
|
711
|
+
* @param schemaDefinition - The schema definition to update
|
|
712
|
+
* @param target - The class constructor or prototype carrying the decorator
|
|
713
|
+
* @param propertyName - Optional property name for property-level decorators
|
|
715
714
|
*/
|
|
716
715
|
applyDescriptionDecorator(schemaDefinition, target, propertyName) {
|
|
717
716
|
const description = Reflect.getMetadata(decoration_1.metadataKeys.description, target, propertyName);
|
|
@@ -720,12 +719,14 @@ class Decorator extends BaseClass {
|
|
|
720
719
|
}
|
|
721
720
|
}
|
|
722
721
|
/**
|
|
723
|
-
* Applies all decorators to the schema
|
|
724
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
* @param
|
|
728
|
-
* @
|
|
722
|
+
* Applies all decorators to the schema in the correct order:
|
|
723
|
+
* description → isViewNode → validity → enums → message → hide → readonly.
|
|
724
|
+
* Message runs before hide so that hide can skip properties that already have messages.
|
|
725
|
+
*
|
|
726
|
+
* @param minUi5Version - The app's minimum UI5 version for validity checks
|
|
727
|
+
* @param propertyName - Optional property name when decorating a single property
|
|
728
|
+
* @param customDefinition - Override the schema definition (defaults to `getBase()`)
|
|
729
|
+
* @returns The decorated schema definition
|
|
729
730
|
*/
|
|
730
731
|
applyDecorators(minUi5Version, propertyName, customDefinition) {
|
|
731
732
|
const definition = customDefinition ?? this.getBase();
|