@sap-ux/preview-middleware 0.13.37 → 0.13.38
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.
- package/dist/client/adp/init.js +27 -10
- package/dist/client/adp/init.ts +34 -10
- package/package.json +7 -7
package/dist/client/adp/init.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
sap.ui.define([
|
|
3
3
|
'sap/base/Log',
|
|
4
|
-
'sap/ui/core/ElementRegistry',
|
|
5
4
|
'../cpe/init',
|
|
6
5
|
'./init-dialogs',
|
|
7
6
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
8
7
|
'sap/ui/VersionInfo',
|
|
9
8
|
'./ui5-version-utils'
|
|
10
|
-
], function (log,
|
|
9
|
+
], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, VersionInfo, ___ui5_version_utils) {
|
|
11
10
|
'use strict';
|
|
12
11
|
function _interopRequireDefault(obj) {
|
|
13
12
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -52,7 +51,7 @@ sap.ui.define([
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
|
-
const syncViewsIds = getAllSyncViewsIds();
|
|
54
|
+
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
56
55
|
initDialogs(rta, syncViewsIds);
|
|
57
56
|
if (minor > 77) {
|
|
58
57
|
const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
|
|
@@ -76,16 +75,34 @@ sap.ui.define([
|
|
|
76
75
|
}
|
|
77
76
|
log.debug('ADP init executed.');
|
|
78
77
|
};
|
|
79
|
-
function getAllSyncViewsIds() {
|
|
80
|
-
const elements = UI5ElementRegistry.all();
|
|
78
|
+
async function getAllSyncViewsIds(minor) {
|
|
81
79
|
const syncViewIds = [];
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
try {
|
|
81
|
+
if (minor < 120) {
|
|
82
|
+
const Element = (await __ui5_require_async('sap/ui/core/Element')).default;
|
|
83
|
+
const elements = Element.registry.filter(() => true);
|
|
84
|
+
elements.forEach(ui5Element => {
|
|
85
|
+
if (isSyncView(ui5Element)) {
|
|
86
|
+
syncViewIds.push(ui5Element.getId());
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
|
|
91
|
+
const elements = ElementRegistry.all();
|
|
92
|
+
Object.entries(elements).forEach(_ref => {
|
|
93
|
+
let [key, ui5Element] = _ref;
|
|
94
|
+
if (isSyncView(ui5Element)) {
|
|
95
|
+
syncViewIds.push(key);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
86
98
|
}
|
|
87
|
-
})
|
|
99
|
+
} catch (error) {
|
|
100
|
+
log.error('Could not get application sync views', error);
|
|
101
|
+
}
|
|
88
102
|
return syncViewIds;
|
|
89
103
|
}
|
|
104
|
+
const isSyncView = element => {
|
|
105
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
106
|
+
};
|
|
90
107
|
return __exports;
|
|
91
108
|
});
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import log from 'sap/base/Log';
|
|
2
2
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
3
|
-
import UI5ElementRegistry from 'sap/ui/core/ElementRegistry';
|
|
4
|
-
|
|
5
3
|
import init from '../cpe/init';
|
|
6
4
|
import { initDialogs } from './init-dialogs';
|
|
7
5
|
import {
|
|
@@ -46,7 +44,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
46
44
|
}
|
|
47
45
|
);
|
|
48
46
|
|
|
49
|
-
const syncViewsIds = getAllSyncViewsIds();
|
|
47
|
+
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
50
48
|
initDialogs(rta, syncViewsIds);
|
|
51
49
|
|
|
52
50
|
if (minor > 77) {
|
|
@@ -77,19 +75,45 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
/**
|
|
80
|
-
*
|
|
81
78
|
* Get Ids for all sync views
|
|
79
|
+
*
|
|
80
|
+
* @param minor UI5 Version
|
|
82
81
|
*
|
|
83
82
|
* @returns array of Ids for application sync views
|
|
84
83
|
*/
|
|
85
|
-
function getAllSyncViewsIds(): string[] {
|
|
86
|
-
const elements = UI5ElementRegistry.all() as Record<string, UI5Element>;
|
|
84
|
+
async function getAllSyncViewsIds(minor: number): Promise<string[]> {
|
|
87
85
|
const syncViewIds: string[] = [];
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
86
|
+
try {
|
|
87
|
+
if (minor < 120) {
|
|
88
|
+
const Element = (await import('sap/ui/core/Element')).default;
|
|
89
|
+
const elements = Element.registry.filter(() => true) as UI5Element[];
|
|
90
|
+
elements.forEach((ui5Element) => {
|
|
91
|
+
if (isSyncView(ui5Element)) {
|
|
92
|
+
syncViewIds.push(ui5Element.getId());
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
const ElementRegistry = (await import('sap/ui/core/ElementRegistry')).default;
|
|
97
|
+
const elements = ElementRegistry.all() as Record<string, UI5Element>;
|
|
98
|
+
Object.entries(elements).forEach(([key, ui5Element]) => {
|
|
99
|
+
if (isSyncView(ui5Element)) {
|
|
100
|
+
syncViewIds.push(key);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
91
103
|
}
|
|
92
|
-
})
|
|
104
|
+
} catch (error) {
|
|
105
|
+
log.error('Could not get application sync views', error);
|
|
106
|
+
}
|
|
93
107
|
|
|
94
108
|
return syncViewIds;
|
|
95
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Check if element is sync view
|
|
113
|
+
*
|
|
114
|
+
* @param element UI5Element
|
|
115
|
+
* @returns boolean if element is sync view or not
|
|
116
|
+
*/
|
|
117
|
+
const isSyncView = (element: UI5Element): boolean => {
|
|
118
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
119
|
+
};
|
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.13.
|
|
12
|
+
"version": "0.13.38",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"ejs": "3.1.10",
|
|
26
26
|
"mem-fs": "2.1.0",
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
|
-
"@sap-ux/btp-utils": "0.14.4",
|
|
29
|
-
"@sap-ux/adp-tooling": "0.10.5",
|
|
30
28
|
"@sap-ux/logger": "0.5.1",
|
|
29
|
+
"@sap-ux/adp-tooling": "0.10.5",
|
|
31
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.20",
|
|
32
|
-
"@sap-ux/project-access": "1.20.0"
|
|
31
|
+
"@sap-ux/project-access": "1.20.0",
|
|
32
|
+
"@sap-ux/btp-utils": "0.14.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/ejs": "3.1.2",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"supertest": "6.3.3",
|
|
46
46
|
"@sap-ux-private/playwright": "0.0.3",
|
|
47
47
|
"dotenv": "16.3.1",
|
|
48
|
-
"@
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.10",
|
|
48
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.11",
|
|
50
49
|
"@sap-ux/axios-extension": "1.12.3",
|
|
51
|
-
"@sap-ux/store": "0.5.0"
|
|
50
|
+
"@sap-ux/store": "0.5.0",
|
|
51
|
+
"@sap-ux/i18n": "0.0.6"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"express": "4"
|