@sap-ux/preview-middleware 0.13.7 → 0.13.9

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.
Files changed (41) hide show
  1. package/dist/client/adp/api-handler.js +141 -141
  2. package/dist/client/adp/api-handler.ts +2 -2
  3. package/dist/client/adp/command-executor.js +54 -54
  4. package/dist/client/adp/control-utils.js +44 -44
  5. package/dist/client/adp/controllers/AddFragment.controller.js +206 -206
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +57 -57
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +179 -179
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +100 -100
  9. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +2 -2
  10. package/dist/client/adp/init-dialogs.js +74 -74
  11. package/dist/client/adp/init.js +1 -1
  12. package/dist/client/adp/init.ts +1 -1
  13. package/dist/client/adp/ui5-version-utils.js +63 -63
  14. package/dist/client/adp/utils.js +33 -33
  15. package/dist/client/cpe/changes/flex-change.js +51 -51
  16. package/dist/client/cpe/changes/index.js +10 -10
  17. package/dist/client/cpe/changes/service.ts +3 -1
  18. package/dist/client/cpe/changes/validator.js +35 -35
  19. package/dist/client/cpe/control-data.ts +1 -0
  20. package/dist/client/cpe/documentation.js +164 -164
  21. package/dist/client/cpe/documentation.ts +5 -3
  22. package/dist/client/cpe/logger.js +30 -30
  23. package/dist/client/cpe/logger.ts +1 -1
  24. package/dist/client/cpe/outline/nodes.js +84 -84
  25. package/dist/client/cpe/outline/nodes.ts +1 -1
  26. package/dist/client/cpe/outline/utils.js +37 -37
  27. package/dist/client/cpe/selection.js +1 -1
  28. package/dist/client/cpe/selection.ts +3 -1
  29. package/dist/client/cpe/types.js +4 -4
  30. package/dist/client/cpe/ui5-utils.js +49 -49
  31. package/dist/client/cpe/utils.js +48 -48
  32. package/dist/client/flp/WorkspaceConnector.js +84 -84
  33. package/dist/client/flp/WorkspaceConnector.ts +2 -2
  34. package/dist/client/flp/common.js +28 -28
  35. package/dist/client/flp/common.ts +2 -2
  36. package/dist/client/flp/enableFakeConnector.js +77 -77
  37. package/dist/client/flp/init.js +220 -220
  38. package/dist/client/flp/initConnectors.js +33 -33
  39. package/dist/client/flp/initRta.js +178 -178
  40. package/package.json +4 -4
  41. package/templates/test/qunit.js +6 -4
@@ -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
@@ -52,7 +52,7 @@ sap.ui.define([
52
52
  const extPointService = new ExtensionPointService(rta);
53
53
  extPointService.init(subscribe);
54
54
  }
55
- init(rta);
55
+ await init(rta);
56
56
  const ui5VersionValidationMsg = getUI5VersionValidationMessage(version);
57
57
  if (ui5VersionValidationMsg) {
58
58
  sendAction(showMessage(ui5VersionValidationMsg));
@@ -51,7 +51,7 @@ export default async function (rta: RuntimeAuthoring) {
51
51
  }
52
52
 
53
53
  // also initialize the editor
54
- init(rta);
54
+ await init(rta);
55
55
 
56
56
  const ui5VersionValidationMsg = getUI5VersionValidationMessage(version);
57
57
 
@@ -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
@@ -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
@@ -120,6 +120,7 @@ export class ChangeService {
120
120
  if (control) {
121
121
  name = control.getMetadata().getName();
122
122
  }
123
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
123
124
  const modifiedMessage = modifyRTAErrorMessage(exception?.toString(), id, name);
124
125
  const errorMessage =
125
126
  modifiedMessage || `RTA Exception applying expression "${action.payload.value}"`;
@@ -379,9 +380,10 @@ export class ChangeService {
379
380
  private getCommandSelectorId(command: FlexCommand): string | undefined {
380
381
  return this.retryOperations([
381
382
  () => command.getSelector().id,
383
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
382
384
  () => command.getElement().getProperty('persistencyKey'),
383
385
  () => command.getElement().getId(),
384
386
  () => command.getParent()?.getElement().getId()
385
- ]);
387
+ ]) as string | undefined;
386
388
  }
387
389
  }
@@ -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
@@ -102,6 +102,7 @@ function analyzePropertyType(property: ManagedObjectMetadataProperties): Analyze
102
102
  if (propertyDataType && !(propertyDataType instanceof DataType)) {
103
103
  return analyzedType;
104
104
  }
105
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
105
106
  const name = Object.getPrototypeOf(propertyDataType).getName();
106
107
  if (!name) {
107
108
  analyzedType.primitiveType = 'enum';