@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,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,35 @@
|
|
|
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
|
-
var __exports = {
|
|
30
|
-
__esModule: true
|
|
31
|
-
};
|
|
32
|
-
__exports.createDeferred = createDeferred;
|
|
33
|
-
return __exports;
|
|
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
|
+
var __exports = {
|
|
30
|
+
__esModule: true
|
|
31
|
+
};
|
|
32
|
+
__exports.createDeferred = createDeferred;
|
|
33
|
+
return __exports;
|
|
34
34
|
});
|
|
35
35
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/ui/rta/command/CommandFactory", "./validator"], function (CommandFactory, ___validator) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const validateBindingModel = ___validator["validateBindingModel"];
|
|
7
|
-
/**
|
|
8
|
-
* Function to check a give value is a binding expression.
|
|
9
|
-
*
|
|
10
|
-
* @param value value to be checked.
|
|
11
|
-
* @returns boolean
|
|
12
|
-
*/
|
|
13
|
-
function isBindingExpression(value) {
|
|
14
|
-
return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @param options UI5 adaptation options
|
|
20
|
-
* @param change changed property of a control
|
|
21
|
-
*/
|
|
22
|
-
async function applyChange(options, change) {
|
|
23
|
-
const {
|
|
24
|
-
rta
|
|
25
|
-
} = options;
|
|
26
|
-
const modifiedControl = sap.ui.getCore().byId(change.controlId);
|
|
27
|
-
if (!modifiedControl) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
|
|
31
|
-
const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
|
|
32
|
-
const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
|
|
33
|
-
const flexSettings = rta.getFlexSettings();
|
|
34
|
-
const changeType = isBindingString ? 'BindProperty' : 'Property';
|
|
35
|
-
if (isBindingModel) {
|
|
36
|
-
validateBindingModel(change.value);
|
|
37
|
-
}
|
|
38
|
-
const property = isBindingString ? 'newBinding' : 'newValue';
|
|
39
|
-
const modifiedValue = {
|
|
40
|
-
generator: flexSettings.generator,
|
|
41
|
-
propertyName: change.propertyName,
|
|
42
|
-
[property]: change.value
|
|
43
|
-
};
|
|
44
|
-
const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
|
|
45
|
-
await rta.getCommandStack().pushAndExecute(command);
|
|
46
|
-
}
|
|
47
|
-
var __exports = {
|
|
48
|
-
__esModule: true
|
|
49
|
-
};
|
|
50
|
-
__exports.applyChange = applyChange;
|
|
51
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/rta/command/CommandFactory", "./validator"], function (CommandFactory, ___validator) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const validateBindingModel = ___validator["validateBindingModel"];
|
|
7
|
+
/**
|
|
8
|
+
* Function to check a give value is a binding expression.
|
|
9
|
+
*
|
|
10
|
+
* @param value value to be checked.
|
|
11
|
+
* @returns boolean
|
|
12
|
+
*/
|
|
13
|
+
function isBindingExpression(value) {
|
|
14
|
+
return value.includes('{') && value.includes('}') && value.indexOf('{') < value.indexOf('}');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param options UI5 adaptation options
|
|
20
|
+
* @param change changed property of a control
|
|
21
|
+
*/
|
|
22
|
+
async function applyChange(options, change) {
|
|
23
|
+
const {
|
|
24
|
+
rta
|
|
25
|
+
} = options;
|
|
26
|
+
const modifiedControl = sap.ui.getCore().byId(change.controlId);
|
|
27
|
+
if (!modifiedControl) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const isBindingString = typeof change.value === 'string' && isBindingExpression(change.value);
|
|
31
|
+
const modifiedControlModifiedProperties = modifiedControl.getMetadata().getAllProperties()[change.propertyName];
|
|
32
|
+
const isBindingModel = isBindingString && modifiedControlModifiedProperties?.type === 'string';
|
|
33
|
+
const flexSettings = rta.getFlexSettings();
|
|
34
|
+
const changeType = isBindingString ? 'BindProperty' : 'Property';
|
|
35
|
+
if (isBindingModel) {
|
|
36
|
+
validateBindingModel(change.value);
|
|
37
|
+
}
|
|
38
|
+
const property = isBindingString ? 'newBinding' : 'newValue';
|
|
39
|
+
const modifiedValue = {
|
|
40
|
+
generator: flexSettings.generator,
|
|
41
|
+
propertyName: change.propertyName,
|
|
42
|
+
[property]: change.value
|
|
43
|
+
};
|
|
44
|
+
const command = await CommandFactory.getCommandFor(modifiedControl, changeType, modifiedValue, null, flexSettings);
|
|
45
|
+
await rta.getCommandStack().pushAndExecute(command);
|
|
46
|
+
}
|
|
47
|
+
var __exports = {
|
|
48
|
+
__esModule: true
|
|
49
|
+
};
|
|
50
|
+
__exports.applyChange = applyChange;
|
|
51
|
+
return __exports;
|
|
52
52
|
});
|
|
53
53
|
//# sourceMappingURL=flex-change.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["./service"], function (___service) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
var __exports = {
|
|
7
|
-
__esModule: true
|
|
8
|
-
};
|
|
9
|
-
__exports.ChangeService = ___service.ChangeService;
|
|
10
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./service"], function (___service) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
var __exports = {
|
|
7
|
+
__esModule: true
|
|
8
|
+
};
|
|
9
|
+
__exports.ChangeService = ___service.ChangeService;
|
|
10
|
+
return __exports;
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -10,6 +10,7 @@ sap.ui.define([
|
|
|
10
10
|
const deletePropertyChanges = ___sap_ux_private_control_property_editor_common['deletePropertyChanges'];
|
|
11
11
|
const propertyChangeFailed = ___sap_ux_private_control_property_editor_common['propertyChangeFailed'];
|
|
12
12
|
const FlexChangesEndPoints = ___sap_ux_private_control_property_editor_common['FlexChangesEndPoints'];
|
|
13
|
+
const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
|
|
13
14
|
const applyChange = ___flex_change['applyChange'];
|
|
14
15
|
function assertProperties(properties, target) {
|
|
15
16
|
for (const property of properties) {
|
|
@@ -62,10 +63,15 @@ sap.ui.define([
|
|
|
62
63
|
}
|
|
63
64
|
} else if (deletePropertyChanges.match(action)) {
|
|
64
65
|
await this.deleteChange(action.payload.controlId, action.payload.propertyName, action.payload.fileName);
|
|
66
|
+
} else if (reloadApplication.match(action)) {
|
|
67
|
+
await this.options.rta.stop(false, true);
|
|
65
68
|
}
|
|
66
69
|
});
|
|
67
70
|
await this.fetchSavedChanges();
|
|
68
71
|
this.updateStack();
|
|
72
|
+
this.options.rta.attachStop(() => {
|
|
73
|
+
location.reload();
|
|
74
|
+
});
|
|
69
75
|
this.options.rta.attachUndoRedoStackModified(this.createOnStackChangeHandler());
|
|
70
76
|
}
|
|
71
77
|
updateStack() {
|
|
@@ -180,6 +186,7 @@ sap.ui.define([
|
|
|
180
186
|
value = command.getProperty('newBinding');
|
|
181
187
|
break;
|
|
182
188
|
}
|
|
189
|
+
const {fileName} = command.getPreparedChange().getDefinition();
|
|
183
190
|
if (changeType === 'propertyChange' || changeType === 'propertyBindingChange') {
|
|
184
191
|
result = {
|
|
185
192
|
type: 'pending',
|
|
@@ -188,7 +195,8 @@ sap.ui.define([
|
|
|
188
195
|
propertyName: command.getProperty('propertyName'),
|
|
189
196
|
isActive: index >= inactiveCommandCount,
|
|
190
197
|
value,
|
|
191
|
-
controlName: command.getElement().getMetadata().getName().split('.').pop() ?? ''
|
|
198
|
+
controlName: command.getElement().getMetadata().getName().split('.').pop() ?? '',
|
|
199
|
+
fileName
|
|
192
200
|
};
|
|
193
201
|
} else {
|
|
194
202
|
result = {
|
|
@@ -196,7 +204,8 @@ sap.ui.define([
|
|
|
196
204
|
controlId: selectorId,
|
|
197
205
|
changeType,
|
|
198
206
|
isActive: index >= inactiveCommandCount,
|
|
199
|
-
controlName: changeType === 'addXMLAtExtensionPoint' ? command.getSelector().name ?? '' : command.getElement().getMetadata().getName().split('.').pop() ?? ''
|
|
207
|
+
controlName: changeType === 'addXMLAtExtensionPoint' ? command.getSelector().name ?? '' : command.getElement().getMetadata().getName().split('.').pop() ?? '',
|
|
208
|
+
fileName
|
|
200
209
|
};
|
|
201
210
|
}
|
|
202
211
|
return result;
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
changeStackModified,
|
|
10
10
|
deletePropertyChanges,
|
|
11
11
|
propertyChangeFailed,
|
|
12
|
-
FlexChangesEndPoints
|
|
12
|
+
FlexChangesEndPoints,
|
|
13
|
+
reloadApplication
|
|
13
14
|
} from '@sap-ux-private/control-property-editor-common';
|
|
14
15
|
import { applyChange } from './flex-change';
|
|
15
16
|
import type { SelectionService } from '../selection';
|
|
@@ -127,12 +128,17 @@ export class ChangeService {
|
|
|
127
128
|
}
|
|
128
129
|
} else if (deletePropertyChanges.match(action)) {
|
|
129
130
|
await this.deleteChange(action.payload.controlId, action.payload.propertyName, action.payload.fileName);
|
|
131
|
+
} else if (reloadApplication.match(action)) {
|
|
132
|
+
await this.options.rta.stop(false, true);
|
|
130
133
|
}
|
|
131
134
|
});
|
|
132
135
|
|
|
133
136
|
await this.fetchSavedChanges();
|
|
134
137
|
this.updateStack();
|
|
135
|
-
|
|
138
|
+
this.options.rta.attachStop(() => {
|
|
139
|
+
// eslint-disable-next-line fiori-custom/sap-no-location-reload
|
|
140
|
+
location.reload();
|
|
141
|
+
});
|
|
136
142
|
this.options.rta.attachUndoRedoStackModified(this.createOnStackChangeHandler());
|
|
137
143
|
}
|
|
138
144
|
|
|
@@ -300,6 +306,7 @@ export class ChangeService {
|
|
|
300
306
|
value = command.getProperty('newBinding');
|
|
301
307
|
break;
|
|
302
308
|
}
|
|
309
|
+
const { fileName } = command.getPreparedChange().getDefinition();
|
|
303
310
|
if (changeType === 'propertyChange' || changeType === 'propertyBindingChange') {
|
|
304
311
|
result = {
|
|
305
312
|
type: 'pending',
|
|
@@ -308,7 +315,8 @@ export class ChangeService {
|
|
|
308
315
|
propertyName: command.getProperty('propertyName'),
|
|
309
316
|
isActive: index >= inactiveCommandCount,
|
|
310
317
|
value,
|
|
311
|
-
controlName: command.getElement().getMetadata().getName().split('.').pop() ?? ''
|
|
318
|
+
controlName: command.getElement().getMetadata().getName().split('.').pop() ?? '',
|
|
319
|
+
fileName
|
|
312
320
|
};
|
|
313
321
|
} else {
|
|
314
322
|
result = {
|
|
@@ -319,7 +327,8 @@ export class ChangeService {
|
|
|
319
327
|
controlName:
|
|
320
328
|
changeType === 'addXMLAtExtensionPoint'
|
|
321
329
|
? command.getSelector().name ?? ''
|
|
322
|
-
: command.getElement().getMetadata().getName().split('.').pop() ?? ''
|
|
330
|
+
: command.getElement().getMetadata().getName().split('.').pop() ?? '',
|
|
331
|
+
fileName
|
|
323
332
|
};
|
|
324
333
|
}
|
|
325
334
|
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/base/i18n/ResourceBundle"], function (ResourceBundle) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Function to validate if a given value is a valid binding model.
|
|
8
|
-
*
|
|
9
|
-
* @param value value to be checked.
|
|
10
|
-
*/
|
|
11
|
-
function validateBindingModel(value) {
|
|
12
|
-
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
13
|
-
const bindingParts = bindingValue.split('>').filter(el => el != '');
|
|
14
|
-
if (!bindingParts.length) {
|
|
15
|
-
throw new SyntaxError('Invalid binding string.');
|
|
16
|
-
}
|
|
17
|
-
if (bindingParts[0].trim() === 'i18n') {
|
|
18
|
-
if (bindingParts.length === 2) {
|
|
19
|
-
const resourceBundle = ResourceBundle.create({
|
|
20
|
-
url: '../i18n/i18n.properties'
|
|
21
|
-
});
|
|
22
|
-
const resourceKey = bindingParts[1].trim();
|
|
23
|
-
if (!resourceBundle.hasText(resourceKey)) {
|
|
24
|
-
throw new SyntaxError('Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties. If not, add the key in the i18n.properties file and reload the editor for the new key to take effect.');
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
throw new SyntaxError('Invalid binding string. Supported value pattern is {i18n>YOUR_KEY}');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
var __exports = {
|
|
32
|
-
__esModule: true
|
|
33
|
-
};
|
|
34
|
-
__exports.validateBindingModel = validateBindingModel;
|
|
35
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/base/i18n/ResourceBundle"], function (ResourceBundle) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Function to validate if a given value is a valid binding model.
|
|
8
|
+
*
|
|
9
|
+
* @param value value to be checked.
|
|
10
|
+
*/
|
|
11
|
+
function validateBindingModel(value) {
|
|
12
|
+
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
13
|
+
const bindingParts = bindingValue.split('>').filter(el => el != '');
|
|
14
|
+
if (!bindingParts.length) {
|
|
15
|
+
throw new SyntaxError('Invalid binding string.');
|
|
16
|
+
}
|
|
17
|
+
if (bindingParts[0].trim() === 'i18n') {
|
|
18
|
+
if (bindingParts.length === 2) {
|
|
19
|
+
const resourceBundle = ResourceBundle.create({
|
|
20
|
+
url: '../i18n/i18n.properties'
|
|
21
|
+
});
|
|
22
|
+
const resourceKey = bindingParts[1].trim();
|
|
23
|
+
if (!resourceBundle.hasText(resourceKey)) {
|
|
24
|
+
throw new SyntaxError('Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties. If not, add the key in the i18n.properties file and reload the editor for the new key to take effect.');
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
throw new SyntaxError('Invalid binding string. Supported value pattern is {i18n>YOUR_KEY}');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var __exports = {
|
|
32
|
+
__esModule: true
|
|
33
|
+
};
|
|
34
|
+
__exports.validateBindingModel = validateBindingModel;
|
|
35
|
+
return __exports;
|
|
36
36
|
});
|
|
37
37
|
//# sourceMappingURL=validator.js.map
|