@sap-ux/preview-middleware 0.12.13 → 0.12.15
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/base/flp.js +6 -1
- package/dist/client/adp/api-handler.js +141 -141
- package/dist/client/adp/command-executor.js +54 -54
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +206 -206
- package/dist/client/adp/controllers/BaseDialog.controller.js +57 -57
- package/dist/client/adp/controllers/ControllerExtension.controller.js +174 -174
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +100 -100
- package/dist/client/adp/init-dialogs.js +74 -74
- package/dist/client/adp/ui5-version-utils.js +63 -63
- package/dist/client/adp/utils.js +33 -33
- package/dist/client/cpe/changes/flex-change.js +51 -51
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/service.js +11 -2
- package/dist/client/cpe/changes/service.ts +13 -4
- package/dist/client/cpe/changes/validator.js +35 -35
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/init.js +13 -2
- package/dist/client/cpe/init.ts +15 -1
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/nodes.js +84 -84
- package/dist/client/cpe/outline/utils.js +37 -37
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +49 -49
- package/dist/client/cpe/utils.js +48 -48
- package/dist/client/flp/WorkspaceConnector.js +84 -69
- package/dist/client/flp/WorkspaceConnector.ts +18 -1
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/common.ts +2 -0
- package/dist/client/flp/enableFakeConnector.js +77 -77
- package/dist/client/flp/init.js +220 -220
- package/dist/client/flp/initConnectors.js +33 -33
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +3 -1
- package/package.json +6 -6
- package/templates/flp/editor.html +2 -1
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["./utils", "sap/base/Log"], function (___utils, Log) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const getLibrary = ___utils["getLibrary"];
|
|
7
|
-
/**
|
|
8
|
-
* Get ui5 metadata of given library name.
|
|
9
|
-
*
|
|
10
|
-
* @param libName library name for eg: sap.m
|
|
11
|
-
* @returns Promise<SchemaForApiJsonFiles>
|
|
12
|
-
*/
|
|
13
|
-
async function getUi5ApiDtMetadata(libName) {
|
|
14
|
-
const libUrl = '/test-resources/' + libName.split('.').join('/') + '/designtime/api.json';
|
|
15
|
-
return fetch(libUrl).then(res => res.json());
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* load ui5 controls design time metadata api.json for following libraries
|
|
20
|
-
* sap.m, sap.ui.comp, sap.f, sap.ui.core
|
|
21
|
-
* loading libraries(more in file size) in parallel during initialization.
|
|
22
|
-
* Others (less in file size) are loaded dynamically in getControlMetadata method
|
|
23
|
-
*/
|
|
24
|
-
const ui5ApiDtMetadata = new Map();
|
|
25
|
-
function loadDefaultLibraries() {
|
|
26
|
-
const allData = Promise.all([getUi5ApiDtMetadata('sap.m'), getUi5ApiDtMetadata('sap.ui.comp'), getUi5ApiDtMetadata('sap.ui.core'), getUi5ApiDtMetadata('sap.f')]);
|
|
27
|
-
allData.then(res => {
|
|
28
|
-
res.forEach(api => {
|
|
29
|
-
if (api.library) {
|
|
30
|
-
ui5ApiDtMetadata.set(api.library, api);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}).catch(reason => Log.error('Loading Library Failed: ' + reason));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Format html text.
|
|
38
|
-
*
|
|
39
|
-
* @param sHtml - html string
|
|
40
|
-
* @returns string
|
|
41
|
-
*/
|
|
42
|
-
function formatHtmlText(sHtml) {
|
|
43
|
-
// replaced "sHtml.replace(new RegExp('<[^>]*>', 'g')" due to regex runtime vulnerability
|
|
44
|
-
const parts = (sHtml || '').split('<');
|
|
45
|
-
let result = '';
|
|
46
|
-
for (const part of parts) {
|
|
47
|
-
if (!result) {
|
|
48
|
-
result = part;
|
|
49
|
-
} else {
|
|
50
|
-
const indexClosingBracket = part.indexOf('>');
|
|
51
|
-
result += indexClosingBracket >= 0 ? part.substring(indexClosingBracket + 1) : `<${part}`;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Method to parse ui5 control metadata.
|
|
59
|
-
*
|
|
60
|
-
* @param controlLibMetadata control library metadata
|
|
61
|
-
* @param controlName name of the control
|
|
62
|
-
* @returns ControlMetadata
|
|
63
|
-
*/
|
|
64
|
-
function parseControlMetaModel(controlLibMetadata, controlName) {
|
|
65
|
-
const controlInfo = {
|
|
66
|
-
baseType: '',
|
|
67
|
-
doc: '',
|
|
68
|
-
properties: {}
|
|
69
|
-
};
|
|
70
|
-
const selectedControlMetadata = (controlLibMetadata.symbols ?? []).find(control => control.name === controlName);
|
|
71
|
-
if (selectedControlMetadata) {
|
|
72
|
-
// base type info of control is available on property 'extends'
|
|
73
|
-
controlInfo.baseType = selectedControlMetadata.extends;
|
|
74
|
-
controlInfo.doc = selectedControlMetadata.description ?? '';
|
|
75
|
-
const properties = selectedControlMetadata['ui5-metadata'].properties;
|
|
76
|
-
if (properties) {
|
|
77
|
-
properties.forEach(prop => {
|
|
78
|
-
prop.description = formatHtmlText(prop.description || '');
|
|
79
|
-
prop.propertyName = prop.name;
|
|
80
|
-
prop.propertyType = prop.type;
|
|
81
|
-
if (prop.defaultValue === null || prop.defaultValue === '') {
|
|
82
|
-
prop.defaultValue = '-';
|
|
83
|
-
}
|
|
84
|
-
controlInfo.properties[prop.name] = {
|
|
85
|
-
...prop
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return controlInfo;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get control metadata for a given control.
|
|
95
|
-
*
|
|
96
|
-
* @param controlName name of the control
|
|
97
|
-
* @param contLibName library name of the control
|
|
98
|
-
* @returns Promise<ControlMetadata | undefined>
|
|
99
|
-
*/
|
|
100
|
-
async function getControlMetadata(controlName, contLibName) {
|
|
101
|
-
let result;
|
|
102
|
-
let controlLibMetadata = ui5ApiDtMetadata.get(contLibName);
|
|
103
|
-
if (controlLibMetadata) {
|
|
104
|
-
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
105
|
-
} else {
|
|
106
|
-
controlLibMetadata = await getUi5ApiDtMetadata(contLibName);
|
|
107
|
-
ui5ApiDtMetadata.set(contLibName, controlLibMetadata);
|
|
108
|
-
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get Control Property Documentation for a give control name and control library.
|
|
115
|
-
*
|
|
116
|
-
* @param controlName name of the control
|
|
117
|
-
* @param contLibName library name of the control
|
|
118
|
-
* @returns Promise<Properties | undefined>
|
|
119
|
-
*/
|
|
120
|
-
async function getControlPropertyDocumentation(controlName, contLibName) {
|
|
121
|
-
const doc = await getControlMetadata(controlName, contLibName);
|
|
122
|
-
if (doc) {
|
|
123
|
-
const baseControlType = doc.baseType;
|
|
124
|
-
if (baseControlType) {
|
|
125
|
-
const baseContLibName = await getLibrary(baseControlType);
|
|
126
|
-
if (baseContLibName) {
|
|
127
|
-
const baseControlProps = await getControlPropertyDocumentation(baseControlType, baseContLibName);
|
|
128
|
-
return {
|
|
129
|
-
...baseControlProps,
|
|
130
|
-
...doc.properties
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
...doc.properties
|
|
136
|
-
};
|
|
137
|
-
} else {
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get documentation of a given control of a ui5 library.
|
|
144
|
-
*
|
|
145
|
-
* @param controlName name of the control.
|
|
146
|
-
* @param contLibName library name of the control
|
|
147
|
-
* @returns Promise<Properties | undefined>
|
|
148
|
-
*/
|
|
149
|
-
async function getDocumentation(controlName, contLibName) {
|
|
150
|
-
let doc;
|
|
151
|
-
try {
|
|
152
|
-
doc = await getControlPropertyDocumentation(controlName, contLibName);
|
|
153
|
-
} catch (err) {
|
|
154
|
-
Log.error(`Error in getting documentation for ${contLibName}`);
|
|
155
|
-
}
|
|
156
|
-
return doc;
|
|
157
|
-
}
|
|
158
|
-
var __exports = {
|
|
159
|
-
__esModule: true
|
|
160
|
-
};
|
|
161
|
-
__exports.getUi5ApiDtMetadata = getUi5ApiDtMetadata;
|
|
162
|
-
__exports.loadDefaultLibraries = loadDefaultLibraries;
|
|
163
|
-
__exports.getDocumentation = getDocumentation;
|
|
164
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./utils", "sap/base/Log"], function (___utils, Log) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getLibrary = ___utils["getLibrary"];
|
|
7
|
+
/**
|
|
8
|
+
* Get ui5 metadata of given library name.
|
|
9
|
+
*
|
|
10
|
+
* @param libName library name for eg: sap.m
|
|
11
|
+
* @returns Promise<SchemaForApiJsonFiles>
|
|
12
|
+
*/
|
|
13
|
+
async function getUi5ApiDtMetadata(libName) {
|
|
14
|
+
const libUrl = '/test-resources/' + libName.split('.').join('/') + '/designtime/api.json';
|
|
15
|
+
return fetch(libUrl).then(res => res.json());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* load ui5 controls design time metadata api.json for following libraries
|
|
20
|
+
* sap.m, sap.ui.comp, sap.f, sap.ui.core
|
|
21
|
+
* loading libraries(more in file size) in parallel during initialization.
|
|
22
|
+
* Others (less in file size) are loaded dynamically in getControlMetadata method
|
|
23
|
+
*/
|
|
24
|
+
const ui5ApiDtMetadata = new Map();
|
|
25
|
+
function loadDefaultLibraries() {
|
|
26
|
+
const allData = Promise.all([getUi5ApiDtMetadata('sap.m'), getUi5ApiDtMetadata('sap.ui.comp'), getUi5ApiDtMetadata('sap.ui.core'), getUi5ApiDtMetadata('sap.f')]);
|
|
27
|
+
allData.then(res => {
|
|
28
|
+
res.forEach(api => {
|
|
29
|
+
if (api.library) {
|
|
30
|
+
ui5ApiDtMetadata.set(api.library, api);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}).catch(reason => Log.error('Loading Library Failed: ' + reason));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Format html text.
|
|
38
|
+
*
|
|
39
|
+
* @param sHtml - html string
|
|
40
|
+
* @returns string
|
|
41
|
+
*/
|
|
42
|
+
function formatHtmlText(sHtml) {
|
|
43
|
+
// replaced "sHtml.replace(new RegExp('<[^>]*>', 'g')" due to regex runtime vulnerability
|
|
44
|
+
const parts = (sHtml || '').split('<');
|
|
45
|
+
let result = '';
|
|
46
|
+
for (const part of parts) {
|
|
47
|
+
if (!result) {
|
|
48
|
+
result = part;
|
|
49
|
+
} else {
|
|
50
|
+
const indexClosingBracket = part.indexOf('>');
|
|
51
|
+
result += indexClosingBracket >= 0 ? part.substring(indexClosingBracket + 1) : `<${part}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Method to parse ui5 control metadata.
|
|
59
|
+
*
|
|
60
|
+
* @param controlLibMetadata control library metadata
|
|
61
|
+
* @param controlName name of the control
|
|
62
|
+
* @returns ControlMetadata
|
|
63
|
+
*/
|
|
64
|
+
function parseControlMetaModel(controlLibMetadata, controlName) {
|
|
65
|
+
const controlInfo = {
|
|
66
|
+
baseType: '',
|
|
67
|
+
doc: '',
|
|
68
|
+
properties: {}
|
|
69
|
+
};
|
|
70
|
+
const selectedControlMetadata = (controlLibMetadata.symbols ?? []).find(control => control.name === controlName);
|
|
71
|
+
if (selectedControlMetadata) {
|
|
72
|
+
// base type info of control is available on property 'extends'
|
|
73
|
+
controlInfo.baseType = selectedControlMetadata.extends;
|
|
74
|
+
controlInfo.doc = selectedControlMetadata.description ?? '';
|
|
75
|
+
const properties = selectedControlMetadata['ui5-metadata'].properties;
|
|
76
|
+
if (properties) {
|
|
77
|
+
properties.forEach(prop => {
|
|
78
|
+
prop.description = formatHtmlText(prop.description || '');
|
|
79
|
+
prop.propertyName = prop.name;
|
|
80
|
+
prop.propertyType = prop.type;
|
|
81
|
+
if (prop.defaultValue === null || prop.defaultValue === '') {
|
|
82
|
+
prop.defaultValue = '-';
|
|
83
|
+
}
|
|
84
|
+
controlInfo.properties[prop.name] = {
|
|
85
|
+
...prop
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return controlInfo;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get control metadata for a given control.
|
|
95
|
+
*
|
|
96
|
+
* @param controlName name of the control
|
|
97
|
+
* @param contLibName library name of the control
|
|
98
|
+
* @returns Promise<ControlMetadata | undefined>
|
|
99
|
+
*/
|
|
100
|
+
async function getControlMetadata(controlName, contLibName) {
|
|
101
|
+
let result;
|
|
102
|
+
let controlLibMetadata = ui5ApiDtMetadata.get(contLibName);
|
|
103
|
+
if (controlLibMetadata) {
|
|
104
|
+
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
105
|
+
} else {
|
|
106
|
+
controlLibMetadata = await getUi5ApiDtMetadata(contLibName);
|
|
107
|
+
ui5ApiDtMetadata.set(contLibName, controlLibMetadata);
|
|
108
|
+
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Get Control Property Documentation for a give control name and control library.
|
|
115
|
+
*
|
|
116
|
+
* @param controlName name of the control
|
|
117
|
+
* @param contLibName library name of the control
|
|
118
|
+
* @returns Promise<Properties | undefined>
|
|
119
|
+
*/
|
|
120
|
+
async function getControlPropertyDocumentation(controlName, contLibName) {
|
|
121
|
+
const doc = await getControlMetadata(controlName, contLibName);
|
|
122
|
+
if (doc) {
|
|
123
|
+
const baseControlType = doc.baseType;
|
|
124
|
+
if (baseControlType) {
|
|
125
|
+
const baseContLibName = await getLibrary(baseControlType);
|
|
126
|
+
if (baseContLibName) {
|
|
127
|
+
const baseControlProps = await getControlPropertyDocumentation(baseControlType, baseContLibName);
|
|
128
|
+
return {
|
|
129
|
+
...baseControlProps,
|
|
130
|
+
...doc.properties
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
...doc.properties
|
|
136
|
+
};
|
|
137
|
+
} else {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get documentation of a given control of a ui5 library.
|
|
144
|
+
*
|
|
145
|
+
* @param controlName name of the control.
|
|
146
|
+
* @param contLibName library name of the control
|
|
147
|
+
* @returns Promise<Properties | undefined>
|
|
148
|
+
*/
|
|
149
|
+
async function getDocumentation(controlName, contLibName) {
|
|
150
|
+
let doc;
|
|
151
|
+
try {
|
|
152
|
+
doc = await getControlPropertyDocumentation(controlName, contLibName);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
Log.error(`Error in getting documentation for ${contLibName}`);
|
|
155
|
+
}
|
|
156
|
+
return doc;
|
|
157
|
+
}
|
|
158
|
+
var __exports = {
|
|
159
|
+
__esModule: true
|
|
160
|
+
};
|
|
161
|
+
__exports.getUi5ApiDtMetadata = getUi5ApiDtMetadata;
|
|
162
|
+
__exports.loadDefaultLibraries = loadDefaultLibraries;
|
|
163
|
+
__exports.getDocumentation = getDocumentation;
|
|
164
|
+
return __exports;
|
|
165
165
|
});
|
|
166
166
|
//# sourceMappingURL=documentation.js.map
|
package/dist/client/cpe/init.js
CHANGED
|
@@ -7,18 +7,24 @@ sap.ui.define([
|
|
|
7
7
|
'./documentation',
|
|
8
8
|
'sap/base/Log',
|
|
9
9
|
'./logger',
|
|
10
|
-
'./ui5-utils'
|
|
11
|
-
|
|
10
|
+
'./ui5-utils',
|
|
11
|
+
'../flp/WorkspaceConnector'
|
|
12
|
+
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils, __workspaceConnector) {
|
|
12
13
|
'use strict';
|
|
14
|
+
function _interopRequireDefault(obj) {
|
|
15
|
+
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
16
|
+
}
|
|
13
17
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
14
18
|
const iconsLoaded = ___sap_ux_private_control_property_editor_common['iconsLoaded'];
|
|
15
19
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
20
|
+
const storageFileChanged = ___sap_ux_private_control_property_editor_common['storageFileChanged'];
|
|
16
21
|
const initOutline = ___outline_index['initOutline'];
|
|
17
22
|
const SelectionService = ___selection['SelectionService'];
|
|
18
23
|
const ChangeService = ___changes_service['ChangeService'];
|
|
19
24
|
const loadDefaultLibraries = ___documentation['loadDefaultLibraries'];
|
|
20
25
|
const logger = ___logger['logger'];
|
|
21
26
|
const getIcons = ___ui5_utils['getIcons'];
|
|
27
|
+
const workspaceConnector = _interopRequireDefault(__workspaceConnector);
|
|
22
28
|
function init(rta) {
|
|
23
29
|
Log.info('Initializing Control Property Editor');
|
|
24
30
|
const flexSettings = rta.getFlexSettings();
|
|
@@ -51,6 +57,11 @@ sap.ui.define([
|
|
|
51
57
|
}
|
|
52
58
|
initOutline(rta, sendAction).catch(error => Log.error('Error during initialization of Control Property Editor', error));
|
|
53
59
|
const icons = getIcons();
|
|
60
|
+
workspaceConnector.storage.fileChangeRequestNotifier = (fileName, kind, changeType) => {
|
|
61
|
+
if (changeType && changeType !== 'appdescr_fe_changePageConfiguration' || kind === 'delete') {
|
|
62
|
+
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
54
65
|
sendAction(iconsLoaded(icons));
|
|
55
66
|
} catch (error) {
|
|
56
67
|
Log.error('Error during initialization of Control Property Editor', error);
|
package/dist/client/cpe/init.ts
CHANGED
|
@@ -2,7 +2,8 @@ import type { ExternalAction } from '@sap-ux-private/control-property-editor-com
|
|
|
2
2
|
import {
|
|
3
3
|
startPostMessageCommunication,
|
|
4
4
|
iconsLoaded,
|
|
5
|
-
enableTelemetry
|
|
5
|
+
enableTelemetry,
|
|
6
|
+
storageFileChanged
|
|
6
7
|
} from '@sap-ux-private/control-property-editor-common';
|
|
7
8
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
8
9
|
|
|
@@ -14,6 +15,7 @@ import { loadDefaultLibraries } from './documentation';
|
|
|
14
15
|
import Log from 'sap/base/Log';
|
|
15
16
|
import { logger } from './logger';
|
|
16
17
|
import { getIcons } from './ui5-utils';
|
|
18
|
+
import workspaceConnector from '../flp/WorkspaceConnector';
|
|
17
19
|
|
|
18
20
|
export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
19
21
|
Log.info('Initializing Control Property Editor');
|
|
@@ -62,6 +64,18 @@ export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
|
62
64
|
Log.error('Error during initialization of Control Property Editor', error)
|
|
63
65
|
);
|
|
64
66
|
const icons = getIcons();
|
|
67
|
+
|
|
68
|
+
// hook the file deletion listener to the UI5 workspace connector
|
|
69
|
+
workspaceConnector.storage.fileChangeRequestNotifier = (
|
|
70
|
+
fileName: string,
|
|
71
|
+
kind: 'delete' | 'create',
|
|
72
|
+
changeType?: string
|
|
73
|
+
) => {
|
|
74
|
+
if ((changeType && changeType !== 'appdescr_fe_changePageConfiguration') || kind === 'delete') {
|
|
75
|
+
sendAction(storageFileChanged(fileName?.replace('sap.ui.fl.', '')));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
65
79
|
sendAction(iconsLoaded(icons));
|
|
66
80
|
} catch (error) {
|
|
67
81
|
Log.error('Error during initialization of Control Property Editor', error);
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/base/Log"], function (Log) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function getString(message) {
|
|
7
|
-
if (typeof message === 'object') {
|
|
8
|
-
return message.toString();
|
|
9
|
-
}
|
|
10
|
-
return message;
|
|
11
|
-
}
|
|
12
|
-
const logger = {
|
|
13
|
-
info: message => {
|
|
14
|
-
Log.info(getString(message));
|
|
15
|
-
},
|
|
16
|
-
debug: message => {
|
|
17
|
-
Log.debug(getString(message));
|
|
18
|
-
},
|
|
19
|
-
warn: message => {
|
|
20
|
-
Log.warning(getString(message));
|
|
21
|
-
},
|
|
22
|
-
error: message => {
|
|
23
|
-
Log.error(getString(message));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var __exports = {
|
|
27
|
-
__esModule: true
|
|
28
|
-
};
|
|
29
|
-
__exports.logger = logger;
|
|
30
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/Log"], function (Log) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function getString(message) {
|
|
7
|
+
if (typeof message === 'object') {
|
|
8
|
+
return message.toString();
|
|
9
|
+
}
|
|
10
|
+
return message;
|
|
11
|
+
}
|
|
12
|
+
const logger = {
|
|
13
|
+
info: message => {
|
|
14
|
+
Log.info(getString(message));
|
|
15
|
+
},
|
|
16
|
+
debug: message => {
|
|
17
|
+
Log.debug(getString(message));
|
|
18
|
+
},
|
|
19
|
+
warn: message => {
|
|
20
|
+
Log.warning(getString(message));
|
|
21
|
+
},
|
|
22
|
+
error: message => {
|
|
23
|
+
Log.error(getString(message));
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var __exports = {
|
|
27
|
+
__esModule: true
|
|
28
|
+
};
|
|
29
|
+
__exports.logger = logger;
|
|
30
|
+
return __exports;
|
|
31
31
|
});
|
|
32
32
|
//# sourceMappingURL=logger.js.map
|
|
@@ -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 = await 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 = await 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
|