@sap-ux/preview-middleware 0.16.8 → 0.16.11
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/README.md +7 -0
- package/dist/client/adp/api-handler.js +142 -142
- package/dist/client/adp/command-executor.js +58 -58
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +219 -219
- package/dist/client/adp/controllers/BaseDialog.controller.js +105 -105
- package/dist/client/adp/controllers/ControllerExtension.controller.js +228 -228
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/init-dialogs.js +138 -121
- package/dist/client/adp/init-dialogs.ts +39 -14
- package/dist/client/adp/init.js +1 -1
- package/dist/client/adp/init.ts +2 -1
- package/dist/client/adp/ui5-version-utils.js +63 -63
- package/dist/client/adp/utils.js +61 -61
- 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 +34 -34
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/error-utils.js +19 -19
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/index.js +11 -1
- package/dist/client/cpe/outline/index.ts +9 -4
- package/dist/client/cpe/outline/nodes.js +172 -151
- package/dist/client/cpe/outline/nodes.ts +40 -9
- package/dist/client/cpe/outline/utils.js +60 -37
- package/dist/client/cpe/outline/utils.ts +27 -0
- 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 +84 -84
- package/dist/client/flp/initConnectors.js +33 -33
- package/dist/client/flp/initRta.js +178 -178
- package/package.json +5 -5
package/dist/client/adp/init.js
CHANGED
|
@@ -54,7 +54,7 @@ sap.ui.define([
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
57
|
-
initDialogs(rta, syncViewsIds);
|
|
57
|
+
initDialogs(rta, syncViewsIds, minor);
|
|
58
58
|
if (minor > 77) {
|
|
59
59
|
const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
|
|
60
60
|
const extPointService = new ExtensionPointService(rta);
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -46,7 +46,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const syncViewsIds = await getAllSyncViewsIds(minor);
|
|
49
|
-
initDialogs(rta, syncViewsIds);
|
|
49
|
+
initDialogs(rta, syncViewsIds, minor);
|
|
50
50
|
|
|
51
51
|
if (minor > 77) {
|
|
52
52
|
const ExtensionPointService = (await import('open/ux/preview/client/adp/extension-point')).default;
|
|
@@ -62,6 +62,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
62
62
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
+
|
|
65
66
|
if (syncViewsIds.length > 0) {
|
|
66
67
|
sendAction(
|
|
67
68
|
showMessage({
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Parses the UI5 version
|
|
8
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
9
|
-
* Returns x.xx for snapshot-x.xx
|
|
10
|
-
*
|
|
11
|
-
* @param version the UI5 version to parse
|
|
12
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
13
|
-
*/
|
|
14
|
-
function parseUI5Version(version) {
|
|
15
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
16
|
-
const major = parseInt(versionParts[0], 10);
|
|
17
|
-
const minor = parseInt(versionParts[1], 10);
|
|
18
|
-
return {
|
|
19
|
-
major,
|
|
20
|
-
minor
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Checks if the given version is lower than the required minimal version.
|
|
26
|
-
* @param version to check
|
|
27
|
-
* @param minVersion to check
|
|
28
|
-
*
|
|
29
|
-
* @returns boolean
|
|
30
|
-
*/
|
|
31
|
-
function isLowerThanMinimalUi5Version(version, minVersion) {
|
|
32
|
-
if (version && minVersion) {
|
|
33
|
-
const minVersionParsed = parseUI5Version(minVersion);
|
|
34
|
-
const ui5VersionParsed = parseUI5Version(version);
|
|
35
|
-
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
36
|
-
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get UI5 version validation message based on conditions.
|
|
49
|
-
* @param ui5Version to validate
|
|
50
|
-
* @returns string with validation message or undefined if non condition is met.
|
|
51
|
-
*/
|
|
52
|
-
function getUI5VersionValidationMessage(ui5Version) {
|
|
53
|
-
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
54
|
-
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`;
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
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
|
+
* Parses the UI5 version
|
|
8
|
+
* Returns NaN for snapshot or snapshot-untested
|
|
9
|
+
* Returns x.xx for snapshot-x.xx
|
|
10
|
+
*
|
|
11
|
+
* @param version the UI5 version to parse
|
|
12
|
+
* @returns The major and the minor version, e.g. 1.86
|
|
13
|
+
*/
|
|
14
|
+
function parseUI5Version(version) {
|
|
15
|
+
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
16
|
+
const major = parseInt(versionParts[0], 10);
|
|
17
|
+
const minor = parseInt(versionParts[1], 10);
|
|
18
|
+
return {
|
|
19
|
+
major,
|
|
20
|
+
minor
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the given version is lower than the required minimal version.
|
|
26
|
+
* @param version to check
|
|
27
|
+
* @param minVersion to check
|
|
28
|
+
*
|
|
29
|
+
* @returns boolean
|
|
30
|
+
*/
|
|
31
|
+
function isLowerThanMinimalUi5Version(version, minVersion) {
|
|
32
|
+
if (version && minVersion) {
|
|
33
|
+
const minVersionParsed = parseUI5Version(minVersion);
|
|
34
|
+
const ui5VersionParsed = parseUI5Version(version);
|
|
35
|
+
if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
|
|
36
|
+
if (ui5VersionParsed.major < minVersionParsed.major) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get UI5 version validation message based on conditions.
|
|
49
|
+
* @param ui5Version to validate
|
|
50
|
+
* @returns string with validation message or undefined if non condition is met.
|
|
51
|
+
*/
|
|
52
|
+
function getUI5VersionValidationMessage(ui5Version) {
|
|
53
|
+
if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
|
|
54
|
+
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`;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
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,63 +1,63 @@
|
|
|
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;
|
|
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;
|
|
62
62
|
});
|
|
63
63
|
//# 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(modifiedControl, 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(modifiedControl, 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
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define([], function () {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Function to validate if a given value is a valid binding model.
|
|
8
|
-
*
|
|
9
|
-
* @param modifiedControl control to be modified.
|
|
10
|
-
* @param value value to be checked.
|
|
11
|
-
*/
|
|
12
|
-
function validateBindingModel(modifiedControl, value) {
|
|
13
|
-
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
14
|
-
const bindingParts = bindingValue.split('>').filter(el => el !== '');
|
|
15
|
-
if (!bindingParts.length) {
|
|
16
|
-
throw new SyntaxError('Invalid binding string.');
|
|
17
|
-
}
|
|
18
|
-
if (bindingParts[0].trim() === 'i18n') {
|
|
19
|
-
if (bindingParts.length === 2) {
|
|
20
|
-
const resourceKey = bindingParts[1].trim();
|
|
21
|
-
const resourceBundle = modifiedControl.getModel('i18n').getResourceBundle();
|
|
22
|
-
if (!resourceBundle.getText(resourceKey, undefined, true)) {
|
|
23
|
-
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.');
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
throw new SyntaxError('Invalid binding string. Supported value pattern is {i18n>YOUR_KEY}');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
var __exports = {
|
|
31
|
-
__esModule: true
|
|
32
|
-
};
|
|
33
|
-
__exports.validateBindingModel = validateBindingModel;
|
|
34
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Function to validate if a given value is a valid binding model.
|
|
8
|
+
*
|
|
9
|
+
* @param modifiedControl control to be modified.
|
|
10
|
+
* @param value value to be checked.
|
|
11
|
+
*/
|
|
12
|
+
function validateBindingModel(modifiedControl, value) {
|
|
13
|
+
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
14
|
+
const bindingParts = bindingValue.split('>').filter(el => el !== '');
|
|
15
|
+
if (!bindingParts.length) {
|
|
16
|
+
throw new SyntaxError('Invalid binding string.');
|
|
17
|
+
}
|
|
18
|
+
if (bindingParts[0].trim() === 'i18n') {
|
|
19
|
+
if (bindingParts.length === 2) {
|
|
20
|
+
const resourceKey = bindingParts[1].trim();
|
|
21
|
+
const resourceBundle = modifiedControl.getModel('i18n').getResourceBundle();
|
|
22
|
+
if (!resourceBundle.getText(resourceKey, undefined, true)) {
|
|
23
|
+
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.');
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
throw new SyntaxError('Invalid binding string. Supported value pattern is {i18n>YOUR_KEY}');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var __exports = {
|
|
31
|
+
__esModule: true
|
|
32
|
+
};
|
|
33
|
+
__exports.validateBindingModel = validateBindingModel;
|
|
34
|
+
return __exports;
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=validator.js.map
|