@sap/ux-specification 1.139.9 → 1.139.10
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 +40 -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 +322 -317
- 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 +48 -18
- package/dist/schemas/v4/ObjectPageConfig.json +112 -728
- package/dist/specification/package.json +8 -8
- package/dist/specification/scripts/generate-validity-report.js +1 -1
- package/dist/specification/scripts/generate-validity-report.js.map +1 -1
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +15 -0
- 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 +23 -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/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 +58 -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 +23 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +0 -8
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +0 -15
- 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 +28 -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/common/rules.d.ts +1 -1
- package/dist/specification/src/sync/common/rules.js +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/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 +1 -0
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +10 -0
- package/dist/specification/src/sync/v4/application.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts +1 -2
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js +1 -2
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts +3 -5
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.js +2 -7
- package/dist/specification/src/sync/v4/export/controls/Header.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts +9 -3
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js +10 -6
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts +1 -2
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js +1 -2
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts +11 -51
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js +95 -246
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts +6 -27
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.js +11 -38
- package/dist/specification/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +1 -2
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js +1 -2
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/factory.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/factory.js +2 -4
- package/dist/specification/src/sync/v4/export/factory.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 +74 -2
- 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.d.ts +32 -13
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js +103 -78
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts +7 -4
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js +34 -19
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts +1 -2
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +136 -95
- 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/import/pages/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/objectPage.js +4 -23
- package/dist/specification/src/sync/v4/import/pages/objectPage.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 +1 -294
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +0 -753
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +2 -4
- 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/StableIdHelper.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/StableIdHelper.js +10 -4
- package/dist/specification/src/sync/v4/utils/StableIdHelper.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/src/sync/v4/utils/utils.d.ts +22 -2
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +238 -41
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/specification/test/test-utils/utils.d.ts +1 -0
- package/dist/specification/test/test-utils/utils.d.ts.map +1 -1
- package/dist/specification/test/test-utils/utils.js +11 -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 +11 -6
- package/dist/types/src/common/types.d.ts.map +1 -1
- package/dist/types/src/common/types.js +12 -7
- package/dist/types/src/common/types.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/dist/types/src/v4/controls/ObjectPageTable.d.ts +86 -252
- package/dist/types/src/v4/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/types/src/v4/controls/ObjectPageTable.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,756 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Decorator = exports.BaseClass = exports.BaseConstruct = void 0;
|
|
7
|
-
const ux_specification_types_1 = require("@sap/ux-specification-types");
|
|
8
|
-
const decoration_1 = require("../../common/decoration");
|
|
9
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
10
|
-
const jsonpath_plus_1 = require("jsonpath-plus");
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
|
-
/**
|
|
13
|
-
* Appends a message to a schema element's message array.
|
|
14
|
-
* Inlined here to avoid circular dependency issues.
|
|
15
|
-
*
|
|
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
|
-
*/
|
|
21
|
-
function addMessageToSchema(element, { text, deletable = false }) {
|
|
22
|
-
if (!element[ux_specification_types_1.SchemaTag.messages]) {
|
|
23
|
-
element[ux_specification_types_1.SchemaTag.messages] = [];
|
|
24
|
-
}
|
|
25
|
-
element[ux_specification_types_1.SchemaTag.messages].push({ text, deletable });
|
|
26
|
-
}
|
|
27
|
-
class BaseConstruct {
|
|
28
|
-
/**
|
|
29
|
-
* Creates the base construct with access to the app schema, app/page configuration, and logger.
|
|
30
|
-
*
|
|
31
|
-
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
32
|
-
*/
|
|
33
|
-
constructor(settings) {
|
|
34
|
-
const { app, appSchema, page, logger } = settings || {};
|
|
35
|
-
// Define properties as non-enumerable to hide them from serialization and Object.keys()
|
|
36
|
-
Object.defineProperty(this, 'appSchema', {
|
|
37
|
-
value: appSchema,
|
|
38
|
-
writable: false,
|
|
39
|
-
enumerable: false,
|
|
40
|
-
configurable: true
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(this, 'app', {
|
|
43
|
-
value: app,
|
|
44
|
-
writable: false,
|
|
45
|
-
enumerable: false,
|
|
46
|
-
configurable: true
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(this, 'page', {
|
|
49
|
-
value: page,
|
|
50
|
-
writable: false,
|
|
51
|
-
enumerable: false,
|
|
52
|
-
configurable: true
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(this, 'logger', {
|
|
55
|
-
value: logger,
|
|
56
|
-
writable: false,
|
|
57
|
-
enumerable: false,
|
|
58
|
-
configurable: true
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Returns the shared context (appSchema, app, page, logger) for use by subclasses or callers.
|
|
63
|
-
*
|
|
64
|
-
* @returns The current settings object
|
|
65
|
-
*/
|
|
66
|
-
getSettings() {
|
|
67
|
-
return {
|
|
68
|
-
appSchema: this.appSchema,
|
|
69
|
-
app: this.app,
|
|
70
|
-
page: this.page,
|
|
71
|
-
logger: this.logger
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.BaseConstruct = BaseConstruct;
|
|
76
|
-
class BaseClass extends BaseConstruct {
|
|
77
|
-
/**
|
|
78
|
-
* Looks up the matching schema definition by class name and stores it as the base.
|
|
79
|
-
*
|
|
80
|
-
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
81
|
-
*/
|
|
82
|
-
constructor(settings) {
|
|
83
|
-
super(settings);
|
|
84
|
-
const name = this.getClassName();
|
|
85
|
-
// Define base as non-enumerable to hide it from serialization and Object.keys()
|
|
86
|
-
Object.defineProperty(this, 'base', {
|
|
87
|
-
value: { name, definition: this.appSchema?.get().definitions?.[name] },
|
|
88
|
-
writable: true,
|
|
89
|
-
enumerable: false,
|
|
90
|
-
configurable: true
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Returns the class name used to look up the matching schema definition.
|
|
95
|
-
*
|
|
96
|
-
* @returns The constructor name of this class
|
|
97
|
-
*/
|
|
98
|
-
getClassName() {
|
|
99
|
-
return this.constructor.name;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Returns the name stored at construction time for the schema definition lookup.
|
|
103
|
-
*
|
|
104
|
-
* @returns The base definition name
|
|
105
|
-
*/
|
|
106
|
-
getBaseName() {
|
|
107
|
-
return this.base.name;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Returns the schema definition that decorators are applied to.
|
|
111
|
-
*
|
|
112
|
-
* @returns The JSON schema definition for this class
|
|
113
|
-
*/
|
|
114
|
-
getBase() {
|
|
115
|
-
return this.base.definition;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Builds an annotation path like `/<EntityType>/@<Term>#<Qualifier>` and stores it on the schema definition.
|
|
119
|
-
*
|
|
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
|
-
*/
|
|
125
|
-
createAnnotationPath(entityTypeName, term, qualifier) {
|
|
126
|
-
if (!entityTypeName) {
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
let annotationPath = `/${entityTypeName}/@${term}`;
|
|
130
|
-
if (qualifier) {
|
|
131
|
-
annotationPath += `#${qualifier}`;
|
|
132
|
-
}
|
|
133
|
-
this.getBase()[ux_specification_types_1.SchemaTag.annotationPath] = annotationPath;
|
|
134
|
-
return annotationPath;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.BaseClass = BaseClass;
|
|
138
|
-
class Decorator extends BaseClass {
|
|
139
|
-
/**
|
|
140
|
-
* Sets up the decorator context as non-enumerable so it stays hidden from serialization.
|
|
141
|
-
*
|
|
142
|
-
* @param settings - Shared context (appSchema, app, page, logger) passed to all decorator classes
|
|
143
|
-
*/
|
|
144
|
-
constructor(settings) {
|
|
145
|
-
super(settings);
|
|
146
|
-
// Define decoratorContext as non-enumerable to hide from serialization
|
|
147
|
-
Object.defineProperty(this, 'decoratorContext', {
|
|
148
|
-
value: {},
|
|
149
|
-
writable: true,
|
|
150
|
-
enumerable: false,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Builds the decorator context from app, page, and custom values, then applies all
|
|
156
|
-
* decorators (enums, message, hide, readonly) to the schema definition.
|
|
157
|
-
*
|
|
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())
|
|
160
|
-
* @example
|
|
161
|
-
* ```typescript
|
|
162
|
-
* // Basic initialization (app and page auto-injected)
|
|
163
|
-
* decorator.init();
|
|
164
|
-
*
|
|
165
|
-
* // With custom context for table-specific conditions
|
|
166
|
-
* decorator.init({
|
|
167
|
-
* table: { type: 'GridTable', views: [] }
|
|
168
|
-
* });
|
|
169
|
-
*
|
|
170
|
-
* // With custom definition (for dynamically created definitions)
|
|
171
|
-
* decorator.init({ table: { type: 'GridTable' } }, customTableDefinition);
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
init(customContext, definition) {
|
|
175
|
-
this.decoratorContext = {
|
|
176
|
-
app: this.app?.config,
|
|
177
|
-
page: this.page?.config,
|
|
178
|
-
custom: customContext
|
|
179
|
-
};
|
|
180
|
-
// @ToDo activate for actual use of minUI5Version.
|
|
181
|
-
// const minUi5Version = this.app?.getMinUI5Version();
|
|
182
|
-
this.applyDecorators(undefined, undefined, definition);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Resolves a dotted property path (e.g. `page.isALP`, `custom.items[0].name`) against
|
|
186
|
-
* the decorator context using JSONPath. The path must start with a known source prefix
|
|
187
|
-
* (`app`, `page`, or `custom`).
|
|
188
|
-
*
|
|
189
|
-
* @param propertyPath - Dotted path with source prefix, supports full JSONPath syntax
|
|
190
|
-
* @returns The resolved `{ key, value }` pair, or undefined if the path does not resolve
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* // With decoratorContext = {
|
|
194
|
-
* // app: { manifest: { 'sap.ui5': { routing: {...} } } },
|
|
195
|
-
* // page: { isALP: true },
|
|
196
|
-
* // custom: { type: 'GridTable', items: [{ name: 'Item1' }, { name: 'Item2' }] }
|
|
197
|
-
* // }
|
|
198
|
-
* getPropertyKeyValue('page.isALP') // { key: 'isALP', value: true }
|
|
199
|
-
* getPropertyKeyValue('custom.items[0]') // { key: '0', value: { name: 'Item1' } }
|
|
200
|
-
* getPropertyKeyValue('custom.items[1].name') // { key: 'name', value: 'Item2' }
|
|
201
|
-
* getPropertyKeyValue('app.manifest["sap.ui5"]') // Access property with dot in name
|
|
202
|
-
* getPropertyKeyValue('$.app.manifest["sap.ui5"].routing') // JSONPath with root reference
|
|
203
|
-
* getPropertyKeyValue('$app["manifest"]["sap.ui5"]') // Alternative JSONPath format
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
getPropertyKeyValue(propertyPath) {
|
|
207
|
-
if (!propertyPath || !this.decoratorContext) {
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
|
-
try {
|
|
211
|
-
// Ensure path starts with $ for JSONPath
|
|
212
|
-
const jsonPath = propertyPath.startsWith('$') ? propertyPath : `$.${propertyPath}`;
|
|
213
|
-
// Use JSONPath to query with resultType 'all' to get both value and metadata
|
|
214
|
-
const results = (0, jsonpath_plus_1.JSONPath)({
|
|
215
|
-
path: jsonPath,
|
|
216
|
-
json: this.decoratorContext,
|
|
217
|
-
resultType: 'all'
|
|
218
|
-
});
|
|
219
|
-
// JSONPath with resultType 'all' returns an array of result objects
|
|
220
|
-
if (!results || results.length === 0) {
|
|
221
|
-
return undefined;
|
|
222
|
-
}
|
|
223
|
-
// Get the first result (wrap: false behavior)
|
|
224
|
-
const result = results[0];
|
|
225
|
-
// parentProperty contains the last key in the path
|
|
226
|
-
const key = String(result.parentProperty);
|
|
227
|
-
const value = result.value;
|
|
228
|
-
return { key, value };
|
|
229
|
-
}
|
|
230
|
-
catch {
|
|
231
|
-
// If JSONPath fails, return undefined
|
|
232
|
-
return undefined;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Evaluates one condition: resolves the path, applies the check (custom function,
|
|
237
|
-
* equality, or truthy), and optionally negates the result (for `not()` conditions).
|
|
238
|
-
*
|
|
239
|
-
* @param condition - A single condition with path, expected value, and optional negate flag
|
|
240
|
-
* @returns Whether the condition passed along with the resolved value and key
|
|
241
|
-
*/
|
|
242
|
-
evaluateSingleCondition(condition) {
|
|
243
|
-
// Handle special __always__ path (from @hide(true))
|
|
244
|
-
if (condition.path === '__always__') {
|
|
245
|
-
return { passed: true, value: true, key: '__always__' };
|
|
246
|
-
}
|
|
247
|
-
const result = this.getPropertyKeyValue(condition.path);
|
|
248
|
-
const key = result?.key ?? condition.path;
|
|
249
|
-
const value = result?.value;
|
|
250
|
-
let passed = false;
|
|
251
|
-
if (condition.dependsOn) {
|
|
252
|
-
// Use custom condition function
|
|
253
|
-
passed = condition.dependsOn(value);
|
|
254
|
-
}
|
|
255
|
-
else if (condition.expectedValue !== undefined) {
|
|
256
|
-
// Use simple equality check
|
|
257
|
-
passed = value === condition.expectedValue;
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
// Default: truthy check
|
|
261
|
-
passed = !!value;
|
|
262
|
-
}
|
|
263
|
-
// Apply negation if negate flag is set (from not() helper)
|
|
264
|
-
if (condition.negate) {
|
|
265
|
-
passed = !passed;
|
|
266
|
-
}
|
|
267
|
-
return { passed, value, key };
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Translates and attaches a message to a schema property.
|
|
271
|
-
* Supports both the new `MessageConfig` format (from `msg()` helper) and the legacy `DependsOnMessage` format.
|
|
272
|
-
*
|
|
273
|
-
* @param condition - The decorator metadata or enum value condition containing the message definition
|
|
274
|
-
* @param decoratedClass - The decorated class instance, used for legacy function-based message text
|
|
275
|
-
* @param definition - The schema property definition to attach the message to
|
|
276
|
-
* @param i18nProperties - Context for i18n translation (propertyName, evaluation context)
|
|
277
|
-
* @param i18nProperties.propertyName - The property name used as i18n parameter
|
|
278
|
-
* @param i18nProperties.context - The evaluation context string used as i18n parameter
|
|
279
|
-
*/
|
|
280
|
-
addConditionalMessage(condition, decoratedClass, definition, i18nProperties) {
|
|
281
|
-
// Handle new MessageConfig format (from msg() helper)
|
|
282
|
-
const metadata = condition;
|
|
283
|
-
if (metadata.messageConfig && (0, decoration_1.isMessageConfig)(metadata.messageConfig)) {
|
|
284
|
-
// Resolve any PathNode values in the params
|
|
285
|
-
const resolvedParams = this.resolveMessageParams(metadata.messageConfig.params);
|
|
286
|
-
const messageText = i18next_1.default.t(metadata.messageConfig.i18nKey, resolvedParams);
|
|
287
|
-
addMessageToSchema(definition, { text: messageText, deletable: metadata.messageConfig.deletable });
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
// Handle legacy DependsOnMessage format
|
|
291
|
-
if (!condition.message) {
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
let messageText;
|
|
295
|
-
if (typeof condition.message.text === 'function') {
|
|
296
|
-
messageText = condition.message.text(decoratedClass);
|
|
297
|
-
}
|
|
298
|
-
else if (typeof condition.message.text === 'string') {
|
|
299
|
-
messageText = condition.message.text;
|
|
300
|
-
}
|
|
301
|
-
else if (condition.message.text === true) {
|
|
302
|
-
// true means use default i18n translation
|
|
303
|
-
messageText = i18next_1.default.t('PROPERTY_NOT_ALLOWED', { ...i18nProperties });
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
messageText = i18next_1.default.t('PROPERTY_NOT_ALLOWED', { ...i18nProperties });
|
|
307
|
-
}
|
|
308
|
-
addMessageToSchema(definition, { text: messageText, deletable: condition.message.deletable });
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Resolves any `PathNode` values in message params to their actual values from the decorator context.
|
|
312
|
-
*
|
|
313
|
-
* @param params - Message parameters that may contain PathNode references
|
|
314
|
-
* @returns A new params object with PathNode values replaced by their resolved context values
|
|
315
|
-
*/
|
|
316
|
-
resolveMessageParams(params) {
|
|
317
|
-
if (!params) {
|
|
318
|
-
return params;
|
|
319
|
-
}
|
|
320
|
-
const resolved = {};
|
|
321
|
-
for (const [key, value] of Object.entries(params)) {
|
|
322
|
-
if ((0, decoration_1.isPathNode)(value)) {
|
|
323
|
-
// Resolve PathNode to actual value
|
|
324
|
-
const result = this.getPropertyKeyValue((0, decoration_1.getPath)(value));
|
|
325
|
-
resolved[key] = result?.value ?? '';
|
|
326
|
-
}
|
|
327
|
-
else {
|
|
328
|
-
resolved[key] = value;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return resolved;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Builds a human-readable context string from the evaluation results that did not pass.
|
|
335
|
-
* Used for diagnostic messages showing which conditions were unmet.
|
|
336
|
-
*
|
|
337
|
-
* @param results - The condition evaluation results to summarize
|
|
338
|
-
* @returns A comma-separated string of `key: value` pairs for failed conditions
|
|
339
|
-
*/
|
|
340
|
-
getContextForMessage(results) {
|
|
341
|
-
return results
|
|
342
|
-
.filter((result) => !result.passed)
|
|
343
|
-
.map((result) => `${result.key}: ${result.value}`)
|
|
344
|
-
.join(', ');
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Evaluates one item inside an AND group — either a single condition or a nested OR group.
|
|
348
|
-
*
|
|
349
|
-
* @param conditionItem - A single condition or a nested `{ __orConditions }` group
|
|
350
|
-
* @returns Whether the item passed and the detailed evaluation results
|
|
351
|
-
*/
|
|
352
|
-
evaluateAndConditionItem(conditionItem) {
|
|
353
|
-
// Check if this is a nested OR group
|
|
354
|
-
if ((0, decoration_1.isOrConditionGroup)(conditionItem)) {
|
|
355
|
-
// Evaluate the nested OR - at least one must pass
|
|
356
|
-
return this.evaluateOrConditions(conditionItem.__orConditions);
|
|
357
|
-
}
|
|
358
|
-
// It's a single condition
|
|
359
|
-
const result = this.evaluateSingleCondition(conditionItem);
|
|
360
|
-
return { passed: result.passed, results: [result] };
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Evaluates OR conditions — passes when at least one item (single condition or nested AND group) matches.
|
|
364
|
-
* Short-circuits on the first passing item.
|
|
365
|
-
*
|
|
366
|
-
* @param orConditions - Array of conditions or nested AND groups to evaluate
|
|
367
|
-
* @returns Whether any condition passed and the collected evaluation results
|
|
368
|
-
*/
|
|
369
|
-
evaluateOrConditions(orConditions) {
|
|
370
|
-
const allResults = [];
|
|
371
|
-
for (const conditionItem of orConditions) {
|
|
372
|
-
// Check if this is a nested AND group
|
|
373
|
-
if ((0, decoration_1.isAndConditionGroup)(conditionItem)) {
|
|
374
|
-
// Evaluate all conditions in the AND group - all must pass
|
|
375
|
-
const andResults = [];
|
|
376
|
-
let allAndPassed = true;
|
|
377
|
-
for (const andItem of conditionItem.__andConditions) {
|
|
378
|
-
const { passed, results } = this.evaluateAndConditionItem(andItem);
|
|
379
|
-
andResults.push(...results);
|
|
380
|
-
if (!passed) {
|
|
381
|
-
allAndPassed = false;
|
|
382
|
-
// Don't break - we want all results for context
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
allResults.push(...andResults);
|
|
386
|
-
if (allAndPassed) {
|
|
387
|
-
// Short-circuit: if this AND group passes, the OR passes
|
|
388
|
-
return { passed: true, results: allResults };
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
392
|
-
// Single condition (symmetric with AND handling)
|
|
393
|
-
const result = this.evaluateSingleCondition(conditionItem);
|
|
394
|
-
allResults.push(result);
|
|
395
|
-
if (result.passed) {
|
|
396
|
-
// Short-circuit: if any condition passes, the OR passes
|
|
397
|
-
return { passed: true, results: allResults };
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return { passed: false, results: allResults };
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Evaluates AND conditions — passes only when every item (single condition or nested OR group) matches.
|
|
405
|
-
* Continues even after a failure to collect all results for diagnostic context.
|
|
406
|
-
*
|
|
407
|
-
* @param andConditions - Array of conditions or nested OR groups that must all pass
|
|
408
|
-
* @returns Whether all conditions passed and the collected evaluation results
|
|
409
|
-
*/
|
|
410
|
-
evaluateAndConditions(andConditions) {
|
|
411
|
-
const allResults = [];
|
|
412
|
-
let allPassed = true;
|
|
413
|
-
for (const conditionItem of andConditions) {
|
|
414
|
-
const { passed, results } = this.evaluateAndConditionItem(conditionItem);
|
|
415
|
-
allResults.push(...results);
|
|
416
|
-
if (!passed) {
|
|
417
|
-
allPassed = false;
|
|
418
|
-
// Continue to collect all results for context
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
return { passed: allPassed, results: allResults };
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Entry point for condition evaluation. Dispatches to OR, AND, or single evaluation
|
|
425
|
-
* depending on the shape of the condition metadata.
|
|
426
|
-
*
|
|
427
|
-
* @param conditionInfo - The decorator condition metadata (single, AND, or OR)
|
|
428
|
-
* @returns Whether the condition passed and a diagnostic context string
|
|
429
|
-
*/
|
|
430
|
-
evaluateCondition(conditionInfo) {
|
|
431
|
-
let passed = false;
|
|
432
|
-
let context = '';
|
|
433
|
-
if (conditionInfo.orConditions && Array.isArray(conditionInfo.orConditions)) {
|
|
434
|
-
// OR logic: At least one condition object must match
|
|
435
|
-
const result = this.evaluateOrConditions(conditionInfo.orConditions);
|
|
436
|
-
passed = result.passed;
|
|
437
|
-
context = this.getContextForMessage(result.results);
|
|
438
|
-
}
|
|
439
|
-
else if (conditionInfo.conditions && Array.isArray(conditionInfo.conditions)) {
|
|
440
|
-
// Multi-condition: ALL must be met (AND logic)
|
|
441
|
-
// Now supports nested OR groups via evaluateAndConditions
|
|
442
|
-
const result = this.evaluateAndConditions(conditionInfo.conditions);
|
|
443
|
-
passed = result.passed;
|
|
444
|
-
context = this.getContextForMessage(result.results);
|
|
445
|
-
}
|
|
446
|
-
else if (conditionInfo.path) {
|
|
447
|
-
// Single condition
|
|
448
|
-
const result = this.evaluateSingleCondition(conditionInfo);
|
|
449
|
-
passed = result.passed;
|
|
450
|
-
context = this.getContextForMessage([result]);
|
|
451
|
-
}
|
|
452
|
-
return { passed, context };
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Yields each property from a schema definition for decorator processing.
|
|
456
|
-
* Returns early if the definition has no properties or the target is falsy.
|
|
457
|
-
*
|
|
458
|
-
* @param schemaDefinition - The schema definition whose properties to iterate
|
|
459
|
-
* @param target - Guard object — iteration is skipped if falsy
|
|
460
|
-
* @yields Property name and its definition for each property in the schema
|
|
461
|
-
*/
|
|
462
|
-
*iterateProperties(schemaDefinition, target) {
|
|
463
|
-
if (!schemaDefinition?.properties || !target) {
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
for (const propertyName in schemaDefinition.properties) {
|
|
467
|
-
const property = schemaDefinition.properties[propertyName];
|
|
468
|
-
yield { propertyName, property };
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Hides properties whose `@hide` conditions pass.
|
|
473
|
-
* Multiple `@hide` decorators use OR semantics — any passing condition hides the property.
|
|
474
|
-
* Skipped when the `@message` decorator already added messages to the property.
|
|
475
|
-
*
|
|
476
|
-
* @param schemaDefinition - The schema definition to process
|
|
477
|
-
* @param decoratedClass - The decorated class instance carrying `@hide` metadata
|
|
478
|
-
*/
|
|
479
|
-
applyHideDecorator(schemaDefinition, decoratedClass) {
|
|
480
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
481
|
-
const hideConditions = Reflect.getMetadata(decoration_1.metadataKeys.hide, decoratedClass, propertyName);
|
|
482
|
-
if (hideConditions) {
|
|
483
|
-
// Hide when ANY condition IS met (OR semantics across multiple @hide decorators)
|
|
484
|
-
// But only if no messages were added by the message decorator
|
|
485
|
-
const hasMessages = Array.isArray(property[ux_specification_types_1.SchemaTag.messages]) && property[ux_specification_types_1.SchemaTag.messages].length > 0;
|
|
486
|
-
for (const condition of hideConditions) {
|
|
487
|
-
const { passed } = this.evaluateCondition(condition);
|
|
488
|
-
if (passed && !hasMessages) {
|
|
489
|
-
property[ux_specification_types_1.SchemaTag.hidden] = true;
|
|
490
|
-
break;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Shows messages on properties whose `@message` conditions pass.
|
|
498
|
-
* Must run before `applyHideDecorator` so hide can detect existing messages.
|
|
499
|
-
*
|
|
500
|
-
* @param schemaDefinition - The schema definition to process
|
|
501
|
-
* @param decoratedClass - The decorated class instance carrying `@message` metadata
|
|
502
|
-
*/
|
|
503
|
-
applyMessageDecorator(schemaDefinition, decoratedClass) {
|
|
504
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
505
|
-
const messageConditions = Reflect.getMetadata(decoration_1.metadataKeys.message, decoratedClass, propertyName);
|
|
506
|
-
if (messageConditions) {
|
|
507
|
-
for (const condition of messageConditions) {
|
|
508
|
-
const { passed, context } = this.evaluateCondition(condition);
|
|
509
|
-
if (passed && (condition.message || condition.messageConfig)) {
|
|
510
|
-
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
511
|
-
propertyName,
|
|
512
|
-
context
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* Marks properties as read-only whose `@readonly` conditions pass.
|
|
521
|
-
* Multiple `@readonly` decorators use OR semantics — any passing condition makes the property read-only.
|
|
522
|
-
*
|
|
523
|
-
* @param schemaDefinition - The schema definition to process
|
|
524
|
-
* @param decoratedClass - The decorated class instance carrying `@readonly` metadata
|
|
525
|
-
*/
|
|
526
|
-
applyReadonlyDecorator(schemaDefinition, decoratedClass) {
|
|
527
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
528
|
-
const readonlyConditions = Reflect.getMetadata(decoration_1.metadataKeys.readonly, decoratedClass, propertyName);
|
|
529
|
-
if (readonlyConditions) {
|
|
530
|
-
// Readonly when ANY condition IS met (OR semantics across multiple @readonly decorators)
|
|
531
|
-
for (const condition of readonlyConditions) {
|
|
532
|
-
const { passed } = this.evaluateCondition(condition);
|
|
533
|
-
if (passed) {
|
|
534
|
-
property.readOnly = true;
|
|
535
|
-
break;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Restricts enum values on properties whose `@enums` conditions pass.
|
|
543
|
-
* When multiple `@enums` decorators exist on the same property, the first matching condition wins.
|
|
544
|
-
*
|
|
545
|
-
* @param schemaDefinition - The schema definition to process
|
|
546
|
-
* @param decoratedClass - The decorated class instance carrying `@enums` metadata
|
|
547
|
-
*/
|
|
548
|
-
applyEnumsDecorator(schemaDefinition, decoratedClass) {
|
|
549
|
-
for (const { propertyName, property } of this.iterateProperties(schemaDefinition, decoratedClass)) {
|
|
550
|
-
const enumsConditions = Reflect.getMetadata(decoration_1.metadataKeys.enums, decoratedClass, propertyName);
|
|
551
|
-
if (!enumsConditions?.length) {
|
|
552
|
-
continue;
|
|
553
|
-
}
|
|
554
|
-
// Find first matching condition (first match wins)
|
|
555
|
-
for (const condition of enumsConditions) {
|
|
556
|
-
const { passed } = this.evaluateCondition(condition);
|
|
557
|
-
if (passed) {
|
|
558
|
-
const currentEnumValues = this.resolveEnumFromProperty(property);
|
|
559
|
-
if (currentEnumValues) {
|
|
560
|
-
// Filter to only allowed values that exist in original enum
|
|
561
|
-
const filteredValues = condition.allowedValues.filter((v) => currentEnumValues.includes(v));
|
|
562
|
-
this.applyFilteredEnumToProperty(property, filteredValues);
|
|
563
|
-
}
|
|
564
|
-
break; // First match wins, stop processing
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Reads the `@validity` metadata stored on a property of the decorated class.
|
|
571
|
-
*
|
|
572
|
-
* @param target - The decorated class instance
|
|
573
|
-
* @param propertyName - The property to read validity metadata from
|
|
574
|
-
* @returns The validity constraints (since, enum restrictions), or undefined if none
|
|
575
|
-
*/
|
|
576
|
-
getValidityMetadata(target, propertyName) {
|
|
577
|
-
let validityInfo;
|
|
578
|
-
if (target) {
|
|
579
|
-
validityInfo = Reflect.getMetadata(decoration_1.metadataKeys.validity, target, propertyName);
|
|
580
|
-
}
|
|
581
|
-
return validityInfo;
|
|
582
|
-
}
|
|
583
|
-
/**
|
|
584
|
-
* Returns the enum values from a property definition, resolving `$ref` to a shared enum definition if needed.
|
|
585
|
-
*
|
|
586
|
-
* @param property - The schema property definition (may have inline `enum` or a `$ref`)
|
|
587
|
-
* @returns The enum values array, or undefined if the property is not an enum
|
|
588
|
-
*/
|
|
589
|
-
resolveEnumFromProperty(property) {
|
|
590
|
-
// Check for inline enum
|
|
591
|
-
if (property?.enum && Array.isArray(property.enum)) {
|
|
592
|
-
return property.enum;
|
|
593
|
-
}
|
|
594
|
-
// Check for $ref to an enum definition
|
|
595
|
-
if (property?.$ref) {
|
|
596
|
-
const refName = property.$ref.replace('#/definitions/', '');
|
|
597
|
-
const schema = this.appSchema?.get();
|
|
598
|
-
const refDef = schema?.definitions?.[refName];
|
|
599
|
-
if (refDef?.enum && Array.isArray(refDef.enum)) {
|
|
600
|
-
return refDef.enum;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
return undefined;
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* Writes filtered enum values to a property definition.
|
|
607
|
-
* For `$ref` properties, inlines the enum, copies the type, and removes the `$ref`.
|
|
608
|
-
*
|
|
609
|
-
* @param property - The schema property definition to update
|
|
610
|
-
* @param filteredEnum - The allowed enum values after filtering
|
|
611
|
-
*/
|
|
612
|
-
applyFilteredEnumToProperty(property, filteredEnum) {
|
|
613
|
-
if (property.$ref) {
|
|
614
|
-
// For $ref properties, resolve the referenced definition to get the type
|
|
615
|
-
const refName = property.$ref.replace('#/definitions/', '');
|
|
616
|
-
const schema = this.appSchema?.get();
|
|
617
|
-
const refDef = schema?.definitions?.[refName];
|
|
618
|
-
// Copy the type from the referenced definition if it exists
|
|
619
|
-
if (refDef?.type) {
|
|
620
|
-
property.type = refDef.type;
|
|
621
|
-
}
|
|
622
|
-
// Remove the $ref and inline the filtered enum
|
|
623
|
-
delete property.$ref;
|
|
624
|
-
property.enum = filteredEnum;
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
// For inline enum properties, update directly
|
|
628
|
-
property.enum = filteredEnum;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Hides properties and filters enum values that require a UI5 version higher than the app's minimum.
|
|
633
|
-
*
|
|
634
|
-
* @param schemaDefinition - The schema definition to process
|
|
635
|
-
* @param decoratedClass - The decorated class instance carrying `@validity` metadata
|
|
636
|
-
* @param minUI5Version - The app's minimum UI5 version to check against
|
|
637
|
-
*/
|
|
638
|
-
applyValidityDecorator(schemaDefinition, decoratedClass, minUI5Version) {
|
|
639
|
-
if (!schemaDefinition?.properties || !decoratedClass || !minUI5Version) {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
for (const propertyName in schemaDefinition.properties) {
|
|
643
|
-
const property = schemaDefinition.properties[propertyName];
|
|
644
|
-
const validityInfo = this.getValidityMetadata(decoratedClass, propertyName);
|
|
645
|
-
// Check if property has a 'since' requirement that exceeds the app's minUI5Version
|
|
646
|
-
if (validityInfo?.since && !(0, utils_1.compareUI5Versions)(minUI5Version, validityInfo.since)) {
|
|
647
|
-
property[ux_specification_types_1.SchemaTag.hidden] = true;
|
|
648
|
-
// possible message?
|
|
649
|
-
}
|
|
650
|
-
// Process enum validity configuration from @validity decorator
|
|
651
|
-
// Supports both inline enums and $ref to enum definitions
|
|
652
|
-
if (validityInfo?.enum) {
|
|
653
|
-
const enumValues = this.resolveEnumFromProperty(property);
|
|
654
|
-
if (enumValues) {
|
|
655
|
-
const filteredEnum = enumValues.filter((enumValue) => {
|
|
656
|
-
const enumValueStr = String(enumValue);
|
|
657
|
-
const condition = validityInfo.enum[enumValueStr];
|
|
658
|
-
if (!condition) {
|
|
659
|
-
return true; // Keep values without conditions
|
|
660
|
-
}
|
|
661
|
-
// Check UI5 version requirement (if specified)
|
|
662
|
-
if (condition.since && minUI5Version) {
|
|
663
|
-
if (!(0, utils_1.compareUI5Versions)(minUI5Version, condition.since)) {
|
|
664
|
-
if (condition.message) {
|
|
665
|
-
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
666
|
-
propertyName: enumValueStr
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
return false; // Version requirement not met
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
// Check property dependency using dependsOn function
|
|
673
|
-
if (condition.dependsOn) {
|
|
674
|
-
if (!condition.dependsOn(decoratedClass)) {
|
|
675
|
-
if (condition.message) {
|
|
676
|
-
this.addConditionalMessage(condition, decoratedClass, property, {
|
|
677
|
-
propertyName: enumValueStr
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
|
-
return false; // Dependency condition not met
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
return true;
|
|
684
|
-
});
|
|
685
|
-
// Only update if enum was actually filtered
|
|
686
|
-
if (filteredEnum.length !== enumValues.length) {
|
|
687
|
-
this.applyFilteredEnumToProperty(property, filteredEnum);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
/**
|
|
694
|
-
* Marks the schema definition as a view node if the `@isViewNode` decorator is present on the target.
|
|
695
|
-
*
|
|
696
|
-
* @param schemaDefinition - The schema definition to tag
|
|
697
|
-
* @param target - The class constructor or prototype carrying the decorator
|
|
698
|
-
* @param propertyName - Optional property name for property-level decorators
|
|
699
|
-
*/
|
|
700
|
-
applyIsViewNodeDecorator(schemaDefinition, target, propertyName) {
|
|
701
|
-
const isViewNode = Reflect.getMetadata(decoration_1.metadataKeys.isViewNode, target, propertyName);
|
|
702
|
-
if (isViewNode !== undefined) {
|
|
703
|
-
schemaDefinition[ux_specification_types_1.SchemaTag.isViewNode] = isViewNode;
|
|
704
|
-
schemaDefinition.properties = schemaDefinition.properties || {};
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
/**
|
|
708
|
-
* Sets the schema `description` field from the `@description` decorator if present on the target.
|
|
709
|
-
*
|
|
710
|
-
* @param schemaDefinition - The schema definition to update
|
|
711
|
-
* @param target - The class constructor or prototype carrying the decorator
|
|
712
|
-
* @param propertyName - Optional property name for property-level decorators
|
|
713
|
-
*/
|
|
714
|
-
applyDescriptionDecorator(schemaDefinition, target, propertyName) {
|
|
715
|
-
const description = Reflect.getMetadata(decoration_1.metadataKeys.description, target, propertyName);
|
|
716
|
-
if (description !== undefined) {
|
|
717
|
-
schemaDefinition.description = description;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* Applies all decorators to the schema in the correct order:
|
|
722
|
-
* description → isViewNode → validity → enums → message → hide → readonly.
|
|
723
|
-
* Message runs before hide so that hide can skip properties that already have messages.
|
|
724
|
-
*
|
|
725
|
-
* @param minUi5Version - The app's minimum UI5 version for validity checks
|
|
726
|
-
* @param propertyName - Optional property name when decorating a single property
|
|
727
|
-
* @param customDefinition - Override the schema definition (defaults to `getBase()`)
|
|
728
|
-
* @returns The decorated schema definition
|
|
729
|
-
*/
|
|
730
|
-
applyDecorators(minUi5Version, propertyName, customDefinition) {
|
|
731
|
-
const definition = customDefinition ?? this.getBase();
|
|
732
|
-
if (!definition) {
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
const target = propertyName ? this : this.constructor;
|
|
736
|
-
// Apply description decorator
|
|
737
|
-
this.applyDescriptionDecorator(definition, target, propertyName);
|
|
738
|
-
// Apply isViewNode decorator
|
|
739
|
-
this.applyIsViewNodeDecorator(definition, target, propertyName);
|
|
740
|
-
// Apply validity decorator (for properties)
|
|
741
|
-
this.applyValidityDecorator(definition, this, minUi5Version);
|
|
742
|
-
// Apply enums decorator - filter enum values based on conditions
|
|
743
|
-
this.applyEnumsDecorator(definition, this);
|
|
744
|
-
// Apply message decorator - show messages based on conditions
|
|
745
|
-
// NOTE: Message decorator must run before hide decorator so hide can check for messages
|
|
746
|
-
this.applyMessageDecorator(definition, this);
|
|
747
|
-
// Apply hide decorator - hide properties based on conditions
|
|
748
|
-
// NOTE: Only hides if message decorator did not add any messages
|
|
749
|
-
this.applyHideDecorator(definition, this);
|
|
750
|
-
// Apply readonly decorator - mark properties as readonly based on conditions
|
|
751
|
-
this.applyReadonlyDecorator(definition, this);
|
|
752
|
-
return { definition };
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
exports.Decorator = Decorator;
|
|
756
3
|
//# sourceMappingURL=DecoratorClass.js.map
|