@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.
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 +2 -2
@@ -1,116 +1,160 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/model/json/JSONModel',
4
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../utils/error',
6
- '../../utils/info-center-message',
7
- '../api-handler',
8
- './BaseDialog.controller'
9
- ], function (JSONModel, ___sap_ux_private_control_property_editor_common, ____utils_error, ____utils_info_center_message, ___api_handler, __BaseDialog) {
10
- 'use strict';
11
- function _interopRequireDefault(obj) {
12
- return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
13
- }
14
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
15
- const getError = ____utils_error['getError'];
16
- const sendInfoCenterMessage = ____utils_info_center_message['sendInfoCenterMessage'];
17
- const getFragments = ___api_handler['getFragments'];
18
- const BaseDialog = _interopRequireDefault(__BaseDialog);
19
- const ExtensionPoint = BaseDialog.extend('open.ux.preview.client.adp.controllers.ExtensionPoint', {
20
- constructor: function _constructor(name, _overlays, rta, data) {
21
- BaseDialog.prototype.constructor.call(this, name);
22
- this.model = new JSONModel();
23
- this.data = data;
24
- this.rta = rta;
25
- },
26
- setup: async function _setup(dialog) {
27
- this.dialog = dialog;
28
- this.setEscapeHandler();
29
- await this.buildDialogData();
30
- this.dialog.setModel(this.model);
31
- this.dialog.open();
32
- },
33
- onCreateBtnPress: async function _onCreateBtnPress(event) {
34
- const source = event.getSource();
35
- source.setEnabled(false);
36
- await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
37
- const fragmentName = this.model.getProperty('/newFragmentName');
38
- this.createExtensionPointFragmentChange(fragmentName);
39
- await sendInfoCenterMessage({
40
- title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
41
- description: {
42
- key: 'ADP_CREATE_XML_FRAGMENT_DESCRIPTION',
43
- params: [fragmentName]
44
- },
45
- type: MessageBarType.info
46
- });
47
- this.handleDialogClose();
48
- },
49
- onExtensionPointHandler: function _onExtensionPointHandler(event) {
50
- const source = event.getSource();
51
- const selectedItem = source.getSelectedItem();
52
- let extensionPointName = '';
53
- if (selectedItem) {
54
- extensionPointName = selectedItem.getText();
55
- }
56
- this.model.setProperty('/extensionPointName', extensionPointName);
57
- const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
58
- this.model.setProperty('/hasDefaultContent', hasDefaultContent);
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/model/json/JSONModel", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../utils/error", "../../utils/info-center-message", "../api-handler", "./BaseDialog.controller"], function (JSONModel, ___sap_ux_private_control_property_editor_common, ____utils_error, ____utils_info_center_message, ___api_handler, __BaseDialog) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
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
+ const getFragments = ___api_handler["getFragments"];
13
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
14
+ /**
15
+ * @namespace open.ux.preview.client.adp.controllers
16
+ */
17
+ const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
18
+ constructor: function _constructor(name, _overlays, rta, data) {
19
+ BaseDialog.prototype.constructor.call(this, name);
20
+ this.model = new JSONModel();
21
+ this.data = data;
22
+ this.rta = rta;
23
+ },
24
+ /**
25
+ * Setups the Dialog and the JSON Model
26
+ *
27
+ * @param {Dialog} dialog - Dialog instance
28
+ */
29
+ setup: async function _setup(dialog) {
30
+ this.dialog = dialog;
31
+ this.setEscapeHandler();
32
+ await this.buildDialogData();
33
+ this.dialog.setModel(this.model);
34
+ this.dialog.open();
35
+ },
36
+ /**
37
+ * Handles create button press
38
+ *
39
+ * @param event Event
40
+ */
41
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
42
+ const source = event.getSource();
43
+ source.setEnabled(false);
44
+ await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
45
+ const fragmentName = this.model.getProperty('/newFragmentName');
46
+ this.createExtensionPointFragmentChange(fragmentName);
47
+ await sendInfoCenterMessage({
48
+ title: {
49
+ key: 'ADP_CREATE_XML_FRAGMENT_TITLE'
59
50
  },
60
- hasDefaultContentForName: function _hasDefaultContentForName(name) {
61
- const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
62
- return defaultContent ? defaultContent.length > 0 : false;
51
+ description: {
52
+ key: 'ADP_CREATE_XML_FRAGMENT_DESCRIPTION',
53
+ params: [fragmentName]
63
54
  },
64
- buildDialogData: async function _buildDialogData() {
65
- const name = this.data?.name;
66
- if (name) {
67
- const hasDefaultContent = this.hasDefaultContentForName(name);
68
- const extensionPointList = [{
69
- key: 0,
70
- value: name
71
- }];
72
- this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
73
- } else {
74
- const extensionPointList = this.data.info.map((v, idx) => {
75
- return {
76
- key: idx,
77
- value: v.name
78
- };
79
- });
80
- const firstElName = extensionPointList[0].value;
81
- const enabled = extensionPointList.length > 1;
82
- const hasDefaultContent = this.hasDefaultContentForName(firstElName);
83
- this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
84
- }
85
- try {
86
- const {fragments} = await getFragments();
87
- this.model.setProperty('/fragmentList', fragments);
88
- } catch (e) {
89
- const error = getError(e);
90
- await sendInfoCenterMessage({
91
- title: { key: 'ADP_EXTENSION_POINT_ERROR_TITLE' },
92
- description: error.message,
93
- type: MessageBarType.error
94
- });
95
- throw error;
96
- }
97
- },
98
- updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
99
- this.model.setProperty('/extensionPointName', name);
100
- this.model.setProperty('/extensionPointKey', key);
101
- this.model.setProperty('/extensionPointList', list);
102
- this.model.setProperty('/extensionListEnabled', enabled);
103
- this.model.setProperty('/hasDefaultContent', hasDefaultContent);
104
- },
105
- createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
106
- const extensionPointName = this.model.getProperty('/extensionPointName');
107
- const modifiedValue = {
108
- fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
109
- fragmentPath: `fragments/${ fragmentName }.fragment.xml`,
110
- extensionPointName
111
- };
112
- this.data.deferred.resolve(modifiedValue);
113
- }
114
- });
115
- return ExtensionPoint;
116
- });
55
+ type: MessageBarType.info
56
+ });
57
+ this.handleDialogClose();
58
+ },
59
+ /**
60
+ * Handler for extension point select control
61
+ *
62
+ * @param event Select control change event
63
+ */
64
+ onExtensionPointHandler: function _onExtensionPointHandler(event) {
65
+ const source = event.getSource();
66
+ const selectedItem = source.getSelectedItem();
67
+ let extensionPointName = '';
68
+ if (selectedItem) {
69
+ extensionPointName = selectedItem.getText();
70
+ }
71
+ this.model.setProperty('/extensionPointName', extensionPointName);
72
+ const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
73
+ this.model.setProperty('/hasDefaultContent', hasDefaultContent);
74
+ },
75
+ /**
76
+ * Determines whether there is default content associated with the given name.
77
+ *
78
+ * @param {string} name - The name to check for associated default content.
79
+ * @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
80
+ */
81
+ hasDefaultContentForName: function _hasDefaultContentForName(name) {
82
+ const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
83
+ return defaultContent ? defaultContent.length > 0 : false;
84
+ },
85
+ /**
86
+ * Builds data that is used in the dialog
87
+ */
88
+ buildDialogData: async function _buildDialogData() {
89
+ const name = this.data?.name;
90
+ if (name) {
91
+ const hasDefaultContent = this.hasDefaultContentForName(name);
92
+ const extensionPointList = [{
93
+ key: 0,
94
+ value: name
95
+ }];
96
+ this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
97
+ } else {
98
+ // In this case we are selecting from the application. There can be many extension points under one control.
99
+ const extensionPointList = this.data.info.map((v, idx) => {
100
+ return {
101
+ key: idx,
102
+ value: v.name
103
+ };
104
+ });
105
+ const firstElName = extensionPointList[0].value;
106
+ const enabled = extensionPointList.length > 1;
107
+ const hasDefaultContent = this.hasDefaultContentForName(firstElName);
108
+ this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
109
+ }
110
+ try {
111
+ const {
112
+ fragments
113
+ } = await getFragments();
114
+ this.model.setProperty('/fragmentList', fragments);
115
+ } catch (e) {
116
+ const error = getError(e);
117
+ await sendInfoCenterMessage({
118
+ title: {
119
+ key: 'ADP_EXTENSION_POINT_ERROR_TITLE'
120
+ },
121
+ description: error.message,
122
+ type: MessageBarType.error
123
+ });
124
+ throw error;
125
+ }
126
+ },
127
+ /**
128
+ * Updates the Select control according to provided values
129
+ *
130
+ * @param name Extension point name
131
+ * @param key Selected extension point key
132
+ * @param list All of the extension points that are under a view
133
+ * @param enabled Enables the select control
134
+ * @param hasDefaultContent Whether there is default content associated with the extension name
135
+ */
136
+ updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
137
+ this.model.setProperty('/extensionPointName', name);
138
+ this.model.setProperty('/extensionPointKey', key);
139
+ this.model.setProperty('/extensionPointList', list);
140
+ this.model.setProperty('/extensionListEnabled', enabled);
141
+ this.model.setProperty('/hasDefaultContent', hasDefaultContent);
142
+ },
143
+ /**
144
+ * Creates add xml at extension point changes
145
+ *
146
+ * @param fragmentName Fragment name
147
+ */
148
+ createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
149
+ const extensionPointName = this.model.getProperty('/extensionPointName');
150
+ const modifiedValue = {
151
+ fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
152
+ fragmentPath: `fragments/${fragmentName}.fragment.xml`,
153
+ extensionPointName
154
+ };
155
+ this.data.deferred.resolve(modifiedValue);
156
+ }
157
+ });
158
+ return ExtensionPoint;
159
+ });
160
+ //# sourceMappingURL=ExtensionPoint.controller.js.map
@@ -1,62 +1,83 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/rta/plugin/AddXMLAtExtensionPoint',
4
- 'sap/ui/rta/command/CommandFactory',
5
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
6
- './utils',
7
- './dialog-factory',
8
- '../cpe/communication-service'
9
- ], function (AddXMLAtExtensionPoint, CommandFactory, ___sap_ux_private_control_property_editor_common, ___utils, ___dialog_factory, ___cpe_communication_service) {
10
- 'use strict';
11
- const addExtensionPoint = ___sap_ux_private_control_property_editor_common['addExtensionPoint'];
12
- const createDeferred = ___utils['createDeferred'];
13
- const DialogFactory = ___dialog_factory['DialogFactory'];
14
- const DialogNames = ___dialog_factory['DialogNames'];
15
- const CommunicationService = ___cpe_communication_service['CommunicationService'];
16
- class ExtensionPointService {
17
- actionId = 'CTX_ADDXML_AT_EXTENSIONPOINT';
18
- constructor(rta) {
19
- this.rta = rta;
20
- }
21
- init() {
22
- this.initPlugin();
23
- CommunicationService.subscribe(async action => {
24
- if (addExtensionPoint.match(action)) {
25
- try {
26
- const {controlId, name} = action.payload;
27
- const suffix = `--${ name }`;
28
- const baseControlId = controlId.endsWith(suffix) ? controlId.slice(0, -suffix.length) : controlId;
29
- const service = await this.rta.getService('action');
30
- service.execute(baseControlId, this.actionId);
31
- this.selectedExtensionPointName = name;
32
- } catch (e) {
33
- throw new Error(`Failed to execute service with actionId: ${ this.actionId }`);
34
- }
35
- }
36
- });
37
- }
38
- initPlugin() {
39
- const flexSettings = this.rta.getFlexSettings();
40
- const commandFactory = new CommandFactory({ flexSettings });
41
- const plugin = new AddXMLAtExtensionPoint({
42
- commandFactory,
43
- fragmentHandler: async (overlay, info) => await this.fragmentHandler(overlay, info)
44
- });
45
- const plugins = this.rta.getPlugins();
46
- plugins.addXMLAtExtensionPoint = plugin;
47
- this.rta.setPlugins(plugins);
48
- }
49
- async fragmentHandler(overlay, info) {
50
- let deferred = createDeferred();
51
- const name = this.selectedExtensionPointName;
52
- await DialogFactory.createDialog(overlay, this.rta, DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT, {
53
- name,
54
- info,
55
- deferred
56
- });
57
- this.selectedExtensionPointName = '';
58
- return deferred.promise;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/rta/plugin/AddXMLAtExtensionPoint", "sap/ui/rta/command/CommandFactory", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "./utils", "./dialog-factory", "../cpe/communication-service"], function (AddXMLAtExtensionPoint, CommandFactory, ___sap_ux_private_control_property_editor_common, ___utils, ___dialog_factory, ___cpe_communication_service) {
4
+ "use strict";
5
+
6
+ const addExtensionPoint = ___sap_ux_private_control_property_editor_common["addExtensionPoint"];
7
+ const createDeferred = ___utils["createDeferred"];
8
+ const DialogFactory = ___dialog_factory["DialogFactory"];
9
+ const DialogNames = ___dialog_factory["DialogNames"];
10
+ const CommunicationService = ___cpe_communication_service["CommunicationService"];
11
+ class ExtensionPointService {
12
+ actionId = 'CTX_ADDXML_AT_EXTENSIONPOINT';
13
+ /**
14
+ * @param rta Runtime Authoring
15
+ */
16
+ constructor(rta) {
17
+ this.rta = rta;
18
+ }
19
+
20
+ /**
21
+ * Initializes communication with CPE, and the extension point plugin.
22
+ *
23
+ */
24
+ init() {
25
+ this.initPlugin();
26
+ CommunicationService.subscribe(async action => {
27
+ if (addExtensionPoint.match(action)) {
28
+ try {
29
+ const {
30
+ controlId,
31
+ name
32
+ } = action.payload;
33
+ const suffix = `--${name}`;
34
+ const baseControlId = controlId.endsWith(suffix) ? controlId.slice(0, -suffix.length) : controlId;
35
+ const service = await this.rta.getService('action');
36
+ service.execute(baseControlId, this.actionId);
37
+ this.selectedExtensionPointName = name;
38
+ } catch (e) {
39
+ throw new Error(`Failed to execute service with actionId: ${this.actionId}`);
40
+ }
59
41
  }
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Initializes Add XML at Extension Point plugin and adds it to the default RTA plugins.
47
+ */
48
+ initPlugin() {
49
+ const flexSettings = this.rta.getFlexSettings();
50
+ const commandFactory = new CommandFactory({
51
+ flexSettings
52
+ });
53
+ const plugin = new AddXMLAtExtensionPoint({
54
+ commandFactory,
55
+ fragmentHandler: async (overlay, info) => await this.fragmentHandler(overlay, info)
56
+ });
57
+ const plugins = this.rta.getPlugins();
58
+ plugins.addXMLAtExtensionPoint = plugin;
59
+ this.rta.setPlugins(plugins);
60
+ }
61
+
62
+ /**
63
+ * Handler function for AddXMLAtExtensionPoint plugin.
64
+ *
65
+ * @param overlay UI5 Element overlay
66
+ * @param info Extension point data from the plugin
67
+ * @returns Deferred extension point data that is provided to the plugin
68
+ */
69
+ async fragmentHandler(overlay, info) {
70
+ let deferred = createDeferred();
71
+ const name = this.selectedExtensionPointName;
72
+ await DialogFactory.createDialog(overlay, this.rta, DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT, {
73
+ name,
74
+ info,
75
+ deferred
76
+ });
77
+ this.selectedExtensionPointName = '';
78
+ return deferred.promise;
60
79
  }
61
- return ExtensionPointService;
62
- });
80
+ }
81
+ return ExtensionPointService;
82
+ });
83
+ //# sourceMappingURL=extension-point.js.map
@@ -1,101 +1,102 @@
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/version',
6
- '../cpe/init',
7
- './sync-views-utils',
8
- '../utils/application',
9
- './quick-actions/load',
10
- './init-dialogs',
11
- '../utils/info-center-message',
12
- '../cpe/communication-service'
13
- ], function (log, ___sap_ux_private_control_property_editor_common, ___utils_version, __init, ___sync_views_utils, ___utils_application, ___quick_actions_load, ___init_dialogs, ___utils_info_center_message, ___cpe_communication_service) {
14
- 'use strict';
15
- function _interopRequireDefault(obj) {
16
- return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../utils/version", "../cpe/init", "./sync-views-utils", "../utils/application", "./quick-actions/load", "./init-dialogs", "../utils/info-center-message", "../cpe/communication-service"], function (log, ___sap_ux_private_control_property_editor_common, ___utils_version, __init, ___sync_views_utils, ___utils_application, ___quick_actions_load, ___init_dialogs, ___utils_info_center_message, ___cpe_communication_service) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ function __ui5_require_async(path) {
10
+ return new Promise(function (resolve, reject) {
11
+ sap.ui.require([path], function (module) {
12
+ if (!(module && module.__esModule)) {
13
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
14
+ default: module
15
+ } : module;
16
+ Object.defineProperty(module, "__esModule", {
17
+ value: true
18
+ });
19
+ }
20
+ resolve(module);
21
+ }, function (err) {
22
+ reject(err);
23
+ });
24
+ });
25
+ }
26
+ const enableTelemetry = ___sap_ux_private_control_property_editor_common["enableTelemetry"];
27
+ const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
28
+ const toggleAppPreviewVisibility = ___sap_ux_private_control_property_editor_common["toggleAppPreviewVisibility"];
29
+ const getFullyQualifiedUi5Version = ___utils_version["getFullyQualifiedUi5Version"];
30
+ const getUi5Version = ___utils_version["getUi5Version"];
31
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
32
+ const minVersionInfo = ___utils_version["minVersionInfo"];
33
+ const init = _interopRequireDefault(__init);
34
+ const updateSyncViewsIds = ___sync_views_utils["updateSyncViewsIds"];
35
+ const showSyncViewsWarning = ___sync_views_utils["showSyncViewsWarning"];
36
+ const getApplicationType = ___utils_application["getApplicationType"];
37
+ const loadDefinitions = ___quick_actions_load["loadDefinitions"];
38
+ const initDialogs = ___init_dialogs["initDialogs"];
39
+ const sendInfoCenterMessage = ___utils_info_center_message["sendInfoCenterMessage"];
40
+ const CommunicationService = ___cpe_communication_service["CommunicationService"];
41
+ var __exports = async function (rta) {
42
+ const flexSettings = rta.getFlexSettings();
43
+ if (flexSettings.telemetry === true) {
44
+ enableTelemetry();
17
45
  }
18
- function __ui5_require_async(path) {
19
- return new Promise(function (resolve, reject) {
20
- sap.ui.require([path], function (module) {
21
- if (!(module && module.__esModule)) {
22
- module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
23
- Object.defineProperty(module, '__esModule', { value: true });
24
- }
25
- resolve(module);
26
- }, function (err) {
27
- reject(err);
28
- });
29
- });
46
+ const ui5VersionInfo = await getUi5Version();
47
+
48
+ // Plugins need to be set before adding additional plugins to prevent overriding with the default
49
+ // and allow usage of getPlugins later in the flow
50
+ const defaultPlugins = rta.getDefaultPlugins();
51
+ rta.setPlugins(defaultPlugins);
52
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
53
+ major: 1,
54
+ minor: 136,
55
+ patch: 2
56
+ })) {
57
+ await initDialogs(rta, ui5VersionInfo);
58
+ } else {
59
+ (await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
60
+ (await __ui5_require_async('open/ux/preview/client/adp/extend-controller')).initExtendControllerPlugin(rta);
30
61
  }
31
- const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
32
- const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
33
- const toggleAppPreviewVisibility = ___sap_ux_private_control_property_editor_common['toggleAppPreviewVisibility'];
34
- const getFullyQualifiedUi5Version = ___utils_version['getFullyQualifiedUi5Version'];
35
- const getUi5Version = ___utils_version['getUi5Version'];
36
- const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
37
- const minVersionInfo = ___utils_version['minVersionInfo'];
38
- const init = _interopRequireDefault(__init);
39
- const updateSyncViewsIds = ___sync_views_utils['updateSyncViewsIds'];
40
- const showSyncViewsWarning = ___sync_views_utils['showSyncViewsWarning'];
41
- const getApplicationType = ___utils_application['getApplicationType'];
42
- const loadDefinitions = ___quick_actions_load['loadDefinitions'];
43
- const initDialogs = ___init_dialogs['initDialogs'];
44
- const sendInfoCenterMessage = ___utils_info_center_message['sendInfoCenterMessage'];
45
- const CommunicationService = ___cpe_communication_service['CommunicationService'];
46
- var __exports = async function (rta) {
47
- const flexSettings = rta.getFlexSettings();
48
- if (flexSettings.telemetry === true) {
49
- enableTelemetry();
50
- }
51
- const ui5VersionInfo = await getUi5Version();
52
- const defaultPlugins = rta.getDefaultPlugins();
53
- rta.setPlugins(defaultPlugins);
54
- if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
55
- major: 1,
56
- minor: 136,
57
- patch: 2
58
- })) {
59
- await initDialogs(rta, ui5VersionInfo);
60
- } else {
61
- (await __ui5_require_async('open/ux/preview/client/adp/add-fragment')).initAddXMLPlugin(rta);
62
- (await __ui5_require_async('open/ux/preview/client/adp/extend-controller')).initExtendControllerPlugin(rta);
63
- }
64
- if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
65
- major: 1,
66
- minor: 78
67
- })) {
68
- const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
69
- const extPointService = new ExtensionPointService(rta);
70
- extPointService.init();
71
- }
72
- const applicationType = getApplicationType(rta.getRootControlInstance().getManifest());
73
- const quickActionRegistries = await loadDefinitions(applicationType);
74
- await init(rta, quickActionRegistries);
75
- rta.getService('outline').then(outlineService => {
76
- outlineService.attachEvent('update', async () => {
77
- await updateSyncViewsIds(ui5VersionInfo);
78
- await showSyncViewsWarning();
79
- });
80
- }).catch(error => {
81
- log.error('Failed to attach update event to outline service', error);
82
- });
83
- if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
84
- await sendInfoCenterMessage({
85
- title: { key: 'FLP_UI5_VERSION_WARNING_TITLE' },
86
- description: {
87
- key: 'FLP_UI5_VERSION_WARNING_DESCRIPTION',
88
- params: [
89
- getFullyQualifiedUi5Version(ui5VersionInfo),
90
- getFullyQualifiedUi5Version(minVersionInfo)
91
- ]
92
- },
93
- type: MessageBarType.error
94
- });
95
- CommunicationService.sendAction(toggleAppPreviewVisibility(false));
96
- return;
97
- }
98
- log.debug('ADP init executed.');
99
- };
100
- return __exports;
101
- });
62
+ if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
63
+ major: 1,
64
+ minor: 78
65
+ })) {
66
+ const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
67
+ const extPointService = new ExtensionPointService(rta);
68
+ extPointService.init();
69
+ }
70
+ const applicationType = getApplicationType(rta.getRootControlInstance().getManifest());
71
+ const quickActionRegistries = await loadDefinitions(applicationType);
72
+ await init(rta, quickActionRegistries);
73
+
74
+ // Register synchronious views detection and warning
75
+ // This is not awaited to prevent deadlock in the initialization
76
+ rta.getService('outline').then(outlineService => {
77
+ outlineService.attachEvent('update', async () => {
78
+ await updateSyncViewsIds(ui5VersionInfo);
79
+ await showSyncViewsWarning();
80
+ });
81
+ }).catch(error => {
82
+ log.error('Failed to attach update event to outline service', error);
83
+ });
84
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
85
+ await sendInfoCenterMessage({
86
+ title: {
87
+ key: 'FLP_UI5_VERSION_WARNING_TITLE'
88
+ },
89
+ description: {
90
+ key: 'FLP_UI5_VERSION_WARNING_DESCRIPTION',
91
+ params: [getFullyQualifiedUi5Version(ui5VersionInfo), getFullyQualifiedUi5Version(minVersionInfo)]
92
+ },
93
+ type: MessageBarType.error
94
+ });
95
+ CommunicationService.sendAction(toggleAppPreviewVisibility(false));
96
+ return;
97
+ }
98
+ log.debug('ADP init executed.');
99
+ };
100
+ return __exports;
101
+ });
102
+ //# sourceMappingURL=init.js.map