@sap/ux-specification 1.142.2 → 1.142.4
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 +117 -43
- 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 +288 -282
- package/dist/index-min.js.map +4 -4
- package/dist/schemas/v2/AnalyticalListPageConfig.json +3 -3
- package/dist/schemas/v2/ListReportConfig.json +5 -5
- package/dist/schemas/v2/ListReportNewConfig.json +1 -1
- package/dist/schemas/v2/ObjectPageConfig.json +5 -5
- package/dist/schemas/v4/ApplicationV4.json +1 -1
- package/dist/schemas/v4/BuildingBlocksConfig.json +128 -42
- package/dist/schemas/v4/ListReportConfig.json +24 -6
- package/dist/schemas/v4/ObjectPageConfig.json +32 -8
- package/dist/specification/package.json +14 -12
- package/dist/specification/scripts/extractDocu.js +18 -1
- package/dist/specification/scripts/extractDocu.js.map +1 -1
- package/dist/specification/scripts/generate-validity-report.d.ts +15 -0
- package/dist/specification/scripts/generate-validity-report.d.ts.map +1 -0
- package/dist/specification/scripts/generate-validity-report.js +367 -0
- package/dist/specification/scripts/generate-validity-report.js.map +1 -0
- package/dist/specification/scripts/macros/corrections.d.ts.map +1 -1
- package/dist/specification/scripts/macros/corrections.js +36 -1
- 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 +13 -0
- package/dist/specification/scripts/macros/schema.js.map +1 -1
- package/dist/specification/src/api.js +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/ManifestDrivenSchemaProcessor.d.ts +8 -1
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.d.ts.map +1 -1
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.js +10 -7
- package/dist/specification/src/sync/common/ManifestDrivenSchemaProcessor.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts +503 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.d.ts.map +1 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.js +497 -0
- package/dist/specification/src/sync/common/decoration/decorator-paths.js.map +1 -0
- package/dist/specification/src/sync/common/decoration/decorators.d.ts +116 -24
- package/dist/specification/src/sync/common/decoration/decorators.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/decorators.js +308 -78
- package/dist/specification/src/sync/common/decoration/decorators.js.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.d.ts +1 -0
- package/dist/specification/src/sync/common/decoration/index.d.ts.map +1 -1
- package/dist/specification/src/sync/common/decoration/index.js +1 -0
- package/dist/specification/src/sync/common/decoration/index.js.map +1 -1
- package/dist/specification/src/sync/common/dist_tag.json +8 -3
- package/dist/specification/src/sync/common/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/common/generate/objectPage.js +3 -1
- package/dist/specification/src/sync/common/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/common/i18n.json +2 -1
- package/dist/specification/src/sync/common/rules.d.ts +25 -0
- package/dist/specification/src/sync/common/rules.d.ts.map +1 -1
- package/dist/specification/src/sync/common/rules.js +27 -2
- package/dist/specification/src/sync/common/rules.js.map +1 -1
- package/dist/specification/src/sync/common/utils.d.ts +22 -6
- package/dist/specification/src/sync/common/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/common/utils.js +122 -18
- package/dist/specification/src/sync/common/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js +9 -7
- package/dist/specification/src/sync/v2/generate/analyticalListReport.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/listReport.js +3 -1
- package/dist/specification/src/sync/v2/generate/listReport.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 +58 -2
- package/dist/specification/src/sync/v2/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.d.ts +1 -9
- package/dist/specification/src/sync/v2/generate/overviewPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.js +30 -1
- package/dist/specification/src/sync/v2/generate/overviewPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/app/appProvider.js +2 -0
- package/dist/specification/src/sync/v2/import/app/appProvider.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.d.ts +2 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.js +5 -0
- package/dist/specification/src/sync/v2/import/pages/analyticalListPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.d.ts +2 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/listReport.js +5 -0
- package/dist/specification/src/sync/v2/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.js +2 -1
- package/dist/specification/src/sync/v2/import/pages/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v2/import/utils.d.ts +28 -1
- package/dist/specification/src/sync/v2/import/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/import/utils.js +37 -0
- package/dist/specification/src/sync/v2/import/utils.js.map +1 -1
- package/dist/specification/src/sync/v2/utils.d.ts +12 -2
- package/dist/specification/src/sync/v2/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v2/utils.js +19 -2
- package/dist/specification/src/sync/v2/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/application.d.ts +31 -2
- package/dist/specification/src/sync/v4/application.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/application.js +44 -4
- package/dist/specification/src/sync/v4/application.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js +2 -1
- package/dist/specification/src/sync/v4/export/controls/FilterBar.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts +4 -3
- package/dist/specification/src/sync/v4/export/controls/Header.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Header.js +7 -3
- package/dist/specification/src/sync/v4/export/controls/Header.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js +7 -0
- package/dist/specification/src/sync/v4/export/controls/HeaderAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts +2 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js +2 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageCustomSection.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js +0 -13
- package/dist/specification/src/sync/v4/export/controls/ObjectPageTable.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts +32 -17
- package/dist/specification/src/sync/v4/export/controls/Table.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/Table.js +90 -60
- package/dist/specification/src/sync/v4/export/controls/Table.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js +2 -2
- package/dist/specification/src/sync/v4/export/controls/TableColumn.js.map +1 -1
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.d.ts +2 -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 +4 -3
- package/dist/specification/src/sync/v4/export/controls/ToolBarAction.js.map +1 -1
- package/dist/specification/src/sync/v4/export/export.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/export/export.js +25 -3
- package/dist/specification/src/sync/v4/export/export.js.map +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js +1 -1
- package/dist/specification/src/sync/v4/export/pages/ListReport.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/actions.d.ts +1 -1
- package/dist/specification/src/sync/v4/generate/actions.d.ts.map +1 -1
- 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 +20 -12
- 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/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js +10 -1
- package/dist/specification/src/sync/v4/generate/fpm-custom-page/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/index.d.ts +1 -1
- package/dist/specification/src/sync/v4/generate/index.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/index.js +1 -1
- package/dist/specification/src/sync/v4/generate/index.js.map +1 -1
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts +73 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js +354 -0
- package/dist/specification/src/sync/v4/generate/list-report/ListReportUtils.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/{listReport.d.ts → list-report/listReport.d.ts} +27 -16
- package/dist/specification/src/sync/v4/generate/list-report/listReport.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/generate/{listReport.js → list-report/listReport.js} +194 -164
- package/dist/specification/src/sync/v4/generate/list-report/listReport.js.map +1 -0
- package/dist/specification/src/sync/v4/generate/objectPage.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/generate/objectPage.js +145 -44
- package/dist/specification/src/sync/v4/generate/objectPage.js.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js +2 -1
- package/dist/specification/src/sync/v4/import/pages/listReport.js.map +1 -1
- package/dist/specification/src/sync/v4/import/utils.js +5 -3
- package/dist/specification/src/sync/v4/import/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts +9 -7
- package/dist/specification/src/sync/v4/sync-rules/App.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/App.js +4 -8
- 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 -9
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js +2 -11
- package/dist/specification/src/sync/v4/sync-rules/AppSchema.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts +219 -96
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js +557 -211
- package/dist/specification/src/sync/v4/sync-rules/DecoratorClass.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts +17 -22
- package/dist/specification/src/sync/v4/sync-rules/Page.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/Page.js +15 -22
- package/dist/specification/src/sync/v4/sync-rules/Page.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.d.ts +1 -0
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.js +17 -9
- package/dist/specification/src/sync/v4/sync-rules/controllerExtensions.js.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/index.d.ts +5 -0
- package/dist/specification/src/sync/v4/sync-rules/index.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/index.js +21 -0
- package/dist/specification/src/sync/v4/sync-rules/index.js.map +1 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/sync-rules/utils.js +4 -0
- package/dist/specification/src/sync/v4/sync-rules/utils.js.map +1 -1
- package/dist/specification/src/sync/v4/utils/index.d.ts +2 -0
- package/dist/specification/src/sync/v4/utils/index.d.ts.map +1 -0
- package/dist/specification/src/sync/v4/utils/index.js +18 -0
- package/dist/specification/src/sync/v4/utils/index.js.map +1 -0
- package/dist/specification/src/sync/v4/utils/utils.d.ts +9 -1
- package/dist/specification/src/sync/v4/utils/utils.d.ts.map +1 -1
- package/dist/specification/src/sync/v4/utils/utils.js +17 -2
- package/dist/specification/src/sync/v4/utils/utils.js.map +1 -1
- package/dist/specification/test/test-projects/v2sttaProdMan2/webapp/manifest.json +550 -0
- package/dist/specification/test/test-projects/v4new/webapp/manifest.json +147 -0
- package/dist/specification/test/test-utils/utils.d.ts +71 -0
- package/dist/specification/test/test-utils/utils.d.ts.map +1 -0
- package/dist/specification/test/test-utils/utils.js +400 -0
- package/dist/specification/test/test-utils/utils.js.map +1 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts +131 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.d.ts.map +1 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.js +661 -0
- package/dist/specification/test/unit/decorators/validity-test-utils.js.map +1 -0
- package/dist/types/src/apiTypes.d.ts +2 -3
- package/dist/types/src/apiTypes.d.ts.map +1 -1
- package/dist/types/src/apiTypes.js.map +1 -1
- package/dist/types/src/common/types.d.ts +119 -13
- 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/v2/controls/ObjectPageTable.d.ts +1 -1
- package/dist/types/src/v2/controls/Table.d.ts +1 -1
- package/dist/types/src/v4/controls/ObjectPageTable.d.ts +1 -1
- package/dist/types/src/v4/controls/ObjectPageTable.d.ts.map +1 -1
- package/dist/types/src/v4/controls/Table.d.ts +3 -3
- package/dist/types/src/v4/controls/Table.d.ts.map +1 -1
- package/package.json +14 -12
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts +0 -107
- package/dist/specification/src/sync/v4/generate/ListReportUtils.d.ts.map +0 -1
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js +0 -394
- package/dist/specification/src/sync/v4/generate/ListReportUtils.js.map +0 -1
- package/dist/specification/src/sync/v4/generate/listReport.d.ts.map +0 -1
- package/dist/specification/src/sync/v4/generate/listReport.js.map +0 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type-safe path builders and condition helpers for decorator conditions.
|
|
4
|
+
*
|
|
5
|
+
* This module provides:
|
|
6
|
+
*
|
|
7
|
+
* ## Context Sources
|
|
8
|
+
* - **`app`**: App-level configuration (auto-injected from `app.config`)
|
|
9
|
+
* - **`page`**: Page-level configuration (auto-injected from `page.config`)
|
|
10
|
+
* - **`custom`**: Custom context (provided via `init()`)
|
|
11
|
+
*
|
|
12
|
+
* ## Utilities
|
|
13
|
+
* - **Path builders**: Type-safe property access for `app`, `page`, and `custom` contexts
|
|
14
|
+
* - **Condition helpers**: `when()`, `not()`, `and()`, `or()` for building conditions
|
|
15
|
+
* - **Message helper**: `msg()` for i18n-based messages
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { page, custom, when, not, and, or, msg } from './decorator-paths';
|
|
20
|
+
*
|
|
21
|
+
* class MyTable extends Decorator {
|
|
22
|
+
* // Truthy check - hide when value is falsy
|
|
23
|
+
* @hide(page.isALP)
|
|
24
|
+
* alpOnlyField: string;
|
|
25
|
+
*
|
|
26
|
+
* // Equality check with when() - hide when type IS GridTable
|
|
27
|
+
* @hide(when(page.type, 'GridTable'))
|
|
28
|
+
* gridField: string;
|
|
29
|
+
*
|
|
30
|
+
* // Negation with not() - hide when type is NOT TreeTable
|
|
31
|
+
* @hide(not(page.type, 'TreeTable'))
|
|
32
|
+
* treeOnlyField: string;
|
|
33
|
+
*
|
|
34
|
+
* // AND conditions
|
|
35
|
+
* @hide(and(page.isALP, when(page.type, 'GridTable')))
|
|
36
|
+
* alpGridField: string;
|
|
37
|
+
*
|
|
38
|
+
* // OR conditions
|
|
39
|
+
* @hide(or(when(page.actionType, 'Bound'), when(page.actionType, 'Custom')))
|
|
40
|
+
* actionField: string;
|
|
41
|
+
*
|
|
42
|
+
* // Message with i18n
|
|
43
|
+
* @message(page.betaFeature, msg('BETA_WARNING', { feature: 'table' }))
|
|
44
|
+
* betaField: string;
|
|
45
|
+
*
|
|
46
|
+
* // Always hide
|
|
47
|
+
* @hide(true)
|
|
48
|
+
* internalField: string;
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.MSG_SYMBOL = exports.NOT_SYMBOL = exports.WHEN_SYMBOL = exports.tableContext = exports.custom = exports.page = exports.app = exports.PATH_SYMBOL = void 0;
|
|
54
|
+
exports.getPath = getPath;
|
|
55
|
+
exports.isPathNode = isPathNode;
|
|
56
|
+
exports.isWhenCondition = isWhenCondition;
|
|
57
|
+
exports.when = when;
|
|
58
|
+
exports.isNotCondition = isNotCondition;
|
|
59
|
+
exports.not = not;
|
|
60
|
+
exports.exists = exists;
|
|
61
|
+
exports.isMessageConfig = isMessageConfig;
|
|
62
|
+
exports.msg = msg;
|
|
63
|
+
exports.and = and;
|
|
64
|
+
exports.or = or;
|
|
65
|
+
exports.isAndCondition = isAndCondition;
|
|
66
|
+
exports.isOrCondition = isOrCondition;
|
|
67
|
+
exports.isConditionGroup = isConditionGroup;
|
|
68
|
+
exports.isOrConditionGroup = isOrConditionGroup;
|
|
69
|
+
exports.isAndConditionGroup = isAndConditionGroup;
|
|
70
|
+
// ============================================
|
|
71
|
+
// PATH NODE INFRASTRUCTURE
|
|
72
|
+
// ============================================
|
|
73
|
+
/**
|
|
74
|
+
* Symbol used to store the path string within PathNode objects.
|
|
75
|
+
* This allows the decorator to extract the path at runtime.
|
|
76
|
+
*
|
|
77
|
+
* Using Symbol.for() creates a global symbol that persists across module loads,
|
|
78
|
+
* ensuring isPathNode() works correctly even when the module is loaded multiple times.
|
|
79
|
+
*/
|
|
80
|
+
exports.PATH_SYMBOL = Symbol.for('decorator:pathNode');
|
|
81
|
+
/**
|
|
82
|
+
* Creates a type-safe path builder for a given context shape.
|
|
83
|
+
* Uses JavaScript Proxy to dynamically build paths with full TypeScript support.
|
|
84
|
+
*
|
|
85
|
+
* @template T - The shape type defining available properties
|
|
86
|
+
* @param prefix - The root prefix for all paths (e.g., 'app', 'page', 'custom')
|
|
87
|
+
* @returns A proxy object that builds typed paths
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* type MyShape = { enabled: boolean; settings: { mode: string } };
|
|
91
|
+
* const my = createPathBuilder<MyShape>('my');
|
|
92
|
+
*
|
|
93
|
+
* my.enabled[PATH_SYMBOL] // 'my.enabled'
|
|
94
|
+
* my.settings.mode[PATH_SYMBOL] // 'my.settings.mode'
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
function createPathBuilder(prefix) {
|
|
98
|
+
const handler = {
|
|
99
|
+
get(_, prop) {
|
|
100
|
+
if (prop === exports.PATH_SYMBOL) {
|
|
101
|
+
return prefix;
|
|
102
|
+
}
|
|
103
|
+
if (typeof prop === 'string') {
|
|
104
|
+
return createPathBuilder(`${prefix}.${prop}`);
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
},
|
|
108
|
+
// Add 'has' trap to make 'in' operator work with PathNode check
|
|
109
|
+
has(_, prop) {
|
|
110
|
+
return prop === exports.PATH_SYMBOL;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return new Proxy({}, handler);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Extracts the path string from a PathNode.
|
|
117
|
+
*
|
|
118
|
+
* @template P - The string literal type of the path
|
|
119
|
+
* @param node - The PathNode to extract the path from
|
|
120
|
+
* @returns The path string
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* getPath(page.isALP) // Returns: 'page.isALP'
|
|
124
|
+
* getPath(app.manifest) // Returns: 'app.manifest'
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
function getPath(node) {
|
|
128
|
+
return node[exports.PATH_SYMBOL];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Type guard to check if a value is a PathNode.
|
|
132
|
+
*
|
|
133
|
+
* @param value - The value to check
|
|
134
|
+
* @returns True if the value is a PathNode
|
|
135
|
+
*/
|
|
136
|
+
function isPathNode(value) {
|
|
137
|
+
return typeof value === 'object' && value !== null && exports.PATH_SYMBOL in value;
|
|
138
|
+
}
|
|
139
|
+
// ============================================
|
|
140
|
+
// PATH BUILDER EXPORTS
|
|
141
|
+
// ============================================
|
|
142
|
+
/**
|
|
143
|
+
* Path builder for app.config properties.
|
|
144
|
+
*
|
|
145
|
+
* This context is **auto-injected** from `app.config` - you do not need to
|
|
146
|
+
* provide it in the customContext parameter of `init()`.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* // Access manifest properties
|
|
151
|
+
* @hide(when(app.manifest['sap.app'].id, 'some-app-id'))
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
exports.app = createPathBuilder('app');
|
|
155
|
+
/**
|
|
156
|
+
* Path builder for page.config properties.
|
|
157
|
+
*
|
|
158
|
+
* This context is **auto-injected** from `page.config` - you do not need to
|
|
159
|
+
* provide it in the customContext parameter of `init()`.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* // Simple truthy check
|
|
164
|
+
* @hide(page.isALP)
|
|
165
|
+
*
|
|
166
|
+
* // Equality check with when()
|
|
167
|
+
* @hide(when(page.isALP, true))
|
|
168
|
+
* @hide(when(page.visualization, 'Chart'))
|
|
169
|
+
*
|
|
170
|
+
* // Nested property
|
|
171
|
+
* @hide(when(page.settings.enabled, false))
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
exports.page = createPathBuilder('page');
|
|
175
|
+
/**
|
|
176
|
+
* Path builder for custom context properties.
|
|
177
|
+
*
|
|
178
|
+
* This context **must be provided** in the customContext parameter of `init()`.
|
|
179
|
+
* Use this for runtime-specific conditions like table state, section state, etc.
|
|
180
|
+
*
|
|
181
|
+
* **Note**: For table-specific decorators, prefer using `tableContext` which provides
|
|
182
|
+
* full type safety for table properties.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* // In decorator
|
|
187
|
+
* @hide(when(custom.table.type, 'ResponsiveTable'))
|
|
188
|
+
* @hide(when(custom.table.views, (views) => views.length > 0))
|
|
189
|
+
*
|
|
190
|
+
* // In init
|
|
191
|
+
* decorator.init({
|
|
192
|
+
* table: { type: 'GridTable', views: [] }
|
|
193
|
+
* });
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
exports.custom = createPathBuilder('custom');
|
|
197
|
+
/**
|
|
198
|
+
* Type-safe path builder for table decorator context.
|
|
199
|
+
*
|
|
200
|
+
* This context **must be provided** in the customContext parameter of `init()`.
|
|
201
|
+
* Use this for table-specific conditions in List Report table decorators.
|
|
202
|
+
*
|
|
203
|
+
* Properties are accessed directly without nesting (e.g., `tableContext.type` not `tableContext.table.type`).
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* // In decorator - with full type safety
|
|
208
|
+
* @hide(when(tableContext.type, 'AnalyticalTable'))
|
|
209
|
+
* @hide(not(tableContext.type, 'TreeTable'))
|
|
210
|
+
* @hide(when(tableContext.creationMode, (cm) => cm?.name === 'CreationDialog'))
|
|
211
|
+
*
|
|
212
|
+
* // In init - provide flat context object
|
|
213
|
+
* decorator.init({
|
|
214
|
+
* type: 'GridTable',
|
|
215
|
+
* creationMode: { name: 'NewPage' },
|
|
216
|
+
* analyticalConfiguration: undefined,
|
|
217
|
+
* popinLayout: undefined
|
|
218
|
+
* });
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
exports.tableContext = createPathBuilder('custom');
|
|
222
|
+
// ============================================
|
|
223
|
+
// WHEN CONDITION HELPER
|
|
224
|
+
// ============================================
|
|
225
|
+
/**
|
|
226
|
+
* Symbol used to identify WhenCondition objects.
|
|
227
|
+
*/
|
|
228
|
+
exports.WHEN_SYMBOL = Symbol.for('decorator:when');
|
|
229
|
+
/**
|
|
230
|
+
* Type guard to check if a value is a WhenCondition.
|
|
231
|
+
*
|
|
232
|
+
* @param value - The value to check
|
|
233
|
+
* @returns True if value is a WhenCondition
|
|
234
|
+
*/
|
|
235
|
+
function isWhenCondition(value) {
|
|
236
|
+
return typeof value === 'object' && value !== null && exports.WHEN_SYMBOL in value;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Creates a condition that checks if a path's value matches an expected value or function.
|
|
240
|
+
*
|
|
241
|
+
* @param path - The PathNode to check
|
|
242
|
+
* @param expected - The expected value or a function that receives the value and returns boolean
|
|
243
|
+
* @returns A WhenCondition object
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* // Equality check
|
|
247
|
+
* @hide(when(page.type, 'GridTable'))
|
|
248
|
+
*
|
|
249
|
+
* // Custom function (e.g., negation)
|
|
250
|
+
* @hide(when(page.type, (type) => type !== 'GridTable'))
|
|
251
|
+
*
|
|
252
|
+
* // Check array length
|
|
253
|
+
* @hide(when(custom.table.views, (views) => views?.length === 0))
|
|
254
|
+
*
|
|
255
|
+
* // Numeric comparison
|
|
256
|
+
* @hide(when(page.count, (count) => count > 10))
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
function when(path, expected) {
|
|
260
|
+
return {
|
|
261
|
+
[exports.WHEN_SYMBOL]: true,
|
|
262
|
+
path,
|
|
263
|
+
expected
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
// ============================================
|
|
267
|
+
// NOT CONDITION HELPER
|
|
268
|
+
// ============================================
|
|
269
|
+
/**
|
|
270
|
+
* Symbol used to identify NotCondition objects.
|
|
271
|
+
*/
|
|
272
|
+
exports.NOT_SYMBOL = Symbol.for('decorator:not');
|
|
273
|
+
/**
|
|
274
|
+
* Type guard to check if a value is a NotCondition.
|
|
275
|
+
*
|
|
276
|
+
* @param value - The value to check
|
|
277
|
+
* @returns True if value is a NotCondition
|
|
278
|
+
*/
|
|
279
|
+
function isNotCondition(value) {
|
|
280
|
+
return typeof value === 'object' && value !== null && exports.NOT_SYMBOL in value;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Creates a negated condition that checks if a path's value does not match an expected value or function.
|
|
284
|
+
* This is the opposite of `when()`. While `when(path, value)` passes when value === expected,
|
|
285
|
+
* `not(path, value)` passes when value !== expected.
|
|
286
|
+
*
|
|
287
|
+
* Can also invert a WhenCondition created by `when()` or `exists()`.
|
|
288
|
+
*
|
|
289
|
+
* @param pathOrCondition - The PathNode to check or a WhenCondition to invert
|
|
290
|
+
* @param expected - Optional: The expected value or a function that receives the value and returns boolean
|
|
291
|
+
* @returns A NotCondition object
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* // Falsy check - hide when value is falsy
|
|
295
|
+
* @hide(not(page.enabled))
|
|
296
|
+
*
|
|
297
|
+
* // Inequality check - hide when type is NOT TreeTable
|
|
298
|
+
* @hide(not(page.type, 'TreeTable'))
|
|
299
|
+
*
|
|
300
|
+
* // Custom function negation - hide when function returns false
|
|
301
|
+
* @hide(not(custom.settings, (s) => s?.enabled === true))
|
|
302
|
+
*
|
|
303
|
+
* // Invert exists() - hide when value does NOT exist
|
|
304
|
+
* @hide(not(exists(tableContext.creationMode)))
|
|
305
|
+
*
|
|
306
|
+
* // Combined with and() - hide when BOTH conditions are met
|
|
307
|
+
* @hide(and(not(page.type, 'TreeTable'), page.isEnabled))
|
|
308
|
+
* ```
|
|
309
|
+
*/
|
|
310
|
+
function not(pathOrCondition, expected) {
|
|
311
|
+
// If first argument is a WhenCondition, extract its path and expected WITHOUT inverting
|
|
312
|
+
// The negate flag will handle inversion later in conditionToSingle
|
|
313
|
+
if (isWhenCondition(pathOrCondition)) {
|
|
314
|
+
const condition = pathOrCondition;
|
|
315
|
+
return {
|
|
316
|
+
[exports.NOT_SYMBOL]: true,
|
|
317
|
+
path: condition.path,
|
|
318
|
+
expected: condition.expected // Pass through without inversion - negate flag handles it
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
// Normal case: path + optional expected
|
|
322
|
+
return {
|
|
323
|
+
[exports.NOT_SYMBOL]: true,
|
|
324
|
+
path: pathOrCondition,
|
|
325
|
+
expected
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// ============================================
|
|
329
|
+
// EXISTS HELPER
|
|
330
|
+
// ============================================
|
|
331
|
+
/**
|
|
332
|
+
* Creates a condition that checks if a path's value exists (is not undefined).
|
|
333
|
+
* This is a semantic shorthand for `when(path, (value) => value !== undefined)`.
|
|
334
|
+
*
|
|
335
|
+
* @param path - The PathNode to check for existence
|
|
336
|
+
* @returns A WhenCondition that checks for defined value
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Check if property exists - show message only when value is set
|
|
340
|
+
* @message(
|
|
341
|
+
* and(
|
|
342
|
+
* not(tableContext.type, 'AnalyticalTable'),
|
|
343
|
+
* exists(tableContext.analyticalConfiguration.aggregationOnLeafLevel)
|
|
344
|
+
* ),
|
|
345
|
+
* msg('PROPERTY_NOT_ALLOWED')
|
|
346
|
+
* )
|
|
347
|
+
*
|
|
348
|
+
* // Can be negated with not() - though typically just use truthy check
|
|
349
|
+
* @hide(not(exists(tableContext.creationMode)))
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
function exists(path) {
|
|
353
|
+
return when(path, (value) => value !== undefined);
|
|
354
|
+
}
|
|
355
|
+
// ============================================
|
|
356
|
+
// MESSAGE HELPER
|
|
357
|
+
// ============================================
|
|
358
|
+
/**
|
|
359
|
+
* Symbol used to identify MessageConfig objects.
|
|
360
|
+
*/
|
|
361
|
+
exports.MSG_SYMBOL = Symbol.for('decorator:msg');
|
|
362
|
+
/**
|
|
363
|
+
* Type guard to check if a value is a MessageConfig.
|
|
364
|
+
*
|
|
365
|
+
* @param value - The value to check
|
|
366
|
+
* @returns True if value is a MessageConfig
|
|
367
|
+
*/
|
|
368
|
+
function isMessageConfig(value) {
|
|
369
|
+
return typeof value === 'object' && value !== null && exports.MSG_SYMBOL in value;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Creates an i18n message configuration for use with the `@message` decorator.
|
|
373
|
+
*
|
|
374
|
+
* @param i18nKey - The i18n translation key
|
|
375
|
+
* @param params - Optional parameters to pass to the translation function.
|
|
376
|
+
* Values can be static or PathNode references for dynamic resolution.
|
|
377
|
+
* @param options - Optional configuration
|
|
378
|
+
* @param options.deletable - Whether the message can be dismissed/deleted in the UI (default: false)
|
|
379
|
+
* @returns A MessageConfig object
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* // Simple message
|
|
383
|
+
* @message(page.betaFeature, msg('BETA_WARNING'))
|
|
384
|
+
*
|
|
385
|
+
* // Message with static parameters
|
|
386
|
+
* @message(when(page.type, 'GridTable'), msg('TABLE_WARNING', { type: 'GridTable' }))
|
|
387
|
+
*
|
|
388
|
+
* // Message with dynamic parameters (resolved from context at runtime)
|
|
389
|
+
* @message(condition, msg('TABLE_WARNING', { tableType: tableContext.table.type }))
|
|
390
|
+
*
|
|
391
|
+
* // Deletable message
|
|
392
|
+
* @message(page.deprecated, msg('DEPRECATED', { since: '1.96' }, { deletable: true }))
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
function msg(i18nKey, params, options) {
|
|
396
|
+
return {
|
|
397
|
+
[exports.MSG_SYMBOL]: true,
|
|
398
|
+
i18nKey,
|
|
399
|
+
params,
|
|
400
|
+
deletable: options?.deletable ?? false
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
// ============================================
|
|
404
|
+
// CONDITION HELPER FUNCTIONS
|
|
405
|
+
// ============================================
|
|
406
|
+
/**
|
|
407
|
+
* Creates an AND condition group where ALL conditions must be met.
|
|
408
|
+
*
|
|
409
|
+
* @param conditions - Conditions to combine (PathNode for truthy, WhenCondition for value check)
|
|
410
|
+
* @returns An AndCondition object for use with decorators
|
|
411
|
+
* @example
|
|
412
|
+
* ```typescript
|
|
413
|
+
* // Both must be truthy
|
|
414
|
+
* @hide(and(page.isALP, page.isMultiView))
|
|
415
|
+
*
|
|
416
|
+
* // Mixed truthy and value checks
|
|
417
|
+
* @hide(and(page.isALP, when(page.type, 'GridTable')))
|
|
418
|
+
*
|
|
419
|
+
* // Multiple value checks
|
|
420
|
+
* @hide(and(when(page.isALP, true), when(page.isMultiView, true)))
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
function and(...conditions) {
|
|
424
|
+
return {
|
|
425
|
+
__type: 'and',
|
|
426
|
+
conditions
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Creates an OR condition group where AT LEAST ONE condition must be met.
|
|
431
|
+
*
|
|
432
|
+
* @param conditions - Conditions to combine (PathNode for truthy, WhenCondition for value check)
|
|
433
|
+
* @returns An OrCondition object for use with decorators
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* // Either must be truthy
|
|
437
|
+
* @hide(or(page.isALP, page.isOVP))
|
|
438
|
+
*
|
|
439
|
+
* // Either value must match
|
|
440
|
+
* @hide(or(when(page.actionType, 'Bound'), when(page.actionType, 'Custom')))
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
function or(...conditions) {
|
|
444
|
+
return {
|
|
445
|
+
__type: 'or',
|
|
446
|
+
conditions
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Type guard to check if a value is an AndCondition.
|
|
451
|
+
*
|
|
452
|
+
* @param value - The value to check
|
|
453
|
+
* @returns True if value is an AndCondition
|
|
454
|
+
*/
|
|
455
|
+
function isAndCondition(value) {
|
|
456
|
+
return typeof value === 'object' && value !== null && value.__type === 'and';
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Type guard to check if a value is an OrCondition.
|
|
460
|
+
*
|
|
461
|
+
* @param value - The value to check
|
|
462
|
+
* @returns True if value is an OrCondition
|
|
463
|
+
*/
|
|
464
|
+
function isOrCondition(value) {
|
|
465
|
+
return typeof value === 'object' && value !== null && value.__type === 'or';
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Type guard to check if a value is a ConditionGroup (and or or).
|
|
469
|
+
*
|
|
470
|
+
* @param value - The value to check
|
|
471
|
+
* @returns True if value is a ConditionGroup
|
|
472
|
+
*/
|
|
473
|
+
function isConditionGroup(value) {
|
|
474
|
+
return isAndCondition(value) || isOrCondition(value);
|
|
475
|
+
}
|
|
476
|
+
// ============================================
|
|
477
|
+
// NESTED CONDITION TYPE GUARDS
|
|
478
|
+
// ============================================
|
|
479
|
+
/**
|
|
480
|
+
* Type guard to check if an AND condition item is a nested OR group.
|
|
481
|
+
*
|
|
482
|
+
* @param item - The condition item to check
|
|
483
|
+
* @returns True if item is an OrConditionGroup
|
|
484
|
+
*/
|
|
485
|
+
function isOrConditionGroup(item) {
|
|
486
|
+
return item !== null && typeof item === 'object' && '__orConditions' in item;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Type guard to check if an OR condition item is a nested AND group.
|
|
490
|
+
*
|
|
491
|
+
* @param item - The condition item to check
|
|
492
|
+
* @returns True if item is an AndConditionGroup
|
|
493
|
+
*/
|
|
494
|
+
function isAndConditionGroup(item) {
|
|
495
|
+
return item !== null && typeof item === 'object' && '__andConditions' in item;
|
|
496
|
+
}
|
|
497
|
+
//# sourceMappingURL=decorator-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator-paths.js","sourceRoot":"","sources":["../../../../../../src/sync/common/decoration/decorator-paths.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;AAsIH,0BAEC;AAQD,gCAEC;AAwHD,0CAEC;AAuBD,oBAMC;AAgCD,wCAEC;AA8BD,kBAkBC;AA2BD,wBAEC;AAoCD,0CAEC;AA0BD,kBAWC;AA4DD,kBAKC;AAgBD,gBAKC;AAQD,wCAEC;AAQD,sCAEC;AAQD,4CAEC;AAYD,gDAEC;AAQD,kDAEC;AAlkBD,+CAA+C;AAC/C,2BAA2B;AAC3B,+CAA+C;AAE/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CAAC,MAAM,KAAK,KAAK,CAAC;AACnG,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAK,KAAqB,CAAC,MAAM,KAAK,IAAI,CAAC;AACjG,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAc;IAC3C,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,+CAA+C;AAC/C,+BAA+B;AAC/B,+CAA+C;AAE/C;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,IAAsB;IACrD,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,gBAAgB,IAAI,IAAI,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,IAAqB;IACrD,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,iBAAiB,IAAI,IAAI,CAAC;AAClF,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import type { SyncRule, PageLayoutInformation, ValidityInformation, SyncRuleProvider, Validity,
|
|
2
|
+
import type { SyncRule, PageLayoutInformation, ValidityInformation, SyncRuleProvider, Validity, DependsOnCondition } from '@sap/ux-specification-types';
|
|
3
|
+
import { type ConditionInput, type MessageConfig } from './decorator-paths';
|
|
4
|
+
/**
|
|
5
|
+
* Metadata keys for schema post-processing.
|
|
6
|
+
* Used by decorators to store metadata that is processed during schema generation.
|
|
7
|
+
*/
|
|
3
8
|
export declare const metadataKeys: {
|
|
4
9
|
description: symbol;
|
|
5
|
-
hidden: symbol;
|
|
6
10
|
isViewNode: symbol;
|
|
7
11
|
syncRule: symbol;
|
|
8
|
-
dependsOn: symbol;
|
|
9
12
|
validity: symbol;
|
|
13
|
+
hide: symbol;
|
|
14
|
+
message: symbol;
|
|
15
|
+
readonly: symbol;
|
|
16
|
+
enums: symbol;
|
|
10
17
|
};
|
|
11
18
|
export declare const syncRule: (propSpec: SyncRule) => any;
|
|
12
19
|
/**
|
|
@@ -54,39 +61,124 @@ export declare function isViewNode(target: Function): void;
|
|
|
54
61
|
*/
|
|
55
62
|
export declare function description(text: string): (target: Function) => void;
|
|
56
63
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
64
|
+
* Internal metadata structure stored by decorators.
|
|
65
|
+
* Extends DependsOnCondition with optional message configuration.
|
|
66
|
+
*/
|
|
67
|
+
export interface DecoratorMetadata extends DependsOnCondition {
|
|
68
|
+
messageConfig?: MessageConfig;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Decorator to conditionally hide a property based on conditions.
|
|
72
|
+
* The property will be hidden when the condition(s) ARE met.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import { page, custom, when, and, or } from './decorator-paths';
|
|
77
|
+
*
|
|
78
|
+
* // Truthy check - hide when page.isALP is truthy
|
|
79
|
+
* @hide(page.isALP)
|
|
80
|
+
*
|
|
81
|
+
* // Equality check - hide when page.type === 'GridTable'
|
|
82
|
+
* @hide(when(page.type, 'GridTable'))
|
|
59
83
|
*
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
84
|
+
* // Custom function - hide when function returns true (type !== 'GridTable')
|
|
85
|
+
* @hide(when(page.type, (type) => type !== 'GridTable'))
|
|
86
|
+
*
|
|
87
|
+
* // Always hide
|
|
88
|
+
* @hide(true)
|
|
89
|
+
*
|
|
90
|
+
* // AND logic - hide when isALP is truthy AND type === 'GridTable'
|
|
91
|
+
* @hide(and(page.isALP, when(page.type, 'GridTable')))
|
|
92
|
+
*
|
|
93
|
+
* // OR logic - hide when actionType === 'Bound' OR actionType === 'Custom'
|
|
94
|
+
* @hide(or(when(page.actionType, 'Bound'), when(page.actionType, 'Custom')))
|
|
95
|
+
* ```
|
|
96
|
+
* @param condition - The condition to evaluate
|
|
97
|
+
* @returns PropertyDecorator
|
|
62
98
|
*/
|
|
63
|
-
export declare function
|
|
99
|
+
export declare function hide(condition: ConditionInput): PropertyDecorator;
|
|
64
100
|
/**
|
|
65
|
-
*
|
|
101
|
+
* Decorator to conditionally display a message based on conditions.
|
|
102
|
+
* A message will be shown when the condition(s) are met.
|
|
103
|
+
* Multiple @message decorators can be applied to the same property - all matching conditions will show their messages.
|
|
104
|
+
*
|
|
105
|
+
* @param condition - The condition to evaluate
|
|
106
|
+
* @param messageConfig - The message configuration (use msg() helper)
|
|
107
|
+
* @returns PropertyDecorator
|
|
108
|
+
* @example
|
|
109
|
+
* ```typescript
|
|
110
|
+
* import { page, when, msg } from './decorator-paths';
|
|
111
|
+
*
|
|
112
|
+
* // Simple message
|
|
113
|
+
* @message(page.betaFeature, msg('BETA_WARNING'))
|
|
66
114
|
*
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
*
|
|
115
|
+
* // Message with parameters
|
|
116
|
+
* @message(when(page.type, 'GridTable'), msg('TABLE_WARNING', { type: 'GridTable' }))
|
|
117
|
+
*
|
|
118
|
+
* // Deletable message
|
|
119
|
+
* @message(page.deprecated, msg('DEPRECATED', { since: '1.96' }, { deletable: true }))
|
|
120
|
+
*
|
|
121
|
+
* // With AND/OR conditions
|
|
122
|
+
* @message(and(page.isALP, when(page.type, 'GridTable')), msg('ALP_GRID_INFO'))
|
|
123
|
+
*
|
|
124
|
+
* // Multiple messages on same property
|
|
125
|
+
* @message(when(page.type, 'AnalyticalTable'), msg('ANALYTICAL_WARNING'))
|
|
126
|
+
* @message(when(page.mode, 'edit'), msg('EDIT_MODE_WARNING'))
|
|
127
|
+
* ```
|
|
70
128
|
*/
|
|
71
|
-
export declare
|
|
129
|
+
export declare function message(condition: ConditionInput, messageConfig: MessageConfig): PropertyDecorator;
|
|
72
130
|
/**
|
|
73
|
-
* Decorator to conditionally
|
|
74
|
-
* The
|
|
131
|
+
* Decorator to conditionally mark a property as readonly based on conditions.
|
|
132
|
+
* The property will be readonly when the condition(s) are met.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* import { page, custom, when } from './decorator-paths';
|
|
75
137
|
*
|
|
76
|
-
*
|
|
77
|
-
* @
|
|
78
|
-
*
|
|
138
|
+
* // Truthy check - readonly if page.isLocked is truthy
|
|
139
|
+
* @readonly(page.isLocked)
|
|
140
|
+
*
|
|
141
|
+
* // Equality check - readonly if mode === 'view'
|
|
142
|
+
* @readonly(when(page.mode, 'view'))
|
|
143
|
+
*
|
|
144
|
+
* // Custom function - readonly if role is 'viewer'
|
|
145
|
+
* @readonly(when(custom.user.role, (role) => role === 'viewer'))
|
|
146
|
+
* ```
|
|
147
|
+
* @param condition - The condition to evaluate
|
|
79
148
|
* @returns PropertyDecorator
|
|
80
149
|
*/
|
|
81
|
-
export declare function
|
|
150
|
+
export declare function readonly(condition: ConditionInput): PropertyDecorator;
|
|
82
151
|
/**
|
|
83
|
-
*
|
|
152
|
+
* Metadata structure for the @enums decorator.
|
|
153
|
+
* Extends DecoratorMetadata with the list of allowed enum values.
|
|
154
|
+
*/
|
|
155
|
+
export interface EnumsDecoratorMetadata extends DecoratorMetadata {
|
|
156
|
+
/** The allowed enum values when the condition is met */
|
|
157
|
+
allowedValues: string[];
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Decorator to conditionally restrict enum values based on conditions.
|
|
161
|
+
* When the condition is met, only the specified allowedValues will be available.
|
|
162
|
+
* If multiple @enums decorators exist on the same property, the first matching condition wins.
|
|
84
163
|
*
|
|
85
|
-
* @
|
|
86
|
-
*
|
|
87
|
-
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* import { custom, when } from './decorator-paths';
|
|
167
|
+
*
|
|
168
|
+
* // Restrict to specific values when table type is TreeTable
|
|
169
|
+
* @enums(when(custom.table.type, 'TreeTable'), ['Inline', 'NewPage', 'CreationDialog'])
|
|
170
|
+
*
|
|
171
|
+
* // Different values for other table types
|
|
172
|
+
* @enums(when(custom.table.type, 'ResponsiveTable'), ['Inline', 'InlineCreationRows', 'NewPage', 'CreationDialog', 'External'])
|
|
173
|
+
*
|
|
174
|
+
* // Default values when no other condition matches
|
|
175
|
+
* @enums(true, ['NewPage', 'CreationDialog'])
|
|
176
|
+
* ```
|
|
177
|
+
* @param condition - The condition to evaluate
|
|
178
|
+
* @param allowedValues - Array of allowed enum values when condition is met
|
|
179
|
+
* @returns PropertyDecorator
|
|
88
180
|
*/
|
|
89
|
-
export declare function
|
|
181
|
+
export declare function enums(condition: ConditionInput, allowedValues: string[]): PropertyDecorator;
|
|
90
182
|
/**
|
|
91
183
|
* Generates a deprecation message for a given key, optionally including additional validity information.
|
|
92
184
|
*
|