@sap-ux/preview-middleware 0.7.3 → 0.7.4

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 (33) hide show
  1. package/dist/client/adp/api-handler.js +33 -0
  2. package/dist/client/adp/api-handler.ts +36 -0
  3. package/dist/client/adp/controllers/AddFragment.controller.js +6 -11
  4. package/dist/client/adp/controllers/AddFragment.controller.ts +3 -45
  5. package/dist/client/adp/controllers/BaseDialog.controller.js +17 -0
  6. package/dist/client/adp/controllers/BaseDialog.controller.ts +51 -0
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +114 -0
  8. package/dist/client/adp/controllers/ControllerExtension.controller.ts +172 -0
  9. package/dist/client/adp/init-dialogs.js +10 -2
  10. package/dist/client/adp/init-dialogs.ts +15 -2
  11. package/dist/client/adp/init.ts +1 -0
  12. package/dist/client/adp/ui/AddFragment.view.xml +1 -1
  13. package/dist/client/adp/ui/ControllerExtension.view.xml +38 -0
  14. package/dist/client/cpe/changes/service.js +2 -3
  15. package/dist/client/cpe/changes/service.ts +2 -3
  16. package/dist/client/cpe/control-data.js +0 -1
  17. package/dist/client/cpe/control-data.ts +0 -1
  18. package/dist/client/cpe/init.js +8 -9
  19. package/dist/client/cpe/init.ts +5 -7
  20. package/dist/client/cpe/outline/index.js +2 -2
  21. package/dist/client/cpe/outline/index.ts +2 -8
  22. package/dist/client/cpe/outline/nodes.js +6 -7
  23. package/dist/client/cpe/outline/nodes.ts +6 -8
  24. package/dist/client/cpe/outline/utils.js +6 -5
  25. package/dist/client/cpe/outline/utils.ts +4 -4
  26. package/dist/client/cpe/selection.js +12 -9
  27. package/dist/client/cpe/selection.ts +10 -7
  28. package/dist/client/cpe/types.ts +1 -12
  29. package/dist/client/cpe/ui5-utils.js +51 -0
  30. package/dist/client/cpe/ui5-utils.ts +45 -0
  31. package/package.json +3 -3
  32. package/dist/client/cpe/facade.js +0 -95
  33. package/dist/client/cpe/facade.ts +0 -95
@@ -0,0 +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;
50
+ });
51
+ //# sourceMappingURL=ui5-utils.js.map
@@ -0,0 +1,45 @@
1
+ import type { IconDetails } from '@sap-ux-private/control-property-editor-common';
2
+ import Component from 'sap/ui/core/Component';
3
+ import type { ID } from 'sap/ui/core/library';
4
+ import IconPool from 'sap/ui/core/IconPool';
5
+
6
+ /**
7
+ * Gets Component by id.
8
+ *
9
+ * @param id - unique identifier for control
10
+ * @returns Component | undefined
11
+ */
12
+ export function getComponent<T extends Component>(id: ID): T | undefined {
13
+ if (Component?.get) {
14
+ return Component.get(id) as T;
15
+ } else {
16
+ // Older version must be still supported until maintenance period.
17
+ return sap.ui.getCore().getComponent(id) as T; // NOSONAR
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Get ui5 icons.
23
+ *
24
+ * @returns IconDetails[]
25
+ */
26
+ export function getIcons(): IconDetails[] {
27
+ return IconPool.getIconNames('undefined')
28
+ .map((icon: string) => {
29
+ const iconInfo = IconPool.getIconInfo(icon) as IconDetails;
30
+ return {
31
+ name: icon.toLowerCase(),
32
+ content: iconInfo.content,
33
+ fontFamily: iconInfo.fontFamily
34
+ } as IconDetails;
35
+ })
36
+ .sort((item1: IconDetails, item2: IconDetails) => {
37
+ if (item1.name < item2.name) {
38
+ return -1;
39
+ }
40
+ if (item1.name > item2.name) {
41
+ return 1;
42
+ }
43
+ return 0;
44
+ });
45
+ }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.7.3",
12
+ "version": "0.7.4",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "ejs": "3.1.9",
26
26
  "@sap-ux/logger": "0.3.8",
27
- "@sap-ux/adp-tooling": "0.3.4",
27
+ "@sap-ux/adp-tooling": "0.4.0",
28
28
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.2.2"
29
29
  },
30
30
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "npm-run-all": "4.1.5",
37
37
  "nock": "13.2.1",
38
38
  "supertest": "6.3.3",
39
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.3.0",
39
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.4.0",
40
40
  "@sap-ux/project-access": "1.13.6",
41
41
  "@sap-ux/store": "0.3.14"
42
42
  },
@@ -1,95 +0,0 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/Component", "sap/ui/dt/OverlayRegistry", "sap/ui/dt/OverlayUtil", "sap/ui/core/IconPool"], function (Component, OverlayRegistry, OverlayUtil, IconPool) {
4
- "use strict";
5
-
6
- /**
7
- * Gets control by id.
8
- *
9
- * @param id unique identifier for control
10
- * @returns Element | undefined
11
- */
12
- function getControlById(id) {
13
- return sap.ui.getCore().byId(id);
14
- }
15
-
16
- /**
17
- * Gets Component by id.
18
- *
19
- * @param id - unique identifier for control
20
- * @returns Component | undefined
21
- */
22
- function getComponent(id) {
23
- if (Component?.get) {
24
- return Component.get(id);
25
- } else {
26
- // Older version must be still supported until maintenance period.
27
- return sap.ui.getCore().getComponent(id); // NOSONAR
28
- }
29
- }
30
-
31
- /**
32
- * Gets overlay for control.
33
- *
34
- * @param control ui5 control
35
- * @returns ElementOverlay | undefined
36
- */
37
- function getOverlay(control) {
38
- return OverlayRegistry.getOverlay(control);
39
- }
40
-
41
- /**
42
- * Gets ClosestOverlay for control.
43
- *
44
- * @param control ui5 control
45
- * @returns ElementOverlay | undefined
46
- */
47
- function getClosestOverlayFor(control) {
48
- return OverlayUtil.getClosestOverlayFor(control);
49
- }
50
-
51
- /**
52
- * Get ui5 icons.
53
- *
54
- * @returns IconDetails[]
55
- */
56
- function getIcons() {
57
- return IconPool.getIconNames('undefined').map(icon => {
58
- const iconInfo = IconPool.getIconInfo(icon);
59
- return {
60
- name: icon.toLowerCase(),
61
- content: iconInfo.content,
62
- fontFamily: iconInfo.fontFamily
63
- };
64
- }).sort((item1, item2) => {
65
- if (item1.name < item2.name) {
66
- return -1;
67
- }
68
- if (item1.name > item2.name) {
69
- return 1;
70
- }
71
- return 0;
72
- });
73
- }
74
-
75
- /**
76
- * A facade for UI5 framework methods.
77
- *
78
- * @returns UI5Facade
79
- */
80
- function createUi5Facade() {
81
- return {
82
- getControlById,
83
- getIcons,
84
- getComponent,
85
- getOverlay,
86
- getClosestOverlayFor
87
- };
88
- }
89
- var __exports = {
90
- __esModule: true
91
- };
92
- __exports.createUi5Facade = createUi5Facade;
93
- return __exports;
94
- });
95
- //# sourceMappingURL=facade.js.map
@@ -1,95 +0,0 @@
1
- import type { IconDetails } from '@sap-ux-private/control-property-editor-common';
2
- import type { UI5Facade } from './types';
3
- import Component from 'sap/ui/core/Component';
4
- import type Element from 'sap/ui/core/Element';
5
- import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
6
- import type { ID } from 'sap/ui/core/library';
7
- import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
8
- import OverlayUtil from 'sap/ui/dt/OverlayUtil';
9
- import IconPool from 'sap/ui/core/IconPool';
10
-
11
- /**
12
- * Gets control by id.
13
- *
14
- * @param id unique identifier for control
15
- * @returns Element | undefined
16
- */
17
- function getControlById<T extends Element>(id: ID): T | undefined {
18
- return sap.ui.getCore().byId(id) as T;
19
- }
20
-
21
- /**
22
- * Gets Component by id.
23
- *
24
- * @param id - unique identifier for control
25
- * @returns Component | undefined
26
- */
27
- function getComponent<T extends Component>(id: ID): T | undefined {
28
- if (Component?.get) {
29
- return Component.get(id) as T;
30
- } else {
31
- // Older version must be still supported until maintenance period.
32
- return sap.ui.getCore().getComponent(id) as T; // NOSONAR
33
- }
34
- }
35
-
36
- /**
37
- * Gets overlay for control.
38
- *
39
- * @param control ui5 control
40
- * @returns ElementOverlay | undefined
41
- */
42
- function getOverlay<T extends ElementOverlay>(control: Element): T | undefined {
43
- return OverlayRegistry.getOverlay(control) as T;
44
- }
45
-
46
- /**
47
- * Gets ClosestOverlay for control.
48
- *
49
- * @param control ui5 control
50
- * @returns ElementOverlay | undefined
51
- */
52
- function getClosestOverlayFor<T extends ElementOverlay>(control: Element): T | undefined {
53
- return OverlayUtil.getClosestOverlayFor(control) as T;
54
- }
55
-
56
- /**
57
- * Get ui5 icons.
58
- *
59
- * @returns IconDetails[]
60
- */
61
- function getIcons(): IconDetails[] {
62
- return IconPool.getIconNames('undefined')
63
- .map((icon: string) => {
64
- const iconInfo = IconPool.getIconInfo(icon) as IconDetails;
65
- return {
66
- name: icon.toLowerCase(),
67
- content: iconInfo.content,
68
- fontFamily: iconInfo.fontFamily
69
- } as IconDetails;
70
- })
71
- .sort((item1: IconDetails, item2: IconDetails) => {
72
- if (item1.name < item2.name) {
73
- return -1;
74
- }
75
- if (item1.name > item2.name) {
76
- return 1;
77
- }
78
- return 0;
79
- });
80
- }
81
-
82
- /**
83
- * A facade for UI5 framework methods.
84
- *
85
- * @returns UI5Facade
86
- */
87
- export function createUi5Facade(): UI5Facade {
88
- return {
89
- getControlById,
90
- getIcons,
91
- getComponent,
92
- getOverlay,
93
- getClosestOverlayFor
94
- };
95
- }