@sap-ux/preview-middleware 0.20.0 → 0.20.2
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/client/adp/add-fragment.js +46 -46
- package/dist/client/adp/api-handler.js +159 -159
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/command-executor.ts +4 -4
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddFragment.controller.js +1 -1
- package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +1 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +2 -2
- package/dist/client/adp/controllers/BaseDialog.controller.js +2 -13
- package/dist/client/adp/controllers/BaseDialog.controller.ts +7 -25
- package/dist/client/adp/controllers/ControllerExtension.controller.js +268 -210
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +110 -22
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +139 -139
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +135 -135
- package/dist/client/adp/dialog-factory.ts +3 -1
- package/dist/client/adp/extend-controller.js +48 -0
- package/dist/client/adp/extend-controller.ts +49 -0
- package/dist/client/adp/init-dialogs.js +143 -163
- package/dist/client/adp/init-dialogs.ts +42 -20
- package/dist/client/adp/init.js +9 -1
- package/dist/client/adp/init.ts +6 -1
- package/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +96 -96
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -60
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +25 -3
- package/dist/client/adp/quick-actions/common/create-page-action.js +54 -54
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +39 -39
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +67 -67
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +23 -23
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
- package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
- package/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +81 -81
- package/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +67 -67
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +107 -107
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +99 -99
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
- package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +59 -59
- package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
- package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +84 -84
- package/dist/client/adp/quick-actions/fe-v2/registry.js +77 -77
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +138 -138
- package/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +79 -79
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +75 -75
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +49 -49
- package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +56 -56
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -84
- package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +53 -53
- package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
- package/dist/client/adp/quick-actions/fe-v4/registry.js +60 -60
- package/dist/client/adp/quick-actions/fe-v4/utils.js +72 -72
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +64 -64
- package/dist/client/adp/ui/ControllerExtension.fragment.xml +14 -3
- package/dist/client/adp/utils.js +259 -218
- package/dist/client/adp/utils.ts +55 -7
- package/dist/client/cpe/additional-change-info/add-xml-additional-info.js +75 -75
- package/dist/client/cpe/changes/generic-change.js +326 -326
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- package/dist/client/cpe/connector-service.ts +1 -0
- package/dist/client/cpe/documentation.js +164 -164
- package/dist/client/cpe/feature-service.js +36 -36
- package/dist/client/cpe/logger.js +30 -30
- package/dist/client/cpe/outline/editable.js +37 -37
- package/dist/client/cpe/outline/nodes.js +203 -203
- package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
- package/dist/client/cpe/quick-actions/registry.js +143 -143
- package/dist/client/cpe/quick-actions/utils.js +92 -92
- package/dist/client/cpe/types.js +4 -4
- package/dist/client/cpe/ui5-utils.js +33 -33
- package/dist/client/cpe/utils.js +111 -111
- package/dist/client/flp/WorkspaceConnector.js +92 -92
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +89 -89
- package/dist/client/flp/homepage/Component.js +14 -14
- package/dist/client/flp/initCdm.js +117 -117
- package/dist/client/flp/initConnectors.js +28 -28
- package/dist/client/flp/initRta.js +178 -178
- package/dist/client/i18n.js +56 -56
- package/dist/client/messagebundle.properties +5 -0
- package/dist/client/utils/additional-change-info.js +54 -54
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +84 -84
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +56 -56
- package/dist/client/utils/fe-v4.js +140 -140
- package/dist/client/utils/version.js +104 -104
- package/package.json +4 -4
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["./dialog-enablement-validator"], function (___dialog_enablement_validator) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
7
|
-
/**
|
|
8
|
-
* Base class for all quick actions.
|
|
9
|
-
*/
|
|
10
|
-
class QuickActionDefinitionBase {
|
|
11
|
-
get id() {
|
|
12
|
-
return `${this.context.key}-${this.type}`;
|
|
13
|
-
}
|
|
14
|
-
getTelemetryIdentifier() {
|
|
15
|
-
let update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
-
if (update === true) {
|
|
17
|
-
this.telemetryIdentifier = new Date().toISOString();
|
|
18
|
-
}
|
|
19
|
-
return this.telemetryIdentifier;
|
|
20
|
-
}
|
|
21
|
-
get quickActionSteps() {
|
|
22
|
-
return this.enablementValidators.find(item => item === DIALOG_ENABLEMENT_VALIDATOR) ? 2 : 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Quick Actions tooltip.
|
|
27
|
-
*/
|
|
28
|
-
get tooltip() {
|
|
29
|
-
if (this.validationResult) {
|
|
30
|
-
const validationErrors = this.validationResult.filter(result => result?.type === 'error');
|
|
31
|
-
if (validationErrors.length > 0) {
|
|
32
|
-
const error = validationErrors[0];
|
|
33
|
-
return error.message;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
get isDisabled() {
|
|
39
|
-
if (this.validationResult === undefined) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
const validationErrors = this.validationResult.filter(result => result?.type === 'error');
|
|
43
|
-
return validationErrors.length > 0;
|
|
44
|
-
}
|
|
45
|
-
get textKey() {
|
|
46
|
-
return this.defaultTextKey;
|
|
47
|
-
}
|
|
48
|
-
constructor(type, kind, defaultTextKey, context) {
|
|
49
|
-
let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
50
|
-
this.type = type;
|
|
51
|
-
this.kind = kind;
|
|
52
|
-
this.defaultTextKey = defaultTextKey;
|
|
53
|
-
this.context = context;
|
|
54
|
-
this.enablementValidators = enablementValidators;
|
|
55
|
-
}
|
|
56
|
-
async runEnablementValidators() {
|
|
57
|
-
this.validationResult = await Promise.all(this.enablementValidators.map(async validator => await validator.run()));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
var __exports = {
|
|
61
|
-
__esModule: true
|
|
62
|
-
};
|
|
63
|
-
__exports.QuickActionDefinitionBase = QuickActionDefinitionBase;
|
|
64
|
-
return __exports;
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./dialog-enablement-validator"], function (___dialog_enablement_validator) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
7
|
+
/**
|
|
8
|
+
* Base class for all quick actions.
|
|
9
|
+
*/
|
|
10
|
+
class QuickActionDefinitionBase {
|
|
11
|
+
get id() {
|
|
12
|
+
return `${this.context.key}-${this.type}`;
|
|
13
|
+
}
|
|
14
|
+
getTelemetryIdentifier() {
|
|
15
|
+
let update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
16
|
+
if (update === true) {
|
|
17
|
+
this.telemetryIdentifier = new Date().toISOString();
|
|
18
|
+
}
|
|
19
|
+
return this.telemetryIdentifier;
|
|
20
|
+
}
|
|
21
|
+
get quickActionSteps() {
|
|
22
|
+
return this.enablementValidators.find(item => item === DIALOG_ENABLEMENT_VALIDATOR) ? 2 : 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Quick Actions tooltip.
|
|
27
|
+
*/
|
|
28
|
+
get tooltip() {
|
|
29
|
+
if (this.validationResult) {
|
|
30
|
+
const validationErrors = this.validationResult.filter(result => result?.type === 'error');
|
|
31
|
+
if (validationErrors.length > 0) {
|
|
32
|
+
const error = validationErrors[0];
|
|
33
|
+
return error.message;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
get isDisabled() {
|
|
39
|
+
if (this.validationResult === undefined) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const validationErrors = this.validationResult.filter(result => result?.type === 'error');
|
|
43
|
+
return validationErrors.length > 0;
|
|
44
|
+
}
|
|
45
|
+
get textKey() {
|
|
46
|
+
return this.defaultTextKey;
|
|
47
|
+
}
|
|
48
|
+
constructor(type, kind, defaultTextKey, context) {
|
|
49
|
+
let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
|
|
50
|
+
this.type = type;
|
|
51
|
+
this.kind = kind;
|
|
52
|
+
this.defaultTextKey = defaultTextKey;
|
|
53
|
+
this.context = context;
|
|
54
|
+
this.enablementValidators = enablementValidators;
|
|
55
|
+
}
|
|
56
|
+
async runEnablementValidators() {
|
|
57
|
+
this.validationResult = await Promise.all(this.enablementValidators.map(async validator => await validator.run()));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
var __exports = {
|
|
61
|
+
__esModule: true
|
|
62
|
+
};
|
|
63
|
+
__exports.QuickActionDefinitionBase = QuickActionDefinitionBase;
|
|
64
|
+
return __exports;
|
|
65
65
|
});
|
|
66
66
|
//# sourceMappingURL=quick-action-base.js.map
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
editable="true"
|
|
12
12
|
layout="ResponsiveGridLayout"
|
|
13
13
|
labelSpanS="4"
|
|
14
|
-
singleContainerFullSize="false"
|
|
14
|
+
singleContainerFullSize="false"
|
|
15
|
+
visible="{/inputFormVisibility}">
|
|
15
16
|
<f:content>
|
|
16
17
|
<Label text="Controller Name" />
|
|
17
18
|
<Input
|
|
@@ -26,13 +27,23 @@
|
|
|
26
27
|
editable="true"
|
|
27
28
|
layout="ResponsiveGridLayout"
|
|
28
29
|
labelSpanS="12"
|
|
29
|
-
visible="
|
|
30
|
+
visible="{/existingControllerFormVisibility}"
|
|
30
31
|
singleContainerFullSize="false">
|
|
31
32
|
<f:content>
|
|
32
|
-
<Label text="
|
|
33
|
+
<Label text="{i18n>ADP_CONTROLLER_EXTENSION_EXISTS}" />
|
|
33
34
|
<Text text="{/controllerPathFromRoot}" />
|
|
34
35
|
</f:content>
|
|
35
36
|
</f:SimpleForm>
|
|
37
|
+
<f:SimpleForm
|
|
38
|
+
editable="true"
|
|
39
|
+
layout="ResponsiveGridLayout"
|
|
40
|
+
labelSpanS="12"
|
|
41
|
+
visible="{/pendingChangeFormVisibility}"
|
|
42
|
+
singleContainerFullSize="false">
|
|
43
|
+
<f:content>
|
|
44
|
+
<Text text="{i18n>ADP_CONTROLLER_PENDING_CHANGE_EXISTS}" />
|
|
45
|
+
</f:content>
|
|
46
|
+
</f:SimpleForm>
|
|
36
47
|
</content>
|
|
37
48
|
<beginButton>
|
|
38
49
|
<Button
|
package/dist/client/adp/utils.js
CHANGED
|
@@ -1,220 +1,261 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/core", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_core, ___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 getControlById = ___utils_core["getControlById"];
|
|
24
|
-
const getError = ___utils_error["getError"];
|
|
25
|
-
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
26
|
-
let reuseComponentChecker;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Resets the reuse component checker.
|
|
30
|
-
*/
|
|
31
|
-
function resetReuseComponentChecker() {
|
|
32
|
-
reuseComponentChecker = undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
37
|
-
*
|
|
38
|
-
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Deferred} Deferred object
|
|
41
|
-
*/
|
|
42
|
-
function createDeferred() {
|
|
43
|
-
let resolve = null;
|
|
44
|
-
let reject = null;
|
|
45
|
-
const promise = new Promise((res, rej) => {
|
|
46
|
-
resolve = res;
|
|
47
|
-
reject = rej;
|
|
48
|
-
});
|
|
49
|
-
if (resolve === null || reject === null) {
|
|
50
|
-
throw new Error('Failed to initialize resolve and reject functions.');
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
promise,
|
|
54
|
-
resolve,
|
|
55
|
-
reject
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Checks
|
|
61
|
-
*
|
|
62
|
-
* @param {
|
|
63
|
-
* @param {string}
|
|
64
|
-
* @
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/core", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_core, ___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 getControlById = ___utils_core["getControlById"];
|
|
24
|
+
const getError = ___utils_error["getError"];
|
|
25
|
+
const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
|
|
26
|
+
let reuseComponentChecker;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Resets the reuse component checker.
|
|
30
|
+
*/
|
|
31
|
+
function resetReuseComponentChecker() {
|
|
32
|
+
reuseComponentChecker = undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
|
|
37
|
+
*
|
|
38
|
+
* @description A Deferred object contains an unresolved promise along with the functions to resolve or reject that promise.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Deferred} Deferred object
|
|
41
|
+
*/
|
|
42
|
+
function createDeferred() {
|
|
43
|
+
let resolve = null;
|
|
44
|
+
let reject = null;
|
|
45
|
+
const promise = new Promise((res, rej) => {
|
|
46
|
+
resolve = res;
|
|
47
|
+
reject = rej;
|
|
48
|
+
});
|
|
49
|
+
if (resolve === null || reject === null) {
|
|
50
|
+
throw new Error('Failed to initialize resolve and reject functions.');
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
promise,
|
|
54
|
+
resolve,
|
|
55
|
+
reject
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Checks for the existence of a change associated with a specific fragment name in the RTA command stack.
|
|
61
|
+
*
|
|
62
|
+
* @param {RuntimeAuthoring} rta - The RuntimeAuthoring instance to check for existing changes.
|
|
63
|
+
* @param {string} commandName - The name of the fragment to check for existing changes.
|
|
64
|
+
* @param {string} propertyPath - The path to the property as string separated by dot in the change definition to check.
|
|
65
|
+
* @param {string} propertyValue - The value to match against the specified property.
|
|
66
|
+
* @returns {Promise<boolean>} A promise that resolves to `true` if a matching change is found, otherwise `false`.
|
|
67
|
+
*/
|
|
68
|
+
function checkForExistingChange(rta, commandName, propertyPath, propertyValue) {
|
|
69
|
+
const allCommands = rta.getCommandStack().getCommands();
|
|
70
|
+
return allCommands.some(command => {
|
|
71
|
+
if (typeof command.getCommands === 'function') {
|
|
72
|
+
const subCommand = command.getCommands().find(c => c?.getProperty('name') === commandName);
|
|
73
|
+
return subCommand && matchesChangeProperty(subCommand, propertyPath, propertyValue);
|
|
74
|
+
} else {
|
|
75
|
+
return matchesChangeProperty(command, propertyPath, propertyValue);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Retrieves the value of a nested property from an object based on a dot-separated path.
|
|
82
|
+
*
|
|
83
|
+
* @param obj - The object from which to retrieve the nested property.
|
|
84
|
+
* @param path - A dot-separated string representing the path to the desired property.
|
|
85
|
+
* For example, "a.b.c" will attempt to access `obj.a.b.c`.
|
|
86
|
+
* @returns The value of the nested property if it exists, or `undefined` if any part of the path is invalid.
|
|
87
|
+
*/
|
|
88
|
+
function getNestedProperty(obj, path) {
|
|
89
|
+
return path.split('.').reduce((acc, key) => {
|
|
90
|
+
return acc?.[key];
|
|
91
|
+
}, obj);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Checks if a specific property in the command's change matches the given value.
|
|
96
|
+
*
|
|
97
|
+
* @param {FlexCommand} command - The command object containing the prepared change to be examined.
|
|
98
|
+
* @param {string} propertyPath - The path to the property in the change definition to check.
|
|
99
|
+
* @param {string} propertyValue - The value to match against the specified property.
|
|
100
|
+
* @returns {boolean} Returns true if the command's change contains the specified property with the matching value; otherwise, returns false.
|
|
101
|
+
*/
|
|
102
|
+
function matchesChangeProperty(command, propertyPath, propertyValue) {
|
|
103
|
+
if (typeof command.getPreparedChange !== 'function') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const change = command.getPreparedChange()?.getDefinition?.();
|
|
107
|
+
if (!change) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
const nestedProperty = getNestedProperty(change, propertyPath);
|
|
111
|
+
return typeof nestedProperty === 'string' ? nestedProperty.includes(propertyValue) : false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Displays a message to the user indicating that an XML fragment will be created upon saving a change.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} message - The message to be shown in the message toast.
|
|
118
|
+
* @param {number} duration - The duration during which message toast will be active.
|
|
119
|
+
*/
|
|
120
|
+
function notifyUser(message) {
|
|
121
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
122
|
+
MessageToast.show(message, {
|
|
123
|
+
duration
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Check if element is sync view
|
|
129
|
+
*
|
|
130
|
+
* @param element Design time Element
|
|
131
|
+
* @returns boolean if element is sync view or not
|
|
132
|
+
*/
|
|
133
|
+
function isSyncView(element) {
|
|
134
|
+
return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get Ids for all sync views
|
|
139
|
+
*
|
|
140
|
+
* @param ui5VersionInfo UI5 Version Information
|
|
141
|
+
*
|
|
142
|
+
* @returns array of Ids for application sync views
|
|
143
|
+
*/
|
|
144
|
+
async function getAllSyncViewsIds(ui5VersionInfo) {
|
|
145
|
+
const syncViewIds = [];
|
|
146
|
+
try {
|
|
147
|
+
if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
148
|
+
major: 1,
|
|
149
|
+
minor: 120
|
|
150
|
+
})) {
|
|
151
|
+
const elements = Element.registry.filter(() => true);
|
|
152
|
+
elements.forEach(ui5Element => {
|
|
153
|
+
if (isSyncView(ui5Element)) {
|
|
154
|
+
syncViewIds.push(ui5Element.getId());
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
|
|
159
|
+
const elements = ElementRegistry.all();
|
|
160
|
+
Object.entries(elements).forEach(_ref => {
|
|
161
|
+
let [key, ui5Element] = _ref;
|
|
162
|
+
if (isSyncView(ui5Element)) {
|
|
163
|
+
syncViewIds.push(key);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
} catch (error) {
|
|
168
|
+
Log.error('Could not get application sync views', getError(error));
|
|
169
|
+
}
|
|
170
|
+
return syncViewIds;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Gets controller name and view ID for the given UI5 control.
|
|
174
|
+
*
|
|
175
|
+
* @param control UI5 control.
|
|
176
|
+
* @returns The controller name and view ID.
|
|
177
|
+
*/
|
|
178
|
+
function getControllerInfoForControl(control) {
|
|
179
|
+
const view = FlexUtils.getViewForControl(control);
|
|
180
|
+
const moduleName = view?.getControllerModuleName?.();
|
|
181
|
+
const controllerName = moduleName ? `module:${moduleName}` : view.getController()?.getMetadata().getName();
|
|
182
|
+
const viewId = view.getId();
|
|
183
|
+
return {
|
|
184
|
+
controllerName,
|
|
185
|
+
viewId
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Gets controller name and view ID for the given overlay control.
|
|
191
|
+
*
|
|
192
|
+
* @param overlayControl The overlay control.
|
|
193
|
+
* @returns The controller name and view ID.
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
function getControllerInfo(overlayControl) {
|
|
197
|
+
const control = overlayControl.getElement();
|
|
198
|
+
return getControllerInfoForControl(control);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Gets the reuse component checker function.
|
|
203
|
+
*
|
|
204
|
+
* @param ui5VersionInfo UI5 version information.
|
|
205
|
+
* @returns The reuse component checker function.
|
|
206
|
+
*/
|
|
207
|
+
async function getReuseComponentChecker(ui5VersionInfo) {
|
|
208
|
+
if (reuseComponentChecker) {
|
|
209
|
+
return reuseComponentChecker;
|
|
210
|
+
}
|
|
211
|
+
let reuseComponentApi;
|
|
212
|
+
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
213
|
+
major: 1,
|
|
214
|
+
minor: 134
|
|
215
|
+
})) {
|
|
216
|
+
reuseComponentApi = (await __ui5_require_async('sap/ui/rta/util/isReuseComponent')).default;
|
|
217
|
+
}
|
|
218
|
+
reuseComponentChecker = function isReuseComponent(controlId) {
|
|
219
|
+
const ui5Control = getControlById(controlId);
|
|
220
|
+
if (!ui5Control) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
const component = FlexUtils.getComponentForControl(ui5Control);
|
|
224
|
+
if (reuseComponentApi) {
|
|
225
|
+
return reuseComponentApi(component);
|
|
226
|
+
}
|
|
227
|
+
if (!component) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
const appComponent = FlexUtils.getAppComponentForControl(component);
|
|
231
|
+
if (!appComponent) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
const manifest = component.getManifest();
|
|
235
|
+
const appManifest = appComponent.getManifest();
|
|
236
|
+
const componentName = manifest?.['sap.app']?.id;
|
|
237
|
+
|
|
238
|
+
// Look for component name in component usages of app component manifest
|
|
239
|
+
const componentUsages = appManifest?.['sap.ui5']?.componentUsages;
|
|
240
|
+
return Object.values(componentUsages || {}).some(componentUsage => {
|
|
241
|
+
return componentUsage.name === componentName;
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
return reuseComponentChecker;
|
|
245
|
+
}
|
|
246
|
+
var __exports = {
|
|
247
|
+
__esModule: true
|
|
248
|
+
};
|
|
249
|
+
__exports.resetReuseComponentChecker = resetReuseComponentChecker;
|
|
250
|
+
__exports.createDeferred = createDeferred;
|
|
251
|
+
__exports.checkForExistingChange = checkForExistingChange;
|
|
252
|
+
__exports.getNestedProperty = getNestedProperty;
|
|
253
|
+
__exports.matchesChangeProperty = matchesChangeProperty;
|
|
254
|
+
__exports.notifyUser = notifyUser;
|
|
255
|
+
__exports.getAllSyncViewsIds = getAllSyncViewsIds;
|
|
256
|
+
__exports.getControllerInfoForControl = getControllerInfoForControl;
|
|
257
|
+
__exports.getControllerInfo = getControllerInfo;
|
|
258
|
+
__exports.getReuseComponentChecker = getReuseComponentChecker;
|
|
259
|
+
return __exports;
|
|
219
260
|
});
|
|
220
261
|
//# sourceMappingURL=utils.js.map
|