@sap-ux/preview-middleware 0.16.173 → 0.16.174

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.
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["./utils", "../simple-quick-action-base", "sap/ui/core/Component"], function (___utils, ___simple_quick_action_base, Component) {
4
+ "use strict";
5
+
6
+ const areManifestChangesSupported = ___utils["areManifestChangesSupported"];
7
+ const prepareManifestChange = ___utils["prepareManifestChange"];
8
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
9
+ const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
10
+ const CONTROL_TYPES = ['sap.f.DynamicPage'];
11
+
12
+ /**
13
+ * Quick Action for enabling table filtering using table personalization settings.
14
+ */
15
+ class EnableListReportVariantManagementQuickAction extends SimpleQuickActionDefinitionBase {
16
+ isPageSmartVariantManagementEnabled = false;
17
+ forceRefreshAfterExecution = true;
18
+ constructor(context) {
19
+ super(ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLES_AND_CHARTS_VARIANT_MANAGEMENT', context, [{
20
+ run: () => {
21
+ if (this.ownerComponent) {
22
+ if (!this.isPageSmartVariantManagementEnabled) {
23
+ return {
24
+ type: 'error',
25
+ message: this.context.resourceBundle.getText('VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED')
26
+ };
27
+ }
28
+ }
29
+ return undefined;
30
+ }
31
+ }]);
32
+ }
33
+ async initialize() {
34
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
35
+ if (!manifestChangesSupported) {
36
+ return;
37
+ }
38
+ super.initialize();
39
+ if (this.control) {
40
+ this.ownerComponent = Component.getOwnerComponentFor(this.control);
41
+ if (!this.ownerComponent?.isA('sap.suite.ui.generic.template.ListReport.Component') && !this.ownerComponent?.isA('sap.suite.ui.generic.template.AnalyticalListPage.Component')) {
42
+ this.control = undefined;
43
+ } else {
44
+ const id = this.control.getId();
45
+ if (typeof id !== 'string') {
46
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
47
+ }
48
+ const value = this.context.changeService.getConfigurationPropertyValue(id, 'smartVariantManagement');
49
+ this.isPageSmartVariantManagementEnabled = value === undefined ? this.ownerComponent.getSmartVariantManagement() : value;
50
+ }
51
+ }
52
+ }
53
+ async execute() {
54
+ if (!this.control) {
55
+ return [];
56
+ }
57
+ const entitySet = this.ownerComponent.getEntitySet();
58
+ const command = await prepareManifestChange(this.context, 'component/settings', this.control, this.ownerComponent.getMetadata().getComponentName(), entitySet, {
59
+ smartVariantManagement: !this.isPageSmartVariantManagementEnabled
60
+ });
61
+ return command;
62
+ }
63
+ }
64
+ var __exports = {
65
+ __esModule: true
66
+ };
67
+ __exports.ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS;
68
+ __exports.EnableListReportVariantManagementQuickAction = EnableListReportVariantManagementQuickAction;
69
+ return __exports;
70
+ });
71
+ //# sourceMappingURL=lr-enable-variant-management.js.map
@@ -0,0 +1,95 @@
1
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+
3
+ import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
+ import { areManifestChangesSupported, prepareManifestChange } from './utils';
5
+ import ListReportComponent from 'sap/suite/ui/generic/template/ListReport';
6
+
7
+ import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
8
+ import Component from 'sap/ui/core/Component';
9
+
10
+ export const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
11
+
12
+ const CONTROL_TYPES = ['sap.f.DynamicPage'];
13
+
14
+ /**
15
+ * Quick Action for enabling table filtering using table personalization settings.
16
+ */
17
+ export class EnableListReportVariantManagementQuickAction
18
+ extends SimpleQuickActionDefinitionBase
19
+ implements SimpleQuickActionDefinition
20
+ {
21
+ private isPageSmartVariantManagementEnabled = false;
22
+ private ownerComponent: ListReportComponent;
23
+ readonly forceRefreshAfterExecution = true;
24
+
25
+ constructor(context: QuickActionContext) {
26
+ super(
27
+ ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS,
28
+ CONTROL_TYPES,
29
+ 'QUICK_ACTION_ENABLE_TABLES_AND_CHARTS_VARIANT_MANAGEMENT',
30
+ context,
31
+ [
32
+ {
33
+ run: () => {
34
+ if (this.ownerComponent) {
35
+ if (!this.isPageSmartVariantManagementEnabled) {
36
+ return {
37
+ type: 'error',
38
+ message: this.context.resourceBundle.getText(
39
+ 'VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED'
40
+ )
41
+ };
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ }
47
+ ]
48
+ );
49
+ }
50
+
51
+ async initialize(): Promise<void> {
52
+ const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
53
+ if (!manifestChangesSupported) {
54
+ return;
55
+ }
56
+ super.initialize();
57
+ if (this.control) {
58
+ this.ownerComponent = Component.getOwnerComponentFor(this.control) as unknown as ListReportComponent;
59
+ if (
60
+ !this.ownerComponent?.isA('sap.suite.ui.generic.template.ListReport.Component') &&
61
+ !this.ownerComponent?.isA('sap.suite.ui.generic.template.AnalyticalListPage.Component')
62
+ ) {
63
+ this.control = undefined;
64
+ } else {
65
+ const id = this.control.getId();
66
+ if (typeof id !== 'string') {
67
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
68
+ }
69
+ const value = this.context.changeService.getConfigurationPropertyValue(id, 'smartVariantManagement');
70
+ this.isPageSmartVariantManagementEnabled =
71
+ value === undefined ? this.ownerComponent.getSmartVariantManagement() : (value as boolean);
72
+ }
73
+ }
74
+ }
75
+
76
+ async execute(): Promise<FlexCommand[]> {
77
+ if (!this.control) {
78
+ return [];
79
+ }
80
+
81
+ const entitySet = this.ownerComponent.getEntitySet();
82
+ const command = await prepareManifestChange(
83
+ this.context,
84
+ 'component/settings',
85
+ this.control,
86
+ this.ownerComponent.getMetadata().getComponentName(),
87
+ entitySet,
88
+ {
89
+ smartVariantManagement: !this.isPageSmartVariantManagementEnabled
90
+ }
91
+ );
92
+
93
+ return command;
94
+ }
95
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../table-quick-action-base", "../control-types", "./utils", "./create-table-custom-column"], function (___table_quick_action_base, ___control_types, ___utils, ___create_table_custom_column) {
4
+ "use strict";
5
+
6
+ const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
7
+ const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
8
+ const areManifestChangesSupported = ___utils["areManifestChangesSupported"];
9
+ const prepareManifestChange = ___utils["prepareManifestChange"];
10
+ const preprocessActionExecution = ___create_table_custom_column["preprocessActionExecution"];
11
+ const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
12
+ const CONTROL_TYPES = [SMART_TABLE_TYPE];
13
+ const OBJECT_PAGE_COMPONENT_NAME = 'sap.suite.ui.generic.template.ObjectPage';
14
+ class EnableObjectPageVariantManagementQuickAction extends TableQuickActionDefinitionBase {
15
+ forceRefreshAfterExecution = true;
16
+ constructor(context) {
17
+ super(ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLES_AND_VARIANT_MANAGEMENT', context);
18
+ }
19
+ async initialize() {
20
+ if (!(await areManifestChangesSupported(this.context.manifest))) {
21
+ this.isApplicable = false;
22
+ return;
23
+ }
24
+ await super.initialize();
25
+ const processChild = (child, mapKey) => {
26
+ const alreadyEnabledTooltip = this.context.resourceBundle.getText('VARIANT_MANAGEMENT_FOR_TABLE_CONTROLS_IS_ALREADY_ENABLED', [child.label]);
27
+ const table = this.tableMap[mapKey]?.table;
28
+ if (table) {
29
+ const id = table.getId();
30
+ if (typeof id !== 'string') {
31
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
32
+ }
33
+ let value = this.context.changeService.getConfigurationPropertyValue(id, 'variantManagement');
34
+ if (value === undefined) {
35
+ value = !!table.getVariantManagement();
36
+ }
37
+ const hasItems = !!table.getTable().getBindingInfo('items');
38
+ if (value || !hasItems) {
39
+ child.enabled = false;
40
+ child.tooltip = hasItems ? alreadyEnabledTooltip : undefined;
41
+ }
42
+ }
43
+ child.children.forEach((nestedChild, idx) => processChild(nestedChild, `${mapKey}/${idx.toFixed(0)}`));
44
+ };
45
+ this.children.forEach((nestedChild, idx) => processChild(nestedChild, `${idx.toFixed(0)}`));
46
+ }
47
+ async execute(path) {
48
+ const {
49
+ table,
50
+ sectionInfo,
51
+ iconTabBarFilterKey
52
+ } = this.tableMap[path];
53
+ if (!table) {
54
+ throw Error('Internal error. Table element not found');
55
+ }
56
+ const entitySet = this.context.view.getParent()?.getProperty('entitySet');
57
+ if (!entitySet) {
58
+ throw Error('Internal error. Object Page entity set not found');
59
+ }
60
+ preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
61
+ this.selectOverlay(table);
62
+ const commands = await prepareManifestChange(this.context, `component/settings/sections/${this.getSectionID(table)}/tableSettings`, table, OBJECT_PAGE_COMPONENT_NAME, entitySet, {
63
+ 'variantManagement': true
64
+ });
65
+ return commands ?? [];
66
+ }
67
+ getSectionID(table) {
68
+ let lineItem = 'com.sap.vocabularies.UI.v1.LineItem';
69
+ if (table.data().lineItemQualifier) {
70
+ lineItem = `${lineItem}#${table.data().lineItemQualifier}`;
71
+ }
72
+ const navSegment = table.getTable().getBindingInfo('items').path ?? '';
73
+ return `${navSegment ? navSegment + '::' : ''}${lineItem}`;
74
+ }
75
+ }
76
+ var __exports = {
77
+ __esModule: true
78
+ };
79
+ __exports.ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS;
80
+ __exports.EnableObjectPageVariantManagementQuickAction = EnableObjectPageVariantManagementQuickAction;
81
+ return __exports;
82
+ });
83
+ //# sourceMappingURL=op-enable-variant-management.js.map
@@ -0,0 +1,107 @@
1
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+
3
+ import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
+ import { TableQuickActionDefinitionBase } from '../table-quick-action-base';
5
+ import { SMART_TABLE_TYPE } from '../control-types';
6
+
7
+ import { NestedQuickActionChild } from '@sap-ux-private/control-property-editor-common';
8
+ import { areManifestChangesSupported, prepareManifestChange } from './utils';
9
+ import { preprocessActionExecution } from './create-table-custom-column';
10
+ import SmartTable from 'sap/ui/comp/smarttable/SmartTable';
11
+ import UI5Element from 'sap/ui/core/Element';
12
+ import SmartTableExtended from 'sap/ui/comp/smarttable';
13
+
14
+ export const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
15
+
16
+ const CONTROL_TYPES = [SMART_TABLE_TYPE];
17
+
18
+ const OBJECT_PAGE_COMPONENT_NAME = 'sap.suite.ui.generic.template.ObjectPage';
19
+
20
+ export class EnableObjectPageVariantManagementQuickAction
21
+ extends TableQuickActionDefinitionBase
22
+ implements NestedQuickActionDefinition
23
+ {
24
+ readonly forceRefreshAfterExecution = true;
25
+
26
+ constructor(context: QuickActionContext) {
27
+ super(
28
+ ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS,
29
+ CONTROL_TYPES,
30
+ 'QUICK_ACTION_ENABLE_TABLES_AND_VARIANT_MANAGEMENT',
31
+ context
32
+ );
33
+ }
34
+
35
+ async initialize(): Promise<void> {
36
+ if (!(await areManifestChangesSupported(this.context.manifest))) {
37
+ this.isApplicable = false;
38
+ return;
39
+ }
40
+
41
+ await super.initialize();
42
+
43
+ const processChild = (child: NestedQuickActionChild, mapKey: string) => {
44
+ const alreadyEnabledTooltip = this.context.resourceBundle.getText(
45
+ 'VARIANT_MANAGEMENT_FOR_TABLE_CONTROLS_IS_ALREADY_ENABLED',
46
+ [child.label]
47
+ );
48
+ const table = this.tableMap[mapKey]?.table;
49
+
50
+ if (table) {
51
+ const id = table.getId();
52
+ if (typeof id !== 'string') {
53
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
54
+ }
55
+ let value = this.context.changeService.getConfigurationPropertyValue(id, 'variantManagement');
56
+ if (value === undefined) {
57
+ value = !!(table as SmartTableExtended).getVariantManagement();
58
+ }
59
+ const hasItems = !!(table as SmartTable).getTable().getBindingInfo('items');
60
+
61
+ if (value || !hasItems) {
62
+ child.enabled = false;
63
+ child.tooltip = hasItems ? alreadyEnabledTooltip : undefined;
64
+ }
65
+ }
66
+ child.children.forEach((nestedChild, idx) => processChild(nestedChild, `${mapKey}/${idx.toFixed(0)}`));
67
+ };
68
+ this.children.forEach((nestedChild, idx) => processChild(nestedChild, `${idx.toFixed(0)}`));
69
+ }
70
+
71
+ async execute(path: string): Promise<FlexCommand[]> {
72
+ const { table, sectionInfo, iconTabBarFilterKey } = this.tableMap[path];
73
+ if (!table) {
74
+ throw Error('Internal error. Table element not found');
75
+ }
76
+
77
+ const entitySet = this.context.view.getParent()?.getProperty('entitySet') as string | undefined;
78
+ if (!entitySet) {
79
+ throw Error('Internal error. Object Page entity set not found');
80
+ }
81
+
82
+ preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
83
+ this.selectOverlay(table);
84
+
85
+ const commands = await prepareManifestChange(
86
+ this.context,
87
+ `component/settings/sections/${this.getSectionID(table)}/tableSettings`,
88
+ table,
89
+ OBJECT_PAGE_COMPONENT_NAME,
90
+ entitySet,
91
+ {
92
+ 'variantManagement': true
93
+ }
94
+ );
95
+
96
+ return commands ?? [];
97
+ }
98
+
99
+ getSectionID(table: UI5Element): string {
100
+ let lineItem = 'com.sap.vocabularies.UI.v1.LineItem';
101
+ if (table.data().lineItemQualifier) {
102
+ lineItem = `${lineItem}#${table.data().lineItemQualifier}`;
103
+ }
104
+ const navSegment = (table as SmartTable).getTable().getBindingInfo('items').path ?? '';
105
+ return `${navSegment ? navSegment + '::' : ''}${lineItem}`;
106
+ }
107
+ }
@@ -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"], 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) {
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"], 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) {
4
4
  "use strict";
5
5
 
6
6
  const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
@@ -16,6 +16,8 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
16
16
  const ToggleSemanticDateRangeFilterBar = ___lr_enable_semantic_date_range_filter_bar["ToggleSemanticDateRangeFilterBar"];
17
17
  const EnableTableEmptyRowModeQuickAction = ___op_enable_empty_row_mode["EnableTableEmptyRowModeQuickAction"];
18
18
  const AddNewAnnotationFile = ___common_add_new_annotation_file["AddNewAnnotationFile"];
19
+ const EnableObjectPageVariantManagementQuickAction = ___op_enable_variant_management["EnableObjectPageVariantManagementQuickAction"];
20
+ const EnableListReportVariantManagementQuickAction = ___lr_enable_variant_management["EnableListReportVariantManagementQuickAction"];
19
21
  const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
20
22
  const LIST_REPORT_TYPE = 'sap.suite.ui.generic.template.ListReport.view.ListReport';
21
23
  const ANALYTICAL_LIST_PAGE_TYPE = 'sap.suite.ui.generic.template.AnalyticalListPage.view.AnalyticalListPage';
@@ -39,21 +41,21 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/ComponentContainer", "../
39
41
  if (name === 'listReport') {
40
42
  definitionGroups.push({
41
43
  title: 'LIST REPORT',
42
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
44
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
43
45
  view,
44
46
  key: name + index
45
47
  });
46
48
  } else if (name === 'objectPage') {
47
49
  definitionGroups.push({
48
50
  title: 'OBJECT PAGE',
49
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile],
51
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, EnableObjectPageVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile],
50
52
  view,
51
53
  key: name + index
52
54
  });
53
55
  } else if (name === 'analyticalListPage') {
54
56
  definitionGroups.push({
55
57
  title: 'ANALYTICAL LIST PAGE',
56
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
58
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableListReportVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
57
59
  view,
58
60
  key: name + index
59
61
  });
@@ -21,6 +21,8 @@ import { EnableTableFilteringQuickAction } from './lr-enable-table-filtering';
21
21
  import { ToggleSemanticDateRangeFilterBar } from './lr-enable-semantic-date-range-filter-bar';
22
22
  import { EnableTableEmptyRowModeQuickAction } from './op-enable-empty-row-mode';
23
23
  import { AddNewAnnotationFile } from '../common/add-new-annotation-file';
24
+ import { EnableObjectPageVariantManagementQuickAction } from './op-enable-variant-management';
25
+ import { EnableListReportVariantManagementQuickAction } from './lr-enable-variant-management';
24
26
  type PageName = 'listReport' | 'objectPage' | 'analyticalListPage';
25
27
 
26
28
  const OBJECT_PAGE_TYPE = 'sap.suite.ui.generic.template.ObjectPage.view.Details';
@@ -49,6 +51,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
49
51
  AddPageActionQuickAction,
50
52
  ToggleClearFilterBarQuickAction,
51
53
  ToggleSemanticDateRangeFilterBar,
54
+ EnableListReportVariantManagementQuickAction,
52
55
  ChangeTableColumnsQuickAction,
53
56
  AddTableActionQuickAction,
54
57
  AddTableCustomColumnQuickAction,
@@ -66,6 +69,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
66
69
  AddPageActionQuickAction,
67
70
  AddHeaderFieldQuickAction,
68
71
  AddCustomSectionQuickAction,
72
+ EnableObjectPageVariantManagementQuickAction,
69
73
  ChangeTableColumnsQuickAction,
70
74
  AddTableActionQuickAction,
71
75
  AddTableCustomColumnQuickAction,
@@ -83,6 +87,7 @@ export default class FEV2QuickActionRegistry extends QuickActionDefinitionRegist
83
87
  AddPageActionQuickAction,
84
88
  ToggleClearFilterBarQuickAction,
85
89
  ToggleSemanticDateRangeFilterBar,
90
+ EnableListReportVariantManagementQuickAction,
86
91
  ChangeTableColumnsQuickAction,
87
92
  AddTableActionQuickAction,
88
93
  AddTableCustomColumnQuickAction,
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../simple-quick-action-base", "sap/ui/core/Component", "../../../utils/version", "../../../utils/fe-v4"], function (___simple_quick_action_base, Component, _____utils_version, _____utils_fe_v4) {
4
+ "use strict";
5
+
6
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
7
+ const getUi5Version = _____utils_version["getUi5Version"];
8
+ const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
9
+ const createManifestPropertyChange = _____utils_fe_v4["createManifestPropertyChange"];
10
+ const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
11
+
12
+ // sap.f.DynamicPage for list report and sap.uxap.ObjectPageLayout for object page.
13
+ const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
14
+
15
+ /**
16
+ * Quick Action for enabling table filtering using table personalization settings.
17
+ */
18
+ class EnableVariantManagementQuickAction extends SimpleQuickActionDefinitionBase {
19
+ pageSmartVariantManagementMode = '';
20
+ constructor(context) {
21
+ super(ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLES_AND_CHARTS_VARIANT_MANAGEMENT', context, [{
22
+ run: () => {
23
+ if (this.control) {
24
+ if (this.pageSmartVariantManagementMode === 'Control') {
25
+ return {
26
+ type: 'error',
27
+ message: this.context.resourceBundle.getText('VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED')
28
+ };
29
+ }
30
+ }
31
+ return undefined;
32
+ }
33
+ }]);
34
+ }
35
+ forceRefreshAfterExecution = true;
36
+ async initialize() {
37
+ const version = await getUi5Version();
38
+ if (isLowerThanMinimalUi5Version(version, {
39
+ major: 1,
40
+ minor: 131
41
+ })) {
42
+ return;
43
+ }
44
+ super.initialize();
45
+ if (this.control) {
46
+ this.ownerComponent = Component.getOwnerComponentFor(this.control);
47
+ if (!this.ownerComponent?.isA('sap.fe.templates.ListReport.Component') && !this.ownerComponent?.isA('sap.fe.templates.ObjectPage.Component') && !this.ownerComponent?.isA('sap.fe.templates.AnalyticalListPage.Component')) {
48
+ this.control = undefined;
49
+ } else {
50
+ const id = this.control.getId();
51
+ if (typeof id !== 'string') {
52
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
53
+ }
54
+ const value = this.context.changeService.getConfigurationPropertyValue(id, 'variantManagement');
55
+ this.pageSmartVariantManagementMode = value === undefined ? this.ownerComponent.getVariantManagement() : value;
56
+ }
57
+ }
58
+ }
59
+ async execute() {
60
+ if (!this.control) {
61
+ return [];
62
+ }
63
+ const {
64
+ flexSettings
65
+ } = this.context;
66
+ const command = await createManifestPropertyChange(this.control, flexSettings, {
67
+ variantManagement: 'Control'
68
+ });
69
+ if (command) {
70
+ return [command];
71
+ } else {
72
+ return [];
73
+ }
74
+ }
75
+ }
76
+ var __exports = {
77
+ __esModule: true
78
+ };
79
+ __exports.ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS;
80
+ __exports.EnableVariantManagementQuickAction = EnableVariantManagementQuickAction;
81
+ return __exports;
82
+ });
83
+ //# sourceMappingURL=enable-variant-management.js.map
@@ -0,0 +1,93 @@
1
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+
3
+ import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
+
5
+ import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
6
+ import Component from 'sap/ui/core/Component';
7
+ import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
8
+ import { createManifestPropertyChange } from '../../../utils/fe-v4';
9
+ import ListReportComponent from 'sap/suite/ui/generic/template/ListReport';
10
+
11
+ export const ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS = 'enable-variant-management-in-tables-charts';
12
+
13
+ // sap.f.DynamicPage for list report and sap.uxap.ObjectPageLayout for object page.
14
+ const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
15
+
16
+ /**
17
+ * Quick Action for enabling table filtering using table personalization settings.
18
+ */
19
+ export class EnableVariantManagementQuickAction
20
+ extends SimpleQuickActionDefinitionBase
21
+ implements SimpleQuickActionDefinition
22
+ {
23
+ private pageSmartVariantManagementMode = '';
24
+ private ownerComponent: ListReportComponent;
25
+ constructor(context: QuickActionContext) {
26
+ super(
27
+ ENABLE_VARIANT_MANAGEMENT_IN_TABLES_CHARTS,
28
+ CONTROL_TYPES,
29
+ 'QUICK_ACTION_ENABLE_TABLES_AND_CHARTS_VARIANT_MANAGEMENT',
30
+ context,
31
+ [
32
+ {
33
+ run: () => {
34
+ if (this.control) {
35
+ if (this.pageSmartVariantManagementMode === 'Control') {
36
+ return {
37
+ type: 'error',
38
+ message: this.context.resourceBundle.getText(
39
+ 'VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED'
40
+ )
41
+ };
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ }
47
+ ]
48
+ );
49
+ }
50
+
51
+ readonly forceRefreshAfterExecution = true;
52
+ async initialize(): Promise<void> {
53
+ const version = await getUi5Version();
54
+ if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 131 })) {
55
+ return;
56
+ }
57
+ super.initialize();
58
+ if (this.control) {
59
+ this.ownerComponent = Component.getOwnerComponentFor(this.control) as unknown as ListReportComponent;
60
+ if (
61
+ !this.ownerComponent?.isA('sap.fe.templates.ListReport.Component') &&
62
+ !this.ownerComponent?.isA('sap.fe.templates.ObjectPage.Component') &&
63
+ !this.ownerComponent?.isA('sap.fe.templates.AnalyticalListPage.Component')
64
+ ) {
65
+ this.control = undefined;
66
+ } else {
67
+ const id = this.control.getId();
68
+ if (typeof id !== 'string') {
69
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
70
+ }
71
+ const value = this.context.changeService.getConfigurationPropertyValue(id, 'variantManagement');
72
+ this.pageSmartVariantManagementMode =
73
+ value === undefined ? this.ownerComponent.getVariantManagement() : (value as string);
74
+ }
75
+ }
76
+ }
77
+
78
+ async execute(): Promise<FlexCommand[]> {
79
+ if (!this.control) {
80
+ return [];
81
+ }
82
+ const { flexSettings } = this.context;
83
+
84
+ const command = await createManifestPropertyChange(this.control, flexSettings, {
85
+ variantManagement: 'Control'
86
+ });
87
+ if (command) {
88
+ return [command];
89
+ } else {
90
+ return [];
91
+ }
92
+ }
93
+ }
@@ -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"], 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) {
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"], 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) {
4
4
  "use strict";
5
5
 
6
6
  const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
@@ -16,6 +16,7 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
16
16
  const ToggleSemanticDateRangeFilterBar = ___lr_enable_semantic_date_range_filter_bar["ToggleSemanticDateRangeFilterBar"];
17
17
  const EnableTableEmptyRowModeQuickAction = ___op_enable_empty_row_mode["EnableTableEmptyRowModeQuickAction"];
18
18
  const AddNewAnnotationFile = ___common_add_new_annotation_file["AddNewAnnotationFile"];
19
+ const EnableVariantManagementQuickAction = ___enable_variant_management["EnableVariantManagementQuickAction"];
19
20
  const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
20
21
  const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
21
22
 
@@ -38,14 +39,14 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
38
39
  if (name === 'listReport') {
39
40
  definitionGroups.push({
40
41
  title: 'LIST REPORT',
41
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
42
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, EnableVariantManagementQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction, AddNewAnnotationFile],
42
43
  view,
43
44
  key: name + index
44
45
  });
45
46
  } else if (name === 'objectPage') {
46
47
  definitionGroups.push({
47
48
  title: 'OBJECT PAGE',
48
- definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile],
49
+ definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, AddHeaderFieldQuickAction, AddCustomSectionQuickAction, ChangeTableColumnsQuickAction, EnableVariantManagementQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableEmptyRowModeQuickAction, AddNewAnnotationFile],
49
50
  view,
50
51
  key: name + index
51
52
  });
@@ -16,6 +16,7 @@ import { EnableTableFilteringQuickAction } from './lr-enable-table-filtering';
16
16
  import { ToggleSemanticDateRangeFilterBar } from './lr-enable-semantic-date-range-filter-bar';
17
17
  import { EnableTableEmptyRowModeQuickAction } from './op-enable-empty-row-mode';
18
18
  import { AddNewAnnotationFile } from '../common/add-new-annotation-file';
19
+ import { EnableVariantManagementQuickAction } from './enable-variant-management';
19
20
 
20
21
  type PageName = 'listReport' | 'objectPage';
21
22
 
@@ -44,6 +45,7 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
44
45
  AddPageActionQuickAction,
45
46
  ToggleClearFilterBarQuickAction,
46
47
  ToggleSemanticDateRangeFilterBar,
48
+ EnableVariantManagementQuickAction,
47
49
  ChangeTableColumnsQuickAction,
48
50
  AddTableActionQuickAction,
49
51
  AddTableCustomColumnQuickAction,
@@ -62,6 +64,7 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
62
64
  AddHeaderFieldQuickAction,
63
65
  AddCustomSectionQuickAction,
64
66
  ChangeTableColumnsQuickAction,
67
+ EnableVariantManagementQuickAction,
65
68
  AddTableActionQuickAction,
66
69
  AddTableCustomColumnQuickAction,
67
70
  EnableTableEmptyRowModeQuickAction,
@@ -79,8 +79,7 @@ export class QuickActionService implements Service {
79
79
  }
80
80
  if (externalFileChange.match(action)) {
81
81
  await this.reloadQuickActions(this.controlTreeIndex);
82
- }
83
-
82
+ }
84
83
  });
85
84
 
86
85
  this.outlineService.onOutlineChange(async (event) => {
@@ -11,6 +11,8 @@ QUICK_ACTION_ADD_NEW_ANNOTATION_FILE=Add Local Annotation File
11
11
  QUICK_ACTION_SHOW_ANNOTATION_FILE=Show Local Annotation File
12
12
  QUICK_ACTION_ENABLE_TABLE_FILTERING=Enable Table Filtering for Page Variants
13
13
  QUICK_ACTION_ENABLE_TABLE_EMPTY_ROW_MODE=Enable Empty Row Mode for Tables
14
+ QUICK_ACTION_ENABLE_TABLES_AND_CHARTS_VARIANT_MANAGEMENT=Enable Variant Management in Tables and Charts
15
+ QUICK_ACTION_ENABLE_TABLES_AND_VARIANT_MANAGEMENT=Enable Variant Management in Tables
14
16
 
15
17
  V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
16
18
  V2_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable "Clear" Button in Filter Bar
@@ -22,7 +24,6 @@ QUICK_ACTION_LR_DISABLE_SEMANTIC_DATE_RANGE_FILTER_BAR=Disable Semantic Date Ran
22
24
  V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change Table Columns
23
25
  V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable "Clear" Button in Filter Bar
24
26
  V4_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable "Clear" Button in Filter Bar
25
-
26
27
  ADP_ADD_FRAGMENT_DIALOG_TITLE = Add XML Fragment
27
28
  ADP_ADD_FRAGMENT_DIALOG_CONTROL_TYPE_LABEL = Control Type
28
29
  ADP_ADD_FRAGMENT_DIALOG_AGGREGATION_LABEL = Target Aggregation
@@ -36,7 +37,6 @@ ADP_ADD_TWO_FRAGMENTS_WITH_TEMPLATE_NOTIFICATION = Note: The "{0}.fragment.xml"
36
37
  ADP_SYNC_VIEWS_MESSAGE = Synchronous views are detected for this application. Controller extensions are not supported for such views and will be disabled.
37
38
  ADP_REUSE_COMPONENTS_MESSAGE = Reuse components are detected for some views in this application. Controller extensions, adding fragments and manifest changes are not supported for such views and will be disabled.
38
39
  ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE = This action is disabled because a dialog is already open
39
-
40
40
  CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be visible after save and reload.
41
41
 
42
42
  TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again.
@@ -47,9 +47,12 @@ TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE=This action has been disabled because t
47
47
  TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE=This option is disabled because table filtering for page variants is already enabled
48
48
  EMPTY_ROW_MODE_IS_ALREADY_ENABLED=This option has been disabled because empty row mode is already enabled for this table
49
49
  EMPTY_ROW_MODE_IS_NOT_SUPPORTED=This action is disabled because empty row mode is not supported for analytical and tree tables
50
+ VARIANT_MANAGEMENT_FOR_PAGE_CONTROLS_IS_ALREADY_ENABLED=This option has been disabled because variant management is already enabled for tables and charts
51
+ VARIANT_MANAGEMENT_FOR_TABLE_CONTROLS_IS_ALREADY_ENABLED=This option has been disabled because variant management is already enabled for the ''{0}''
50
52
 
51
53
  ADD_ANNOTATION_FILE=Add Annotation File for ''{0}''
52
54
  SHOW_ANNOTATION_FILE=Show Annotation File for ''{0}''
53
55
  EXTEND_WITH_ANNOTATION=Extend With Annotation
54
56
  ANNOTATION_FILE_HAS_BEEN_FOUND=An annotation file has been found.
55
- SHOW_FILE_IN_VSCODE=Show File in VSCode
57
+ SHOW_FILE_IN_VSCODE=Show File in VSCode
58
+
@@ -253,7 +253,7 @@ sap.ui.define((function () { 'use strict';
253
253
  const words = [];
254
254
  let word = '';
255
255
  let lookForUpperCase = true;
256
- for (let i = 0; i < text.length; i++) {
256
+ for (let i = 0; i < (text ?? '').length; i++) {
257
257
  const character = text[i];
258
258
  if (lookForUpperCase) {
259
259
  // make sure that the first letter is capitalized
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.16.173",
12
+ "version": "0.16.174",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -27,8 +27,8 @@
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "@sap-ux/logger": "0.6.0",
29
29
  "@sap-ux/feature-toggle": "0.2.3",
30
- "@sap-ux/btp-utils": "0.17.2",
31
30
  "@sap-ux/adp-tooling": "0.12.112",
31
+ "@sap-ux/btp-utils": "0.17.2",
32
32
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.32",
33
33
  "@sap-ux/project-access": "1.29.0"
34
34
  },
@@ -46,7 +46,7 @@
46
46
  "supertest": "6.3.3",
47
47
  "@sap-ux-private/playwright": "0.1.0",
48
48
  "dotenv": "16.3.1",
49
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.50",
49
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.51",
50
50
  "@sap-ux/axios-extension": "1.18.1",
51
51
  "@sap-ux/store": "1.0.0",
52
52
  "@sap-ux/ui5-info": "0.8.3",