@sap-ux/preview-middleware 0.18.18 → 0.18.20

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 (77) hide show
  1. package/dist/client/adp/api-handler.js +153 -153
  2. package/dist/client/adp/command-executor.js +75 -75
  3. package/dist/client/adp/control-utils.js +44 -44
  4. package/dist/client/adp/controllers/AddSubpage.controller.js +128 -0
  5. package/dist/client/adp/controllers/AddSubpage.controller.ts +195 -0
  6. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
  7. package/dist/client/adp/controllers/ControllerExtension.controller.js +209 -209
  8. package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
  9. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  10. package/dist/client/adp/dialog-factory.js +133 -125
  11. package/dist/client/adp/dialog-factory.ts +17 -3
  12. package/dist/client/adp/init-dialogs.js +107 -107
  13. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
  14. package/dist/client/adp/quick-actions/common/add-new-subpage.js +140 -0
  15. package/dist/client/adp/quick-actions/common/add-new-subpage.ts +164 -0
  16. package/dist/client/adp/quick-actions/common/create-page-action.js +51 -51
  17. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
  18. package/dist/client/adp/quick-actions/common/op-add-header-field.js +61 -61
  19. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  20. package/dist/client/adp/quick-actions/control-types.js +21 -21
  21. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  22. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  23. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  24. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +104 -104
  25. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
  26. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  27. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  28. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  29. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
  30. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  31. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
  32. package/dist/client/adp/quick-actions/fe-v2/registry.js +76 -75
  33. package/dist/client/adp/quick-actions/fe-v2/registry.ts +7 -3
  34. package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
  35. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
  36. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +50 -50
  37. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
  38. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  39. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
  40. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
  41. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
  42. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  43. package/dist/client/adp/quick-actions/fe-v4/registry.js +58 -58
  44. package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
  45. package/dist/client/adp/quick-actions/load.js +44 -44
  46. package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
  47. package/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
  48. package/dist/client/adp/utils.js +160 -160
  49. package/dist/client/cpe/changes/index.js +10 -10
  50. package/dist/client/cpe/changes/validator.js +39 -39
  51. package/dist/client/cpe/documentation.js +164 -164
  52. package/dist/client/cpe/feature-service.js +36 -36
  53. package/dist/client/cpe/logger.js +30 -30
  54. package/dist/client/cpe/outline/editable.js +37 -37
  55. package/dist/client/cpe/outline/nodes.js +222 -222
  56. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  57. package/dist/client/cpe/quick-actions/registry.js +143 -143
  58. package/dist/client/cpe/quick-actions/utils.js +92 -92
  59. package/dist/client/cpe/types.js +4 -4
  60. package/dist/client/cpe/ui5-utils.js +33 -33
  61. package/dist/client/cpe/utils.js +138 -138
  62. package/dist/client/flp/WorkspaceConnector.js +86 -86
  63. package/dist/client/flp/common.js +28 -28
  64. package/dist/client/flp/enableFakeConnector.js +83 -83
  65. package/dist/client/flp/initConnectors.js +28 -28
  66. package/dist/client/flp/initRta.js +178 -178
  67. package/dist/client/i18n.js +56 -56
  68. package/dist/client/messagebundle.properties +6 -0
  69. package/dist/client/utils/application.js +32 -32
  70. package/dist/client/utils/core.js +68 -68
  71. package/dist/client/utils/error.js +19 -19
  72. package/dist/client/utils/fe-v2.js +58 -0
  73. package/dist/client/utils/fe-v2.ts +63 -0
  74. package/dist/client/utils/fe-v4.js +141 -118
  75. package/dist/client/utils/fe-v4.ts +19 -0
  76. package/dist/client/utils/version.js +104 -104
  77. package/package.json +8 -8
@@ -1,55 +1,55 @@
1
- "use strict";
2
-
3
- sap.ui.define([], function () {
4
- "use strict";
5
-
6
- /**
7
- * Base class for all quick actions.
8
- */
9
- class QuickActionDefinitionBase {
10
- get id() {
11
- return `${this.context.key}-${this.type}`;
12
- }
13
-
14
- /**
15
- * Quick Actions tooltip.
16
- */
17
- get tooltip() {
18
- if (this.validationResult) {
19
- const validationErrors = this.validationResult.filter(result => result?.type === 'error');
20
- if (validationErrors.length > 0) {
21
- const error = validationErrors[0];
22
- return error.message;
23
- }
24
- }
25
- return undefined;
26
- }
27
- get isDisabled() {
28
- if (this.validationResult === undefined) {
29
- return false;
30
- }
31
- const validationErrors = this.validationResult.filter(result => result?.type === 'error');
32
- return validationErrors.length > 0;
33
- }
34
- get textKey() {
35
- return this.defaultTextKey;
36
- }
37
- constructor(type, kind, defaultTextKey, context) {
38
- let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
39
- this.type = type;
40
- this.kind = kind;
41
- this.defaultTextKey = defaultTextKey;
42
- this.context = context;
43
- this.enablementValidators = enablementValidators;
44
- }
45
- async runEnablementValidators() {
46
- this.validationResult = await Promise.all(this.enablementValidators.map(async validator => await validator.run()));
47
- }
48
- }
49
- var __exports = {
50
- __esModule: true
51
- };
52
- __exports.QuickActionDefinitionBase = QuickActionDefinitionBase;
53
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Base class for all quick actions.
8
+ */
9
+ class QuickActionDefinitionBase {
10
+ get id() {
11
+ return `${this.context.key}-${this.type}`;
12
+ }
13
+
14
+ /**
15
+ * Quick Actions tooltip.
16
+ */
17
+ get tooltip() {
18
+ if (this.validationResult) {
19
+ const validationErrors = this.validationResult.filter(result => result?.type === 'error');
20
+ if (validationErrors.length > 0) {
21
+ const error = validationErrors[0];
22
+ return error.message;
23
+ }
24
+ }
25
+ return undefined;
26
+ }
27
+ get isDisabled() {
28
+ if (this.validationResult === undefined) {
29
+ return false;
30
+ }
31
+ const validationErrors = this.validationResult.filter(result => result?.type === 'error');
32
+ return validationErrors.length > 0;
33
+ }
34
+ get textKey() {
35
+ return this.defaultTextKey;
36
+ }
37
+ constructor(type, kind, defaultTextKey, context) {
38
+ let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
39
+ this.type = type;
40
+ this.kind = kind;
41
+ this.defaultTextKey = defaultTextKey;
42
+ this.context = context;
43
+ this.enablementValidators = enablementValidators;
44
+ }
45
+ async runEnablementValidators() {
46
+ this.validationResult = await Promise.all(this.enablementValidators.map(async validator => await validator.run()));
47
+ }
48
+ }
49
+ var __exports = {
50
+ __esModule: true
51
+ };
52
+ __exports.QuickActionDefinitionBase = QuickActionDefinitionBase;
53
+ return __exports;
54
54
  });
55
55
  //# sourceMappingURL=quick-action-base.js.map
@@ -0,0 +1,73 @@
1
+ <Dialog
2
+ id="addSubpageDialog"
3
+ xmlns="sap.m"
4
+ xmlns:core="sap.ui.core"
5
+ xmlns:l="sap.ui.layout"
6
+ xmlns:f="sap.ui.layout.form"
7
+ title="{/title}"
8
+ contentWidth="500px"
9
+ initialFocus="aggregationName"
10
+ class="sapUiRTABorder"
11
+ >
12
+ <content>
13
+ <f:SimpleForm
14
+ id="addSubpageDialog_Form"
15
+ editable="true"
16
+ layout="ResponsiveGridLayout"
17
+ labelSpanS="4"
18
+ singleContainerFullSize="false"
19
+ >
20
+ <f:content>
21
+ <Label text="{i18n>ADP_ADD_SUB_PAGE_DIALOG_PAGE_TYPE_LABEL}" />
22
+ <Select
23
+ id="pageType"
24
+ change="onPageTypeChange"
25
+ selectedKey="{/selectedPageType/key}"
26
+ editable="false"
27
+ items="{
28
+ path: '/pageTypeOptions',
29
+ sorter: { path: 'text' }
30
+ }"
31
+ >
32
+ <core:Item
33
+ key="{key}"
34
+ text="{value}"
35
+ />
36
+ </Select>
37
+ <Label text="{i18n>ADP_ADD_SUB_PAGE_DIALOG_NAVIGATION_LABEL}" />
38
+ <Select
39
+ id="navigation"
40
+ visible="true"
41
+ change="onNavigationChange"
42
+ selectedKey="{/selectedNavigation/key}"
43
+ items="{
44
+ path: '/navigationOptions',
45
+ sorter: { path: 'text' }
46
+ }"
47
+ >
48
+ <core:Item
49
+ key="{key}"
50
+ text="{value}"
51
+ />
52
+ </Select>
53
+ </f:content>
54
+ </f:SimpleForm>
55
+ </content>
56
+ <beginButton>
57
+ <Button
58
+ id="createDialogBtn"
59
+ text="{i18n>CREATE_BUTTON_LABEL}"
60
+ press="onCreateBtnPress"
61
+ enabled="true"
62
+ type="Emphasized"
63
+ />
64
+ </beginButton>
65
+ <endButton>
66
+ <Button
67
+ id="closeDialogBtn"
68
+ text="{i18n>CANCEL_BUTTON_LABEL}"
69
+ press="handleDialogClose"
70
+ type="Reject"
71
+ />
72
+ </endButton>
73
+ </Dialog>
@@ -1,162 +1,162 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_error, ___utils_version) {
4
- "use strict";
5
-
6
- function __ui5_require_async(path) {
7
- return new Promise(function (resolve, reject) {
8
- sap.ui.require([path], function (module) {
9
- if (!(module && module.__esModule)) {
10
- module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
- default: module
12
- } : module;
13
- Object.defineProperty(module, "__esModule", {
14
- value: true
15
- });
16
- }
17
- resolve(module);
18
- }, function (err) {
19
- reject(err);
20
- });
21
- });
22
- }
23
- const getError = ___utils_error["getError"];
24
- const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
25
- /**
26
- * Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
27
- *
28
- * @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
29
- *
30
- * @returns {Deferred} Deferred object
31
- */
32
- function createDeferred() {
33
- let resolve = null;
34
- let reject = null;
35
- const promise = new Promise((res, rej) => {
36
- resolve = res;
37
- reject = rej;
38
- });
39
- if (resolve === null || reject === null) {
40
- throw new Error('Failed to initialize resolve and reject functions.');
41
- }
42
- return {
43
- promise,
44
- resolve,
45
- reject
46
- };
47
- }
48
-
49
- /**
50
- * Checks if the fragment name associated with a command matches the specified fragment name.
51
- *
52
- * @param {FlexCommand} command - The command object containing the prepared change to be examined.
53
- * @param {string} fragmentName - The name of the fragment to match against the command's change.
54
- * @returns {boolean} Returns true if the command's change contains a fragment path that matches
55
- * the specified fragment name; otherwise, returns false.
56
- */
57
- function matchesFragmentName(command, fragmentName) {
58
- if (typeof command.getPreparedChange !== 'function') {
59
- return false;
60
- }
61
- const change = command.getPreparedChange().getDefinition();
62
- return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
63
- }
64
-
65
- /**
66
- * Displays a message to the user indicating that an XML fragment will be created upon saving a change.
67
- *
68
- * @param {string} message - The message to be shown in the message toast.
69
- * @param {number} duration - The duration during which message toast will be active.
70
- */
71
- function notifyUser(message) {
72
- let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
73
- MessageToast.show(message, {
74
- duration
75
- });
76
- }
77
-
78
- /**
79
- * Check if element is sync view
80
- *
81
- * @param element Design time Element
82
- * @returns boolean if element is sync view or not
83
- */
84
- function isSyncView(element) {
85
- return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
86
- }
87
-
88
- /**
89
- * Get Ids for all sync views
90
- *
91
- * @param ui5VersionInfo UI5 Version Information
92
- *
93
- * @returns array of Ids for application sync views
94
- */
95
- async function getAllSyncViewsIds(ui5VersionInfo) {
96
- const syncViewIds = [];
97
- try {
98
- if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
99
- major: 1,
100
- minor: 120
101
- })) {
102
- const elements = Element.registry.filter(() => true);
103
- elements.forEach(ui5Element => {
104
- if (isSyncView(ui5Element)) {
105
- syncViewIds.push(ui5Element.getId());
106
- }
107
- });
108
- } else {
109
- const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
110
- const elements = ElementRegistry.all();
111
- Object.entries(elements).forEach(_ref => {
112
- let [key, ui5Element] = _ref;
113
- if (isSyncView(ui5Element)) {
114
- syncViewIds.push(key);
115
- }
116
- });
117
- }
118
- } catch (error) {
119
- Log.error('Could not get application sync views', getError(error));
120
- }
121
- return syncViewIds;
122
- }
123
- /**
124
- * Gets controller name and view ID for the given UI5 control.
125
- *
126
- * @param control UI5 control.
127
- * @returns The controller name and view ID.
128
- */
129
-
130
- function getControllerInfoForControl(control) {
131
- const view = FlexUtils.getViewForControl(control);
132
- const controllerName = view.getController().getMetadata().getName();
133
- const viewId = view.getId();
134
- return {
135
- controllerName,
136
- viewId
137
- };
138
- }
139
-
140
- /**
141
- * Gets controller name and view ID for the given overlay control.
142
- *
143
- * @param overlayControl The overlay control.
144
- * @returns The controller name and view ID.
145
- */
146
-
147
- function getControllerInfo(overlayControl) {
148
- const control = overlayControl.getElement();
149
- return getControllerInfoForControl(control);
150
- }
151
- var __exports = {
152
- __esModule: true
153
- };
154
- __exports.createDeferred = createDeferred;
155
- __exports.matchesFragmentName = matchesFragmentName;
156
- __exports.notifyUser = notifyUser;
157
- __exports.getAllSyncViewsIds = getAllSyncViewsIds;
158
- __exports.getControllerInfoForControl = getControllerInfoForControl;
159
- __exports.getControllerInfo = getControllerInfo;
160
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_error, ___utils_version) {
4
+ "use strict";
5
+
6
+ function __ui5_require_async(path) {
7
+ return new Promise(function (resolve, reject) {
8
+ sap.ui.require([path], function (module) {
9
+ if (!(module && module.__esModule)) {
10
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
+ default: module
12
+ } : module;
13
+ Object.defineProperty(module, "__esModule", {
14
+ value: true
15
+ });
16
+ }
17
+ resolve(module);
18
+ }, function (err) {
19
+ reject(err);
20
+ });
21
+ });
22
+ }
23
+ const getError = ___utils_error["getError"];
24
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
25
+ /**
26
+ * Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
27
+ *
28
+ * @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
29
+ *
30
+ * @returns {Deferred} Deferred object
31
+ */
32
+ function createDeferred() {
33
+ let resolve = null;
34
+ let reject = null;
35
+ const promise = new Promise((res, rej) => {
36
+ resolve = res;
37
+ reject = rej;
38
+ });
39
+ if (resolve === null || reject === null) {
40
+ throw new Error('Failed to initialize resolve and reject functions.');
41
+ }
42
+ return {
43
+ promise,
44
+ resolve,
45
+ reject
46
+ };
47
+ }
48
+
49
+ /**
50
+ * Checks if the fragment name associated with a command matches the specified fragment name.
51
+ *
52
+ * @param {FlexCommand} command - The command object containing the prepared change to be examined.
53
+ * @param {string} fragmentName - The name of the fragment to match against the command's change.
54
+ * @returns {boolean} Returns true if the command's change contains a fragment path that matches
55
+ * the specified fragment name; otherwise, returns false.
56
+ */
57
+ function matchesFragmentName(command, fragmentName) {
58
+ if (typeof command.getPreparedChange !== 'function') {
59
+ return false;
60
+ }
61
+ const change = command.getPreparedChange().getDefinition();
62
+ return change.content?.fragmentPath?.includes(`${fragmentName}.fragment.xml`) || false;
63
+ }
64
+
65
+ /**
66
+ * Displays a message to the user indicating that an XML fragment will be created upon saving a change.
67
+ *
68
+ * @param {string} message - The message to be shown in the message toast.
69
+ * @param {number} duration - The duration during which message toast will be active.
70
+ */
71
+ function notifyUser(message) {
72
+ let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
73
+ MessageToast.show(message, {
74
+ duration
75
+ });
76
+ }
77
+
78
+ /**
79
+ * Check if element is sync view
80
+ *
81
+ * @param element Design time Element
82
+ * @returns boolean if element is sync view or not
83
+ */
84
+ function isSyncView(element) {
85
+ return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
86
+ }
87
+
88
+ /**
89
+ * Get Ids for all sync views
90
+ *
91
+ * @param ui5VersionInfo UI5 Version Information
92
+ *
93
+ * @returns array of Ids for application sync views
94
+ */
95
+ async function getAllSyncViewsIds(ui5VersionInfo) {
96
+ const syncViewIds = [];
97
+ try {
98
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
99
+ major: 1,
100
+ minor: 120
101
+ })) {
102
+ const elements = Element.registry.filter(() => true);
103
+ elements.forEach(ui5Element => {
104
+ if (isSyncView(ui5Element)) {
105
+ syncViewIds.push(ui5Element.getId());
106
+ }
107
+ });
108
+ } else {
109
+ const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
110
+ const elements = ElementRegistry.all();
111
+ Object.entries(elements).forEach(_ref => {
112
+ let [key, ui5Element] = _ref;
113
+ if (isSyncView(ui5Element)) {
114
+ syncViewIds.push(key);
115
+ }
116
+ });
117
+ }
118
+ } catch (error) {
119
+ Log.error('Could not get application sync views', getError(error));
120
+ }
121
+ return syncViewIds;
122
+ }
123
+ /**
124
+ * Gets controller name and view ID for the given UI5 control.
125
+ *
126
+ * @param control UI5 control.
127
+ * @returns The controller name and view ID.
128
+ */
129
+
130
+ function getControllerInfoForControl(control) {
131
+ const view = FlexUtils.getViewForControl(control);
132
+ const controllerName = view.getController().getMetadata().getName();
133
+ const viewId = view.getId();
134
+ return {
135
+ controllerName,
136
+ viewId
137
+ };
138
+ }
139
+
140
+ /**
141
+ * Gets controller name and view ID for the given overlay control.
142
+ *
143
+ * @param overlayControl The overlay control.
144
+ * @returns The controller name and view ID.
145
+ */
146
+
147
+ function getControllerInfo(overlayControl) {
148
+ const control = overlayControl.getElement();
149
+ return getControllerInfoForControl(control);
150
+ }
151
+ var __exports = {
152
+ __esModule: true
153
+ };
154
+ __exports.createDeferred = createDeferred;
155
+ __exports.matchesFragmentName = matchesFragmentName;
156
+ __exports.notifyUser = notifyUser;
157
+ __exports.getAllSyncViewsIds = getAllSyncViewsIds;
158
+ __exports.getControllerInfoForControl = getControllerInfoForControl;
159
+ __exports.getControllerInfo = getControllerInfo;
160
+ return __exports;
161
161
  });
162
162
  //# sourceMappingURL=utils.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,41 +1,41 @@
1
- "use strict";
2
-
3
- sap.ui.define(["../../i18n"], function (____i18n) {
4
- "use strict";
5
-
6
- const getTextBundle = ____i18n["getTextBundle"];
7
- /**
8
- * Function to validate if a given value is a valid binding model.
9
- *
10
- * @param modifiedControl control to be modified.
11
- * @param value value to be checked.
12
- */
13
- async function validateBindingModel(modifiedControl, value) {
14
- const textBundle = await getTextBundle();
15
- const bindingValue = value.replace(/[{}]/gi, '').trim();
16
- const bindingParts = bindingValue.split('>').filter(el => el !== '');
17
- if (!bindingParts.length) {
18
- throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING'));
19
- }
20
- if (bindingParts.length === 2) {
21
- const bindingModel = bindingParts[0];
22
- const resourceKey = bindingParts[1].trim();
23
- const resourceModel = modifiedControl.getModel(bindingModel);
24
- if (!resourceModel) {
25
- throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL'));
26
- }
27
- const resourceBundle = resourceModel.getResourceBundle();
28
- if (!resourceBundle.getText(resourceKey, undefined, true)) {
29
- throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL_KEY'));
30
- }
31
- } else {
32
- throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING_FORMAT'));
33
- }
34
- }
35
- var __exports = {
36
- __esModule: true
37
- };
38
- __exports.validateBindingModel = validateBindingModel;
39
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../i18n"], function (____i18n) {
4
+ "use strict";
5
+
6
+ const getTextBundle = ____i18n["getTextBundle"];
7
+ /**
8
+ * Function to validate if a given value is a valid binding model.
9
+ *
10
+ * @param modifiedControl control to be modified.
11
+ * @param value value to be checked.
12
+ */
13
+ async function validateBindingModel(modifiedControl, value) {
14
+ const textBundle = await getTextBundle();
15
+ const bindingValue = value.replace(/[{}]/gi, '').trim();
16
+ const bindingParts = bindingValue.split('>').filter(el => el !== '');
17
+ if (!bindingParts.length) {
18
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING'));
19
+ }
20
+ if (bindingParts.length === 2) {
21
+ const bindingModel = bindingParts[0];
22
+ const resourceKey = bindingParts[1].trim();
23
+ const resourceModel = modifiedControl.getModel(bindingModel);
24
+ if (!resourceModel) {
25
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL'));
26
+ }
27
+ const resourceBundle = resourceModel.getResourceBundle();
28
+ if (!resourceBundle.getText(resourceKey, undefined, true)) {
29
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_MODEL_KEY'));
30
+ }
31
+ } else {
32
+ throw new SyntaxError(textBundle.getText('INVALID_BINDING_STRING_FORMAT'));
33
+ }
34
+ }
35
+ var __exports = {
36
+ __esModule: true
37
+ };
38
+ __exports.validateBindingModel = validateBindingModel;
39
+ return __exports;
40
40
  });
41
41
  //# sourceMappingURL=validator.js.map