@sap-ux/preview-middleware 0.13.18 → 0.13.19

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 (35) hide show
  1. package/dist/base/flex.d.ts +5 -15
  2. package/dist/base/flex.js +4 -32
  3. package/dist/base/flp.d.ts +12 -2
  4. package/dist/base/flp.js +27 -5
  5. package/dist/client/adp/api-handler.js +141 -141
  6. package/dist/client/adp/command-executor.js +54 -54
  7. package/dist/client/adp/control-utils.js +44 -44
  8. package/dist/client/adp/controllers/AddFragment.controller.js +185 -206
  9. package/dist/client/adp/controllers/AddFragment.controller.ts +5 -24
  10. package/dist/client/adp/controllers/BaseDialog.controller.js +74 -57
  11. package/dist/client/adp/controllers/BaseDialog.controller.ts +36 -2
  12. package/dist/client/adp/controllers/ControllerExtension.controller.js +179 -179
  13. package/dist/client/adp/controllers/ExtensionPoint.controller.js +90 -100
  14. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +9 -22
  15. package/dist/client/adp/init-dialogs.js +74 -74
  16. package/dist/client/adp/ui5-version-utils.js +63 -63
  17. package/dist/client/adp/utils.js +61 -33
  18. package/dist/client/adp/utils.ts +34 -0
  19. package/dist/client/cpe/changes/flex-change.js +51 -51
  20. package/dist/client/cpe/changes/index.js +10 -10
  21. package/dist/client/cpe/changes/validator.js +35 -35
  22. package/dist/client/cpe/documentation.js +164 -164
  23. package/dist/client/cpe/logger.js +30 -30
  24. package/dist/client/cpe/outline/nodes.js +84 -84
  25. package/dist/client/cpe/outline/utils.js +37 -37
  26. package/dist/client/cpe/types.js +4 -4
  27. package/dist/client/cpe/ui5-utils.js +49 -49
  28. package/dist/client/cpe/utils.js +48 -48
  29. package/dist/client/flp/WorkspaceConnector.js +84 -84
  30. package/dist/client/flp/common.js +28 -28
  31. package/dist/client/flp/enableFakeConnector.js +77 -77
  32. package/dist/client/flp/init.js +220 -220
  33. package/dist/client/flp/initConnectors.js +33 -33
  34. package/dist/client/flp/initRta.js +178 -178
  35. package/package.json +7 -3
@@ -1,86 +1,86 @@
1
- "use strict";
2
-
3
- sap.ui.define(["./utils"], function (___utils) {
4
- "use strict";
5
-
6
- const isEditable = ___utils["isEditable"];
7
- /**
8
- * Retrieves additional data for a given control ID.
9
- *
10
- * @param id The control ID for which to retrieve additional data
11
- * @returns An object containing additional data, including an optional 'text' property
12
- */
13
- function getAdditionalData(id) {
14
- const control = sap.ui.getCore().byId(id);
15
- if (control?.getMetadata().getProperty('text')) {
16
- const text = control.getProperty('text');
17
- if (typeof text === 'string' && text.trim() !== '') {
18
- return {
19
- text
20
- };
21
- }
22
- }
23
- return {};
24
- }
25
-
26
- /**
27
- * Gets the children nodes of an aggregation type node.
28
- *
29
- * @param current The current node to retrieve children from
30
- * @returns An array of children nodes, or an empty array if none are found
31
- */
32
- function getChildren(current) {
33
- return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
34
- }
35
-
36
- /**
37
- * Transform node.
38
- *
39
- * @param input outline view node
40
- * @param scenario type of project
41
- * @returns Promise<OutlineNode[]>
42
- */
43
- async function transformNodes(input, scenario) {
44
- const stack = [...input];
45
- const items = [];
46
- while (stack.length) {
47
- const current = stack.shift();
48
- const editable = isEditable(current?.id);
49
- if (current?.type === 'element') {
50
- const children = getChildren(current);
51
- const {
52
- text
53
- } = getAdditionalData(current.id);
54
- const technicalName = current.technicalName.split('.').slice(-1)[0];
55
- const node = {
56
- controlId: current.id,
57
- controlType: current.technicalName,
58
- name: text ?? technicalName,
59
- editable,
60
- visible: current.visible ?? true,
61
- children: await transformNodes(children, scenario)
62
- };
63
- items.push(node);
64
- }
65
- if (scenario === 'ADAPTATION_PROJECT' && current?.type === 'extensionPoint') {
66
- const node = {
67
- controlId: current.id,
68
- controlType: current.technicalName,
69
- name: current.name,
70
- editable,
71
- visible: current.visible ?? true,
72
- children: [],
73
- icon: current.icon
74
- };
75
- items.push(node);
76
- }
77
- }
78
- return items;
79
- }
80
- var __exports = {
81
- __esModule: true
82
- };
83
- __exports.transformNodes = transformNodes;
84
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["./utils"], function (___utils) {
4
+ "use strict";
5
+
6
+ const isEditable = ___utils["isEditable"];
7
+ /**
8
+ * Retrieves additional data for a given control ID.
9
+ *
10
+ * @param id The control ID for which to retrieve additional data
11
+ * @returns An object containing additional data, including an optional 'text' property
12
+ */
13
+ function getAdditionalData(id) {
14
+ const control = sap.ui.getCore().byId(id);
15
+ if (control?.getMetadata().getProperty('text')) {
16
+ const text = control.getProperty('text');
17
+ if (typeof text === 'string' && text.trim() !== '') {
18
+ return {
19
+ text
20
+ };
21
+ }
22
+ }
23
+ return {};
24
+ }
25
+
26
+ /**
27
+ * Gets the children nodes of an aggregation type node.
28
+ *
29
+ * @param current The current node to retrieve children from
30
+ * @returns An array of children nodes, or an empty array if none are found
31
+ */
32
+ function getChildren(current) {
33
+ return (current.elements ?? []).flatMap(element => element.type === 'aggregation' ? element.elements ?? [] : []);
34
+ }
35
+
36
+ /**
37
+ * Transform node.
38
+ *
39
+ * @param input outline view node
40
+ * @param scenario type of project
41
+ * @returns Promise<OutlineNode[]>
42
+ */
43
+ async function transformNodes(input, scenario) {
44
+ const stack = [...input];
45
+ const items = [];
46
+ while (stack.length) {
47
+ const current = stack.shift();
48
+ const editable = isEditable(current?.id);
49
+ if (current?.type === 'element') {
50
+ const children = getChildren(current);
51
+ const {
52
+ text
53
+ } = getAdditionalData(current.id);
54
+ const technicalName = current.technicalName.split('.').slice(-1)[0];
55
+ const node = {
56
+ controlId: current.id,
57
+ controlType: current.technicalName,
58
+ name: text ?? technicalName,
59
+ editable,
60
+ visible: current.visible ?? true,
61
+ children: await transformNodes(children, scenario)
62
+ };
63
+ items.push(node);
64
+ }
65
+ if (scenario === 'ADAPTATION_PROJECT' && current?.type === 'extensionPoint') {
66
+ const node = {
67
+ controlId: current.id,
68
+ controlType: current.technicalName,
69
+ name: current.name,
70
+ editable,
71
+ visible: current.visible ?? true,
72
+ children: [],
73
+ icon: current.icon
74
+ };
75
+ items.push(node);
76
+ }
77
+ }
78
+ return items;
79
+ }
80
+ var __exports = {
81
+ __esModule: true
82
+ };
83
+ __exports.transformNodes = transformNodes;
84
+ return __exports;
85
85
  });
86
86
  //# sourceMappingURL=nodes.js.map
@@ -1,39 +1,39 @@
1
- "use strict";
2
-
3
- sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils) {
4
- "use strict";
5
-
6
- const buildControlData = ___control_data["buildControlData"];
7
- const getRuntimeControl = ___utils["getRuntimeControl"];
8
- const getComponent = ___ui5_utils["getComponent"];
9
- const isEditable = function () {
10
- let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11
- let editable = false;
12
- const control = sap.ui.getCore().byId(id);
13
- if (!control) {
14
- const component = getComponent(id);
15
- if (component) {
16
- return editable;
17
- }
18
- } else {
19
- let controlOverlay = OverlayRegistry.getOverlay(control);
20
- if (!controlOverlay?.getDomRef()) {
21
- //look for closest control
22
- controlOverlay = OverlayUtil.getClosestOverlayFor(control);
23
- }
24
- if (controlOverlay) {
25
- const runtimeControl = getRuntimeControl(controlOverlay);
26
- const controlData = buildControlData(runtimeControl, controlOverlay);
27
- const prop = controlData.properties.find(item => item.isEnabled === true);
28
- editable = prop !== undefined;
29
- }
30
- }
31
- return editable;
32
- };
33
- var __exports = {
34
- __esModule: true
35
- };
36
- __exports.isEditable = isEditable;
37
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["../control-data", "../utils", "sap/ui/dt/OverlayUtil", "sap/ui/dt/OverlayRegistry", "../ui5-utils"], function (___control_data, ___utils, OverlayUtil, OverlayRegistry, ___ui5_utils) {
4
+ "use strict";
5
+
6
+ const buildControlData = ___control_data["buildControlData"];
7
+ const getRuntimeControl = ___utils["getRuntimeControl"];
8
+ const getComponent = ___ui5_utils["getComponent"];
9
+ const isEditable = function () {
10
+ let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11
+ let editable = false;
12
+ const control = sap.ui.getCore().byId(id);
13
+ if (!control) {
14
+ const component = getComponent(id);
15
+ if (component) {
16
+ return editable;
17
+ }
18
+ } else {
19
+ let controlOverlay = OverlayRegistry.getOverlay(control);
20
+ if (!controlOverlay?.getDomRef()) {
21
+ //look for closest control
22
+ controlOverlay = OverlayUtil.getClosestOverlayFor(control);
23
+ }
24
+ if (controlOverlay) {
25
+ const runtimeControl = getRuntimeControl(controlOverlay);
26
+ const controlData = buildControlData(runtimeControl, controlOverlay);
27
+ const prop = controlData.properties.find(item => item.isEnabled === true);
28
+ editable = prop !== undefined;
29
+ }
30
+ }
31
+ return editable;
32
+ };
33
+ var __exports = {
34
+ __esModule: true
35
+ };
36
+ __exports.isEditable = isEditable;
37
+ return __exports;
38
38
  });
39
39
  //# sourceMappingURL=utils.js.map
@@ -1,6 +1,6 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
5
  });
6
6
  //# sourceMappingURL=types.js.map
@@ -1,51 +1,51 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
4
- "use strict";
5
-
6
- /**
7
- * Gets Component by id.
8
- *
9
- * @param id - unique identifier for control
10
- * @returns Component | undefined
11
- */
12
- function getComponent(id) {
13
- if (Component?.get) {
14
- return Component.get(id);
15
- } else {
16
- // Older version must be still supported until maintenance period.
17
- return sap.ui.getCore().getComponent(id); // NOSONAR
18
- }
19
- }
20
-
21
- /**
22
- * Get ui5 icons.
23
- *
24
- * @returns IconDetails[]
25
- */
26
- function getIcons() {
27
- return IconPool.getIconNames('undefined').map(icon => {
28
- const iconInfo = IconPool.getIconInfo(icon);
29
- return {
30
- name: icon.toLowerCase(),
31
- content: iconInfo.content,
32
- fontFamily: iconInfo.fontFamily
33
- };
34
- }).sort((item1, item2) => {
35
- if (item1.name < item2.name) {
36
- return -1;
37
- }
38
- if (item1.name > item2.name) {
39
- return 1;
40
- }
41
- return 0;
42
- });
43
- }
44
- var __exports = {
45
- __esModule: true
46
- };
47
- __exports.getComponent = getComponent;
48
- __exports.getIcons = getIcons;
49
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Component", "sap/ui/core/IconPool"], function (Component, IconPool) {
4
+ "use strict";
5
+
6
+ /**
7
+ * Gets Component by id.
8
+ *
9
+ * @param id - unique identifier for control
10
+ * @returns Component | undefined
11
+ */
12
+ function getComponent(id) {
13
+ if (Component?.get) {
14
+ return Component.get(id);
15
+ } else {
16
+ // Older version must be still supported until maintenance period.
17
+ return sap.ui.getCore().getComponent(id); // NOSONAR
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Get ui5 icons.
23
+ *
24
+ * @returns IconDetails[]
25
+ */
26
+ function getIcons() {
27
+ return IconPool.getIconNames('undefined').map(icon => {
28
+ const iconInfo = IconPool.getIconInfo(icon);
29
+ return {
30
+ name: icon.toLowerCase(),
31
+ content: iconInfo.content,
32
+ fontFamily: iconInfo.fontFamily
33
+ };
34
+ }).sort((item1, item2) => {
35
+ if (item1.name < item2.name) {
36
+ return -1;
37
+ }
38
+ if (item1.name > item2.name) {
39
+ return 1;
40
+ }
41
+ return 0;
42
+ });
43
+ }
44
+ var __exports = {
45
+ __esModule: true
46
+ };
47
+ __exports.getComponent = getComponent;
48
+ __exports.getIcons = getIcons;
49
+ return __exports;
50
50
  });
51
51
  //# sourceMappingURL=ui5-utils.js.map
@@ -1,50 +1,50 @@
1
- "use strict";
2
-
3
- sap.ui.define([], function () {
4
- "use strict";
5
-
6
- /**
7
- * Get runtime control.
8
- *
9
- * @param overlayControl - element overlay.
10
- * @returns ManagedObject
11
- */
12
- function getRuntimeControl(overlayControl) {
13
- let runtimeControl;
14
- if (overlayControl.getElementInstance) {
15
- runtimeControl = overlayControl.getElementInstance();
16
- } else {
17
- runtimeControl = overlayControl.getElement();
18
- }
19
- return runtimeControl;
20
- }
21
-
22
- /**
23
- * Get library of a control name.
24
- *
25
- * @param controlName - name of the ui5 control eg: sap.m.Button.
26
- * @returns Promise<string>
27
- */
28
- async function getLibrary(controlName) {
29
- return new Promise(resolve => {
30
- const controlPath = controlName.replace(/\./g, '/');
31
- sap.ui.require([controlPath], control => {
32
- const contMetadata = control.getMetadata();
33
- // getLibraryName method does not exist on events
34
- if (contMetadata?.getLibraryName) {
35
- const contLibName = contMetadata.getLibraryName();
36
- resolve(contLibName);
37
- } else {
38
- resolve(''); // return empty for events
39
- }
40
- });
41
- });
42
- }
43
- var __exports = {
44
- __esModule: true
45
- };
46
- __exports.getRuntimeControl = getRuntimeControl;
47
- __exports.getLibrary = getLibrary;
48
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Get runtime control.
8
+ *
9
+ * @param overlayControl - element overlay.
10
+ * @returns ManagedObject
11
+ */
12
+ function getRuntimeControl(overlayControl) {
13
+ let runtimeControl;
14
+ if (overlayControl.getElementInstance) {
15
+ runtimeControl = overlayControl.getElementInstance();
16
+ } else {
17
+ runtimeControl = overlayControl.getElement();
18
+ }
19
+ return runtimeControl;
20
+ }
21
+
22
+ /**
23
+ * Get library of a control name.
24
+ *
25
+ * @param controlName - name of the ui5 control eg: sap.m.Button.
26
+ * @returns Promise<string>
27
+ */
28
+ async function getLibrary(controlName) {
29
+ return new Promise(resolve => {
30
+ const controlPath = controlName.replace(/\./g, '/');
31
+ sap.ui.require([controlPath], control => {
32
+ const contMetadata = control.getMetadata();
33
+ // getLibraryName method does not exist on events
34
+ if (contMetadata?.getLibraryName) {
35
+ const contLibName = contMetadata.getLibraryName();
36
+ resolve(contLibName);
37
+ } else {
38
+ resolve(''); // return empty for events
39
+ }
40
+ });
41
+ });
42
+ }
43
+ var __exports = {
44
+ __esModule: true
45
+ };
46
+ __exports.getRuntimeControl = getRuntimeControl;
47
+ __exports.getLibrary = getLibrary;
48
+ return __exports;
49
49
  });
50
50
  //# sourceMappingURL=utils.js.map
@@ -1,86 +1,86 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStorageConnector", "sap/ui/fl/Layer", "sap/ui/VersionInfo", "./common"], function (merge, ObjectStorageConnector, Layer, VersionInfo, ___common) {
4
- "use strict";
5
-
6
- const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
7
- const getFlexSettings = ___common["getFlexSettings"];
8
- const connector = merge({}, ObjectStorageConnector, {
9
- layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
10
- storage: {
11
- _itemsStoredAsObjects: true,
12
- fileChangeRequestNotifier: undefined,
13
- setItem: function (_key, change) {
14
- const settings = getFlexSettings();
15
- if (settings) {
16
- change.support ??= {};
17
- change.support.generator = settings.generator;
18
- }
19
- if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
20
- try {
21
- this.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
22
- } catch (e) {
23
- // exceptions in the listener call are ignored
24
- }
25
- }
26
- return fetch(CHANGES_API_PATH, {
27
- method: 'POST',
28
- body: JSON.stringify(change, null, 2),
29
- headers: {
30
- 'content-type': 'application/json'
31
- }
32
- });
33
- },
34
- removeItem: function (key) {
35
- if (typeof this.fileChangeRequestNotifier === 'function') {
36
- try {
37
- this.fileChangeRequestNotifier(key, 'delete');
38
- } catch (e) {
39
- // exceptions in the listener call are ignored
40
- }
41
- }
42
- return fetch(CHANGES_API_PATH, {
43
- method: 'DELETE',
44
- body: JSON.stringify({
45
- fileName: key
46
- }),
47
- headers: {
48
- 'content-type': 'application/json'
49
- }
50
- });
51
- },
52
- clear: function () {
53
- // not implemented
54
- },
55
- getItem: function (_key) {
56
- // not implemented
57
- },
58
- getItems: async function () {
59
- const response = await fetch(CHANGES_API_PATH, {
60
- method: 'GET',
61
- headers: {
62
- 'content-type': 'application/json'
63
- }
64
- });
65
- const changes = await response.json();
66
- return changes;
67
- }
68
- },
69
- loadFeatures: async function () {
70
- const features = await ObjectStorageConnector.loadFeatures();
71
- const ui5Version = await VersionInfo.load();
72
- const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
73
- features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
74
- const settings = getFlexSettings();
75
- if (settings?.developerMode) {
76
- features.isVariantAdaptationEnabled = false;
77
- }
78
- if (settings?.scenario === 'ADAPTATION_PROJECT') {
79
- features.isVariantAdaptationEnabled = true;
80
- }
81
- return features;
82
- }
83
- });
84
- 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", "sap/ui/VersionInfo", "./common"], function (merge, ObjectStorageConnector, Layer, VersionInfo, ___common) {
4
+ "use strict";
5
+
6
+ const CHANGES_API_PATH = ___common["CHANGES_API_PATH"];
7
+ const getFlexSettings = ___common["getFlexSettings"];
8
+ const connector = merge({}, ObjectStorageConnector, {
9
+ layers: [Layer.VENDOR, Layer.CUSTOMER_BASE],
10
+ storage: {
11
+ _itemsStoredAsObjects: true,
12
+ fileChangeRequestNotifier: undefined,
13
+ setItem: function (_key, change) {
14
+ const settings = getFlexSettings();
15
+ if (settings) {
16
+ change.support ??= {};
17
+ change.support.generator = settings.generator;
18
+ }
19
+ if (typeof this.fileChangeRequestNotifier === 'function' && change.fileName) {
20
+ try {
21
+ this.fileChangeRequestNotifier(change.fileName, 'create', change.changeType);
22
+ } catch (e) {
23
+ // exceptions in the listener call are ignored
24
+ }
25
+ }
26
+ return fetch(CHANGES_API_PATH, {
27
+ method: 'POST',
28
+ body: JSON.stringify(change, null, 2),
29
+ headers: {
30
+ 'content-type': 'application/json'
31
+ }
32
+ });
33
+ },
34
+ removeItem: function (key) {
35
+ if (typeof this.fileChangeRequestNotifier === 'function') {
36
+ try {
37
+ this.fileChangeRequestNotifier(key, 'delete');
38
+ } catch (e) {
39
+ // exceptions in the listener call are ignored
40
+ }
41
+ }
42
+ return fetch(CHANGES_API_PATH, {
43
+ method: 'DELETE',
44
+ body: JSON.stringify({
45
+ fileName: key
46
+ }),
47
+ headers: {
48
+ 'content-type': 'application/json'
49
+ }
50
+ });
51
+ },
52
+ clear: function () {
53
+ // not implemented
54
+ },
55
+ getItem: function (_key) {
56
+ // not implemented
57
+ },
58
+ getItems: async function () {
59
+ const response = await fetch(CHANGES_API_PATH, {
60
+ method: 'GET',
61
+ headers: {
62
+ 'content-type': 'application/json'
63
+ }
64
+ });
65
+ const changes = await response.json();
66
+ return changes;
67
+ }
68
+ },
69
+ loadFeatures: async function () {
70
+ const features = await ObjectStorageConnector.loadFeatures();
71
+ const ui5Version = await VersionInfo.load();
72
+ const [majorVersion, minorVersion] = ui5Version.version.split('.').map(v => parseInt(v, 10));
73
+ features.isVariantAdaptationEnabled = majorVersion >= 1 && minorVersion >= 90;
74
+ const settings = getFlexSettings();
75
+ if (settings?.developerMode) {
76
+ features.isVariantAdaptationEnabled = false;
77
+ }
78
+ if (settings?.scenario === 'ADAPTATION_PROJECT') {
79
+ features.isVariantAdaptationEnabled = true;
80
+ }
81
+ return features;
82
+ }
83
+ });
84
+ return connector;
85
85
  });
86
86
  //# sourceMappingURL=WorkspaceConnector.js.map