@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,31 +1,43 @@
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
- '../utils/error'
6
- ], function (Log, ___sap_ux_private_control_property_editor_common, ___utils_error) {
7
- 'use strict';
8
- const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
9
- const getError = ___utils_error['getError'];
10
- class CommunicationService {
11
- static actionHandlers = [];
12
- static #_ = ((() => {
13
- const {sendAction} = startPostMessageCommunication(window.parent, async action => {
14
- for (const handler of this.actionHandlers) {
15
- try {
16
- await handler(action);
17
- } catch (error) {
18
- Log.error('Handler Failed: ', getError(error));
19
- }
20
- }
21
- });
22
- this.sendAction = sendAction;
23
- })());
24
- static subscribe(handler) {
25
- this.actionHandlers.push(handler);
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../utils/error"], function (Log, ___sap_ux_private_control_property_editor_common, ___utils_error) {
4
+ "use strict";
5
+
6
+ const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common["startPostMessageCommunication"];
7
+ const getError = ___utils_error["getError"];
8
+ class CommunicationService {
9
+ /**
10
+ * Sends an action to the CPE.
11
+ */
12
+
13
+ static actionHandlers = [];
14
+ static #_ = (() => {
15
+ const {
16
+ sendAction
17
+ } = startPostMessageCommunication(window.parent, async action => {
18
+ for (const handler of this.actionHandlers) {
19
+ try {
20
+ await handler(action);
21
+ } catch (error) {
22
+ Log.error('Handler Failed: ', getError(error));
23
+ }
26
24
  }
25
+ });
26
+ this.sendAction = sendAction;
27
+ })();
28
+ /**
29
+ * Creates a listener to receive actions from the CPE.
30
+ *
31
+ * @param handler - Action handler.
32
+ */
33
+ static subscribe(handler) {
34
+ this.actionHandlers.push(handler);
27
35
  }
28
- var __exports = { __esModule: true };
29
- __exports.CommunicationService = CommunicationService;
30
- return __exports;
31
- });
36
+ }
37
+ var __exports = {
38
+ __esModule: true
39
+ };
40
+ __exports.CommunicationService = CommunicationService;
41
+ return __exports;
42
+ });
43
+ //# sourceMappingURL=communication-service.js.map
@@ -1,67 +1,90 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- '../utils/version'
5
- ], function (___sap_ux_private_control_property_editor_common, ___utils_version) {
6
- 'use strict';
7
- function __ui5_require_async(path) {
8
- return new Promise(function (resolve, reject) {
9
- sap.ui.require([path], function (module) {
10
- if (!(module && module.__esModule)) {
11
- module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
12
- Object.defineProperty(module, '__esModule', { value: true });
13
- }
14
- resolve(module);
15
- }, function (err) {
16
- reject(err);
17
- });
18
- });
19
- }
20
- const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
21
- const storageFileChanged = ___sap_ux_private_control_property_editor_common['storageFileChanged'];
22
- const getUi5Version = ___utils_version['getUi5Version'];
23
- const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
24
- class WorkspaceConnectorService {
25
- isReloadPending = false;
26
- async init(sendAction, subscribe) {
27
- this.sendAction = sendAction;
28
- subscribe(action => {
29
- if (reloadApplication.match(action)) {
30
- this.isReloadPending = true;
31
- }
32
- });
33
- const ui5Version = await getUi5Version();
34
- if (isLowerThanMinimalUi5Version(ui5Version, {
35
- major: 1,
36
- minor: 84
37
- })) {
38
- if (ui5Version.isCdn) {
39
- const FakeLrepConnector = (await __ui5_require_async('sap/ui/fl/FakeLrepConnector')).default;
40
- FakeLrepConnector.fileChangeRequestNotifier = this.onChangeSaved.bind(this);
41
- } else {
42
- return;
43
- }
44
- } else {
45
- const connector = (await __ui5_require_async('open/ux/preview/client/flp/WorkspaceConnector')).default;
46
- connector.storage.fileChangeRequestNotifier = this.onChangeSaved.bind(this);
47
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../utils/version"], function (___sap_ux_private_control_property_editor_common, ___utils_version) {
4
+ "use strict";
5
+
6
+ function __ui5_require_async(path) {
7
+ return new Promise(function (resolve, reject) {
8
+ sap.ui.require([path], function (module) {
9
+ if (!(module && module.__esModule)) {
10
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
+ default: module
12
+ } : module;
13
+ Object.defineProperty(module, "__esModule", {
14
+ value: true
15
+ });
16
+ }
17
+ resolve(module);
18
+ }, function (err) {
19
+ reject(err);
20
+ });
21
+ });
22
+ }
23
+ const reloadApplication = ___sap_ux_private_control_property_editor_common["reloadApplication"];
24
+ const storageFileChanged = ___sap_ux_private_control_property_editor_common["storageFileChanged"];
25
+ const getUi5Version = ___utils_version["getUi5Version"];
26
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
27
+ /**
28
+ * A Class of WorkspaceConnectorService
29
+ */
30
+ class WorkspaceConnectorService {
31
+ /**
32
+ * When save and reload is triggered, we do not need special handling for changes that are not directly visible in preview.
33
+ */
34
+ isReloadPending = false;
35
+ /**
36
+ * Initializes connector service.
37
+ *
38
+ * @param sendAction action sender function
39
+ * @param subscribe subscriber function
40
+ */
41
+ async init(sendAction, subscribe) {
42
+ this.sendAction = sendAction;
43
+ subscribe(action => {
44
+ if (reloadApplication.match(action)) {
45
+ this.isReloadPending = true;
48
46
  }
49
- onChangeSaved(fileName, kind) {
50
- let change = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
51
- let additionalChangeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
52
- const {changeType, content} = change;
53
- if (changeType && ![
54
- 'appdescr_fe_changePageConfiguration',
55
- 'appdescr_ui_generic_app_changePageConfiguration'
56
- ].includes(changeType) || kind === 'delete' || this.isReloadPending) {
57
- this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
58
- }
59
- if (changeType === 'addXML' && additionalChangeInfo?.templateName && content?.fragmentPath) {
60
- this.sendAction(storageFileChanged(content.fragmentPath));
61
- }
47
+ });
48
+ const ui5Version = await getUi5Version();
49
+ if (isLowerThanMinimalUi5Version(ui5Version, {
50
+ major: 1,
51
+ minor: 84
52
+ })) {
53
+ if (ui5Version.isCdn) {
54
+ const FakeLrepConnector = (await __ui5_require_async('sap/ui/fl/FakeLrepConnector')).default;
55
+ FakeLrepConnector.fileChangeRequestNotifier = this.onChangeSaved.bind(this);
56
+ } else {
57
+ // For UI5 versions below 1.84 served from npmjs, we do not support any connector service
58
+ return;
62
59
  }
60
+ } else {
61
+ const connector = (await __ui5_require_async('open/ux/preview/client/flp/WorkspaceConnector')).default;
62
+ // hook the file deletion listener to the UI5 workspace connector
63
+ connector.storage.fileChangeRequestNotifier = this.onChangeSaved.bind(this);
64
+ }
65
+ }
66
+ onChangeSaved(fileName, kind) {
67
+ let change = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
68
+ let additionalChangeInfo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
69
+ const {
70
+ changeType,
71
+ content
72
+ } = change;
73
+ if (changeType && !['appdescr_fe_changePageConfiguration', 'appdescr_ui_generic_app_changePageConfiguration'].includes(changeType) || kind === 'delete' || this.isReloadPending) {
74
+ this.sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
75
+ }
76
+ if (changeType === 'addXML' && additionalChangeInfo?.templateName && content?.fragmentPath) {
77
+ // If there is template available, then we save and reload right away,
78
+ // so we should ignore the first file change event that comes for the fragment.
79
+ // (We don't want to show "Reload" button)
80
+ this.sendAction(storageFileChanged(content.fragmentPath));
81
+ }
63
82
  }
64
- var __exports = { __esModule: true };
65
- __exports.WorkspaceConnectorService = WorkspaceConnectorService;
66
- return __exports;
67
- });
83
+ }
84
+ var __exports = {
85
+ __esModule: true
86
+ };
87
+ __exports.WorkspaceConnectorService = WorkspaceConnectorService;
88
+ return __exports;
89
+ });
90
+ //# sourceMappingURL=connector-service.js.map
@@ -1,77 +1,90 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- '../adp/dialog-factory',
5
- '../i18n',
6
- 'sap/base/Log',
7
- '../utils/core',
8
- '../utils/version',
9
- '../utils/application'
10
- ], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n, Log, ___utils_core, ___utils_version, ___utils_application) {
11
- 'use strict';
12
- const executeContextMenuAction = ___sap_ux_private_control_property_editor_common['executeContextMenuAction'];
13
- const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
14
- const requestControlContextMenu = ___sap_ux_private_control_property_editor_common['requestControlContextMenu'];
15
- const DialogFactory = ___adp_dialog_factory['DialogFactory'];
16
- const getTextBundle = ___i18n['getTextBundle'];
17
- const getControlById = ___utils_core['getControlById'];
18
- const getUi5Version = ___utils_version['getUi5Version'];
19
- const getApplicationType = ___utils_application['getApplicationType'];
20
- class ContextMenuService {
21
- sendAction = () => {
22
- };
23
- constructor(rta) {
24
- this.rta = rta;
25
- }
26
- async init(sendAction, subscribe) {
27
- this.sendAction = sendAction;
28
- this.actionService = await this.rta.getService('action');
29
- const resourceBundle = await getTextBundle();
30
- subscribe(async action => {
31
- if (executeContextMenuAction.match(action)) {
32
- const {actionName, controlId} = action.payload;
33
- await this.actionService.execute(controlId, actionName);
34
- try {
35
- const controlName = getControlById(controlId)?.getMetadata().getName();
36
- const versionInfo = await getUi5Version();
37
- await reportTelemetry({
38
- category: 'OutlineContextMenu',
39
- actionName,
40
- controlName,
41
- ui5Version: `${ versionInfo.major }.${ versionInfo.minor }.${ versionInfo.patch }`,
42
- appType: getApplicationType(this.rta.getRootControlInstance().getManifest())
43
- });
44
- } catch (err) {
45
- Log.error('Error in reporting Telemetry:', err);
46
- }
47
- }
48
- if (requestControlContextMenu.pending.match(action)) {
49
- const controlId = action.payload;
50
- const actions = await this.actionService.get(controlId);
51
- const responsePayload = {
52
- controlId: controlId,
53
- contextMenuItems: (actions ?? []).map(val => {
54
- let enabled = val.enabled;
55
- let tooltip;
56
- if (!DialogFactory.canOpenDialog) {
57
- enabled = false;
58
- tooltip = resourceBundle.getText('ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE');
59
- }
60
- return {
61
- id: val.id,
62
- title: val.text,
63
- enabled,
64
- tooltip
65
- };
66
- })
67
- };
68
- const requestControlActions = requestControlContextMenu.fulfilled(responsePayload);
69
- this.sendAction(requestControlActions);
70
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../adp/dialog-factory", "../i18n", "sap/base/Log", "../utils/core", "../utils/version", "../utils/application"], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n, Log, ___utils_core, ___utils_version, ___utils_application) {
4
+ "use strict";
5
+
6
+ const executeContextMenuAction = ___sap_ux_private_control_property_editor_common["executeContextMenuAction"];
7
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common["reportTelemetry"];
8
+ const requestControlContextMenu = ___sap_ux_private_control_property_editor_common["requestControlContextMenu"];
9
+ const DialogFactory = ___adp_dialog_factory["DialogFactory"];
10
+ const getTextBundle = ___i18n["getTextBundle"];
11
+ const getControlById = ___utils_core["getControlById"];
12
+ const getUi5Version = ___utils_version["getUi5Version"];
13
+ const getApplicationType = ___utils_application["getApplicationType"];
14
+ /**
15
+ * A Class of ContextMenuService
16
+ */
17
+ class ContextMenuService {
18
+ sendAction = () => {};
19
+ /**
20
+ *
21
+ * @param rta Runtime Authoring instance.
22
+ */
23
+ constructor(rta) {
24
+ this.rta = rta;
25
+ }
26
+
27
+ /**
28
+ * Initializes rta service.
29
+ *
30
+ * @param sendAction action sender function
31
+ * @param subscribe subscriber function
32
+ */
33
+ async init(sendAction, subscribe) {
34
+ this.sendAction = sendAction;
35
+ this.actionService = await this.rta.getService('action');
36
+ const resourceBundle = await getTextBundle();
37
+ subscribe(async action => {
38
+ if (executeContextMenuAction.match(action)) {
39
+ const {
40
+ actionName,
41
+ controlId
42
+ } = action.payload;
43
+ await this.actionService.execute(controlId, actionName);
44
+ try {
45
+ const controlName = getControlById(controlId)?.getMetadata().getName();
46
+ const versionInfo = await getUi5Version();
47
+ await reportTelemetry({
48
+ category: 'OutlineContextMenu',
49
+ actionName,
50
+ controlName,
51
+ ui5Version: `${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`,
52
+ appType: getApplicationType(this.rta.getRootControlInstance().getManifest())
71
53
  });
54
+ } catch (err) {
55
+ Log.error('Error in reporting Telemetry:', err);
56
+ }
57
+ }
58
+ if (requestControlContextMenu.pending.match(action)) {
59
+ const controlId = action.payload;
60
+ const actions = await this.actionService.get(controlId);
61
+ const responsePayload = {
62
+ controlId: controlId,
63
+ contextMenuItems: (actions ?? []).map(val => {
64
+ let enabled = val.enabled;
65
+ let tooltip;
66
+ if (!DialogFactory.canOpenDialog) {
67
+ enabled = false;
68
+ tooltip = resourceBundle.getText('ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE');
69
+ }
70
+ return {
71
+ id: val.id,
72
+ title: val.text,
73
+ enabled,
74
+ tooltip
75
+ };
76
+ })
77
+ };
78
+ const requestControlActions = requestControlContextMenu.fulfilled(responsePayload);
79
+ this.sendAction(requestControlActions);
72
80
  }
81
+ });
73
82
  }
74
- var __exports = { __esModule: true };
75
- __exports.ContextMenuService = ContextMenuService;
76
- return __exports;
77
- });
83
+ }
84
+ var __exports = {
85
+ __esModule: true
86
+ };
87
+ __exports.ContextMenuService = ContextMenuService;
88
+ return __exports;
89
+ });
90
+ //# sourceMappingURL=context-menu-service.js.map