@sap-ux/preview-middleware 0.19.28 → 0.19.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/base/flp.d.ts +2 -2
  2. package/dist/base/flp.js +3 -3
  3. package/dist/client/adp/add-fragment.js +48 -0
  4. package/dist/client/adp/add-fragment.ts +51 -0
  5. package/dist/client/adp/api-handler.js +155 -153
  6. package/dist/client/adp/api-handler.ts +2 -2
  7. package/dist/client/adp/command-executor.js +75 -75
  8. package/dist/client/adp/control-utils.js +44 -44
  9. package/dist/client/adp/controllers/AddFragment.controller.js +26 -86
  10. package/dist/client/adp/controllers/AddFragment.controller.ts +29 -113
  11. package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
  12. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  13. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  14. package/dist/client/adp/dialog-factory.js +135 -135
  15. package/dist/client/adp/dialog-factory.ts +21 -13
  16. package/dist/client/adp/extension-point.js +3 -3
  17. package/dist/client/adp/extension-point.ts +3 -3
  18. package/dist/client/adp/init-dialogs.js +163 -138
  19. package/dist/client/adp/init-dialogs.ts +13 -8
  20. package/dist/client/adp/init.js +2 -0
  21. package/dist/client/adp/init.ts +5 -0
  22. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  23. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
  24. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  25. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  26. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  27. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  28. package/dist/client/adp/quick-actions/control-types.js +23 -23
  29. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  30. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  31. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  32. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  33. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  34. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  35. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  36. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  37. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  38. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  39. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  40. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  41. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  42. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  43. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  44. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  45. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  46. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
  47. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  48. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  49. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  50. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  51. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
  52. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  53. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  54. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  55. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  56. package/dist/client/adp/quick-actions/load.js +44 -44
  57. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  58. package/dist/client/adp/utils.js +218 -218
  59. package/dist/client/adp/utils.ts +2 -2
  60. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +77 -0
  61. package/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +84 -0
  62. package/dist/client/cpe/changes/index.js +10 -10
  63. package/dist/client/cpe/changes/service.js +5 -2
  64. package/dist/client/cpe/changes/service.ts +2 -0
  65. package/dist/client/cpe/changes/validator.js +39 -39
  66. package/dist/client/cpe/connector-service.js +2 -1
  67. package/dist/client/cpe/connector-service.ts +8 -4
  68. package/dist/client/cpe/documentation.js +164 -164
  69. package/dist/client/cpe/feature-service.js +36 -36
  70. package/dist/client/cpe/logger.js +30 -30
  71. package/dist/client/cpe/outline/editable.js +37 -37
  72. package/dist/client/cpe/outline/nodes.js +203 -203
  73. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  74. package/dist/client/cpe/quick-actions/registry.js +143 -143
  75. package/dist/client/cpe/quick-actions/utils.js +92 -92
  76. package/dist/client/cpe/types.js +4 -4
  77. package/dist/client/cpe/ui5-utils.js +33 -33
  78. package/dist/client/cpe/utils.js +111 -111
  79. package/dist/client/flp/WorkspaceConnector.js +92 -86
  80. package/dist/client/flp/WorkspaceConnector.ts +10 -2
  81. package/dist/client/flp/common.js +28 -28
  82. package/dist/client/flp/enableFakeConnector.js +89 -83
  83. package/dist/client/flp/enableFakeConnector.ts +11 -2
  84. package/dist/client/flp/homepage/Component.js +14 -14
  85. package/dist/client/flp/initCdm.js +117 -117
  86. package/dist/client/flp/initConnectors.js +28 -28
  87. package/dist/client/flp/initRta.js +178 -178
  88. package/dist/client/i18n.js +56 -56
  89. package/dist/client/utils/additional-change-info.js +43 -0
  90. package/dist/client/utils/additional-change-info.ts +42 -0
  91. package/dist/client/utils/application.js +32 -32
  92. package/dist/client/utils/core.js +84 -84
  93. package/dist/client/utils/error.js +19 -19
  94. package/dist/client/utils/fe-v2.js +56 -56
  95. package/dist/client/utils/fe-v4.js +140 -140
  96. package/dist/client/utils/version.js +104 -104
  97. package/package.json +3 -3
@@ -1,140 +1,140 @@
1
- "use strict";
2
-
3
- sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version"], function (_____utils_fe_v4, ___add_new_subpage_quick_action_base, _____utils_core, _____utils_version) {
4
- "use strict";
5
-
6
- const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
7
- const getV4ApplicationPages = _____utils_fe_v4["getV4ApplicationPages"];
8
- const AddNewSubpageBase = ___add_new_subpage_quick_action_base["AddNewSubpageBase"];
9
- const isA = _____utils_core["isA"];
10
- const getUi5Version = _____utils_version["getUi5Version"];
11
- const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
12
- const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
13
- /**
14
- * Quick Action for adding a custom page action.
15
- */
16
- class AddNewSubpage extends AddNewSubpageBase {
17
- get currentPageDescriptor() {
18
- if (!this.pageId) {
19
- throw new Error('pageId is not defined');
20
- }
21
- if (!this.routePattern) {
22
- throw new Error('routePattern is not defined');
23
- }
24
- if (!this.appComponent) {
25
- throw new Error('appComponent is not defined');
26
- }
27
- return {
28
- appType: 'fe-v4',
29
- appComponent: this.appComponent,
30
- pageId: this.pageId,
31
- routePattern: this.routePattern
32
- };
33
- }
34
- getApplicationPages() {
35
- return getV4ApplicationPages(this.context.manifest);
36
- }
37
- async resolveContextPathTargetName(contextPath, metaModel) {
38
- let result;
39
- const segments = contextPath.split('/').filter(s => !!s);
40
- if (segments.length === 1) {
41
- // one segment - assumed it is the direct name of entitySet
42
- result = segments[0];
43
- } else {
44
- // resolve segment by segment
45
- let targetObject = await metaModel.requestObject(`/${segments[0]}`); // NO SONAR;
46
-
47
- let idx = 1;
48
- let targetSetName = '';
49
- while (targetObject && idx < segments.length) {
50
- const navProp = segments[idx];
51
- targetSetName = targetObject.$NavigationPropertyBinding[navProp];
52
- if (!targetSetName) {
53
- targetObject = undefined;
54
- } else {
55
- targetObject = await metaModel.requestObject(`/${targetSetName}`); // NO SONAR;
56
- idx++;
57
- }
58
- }
59
- if (targetObject) {
60
- result = targetSetName;
61
- }
62
- }
63
- return result;
64
- }
65
- async isPageExists(targetEntitySet, metaModel) {
66
- let pageFound = false;
67
- let entitySetName;
68
- for (const page of this.existingPages) {
69
- if (page.contextPath) {
70
- // resolve contextPath to target entitySet
71
- entitySetName = await this.resolveContextPathTargetName(page.contextPath, metaModel);
72
- } else {
73
- entitySetName = page.entitySet;
74
- }
75
- if (entitySetName === targetEntitySet) {
76
- pageFound = true;
77
- break;
78
- }
79
- }
80
- return pageFound;
81
- }
82
- isCurrentObjectPage() {
83
- return this.pageType === OBJECT_PAGE_COMPONENT_NAME_V4;
84
- }
85
- getODataMetaModel() {
86
- return this.context.rta.getRootControlInstance().getModel()?.getMetaModel();
87
- }
88
- async getEntitySetNameFromPageComponent(component, metaModel) {
89
- if (!isA('sap.fe.templates.ListReport.Component', component) && !isA('sap.fe.templates.ObjectPage.Component', component)) {
90
- throw new Error('Unexpected type of page owner component');
91
- }
92
- let entitySet = component.getEntitySet();
93
- let contextPath = component.getContextPath();
94
- if (contextPath) {
95
- entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
96
- }
97
- return entitySet;
98
- }
99
- async prepareNavigationData(metaModel) {
100
- const entitySet = await metaModel.requestObject(`/${this.entitySet}`); // NO SONAR;
101
- if (!entitySet) {
102
- return;
103
- }
104
- const entityTypePath = entitySet.$Type;
105
- const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
106
- for (const navigationProperty of entitySetNavigationKeys) {
107
- const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`);
108
- if (associationEnd?.$isCollection) {
109
- const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
110
- await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
111
- }
112
- }
113
- }
114
- async initialize() {
115
- const version = await getUi5Version();
116
- if (isLowerThanMinimalUi5Version(version, {
117
- major: 1,
118
- minor: 135
119
- })) {
120
- return;
121
- }
122
- await super.initialize();
123
- this.appComponent = getV4AppComponent(this.context.view);
124
- this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
125
- // remember current page route pattern (used in dialog controller for new page change)
126
- const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(r => r.name === this.pageId);
127
- if (!currentPageRoute) {
128
- throw new Error('Current page navigation route not found in manifest');
129
- }
130
- this.routePattern = currentPageRoute.pattern;
131
- }
132
- }
133
- var __exports = {
134
- __esModule: true
135
- };
136
- __exports.OBJECT_PAGE_COMPONENT_NAME_V4 = OBJECT_PAGE_COMPONENT_NAME_V4;
137
- __exports.AddNewSubpage = AddNewSubpage;
138
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version"], function (_____utils_fe_v4, ___add_new_subpage_quick_action_base, _____utils_core, _____utils_version) {
4
+ "use strict";
5
+
6
+ const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
7
+ const getV4ApplicationPages = _____utils_fe_v4["getV4ApplicationPages"];
8
+ const AddNewSubpageBase = ___add_new_subpage_quick_action_base["AddNewSubpageBase"];
9
+ const isA = _____utils_core["isA"];
10
+ const getUi5Version = _____utils_version["getUi5Version"];
11
+ const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
12
+ const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
13
+ /**
14
+ * Quick Action for adding a custom page action.
15
+ */
16
+ class AddNewSubpage extends AddNewSubpageBase {
17
+ get currentPageDescriptor() {
18
+ if (!this.pageId) {
19
+ throw new Error('pageId is not defined');
20
+ }
21
+ if (!this.routePattern) {
22
+ throw new Error('routePattern is not defined');
23
+ }
24
+ if (!this.appComponent) {
25
+ throw new Error('appComponent is not defined');
26
+ }
27
+ return {
28
+ appType: 'fe-v4',
29
+ appComponent: this.appComponent,
30
+ pageId: this.pageId,
31
+ routePattern: this.routePattern
32
+ };
33
+ }
34
+ getApplicationPages() {
35
+ return getV4ApplicationPages(this.context.manifest);
36
+ }
37
+ async resolveContextPathTargetName(contextPath, metaModel) {
38
+ let result;
39
+ const segments = contextPath.split('/').filter(s => !!s);
40
+ if (segments.length === 1) {
41
+ // one segment - assumed it is the direct name of entitySet
42
+ result = segments[0];
43
+ } else {
44
+ // resolve segment by segment
45
+ let targetObject = await metaModel.requestObject(`/${segments[0]}`); // NO SONAR;
46
+
47
+ let idx = 1;
48
+ let targetSetName = '';
49
+ while (targetObject && idx < segments.length) {
50
+ const navProp = segments[idx];
51
+ targetSetName = targetObject.$NavigationPropertyBinding[navProp];
52
+ if (!targetSetName) {
53
+ targetObject = undefined;
54
+ } else {
55
+ targetObject = await metaModel.requestObject(`/${targetSetName}`); // NO SONAR;
56
+ idx++;
57
+ }
58
+ }
59
+ if (targetObject) {
60
+ result = targetSetName;
61
+ }
62
+ }
63
+ return result;
64
+ }
65
+ async isPageExists(targetEntitySet, metaModel) {
66
+ let pageFound = false;
67
+ let entitySetName;
68
+ for (const page of this.existingPages) {
69
+ if (page.contextPath) {
70
+ // resolve contextPath to target entitySet
71
+ entitySetName = await this.resolveContextPathTargetName(page.contextPath, metaModel);
72
+ } else {
73
+ entitySetName = page.entitySet;
74
+ }
75
+ if (entitySetName === targetEntitySet) {
76
+ pageFound = true;
77
+ break;
78
+ }
79
+ }
80
+ return pageFound;
81
+ }
82
+ isCurrentObjectPage() {
83
+ return this.pageType === OBJECT_PAGE_COMPONENT_NAME_V4;
84
+ }
85
+ getODataMetaModel() {
86
+ return this.context.rta.getRootControlInstance().getModel()?.getMetaModel();
87
+ }
88
+ async getEntitySetNameFromPageComponent(component, metaModel) {
89
+ if (!isA('sap.fe.templates.ListReport.Component', component) && !isA('sap.fe.templates.ObjectPage.Component', component)) {
90
+ throw new Error('Unexpected type of page owner component');
91
+ }
92
+ let entitySet = component.getEntitySet();
93
+ let contextPath = component.getContextPath();
94
+ if (contextPath) {
95
+ entitySet = await this.resolveContextPathTargetName(contextPath, metaModel);
96
+ }
97
+ return entitySet;
98
+ }
99
+ async prepareNavigationData(metaModel) {
100
+ const entitySet = await metaModel.requestObject(`/${this.entitySet}`); // NO SONAR;
101
+ if (!entitySet) {
102
+ return;
103
+ }
104
+ const entityTypePath = entitySet.$Type;
105
+ const entitySetNavigationKeys = Object.keys(entitySet.$NavigationPropertyBinding);
106
+ for (const navigationProperty of entitySetNavigationKeys) {
107
+ const associationEnd = await metaModel.requestObject(`/${entityTypePath}/${navigationProperty}`);
108
+ if (associationEnd?.$isCollection) {
109
+ const targetEntitySet = entitySet.$NavigationPropertyBinding[navigationProperty];
110
+ await this.addNavigationOptionIfAvailable(metaModel, targetEntitySet, navigationProperty);
111
+ }
112
+ }
113
+ }
114
+ async initialize() {
115
+ const version = await getUi5Version();
116
+ if (isLowerThanMinimalUi5Version(version, {
117
+ major: 1,
118
+ minor: 135
119
+ })) {
120
+ return;
121
+ }
122
+ await super.initialize();
123
+ this.appComponent = getV4AppComponent(this.context.view);
124
+ this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
125
+ // remember current page route pattern (used in dialog controller for new page change)
126
+ const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(r => r.name === this.pageId);
127
+ if (!currentPageRoute) {
128
+ throw new Error('Current page navigation route not found in manifest');
129
+ }
130
+ this.routePattern = currentPageRoute.pattern;
131
+ }
132
+ }
133
+ var __exports = {
134
+ __esModule: true
135
+ };
136
+ __exports.OBJECT_PAGE_COMPONENT_NAME_V4 = OBJECT_PAGE_COMPONENT_NAME_V4;
137
+ __exports.AddNewSubpage = AddNewSubpage;
138
+ return __exports;
139
139
  });
140
140
  //# sourceMappingURL=add-new-subpage.js.map
@@ -1,81 +1,81 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../utils/core", "../table-quick-action-base", "../control-types", "../../../cpe/quick-actions/utils", "../fe-v2/create-table-custom-column", "../dialog-enablement-validator"], function (OverlayUtil, _____utils_core, ___table_quick_action_base, ___control_types, _____cpe_quick_actions_utils, ___fe_v2_create_table_custom_column, ___dialog_enablement_validator) {
4
- "use strict";
5
-
6
- const getControlById = _____utils_core["getControlById"];
7
- const findNestedElements = _____utils_core["findNestedElements"];
8
- const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
9
- const MDC_ACTION_TOOLBAR_TYPE = ___control_types["MDC_ACTION_TOOLBAR_TYPE"];
10
- const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
11
- const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
12
- const preprocessActionExecution = ___fe_v2_create_table_custom_column["preprocessActionExecution"];
13
- const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
14
- const CHANGE_TABLE_ACTIONS = 'change-table-actions';
15
- const ACTION_ID = 'CTX_SETTINGS';
16
-
17
- /**
18
- * Quick Action for changing table columns.
19
- */
20
- class ChangeTableActionsQuickAction extends TableQuickActionDefinitionBase {
21
- toolbarsMap = {};
22
- constructor(context) {
23
- super(CHANGE_TABLE_ACTIONS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_ACTIONS', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
24
- }
25
- async initialize() {
26
- const toolbars = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [MDC_ACTION_TOOLBAR_TYPE]);
27
- const processChild = async (child, mapKey) => {
28
- const mapEntry = this.tableMap[mapKey];
29
- if (mapEntry) {
30
- const tableToolbar = findNestedElements(mapEntry.table, toolbars)[0];
31
- this.toolbarsMap[mapKey] = tableToolbar;
32
- const actions = tableToolbar ? await this.context.actionService.get(tableToolbar.getId()) : [];
33
- const changeToolbarContentAction = actions.find(action => action.id === ACTION_ID);
34
- child.enabled = !!changeToolbarContentAction?.enabled;
35
- let tooltip;
36
- if (!tableToolbar) {
37
- tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_AVAILABLE');
38
- } else if (!child.enabled) {
39
- tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE');
40
- }
41
- child.tooltip = tooltip ?? child.tooltip;
42
- }
43
- for (let idx = 0; idx < child.children.length; idx++) {
44
- await processChild(child.children[idx], `${mapKey}/${idx}`);
45
- }
46
- };
47
- await super.initialize();
48
-
49
- // disable nested actions based on conditions
50
- for (let idx = 0; idx < this.children.length; idx++) {
51
- await processChild(this.children[idx], `${idx}`);
52
- }
53
- }
54
- async execute(path) {
55
- const {
56
- table,
57
- sectionInfo,
58
- iconTabBarFilterKey
59
- } = this.tableMap[path];
60
- const toolbar = this.toolbarsMap[path];
61
- if (!table || !toolbar) {
62
- return [];
63
- }
64
- preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
65
- const toolbarControl = getControlById(toolbar.getId());
66
- const controlOverlay = OverlayUtil.getClosestOverlayFor(toolbarControl);
67
- if (controlOverlay) {
68
- controlOverlay.setSelected(true);
69
- await this.context.actionService.execute(toolbar.getId(), ACTION_ID);
70
- }
71
- return [];
72
- }
73
- }
74
- var __exports = {
75
- __esModule: true
76
- };
77
- __exports.CHANGE_TABLE_ACTIONS = CHANGE_TABLE_ACTIONS;
78
- __exports.ChangeTableActionsQuickAction = ChangeTableActionsQuickAction;
79
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../utils/core", "../table-quick-action-base", "../control-types", "../../../cpe/quick-actions/utils", "../fe-v2/create-table-custom-column", "../dialog-enablement-validator"], function (OverlayUtil, _____utils_core, ___table_quick_action_base, ___control_types, _____cpe_quick_actions_utils, ___fe_v2_create_table_custom_column, ___dialog_enablement_validator) {
4
+ "use strict";
5
+
6
+ const getControlById = _____utils_core["getControlById"];
7
+ const findNestedElements = _____utils_core["findNestedElements"];
8
+ const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
9
+ const MDC_ACTION_TOOLBAR_TYPE = ___control_types["MDC_ACTION_TOOLBAR_TYPE"];
10
+ const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
11
+ const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
12
+ const preprocessActionExecution = ___fe_v2_create_table_custom_column["preprocessActionExecution"];
13
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
14
+ const CHANGE_TABLE_ACTIONS = 'change-table-actions';
15
+ const ACTION_ID = 'CTX_SETTINGS';
16
+
17
+ /**
18
+ * Quick Action for changing table columns.
19
+ */
20
+ class ChangeTableActionsQuickAction extends TableQuickActionDefinitionBase {
21
+ toolbarsMap = {};
22
+ constructor(context) {
23
+ super(CHANGE_TABLE_ACTIONS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_ACTIONS', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
24
+ }
25
+ async initialize() {
26
+ const toolbars = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [MDC_ACTION_TOOLBAR_TYPE]);
27
+ const processChild = async (child, mapKey) => {
28
+ const mapEntry = this.tableMap[mapKey];
29
+ if (mapEntry) {
30
+ const tableToolbar = findNestedElements(mapEntry.table, toolbars)[0];
31
+ this.toolbarsMap[mapKey] = tableToolbar;
32
+ const actions = tableToolbar ? await this.context.actionService.get(tableToolbar.getId()) : [];
33
+ const changeToolbarContentAction = actions.find(action => action.id === ACTION_ID);
34
+ child.enabled = !!changeToolbarContentAction?.enabled;
35
+ let tooltip;
36
+ if (!tableToolbar) {
37
+ tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_AVAILABLE');
38
+ } else if (!child.enabled) {
39
+ tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE');
40
+ }
41
+ child.tooltip = tooltip ?? child.tooltip;
42
+ }
43
+ for (let idx = 0; idx < child.children.length; idx++) {
44
+ await processChild(child.children[idx], `${mapKey}/${idx}`);
45
+ }
46
+ };
47
+ await super.initialize();
48
+
49
+ // disable nested actions based on conditions
50
+ for (let idx = 0; idx < this.children.length; idx++) {
51
+ await processChild(this.children[idx], `${idx}`);
52
+ }
53
+ }
54
+ async execute(path) {
55
+ const {
56
+ table,
57
+ sectionInfo,
58
+ iconTabBarFilterKey
59
+ } = this.tableMap[path];
60
+ const toolbar = this.toolbarsMap[path];
61
+ if (!table || !toolbar) {
62
+ return [];
63
+ }
64
+ preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
65
+ const toolbarControl = getControlById(toolbar.getId());
66
+ const controlOverlay = OverlayUtil.getClosestOverlayFor(toolbarControl);
67
+ if (controlOverlay) {
68
+ controlOverlay.setSelected(true);
69
+ await this.context.actionService.execute(toolbar.getId(), ACTION_ID);
70
+ }
71
+ return [];
72
+ }
73
+ }
74
+ var __exports = {
75
+ __esModule: true
76
+ };
77
+ __exports.CHANGE_TABLE_ACTIONS = CHANGE_TABLE_ACTIONS;
78
+ __exports.ChangeTableActionsQuickAction = ChangeTableActionsQuickAction;
79
+ return __exports;
80
80
  });
81
81
  //# sourceMappingURL=change-table-actions.js.map
@@ -1,77 +1,77 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI", "../../../utils/core", "../table-quick-action-base", "../control-types", "../dialog-enablement-validator", "../../../cpe/quick-actions/utils"], function (OverlayUtil, FlexRuntimeInfoAPI, _____utils_core, ___table_quick_action_base, ___control_types, ___dialog_enablement_validator, _____cpe_quick_actions_utils) {
4
- "use strict";
5
-
6
- const getControlById = _____utils_core["getControlById"];
7
- const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
8
- const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
9
- const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
10
- const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
11
- const CHANGE_TABLE_COLUMNS = 'change-table-columns';
12
- const ACTION_ID = 'CTX_SETTINGS0';
13
-
14
- /**
15
- * Quick Action for changing table columns.
16
- */
17
- class ChangeTableColumnsQuickAction extends TableQuickActionDefinitionBase {
18
- constructor(context) {
19
- super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
20
- }
21
- async initialize() {
22
- for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
23
- const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({
24
- element: smartTable
25
- });
26
- if (!hasVariantManagement) {
27
- continue;
28
- }
29
- const actions = await this.context.actionService.get(smartTable.getId());
30
- const changeColumnAction = actions.find(action => action.id === ACTION_ID);
31
- if (changeColumnAction) {
32
- const path = this.children.length.toString();
33
- this.children.push({
34
- path,
35
- label: `'${smartTable.getHeader()}' table`,
36
- enabled: true,
37
- children: []
38
- });
39
- this.tableMap[path] = {
40
- table: smartTable,
41
- tableUpdateEventAttachedOnce: false
42
- };
43
- }
44
- }
45
- if (this.children.length > 0) {
46
- this.isApplicable = true;
47
- }
48
- }
49
- async execute(path) {
50
- const {
51
- table
52
- } = this.tableMap[path];
53
- if (!table) {
54
- return [];
55
- }
56
- const tableControl = getControlById(table.getId());
57
- const controlOverlay = OverlayUtil.getClosestOverlayFor(tableControl);
58
- if (controlOverlay) {
59
- controlOverlay.setSelected(true);
60
- }
61
- const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({
62
- element: table
63
- });
64
- if (hasVariantManagement) {
65
- await this.context.actionService.execute(table.getId(), ACTION_ID);
66
- }
67
- return [];
68
- }
69
- }
70
- var __exports = {
71
- __esModule: true
72
- };
73
- __exports.CHANGE_TABLE_COLUMNS = CHANGE_TABLE_COLUMNS;
74
- __exports.ChangeTableColumnsQuickAction = ChangeTableColumnsQuickAction;
75
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI", "../../../utils/core", "../table-quick-action-base", "../control-types", "../dialog-enablement-validator", "../../../cpe/quick-actions/utils"], function (OverlayUtil, FlexRuntimeInfoAPI, _____utils_core, ___table_quick_action_base, ___control_types, ___dialog_enablement_validator, _____cpe_quick_actions_utils) {
4
+ "use strict";
5
+
6
+ const getControlById = _____utils_core["getControlById"];
7
+ const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
8
+ const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
9
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
10
+ const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
11
+ const CHANGE_TABLE_COLUMNS = 'change-table-columns';
12
+ const ACTION_ID = 'CTX_SETTINGS0';
13
+
14
+ /**
15
+ * Quick Action for changing table columns.
16
+ */
17
+ class ChangeTableColumnsQuickAction extends TableQuickActionDefinitionBase {
18
+ constructor(context) {
19
+ super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
20
+ }
21
+ async initialize() {
22
+ for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
23
+ const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({
24
+ element: smartTable
25
+ });
26
+ if (!hasVariantManagement) {
27
+ continue;
28
+ }
29
+ const actions = await this.context.actionService.get(smartTable.getId());
30
+ const changeColumnAction = actions.find(action => action.id === ACTION_ID);
31
+ if (changeColumnAction) {
32
+ const path = this.children.length.toString();
33
+ this.children.push({
34
+ path,
35
+ label: `'${smartTable.getHeader()}' table`,
36
+ enabled: true,
37
+ children: []
38
+ });
39
+ this.tableMap[path] = {
40
+ table: smartTable,
41
+ tableUpdateEventAttachedOnce: false
42
+ };
43
+ }
44
+ }
45
+ if (this.children.length > 0) {
46
+ this.isApplicable = true;
47
+ }
48
+ }
49
+ async execute(path) {
50
+ const {
51
+ table
52
+ } = this.tableMap[path];
53
+ if (!table) {
54
+ return [];
55
+ }
56
+ const tableControl = getControlById(table.getId());
57
+ const controlOverlay = OverlayUtil.getClosestOverlayFor(tableControl);
58
+ if (controlOverlay) {
59
+ controlOverlay.setSelected(true);
60
+ }
61
+ const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({
62
+ element: table
63
+ });
64
+ if (hasVariantManagement) {
65
+ await this.context.actionService.execute(table.getId(), ACTION_ID);
66
+ }
67
+ return [];
68
+ }
69
+ }
70
+ var __exports = {
71
+ __esModule: true
72
+ };
73
+ __exports.CHANGE_TABLE_COLUMNS = CHANGE_TABLE_COLUMNS;
74
+ __exports.ChangeTableColumnsQuickAction = ChangeTableColumnsQuickAction;
75
+ return __exports;
76
76
  });
77
77
  //# sourceMappingURL=change-table-columns.js.map