@sap-ux/preview-middleware 0.23.48 → 0.23.49

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 (36) hide show
  1. package/dist/client/adp/command-executor.js +99 -66
  2. package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
  3. package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
  4. package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
  5. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
  9. package/dist/client/adp/extension-point.js +81 -60
  10. package/dist/client/adp/init.js +100 -99
  11. package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
  12. package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
  13. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
  14. package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
  15. package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
  16. package/dist/client/adp/sync-views-utils.js +119 -83
  17. package/dist/client/cpe/changes/flex-change.js +64 -48
  18. package/dist/client/cpe/changes/service.js +492 -367
  19. package/dist/client/cpe/communication-service.js +41 -29
  20. package/dist/client/cpe/connector-service.js +87 -64
  21. package/dist/client/cpe/context-menu-service.js +87 -74
  22. package/dist/client/cpe/control-data.js +353 -263
  23. package/dist/client/cpe/documentation.js +183 -126
  24. package/dist/client/cpe/init.js +69 -75
  25. package/dist/client/cpe/outline/service.js +60 -45
  26. package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
  27. package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
  28. package/dist/client/cpe/rta-service.js +91 -69
  29. package/dist/client/cpe/selection.js +239 -187
  30. package/dist/client/cpe/types.js +0 -4
  31. package/dist/client/flp/init.js +403 -296
  32. package/dist/client/manifest.json +7 -4
  33. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
  34. package/dist/client/utils/info-center-message.js +59 -31
  35. package/dist/client/utils/version.js +128 -72
  36. package/package.json +2 -2
@@ -1,153 +1,171 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- 'sap/ui/dt/OverlayRegistry',
5
- 'sap/ui/rta/command/CommandFactory',
6
- '../../../utils/application',
7
- '../../../utils/fe-v4',
8
- '../../../utils/version',
9
- '../../api-handler',
10
- '../../dialog-factory',
11
- '../dialog-enablement-validator',
12
- '../fe-v2/utils',
13
- '../quick-action-base'
14
- ], function (___sap_ux_private_control_property_editor_common, OverlayRegistry, CommandFactory, _____utils_application, _____utils_fe_v4, _____utils_version, ____api_handler, ____dialog_factory, ___dialog_enablement_validator, ___fe_v2_utils, ___quick_action_base) {
15
- 'use strict';
16
- const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
17
- const getApplicationType = _____utils_application['getApplicationType'];
18
- const getV4AppComponent = _____utils_fe_v4['getV4AppComponent'];
19
- const getUi5Version = _____utils_version['getUi5Version'];
20
- const isLowerThanMinimalUi5Version = _____utils_version['isLowerThanMinimalUi5Version'];
21
- const getDataSourceAnnotationFileMap = ____api_handler['getDataSourceAnnotationFileMap'];
22
- const DialogFactory = ____dialog_factory['DialogFactory'];
23
- const DialogNames = ____dialog_factory['DialogNames'];
24
- const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator['DIALOG_ENABLEMENT_VALIDATOR'];
25
- const getV2AppComponent = ___fe_v2_utils['getV2AppComponent'];
26
- const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
27
- const ADD_NEW_ANNOTATION_FILE = 'add-new-annotation-file';
28
- const ADD_NEW_ANNOTATION_FILE_TITLE = 'QUICK_ACTION_ADD_NEW_ANNOTATION_FILE';
29
- class AddNewAnnotationFile extends QuickActionDefinitionBase {
30
- children = [];
31
- get quickActionSteps() {
32
- return 1;
33
- }
34
- kind = ((() => NESTED_QUICK_ACTION_KIND)());
35
- type = ((() => ADD_NEW_ANNOTATION_FILE)());
36
- forceRefreshAfterExecution = true;
37
- isApplicable = true;
38
- get id() {
39
- return `${ this.context.key }-${ this.type }`;
40
- }
41
- constructor(context) {
42
- super(ADD_NEW_ANNOTATION_FILE, NESTED_QUICK_ACTION_KIND, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
43
- this.context = context;
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "sap/ui/dt/OverlayRegistry", "sap/ui/rta/command/CommandFactory", "../../../utils/application", "../../../utils/fe-v4", "../../../utils/version", "../../api-handler", "../../dialog-factory", "../dialog-enablement-validator", "../fe-v2/utils", "../quick-action-base"], function (___sap_ux_private_control_property_editor_common, OverlayRegistry, CommandFactory, _____utils_application, _____utils_fe_v4, _____utils_version, ____api_handler, ____dialog_factory, ___dialog_enablement_validator, ___fe_v2_utils, ___quick_action_base) {
4
+ "use strict";
5
+
6
+ const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["NESTED_QUICK_ACTION_KIND"];
7
+ const getApplicationType = _____utils_application["getApplicationType"];
8
+ const getV4AppComponent = _____utils_fe_v4["getV4AppComponent"];
9
+ const getUi5Version = _____utils_version["getUi5Version"];
10
+ const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
11
+ const getDataSourceAnnotationFileMap = ____api_handler["getDataSourceAnnotationFileMap"];
12
+ const DialogFactory = ____dialog_factory["DialogFactory"];
13
+ const DialogNames = ____dialog_factory["DialogNames"];
14
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
15
+ const getV2AppComponent = ___fe_v2_utils["getV2AppComponent"];
16
+ const QuickActionDefinitionBase = ___quick_action_base["QuickActionDefinitionBase"];
17
+ const ADD_NEW_ANNOTATION_FILE = 'add-new-annotation-file';
18
+ const ADD_NEW_ANNOTATION_FILE_TITLE = 'QUICK_ACTION_ADD_NEW_ANNOTATION_FILE';
19
+
20
+ /**
21
+ * Add New Annotation File.
22
+ */
23
+ class AddNewAnnotationFile extends QuickActionDefinitionBase {
24
+ children = [];
25
+ get quickActionSteps() {
26
+ return 1;
27
+ }
28
+ kind = (() => NESTED_QUICK_ACTION_KIND)();
29
+ type = (() => ADD_NEW_ANNOTATION_FILE)();
30
+ forceRefreshAfterExecution = true;
31
+ isApplicable = true;
32
+ get id() {
33
+ return `${this.context.key}-${this.type}`;
34
+ }
35
+ constructor(context) {
36
+ super(ADD_NEW_ANNOTATION_FILE, NESTED_QUICK_ACTION_KIND, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
37
+ this.context = context;
38
+ }
39
+ async initialize() {
40
+ const version = await getUi5Version();
41
+ if (isLowerThanMinimalUi5Version(version, {
42
+ major: 1,
43
+ minor: 108,
44
+ patch: 27
45
+ })) {
46
+ this.isApplicable = false;
47
+ return;
48
+ }
49
+ this.annotationDataSourceData = await getDataSourceAnnotationFileMap();
50
+ const {
51
+ annotationDataSourceMap
52
+ } = this.annotationDataSourceData;
53
+ if (!Object.keys(this.annotationDataSourceData.annotationDataSourceMap).length) {
54
+ throw new Error('No data sources found in the manifest');
55
+ }
56
+ for (const key in annotationDataSourceMap) {
57
+ if (Object.prototype.hasOwnProperty.call(annotationDataSourceMap, key)) {
58
+ const source = annotationDataSourceMap[key];
59
+ const {
60
+ annotationExistsInWS
61
+ } = source.annotationDetails;
62
+ if (source.metadataReadErrorMsg) {
63
+ this.children.push({
64
+ path: this.children.length.toString(),
65
+ enabled: false,
66
+ tooltip: source.metadataReadErrorMsg,
67
+ label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
68
+ children: []
69
+ });
70
+ } else {
71
+ this.children.push({
72
+ path: this.children.length.toString(),
73
+ enabled: true,
74
+ label: annotationExistsInWS ? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key]) : this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
75
+ children: []
76
+ });
77
+ }
44
78
  }
45
- async initialize() {
46
- const version = await getUi5Version();
47
- if (isLowerThanMinimalUi5Version(version, {
48
- major: 1,
49
- minor: 108,
50
- patch: 27
51
- })) {
52
- this.isApplicable = false;
53
- return;
54
- }
55
- this.annotationDataSourceData = await getDataSourceAnnotationFileMap();
56
- const {annotationDataSourceMap} = this.annotationDataSourceData;
57
- if (!Object.keys(this.annotationDataSourceData.annotationDataSourceMap).length) {
58
- throw new Error('No data sources found in the manifest');
59
- }
60
- for (const key in annotationDataSourceMap) {
61
- if (Object.prototype.hasOwnProperty.call(annotationDataSourceMap, key)) {
62
- const source = annotationDataSourceMap[key];
63
- const {annotationExistsInWS} = source.annotationDetails;
64
- if (source.metadataReadErrorMsg) {
65
- this.children.push({
66
- path: this.children.length.toString(),
67
- enabled: false,
68
- tooltip: source.metadataReadErrorMsg,
69
- label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
70
- children: []
71
- });
72
- } else {
73
- this.children.push({
74
- path: this.children.length.toString(),
75
- enabled: true,
76
- label: annotationExistsInWS ? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key]) : this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
77
- children: []
78
- });
79
- }
80
- }
81
- }
79
+ }
80
+ }
81
+ get textKey() {
82
+ let result = ADD_NEW_ANNOTATION_FILE_TITLE;
83
+ const dataSourceIds = Object.keys(this.annotationDataSourceData.annotationDataSourceMap);
84
+ if (dataSourceIds.length === 1) {
85
+ const details = this.annotationDataSourceData.annotationDataSourceMap[dataSourceIds[0]];
86
+ if (details.annotationDetails.annotationExistsInWS) {
87
+ result = 'QUICK_ACTION_SHOW_ANNOTATION_FILE';
82
88
  }
83
- get textKey() {
84
- let result = ADD_NEW_ANNOTATION_FILE_TITLE;
85
- const dataSourceIds = Object.keys(this.annotationDataSourceData.annotationDataSourceMap);
86
- if (dataSourceIds.length === 1) {
87
- const details = this.annotationDataSourceData.annotationDataSourceMap[dataSourceIds[0]];
88
- if (details.annotationDetails.annotationExistsInWS) {
89
- result = 'QUICK_ACTION_SHOW_ANNOTATION_FILE';
90
- }
91
- }
92
- return result;
89
+ }
90
+ return result;
91
+ }
92
+ async execute(path) {
93
+ const {
94
+ annotationDataSourceMap,
95
+ isRunningInBAS
96
+ } = this.annotationDataSourceData;
97
+ const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
98
+ const index = Number(path);
99
+ if (index >= 0) {
100
+ const dataSourceId = Object.keys(annotationDataSourceMap)[index];
101
+ const dataSource = annotationDataSourceMap[dataSourceId];
102
+ if (dataSource?.annotationDetails.annotationExistsInWS) {
103
+ const annotationFileDetails = dataSource.annotationDetails;
104
+ const {
105
+ annotationPath,
106
+ annotationPathFromRoot
107
+ } = annotationFileDetails;
108
+ await DialogFactory.createDialog(OverlayRegistry.getOverlay(this.context.view),
109
+ // this passed only because, for method param is required.
110
+ this.context.rta,
111
+ // same as above
112
+ DialogNames.FILE_EXISTS, undefined, {
113
+ fileName: annotationPathFromRoot,
114
+ filePath: annotationPath,
115
+ isRunningInBAS: isRunningInBAS
116
+ });
93
117
  }
94
- async execute(path) {
95
- const {annotationDataSourceMap, isRunningInBAS} = this.annotationDataSourceData;
96
- const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
97
- const index = Number(path);
98
- if (index >= 0) {
99
- const dataSourceId = Object.keys(annotationDataSourceMap)[index];
100
- const dataSource = annotationDataSourceMap[dataSourceId];
101
- if (dataSource?.annotationDetails.annotationExistsInWS) {
102
- const annotationFileDetails = dataSource.annotationDetails;
103
- const {annotationPath, annotationPathFromRoot} = annotationFileDetails;
104
- await DialogFactory.createDialog(OverlayRegistry.getOverlay(this.context.view), this.context.rta, DialogNames.FILE_EXISTS, undefined, {
105
- fileName: annotationPathFromRoot,
106
- filePath: annotationPath,
107
- isRunningInBAS: isRunningInBAS
108
- });
109
- } else if (dataSource) {
110
- const timestamp = Date.now();
111
- const annotationFileNameWithoutExtension = `annotation_${ timestamp }`;
112
- const annotationFileName = `${ annotationFileNameWithoutExtension }.xml`;
113
- const annotationNameSpace = this.context.flexSettings.layer === 'CUSTOMER_BASE' ? `customer.annotation.${ annotationFileNameWithoutExtension }` : `annotation.${ annotationFileNameWithoutExtension }`;
114
- const parameters = {
115
- dataSourceId: dataSourceId,
116
- annotations: [annotationNameSpace],
117
- annotationsInsertPosition: 'END',
118
- dataSource: {
119
- [annotationNameSpace]: {
120
- uri: `annotations/${ annotationFileName }`,
121
- type: 'ODataAnnotation'
122
- }
123
- }
124
- };
125
- const modifiedValue = {
126
- changeType: 'appdescr_app_addAnnotationsToOData',
127
- appComponent: appType === 'fe-v4' ? getV4AppComponent(this.context.view) : getV2AppComponent(this.context.view),
128
- generator: this.context.flexSettings.generator,
129
- reference: this.context.flexSettings.projectId,
130
- parameters,
131
- serviceUrl: dataSource.serviceUrl
132
- };
133
- const command = await CommandFactory.getCommandFor(this.context.view, 'appDescriptor', modifiedValue, null, this.context.flexSettings);
134
- return [command];
135
- }
118
+ // Create annotation file only, if no file exists already for datasource id or if the change file exist and but no annotation file exists in file system.
119
+ else if (dataSource) {
120
+ const timestamp = Date.now();
121
+ const annotationFileNameWithoutExtension = `annotation_${timestamp}`;
122
+ const annotationFileName = `${annotationFileNameWithoutExtension}.xml`;
123
+ const annotationNameSpace = this.context.flexSettings.layer === 'CUSTOMER_BASE' ? `customer.annotation.${annotationFileNameWithoutExtension}` : `annotation.${annotationFileNameWithoutExtension}`;
124
+ const parameters = {
125
+ dataSourceId: dataSourceId,
126
+ annotations: [annotationNameSpace],
127
+ annotationsInsertPosition: 'END',
128
+ dataSource: {
129
+ [annotationNameSpace]: {
130
+ uri: `annotations/${annotationFileName}`,
131
+ type: 'ODataAnnotation'
132
+ }
136
133
  }
137
- return [];
138
- }
139
- getActionObject() {
140
- return {
141
- kind: NESTED_QUICK_ACTION_KIND,
142
- id: this.id,
143
- enabled: this.isApplicable,
144
- title: this.context.resourceBundle.getText(this.textKey),
145
- children: this.children
146
- };
134
+ };
135
+ const modifiedValue = {
136
+ changeType: 'appdescr_app_addAnnotationsToOData',
137
+ appComponent: appType === 'fe-v4' ? getV4AppComponent(this.context.view) : getV2AppComponent(this.context.view),
138
+ generator: this.context.flexSettings.generator,
139
+ reference: this.context.flexSettings.projectId,
140
+ parameters,
141
+ serviceUrl: dataSource.serviceUrl
142
+ };
143
+ const command = await CommandFactory.getCommandFor(this.context.view, 'appDescriptor', modifiedValue, null, this.context.flexSettings);
144
+ return [command];
147
145
  }
146
+ }
147
+ return [];
148
+ }
149
+
150
+ /**
151
+ * Prepares nested quick action object
152
+ * @returns action instance
153
+ */
154
+ getActionObject() {
155
+ return {
156
+ kind: NESTED_QUICK_ACTION_KIND,
157
+ id: this.id,
158
+ enabled: this.isApplicable,
159
+ title: this.context.resourceBundle.getText(this.textKey),
160
+ children: this.children
161
+ };
148
162
  }
149
- var __exports = { __esModule: true };
150
- __exports.ADD_NEW_ANNOTATION_FILE = ADD_NEW_ANNOTATION_FILE;
151
- __exports.AddNewAnnotationFile = AddNewAnnotationFile;
152
- return __exports;
153
- });
163
+ }
164
+ var __exports = {
165
+ __esModule: true
166
+ };
167
+ __exports.ADD_NEW_ANNOTATION_FILE = ADD_NEW_ANNOTATION_FILE;
168
+ __exports.AddNewAnnotationFile = AddNewAnnotationFile;
169
+ return __exports;
170
+ });
171
+ //# sourceMappingURL=add-new-annotation-file.js.map
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
2
  //# sourceMappingURL=enablement-validator.js.map
@@ -1,103 +1,108 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/dt/OverlayRegistry',
4
- '../../../utils/core',
5
- '../../dialog-factory',
6
- '../control-types',
7
- '../table-quick-action-base',
8
- '../dialog-enablement-validator',
9
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
10
- '../../../utils/info-center-message'
11
- ], function (OverlayRegistry, _____utils_core, ____dialog_factory, ___control_types, ___table_quick_action_base, ___dialog_enablement_validator, ___sap_ux_private_control_property_editor_common, _____utils_info_center_message) {
12
- 'use strict';
13
- const getControlById = _____utils_core['getControlById'];
14
- const isA = _____utils_core['isA'];
15
- const DialogNames = ____dialog_factory['DialogNames'];
16
- const DialogFactory = ____dialog_factory['DialogFactory'];
17
- const ANALYTICAL_TABLE_TYPE = ___control_types['ANALYTICAL_TABLE_TYPE'];
18
- const GRID_TABLE_TYPE = ___control_types['GRID_TABLE_TYPE'];
19
- const M_TABLE_TYPE = ___control_types['M_TABLE_TYPE'];
20
- const SMART_TABLE_TYPE = ___control_types['SMART_TABLE_TYPE'];
21
- const TREE_TABLE_TYPE = ___control_types['TREE_TABLE_TYPE'];
22
- const TableQuickActionDefinitionBase = ___table_quick_action_base['TableQuickActionDefinitionBase'];
23
- const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator['DIALOG_ENABLEMENT_VALIDATOR'];
24
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
25
- const sendInfoCenterMessage = _____utils_info_center_message['sendInfoCenterMessage'];
26
- const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
27
- const CONTROL_TYPES = [
28
- SMART_TABLE_TYPE,
29
- M_TABLE_TYPE,
30
- TREE_TABLE_TYPE,
31
- GRID_TABLE_TYPE
32
- ];
33
- function preprocessActionExecution(table, sectionInfo, iconTabBar, iconTabBarFilterKey) {
34
- if (sectionInfo) {
35
- const {layout, section, subSection} = sectionInfo;
36
- layout?.setSelectedSection(section);
37
- section.setSelectedSubSection(subSection);
38
- } else {
39
- getControlById(table.getId())?.getDomRef()?.scrollIntoView();
40
- }
41
- if (iconTabBar && iconTabBarFilterKey) {
42
- iconTabBar.setSelectedKey(iconTabBarFilterKey);
43
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/core", "../../dialog-factory", "../control-types", "../table-quick-action-base", "../dialog-enablement-validator", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../../utils/info-center-message"], function (OverlayRegistry, _____utils_core, ____dialog_factory, ___control_types, ___table_quick_action_base, ___dialog_enablement_validator, ___sap_ux_private_control_property_editor_common, _____utils_info_center_message) {
4
+ "use strict";
5
+
6
+ const getControlById = _____utils_core["getControlById"];
7
+ const isA = _____utils_core["isA"];
8
+ const DialogNames = ____dialog_factory["DialogNames"];
9
+ const DialogFactory = ____dialog_factory["DialogFactory"];
10
+ const ANALYTICAL_TABLE_TYPE = ___control_types["ANALYTICAL_TABLE_TYPE"];
11
+ const GRID_TABLE_TYPE = ___control_types["GRID_TABLE_TYPE"];
12
+ const M_TABLE_TYPE = ___control_types["M_TABLE_TYPE"];
13
+ const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
14
+ const TREE_TABLE_TYPE = ___control_types["TREE_TABLE_TYPE"];
15
+ const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
16
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
17
+ const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
18
+ const sendInfoCenterMessage = _____utils_info_center_message["sendInfoCenterMessage"];
19
+ const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
20
+ const CONTROL_TYPES = [SMART_TABLE_TYPE, M_TABLE_TYPE, TREE_TABLE_TYPE, GRID_TABLE_TYPE];
21
+
22
+ /**
23
+ * Reusable function which performs some preparation steps before table action execution
24
+ *
25
+ * @param table - table element
26
+ * @param sectionInfo - section data
27
+ * @param iconTabBar - icon tab bar element
28
+ * @param iconTabBarFilterKey - tab bar key to select a tab
29
+ */
30
+ function preprocessActionExecution(table, sectionInfo, iconTabBar, iconTabBarFilterKey) {
31
+ if (sectionInfo) {
32
+ const {
33
+ layout,
34
+ section,
35
+ subSection
36
+ } = sectionInfo;
37
+ layout?.setSelectedSection(section);
38
+ section.setSelectedSubSection(subSection);
39
+ } else {
40
+ getControlById(table.getId())?.getDomRef()?.scrollIntoView();
44
41
  }
45
- class AddTableCustomColumnQuickAction extends TableQuickActionDefinitionBase {
46
- constructor(context) {
47
- super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, { areTableRowsRequired: true }, [DIALOG_ENABLEMENT_VALIDATOR]);
48
- }
49
- async execute(path) {
50
- const {table, iconTabBarFilterKey, sectionInfo} = this.tableMap[path];
51
- if (!table) {
52
- return [];
53
- }
54
- preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
55
- this.selectOverlay(table);
56
- let tableInternal = table;
57
- if (isA(SMART_TABLE_TYPE, table)) {
58
- const itemsAggregation = table.getAggregation('items');
59
- tableInternal = itemsAggregation.find(item => {
60
- return [
61
- M_TABLE_TYPE,
62
- TREE_TABLE_TYPE,
63
- ANALYTICAL_TABLE_TYPE,
64
- GRID_TABLE_TYPE
65
- ].some(tType => isA(tType, item));
66
- });
67
- if (!tableInternal) {
68
- return [];
69
- }
70
- }
71
- const overlay = OverlayRegistry.getOverlay(tableInternal) || [];
72
- if (!overlay) {
73
- return [];
74
- }
75
- if (isA(M_TABLE_TYPE, tableInternal) && tableInternal.getAggregation('items').length === 0) {
76
- await sendInfoCenterMessage({
77
- title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
78
- description: { key: 'TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN' },
79
- type: MessageBarType.error
80
- });
81
- return [];
82
- }
83
- const dialog = [
84
- TREE_TABLE_TYPE,
85
- ANALYTICAL_TABLE_TYPE,
86
- GRID_TABLE_TYPE
87
- ].some(type => isA(type, tableInternal)) ? DialogNames.ADD_FRAGMENT : DialogNames.ADD_TABLE_COLUMN_FRAGMENTS;
88
- await DialogFactory.createDialog(overlay, this.context.rta, dialog, undefined, {
89
- aggregation: 'columns',
90
- title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN'
91
- }, {
92
- actionName: this.type,
93
- telemetryEventIdentifier: this.getTelemetryIdentifier()
94
- });
95
- return [];
42
+ if (iconTabBar && iconTabBarFilterKey) {
43
+ iconTabBar.setSelectedKey(iconTabBarFilterKey);
44
+ }
45
+ }
46
+ class AddTableCustomColumnQuickAction extends TableQuickActionDefinitionBase {
47
+ constructor(context) {
48
+ super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, {
49
+ areTableRowsRequired: true
50
+ }, [DIALOG_ENABLEMENT_VALIDATOR]);
51
+ }
52
+ async execute(path) {
53
+ const {
54
+ table,
55
+ iconTabBarFilterKey,
56
+ sectionInfo
57
+ } = this.tableMap[path];
58
+ if (!table) {
59
+ return [];
60
+ }
61
+ preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
62
+ this.selectOverlay(table);
63
+ let tableInternal = table;
64
+ if (isA(SMART_TABLE_TYPE, table)) {
65
+ const itemsAggregation = table.getAggregation('items');
66
+ tableInternal = itemsAggregation.find(item => {
67
+ return [M_TABLE_TYPE, TREE_TABLE_TYPE, ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE].some(tType => isA(tType, item));
68
+ });
69
+ if (!tableInternal) {
70
+ return [];
96
71
  }
72
+ }
73
+ const overlay = OverlayRegistry.getOverlay(tableInternal) || [];
74
+ if (!overlay) {
75
+ return [];
76
+ }
77
+ if (isA(M_TABLE_TYPE, tableInternal) && tableInternal.getAggregation('items').length === 0) {
78
+ await sendInfoCenterMessage({
79
+ title: {
80
+ key: 'ADP_CREATE_XML_FRAGMENT_TITLE'
81
+ },
82
+ description: {
83
+ key: 'TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN'
84
+ },
85
+ type: MessageBarType.error
86
+ });
87
+ return [];
88
+ }
89
+ const dialog = [TREE_TABLE_TYPE, ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE].some(type => isA(type, tableInternal)) ? DialogNames.ADD_FRAGMENT : DialogNames.ADD_TABLE_COLUMN_FRAGMENTS;
90
+ await DialogFactory.createDialog(overlay, this.context.rta, dialog, undefined, {
91
+ aggregation: 'columns',
92
+ title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN'
93
+ }, {
94
+ actionName: this.type,
95
+ telemetryEventIdentifier: this.getTelemetryIdentifier()
96
+ });
97
+ return [];
97
98
  }
98
- var __exports = { __esModule: true };
99
- __exports.CREATE_TABLE_CUSTOM_COLUMN = CREATE_TABLE_CUSTOM_COLUMN;
100
- __exports.preprocessActionExecution = preprocessActionExecution;
101
- __exports.AddTableCustomColumnQuickAction = AddTableCustomColumnQuickAction;
102
- return __exports;
103
- });
99
+ }
100
+ var __exports = {
101
+ __esModule: true
102
+ };
103
+ __exports.CREATE_TABLE_CUSTOM_COLUMN = CREATE_TABLE_CUSTOM_COLUMN;
104
+ __exports.preprocessActionExecution = preprocessActionExecution;
105
+ __exports.AddTableCustomColumnQuickAction = AddTableCustomColumnQuickAction;
106
+ return __exports;
107
+ });
108
+ //# sourceMappingURL=create-table-custom-column.js.map
@@ -1,41 +1,45 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- '../../cpe/quick-actions/utils',
5
- './quick-action-base'
6
- ], function (___sap_ux_private_control_property_editor_common, ____cpe_quick_actions_utils, ___quick_action_base) {
7
- 'use strict';
8
- const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
9
- const getRelevantControlFromActivePage = ____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
10
- const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
11
- class SimpleQuickActionDefinitionBase extends QuickActionDefinitionBase {
12
- get isApplicable() {
13
- return this.control !== undefined;
14
- }
15
- constructor(type, controlTypes, defaultTextKey, context) {
16
- let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
17
- super(type, SIMPLE_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
18
- this.type = type;
19
- this.controlTypes = controlTypes;
20
- this.defaultTextKey = defaultTextKey;
21
- this.context = context;
22
- this.enablementValidators = enablementValidators;
23
- }
24
- initialize() {
25
- this.control = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)[0];
26
- return Promise.resolve();
27
- }
28
- getActionObject() {
29
- return {
30
- kind: SIMPLE_QUICK_ACTION_KIND,
31
- id: this.id,
32
- enabled: !this.isDisabled,
33
- tooltip: this.tooltip,
34
- title: this.context.resourceBundle.getText(this.textKey)
35
- };
36
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../cpe/quick-actions/utils", "./quick-action-base"], function (___sap_ux_private_control_property_editor_common, ____cpe_quick_actions_utils, ___quick_action_base) {
4
+ "use strict";
5
+
6
+ const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["SIMPLE_QUICK_ACTION_KIND"];
7
+ const getRelevantControlFromActivePage = ____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
8
+ const QuickActionDefinitionBase = ___quick_action_base["QuickActionDefinitionBase"];
9
+ /**
10
+ * Base class for all simple quick actions.
11
+ */
12
+ class SimpleQuickActionDefinitionBase extends QuickActionDefinitionBase {
13
+ get isApplicable() {
14
+ return this.control !== undefined;
37
15
  }
38
- var __exports = { __esModule: true };
39
- __exports.SimpleQuickActionDefinitionBase = SimpleQuickActionDefinitionBase;
40
- return __exports;
41
- });
16
+ constructor(type, controlTypes, defaultTextKey, context) {
17
+ let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
18
+ super(type, SIMPLE_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
19
+ this.type = type;
20
+ this.controlTypes = controlTypes;
21
+ this.defaultTextKey = defaultTextKey;
22
+ this.context = context;
23
+ this.enablementValidators = enablementValidators;
24
+ }
25
+ initialize() {
26
+ this.control = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)[0];
27
+ return Promise.resolve();
28
+ }
29
+ getActionObject() {
30
+ return {
31
+ kind: SIMPLE_QUICK_ACTION_KIND,
32
+ id: this.id,
33
+ enabled: !this.isDisabled,
34
+ tooltip: this.tooltip,
35
+ title: this.context.resourceBundle.getText(this.textKey)
36
+ };
37
+ }
38
+ }
39
+ var __exports = {
40
+ __esModule: true
41
+ };
42
+ __exports.SimpleQuickActionDefinitionBase = SimpleQuickActionDefinitionBase;
43
+ return __exports;
44
+ });
45
+ //# sourceMappingURL=simple-quick-action-base.js.map