@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.
- package/dist/client/adp/command-executor.js +99 -66
- package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
- package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
- package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
- package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
- package/dist/client/adp/extension-point.js +81 -60
- package/dist/client/adp/init.js +100 -99
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
- package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
- package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
- package/dist/client/adp/sync-views-utils.js +119 -83
- package/dist/client/cpe/changes/flex-change.js +64 -48
- package/dist/client/cpe/changes/service.js +492 -367
- package/dist/client/cpe/communication-service.js +41 -29
- package/dist/client/cpe/connector-service.js +87 -64
- package/dist/client/cpe/context-menu-service.js +87 -74
- package/dist/client/cpe/control-data.js +353 -263
- package/dist/client/cpe/documentation.js +183 -126
- package/dist/client/cpe/init.js +69 -75
- package/dist/client/cpe/outline/service.js +60 -45
- package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
- package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
- package/dist/client/cpe/rta-service.js +91 -69
- package/dist/client/cpe/selection.js +239 -187
- package/dist/client/cpe/types.js +0 -4
- package/dist/client/flp/init.js +403 -296
- package/dist/client/manifest.json +7 -4
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
- package/dist/client/utils/info-center-message.js +59 -31
- package/dist/client/utils/version.js +128 -72
- package/package.json +2 -2
|
@@ -1,67 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
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
|