@sap-ux/preview-middleware 0.16.58 → 0.16.60
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/controllers/AddFragment.controller.js +3 -2
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
- package/dist/client/adp/controllers/ControllerExtension.controller.js +3 -18
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +2 -24
- package/dist/client/adp/init-dialogs.js +22 -7
- package/dist/client/adp/init-dialogs.ts +31 -8
- package/dist/client/adp/init.js +19 -40
- package/dist/client/adp/init.ts +17 -56
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +70 -0
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +71 -0
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +59 -0
- package/dist/client/adp/quick-actions/common/op-add-header-field.ts +71 -0
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +261 -0
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +305 -0
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +67 -0
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +84 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.js +57 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +69 -0
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +84 -0
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +90 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +88 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +97 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.js +51 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +58 -0
- package/dist/client/adp/quick-actions/fe-v4/utils.js +54 -0
- package/dist/client/adp/quick-actions/fe-v4/utils.ts +47 -0
- package/dist/client/adp/quick-actions/load.js +46 -0
- package/dist/client/adp/quick-actions/load.ts +23 -0
- package/dist/client/adp/utils.js +97 -1
- package/dist/client/adp/utils.ts +83 -0
- package/dist/client/cpe/changes/service.js +2 -2
- package/dist/client/cpe/changes/service.ts +2 -2
- package/dist/client/cpe/control-data.js +3 -3
- package/dist/client/cpe/control-data.ts +8 -7
- package/dist/client/cpe/init.js +14 -8
- package/dist/client/cpe/init.ts +25 -11
- package/dist/client/cpe/outline/{utils.js → editable.js} +3 -30
- package/dist/client/cpe/outline/{utils.ts → editable.ts} +1 -29
- package/dist/client/cpe/outline/nodes.js +27 -9
- package/dist/client/cpe/outline/nodes.ts +33 -8
- package/dist/client/cpe/outline/service.js +60 -0
- package/dist/client/cpe/outline/service.ts +73 -0
- package/dist/client/cpe/quick-actions/quick-action-definition.js +6 -0
- package/dist/client/cpe/quick-actions/quick-action-definition.ts +115 -0
- package/dist/client/cpe/quick-actions/quick-action-service.js +101 -0
- package/dist/client/cpe/quick-actions/quick-action-service.ts +142 -0
- package/dist/client/cpe/quick-actions/registry.js +145 -0
- package/dist/client/cpe/quick-actions/registry.ts +156 -0
- package/dist/client/cpe/quick-actions/utils.js +94 -0
- package/dist/client/cpe/quick-actions/utils.ts +114 -0
- package/dist/client/cpe/rta-service.ts +1 -0
- package/dist/client/cpe/selection.js +3 -3
- package/dist/client/cpe/selection.ts +1 -1
- package/dist/client/cpe/types.ts +7 -3
- package/dist/client/cpe/ui5-utils.js +1 -17
- package/dist/client/cpe/ui5-utils.ts +0 -17
- package/dist/client/cpe/utils.js +50 -1
- package/dist/client/cpe/utils.ts +54 -0
- package/dist/client/i18n.js +43 -0
- package/dist/client/i18n.ts +34 -0
- package/dist/client/manifest.json +1 -1
- package/dist/client/messagebundle.properties +17 -0
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +6 -1
- package/dist/client/utils/application.js +34 -0
- package/dist/client/utils/application.ts +27 -0
- package/dist/client/utils/core.js +70 -0
- package/dist/client/utils/core.ts +61 -0
- package/package.json +4 -4
- package/dist/client/cpe/outline/index.js +0 -40
- package/dist/client/cpe/outline/index.ts +0 -37
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import ResourceBundle from 'sap/base/i18n/ResourceBundle';
|
|
2
|
+
|
|
3
|
+
const BUNDLE_CACHE: Record<string, ResourceBundle> = {};
|
|
4
|
+
|
|
5
|
+
export async function getResourceBundle(key: string): Promise<ResourceBundle> {
|
|
6
|
+
const cachedBundle = BUNDLE_CACHE[key];
|
|
7
|
+
|
|
8
|
+
if (cachedBundle) {
|
|
9
|
+
return cachedBundle;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const bundle = await ResourceBundle.create({
|
|
13
|
+
bundleUrl: '/preview/client/messagebundle.properties',
|
|
14
|
+
url: '/preview/client/messagebundle.properties',
|
|
15
|
+
supportedLocales: [''],
|
|
16
|
+
locale: '',
|
|
17
|
+
async: true
|
|
18
|
+
});
|
|
19
|
+
BUNDLE_CACHE[key] = bundle;
|
|
20
|
+
return bundle;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class TextBundle {
|
|
24
|
+
constructor(private bundle: ResourceBundle) {}
|
|
25
|
+
|
|
26
|
+
getText(key: string, args?: string[]): string {
|
|
27
|
+
return this.bundle.getText(key, args) ?? key;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function getTextBundle(key = 'open.ux.preview.client'): Promise<TextBundle> {
|
|
32
|
+
const bundle = await getResourceBundle(key);
|
|
33
|
+
return new TextBundle(bundle);
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
QUICK_ACTION_ADD_PAGE_CONTROLLER=Add controller to page
|
|
2
|
+
QUICK_ACTION_SHOW_PAGE_CONTROLLER=Show page controller
|
|
3
|
+
QUICK_ACTION_OP_ADD_HEADER_FIELD=Add Header Field
|
|
4
|
+
|
|
5
|
+
V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change table columns
|
|
6
|
+
|
|
7
|
+
V2_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable clear filterbar button
|
|
8
|
+
V2_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable clear filterbar button
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS=Change table columns
|
|
12
|
+
|
|
13
|
+
V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR=Enable clear filterbar button
|
|
14
|
+
V4_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR=Disable clear filterbar button
|
|
15
|
+
|
|
16
|
+
ADP_SYNC_VIEWS_MESSAGE = Have in mind that synchronous views are detected for this application and controller extensions are not supported for such views. Controller extension functionality on these views will be disabled.
|
|
17
|
+
ADP_REUSE_COMPONENTS_MESSAGE = Have in mind that reuse components are detected for some views in this application and controller extensions and adding fragments are not supported for such views. Controller extension and adding fragment functionality on these views will be disabled.
|
|
@@ -8,7 +8,7 @@ sap.ui.define((function () { 'use strict';
|
|
|
8
8
|
|
|
9
9
|
(function (exports) {
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.save = exports.redo = exports.undo = exports.appLoaded = exports.setSaveEnablement = exports.setUndoRedoEnablement = exports.setAppMode = exports.storageFileChanged = exports.reloadApplication = exports.showMessage = exports.changeStackModified = exports.propertyChangeFailed = exports.propertyChanged = exports.changeProperty = exports.outlineChanged = exports.deletePropertyChanges = exports.addExtensionPoint = exports.selectControl = exports.controlSelected = exports.iconsLoaded = exports.EXTERNAL_ACTION_PREFIX = exports.SCENARIO = exports.CHECKBOX_EDITOR_TYPE = exports.DROPDOWN_EDITOR_TYPE = exports.INPUT_EDITOR_TYPE = exports.STRING_VALUE_TYPE = exports.FLOAT_VALUE_TYPE = exports.INTEGER_VALUE_TYPE = exports.BOOLEAN_VALUE_TYPE = void 0;
|
|
11
|
+
exports.executeQuickAction = exports.updateQuickAction = exports.quickActionListChanged = exports.save = exports.redo = exports.undo = exports.appLoaded = exports.setSaveEnablement = exports.setUndoRedoEnablement = exports.setAppMode = exports.storageFileChanged = exports.reloadApplication = exports.showMessage = exports.changeStackModified = exports.propertyChangeFailed = exports.propertyChanged = exports.changeProperty = exports.outlineChanged = exports.deletePropertyChanges = exports.addExtensionPoint = exports.selectControl = exports.controlSelected = exports.iconsLoaded = exports.EXTERNAL_ACTION_PREFIX = exports.NESTED_QUICK_ACTION_KIND = exports.SIMPLE_QUICK_ACTION_KIND = exports.SCENARIO = exports.CHECKBOX_EDITOR_TYPE = exports.DROPDOWN_EDITOR_TYPE = exports.INPUT_EDITOR_TYPE = exports.STRING_VALUE_TYPE = exports.FLOAT_VALUE_TYPE = exports.INTEGER_VALUE_TYPE = exports.BOOLEAN_VALUE_TYPE = void 0;
|
|
12
12
|
exports.BOOLEAN_VALUE_TYPE = 'boolean';
|
|
13
13
|
exports.INTEGER_VALUE_TYPE = 'integer';
|
|
14
14
|
exports.FLOAT_VALUE_TYPE = 'float';
|
|
@@ -23,6 +23,8 @@ sap.ui.define((function () { 'use strict';
|
|
|
23
23
|
FioriElementsFromScratch: 'FE_FROM_SCRATCH',
|
|
24
24
|
UiAdaptation: 'UI_ADAPTATION'
|
|
25
25
|
};
|
|
26
|
+
exports.SIMPLE_QUICK_ACTION_KIND = 'simple';
|
|
27
|
+
exports.NESTED_QUICK_ACTION_KIND = 'nested';
|
|
26
28
|
/**
|
|
27
29
|
* Create matcher.
|
|
28
30
|
*
|
|
@@ -81,6 +83,9 @@ sap.ui.define((function () { 'use strict';
|
|
|
81
83
|
exports.undo = createExternalAction('undo');
|
|
82
84
|
exports.redo = createExternalAction('redo');
|
|
83
85
|
exports.save = createExternalAction('save');
|
|
86
|
+
exports.quickActionListChanged = createExternalAction('quick-action-list-changed');
|
|
87
|
+
exports.updateQuickAction = createExternalAction('update-quick-action');
|
|
88
|
+
exports.executeQuickAction = createExternalAction('execute-quick-action');
|
|
84
89
|
|
|
85
90
|
} (api));
|
|
86
91
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Determines application type based on the manifest.json.
|
|
8
|
+
*
|
|
9
|
+
* @param manifest - Application Manifest.
|
|
10
|
+
* @returns Application type.
|
|
11
|
+
*/
|
|
12
|
+
function getApplicationType(manifest) {
|
|
13
|
+
if (manifest['sap.ui.generic.app'] || manifest['sap.ovp']) {
|
|
14
|
+
return 'fe-v2';
|
|
15
|
+
} else if (manifest['sap.ui5']?.routing?.targets) {
|
|
16
|
+
let hasV4pPages = false;
|
|
17
|
+
Object.keys(manifest?.['sap.ui5']?.routing?.targets ?? []).forEach(target => {
|
|
18
|
+
if (manifest?.['sap.ui5']?.routing?.targets?.[target]?.name?.startsWith('sap.fe.templates.')) {
|
|
19
|
+
hasV4pPages = true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
if (hasV4pPages) {
|
|
23
|
+
return 'fe-v4';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 'freestyle';
|
|
27
|
+
}
|
|
28
|
+
var __exports = {
|
|
29
|
+
__esModule: true
|
|
30
|
+
};
|
|
31
|
+
__exports.getApplicationType = getApplicationType;
|
|
32
|
+
return __exports;
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
|
|
2
|
+
|
|
3
|
+
export type ApplicationType = 'fe-v2' | 'fe-v4' | 'freestyle';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Determines application type based on the manifest.json.
|
|
7
|
+
*
|
|
8
|
+
* @param manifest - Application Manifest.
|
|
9
|
+
* @returns Application type.
|
|
10
|
+
*/
|
|
11
|
+
export function getApplicationType(manifest: Manifest): ApplicationType {
|
|
12
|
+
if (manifest['sap.ui.generic.app'] || manifest['sap.ovp']) {
|
|
13
|
+
return 'fe-v2';
|
|
14
|
+
} else if (manifest['sap.ui5']?.routing?.targets) {
|
|
15
|
+
let hasV4pPages = false;
|
|
16
|
+
Object.keys(manifest?.['sap.ui5']?.routing?.targets ?? []).forEach((target) => {
|
|
17
|
+
if (manifest?.['sap.ui5']?.routing?.targets?.[target]?.name?.startsWith('sap.fe.templates.')) {
|
|
18
|
+
hasV4pPages = true;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (hasV4pPages) {
|
|
22
|
+
return 'fe-v4';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return 'freestyle';
|
|
27
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Component", "sap/ui/core/Element"], function (Component, Element) {
|
|
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?.getComponentById) {
|
|
14
|
+
return Component.getComponentById(id);
|
|
15
|
+
} else if (Component?.get) {
|
|
16
|
+
// Older version must be still supported until maintenance period.
|
|
17
|
+
return Component.get(id); // NOSONAR
|
|
18
|
+
} else {
|
|
19
|
+
// Older version must be still supported until maintenance period.
|
|
20
|
+
return sap.ui.getCore().getComponent(id); // NOSONAR
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns control by its global ID.
|
|
26
|
+
*
|
|
27
|
+
* @param id Id of the control.
|
|
28
|
+
* @returns Control instance if it exists.
|
|
29
|
+
*/
|
|
30
|
+
function getControlById(id) {
|
|
31
|
+
if (typeof Element.getElementById === 'function') {
|
|
32
|
+
return Element.getElementById(id);
|
|
33
|
+
} else {
|
|
34
|
+
return sap.ui.getCore().byId(id);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Checks wether this object is an instance of a ManagedObject.
|
|
40
|
+
*
|
|
41
|
+
* @param element An object.
|
|
42
|
+
* @returns True if element is an instance of a ManagedObject.
|
|
43
|
+
*/
|
|
44
|
+
function isManagedObject(element) {
|
|
45
|
+
if (typeof element?.isA === 'function') {
|
|
46
|
+
return element.isA('sap.ui.base.ManagedObject');
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether this object is an instance of the named type.
|
|
53
|
+
*
|
|
54
|
+
* @param type - Type to check for.
|
|
55
|
+
* @param element - Object to check
|
|
56
|
+
* @returns Whether this object is an instance of the given type.
|
|
57
|
+
*/
|
|
58
|
+
function isA(type, element) {
|
|
59
|
+
return !!element?.isA(type);
|
|
60
|
+
}
|
|
61
|
+
var __exports = {
|
|
62
|
+
__esModule: true
|
|
63
|
+
};
|
|
64
|
+
__exports.getComponent = getComponent;
|
|
65
|
+
__exports.getControlById = getControlById;
|
|
66
|
+
__exports.isManagedObject = isManagedObject;
|
|
67
|
+
__exports.isA = isA;
|
|
68
|
+
return __exports;
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Component from 'sap/ui/core/Component';
|
|
2
|
+
import type { ID } from 'sap/ui/core/library';
|
|
3
|
+
import type ManagedObject from 'sap/ui/base/ManagedObject';
|
|
4
|
+
import Element from 'sap/ui/core/Element';
|
|
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 = Component>(id: ID): T | undefined {
|
|
13
|
+
if (Component?.getComponentById) {
|
|
14
|
+
return Component.getComponentById(id) as T;
|
|
15
|
+
} else if (Component?.get) {
|
|
16
|
+
// Older version must be still supported until maintenance period.
|
|
17
|
+
return Component.get(id) as T; // NOSONAR
|
|
18
|
+
} else {
|
|
19
|
+
// Older version must be still supported until maintenance period.
|
|
20
|
+
return sap.ui.getCore().getComponent(id) as T; // NOSONAR
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns control by its global ID.
|
|
26
|
+
*
|
|
27
|
+
* @param id Id of the control.
|
|
28
|
+
* @returns Control instance if it exists.
|
|
29
|
+
*/
|
|
30
|
+
export function getControlById<T extends Element = Element>(id: string): T | undefined {
|
|
31
|
+
if (typeof Element.getElementById === 'function') {
|
|
32
|
+
return Element.getElementById(id) as T;
|
|
33
|
+
} else {
|
|
34
|
+
return sap.ui.getCore().byId(id) as T;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Checks wether this object is an instance of a ManagedObject.
|
|
40
|
+
*
|
|
41
|
+
* @param element An object.
|
|
42
|
+
* @returns True if element is an instance of a ManagedObject.
|
|
43
|
+
*/
|
|
44
|
+
export function isManagedObject(element: object | undefined): element is ManagedObject {
|
|
45
|
+
if (typeof (element as unknown as { isA?: (_type: string) => boolean })?.isA === 'function') {
|
|
46
|
+
return (element as unknown as { isA: (_type: string) => boolean }).isA('sap.ui.base.ManagedObject');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Checks whether this object is an instance of the named type.
|
|
54
|
+
*
|
|
55
|
+
* @param type - Type to check for.
|
|
56
|
+
* @param element - Object to check
|
|
57
|
+
* @returns Whether this object is an instance of the given type.
|
|
58
|
+
*/
|
|
59
|
+
export function isA<T extends ManagedObject>(type: string, element: ManagedObject | undefined): element is T {
|
|
60
|
+
return !!element?.isA(type);
|
|
61
|
+
}
|
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.16.
|
|
12
|
+
"version": "0.16.60",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"ejs": "3.1.10",
|
|
26
26
|
"mem-fs": "2.1.0",
|
|
27
27
|
"mem-fs-editor": "9.4.0",
|
|
28
|
-
"@sap-ux/logger": "0.6.0",
|
|
29
28
|
"@sap-ux/btp-utils": "0.15.2",
|
|
30
29
|
"@sap-ux/adp-tooling": "0.12.45",
|
|
31
|
-
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.
|
|
30
|
+
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.1",
|
|
31
|
+
"@sap-ux/logger": "0.6.0",
|
|
32
32
|
"@sap-ux/project-access": "1.27.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"supertest": "6.3.3",
|
|
46
46
|
"@sap-ux-private/playwright": "0.1.0",
|
|
47
47
|
"dotenv": "16.3.1",
|
|
48
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.
|
|
48
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.0",
|
|
49
49
|
"@sap-ux/axios-extension": "1.16.5",
|
|
50
50
|
"@sap-ux/store": "0.9.1",
|
|
51
51
|
"@sap-ux/ui5-info": "0.8.1",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
sap.ui.define([
|
|
3
|
-
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
4
|
-
'./nodes',
|
|
5
|
-
'sap/base/Log',
|
|
6
|
-
'../../utils/error'
|
|
7
|
-
], function (___sap_ux_private_control_property_editor_common, ___nodes, Log, ____utils_error) {
|
|
8
|
-
'use strict';
|
|
9
|
-
const outlineChanged = ___sap_ux_private_control_property_editor_common['outlineChanged'];
|
|
10
|
-
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
11
|
-
const transformNodes = ___nodes['transformNodes'];
|
|
12
|
-
const getError = ____utils_error['getError'];
|
|
13
|
-
async function initOutline(rta, sendAction) {
|
|
14
|
-
const outline = await rta.getService('outline');
|
|
15
|
-
const scenario = rta.getFlexSettings().scenario;
|
|
16
|
-
let hasSentWarning = false;
|
|
17
|
-
const reuseComponentsIds = new Set();
|
|
18
|
-
async function syncOutline() {
|
|
19
|
-
try {
|
|
20
|
-
const viewNodes = await outline.get();
|
|
21
|
-
const outlineNodes = await transformNodes(viewNodes, scenario, reuseComponentsIds);
|
|
22
|
-
sendAction(outlineChanged(outlineNodes));
|
|
23
|
-
if (reuseComponentsIds.size > 0 && scenario === 'ADAPTATION_PROJECT' && !hasSentWarning) {
|
|
24
|
-
sendAction(showMessage({
|
|
25
|
-
message: 'Have in mind that reuse components are detected for some views in this application and controller extensions and adding fragments are not supported for such views. Controller extension and adding fragment functionality on these views will be disabled.',
|
|
26
|
-
shouldHideIframe: false
|
|
27
|
-
}));
|
|
28
|
-
hasSentWarning = true;
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
Log.error('Outline sync failed!', getError(error));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
await syncOutline();
|
|
35
|
-
outline.attachEvent('update', syncOutline);
|
|
36
|
-
}
|
|
37
|
-
var __exports = { __esModule: true };
|
|
38
|
-
__exports.initOutline = initOutline;
|
|
39
|
-
return __exports;
|
|
40
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ExternalAction } from '@sap-ux-private/control-property-editor-common';
|
|
2
|
-
import { outlineChanged, showMessage } from '@sap-ux-private/control-property-editor-common';
|
|
3
|
-
|
|
4
|
-
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
5
|
-
import type OutlineService from 'sap/ui/rta/command/OutlineService';
|
|
6
|
-
|
|
7
|
-
import { transformNodes } from './nodes';
|
|
8
|
-
import Log from 'sap/base/Log';
|
|
9
|
-
import { getError } from '../../utils/error';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param rta runtimeAuthoring object.
|
|
14
|
-
* @param sendAction send action method.
|
|
15
|
-
*/
|
|
16
|
-
export async function initOutline(rta: RuntimeAuthoring, sendAction: (action: ExternalAction) => void): Promise<void> {
|
|
17
|
-
const outline = await rta.getService<OutlineService>('outline');
|
|
18
|
-
const scenario = rta.getFlexSettings().scenario;
|
|
19
|
-
let hasSentWarning = false;
|
|
20
|
-
const reuseComponentsIds = new Set<string>();
|
|
21
|
-
async function syncOutline() {
|
|
22
|
-
try {
|
|
23
|
-
const viewNodes = await outline.get();
|
|
24
|
-
const outlineNodes = await transformNodes(viewNodes, scenario, reuseComponentsIds);
|
|
25
|
-
sendAction(outlineChanged(outlineNodes));
|
|
26
|
-
if(reuseComponentsIds.size > 0 && scenario === 'ADAPTATION_PROJECT' && !hasSentWarning) {
|
|
27
|
-
sendAction(showMessage({ message: 'Have in mind that reuse components are detected for some views in this application and controller extensions and adding fragments are not supported for such views. Controller extension and adding fragment functionality on these views will be disabled.', shouldHideIframe: false}));
|
|
28
|
-
hasSentWarning = true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
} catch (error) {
|
|
32
|
-
Log.error('Outline sync failed!', getError(error));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
await syncOutline();
|
|
36
|
-
outline.attachEvent('update', syncOutline);
|
|
37
|
-
}
|