@sap-ux/preview-middleware 0.19.43 → 0.20.0

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 (77) hide show
  1. package/dist/client/adp/add-fragment.js +46 -46
  2. package/dist/client/adp/api-handler.js +159 -159
  3. package/dist/client/adp/command-executor.js +75 -75
  4. package/dist/client/adp/control-utils.js +44 -44
  5. package/dist/client/adp/controllers/ControllerExtension.controller.js +210 -210
  6. package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
  7. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  8. package/dist/client/adp/dialog-factory.js +135 -135
  9. package/dist/client/adp/init-dialogs.js +163 -163
  10. package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
  11. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +60 -60
  12. package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
  13. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
  14. package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
  15. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  16. package/dist/client/adp/quick-actions/control-types.js +23 -23
  17. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  18. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  19. package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
  20. package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
  21. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  22. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
  23. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
  24. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  25. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  26. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  27. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  28. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  29. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  30. package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
  31. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  32. package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
  33. package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
  34. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
  35. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
  36. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
  37. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  38. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  39. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
  40. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  41. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  42. package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
  43. package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
  44. package/dist/client/adp/quick-actions/load.js +44 -44
  45. package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
  46. package/dist/client/adp/utils.js +218 -218
  47. package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
  48. package/dist/client/cpe/changes/generic-change.js +326 -326
  49. package/dist/client/cpe/changes/index.js +10 -10
  50. package/dist/client/cpe/changes/validator.js +39 -39
  51. package/dist/client/cpe/documentation.js +164 -164
  52. package/dist/client/cpe/feature-service.js +36 -36
  53. package/dist/client/cpe/logger.js +30 -30
  54. package/dist/client/cpe/outline/editable.js +37 -37
  55. package/dist/client/cpe/outline/nodes.js +203 -203
  56. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  57. package/dist/client/cpe/quick-actions/registry.js +143 -143
  58. package/dist/client/cpe/quick-actions/utils.js +92 -92
  59. package/dist/client/cpe/types.js +4 -4
  60. package/dist/client/cpe/ui5-utils.js +33 -33
  61. package/dist/client/cpe/utils.js +111 -111
  62. package/dist/client/flp/WorkspaceConnector.js +92 -92
  63. package/dist/client/flp/common.js +28 -28
  64. package/dist/client/flp/enableFakeConnector.js +89 -89
  65. package/dist/client/flp/homepage/Component.js +14 -14
  66. package/dist/client/flp/initCdm.js +117 -117
  67. package/dist/client/flp/initConnectors.js +28 -28
  68. package/dist/client/flp/initRta.js +178 -178
  69. package/dist/client/i18n.js +56 -56
  70. package/dist/client/utils/additional-change-info.js +54 -54
  71. package/dist/client/utils/application.js +32 -32
  72. package/dist/client/utils/core.js +84 -84
  73. package/dist/client/utils/error.js +19 -19
  74. package/dist/client/utils/fe-v2.js +56 -56
  75. package/dist/client/utils/fe-v4.js +140 -140
  76. package/dist/client/utils/version.js +104 -104
  77. package/package.json +14 -14
@@ -1,113 +1,113 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil"], function (XMLView, UIComponent, ___utils_core, OverlayRegistry, OverlayUtil) {
4
- "use strict";
5
-
6
- const getComponent = ___utils_core["getComponent"];
7
- /**
8
- * Get runtime control.
9
- *
10
- * @param overlayControl - element overlay.
11
- * @returns ManagedObject
12
- */
13
- function getRuntimeControl(overlayControl) {
14
- let runtimeControl;
15
- if (overlayControl.getElementInstance) {
16
- runtimeControl = overlayControl.getElementInstance();
17
- } else {
18
- runtimeControl = overlayControl.getElement();
19
- }
20
- return runtimeControl;
21
- }
22
-
23
- /**
24
- * Get library of a control name.
25
- *
26
- * @param controlName - name of the ui5 control eg: sap.m.Button.
27
- * @returns Promise<string>
28
- */
29
- async function getLibrary(controlName) {
30
- return new Promise(resolve => {
31
- const controlPath = controlName.replace(/\./g, '/');
32
- sap.ui.require([controlPath], control => {
33
- const contMetadata = control.getMetadata();
34
- // getLibraryName method does not exist on events
35
- if (contMetadata?.getLibraryName) {
36
- const contLibName = contMetadata.getLibraryName();
37
- resolve(contLibName);
38
- } else {
39
- resolve(''); // return empty for events
40
- }
41
- });
42
- });
43
- }
44
-
45
- /**
46
- * Gets the root view of component for the provided ComponentContainer control.
47
- *
48
- * @param container ComponentContainer control.
49
- * @returns XMLView which is the root control of the component if it exists.
50
- */
51
- function getRootControlFromComponentContainer(container) {
52
- if (container) {
53
- const componentId = container.getComponent();
54
- const component = getComponent(componentId);
55
- if (component instanceof UIComponent) {
56
- const rootControl = component.getRootControl();
57
- if (rootControl instanceof XMLView) {
58
- return rootControl;
59
- }
60
- }
61
- }
62
- return undefined;
63
- }
64
- function getManifestProperties(control, changeService, controlOverlay) {
65
- const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
66
- if (!controlOverlay || !overlayData?.manifestSettings) {
67
- return {};
68
- }
69
- const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
70
- const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
71
- const propertyId = item.id;
72
- const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
73
- let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
74
- if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
75
- if (propertyValue === undefined) {
76
- propertyValue = item.value; // set default value of property
77
- }
78
- }
79
- if (!acc[propertyId]) {
80
- acc[propertyId] = {
81
- ...item,
82
- defaultValue: item.value,
83
- configuration: true,
84
- name: item.id,
85
- readableName: item.name,
86
- manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
87
- type: item.type === 'number' ? 'int' : item.type,
88
- value: propertyValue
89
- };
90
- }
91
- return acc;
92
- }, {});
93
- return manifestProperties;
94
- }
95
- const getOverlay = control => {
96
- let controlOverlay = OverlayRegistry.getOverlay(control);
97
- if (!controlOverlay?.getDomRef()) {
98
- //look for closest control
99
- controlOverlay = OverlayUtil.getClosestOverlayFor(control);
100
- }
101
- return controlOverlay;
102
- };
103
- var __exports = {
104
- __esModule: true
105
- };
106
- __exports.getRuntimeControl = getRuntimeControl;
107
- __exports.getLibrary = getLibrary;
108
- __exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
109
- __exports.getManifestProperties = getManifestProperties;
110
- __exports.getOverlay = getOverlay;
111
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/core", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil"], function (XMLView, UIComponent, ___utils_core, OverlayRegistry, OverlayUtil) {
4
+ "use strict";
5
+
6
+ const getComponent = ___utils_core["getComponent"];
7
+ /**
8
+ * Get runtime control.
9
+ *
10
+ * @param overlayControl - element overlay.
11
+ * @returns ManagedObject
12
+ */
13
+ function getRuntimeControl(overlayControl) {
14
+ let runtimeControl;
15
+ if (overlayControl.getElementInstance) {
16
+ runtimeControl = overlayControl.getElementInstance();
17
+ } else {
18
+ runtimeControl = overlayControl.getElement();
19
+ }
20
+ return runtimeControl;
21
+ }
22
+
23
+ /**
24
+ * Get library of a control name.
25
+ *
26
+ * @param controlName - name of the ui5 control eg: sap.m.Button.
27
+ * @returns Promise<string>
28
+ */
29
+ async function getLibrary(controlName) {
30
+ return new Promise(resolve => {
31
+ const controlPath = controlName.replace(/\./g, '/');
32
+ sap.ui.require([controlPath], control => {
33
+ const contMetadata = control.getMetadata();
34
+ // getLibraryName method does not exist on events
35
+ if (contMetadata?.getLibraryName) {
36
+ const contLibName = contMetadata.getLibraryName();
37
+ resolve(contLibName);
38
+ } else {
39
+ resolve(''); // return empty for events
40
+ }
41
+ });
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Gets the root view of component for the provided ComponentContainer control.
47
+ *
48
+ * @param container ComponentContainer control.
49
+ * @returns XMLView which is the root control of the component if it exists.
50
+ */
51
+ function getRootControlFromComponentContainer(container) {
52
+ if (container) {
53
+ const componentId = container.getComponent();
54
+ const component = getComponent(componentId);
55
+ if (component instanceof UIComponent) {
56
+ const rootControl = component.getRootControl();
57
+ if (rootControl instanceof XMLView) {
58
+ return rootControl;
59
+ }
60
+ }
61
+ }
62
+ return undefined;
63
+ }
64
+ function getManifestProperties(control, changeService, controlOverlay) {
65
+ const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
66
+ if (!controlOverlay || !overlayData?.manifestSettings) {
67
+ return {};
68
+ }
69
+ const manifestPropertiesValue = overlayData?.manifestSettingsValues(overlayData?.manifestSettings(control), control);
70
+ const manifestProperties = overlayData?.manifestSettings(control).reduce((acc, item) => {
71
+ const propertyId = item.id;
72
+ const value = changeService.getConfigurationPropertyValue(control.getId(), propertyId);
73
+ let propertyValue = value === 0 || value === false || value ? value : manifestPropertiesValue[propertyId];
74
+ if (item?.type && ['boolean', 'number', 'string'].includes(item?.type)) {
75
+ if (propertyValue === undefined) {
76
+ propertyValue = item.value; // set default value of property
77
+ }
78
+ }
79
+ if (!acc[propertyId]) {
80
+ acc[propertyId] = {
81
+ ...item,
82
+ defaultValue: item.value,
83
+ configuration: true,
84
+ name: item.id,
85
+ readableName: item.name,
86
+ manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
87
+ type: item.type === 'number' ? 'int' : item.type,
88
+ value: propertyValue
89
+ };
90
+ }
91
+ return acc;
92
+ }, {});
93
+ return manifestProperties;
94
+ }
95
+ const getOverlay = control => {
96
+ let controlOverlay = OverlayRegistry.getOverlay(control);
97
+ if (!controlOverlay?.getDomRef()) {
98
+ //look for closest control
99
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
100
+ }
101
+ return controlOverlay;
102
+ };
103
+ var __exports = {
104
+ __esModule: true
105
+ };
106
+ __exports.getRuntimeControl = getRuntimeControl;
107
+ __exports.getLibrary = getLibrary;
108
+ __exports.getRootControlFromComponentContainer = getRootControlFromComponentContainer;
109
+ __exports.getManifestProperties = getManifestProperties;
110
+ __exports.getOverlay = getOverlay;
111
+ return __exports;
112
112
  });
113
113
  //# sourceMappingURL=utils.js.map
@@ -1,94 +1,94 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "./common", "../utils/version", "../utils/additional-change-info"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version, ___utils_additional_change_info) {
4
- "use strict";
5
-
6
- const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
7
- const getFlexSettings = ___common["getFlexSettings"];
8
- const getUi5Version = ___utils_version["getUi5Version"];
9
- const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
10
- const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
11
- const connector = merge({}, ObjectStorageConnector, {
12
- layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
13
- storage: {
14
- _itemsStoredAsObjects: true,
15
- fileChangeRequestNotifier: undefined,
16
- setItem: function (_key, change) {
17
- const settings = getFlexSettings();
18
- if (settings) {
19
- change.support ??= {};
20
- change.support.generator = settings.generator;
21
- }
22
- const additionalChangeInfo = getAdditionalChangeInfo(change);
23
- if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
24
- try {
25
- this.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
26
- } catch (e) {
27
- // exceptions in the listener call are ignored
28
- }
29
- }
30
- const body = {
31
- change,
32
- additionalChangeInfo
33
- };
34
- return fetch(CHANGES_API_PATH, {
35
- method: 'POST',
36
- body: JSON.stringify(body, null, 2),
37
- headers: {
38
- 'content-type': 'application/json'
39
- }
40
- });
41
- },
42
- removeItem: function (key) {
43
- if (typeof this.fileChangeRequestNotifier === 'function') {
44
- try {
45
- this.fileChangeRequestNotifier(key, 'delete');
46
- } catch (e) {
47
- // exceptions in the listener call are ignored
48
- }
49
- }
50
- return fetch(CHANGES_API_PATH, {
51
- method: 'DELETE',
52
- body: JSON.stringify({
53
- fileName: key
54
- }),
55
- headers: {
56
- 'content-type': 'application/json'
57
- }
58
- });
59
- },
60
- clear: function () {
61
- // not implemented
62
- },
63
- getItem: function (_key) {
64
- // not implemented
65
- },
66
- getItems: async function () {
67
- const response = await fetch(CHANGES_API_PATH, {
68
- method: 'GET',
69
- headers: {
70
- 'content-type': 'application/json'
71
- }
72
- });
73
- return await response.json();
74
- }
75
- },
76
- loadFeatures: async function () {
77
- const features = await ObjectStorageConnector.loadFeatures();
78
- features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
79
- major: 1,
80
- minor: 90
81
- });
82
- const settings = getFlexSettings();
83
- if (settings?.developerMode) {
84
- features.isVariantAdaptationEnabled = false;
85
- }
86
- if (settings?.scenario === 'ADAPTATION_PROJECT') {
87
- features.isVariantAdaptationEnabled = true;
88
- }
89
- return features;
90
- }
91
- });
92
- return connector;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "./common", "../utils/version", "../utils/additional-change-info"], function (merge, ObjectStorageConnector, Layer, ___common, ___utils_version, ___utils_additional_change_info) {
4
+ "use strict";
5
+
6
+ const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
7
+ const getFlexSettings = ___common["getFlexSettings"];
8
+ const getUi5Version = ___utils_version["getUi5Version"];
9
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
10
+ const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
11
+ const connector = merge({}, ObjectStorageConnector, {
12
+ layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
13
+ storage: {
14
+ _itemsStoredAsObjects: true,
15
+ fileChangeRequestNotifier: undefined,
16
+ setItem: function (_key, change) {
17
+ const settings = getFlexSettings();
18
+ if (settings) {
19
+ change.support ??= {};
20
+ change.support.generator = settings.generator;
21
+ }
22
+ const additionalChangeInfo = getAdditionalChangeInfo(change);
23
+ if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
24
+ try {
25
+ this.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
26
+ } catch (e) {
27
+ // exceptions in the listener call are ignored
28
+ }
29
+ }
30
+ const body = {
31
+ change,
32
+ additionalChangeInfo
33
+ };
34
+ return fetch(CHANGES_API_PATH, {
35
+ method: 'POST',
36
+ body: JSON.stringify(body, null, 2),
37
+ headers: {
38
+ 'content-type': 'application/json'
39
+ }
40
+ });
41
+ },
42
+ removeItem: function (key) {
43
+ if (typeof this.fileChangeRequestNotifier === 'function') {
44
+ try {
45
+ this.fileChangeRequestNotifier(key, 'delete');
46
+ } catch (e) {
47
+ // exceptions in the listener call are ignored
48
+ }
49
+ }
50
+ return fetch(CHANGES_API_PATH, {
51
+ method: 'DELETE',
52
+ body: JSON.stringify({
53
+ fileName: key
54
+ }),
55
+ headers: {
56
+ 'content-type': 'application/json'
57
+ }
58
+ });
59
+ },
60
+ clear: function () {
61
+ // not implemented
62
+ },
63
+ getItem: function (_key) {
64
+ // not implemented
65
+ },
66
+ getItems: async function () {
67
+ const response = await fetch(CHANGES_API_PATH, {
68
+ method: 'GET',
69
+ headers: {
70
+ 'content-type': 'application/json'
71
+ }
72
+ });
73
+ return await response.json();
74
+ }
75
+ },
76
+ loadFeatures: async function () {
77
+ const features = await ObjectStorageConnector.loadFeatures();
78
+ features.isVariantAdaptationEnabled = !isLowerThanMinimalUi5Version(await getUi5Version(), {
79
+ major: 1,
80
+ minor: 90
81
+ });
82
+ const settings = getFlexSettings();
83
+ if (settings?.developerMode) {
84
+ features.isVariantAdaptationEnabled = false;
85
+ }
86
+ if (settings?.scenario === 'ADAPTATION_PROJECT') {
87
+ features.isVariantAdaptationEnabled = true;
88
+ }
89
+ return features;
90
+ }
91
+ });
92
+ return connector;
93
93
  });
94
94
  //# sourceMappingURL=WorkspaceConnector.js.map
@@ -1,30 +1,30 @@
1
- "use strict";
2
-
3
- sap.ui.define([], function () {
4
- "use strict";
5
-
6
- const CHANGES_API_PATH = '/preview/api/changes';
7
-
8
- /**
9
- * Retrieves Flex settings from a 'sap-ui-bootstrap' element's data attribute.
10
- * Parses the 'data-open-ux-preview-flex-settings' attribute as JSON.
11
- *
12
- * @returns {FlexSettings | undefined} The parsed Flex settings if available, otherwise undefined.
13
- */
14
- function getFlexSettings() {
15
- let result;
16
- const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
17
- const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
18
- if (flexSetting) {
19
- result = JSON.parse(flexSetting);
20
- }
21
- return result;
22
- }
23
- var __exports = {
24
- __esModule: true
25
- };
26
- __exports.CHANGES_API_PATH = CHANGES_API_PATH;
27
- __exports.getFlexSettings = getFlexSettings;
28
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ const CHANGES_API_PATH = '/preview/api/changes';
7
+
8
+ /**
9
+ * Retrieves Flex settings from a 'sap-ui-bootstrap' element's data attribute.
10
+ * Parses the 'data-open-ux-preview-flex-settings' attribute as JSON.
11
+ *
12
+ * @returns {FlexSettings | undefined} The parsed Flex settings if available, otherwise undefined.
13
+ */
14
+ function getFlexSettings() {
15
+ let result;
16
+ const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
17
+ const flexSetting = bootstrapConfig?.getAttribute('data-open-ux-preview-flex-settings');
18
+ if (flexSetting) {
19
+ result = JSON.parse(flexSetting);
20
+ }
21
+ return result;
22
+ }
23
+ var __exports = {
24
+ __esModule: true
25
+ };
26
+ __exports.CHANGES_API_PATH = CHANGES_API_PATH;
27
+ __exports.getFlexSettings = getFlexSettings;
28
+ return __exports;
29
29
  });
30
30
  //# sourceMappingURL=common.js.map
@@ -1,91 +1,91 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../utils/additional-change-info", "./common"], function (LrepConnector, FakeLrepConnector, ___utils_additional_change_info, ___common) {
4
- "use strict";
5
-
6
- const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
7
- const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
8
- const getFlexSettings = ___common["getFlexSettings"];
9
- /**
10
- * Processes an array of FlexChange objects.
11
- * It updates each change object with settings and sends them to a API endpoint.
12
- *
13
- * @param {FlexChange | FlexChange[]} changes - Array of FlexChange objects to be processed.
14
- * @returns {Promise<void>} A promise that resolves when all changes are processed.
15
- */
16
- async function create(changes) {
17
- const settings = getFlexSettings();
18
- await Promise.all((Array.isArray(changes) ? changes : [changes]).map(change => {
19
- if (settings) {
20
- change.support ??= {};
21
- change.support.generator = settings.generator;
22
- }
23
- const additionalChangeInfo = getAdditionalChangeInfo(change);
24
- if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
25
- try {
26
- FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
27
- } catch (e) {
28
- // exceptions in the listener call are ignored
29
- }
30
- }
31
- const body = {
32
- change,
33
- additionalChangeInfo
34
- };
35
- return fetch(CHANGES_API_PATH, {
36
- method: 'POST',
37
- body: JSON.stringify(body, null, 2),
38
- headers: {
39
- 'content-type': 'application/json'
40
- }
41
- });
42
- }));
43
- }
44
-
45
- /**
46
- * Loads changes from a given path and processes them using an LrepConnector instance.
47
- * The changes are then formatted and returned in a specified structure.
48
- *
49
- * @returns {Promise<LoadChangesResult>} A promise that resolves to an object of type LoadChangesResult.
50
- */
51
- async function loadChanges() {
52
- const lrep = new LrepConnector();
53
- const response = await fetch(CHANGES_API_PATH, {
54
- method: 'GET',
55
- headers: {
56
- 'content-type': 'application/json'
57
- }
58
- });
59
- const changes = await response.json();
60
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
- args[_key] = arguments[_key];
62
- }
63
- return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
64
- res.changes.changes = Object.values(changes);
65
- return res;
66
- });
67
- }
68
-
69
- /**
70
- * Configures and enables the FakeLrepConnector based on the SAP UI5 version.
71
- * If the minor version of the SAP UI5 is less than 72, this function extends
72
- * the FakeLrepConnector's prototype with specific methods and enables the fake connector.
73
- *
74
- * Assumes the existence of a global 'sap' object with a 'ui.version' property,
75
- * and global jQuery object with 'extend' method.
76
- *
77
- * @returns {void}
78
- */
79
- var __exports = function () {
80
- jQuery.extend(FakeLrepConnector.prototype, {
81
- create,
82
- loadChanges,
83
- loadSettings: () => Promise.resolve()
84
- });
85
- FakeLrepConnector.enableFakeConnector();
86
- };
87
- __exports.create = create;
88
- __exports.loadChanges = loadChanges;
89
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "../utils/additional-change-info", "./common"], function (LrepConnector, FakeLrepConnector, ___utils_additional_change_info, ___common) {
4
+ "use strict";
5
+
6
+ const getAdditionalChangeInfo = ___utils_additional_change_info["getAdditionalChangeInfo"];
7
+ const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
8
+ const getFlexSettings = ___common["getFlexSettings"];
9
+ /**
10
+ * Processes an array of FlexChange objects.
11
+ * It updates each change object with settings and sends them to a API endpoint.
12
+ *
13
+ * @param {FlexChange | FlexChange[]} changes - Array of FlexChange objects to be processed.
14
+ * @returns {Promise<void>} A promise that resolves when all changes are processed.
15
+ */
16
+ async function create(changes) {
17
+ const settings = getFlexSettings();
18
+ await Promise.all((Array.isArray(changes) ? changes : [changes]).map(change => {
19
+ if (settings) {
20
+ change.support ??= {};
21
+ change.support.generator = settings.generator;
22
+ }
23
+ const additionalChangeInfo = getAdditionalChangeInfo(change);
24
+ if (typeof FakeLrepConnector.fileChangeRequestNotifier === 'function' && change.fileName) {
25
+ try {
26
+ FakeLrepConnector.fileChangeRequestNotifier(change.fileName, 'create', change, additionalChangeInfo);
27
+ } catch (e) {
28
+ // exceptions in the listener call are ignored
29
+ }
30
+ }
31
+ const body = {
32
+ change,
33
+ additionalChangeInfo
34
+ };
35
+ return fetch(CHANGES_API_PATH, {
36
+ method: 'POST',
37
+ body: JSON.stringify(body, null, 2),
38
+ headers: {
39
+ 'content-type': 'application/json'
40
+ }
41
+ });
42
+ }));
43
+ }
44
+
45
+ /**
46
+ * Loads changes from a given path and processes them using an LrepConnector instance.
47
+ * The changes are then formatted and returned in a specified structure.
48
+ *
49
+ * @returns {Promise<LoadChangesResult>} A promise that resolves to an object of type LoadChangesResult.
50
+ */
51
+ async function loadChanges() {
52
+ const lrep = new LrepConnector();
53
+ const response = await fetch(CHANGES_API_PATH, {
54
+ method: 'GET',
55
+ headers: {
56
+ 'content-type': 'application/json'
57
+ }
58
+ });
59
+ const changes = await response.json();
60
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
+ args[_key] = arguments[_key];
62
+ }
63
+ return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
64
+ res.changes.changes = Object.values(changes);
65
+ return res;
66
+ });
67
+ }
68
+
69
+ /**
70
+ * Configures and enables the FakeLrepConnector based on the SAP UI5 version.
71
+ * If the minor version of the SAP UI5 is less than 72, this function extends
72
+ * the FakeLrepConnector's prototype with specific methods and enables the fake connector.
73
+ *
74
+ * Assumes the existence of a global 'sap' object with a 'ui.version' property,
75
+ * and global jQuery object with 'extend' method.
76
+ *
77
+ * @returns {void}
78
+ */
79
+ var __exports = function () {
80
+ jQuery.extend(FakeLrepConnector.prototype, {
81
+ create,
82
+ loadChanges,
83
+ loadSettings: () => Promise.resolve()
84
+ });
85
+ FakeLrepConnector.enableFakeConnector();
86
+ };
87
+ __exports.create = create;
88
+ __exports.loadChanges = loadChanges;
89
+ return __exports;
90
90
  });
91
91
  //# sourceMappingURL=enableFakeConnector.js.map