@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.
- 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 +4 -4
|
@@ -1,135 +1,160 @@
|
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
DialogFactory.onOpenDialogStatusChange(async () => {
|
|
62
|
-
await this.reloadQuickActions(this.controlTreeIndex);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
async reloadQuickActions(controlIndex) {
|
|
66
|
-
const context = {
|
|
67
|
-
controlIndex,
|
|
68
|
-
manifest: this.rta.getRootControlInstance().getManifest(),
|
|
69
|
-
actionService: this.actionService
|
|
70
|
-
};
|
|
71
|
-
const groups = [];
|
|
72
|
-
for (const registry of this.registries) {
|
|
73
|
-
for (const {title, definitions, view, key} of registry.getDefinitions(context)) {
|
|
74
|
-
const group = {
|
|
75
|
-
title,
|
|
76
|
-
actions: []
|
|
77
|
-
};
|
|
78
|
-
const actionContext = {
|
|
79
|
-
...context,
|
|
80
|
-
view,
|
|
81
|
-
key,
|
|
82
|
-
rta: this.rta,
|
|
83
|
-
flexSettings: this.rta.getFlexSettings(),
|
|
84
|
-
resourceBundle: this.texts,
|
|
85
|
-
changeService: this.changeService
|
|
86
|
-
};
|
|
87
|
-
for (const Definition of definitions) {
|
|
88
|
-
try {
|
|
89
|
-
const instance = new Definition(actionContext);
|
|
90
|
-
await instance.initialize();
|
|
91
|
-
await this.addAction(group, instance);
|
|
92
|
-
} catch {
|
|
93
|
-
Log.warning(`Failed to initialize ${ Definition.name } quick action.`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
groups.push(group);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
this.sendAction(quickActionListChanged(groups));
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../i18n", "../../adp/dialog-factory", "../../utils/application", "../../utils/version"], function (Log, ___sap_ux_private_control_property_editor_common, ____i18n, ____adp_dialog_factory, ____utils_application, ____utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const executeQuickAction = ___sap_ux_private_control_property_editor_common["executeQuickAction"];
|
|
7
|
+
const quickActionListChanged = ___sap_ux_private_control_property_editor_common["quickActionListChanged"];
|
|
8
|
+
const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["SIMPLE_QUICK_ACTION_KIND"];
|
|
9
|
+
const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common["NESTED_QUICK_ACTION_KIND"];
|
|
10
|
+
const updateQuickAction = ___sap_ux_private_control_property_editor_common["updateQuickAction"];
|
|
11
|
+
const externalFileChange = ___sap_ux_private_control_property_editor_common["externalFileChange"];
|
|
12
|
+
const reportTelemetry = ___sap_ux_private_control_property_editor_common["reportTelemetry"];
|
|
13
|
+
const getTextBundle = ____i18n["getTextBundle"];
|
|
14
|
+
const DialogFactory = ____adp_dialog_factory["DialogFactory"];
|
|
15
|
+
const getApplicationType = ____utils_application["getApplicationType"];
|
|
16
|
+
const getUi5Version = ____utils_version["getUi5Version"];
|
|
17
|
+
/**
|
|
18
|
+
* Service providing Quick Actions.
|
|
19
|
+
*/
|
|
20
|
+
class QuickActionService {
|
|
21
|
+
sendAction = () => {};
|
|
22
|
+
actions = [];
|
|
23
|
+
/**
|
|
24
|
+
* Quick action service constructor.
|
|
25
|
+
*
|
|
26
|
+
* @param rta - RTA object.
|
|
27
|
+
* @param outlineService - Outline service instance.
|
|
28
|
+
* @param registries - Quick action registries.
|
|
29
|
+
*/
|
|
30
|
+
constructor(rta, outlineService, registries, changeService) {
|
|
31
|
+
this.rta = rta;
|
|
32
|
+
this.outlineService = outlineService;
|
|
33
|
+
this.registries = registries;
|
|
34
|
+
this.changeService = changeService;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Initialize selection service.
|
|
39
|
+
*
|
|
40
|
+
* @param sendAction - Action sender function.
|
|
41
|
+
* @param subscribe - Subscriber function.
|
|
42
|
+
*/
|
|
43
|
+
async init(sendAction, subscribe) {
|
|
44
|
+
this.sendAction = sendAction;
|
|
45
|
+
this.actionService = await this.rta.getService('action');
|
|
46
|
+
this.texts = await getTextBundle();
|
|
47
|
+
subscribe(async action => {
|
|
48
|
+
if (executeQuickAction.match(action)) {
|
|
49
|
+
const actionInstance = this.actions.filter(quickActionDefinition => quickActionDefinition.id === action.payload.id).pop();
|
|
50
|
+
if (!actionInstance) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const commands = await this.executeAction(actionInstance, action.payload);
|
|
54
|
+
for (const command of commands) {
|
|
55
|
+
await this.rta.getCommandStack().pushAndExecute(command);
|
|
56
|
+
}
|
|
57
|
+
if (actionInstance.forceRefreshAfterExecution) {
|
|
58
|
+
this.sendAction(updateQuickAction(actionInstance.getActionObject()));
|
|
59
|
+
}
|
|
100
60
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
await instance.runEnablementValidators();
|
|
104
|
-
const quickAction = instance.getActionObject();
|
|
105
|
-
group.actions.push(quickAction);
|
|
106
|
-
this.actions.push(instance);
|
|
107
|
-
}
|
|
61
|
+
if (externalFileChange.match(action)) {
|
|
62
|
+
await this.reloadQuickActions(this.controlTreeIndex);
|
|
108
63
|
}
|
|
109
|
-
|
|
64
|
+
});
|
|
65
|
+
this.outlineService.onOutlineChange(async event => {
|
|
66
|
+
this.controlTreeIndex = event.detail.controlIndex;
|
|
67
|
+
await this.reloadQuickActions(event.detail.controlIndex);
|
|
68
|
+
});
|
|
69
|
+
this.changeService.onStackChange(async () => {
|
|
70
|
+
await this.reloadQuickActions(this.controlTreeIndex);
|
|
71
|
+
});
|
|
72
|
+
DialogFactory.onOpenDialogStatusChange(async () => {
|
|
73
|
+
await this.reloadQuickActions(this.controlTreeIndex);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Prepares a list of currently applicable Quick Actions and sends them to the UI.
|
|
79
|
+
*
|
|
80
|
+
* @param controlIndex - Control tree index.
|
|
81
|
+
*/
|
|
82
|
+
async reloadQuickActions(controlIndex) {
|
|
83
|
+
const context = {
|
|
84
|
+
controlIndex,
|
|
85
|
+
manifest: this.rta.getRootControlInstance().getManifest(),
|
|
86
|
+
actionService: this.actionService
|
|
87
|
+
};
|
|
88
|
+
const groups = [];
|
|
89
|
+
for (const registry of this.registries) {
|
|
90
|
+
for (const {
|
|
91
|
+
title,
|
|
92
|
+
definitions,
|
|
93
|
+
view,
|
|
94
|
+
key
|
|
95
|
+
} of registry.getDefinitions(context)) {
|
|
96
|
+
const group = {
|
|
97
|
+
title,
|
|
98
|
+
actions: []
|
|
99
|
+
};
|
|
100
|
+
const actionContext = {
|
|
101
|
+
...context,
|
|
102
|
+
view,
|
|
103
|
+
key,
|
|
104
|
+
rta: this.rta,
|
|
105
|
+
flexSettings: this.rta.getFlexSettings(),
|
|
106
|
+
resourceBundle: this.texts,
|
|
107
|
+
changeService: this.changeService
|
|
108
|
+
};
|
|
109
|
+
for (const Definition of definitions) {
|
|
110
110
|
try {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
quickActionSteps: actionInstance.quickActionSteps,
|
|
117
|
-
appType: getApplicationType(this.rta.getRootControlInstance().getManifest()),
|
|
118
|
-
ui5Version: `${ versionInfo.major }.${ versionInfo.minor }.${ versionInfo.patch }`
|
|
119
|
-
});
|
|
120
|
-
} catch (error) {
|
|
121
|
-
Log.error('Error in reporting Telemetry:', error);
|
|
122
|
-
}
|
|
123
|
-
if (payload.kind === SIMPLE_QUICK_ACTION_KIND && actionInstance.kind === SIMPLE_QUICK_ACTION_KIND) {
|
|
124
|
-
return actionInstance.execute();
|
|
125
|
-
}
|
|
126
|
-
if (payload.kind === NESTED_QUICK_ACTION_KIND && actionInstance.kind === NESTED_QUICK_ACTION_KIND) {
|
|
127
|
-
return actionInstance.execute(payload.path);
|
|
111
|
+
const instance = new Definition(actionContext);
|
|
112
|
+
await instance.initialize();
|
|
113
|
+
await this.addAction(group, instance);
|
|
114
|
+
} catch {
|
|
115
|
+
Log.warning(`Failed to initialize ${Definition.name} quick action.`);
|
|
128
116
|
}
|
|
129
|
-
|
|
117
|
+
}
|
|
118
|
+
groups.push(group);
|
|
130
119
|
}
|
|
120
|
+
}
|
|
121
|
+
this.sendAction(quickActionListChanged(groups));
|
|
122
|
+
}
|
|
123
|
+
async addAction(group, instance) {
|
|
124
|
+
if (instance.isApplicable) {
|
|
125
|
+
await instance.runEnablementValidators();
|
|
126
|
+
const quickAction = instance.getActionObject();
|
|
127
|
+
group.actions.push(quickAction);
|
|
128
|
+
this.actions.push(instance);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async executeAction(actionInstance, payload) {
|
|
132
|
+
try {
|
|
133
|
+
const versionInfo = await getUi5Version();
|
|
134
|
+
await reportTelemetry({
|
|
135
|
+
category: 'QuickAction',
|
|
136
|
+
actionName: actionInstance.type,
|
|
137
|
+
telemetryEventIdentifier: actionInstance.getTelemetryIdentifier(true),
|
|
138
|
+
quickActionSteps: actionInstance.quickActionSteps,
|
|
139
|
+
appType: getApplicationType(this.rta.getRootControlInstance().getManifest()),
|
|
140
|
+
ui5Version: `${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`
|
|
141
|
+
});
|
|
142
|
+
} catch (error) {
|
|
143
|
+
Log.error('Error in reporting Telemetry:', error);
|
|
144
|
+
}
|
|
145
|
+
if (payload.kind === SIMPLE_QUICK_ACTION_KIND && actionInstance.kind === SIMPLE_QUICK_ACTION_KIND) {
|
|
146
|
+
return actionInstance.execute();
|
|
147
|
+
}
|
|
148
|
+
if (payload.kind === NESTED_QUICK_ACTION_KIND && actionInstance.kind === NESTED_QUICK_ACTION_KIND) {
|
|
149
|
+
return actionInstance.execute(payload.path);
|
|
150
|
+
}
|
|
151
|
+
return Promise.resolve([]);
|
|
131
152
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
153
|
+
}
|
|
154
|
+
var __exports = {
|
|
155
|
+
__esModule: true
|
|
156
|
+
};
|
|
157
|
+
__exports.QuickActionService = QuickActionService;
|
|
158
|
+
return __exports;
|
|
159
|
+
});
|
|
160
|
+
//# sourceMappingURL=quick-action-service.js.map
|
|
@@ -1,72 +1,94 @@
|
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
save() {
|
|
49
|
-
if (this.rta.save) {
|
|
50
|
-
return this.rta.save();
|
|
51
|
-
} else {
|
|
52
|
-
return this.rta?._serializeToLrep();
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common"], function (___sap_ux_private_control_property_editor_common) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const setAppMode = ___sap_ux_private_control_property_editor_common["setAppMode"];
|
|
7
|
+
const setUndoRedoEnablement = ___sap_ux_private_control_property_editor_common["setUndoRedoEnablement"];
|
|
8
|
+
const setSaveEnablement = ___sap_ux_private_control_property_editor_common["setSaveEnablement"];
|
|
9
|
+
const undo = ___sap_ux_private_control_property_editor_common["undo"];
|
|
10
|
+
const redo = ___sap_ux_private_control_property_editor_common["redo"];
|
|
11
|
+
const save = ___sap_ux_private_control_property_editor_common["save"];
|
|
12
|
+
const reloadApplication = ___sap_ux_private_control_property_editor_common["reloadApplication"];
|
|
13
|
+
const applicationModeChanged = ___sap_ux_private_control_property_editor_common["applicationModeChanged"];
|
|
14
|
+
/**
|
|
15
|
+
* A Class of RtaService
|
|
16
|
+
*/
|
|
17
|
+
class RtaService {
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param options ui5 adaptation options.
|
|
21
|
+
*/
|
|
22
|
+
constructor(rta) {
|
|
23
|
+
this.rta = rta;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Initializes rta service.
|
|
28
|
+
*
|
|
29
|
+
* @param sendAction action sender function
|
|
30
|
+
* @param subscribe subscriber function
|
|
31
|
+
*/
|
|
32
|
+
async init(sendAction, subscribe) {
|
|
33
|
+
return new Promise(resolve => {
|
|
34
|
+
sendAction(applicationModeChanged(this.rta.getMode()));
|
|
35
|
+
subscribe(async action => {
|
|
36
|
+
if (setAppMode.match(action)) {
|
|
37
|
+
this.rta.setMode(action.payload);
|
|
38
|
+
}
|
|
39
|
+
if (undo.match(action)) {
|
|
40
|
+
this.rta.undo();
|
|
41
|
+
}
|
|
42
|
+
if (redo.match(action)) {
|
|
43
|
+
this.rta.redo();
|
|
44
|
+
}
|
|
45
|
+
if (reloadApplication.match(action)) {
|
|
46
|
+
if (action.payload.save === true) {
|
|
47
|
+
await this.save();
|
|
53
48
|
}
|
|
54
|
-
|
|
49
|
+
await this.rta.stop(false, true);
|
|
50
|
+
}
|
|
51
|
+
if (save.match(action)) {
|
|
52
|
+
await this.save();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.rta.attachStop(() => {
|
|
56
|
+
// eslint-disable-next-line fiori-custom/sap-no-location-reload
|
|
57
|
+
location.reload();
|
|
58
|
+
});
|
|
59
|
+
this.rta.attachStart(() => {
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
this.rta.attachModeChanged(modeAndStackChangeHandler(sendAction, this.rta));
|
|
63
|
+
});
|
|
55
64
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}));
|
|
65
|
-
sendAction(setSaveEnablement(saveAllowed));
|
|
66
|
-
};
|
|
65
|
+
save() {
|
|
66
|
+
if (this.rta.save) {
|
|
67
|
+
// v1.107.x and above
|
|
68
|
+
return this.rta.save();
|
|
69
|
+
} else {
|
|
70
|
+
// v1.71.x and above
|
|
71
|
+
return this.rta?._serializeToLrep();
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
}
|
|
75
|
+
function modeAndStackChangeHandler(sendAction, rta) {
|
|
76
|
+
return () => {
|
|
77
|
+
const canUndo = rta.canUndo();
|
|
78
|
+
const canRedo = rta.canRedo();
|
|
79
|
+
const saveAllowed = rta?.canSave ? rta?.canSave() : canUndo; /* canSave v1.112.x and above only*/
|
|
80
|
+
sendAction(setUndoRedoEnablement({
|
|
81
|
+
canUndo,
|
|
82
|
+
canRedo
|
|
83
|
+
}));
|
|
84
|
+
sendAction(setSaveEnablement(saveAllowed));
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
var __exports = {
|
|
88
|
+
__esModule: true
|
|
89
|
+
};
|
|
90
|
+
__exports.RtaService = RtaService;
|
|
91
|
+
__exports.modeAndStackChangeHandler = modeAndStackChangeHandler;
|
|
92
|
+
return __exports;
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=rta-service.js.map
|