@sap-ux/preview-middleware 0.23.48 → 0.23.50

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 +4 -4
@@ -1,67 +1,100 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- 'sap/ui/rta/command/CommandFactory',
5
- '../utils/error',
6
- '../utils/info-center-message'
7
- ], function (___sap_ux_private_control_property_editor_common, CommandFactory, ___utils_error, ___utils_info_center_message) {
8
- 'use strict';
9
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
10
- const getError = ___utils_error['getError'];
11
- const sendInfoCenterMessage = ___utils_info_center_message['sendInfoCenterMessage'];
12
- class CommandExecutor {
13
- constructor(rta) {
14
- this.rta = rta;
15
- }
16
- async getCommand(runtimeControl, commandName, modifiedValue, flexSettings, designMetadata) {
17
- try {
18
- return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
19
- } catch (e) {
20
- const error = getError(e);
21
- await sendInfoCenterMessage({
22
- title: { key: 'ADP_GET_COMMAND_FAILURE_TITLE' },
23
- description: {
24
- key: 'ADP_GET_COMMAND_FAILURE_DESCRIPTION',
25
- params: [
26
- commandName,
27
- error.message
28
- ]
29
- },
30
- type: MessageBarType.error
31
- });
32
- error.message = `Could not get command for '${ commandName }'. ${ error.message }`;
33
- throw error;
34
- }
35
- }
36
- async createCompositeCommand(runtimeControl) {
37
- try {
38
- return await CommandFactory.getCommandFor(runtimeControl, 'composite');
39
- } catch (e) {
40
- const error = getError(e);
41
- await sendInfoCenterMessage({
42
- title: { key: 'ADP_GET_COMMAND_FAILURE_TITLE' },
43
- description: {
44
- key: 'ADP_GET_COMPOSITE_COMMAND_FAILURE_DESCRIPTION',
45
- params: [error.message]
46
- },
47
- type: MessageBarType.error
48
- });
49
- throw error;
50
- }
51
- }
52
- async pushAndExecuteCommand(command) {
53
- try {
54
- await this.rta.getCommandStack().pushAndExecute(command);
55
- } catch (e) {
56
- const error = getError(e);
57
- await sendInfoCenterMessage({
58
- title: { key: 'ADP_RUN_COMMAND_FAILED_TITLE' },
59
- description: error.message,
60
- type: MessageBarType.error
61
- });
62
- throw error;
63
- }
64
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "sap/ui/rta/command/CommandFactory", "../utils/error", "../utils/info-center-message"], function (___sap_ux_private_control_property_editor_common, CommandFactory, ___utils_error, ___utils_info_center_message) {
4
+ "use strict";
5
+
6
+ const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
7
+ const getError = ___utils_error["getError"];
8
+ const sendInfoCenterMessage = ___utils_info_center_message["sendInfoCenterMessage"];
9
+ /**
10
+ * Class responsible for handling rta calls
11
+ */
12
+ class CommandExecutor {
13
+ /**
14
+ *
15
+ * @param rta Runtime Authoring
16
+ */
17
+ constructor(rta) {
18
+ this.rta = rta;
65
19
  }
66
- return CommandExecutor;
67
- });
20
+
21
+ /**
22
+ * Generates command based on given values
23
+ *
24
+ * @param runtimeControl Managed object
25
+ * @param commandName Command name
26
+ * @param modifiedValue Modified value/s
27
+ * @param flexSettings Additional flex settings
28
+ * @param designMetadata Design time metadata
29
+ */
30
+ async getCommand(runtimeControl, commandName, modifiedValue, flexSettings, designMetadata) {
31
+ try {
32
+ return await CommandFactory.getCommandFor(runtimeControl, commandName, modifiedValue, designMetadata, flexSettings);
33
+ } catch (e) {
34
+ const error = getError(e);
35
+ await sendInfoCenterMessage({
36
+ title: {
37
+ key: 'ADP_GET_COMMAND_FAILURE_TITLE'
38
+ },
39
+ description: {
40
+ key: 'ADP_GET_COMMAND_FAILURE_DESCRIPTION',
41
+ params: [commandName, error.message]
42
+ },
43
+ type: MessageBarType.error
44
+ });
45
+ error.message = `Could not get command for '${commandName}'. ${error.message}`;
46
+ throw error;
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Creates composite command without nested commands
52
+ *
53
+ * @param runtimeControl Managed object
54
+ */
55
+ async createCompositeCommand(runtimeControl) {
56
+ try {
57
+ return await CommandFactory.getCommandFor(runtimeControl, 'composite');
58
+ } catch (e) {
59
+ const error = getError(e);
60
+ await sendInfoCenterMessage({
61
+ title: {
62
+ key: 'ADP_GET_COMMAND_FAILURE_TITLE'
63
+ },
64
+ description: {
65
+ key: 'ADP_GET_COMPOSITE_COMMAND_FAILURE_DESCRIPTION',
66
+ params: [error.message]
67
+ },
68
+ type: MessageBarType.error
69
+ });
70
+ throw error;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Pushed and executes the provided command
76
+ *
77
+ * @param command Command
78
+ */
79
+ async pushAndExecuteCommand(command) {
80
+ try {
81
+ /**
82
+ * The change will have pending state and will only be saved to the workspace when the user clicks save icon
83
+ */
84
+ await this.rta.getCommandStack().pushAndExecute(command);
85
+ } catch (e) {
86
+ const error = getError(e);
87
+ await sendInfoCenterMessage({
88
+ title: {
89
+ key: 'ADP_RUN_COMMAND_FAILED_TITLE'
90
+ },
91
+ description: error.message,
92
+ type: MessageBarType.error
93
+ });
94
+ throw error;
95
+ }
96
+ }
97
+ }
98
+ return CommandExecutor;
99
+ });
100
+ //# sourceMappingURL=command-executor.js.map
@@ -1,106 +1,124 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/model/json/JSONModel',
4
- '../../i18n',
5
- '../command-executor',
6
- '../api-handler',
7
- './BaseDialog.controller',
8
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
9
- '../../cpe/communication-service',
10
- '../../utils/info-center-message',
11
- '../../utils/error'
12
- ], function (JSONModel, ____i18n, __CommandExecutor, ___api_handler, __BaseDialog, ___sap_ux_private_control_property_editor_common, ____cpe_communication_service, ____utils_info_center_message, ____utils_error) {
13
- 'use strict';
14
- function _interopRequireDefault(obj) {
15
- return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
16
- }
17
- const getResourceModel = ____i18n['getResourceModel'];
18
- const CommandExecutor = _interopRequireDefault(__CommandExecutor);
19
- const getFragments = ___api_handler['getFragments'];
20
- const BaseDialog = _interopRequireDefault(__BaseDialog);
21
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
22
- const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
23
- const CommunicationService = ____cpe_communication_service['CommunicationService'];
24
- const sendInfoCenterMessage = ____utils_info_center_message['sendInfoCenterMessage'];
25
- const getError = ____utils_error['getError'];
26
- const AddCustomFragment = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddCustomFragment', {
27
- constructor: function _constructor(name, overlays, rta, options, telemetryData) {
28
- BaseDialog.prototype.constructor.call(this, name, telemetryData);
29
- this.options = options;
30
- this.rta = rta;
31
- this.overlays = overlays;
32
- this.model = new JSONModel({ title: options.title });
33
- this.commandExecutor = new CommandExecutor(this.rta);
34
- },
35
- setup: async function _setup(dialog) {
36
- this.dialog = dialog;
37
- this.setEscapeHandler();
38
- await this.buildDialogData();
39
- const resourceModel = await getResourceModel('open.ux.preview.client');
40
- this.dialog.setModel(resourceModel, 'i18n');
41
- this.dialog.setModel(this.model);
42
- this.dialog.open();
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/model/json/JSONModel", "../../i18n", "../command-executor", "../api-handler", "./BaseDialog.controller", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../cpe/communication-service", "../../utils/info-center-message", "../../utils/error"], function (JSONModel, ____i18n, __CommandExecutor, ___api_handler, __BaseDialog, ___sap_ux_private_control_property_editor_common, ____cpe_communication_service, ____utils_info_center_message, ____utils_error) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const getResourceModel = ____i18n["getResourceModel"];
10
+ const CommandExecutor = _interopRequireDefault(__CommandExecutor);
11
+ const getFragments = ___api_handler["getFragments"];
12
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
13
+ const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
14
+ const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common["setApplicationRequiresReload"];
15
+ const CommunicationService = ____cpe_communication_service["CommunicationService"];
16
+ const sendInfoCenterMessage = ____utils_info_center_message["sendInfoCenterMessage"];
17
+ const getError = ____utils_error["getError"];
18
+ /**
19
+ * @namespace open.ux.preview.client.adp.controllers
20
+ */
21
+ const AddCustomFragment = BaseDialog.extend("open.ux.preview.client.adp.controllers.AddCustomFragment", {
22
+ constructor: function _constructor(name, overlays, rta, options, telemetryData) {
23
+ BaseDialog.prototype.constructor.call(this, name, telemetryData);
24
+ this.options = options;
25
+ this.rta = rta;
26
+ this.overlays = overlays;
27
+ this.model = new JSONModel({
28
+ title: options.title
29
+ });
30
+ this.commandExecutor = new CommandExecutor(this.rta);
31
+ },
32
+ /**
33
+ * Setups the Dialog and the JSON Model
34
+ *
35
+ * @param {Dialog} dialog - Dialog instance
36
+ */
37
+ setup: async function _setup(dialog) {
38
+ this.dialog = dialog;
39
+ this.setEscapeHandler();
40
+ await this.buildDialogData();
41
+ const resourceModel = await getResourceModel('open.ux.preview.client');
42
+ this.dialog.setModel(resourceModel, 'i18n');
43
+ this.dialog.setModel(this.model);
44
+ this.dialog.open();
45
+ },
46
+ /**
47
+ * Handles create button press
48
+ *
49
+ * @param event Event
50
+ */
51
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
52
+ const source = event.getSource();
53
+ source.setEnabled(false);
54
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
55
+ const fragmentName = this.model.getProperty('/newFragmentName');
56
+ const template = `fragments.${fragmentName}`;
57
+ await this.createAppDescriptorChangeForV4(template);
58
+ CommunicationService.sendAction(setApplicationRequiresReload(true));
59
+ await sendInfoCenterMessage({
60
+ title: {
61
+ key: 'ADP_ADD_FRAGMENT_DIALOG_TITLE'
43
62
  },
44
- onCreateBtnPress: async function _onCreateBtnPress(event) {
45
- const source = event.getSource();
46
- source.setEnabled(false);
47
- await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
48
- const fragmentName = this.model.getProperty('/newFragmentName');
49
- const template = `fragments.${ fragmentName }`;
50
- await this.createAppDescriptorChangeForV4(template);
51
- CommunicationService.sendAction(setApplicationRequiresReload(true));
52
- await sendInfoCenterMessage({
53
- title: { key: 'ADP_ADD_FRAGMENT_DIALOG_TITLE' },
54
- description: {
55
- key: 'ADP_ADD_FRAGMENT_NOTIFICATION',
56
- params: [fragmentName]
57
- },
58
- type: MessageBarType.warning
59
- });
60
- this.handleDialogClose();
63
+ description: {
64
+ key: 'ADP_ADD_FRAGMENT_NOTIFICATION',
65
+ params: [fragmentName]
61
66
  },
62
- buildDialogData: async function _buildDialogData() {
63
- try {
64
- const {fragments} = await getFragments();
65
- this.model.setProperty('/fragmentList', fragments);
66
- } catch (e) {
67
- const error = getError(e);
68
- await sendInfoCenterMessage({
69
- title: { key: 'ADP_ADD_FRAGMENT_DIALOG_TITLE' },
70
- description: error.message,
71
- type: MessageBarType.error
72
- });
73
- throw error;
67
+ type: MessageBarType.warning
68
+ });
69
+ this.handleDialogClose();
70
+ },
71
+ /**
72
+ * Builds data that is used in the dialog
73
+ */
74
+ buildDialogData: async function _buildDialogData() {
75
+ try {
76
+ const {
77
+ fragments
78
+ } = await getFragments();
79
+ this.model.setProperty('/fragmentList', fragments);
80
+ } catch (e) {
81
+ const error = getError(e);
82
+ await sendInfoCenterMessage({
83
+ title: {
84
+ key: 'ADP_ADD_FRAGMENT_DIALOG_TITLE'
85
+ },
86
+ description: error.message,
87
+ type: MessageBarType.error
88
+ });
89
+ throw error;
90
+ }
91
+ },
92
+ createAppDescriptorChangeForV4: async function _createAppDescriptorChangeForV(templatePath) {
93
+ const fragmentName = this.model.getProperty('/newFragmentName');
94
+ const template = `${this.options.appDescriptor?.projectId}.changes.${templatePath}`;
95
+ let sectionId = this.options.appDescriptor?.anchor;
96
+ const flexSettings = this.rta.getFlexSettings();
97
+ const modifiedValue = {
98
+ reference: this.options.appDescriptor?.projectId,
99
+ appComponent: this.options.appDescriptor?.appComponent,
100
+ changeType: 'appdescr_fe_changePageConfiguration',
101
+ parameters: {
102
+ page: this.options.appDescriptor?.pageId,
103
+ entityPropertyChange: {
104
+ propertyPath: `${this.options.propertyPath}${fragmentName}`,
105
+ // e.g. 'content/body/sections/test'
106
+ operation: 'UPSERT',
107
+ propertyValue: {
108
+ template,
109
+ title: 'New Custom Section',
110
+ position: {
111
+ placement: 'After',
112
+ anchor: `${sectionId}`
113
+ }
74
114
  }
75
- },
76
- createAppDescriptorChangeForV4: async function _createAppDescriptorChangeForV(templatePath) {
77
- const fragmentName = this.model.getProperty('/newFragmentName');
78
- const template = `${ this.options.appDescriptor?.projectId }.changes.${ templatePath }`;
79
- let sectionId = this.options.appDescriptor?.anchor;
80
- const flexSettings = this.rta.getFlexSettings();
81
- const modifiedValue = {
82
- reference: this.options.appDescriptor?.projectId,
83
- appComponent: this.options.appDescriptor?.appComponent,
84
- changeType: 'appdescr_fe_changePageConfiguration',
85
- parameters: {
86
- page: this.options.appDescriptor?.pageId,
87
- entityPropertyChange: {
88
- propertyPath: `${ this.options.propertyPath }${ fragmentName }`,
89
- operation: 'UPSERT',
90
- propertyValue: {
91
- template,
92
- title: 'New Custom Section',
93
- position: {
94
- placement: 'After',
95
- anchor: `${ sectionId }`
96
- }
97
- }
98
- }
99
- }
100
- };
101
- const command = await this.commandExecutor.getCommand(this.getRuntimeControl(), 'appDescriptor', modifiedValue, flexSettings);
102
- await this.commandExecutor.pushAndExecuteCommand(command);
115
+ }
103
116
  }
104
- });
105
- return AddCustomFragment;
106
- });
117
+ };
118
+ const command = await this.commandExecutor.getCommand(this.getRuntimeControl(), 'appDescriptor', modifiedValue, flexSettings);
119
+ await this.commandExecutor.pushAndExecuteCommand(command);
120
+ }
121
+ });
122
+ return AddCustomFragment;
123
+ });
124
+ //# sourceMappingURL=AddCustomFragment.controller.js.map