@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.
- package/dist/base/flex.d.ts +5 -15
- package/dist/base/flex.js +4 -32
- package/dist/base/flp.d.ts +12 -2
- package/dist/base/flp.js +27 -5
- 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 +185 -206
- package/dist/client/adp/controllers/AddFragment.controller.ts +5 -24
- package/dist/client/adp/controllers/BaseDialog.controller.js +74 -57
- package/dist/client/adp/controllers/BaseDialog.controller.ts +36 -2
- package/dist/client/adp/controllers/ControllerExtension.controller.js +179 -179
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +90 -100
- package/dist/client/adp/controllers/ExtensionPoint.controller.ts +9 -22
- 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 +61 -33
- package/dist/client/adp/utils.ts +34 -0
- package/dist/client/cpe/changes/flex-change.js +51 -51
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +35 -35
- package/dist/client/cpe/documentation.js +164 -164
- 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 -84
- package/dist/client/flp/common.js +28 -28
- 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/package.json +7 -3
|
@@ -1,102 +1,92 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/m/MessageToast", "sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller"], function (MessageToast, JSONModel, ___api_handler, __BaseDialog) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
-
}
|
|
9
|
-
const getFragments = ___api_handler["getFragments"];
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
/**
|
|
13
|
-
* @namespace open.ux.preview.client.adp.controllers
|
|
14
|
-
*/
|
|
15
|
-
const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
|
|
16
|
-
constructor: function _constructor(name, _overlays,
|
|
17
|
-
BaseDialog.prototype.constructor.call(this, name);
|
|
18
|
-
this.model = new JSONModel();
|
|
19
|
-
this.data = data;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
this.dialog.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
source.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.model.setProperty('/
|
|
76
|
-
this.model.setProperty('/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
92
|
-
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
93
|
-
const modifiedValue = {
|
|
94
|
-
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
95
|
-
extensionPointName
|
|
96
|
-
};
|
|
97
|
-
this.data.deferred.resolve(modifiedValue);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return ExtensionPoint;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast", "sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (MessageToast, JSONModel, ___api_handler, __BaseDialog, ___utils) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const getFragments = ___api_handler["getFragments"];
|
|
10
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
11
|
+
const notifyUser = ___utils["notifyUser"];
|
|
12
|
+
/**
|
|
13
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
14
|
+
*/
|
|
15
|
+
const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
|
|
16
|
+
constructor: function _constructor(name, _overlays, rta, data) {
|
|
17
|
+
BaseDialog.prototype.constructor.call(this, name);
|
|
18
|
+
this.model = new JSONModel();
|
|
19
|
+
this.data = data;
|
|
20
|
+
this.rta = rta;
|
|
21
|
+
},
|
|
22
|
+
setup: async function _setup(dialog) {
|
|
23
|
+
this.dialog = dialog;
|
|
24
|
+
this.setEscapeHandler();
|
|
25
|
+
await this.buildDialogData();
|
|
26
|
+
this.dialog.setModel(this.model);
|
|
27
|
+
this.dialog.open();
|
|
28
|
+
},
|
|
29
|
+
onCreateBtnPress: function _onCreateBtnPress(event) {
|
|
30
|
+
const source = event.getSource();
|
|
31
|
+
source.setEnabled(false);
|
|
32
|
+
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
33
|
+
this.createExtensionPointFragmentChange(fragmentName);
|
|
34
|
+
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
35
|
+
this.handleDialogClose();
|
|
36
|
+
},
|
|
37
|
+
onExtensionPointHandler: function _onExtensionPointHandler(event) {
|
|
38
|
+
const source = event.getSource();
|
|
39
|
+
const selectedItem = source.getSelectedItem();
|
|
40
|
+
let extensionPointName = '';
|
|
41
|
+
if (selectedItem) {
|
|
42
|
+
extensionPointName = selectedItem.getText();
|
|
43
|
+
}
|
|
44
|
+
this.model.setProperty('/extensionPointName', extensionPointName);
|
|
45
|
+
},
|
|
46
|
+
buildDialogData: async function _buildDialogData() {
|
|
47
|
+
const name = this.data?.name;
|
|
48
|
+
if (name) {
|
|
49
|
+
const extensionPointList = [{
|
|
50
|
+
key: 0,
|
|
51
|
+
value: name
|
|
52
|
+
}];
|
|
53
|
+
this.updateModel(name, 0, extensionPointList, false);
|
|
54
|
+
} else {
|
|
55
|
+
const extensionPointList = this.data.info.map((v, idx) => {
|
|
56
|
+
return {
|
|
57
|
+
key: idx,
|
|
58
|
+
value: v.name
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const enabled = extensionPointList.length > 1;
|
|
62
|
+
this.updateModel(extensionPointList[0].value, 0, extensionPointList, enabled);
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
const {
|
|
66
|
+
fragments
|
|
67
|
+
} = await getFragments();
|
|
68
|
+
this.model.setProperty('/fragmentList', fragments);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
MessageToast.show(e.message);
|
|
71
|
+
throw new Error(e.message);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
updateModel: function _updateModel(name, key, list, enabled) {
|
|
75
|
+
this.model.setProperty('/extensionPointName', name);
|
|
76
|
+
this.model.setProperty('/extensionPointKey', key);
|
|
77
|
+
this.model.setProperty('/extensionPointList', list);
|
|
78
|
+
this.model.setProperty('/extensionListEnabled', enabled);
|
|
79
|
+
},
|
|
80
|
+
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
81
|
+
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
82
|
+
const modifiedValue = {
|
|
83
|
+
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
84
|
+
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
85
|
+
extensionPointName
|
|
86
|
+
};
|
|
87
|
+
this.data.deferred.resolve(modifiedValue);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return ExtensionPoint;
|
|
101
91
|
});
|
|
102
92
|
//# sourceMappingURL=ExtensionPoint.controller.js.map
|
|
@@ -16,9 +16,10 @@ import JSONModel from 'sap/ui/model/json/JSONModel';
|
|
|
16
16
|
/** sap.ui.rta */
|
|
17
17
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
18
18
|
|
|
19
|
-
import { getFragments
|
|
19
|
+
import { getFragments } from '../api-handler';
|
|
20
20
|
import BaseDialog from './BaseDialog.controller';
|
|
21
21
|
import { ExtensionPointData, ExtensionPointInfo } from '../extension-point';
|
|
22
|
+
import { notifyUser } from '../utils';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @namespace open.ux.preview.client.adp.controllers
|
|
@@ -26,10 +27,11 @@ import { ExtensionPointData, ExtensionPointInfo } from '../extension-point';
|
|
|
26
27
|
export default class ExtensionPoint extends BaseDialog {
|
|
27
28
|
public readonly data: ExtensionPointData;
|
|
28
29
|
|
|
29
|
-
constructor(name: string, _overlays: UI5Element,
|
|
30
|
+
constructor(name: string, _overlays: UI5Element, rta: RuntimeAuthoring, data: ExtensionPointData) {
|
|
30
31
|
super(name);
|
|
31
32
|
this.model = new JSONModel();
|
|
32
33
|
this.data = data;
|
|
34
|
+
this.rta = rta;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/**
|
|
@@ -54,13 +56,15 @@ export default class ExtensionPoint extends BaseDialog {
|
|
|
54
56
|
*
|
|
55
57
|
* @param event Event
|
|
56
58
|
*/
|
|
57
|
-
|
|
59
|
+
onCreateBtnPress(event: Event): void {
|
|
58
60
|
const source = event.getSource<Button>();
|
|
59
61
|
source.setEnabled(false);
|
|
60
62
|
|
|
61
63
|
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
this.createExtensionPointFragmentChange(fragmentName);
|
|
66
|
+
|
|
67
|
+
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
64
68
|
|
|
65
69
|
this.handleDialogClose();
|
|
66
70
|
}
|
|
@@ -127,24 +131,6 @@ export default class ExtensionPoint extends BaseDialog {
|
|
|
127
131
|
this.model.setProperty('/extensionListEnabled', enabled);
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
/**
|
|
131
|
-
* Creates a new fragment for the specified extension point
|
|
132
|
-
*
|
|
133
|
-
* @param fragmentName Fragment name
|
|
134
|
-
*/
|
|
135
|
-
private async createNewFragment(fragmentName: string): Promise<void> {
|
|
136
|
-
try {
|
|
137
|
-
await writeFragment<unknown>({ fragmentName });
|
|
138
|
-
MessageToast.show(`Fragment with name '${fragmentName}' was created.`);
|
|
139
|
-
} catch (e) {
|
|
140
|
-
// In case of error when creating a new fragment, we should not create a change file
|
|
141
|
-
MessageToast.show(e.message);
|
|
142
|
-
throw new Error(e.message);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
this.createExtensionPointFragmentChange(fragmentName);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
134
|
/**
|
|
149
135
|
* Creates add xml at extension point changes
|
|
150
136
|
*
|
|
@@ -153,6 +139,7 @@ export default class ExtensionPoint extends BaseDialog {
|
|
|
153
139
|
private createExtensionPointFragmentChange(fragmentName: string): void {
|
|
154
140
|
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
155
141
|
const modifiedValue = {
|
|
142
|
+
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
156
143
|
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
157
144
|
extensionPointName
|
|
158
145
|
};
|
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/core/Fragment", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller"], function (Fragment, __AddFragment, __ControllerExtension, __ExtensionPoint) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
-
}
|
|
9
|
-
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
10
|
-
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
11
|
-
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
12
|
-
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
13
|
-
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
14
|
-
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
15
|
-
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
16
|
-
return DialogNames;
|
|
17
|
-
}(DialogNames || {});
|
|
18
|
-
/**
|
|
19
|
-
* Adds a new item to the context menu
|
|
20
|
-
*
|
|
21
|
-
* @param rta Runtime Authoring
|
|
22
|
-
*/
|
|
23
|
-
const initDialogs = rta => {
|
|
24
|
-
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
25
|
-
contextMenu.addMenuItem({
|
|
26
|
-
id: 'ADD_FRAGMENT',
|
|
27
|
-
text: 'Add: Fragment',
|
|
28
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
29
|
-
icon: 'sap-icon://attachment-html'
|
|
30
|
-
});
|
|
31
|
-
contextMenu.addMenuItem({
|
|
32
|
-
id: 'EXTEND_CONTROLLER',
|
|
33
|
-
text: 'Extend With Controller',
|
|
34
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
35
|
-
icon: 'sap-icon://create-form'
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Handler for new context menu entry
|
|
41
|
-
*
|
|
42
|
-
* @param overlay Control overlays
|
|
43
|
-
* @param rta Runtime Authoring
|
|
44
|
-
* @param dialogName Dialog name
|
|
45
|
-
* @param extensionPointData Control ID
|
|
46
|
-
*/
|
|
47
|
-
async function handler(overlay, rta, dialogName, extensionPointData) {
|
|
48
|
-
let controller;
|
|
49
|
-
switch (dialogName) {
|
|
50
|
-
case DialogNames.ADD_FRAGMENT:
|
|
51
|
-
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
52
|
-
break;
|
|
53
|
-
case DialogNames.CONTROLLER_EXTENSION:
|
|
54
|
-
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
55
|
-
break;
|
|
56
|
-
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
57
|
-
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
61
|
-
const dialog = await Fragment.load({
|
|
62
|
-
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
63
|
-
controller,
|
|
64
|
-
id
|
|
65
|
-
});
|
|
66
|
-
await controller.setup(dialog);
|
|
67
|
-
}
|
|
68
|
-
var __exports = {
|
|
69
|
-
__esModule: true
|
|
70
|
-
};
|
|
71
|
-
__exports.DialogNames = DialogNames;
|
|
72
|
-
__exports.initDialogs = initDialogs;
|
|
73
|
-
__exports.handler = handler;
|
|
74
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Fragment", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller"], function (Fragment, __AddFragment, __ControllerExtension, __ExtensionPoint) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
10
|
+
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
11
|
+
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
12
|
+
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
13
|
+
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
14
|
+
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
15
|
+
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
16
|
+
return DialogNames;
|
|
17
|
+
}(DialogNames || {});
|
|
18
|
+
/**
|
|
19
|
+
* Adds a new item to the context menu
|
|
20
|
+
*
|
|
21
|
+
* @param rta Runtime Authoring
|
|
22
|
+
*/
|
|
23
|
+
const initDialogs = rta => {
|
|
24
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
25
|
+
contextMenu.addMenuItem({
|
|
26
|
+
id: 'ADD_FRAGMENT',
|
|
27
|
+
text: 'Add: Fragment',
|
|
28
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
29
|
+
icon: 'sap-icon://attachment-html'
|
|
30
|
+
});
|
|
31
|
+
contextMenu.addMenuItem({
|
|
32
|
+
id: 'EXTEND_CONTROLLER',
|
|
33
|
+
text: 'Extend With Controller',
|
|
34
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
35
|
+
icon: 'sap-icon://create-form'
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Handler for new context menu entry
|
|
41
|
+
*
|
|
42
|
+
* @param overlay Control overlays
|
|
43
|
+
* @param rta Runtime Authoring
|
|
44
|
+
* @param dialogName Dialog name
|
|
45
|
+
* @param extensionPointData Control ID
|
|
46
|
+
*/
|
|
47
|
+
async function handler(overlay, rta, dialogName, extensionPointData) {
|
|
48
|
+
let controller;
|
|
49
|
+
switch (dialogName) {
|
|
50
|
+
case DialogNames.ADD_FRAGMENT:
|
|
51
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
52
|
+
break;
|
|
53
|
+
case DialogNames.CONTROLLER_EXTENSION:
|
|
54
|
+
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
55
|
+
break;
|
|
56
|
+
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
57
|
+
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
61
|
+
const dialog = await Fragment.load({
|
|
62
|
+
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
63
|
+
controller,
|
|
64
|
+
id
|
|
65
|
+
});
|
|
66
|
+
await controller.setup(dialog);
|
|
67
|
+
}
|
|
68
|
+
var __exports = {
|
|
69
|
+
__esModule: true
|
|
70
|
+
};
|
|
71
|
+
__exports.DialogNames = DialogNames;
|
|
72
|
+
__exports.initDialogs = initDialogs;
|
|
73
|
+
__exports.handler = handler;
|
|
74
|
+
return __exports;
|
|
75
75
|
});
|
|
76
76
|
//# sourceMappingURL=init-dialogs.js.map
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Checks if the given version is lower than the required minimal version.
|
|
8
|
-
* @param version to check
|
|
9
|
-
* @param minVersion to check
|
|
10
|
-
*
|
|
11
|
-
* @returns boolean
|
|
12
|
-
*/
|
|
13
|
-
function isLowerThanMinimalUi5Version(version, minVersion) {
|
|
14
|
-
if (version && minVersion) {
|
|
15
|
-
const minVersionParsed = parseUI5Version(minVersion);
|
|
16
|
-
const ui5VersionParsed = parseUI5Version(version);
|
|
17
|
-
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
18
|
-
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get UI5 version validation message based on conditions.
|
|
31
|
-
* @param ui5Version to validate
|
|
32
|
-
* @returns string with validation message or undefined if non condition is met.
|
|
33
|
-
*/
|
|
34
|
-
function getUI5VersionValidationMessage(ui5Version) {
|
|
35
|
-
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
36
|
-
return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
|
|
37
|
-
}
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Parses the UI5 version
|
|
43
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
44
|
-
* Returns x.xx for snapshot-x.xx
|
|
45
|
-
*
|
|
46
|
-
* @param version the UI5 version to parse
|
|
47
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
48
|
-
*/
|
|
49
|
-
function parseUI5Version(version) {
|
|
50
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
51
|
-
const major = parseInt(versionParts[0], 10);
|
|
52
|
-
const minor = parseInt(versionParts[1], 10);
|
|
53
|
-
return {
|
|
54
|
-
major,
|
|
55
|
-
minor
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
var __exports = {
|
|
59
|
-
__esModule: true
|
|
60
|
-
};
|
|
61
|
-
__exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
|
|
62
|
-
__exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
|
|
63
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checks if the given version is lower than the required minimal version.
|
|
8
|
+
* @param version to check
|
|
9
|
+
* @param minVersion to check
|
|
10
|
+
*
|
|
11
|
+
* @returns boolean
|
|
12
|
+
*/
|
|
13
|
+
function isLowerThanMinimalUi5Version(version, minVersion) {
|
|
14
|
+
if (version && minVersion) {
|
|
15
|
+
const minVersionParsed = parseUI5Version(minVersion);
|
|
16
|
+
const ui5VersionParsed = parseUI5Version(version);
|
|
17
|
+
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
18
|
+
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get UI5 version validation message based on conditions.
|
|
31
|
+
* @param ui5Version to validate
|
|
32
|
+
* @returns string with validation message or undefined if non condition is met.
|
|
33
|
+
*/
|
|
34
|
+
function getUI5VersionValidationMessage(ui5Version) {
|
|
35
|
+
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
36
|
+
return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Parses the UI5 version
|
|
43
|
+
* Returns NaN for snapshot or snapshot-untested
|
|
44
|
+
* Returns x.xx for snapshot-x.xx
|
|
45
|
+
*
|
|
46
|
+
* @param version the UI5 version to parse
|
|
47
|
+
* @returns The major and the minor version, e.g. 1.86
|
|
48
|
+
*/
|
|
49
|
+
function parseUI5Version(version) {
|
|
50
|
+
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
51
|
+
const major = parseInt(versionParts[0], 10);
|
|
52
|
+
const minor = parseInt(versionParts[1], 10);
|
|
53
|
+
return {
|
|
54
|
+
major,
|
|
55
|
+
minor
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
var __exports = {
|
|
59
|
+
__esModule: true
|
|
60
|
+
};
|
|
61
|
+
__exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
|
|
62
|
+
__exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
|
|
63
|
+
return __exports;
|
|
64
64
|
});
|
|
65
65
|
//# sourceMappingURL=ui5-version-utils.js.map
|
package/dist/client/adp/utils.js
CHANGED
|
@@ -1,35 +1,63 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
8
|
-
*
|
|
9
|
-
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
10
|
-
*
|
|
11
|
-
* @returns {Deferred} Deferred object
|
|
12
|
-
*/
|
|
13
|
-
function createDeferred() {
|
|
14
|
-
let resolve = null;
|
|
15
|
-
let reject = null;
|
|
16
|
-
const promise = new Promise((res, rej) => {
|
|
17
|
-
resolve = res;
|
|
18
|
-
reject = rej;
|
|
19
|
-
});
|
|
20
|
-
if (resolve === null || reject === null) {
|
|
21
|
-
throw new Error('Failed to initialize resolve and reject functions.');
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
promise,
|
|
25
|
-
resolve,
|
|
26
|
-
reject
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast"], function (MessageToast) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
8
|
+
*
|
|
9
|
+
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Deferred} Deferred object
|
|
12
|
+
*/
|
|
13
|
+
function createDeferred() {
|
|
14
|
+
let resolve = null;
|
|
15
|
+
let reject = null;
|
|
16
|
+
const promise = new Promise((res, rej) => {
|
|
17
|
+
resolve = res;
|
|
18
|
+
reject = rej;
|
|
19
|
+
});
|
|
20
|
+
if (resolve === null || reject === null) {
|
|
21
|
+
throw new Error('Failed to initialize resolve and reject functions.');
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
promise,
|
|
25
|
+
resolve,
|
|
26
|
+
reject
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Checks if the fragment name associated with a command matches the specified fragment name.
|
|
32
|
+
*
|
|
33
|
+
* @param {FlexCommand} command - The command object containing the prepared change to be examined.
|
|
34
|
+
* @param {string} fragmentName - The name of the fragment to match against the command's change.
|
|
35
|
+
* @returns {boolean} Returns true if the command's change contains a fragment path that matches
|
|
36
|
+
* the specified fragment name; otherwise, returns false.
|
|
37
|
+
*/
|
|
38
|
+
function matchesFragmentName(command, fragmentName) {
|
|
39
|
+
const change = command.getPreparedChange().getDefinition();
|
|
40
|
+
return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Displays a message to the user indicating that an XML fragment will be created upon saving a change.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} message - The message to be shown in the message toast.
|
|
47
|
+
* @param {number} duration - The duration during which message toast will be active.
|
|
48
|
+
*/
|
|
49
|
+
function notifyUser(message) {
|
|
50
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
51
|
+
MessageToast.show(message, {
|
|
52
|
+
duration
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
var __exports = {
|
|
56
|
+
__esModule: true
|
|
57
|
+
};
|
|
58
|
+
__exports.createDeferred = createDeferred;
|
|
59
|
+
__exports.matchesFragmentName = matchesFragmentName;
|
|
60
|
+
__exports.notifyUser = notifyUser;
|
|
61
|
+
return __exports;
|
|
34
62
|
});
|
|
35
63
|
//# sourceMappingURL=utils.js.map
|