@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,135 +1,160 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/base/Log',
4
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../i18n',
6
- '../../adp/dialog-factory',
7
- '../../utils/application',
8
- '../../utils/version'
9
- ], function (Log, ___sap_ux_private_control_property_editor_common, ____i18n, ____adp_dialog_factory, ____utils_application, ____utils_version) {
10
- 'use strict';
11
- const executeQuickAction = ___sap_ux_private_control_property_editor_common['executeQuickAction'];
12
- const quickActionListChanged = ___sap_ux_private_control_property_editor_common['quickActionListChanged'];
13
- const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
14
- const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
15
- const updateQuickAction = ___sap_ux_private_control_property_editor_common['updateQuickAction'];
16
- const externalFileChange = ___sap_ux_private_control_property_editor_common['externalFileChange'];
17
- const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
18
- const getTextBundle = ____i18n['getTextBundle'];
19
- const DialogFactory = ____adp_dialog_factory['DialogFactory'];
20
- const getApplicationType = ____utils_application['getApplicationType'];
21
- const getUi5Version = ____utils_version['getUi5Version'];
22
- class QuickActionService {
23
- sendAction = () => {
24
- };
25
- actions = [];
26
- constructor(rta, outlineService, registries, changeService) {
27
- this.rta = rta;
28
- this.outlineService = outlineService;
29
- this.registries = registries;
30
- this.changeService = changeService;
31
- }
32
- async init(sendAction, subscribe) {
33
- this.sendAction = sendAction;
34
- this.actionService = await this.rta.getService('action');
35
- this.texts = await getTextBundle();
36
- subscribe(async action => {
37
- if (executeQuickAction.match(action)) {
38
- const actionInstance = this.actions.filter(quickActionDefinition => quickActionDefinition.id === action.payload.id).pop();
39
- if (!actionInstance) {
40
- return;
41
- }
42
- const commands = await this.executeAction(actionInstance, action.payload);
43
- for (const command of commands) {
44
- await this.rta.getCommandStack().pushAndExecute(command);
45
- }
46
- if (actionInstance.forceRefreshAfterExecution) {
47
- this.sendAction(updateQuickAction(actionInstance.getActionObject()));
48
- }
49
- }
50
- if (externalFileChange.match(action)) {
51
- await this.reloadQuickActions(this.controlTreeIndex);
52
- }
53
- });
54
- this.outlineService.onOutlineChange(async event => {
55
- this.controlTreeIndex = event.detail.controlIndex;
56
- await this.reloadQuickActions(event.detail.controlIndex);
57
- });
58
- this.changeService.onStackChange(async () => {
59
- await this.reloadQuickActions(this.controlTreeIndex);
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
- async addAction(group, instance) {
102
- if (instance.isApplicable) {
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
- async executeAction(actionInstance, payload) {
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
- const versionInfo = await getUi5Version();
112
- await reportTelemetry({
113
- category: 'QuickAction',
114
- actionName: actionInstance.type,
115
- telemetryEventIdentifier: actionInstance.getTelemetryIdentifier(true),
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
- return Promise.resolve([]);
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
- var __exports = { __esModule: true };
133
- __exports.QuickActionService = QuickActionService;
134
- return __exports;
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
- 'use strict';
2
- sap.ui.define(['open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common'], function (___sap_ux_private_control_property_editor_common) {
3
- 'use strict';
4
- const setAppMode = ___sap_ux_private_control_property_editor_common['setAppMode'];
5
- const setUndoRedoEnablement = ___sap_ux_private_control_property_editor_common['setUndoRedoEnablement'];
6
- const setSaveEnablement = ___sap_ux_private_control_property_editor_common['setSaveEnablement'];
7
- const undo = ___sap_ux_private_control_property_editor_common['undo'];
8
- const redo = ___sap_ux_private_control_property_editor_common['redo'];
9
- const save = ___sap_ux_private_control_property_editor_common['save'];
10
- const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
11
- const applicationModeChanged = ___sap_ux_private_control_property_editor_common['applicationModeChanged'];
12
- class RtaService {
13
- constructor(rta) {
14
- this.rta = rta;
15
- }
16
- async init(sendAction, subscribe) {
17
- return new Promise(resolve => {
18
- sendAction(applicationModeChanged(this.rta.getMode()));
19
- subscribe(async action => {
20
- if (setAppMode.match(action)) {
21
- this.rta.setMode(action.payload);
22
- }
23
- if (undo.match(action)) {
24
- this.rta.undo();
25
- }
26
- if (redo.match(action)) {
27
- this.rta.redo();
28
- }
29
- if (reloadApplication.match(action)) {
30
- if (action.payload.save === true) {
31
- await this.save();
32
- }
33
- await this.rta.stop(false, true);
34
- }
35
- if (save.match(action)) {
36
- await this.save();
37
- }
38
- });
39
- this.rta.attachStop(() => {
40
- location.reload();
41
- });
42
- this.rta.attachStart(() => {
43
- resolve();
44
- });
45
- this.rta.attachModeChanged(modeAndStackChangeHandler(sendAction, this.rta));
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
- function modeAndStackChangeHandler(sendAction, rta) {
57
- return () => {
58
- const canUndo = rta.canUndo();
59
- const canRedo = rta.canRedo();
60
- const saveAllowed = rta?.canSave ? rta?.canSave() : canUndo;
61
- sendAction(setUndoRedoEnablement({
62
- canUndo,
63
- canRedo
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
- var __exports = { __esModule: true };
69
- __exports.RtaService = RtaService;
70
- __exports.modeAndStackChangeHandler = modeAndStackChangeHandler;
71
- return __exports;
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