@sap-ux/preview-middleware 0.19.16 → 0.19.18

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.
@@ -9,6 +9,7 @@ sap.ui.define([], function () {
9
9
  const TREE_TABLE_TYPE = 'sap.ui.table.TreeTable';
10
10
  const GRID_TABLE_TYPE = 'sap.ui.table.Table';
11
11
  const ANALYTICAL_TABLE_TYPE = 'sap.ui.table.AnalyticalTable';
12
+ const MDC_ACTION_TOOLBAR_TYPE = 'sap.ui.mdc.ActionToolbar';
12
13
  var __exports = {
13
14
  __esModule: true
14
15
  };
@@ -18,6 +19,7 @@ sap.ui.define([], function () {
18
19
  __exports.TREE_TABLE_TYPE = TREE_TABLE_TYPE;
19
20
  __exports.GRID_TABLE_TYPE = GRID_TABLE_TYPE;
20
21
  __exports.ANALYTICAL_TABLE_TYPE = ANALYTICAL_TABLE_TYPE;
22
+ __exports.MDC_ACTION_TOOLBAR_TYPE = MDC_ACTION_TOOLBAR_TYPE;
21
23
  return __exports;
22
24
  });
23
25
  //# sourceMappingURL=control-types.js.map
@@ -4,3 +4,4 @@ export const MDC_TABLE_TYPE = 'sap.ui.mdc.Table';
4
4
  export const TREE_TABLE_TYPE = 'sap.ui.table.TreeTable';
5
5
  export const GRID_TABLE_TYPE = 'sap.ui.table.Table';
6
6
  export const ANALYTICAL_TABLE_TYPE = 'sap.ui.table.AnalyticalTable';
7
+ export const MDC_ACTION_TOOLBAR_TYPE = 'sap.ui.mdc.ActionToolbar';
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../../utils/core", "../table-quick-action-base", "../control-types", "../dialog-enablement-validator"], function (_____utils_core, ___table_quick_action_base, ___control_types, ___dialog_enablement_validator) {
4
+ "use strict";
5
+
6
+ const getControlById = _____utils_core["getControlById"];
7
+ const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
8
+ const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
9
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
10
+ const CHANGE_TABLE_ACTIONS = 'change-table-actions';
11
+ const CONTROL_TYPES = [SMART_TABLE_TYPE];
12
+ class ChangeTableActionsQuickAction extends TableQuickActionDefinitionBase {
13
+ constructor(context) {
14
+ super(CHANGE_TABLE_ACTIONS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_ACTIONS', context, {
15
+ includeServiceAction: true
16
+ }, [DIALOG_ENABLEMENT_VALIDATOR]);
17
+ }
18
+ async initialize() {
19
+ const processChild = (child, mapKey) => {
20
+ const tableAction = this.tableMap[mapKey]?.changeToolbarContentAction;
21
+ child.enabled = !!tableAction?.enabled;
22
+ child.tooltip = child.enabled ? undefined : this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE');
23
+ child.children.forEach((nestedChild, idx) => processChild(nestedChild, `${mapKey}/${idx}`));
24
+ };
25
+ await super.initialize();
26
+
27
+ // disable nested actions based on conditions
28
+ this.children.forEach((nestedChild, idx) => processChild(nestedChild, `${idx}`));
29
+ }
30
+ async execute(path) {
31
+ const {
32
+ table,
33
+ iconTabBarFilterKey,
34
+ changeToolbarContentAction,
35
+ sectionInfo
36
+ } = this.tableMap[path];
37
+ if (!table) {
38
+ return [];
39
+ }
40
+ if (sectionInfo) {
41
+ const {
42
+ layout,
43
+ section,
44
+ subSection
45
+ } = sectionInfo;
46
+ layout?.setSelectedSection(section);
47
+ section.setSelectedSubSection(subSection);
48
+ this.selectOverlay(table);
49
+ } else {
50
+ getControlById(table.getId())?.getDomRef()?.scrollIntoView();
51
+ this.selectOverlay(table);
52
+ }
53
+ if (this.iconTabBar && iconTabBarFilterKey) {
54
+ this.iconTabBar.setSelectedKey(iconTabBarFilterKey);
55
+ }
56
+ if (changeToolbarContentAction) {
57
+ await this.context.actionService.execute(table.getId(), changeToolbarContentAction.id);
58
+ }
59
+ return [];
60
+ }
61
+ }
62
+ var __exports = {
63
+ __esModule: true
64
+ };
65
+ __exports.CHANGE_TABLE_ACTIONS = CHANGE_TABLE_ACTIONS;
66
+ __exports.ChangeTableActionsQuickAction = ChangeTableActionsQuickAction;
67
+ return __exports;
68
+ });
69
+ //# sourceMappingURL=change-table-actions.js.map
@@ -0,0 +1,71 @@
1
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+
3
+ import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
+ import { getControlById } from '../../../utils/core';
5
+ import { TableQuickActionDefinitionBase } from '../table-quick-action-base';
6
+ import { NestedQuickActionChild } from '@sap-ux-private/control-property-editor-common';
7
+ import { SMART_TABLE_TYPE } from '../control-types';
8
+ import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
9
+
10
+ export const CHANGE_TABLE_ACTIONS = 'change-table-actions';
11
+ const CONTROL_TYPES = [SMART_TABLE_TYPE];
12
+
13
+ export class ChangeTableActionsQuickAction
14
+ extends TableQuickActionDefinitionBase
15
+ implements NestedQuickActionDefinition
16
+ {
17
+ constructor(context: QuickActionContext) {
18
+ super(
19
+ CHANGE_TABLE_ACTIONS,
20
+ CONTROL_TYPES,
21
+ 'V2_QUICK_ACTION_CHANGE_TABLE_ACTIONS',
22
+ context,
23
+ {
24
+ includeServiceAction: true
25
+ },
26
+ [DIALOG_ENABLEMENT_VALIDATOR]
27
+ );
28
+ }
29
+
30
+ async initialize(): Promise<void> {
31
+ const processChild = (child: NestedQuickActionChild, mapKey: string) => {
32
+ const tableAction = this.tableMap[mapKey]?.changeToolbarContentAction;
33
+ child.enabled = !!tableAction?.enabled;
34
+ child.tooltip = child.enabled
35
+ ? undefined
36
+ : this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE');
37
+ child.children.forEach((nestedChild, idx) => processChild(nestedChild, `${mapKey}/${idx}`));
38
+ };
39
+
40
+ await super.initialize();
41
+
42
+ // disable nested actions based on conditions
43
+ this.children.forEach((nestedChild, idx) => processChild(nestedChild, `${idx}`));
44
+ }
45
+
46
+ async execute(path: string): Promise<FlexCommand[]> {
47
+ const { table, iconTabBarFilterKey, changeToolbarContentAction, sectionInfo } = this.tableMap[path];
48
+ if (!table) {
49
+ return [];
50
+ }
51
+
52
+ if (sectionInfo) {
53
+ const { layout, section, subSection } = sectionInfo;
54
+ layout?.setSelectedSection(section);
55
+ section.setSelectedSubSection(subSection);
56
+ this.selectOverlay(table);
57
+ } else {
58
+ getControlById(table.getId())?.getDomRef()?.scrollIntoView();
59
+ this.selectOverlay(table);
60
+ }
61
+
62
+ if (this.iconTabBar && iconTabBarFilterKey) {
63
+ this.iconTabBar.setSelectedKey(iconTabBarFilterKey);
64
+ }
65
+ if (changeToolbarContentAction) {
66
+ await this.context.actionService.execute(table.getId(), changeToolbarContentAction.id);
67
+ }
68
+
69
+ return [];
70
+ }
71
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "../fe-v2/create-table-action", "./create-table-custom-column", "../common/create-page-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar", "./op-enable-empty-row-mode", "../common/add-new-annotation-file", "./op-enable-variant-management", "./lr-enable-variant-management", "../fe-v2/add-new-subpage"], function (XMLView, ComponentContainer, _____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___fe_v2_create_table_action, ___create_table_custom_column, ___common_create_page_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar, ___op_enable_empty_row_mode, ___common_add_new_annotation_file, ___op_enable_variant_management, ___lr_enable_variant_management, ___fe_v2_add_new_subpage) {
3
+ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "../fe-v2/create-table-action", "./create-table-custom-column", "../common/create-page-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar", "./op-enable-empty-row-mode", "../common/add-new-annotation-file", "./op-enable-variant-management", "./lr-enable-variant-management", "../fe-v2/add-new-subpage", "./change-table-actions"], function (XMLView, ComponentContainer, _____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___fe_v2_create_table_action, ___create_table_custom_column, ___common_create_page_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar, ___op_enable_empty_row_mode, ___common_add_new_annotation_file, ___op_enable_variant_management, ___lr_enable_variant_management, ___fe_v2_add_new_subpage, ___change_table_actions) {
4
4
  "use strict";
5
5
 
6
6
  const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
@@ -19,6 +19,7 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
19
19
  const EnableObjectPageVariantManagementQuickAction = ___op_enable_variant_management["EnableObjectPageVariantManagementQuickAction"];
20
20
  const EnableListReportVariantManagementQuickAction = ___lr_enable_variant_management["EnableListReportVariantManagementQuickAction"];
21
21
  const AddNewSubpage = ___fe_v2_add_new_subpage["AddNewSubpage"];
22
+ const ChangeTableActionsQuickAction = ___change_table_actions["ChangeTableActionsQuickAction"];
22
23
  const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
23
24
  const LIST_REPORT_TYPE = 'sap.suite.ui.generic.template.ListReport.view.ListReport';
24
25
  const ANALYTICAL_LIST_PAGE_TYPE = 'sap.suite.ui.generic.template.AnalyticalListPage.view.AnalyticalListPage';
@@ -42,21 +43,21 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
42
43
  if (name === 'listReport') {
43
44
  definitionGroups.push({
44
45
  title: 'LIST REPORT',
45
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
46
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableActionsQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
46
47
  view,
47
48
  key: name + index
48
49
  });
49
50
  } else if (name === 'objectPage') {
50
51
  definitionGroups.push({
51
52
  title: 'OBJECT PAGE',
52
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, EnableObjectPageVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile, AddNewSubpage],
53
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, EnableObjectPageVariantManagementQuickAction, ChangeTableActionsQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile, AddNewSubpage],
53
54
  view,
54
55
  key: name + index
55
56
  });
56
57
  } else if (name === 'analyticalListPage') {
57
58
  definitionGroups.push({
58
59
  title: 'ANALYTICAL LIST PAGE',
59
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
60
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableActionsQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
60
61
  view,
61
62
  key: name + index
62
63
  });
@@ -24,6 +24,7 @@ import { AddNewAnnotationFile } from '../common/add-new-annotation-file';
24
24
  import { EnableObjectPageVariantManagementQuickAction } from './op-enable-variant-management';
25
25
  import { EnableListReportVariantManagementQuickAction } from './lr-enable-variant-management';
26
26
  import { AddNewSubpage } from '../fe-v2/add-new-subpage';
27
+ import { ChangeTableActionsQuickAction } from './change-table-actions';
27
28
  type PageName = 'listReport' | 'objectPage' | 'analyticalListPage';
28
29
 
29
30
  const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
@@ -53,6 +54,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
53
54
  ToggleClearFilterBarQuickAction,
54
55
  ToggleSemanticDateRangeFilterBar,
55
56
  EnableListReportVariantManagementQuickAction,
57
+ ChangeTableActionsQuickAction,
56
58
  ChangeTableColumnsQuickAction,
57
59
  AddTableActionQuickAction,
58
60
  AddTableCustomColumnQuickAction,
@@ -72,6 +74,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
72
74
  AddHeaderFieldQuickAction,
73
75
  AddCustomSectionQuickAction,
74
76
  EnableObjectPageVariantManagementQuickAction,
77
+ ChangeTableActionsQuickAction,
75
78
  ChangeTableColumnsQuickAction,
76
79
  AddTableActionQuickAction,
77
80
  AddTableCustomColumnQuickAction,
@@ -91,6 +94,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
91
94
  ToggleClearFilterBarQuickAction,
92
95
  ToggleSemanticDateRangeFilterBar,
93
96
  EnableListReportVariantManagementQuickAction,
97
+ ChangeTableActionsQuickAction,
94
98
  ChangeTableColumnsQuickAction,
95
99
  AddTableActionQuickAction,
96
100
  AddTableCustomColumnQuickAction,
@@ -0,0 +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;
80
+ });
81
+ //# sourceMappingURL=change-table-actions.js.map
@@ -0,0 +1,81 @@
1
+ import OverlayUtil from 'sap/ui/dt/OverlayUtil';
2
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
+ import UI5Element from 'sap/ui/core/Element';
4
+ import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
5
+ import { getControlById, findNestedElements } from '../../../utils/core';
6
+ import { TableQuickActionDefinitionBase } from '../table-quick-action-base';
7
+ import { MDC_ACTION_TOOLBAR_TYPE, MDC_TABLE_TYPE } from '../control-types';
8
+ import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
9
+ import { NestedQuickActionChild } from '@sap-ux-private/control-property-editor-common';
10
+ import { preprocessActionExecution } from '../fe-v2/create-table-custom-column';
11
+ import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
12
+
13
+ export const CHANGE_TABLE_ACTIONS = 'change-table-actions';
14
+ const ACTION_ID = 'CTX_SETTINGS';
15
+
16
+ /**
17
+ * Quick Action for changing table columns.
18
+ */
19
+ export class ChangeTableActionsQuickAction
20
+ extends TableQuickActionDefinitionBase
21
+ implements NestedQuickActionDefinition
22
+ {
23
+ public toolbarsMap: Record<string, UI5Element | undefined> = {};
24
+
25
+ constructor(context: QuickActionContext) {
26
+ super(CHANGE_TABLE_ACTIONS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_ACTIONS', context, undefined, [
27
+ DIALOG_ENABLEMENT_VALIDATOR
28
+ ]);
29
+ }
30
+
31
+ async initialize(): Promise<void> {
32
+ const toolbars = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
33
+ MDC_ACTION_TOOLBAR_TYPE
34
+ ]);
35
+
36
+ const processChild = async (child: NestedQuickActionChild, mapKey: string) => {
37
+ const mapEntry = this.tableMap[mapKey];
38
+ if (mapEntry) {
39
+ const tableToolbar = findNestedElements(mapEntry.table, toolbars)[0];
40
+ this.toolbarsMap[mapKey] = tableToolbar;
41
+ const actions = tableToolbar ? await this.context.actionService.get(tableToolbar.getId()) : [];
42
+ const changeToolbarContentAction = actions.find((action) => action.id === ACTION_ID);
43
+
44
+ child.enabled = !!changeToolbarContentAction?.enabled;
45
+ let tooltip: string | undefined;
46
+ if (!tableToolbar) {
47
+ tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_AVAILABLE');
48
+ } else if (!child.enabled) {
49
+ tooltip = this.context.resourceBundle.getText('TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE');
50
+ }
51
+ child.tooltip = tooltip ?? child.tooltip;
52
+ }
53
+ for (let idx = 0; idx < child.children.length; idx++) {
54
+ await processChild(child.children[idx], `${mapKey}/${idx}`);
55
+ }
56
+ };
57
+
58
+ await super.initialize();
59
+
60
+ // disable nested actions based on conditions
61
+ for (let idx = 0; idx < this.children.length; idx++) {
62
+ await processChild(this.children[idx], `${idx}`);
63
+ }
64
+ }
65
+
66
+ async execute(path: string): Promise<FlexCommand[]> {
67
+ const { table, sectionInfo, iconTabBarFilterKey } = this.tableMap[path];
68
+ const toolbar = this.toolbarsMap[path];
69
+ if (!table || !toolbar) {
70
+ return [];
71
+ }
72
+ preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
73
+ const toolbarControl = getControlById(toolbar.getId());
74
+ const controlOverlay = OverlayUtil.getClosestOverlayFor(toolbarControl);
75
+ if (controlOverlay) {
76
+ controlOverlay.setSelected(true);
77
+ await this.context.actionService.execute(toolbar.getId(), ACTION_ID);
78
+ }
79
+ return [];
80
+ }
81
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "./create-table-custom-column", "../common/create-page-action", "./create-table-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar", "./op-enable-empty-row-mode", "../common/add-new-annotation-file", "./enable-variant-management", "../fe-v4/add-new-subpage"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___create_table_custom_column, ___common_create_page_action, ___create_table_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar, ___op_enable_empty_row_mode, ___common_add_new_annotation_file, ___enable_variant_management, ___fe_v4_add_new_subpage) {
3
+ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "./create-table-custom-column", "../common/create-page-action", "./create-table-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar", "./op-enable-empty-row-mode", "../common/add-new-annotation-file", "./enable-variant-management", "../fe-v4/add-new-subpage", "../fe-v4/change-table-actions"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___create_table_custom_column, ___common_create_page_action, ___create_table_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar, ___op_enable_empty_row_mode, ___common_add_new_annotation_file, ___enable_variant_management, ___fe_v4_add_new_subpage, ___fe_v4_change_table_actions) {
4
4
  "use strict";
5
5
 
6
6
  const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
@@ -18,6 +18,7 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
18
18
  const AddNewAnnotationFile = ___common_add_new_annotation_file["AddNewAnnotationFile"];
19
19
  const EnableVariantManagementQuickAction = ___enable_variant_management["EnableVariantManagementQuickAction"];
20
20
  const AddNewSubpage = ___fe_v4_add_new_subpage["AddNewSubpage"];
21
+ const ChangeTableActionsQuickAction = ___fe_v4_change_table_actions["ChangeTableActionsQuickAction"];
21
22
  const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
22
23
  const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
23
24
 
@@ -40,14 +41,14 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
40
41
  if (name === 'listReport') {
41
42
  definitionGroups.push({
42
43
  title: 'LIST REPORT',
43
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
44
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableVariantManagementQuickAction, ChangeTableActionsQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile, AddNewSubpage],
44
45
  view,
45
46
  key: name + index
46
47
  });
47
48
  } else if (name === 'objectPage') {
48
49
  definitionGroups.push({
49
50
  title: 'OBJECT PAGE',
50
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, ChangeTableColumnsQuickAction, EnableVariantManagementQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile, AddNewSubpage],
51
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, EnableVariantManagementQuickAction, ChangeTableActionsQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile, AddNewSubpage],
51
52
  view,
52
53
  key: name + index
53
54
  });
@@ -18,6 +18,7 @@ import { EnableTableEmptyRowModeQuickAction } from './op-enable-empty-row-mode';
18
18
  import { AddNewAnnotationFile } from '../common/add-new-annotation-file';
19
19
  import { EnableVariantManagementQuickAction } from './enable-variant-management';
20
20
  import { AddNewSubpage } from '../fe-v4/add-new-subpage';
21
+ import { ChangeTableActionsQuickAction } from '../fe-v4/change-table-actions';
21
22
 
22
23
  type PageName = 'listReport' | 'objectPage';
23
24
 
@@ -47,6 +48,7 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
47
48
  ToggleClearFilterBarQuickAction,
48
49
  ToggleSemanticDateRangeFilterBar,
49
50
  EnableVariantManagementQuickAction,
51
+ ChangeTableActionsQuickAction,
50
52
  ChangeTableColumnsQuickAction,
51
53
  AddTableActionQuickAction,
52
54
  AddTableCustomColumnQuickAction,
@@ -65,8 +67,9 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
65
67
  AddPageActionQuickAction,
66
68
  AddHeaderFieldQuickAction,
67
69
  AddCustomSectionQuickAction,
68
- ChangeTableColumnsQuickAction,
69
70
  EnableVariantManagementQuickAction,
71
+ ChangeTableActionsQuickAction,
72
+ ChangeTableColumnsQuickAction,
70
73
  AddTableActionQuickAction,
71
74
  AddTableCustomColumnQuickAction,
72
75
  EnableTableEmptyRowModeQuickAction,
@@ -27,6 +27,7 @@ sap.ui.define([
27
27
  const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
28
28
  const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
29
29
  const SETTINGS_ID = 'CTX_SETTINGS';
30
+ const REARRANGE_TOOLBAR_SETTINGS_ID = 'CTX_SETTINGS0';
30
31
  const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
31
32
  async function getActionId(table) {
32
33
  const {major, minor} = await getUi5Version();
@@ -42,6 +43,13 @@ sap.ui.define([
42
43
  SETTINGS_ID
43
44
  ];
44
45
  }
46
+ async function getRearrangeToolbarContentActionId() {
47
+ const {major, minor} = await getUi5Version();
48
+ if (major === 1 && minor <= 127) {
49
+ return SETTINGS_ID;
50
+ }
51
+ return REARRANGE_TOOLBAR_SETTINGS_ID;
52
+ }
45
53
  class TableQuickActionDefinitionBase extends QuickActionDefinitionBase {
46
54
  isApplicable = false;
47
55
  children = [];
@@ -64,8 +72,14 @@ sap.ui.define([
64
72
  if (this.options.includeServiceAction) {
65
73
  const actions = await this.context.actionService.get(table.getId());
66
74
  const actionsIds = await getActionId(table);
67
- const changeColumnAction = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
68
- this.tableMap[tableMapKey].changeColumnActionId = changeColumnAction;
75
+ const changeColumnActionId = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
76
+ this.tableMap[tableMapKey].changeColumnActionId = changeColumnActionId;
77
+ const changeToolbarContentActionId = await getRearrangeToolbarContentActionId();
78
+ const changeToolbarContentAction = actions.find(action => action.id === changeToolbarContentActionId);
79
+ this.tableMap[tableMapKey].changeToolbarContentAction = changeToolbarContentAction ? {
80
+ id: changeToolbarContentAction.id,
81
+ enabled: changeToolbarContentAction.enabled
82
+ } : undefined;
69
83
  }
70
84
  }
71
85
  async initialize() {
@@ -29,6 +29,7 @@ import {
29
29
  const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
30
30
  const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
31
31
  const SETTINGS_ID = 'CTX_SETTINGS';
32
+ const REARRANGE_TOOLBAR_SETTINGS_ID = 'CTX_SETTINGS0';
32
33
  const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
33
34
 
34
35
  async function getActionId(table: UI5Element): Promise<string[]> {
@@ -44,6 +45,15 @@ async function getActionId(table: UI5Element): Promise<string[]> {
44
45
 
45
46
  return [M_TABLE_ACTION_ID, SETTINGS_ID];
46
47
  }
48
+
49
+ async function getRearrangeToolbarContentActionId(): Promise<string> {
50
+ const { major, minor } = await getUi5Version();
51
+ if (major === 1 && minor <= 127) {
52
+ return SETTINGS_ID;
53
+ }
54
+ return REARRANGE_TOOLBAR_SETTINGS_ID;
55
+ }
56
+
47
57
  export type TableQuickActionsOptions = {
48
58
  includeServiceAction?: boolean;
49
59
  areTableRowsRequired?: boolean;
@@ -65,6 +75,7 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
65
75
  tableUpdateEventAttachedOnce: boolean;
66
76
  iconTabBarFilterKey?: string;
67
77
  changeColumnActionId?: string;
78
+ changeToolbarContentAction?: { id: string; enabled: boolean };
68
79
  sectionInfo?: {
69
80
  section: ObjectPageSection;
70
81
  subSection: ObjectPageSubSection;
@@ -100,11 +111,18 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
100
111
  if (this.options.includeServiceAction) {
101
112
  const actions = await this.context.actionService.get(table.getId());
102
113
  const actionsIds = await getActionId(table);
103
-
104
- const changeColumnAction = actionsIds.find(
114
+ const changeColumnActionId = actionsIds.find(
105
115
  (actionId) => actions.findIndex((action) => action.id === actionId) > -1
106
116
  );
107
- this.tableMap[tableMapKey].changeColumnActionId = changeColumnAction;
117
+ this.tableMap[tableMapKey].changeColumnActionId = changeColumnActionId;
118
+ const changeToolbarContentActionId = await getRearrangeToolbarContentActionId();
119
+ const changeToolbarContentAction = actions.find((action) => action.id === changeToolbarContentActionId);
120
+ this.tableMap[tableMapKey].changeToolbarContentAction = changeToolbarContentAction
121
+ ? {
122
+ id: changeToolbarContentAction.id,
123
+ enabled: changeToolbarContentAction.enabled
124
+ }
125
+ : undefined;
108
126
  }
109
127
  }
110
128
 
@@ -17,12 +17,14 @@ QUICK_ACTION_ENABLE_TABLES_AND_VARIANT_MANAGEMENT=Enable Variant Management in T
17
17
  QUICK_ACTION_ADD_NEW_SUB_PAGE=Add Subpage
18
18
 
19
19
  V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
20
+ V2_QUICK_ACTION_CHANGE_TABLE_ACTIONS=Change Table Actions
20
21
  V2_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable "Clear" Button in Filter Bar
21
22
  V2_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable "Clear" Button in Filter Bar
22
23
 
23
24
  QUICK_ACTION_LR_ENABLE_SEMANTIC_DATE_RANGE_FILTER_BAR=Enable Semantic Date Range in Filter Bar
24
25
  QUICK_ACTION_LR_DISABLE_SEMANTIC_DATE_RANGE_FILTER_BAR=Disable Semantic Date Range in Filter Bar
25
26
 
27
+ V4_QUICK_ACTION_CHANGE_TABLE_ACTIONS=Change Table Actions
26
28
  V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
27
29
  V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable "Clear" Button in Filter Bar
28
30
  V4_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable "Clear" Button in Filter Bar
@@ -59,6 +61,8 @@ VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED=This option has been dis
59
61
  VARIANT_MANAGEMENT_FOR_TABLE_CONTROLS_IS_ALREADY_ENABLED=This option has been disabled because variant management is already enabled for the ''{0}''
60
62
  VARIANT_MANAGEMENT_FOR_CUSTOM_TABLES_NOT_SUPPORTED=Variant management cannot be set for custom table ''{0}''
61
63
  NO_TABLE_HEADER_TOOLBAR=This option has been disabled because the table does not have a header toolbar.
64
+ TABLE_HEADER_TOOLBAR_NOT_CHANGEABLE=This option is disabled because the contents of the table toolbar cannot be changed.
65
+ TABLE_HEADER_TOOLBAR_NOT_AVAILABLE=This option is disabled because the table toolbar is not available.
62
66
  DISABLE_SHOW_HEADER_CONTENT=This option has been disabled because the "Show Header Content" page property is set to false.
63
67
  ADD_ANNOTATION_FILE=Add Annotation File for ''{0}''
64
68
  SHOW_ANNOTATION_FILE=Show Annotation File for ''{0}''
@@ -58,6 +58,20 @@ sap.ui.define(["sap/ui/core/Component", "sap/ui/core/Element"], function (Compon
58
58
  function isA(type, element) {
59
59
  return !!element?.isA(type);
60
60
  }
61
+ function hasParent(component, parentIdToFind) {
62
+ const parent = component.getParent();
63
+ if (!parent) {
64
+ return false;
65
+ }
66
+ if (parent.getId() === parentIdToFind) {
67
+ return true;
68
+ }
69
+ return hasParent(parent, parentIdToFind);
70
+ }
71
+ function findNestedElements(ownerElement, candidates) {
72
+ const ownerId = ownerElement.getId();
73
+ return candidates.filter(item => hasParent(item, ownerId));
74
+ }
61
75
  var __exports = {
62
76
  __esModule: true
63
77
  };
@@ -65,6 +79,8 @@ sap.ui.define(["sap/ui/core/Component", "sap/ui/core/Element"], function (Compon
65
79
  __exports.getControlById = getControlById;
66
80
  __exports.isManagedObject = isManagedObject;
67
81
  __exports.isA = isA;
82
+ __exports.hasParent = hasParent;
83
+ __exports.findNestedElements = findNestedElements;
68
84
  return __exports;
69
85
  });
70
86
  //# sourceMappingURL=core.js.map
@@ -59,3 +59,22 @@ export function isManagedObject(element: object | undefined): element is Managed
59
59
  export function isA<T extends ManagedObject>(type: string, element: ManagedObject | undefined): element is T {
60
60
  return !!element?.isA(type);
61
61
  }
62
+
63
+ export function hasParent(component: ManagedObject, parentIdToFind: string): boolean {
64
+ const parent = component.getParent();
65
+ if (!parent) {
66
+ return false;
67
+ }
68
+ if (parent.getId() === parentIdToFind) {
69
+ return true;
70
+ }
71
+ return hasParent(parent, parentIdToFind);
72
+ }
73
+
74
+ export function findNestedElements(
75
+ ownerElement: Element,
76
+ candidates: Element[]
77
+ ): Element[] {
78
+ const ownerId = ownerElement.getId();
79
+ return candidates.filter((item) => hasParent(item, ownerId));
80
+ }
@@ -4,6 +4,7 @@ import Component from 'sap/ui/core/Component';
4
4
  import AppComponent from 'sap/fe/core/AppComponent';
5
5
  import XMLView from 'sap/ui/core/mvc/XMLView';
6
6
  import type { FlexSettings, Manifest } from 'sap/ui/rta/RuntimeAuthoring';
7
+
7
8
  import { isA } from './core';
8
9
  import CommandFactory from 'sap/ui/rta/command/CommandFactory';
9
10
  import { getOverlay } from '../cpe/utils';
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.19.16",
12
+ "version": "0.19.18",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,10 +25,10 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/adp-tooling": "0.13.25",
28
+ "@sap-ux/adp-tooling": "0.13.26",
29
29
  "@sap-ux/btp-utils": "1.0.2",
30
- "@sap-ux/feature-toggle": "0.2.3",
31
30
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.2",
31
+ "@sap-ux/feature-toggle": "0.2.3",
32
32
  "@sap-ux/logger": "0.6.0",
33
33
  "@sap-ux/project-access": "1.29.18",
34
34
  "@sap-ux/system-access": "0.5.34"
@@ -49,7 +49,7 @@
49
49
  "nock": "13.4.0",
50
50
  "npm-run-all2": "6.2.0",
51
51
  "supertest": "6.3.3",
52
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.14",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.15",
53
53
  "@sap-ux/axios-extension": "1.19.2",
54
54
  "@sap-ux/i18n": "0.2.3",
55
55
  "@sap-ux/store": "1.0.0",