@sap-ux/preview-middleware 0.16.132 → 0.16.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/config.d.ts +15 -20
- package/dist/base/flex.js +1 -2
- package/dist/base/flp.d.ts +1 -0
- package/dist/base/flp.js +3 -0
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +3 -1
- package/dist/client/adp/quick-actions/table-quick-action-base.js +48 -23
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +60 -24
- package/dist/client/flp/WorkspaceConnector.js +1 -2
- package/dist/client/flp/WorkspaceConnector.ts +1 -2
- package/dist/client/flp/enableFakeConnector.js +1 -2
- package/dist/client/flp/enableFakeConnector.ts +1 -2
- package/dist/client/flp/init.js +1 -1
- package/dist/client/flp/init.ts +3 -1
- package/dist/client/flp/initRta.js +1 -1
- package/dist/client/flp/initRta.ts +1 -1
- package/dist/client/messagebundle.properties +2 -0
- package/dist/ui5/middleware.js +1 -0
- package/package.json +4 -4
package/dist/base/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ToolsLogger, type Logger } from '@sap-ux/logger';
|
|
2
|
-
import type { App, FlpConfig, Intent, InternalTestConfig, MiddlewareConfig } from '../types';
|
|
2
|
+
import type { App, FlpConfig, Intent, InternalTestConfig, MiddlewareConfig, TestConfig } from '../types';
|
|
3
3
|
import { type Manifest, type UI5FlexLayer } from '@sap-ux/project-access';
|
|
4
4
|
import { type Editor } from 'mem-fs-editor';
|
|
5
5
|
import type { MergedAppDescriptor } from '@sap-ux/axios-extension';
|
|
@@ -13,6 +13,17 @@ export interface FlexConnector {
|
|
|
13
13
|
layers: string[];
|
|
14
14
|
url?: string;
|
|
15
15
|
}
|
|
16
|
+
type TestTemplateConfig = {
|
|
17
|
+
id: string;
|
|
18
|
+
framework: TestConfig['framework'];
|
|
19
|
+
basePath: string;
|
|
20
|
+
initPath: string;
|
|
21
|
+
theme: string;
|
|
22
|
+
};
|
|
23
|
+
export type PreviewUrls = {
|
|
24
|
+
path: string;
|
|
25
|
+
type: 'preview' | 'editor' | 'test';
|
|
26
|
+
};
|
|
16
27
|
/**
|
|
17
28
|
* Internal structure used to fill the sandbox.html template
|
|
18
29
|
*/
|
|
@@ -76,14 +87,7 @@ export declare const DEFAULT_INTENT: Readonly<Intent>;
|
|
|
76
87
|
* @param config partial configuration
|
|
77
88
|
* @returns a full configuration with default values
|
|
78
89
|
*/
|
|
79
|
-
export declare function getFlpConfigWithDefaults(config?: Partial<FlpConfig>):
|
|
80
|
-
path: string;
|
|
81
|
-
intent: Readonly<Intent>;
|
|
82
|
-
apps: App[];
|
|
83
|
-
libs: boolean | undefined;
|
|
84
|
-
theme: string | undefined;
|
|
85
|
-
init: string | undefined;
|
|
86
|
-
};
|
|
90
|
+
export declare function getFlpConfigWithDefaults(config?: Partial<FlpConfig>): FlpConfig;
|
|
87
91
|
/**
|
|
88
92
|
* The developer mode is only supported for adaptation projects, therefore, notify the user if it is wrongly configured and then disable it.
|
|
89
93
|
*
|
|
@@ -125,17 +129,7 @@ export declare function createFlpTemplateConfig(config: FlpConfig, manifest: Par
|
|
|
125
129
|
* @param theme theme to be used
|
|
126
130
|
* @returns configuration object for the test template
|
|
127
131
|
*/
|
|
128
|
-
export declare function createTestTemplateConfig(config: InternalTestConfig, id: string, theme: string):
|
|
129
|
-
id: string;
|
|
130
|
-
framework: "OPA5" | "QUnit" | "Testsuite";
|
|
131
|
-
basePath: string;
|
|
132
|
-
initPath: string;
|
|
133
|
-
theme: string;
|
|
134
|
-
};
|
|
135
|
-
export type PreviewUrls = {
|
|
136
|
-
path: string;
|
|
137
|
-
type: 'preview' | 'editor' | 'test';
|
|
138
|
-
};
|
|
132
|
+
export declare function createTestTemplateConfig(config: InternalTestConfig, id: string, theme: string): TestTemplateConfig;
|
|
139
133
|
/**
|
|
140
134
|
* Returns the preview paths.
|
|
141
135
|
*
|
|
@@ -154,4 +148,5 @@ export declare function getPreviewPaths(config: MiddlewareConfig, logger?: Tools
|
|
|
154
148
|
* @returns a mem-fs editor with the preview files
|
|
155
149
|
*/
|
|
156
150
|
export declare function generatePreviewFiles(basePath: string, config: MiddlewareConfig, fs?: Editor, logger?: ToolsLogger): Promise<Editor>;
|
|
151
|
+
export {};
|
|
157
152
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/base/flex.js
CHANGED
|
@@ -17,8 +17,7 @@ async function readChanges(project, logger) {
|
|
|
17
17
|
const files = await project.byGlob('/**/changes/*.*');
|
|
18
18
|
for (const file of files) {
|
|
19
19
|
try {
|
|
20
|
-
|
|
21
|
-
changes[`sap.ui.fl.${(0, path_1.parse)(file.getName()).name}`] = change;
|
|
20
|
+
changes[`sap.ui.fl.${(0, path_1.parse)(file.getName()).name}`] = JSON.parse(await file.getString());
|
|
22
21
|
logger.debug(`Read change from ${file.getPath()}`);
|
|
23
22
|
}
|
|
24
23
|
catch (error) {
|
package/dist/base/flp.d.ts
CHANGED
|
@@ -126,6 +126,7 @@ export declare class FlpSandbox {
|
|
|
126
126
|
* @param flp FlpSandbox instance
|
|
127
127
|
* @param util middleware utilities provided by the UI5 CLI
|
|
128
128
|
* @param logger logger instance
|
|
129
|
+
* @throws Error in case no manifest.appdescr_variant found
|
|
129
130
|
*/
|
|
130
131
|
export declare function initAdp(rootProject: ReaderCollection, config: AdpPreviewConfig, flp: FlpSandbox, util: MiddlewareUtils, logger: ToolsLogger): Promise<void>;
|
|
131
132
|
export {};
|
package/dist/base/flp.js
CHANGED
|
@@ -212,6 +212,7 @@ class FlpSandbox {
|
|
|
212
212
|
// add route for the sandbox.html
|
|
213
213
|
this.router.get(this.config.path, (async (_req, res, next) => {
|
|
214
214
|
// inform the user if a html file exists on the filesystem
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
215
216
|
const file = await this.project.byPath(this.config.path);
|
|
216
217
|
if (file) {
|
|
217
218
|
this.logger.info(`HTML file returned at ${this.config.path} is loaded from the file system.`);
|
|
@@ -401,6 +402,7 @@ class FlpSandbox {
|
|
|
401
402
|
// add route for the *.qunit.html
|
|
402
403
|
this.router.get(config.path, (async (_req, res, next) => {
|
|
403
404
|
this.logger.debug(`Serving test route: ${config.path}`);
|
|
405
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
404
406
|
const file = await this.project.byPath(config.path);
|
|
405
407
|
if (file) {
|
|
406
408
|
this.logger.warn(`HTML file returned at ${config.path} is loaded from the file system.`);
|
|
@@ -468,6 +470,7 @@ function serializeUi5Configuration(config) {
|
|
|
468
470
|
* @param flp FlpSandbox instance
|
|
469
471
|
* @param util middleware utilities provided by the UI5 CLI
|
|
470
472
|
* @param logger logger instance
|
|
473
|
+
* @throws Error in case no manifest.appdescr_variant found
|
|
471
474
|
*/
|
|
472
475
|
async function initAdp(rootProject, config, flp, util, logger) {
|
|
473
476
|
const appVariant = await rootProject.byPath('/manifest.appdescr_variant');
|
|
@@ -13,7 +13,9 @@ sap.ui.define(["../../../utils/core", "../table-quick-action-base"], function (_
|
|
|
13
13
|
const CONTROL_TYPES = [SMART_TABLE_TYPE, M_TABLE_TYPE, 'sap.ui.table.TreeTable', 'sap.ui.table.Table'];
|
|
14
14
|
class ChangeTableColumnsQuickAction extends TableQuickActionDefinitionBase {
|
|
15
15
|
constructor(context) {
|
|
16
|
-
super(CHANGE_TABLE_COLUMNS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context,
|
|
16
|
+
super(CHANGE_TABLE_COLUMNS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, {
|
|
17
|
+
includeServiceAction: true
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
20
|
async execute(path) {
|
|
19
21
|
const {
|
|
@@ -18,7 +18,9 @@ export class ChangeTableColumnsQuickAction
|
|
|
18
18
|
implements NestedQuickActionDefinition
|
|
19
19
|
{
|
|
20
20
|
constructor(context: QuickActionContext) {
|
|
21
|
-
super(CHANGE_TABLE_COLUMNS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context,
|
|
21
|
+
super(CHANGE_TABLE_COLUMNS, CONTROL_TYPES, 'V2_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, {
|
|
22
|
+
includeServiceAction: true
|
|
23
|
+
});
|
|
22
24
|
}
|
|
23
25
|
async execute(path: string): Promise<FlexCommand[]> {
|
|
24
26
|
const { table, iconTabBarFilterKey, changeColumnActionId, sectionInfo } = this.tableMap[path];
|
|
@@ -44,7 +44,9 @@ sap.ui.define(["../../../utils/core", "sap/ui/dt/OverlayRegistry", "../../init-d
|
|
|
44
44
|
}
|
|
45
45
|
class AddTableCustomColumnQuickAction extends TableQuickActionDefinitionBase {
|
|
46
46
|
constructor(context) {
|
|
47
|
-
super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context
|
|
47
|
+
super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, {
|
|
48
|
+
areTableRowsRequired: true
|
|
49
|
+
});
|
|
48
50
|
}
|
|
49
51
|
async execute(path) {
|
|
50
52
|
const {
|
|
@@ -64,7 +64,9 @@ export class AddTableCustomColumnQuickAction
|
|
|
64
64
|
implements NestedQuickActionDefinition
|
|
65
65
|
{
|
|
66
66
|
constructor(context: QuickActionContext) {
|
|
67
|
-
super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context
|
|
67
|
+
super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, {
|
|
68
|
+
areTableRowsRequired: true
|
|
69
|
+
});
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
async execute(path: string): Promise<FlexCommand[]> {
|
|
@@ -53,12 +53,13 @@ sap.ui.define([
|
|
|
53
53
|
get textKey() {
|
|
54
54
|
return this.defaultTextKey;
|
|
55
55
|
}
|
|
56
|
-
constructor(type, controlTypes, defaultTextKey, context
|
|
56
|
+
constructor(type, controlTypes, defaultTextKey, context) {
|
|
57
|
+
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
57
58
|
this.type = type;
|
|
58
59
|
this.controlTypes = controlTypes;
|
|
59
60
|
this.defaultTextKey = defaultTextKey;
|
|
60
61
|
this.context = context;
|
|
61
|
-
this.
|
|
62
|
+
this.options = options;
|
|
62
63
|
}
|
|
63
64
|
async initialize() {
|
|
64
65
|
const version = await getUi5Version();
|
|
@@ -76,11 +77,9 @@ sap.ui.define([
|
|
|
76
77
|
if (section) {
|
|
77
78
|
this.collectChildrenInSection(section, table);
|
|
78
79
|
} else if (this.iconTabBar && tabKey) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
children: []
|
|
83
|
-
});
|
|
80
|
+
const label = `'${ iconTabBarfilterMap[tabKey] }' table`;
|
|
81
|
+
const child = this.createChild(label, table);
|
|
82
|
+
this.children.push(child);
|
|
84
83
|
this.tableMap[`${ this.children.length - 1 }`] = {
|
|
85
84
|
table,
|
|
86
85
|
iconTabBarFilterKey: tabKey,
|
|
@@ -89,7 +88,7 @@ sap.ui.define([
|
|
|
89
88
|
} else {
|
|
90
89
|
this.processTable(table);
|
|
91
90
|
}
|
|
92
|
-
if (this.includeServiceAction) {
|
|
91
|
+
if (this.options.includeServiceAction) {
|
|
93
92
|
const actions = await this.context.actionService.get(table.getId());
|
|
94
93
|
const actionsIds = await getActionId(table);
|
|
95
94
|
const changeColumnAction = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
|
|
@@ -102,6 +101,23 @@ sap.ui.define([
|
|
|
102
101
|
this.isApplicable = true;
|
|
103
102
|
}
|
|
104
103
|
}
|
|
104
|
+
getInternalTable(table) {
|
|
105
|
+
try {
|
|
106
|
+
let tableInternal;
|
|
107
|
+
if (isA(SMART_TABLE_TYPE, table)) {
|
|
108
|
+
const itemsAggregation = table.getAggregation('items');
|
|
109
|
+
tableInternal = itemsAggregation.find(item => [
|
|
110
|
+
M_TABLE_TYPE,
|
|
111
|
+
TREE_TABLE_TYPE,
|
|
112
|
+
ANALYTICAL_TABLE_TYPE,
|
|
113
|
+
GRID_TABLE_TYPE
|
|
114
|
+
].some(tType => isA(tType, item)));
|
|
115
|
+
}
|
|
116
|
+
return tableInternal;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
105
121
|
getTableLabel(table) {
|
|
106
122
|
if (isA(SMART_TABLE_TYPE, table) || isA(MDC_TABLE_TYPE, table)) {
|
|
107
123
|
const header = table.getHeader();
|
|
@@ -146,24 +162,18 @@ sap.ui.define([
|
|
|
146
162
|
} else if (subSections.length > 1) {
|
|
147
163
|
const sectionChild = this.children.find(val => val.label === `${ section.getTitle() } section`);
|
|
148
164
|
let tableMapIndex = `${ this.children.length - 1 }`;
|
|
165
|
+
const label = this.getTableLabel(table);
|
|
166
|
+
const child = this.createChild(label, table);
|
|
149
167
|
if (!sectionChild) {
|
|
150
168
|
tableMapIndex = `${ tableMapIndex }/0`;
|
|
151
169
|
this.children.push({
|
|
152
170
|
label: `'${ section?.getTitle() }' section`,
|
|
153
171
|
enabled: true,
|
|
154
|
-
children: [
|
|
155
|
-
label: this.getTableLabel(table),
|
|
156
|
-
enabled: true,
|
|
157
|
-
children: []
|
|
158
|
-
}]
|
|
172
|
+
children: [child]
|
|
159
173
|
});
|
|
160
174
|
} else {
|
|
161
175
|
tableMapIndex = `${ tableMapIndex }/${ sectionChild.children.length - 1 }`;
|
|
162
|
-
sectionChild.children.push(
|
|
163
|
-
label: this.getTableLabel(table),
|
|
164
|
-
enabled: true,
|
|
165
|
-
children: []
|
|
166
|
-
});
|
|
176
|
+
sectionChild.children.push(child);
|
|
167
177
|
}
|
|
168
178
|
this.tableMap[tableMapIndex] = {
|
|
169
179
|
table,
|
|
@@ -184,11 +194,9 @@ sap.ui.define([
|
|
|
184
194
|
MDC_TABLE_TYPE,
|
|
185
195
|
TREE_TABLE_TYPE
|
|
186
196
|
].some(type => isA(type, table))) {
|
|
187
|
-
this.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
children: []
|
|
191
|
-
});
|
|
197
|
+
const label = this.getTableLabel(table);
|
|
198
|
+
const child = this.createChild(label, table);
|
|
199
|
+
this.children.push(child);
|
|
192
200
|
}
|
|
193
201
|
this.tableMap[`${ this.children.length - 1 }`] = {
|
|
194
202
|
table,
|
|
@@ -212,6 +220,23 @@ sap.ui.define([
|
|
|
212
220
|
children: this.children
|
|
213
221
|
};
|
|
214
222
|
}
|
|
223
|
+
createChild(label, table) {
|
|
224
|
+
const child = {
|
|
225
|
+
label,
|
|
226
|
+
enabled: true,
|
|
227
|
+
children: []
|
|
228
|
+
};
|
|
229
|
+
if (!this.options.areTableRowsRequired) {
|
|
230
|
+
return child;
|
|
231
|
+
}
|
|
232
|
+
const innerTable = this.getInternalTable(table);
|
|
233
|
+
const tableRows = innerTable?.getAggregation('items') || [];
|
|
234
|
+
if (isA(M_TABLE_TYPE, innerTable) && !tableRows.length) {
|
|
235
|
+
child.enabled = false;
|
|
236
|
+
child.tooltip = this.context.resourceBundle.getText('TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE');
|
|
237
|
+
}
|
|
238
|
+
return child;
|
|
239
|
+
}
|
|
215
240
|
}
|
|
216
241
|
var __exports = { __esModule: true };
|
|
217
242
|
__exports.SMART_TABLE_TYPE = SMART_TABLE_TYPE;
|
|
@@ -14,6 +14,7 @@ import { getUi5Version, isLowerThanMinimalUi5Version } from '../../utils/version
|
|
|
14
14
|
import ObjectPageSection from 'sap/uxap/ObjectPageSection';
|
|
15
15
|
import ObjectPageSubSection from 'sap/uxap/ObjectPageSubSection';
|
|
16
16
|
import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
|
|
17
|
+
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
17
18
|
|
|
18
19
|
const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
|
|
19
20
|
const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
|
|
@@ -39,6 +40,10 @@ async function getActionId(table: UI5Element): Promise<string[]> {
|
|
|
39
40
|
|
|
40
41
|
return [M_TABLE_ACTION_ID, SETTINGS_ID];
|
|
41
42
|
}
|
|
43
|
+
export type TableQuickActionsOptions = {
|
|
44
|
+
includeServiceAction?: boolean;
|
|
45
|
+
areTableRowsRequired?: boolean;
|
|
46
|
+
};
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
49
|
* Base class for table quick actions.
|
|
@@ -85,7 +90,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
85
90
|
protected readonly controlTypes: string[],
|
|
86
91
|
protected readonly defaultTextKey: string,
|
|
87
92
|
protected readonly context: QuickActionContext,
|
|
88
|
-
protected
|
|
93
|
+
protected options: TableQuickActionsOptions = {}
|
|
89
94
|
) {}
|
|
90
95
|
|
|
91
96
|
/**
|
|
@@ -109,11 +114,9 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
109
114
|
if (section) {
|
|
110
115
|
this.collectChildrenInSection(section, table);
|
|
111
116
|
} else if (this.iconTabBar && tabKey) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
children: []
|
|
116
|
-
});
|
|
117
|
+
const label = `'${iconTabBarfilterMap[tabKey]}' table`;
|
|
118
|
+
const child = this.createChild(label, table);
|
|
119
|
+
this.children.push(child);
|
|
117
120
|
this.tableMap[`${this.children.length - 1}`] = {
|
|
118
121
|
table,
|
|
119
122
|
iconTabBarFilterKey: tabKey,
|
|
@@ -124,7 +127,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
// add action id to the table map, if the service actions are needed.
|
|
127
|
-
if (this.includeServiceAction) {
|
|
130
|
+
if (this.options.includeServiceAction) {
|
|
128
131
|
const actions = await this.context.actionService.get(table.getId());
|
|
129
132
|
const actionsIds = await getActionId(table);
|
|
130
133
|
|
|
@@ -142,6 +145,30 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Retrieves the internal table control from a UI5Element.
|
|
150
|
+
*
|
|
151
|
+
* @param table - The UI5Element instance to analyze.
|
|
152
|
+
* @returns The internal table otherwise undefined.
|
|
153
|
+
*/
|
|
154
|
+
protected getInternalTable(table: UI5Element): UI5Element | undefined {
|
|
155
|
+
try {
|
|
156
|
+
let tableInternal: ManagedObject | undefined;
|
|
157
|
+
|
|
158
|
+
if (isA<SmartTable>(SMART_TABLE_TYPE, table)) {
|
|
159
|
+
const itemsAggregation = table.getAggregation('items') as ManagedObject[];
|
|
160
|
+
tableInternal = itemsAggregation.find((item) =>
|
|
161
|
+
[M_TABLE_TYPE, TREE_TABLE_TYPE, ANALYTICAL_TABLE_TYPE, GRID_TABLE_TYPE].some((tType) =>
|
|
162
|
+
isA(tType, item)
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return tableInternal as UI5Element | undefined;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
145
172
|
/**
|
|
146
173
|
* Determines table label for the given table element
|
|
147
174
|
* @param table - table element
|
|
@@ -204,26 +231,19 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
204
231
|
} else if (subSections.length > 1) {
|
|
205
232
|
const sectionChild = this.children.find((val) => val.label === `${section.getTitle()} section`);
|
|
206
233
|
let tableMapIndex = `${this.children.length - 1}`;
|
|
234
|
+
const label = this.getTableLabel(table);
|
|
235
|
+
const child = this.createChild(label, table);
|
|
207
236
|
if (!sectionChild) {
|
|
208
237
|
tableMapIndex = `${tableMapIndex}/0`;
|
|
238
|
+
|
|
209
239
|
this.children.push({
|
|
210
240
|
label: `'${section?.getTitle()}' section`,
|
|
211
241
|
enabled: true,
|
|
212
|
-
children: [
|
|
213
|
-
{
|
|
214
|
-
label: this.getTableLabel(table),
|
|
215
|
-
enabled: true,
|
|
216
|
-
children: []
|
|
217
|
-
}
|
|
218
|
-
]
|
|
242
|
+
children: [child]
|
|
219
243
|
});
|
|
220
244
|
} else {
|
|
221
245
|
tableMapIndex = `${tableMapIndex}/${sectionChild.children.length - 1}`;
|
|
222
|
-
sectionChild.children.push(
|
|
223
|
-
label: this.getTableLabel(table),
|
|
224
|
-
enabled: true,
|
|
225
|
-
children: []
|
|
226
|
-
});
|
|
246
|
+
sectionChild.children.push(child);
|
|
227
247
|
}
|
|
228
248
|
|
|
229
249
|
this.tableMap[tableMapIndex] = {
|
|
@@ -245,11 +265,9 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
245
265
|
sectionInfo?: { section: ObjectPageSection; subSection: ObjectPageSubSection; layout?: ObjectPageLayout }
|
|
246
266
|
): void {
|
|
247
267
|
if ([SMART_TABLE_TYPE, M_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE].some((type) => isA(type, table))) {
|
|
248
|
-
this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
children: []
|
|
252
|
-
});
|
|
268
|
+
const label = this.getTableLabel(table);
|
|
269
|
+
const child = this.createChild(label, table);
|
|
270
|
+
this.children.push(child);
|
|
253
271
|
}
|
|
254
272
|
|
|
255
273
|
this.tableMap[`${this.children.length - 1}`] = {
|
|
@@ -284,4 +302,22 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
284
302
|
children: this.children
|
|
285
303
|
};
|
|
286
304
|
}
|
|
305
|
+
|
|
306
|
+
createChild(label: string, table: UI5Element): NestedQuickActionChild {
|
|
307
|
+
const child: NestedQuickActionChild = {
|
|
308
|
+
label,
|
|
309
|
+
enabled: true,
|
|
310
|
+
children: []
|
|
311
|
+
};
|
|
312
|
+
if (!this.options.areTableRowsRequired) {
|
|
313
|
+
return child;
|
|
314
|
+
}
|
|
315
|
+
const innerTable = this.getInternalTable(table);
|
|
316
|
+
const tableRows = (innerTable?.getAggregation('items') as ManagedObject[]) || [];
|
|
317
|
+
if (isA(M_TABLE_TYPE, innerTable) && !tableRows.length) {
|
|
318
|
+
child.enabled = false;
|
|
319
|
+
child.tooltip = this.context.resourceBundle.getText('TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE');
|
|
320
|
+
}
|
|
321
|
+
return child;
|
|
322
|
+
}
|
|
287
323
|
}
|
|
@@ -64,8 +64,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
|
|
|
64
64
|
'content-type': 'application/json'
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
|
|
68
|
-
return changes;
|
|
67
|
+
return await response.json();
|
|
69
68
|
}
|
|
70
69
|
},
|
|
71
70
|
loadFeatures: async function () {
|
|
@@ -62,8 +62,7 @@ const connector = merge({}, ObjectStorageConnector, {
|
|
|
62
62
|
'content-type': 'application/json'
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
return changes;
|
|
65
|
+
return (await response.json()) as unknown as FlexChange[];
|
|
67
66
|
}
|
|
68
67
|
} as typeof ObjectStorageConnector.storage,
|
|
69
68
|
loadFeatures: async function () {
|
|
@@ -55,8 +55,7 @@ sap.ui.define(["sap/ui/fl/LrepConnector", "sap/ui/fl/FakeLrepConnector", "./comm
|
|
|
55
55
|
args[_key] = arguments[_key];
|
|
56
56
|
}
|
|
57
57
|
return LrepConnector.prototype.loadChanges.apply(lrep, args).then(res => {
|
|
58
|
-
|
|
59
|
-
res.changes.changes = flexChanges;
|
|
58
|
+
res.changes.changes = Object.values(changes);
|
|
60
59
|
return res;
|
|
61
60
|
});
|
|
62
61
|
}
|
|
@@ -74,8 +74,7 @@ export async function loadChanges(...args: []): Promise<LoadChangesResult> {
|
|
|
74
74
|
const changes = (await response.json()) as FetchedChanges;
|
|
75
75
|
|
|
76
76
|
return LrepConnector.prototype.loadChanges.apply(lrep, args).then((res: LoadChangesResult) => {
|
|
77
|
-
|
|
78
|
-
res.changes.changes = flexChanges;
|
|
77
|
+
res.changes.changes = Object.values(changes);
|
|
79
78
|
return res;
|
|
80
79
|
});
|
|
81
80
|
}
|
package/dist/client/flp/init.js
CHANGED
|
@@ -122,10 +122,10 @@ sap.ui.define([
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
async function resetAppState(container) {
|
|
125
|
-
const appStateService = await container.getServiceAsync('AppState');
|
|
126
125
|
const urlParams = new URLSearchParams(window.location.hash);
|
|
127
126
|
const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
|
|
128
127
|
if (appStateValue) {
|
|
128
|
+
const appStateService = await container.getServiceAsync('AppState');
|
|
129
129
|
appStateService.deleteAppState(appStateValue);
|
|
130
130
|
}
|
|
131
131
|
}
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -165,10 +165,10 @@ function registerModules(dataFromAppIndex: AppIndexData) {
|
|
|
165
165
|
* @param container the UShell container
|
|
166
166
|
*/
|
|
167
167
|
export async function resetAppState(container: typeof sap.ushell.Container): Promise<void> {
|
|
168
|
-
const appStateService = await container.getServiceAsync<AppState>('AppState');
|
|
169
168
|
const urlParams = new URLSearchParams(window.location.hash);
|
|
170
169
|
const appStateValue = urlParams.get('sap-iapp-state') ?? urlParams.get('/?sap-iapp-state');
|
|
171
170
|
if (appStateValue) {
|
|
171
|
+
const appStateService = await container.getServiceAsync<AppState>('AppState');
|
|
172
172
|
appStateService.deleteAppState(appStateValue);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -346,6 +346,8 @@ export async function init({
|
|
|
346
346
|
: await container.createRendererInternal(undefined, true);
|
|
347
347
|
renderer.placeAt('content');
|
|
348
348
|
}
|
|
349
|
+
|
|
350
|
+
// eslint-disable-next-line fiori-custom/sap-no-dom-access,fiori-custom/sap-browser-api-warning
|
|
349
351
|
const bootstrapConfig = document.getElementById('sap-ui-bootstrap');
|
|
350
352
|
if (bootstrapConfig) {
|
|
351
353
|
init({
|
|
@@ -151,7 +151,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/core/Control", "sap/ui/core/UIComp
|
|
|
151
151
|
* Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
|
|
152
152
|
* Ensures that the passed options are valid.
|
|
153
153
|
*
|
|
154
|
-
* @param {RTAOptions} options - Options
|
|
154
|
+
* @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
|
|
155
155
|
* @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
|
|
156
156
|
* @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
|
|
157
157
|
*/
|
|
@@ -164,7 +164,7 @@ function removeExtraBtnsFromToolbar(): void {
|
|
|
164
164
|
* Initializes custom RuntimeAuthoring for UI5 Versions < 1.72 and start UI Adaptation.
|
|
165
165
|
* Ensures that the passed options are valid.
|
|
166
166
|
*
|
|
167
|
-
* @param {RTAOptions} options - Options
|
|
167
|
+
* @param {RTAOptions} options - Options that are passed to RuntimeAuthoring upon initialization.
|
|
168
168
|
* @param {RTAPlugin} loadPlugins - Script that needs to be executed after rta is initialized.
|
|
169
169
|
* @returns {Promise<void>} A promise that resolves when all the checks have passed and RuntimeAuthoring is started.
|
|
170
170
|
*/
|
|
@@ -38,4 +38,6 @@ CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be vis
|
|
|
38
38
|
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again.
|
|
39
39
|
|
|
40
40
|
HIGHER_LAYER_CHANGES_INFO_MESSAGE=The preview of the project was reloaded due to detected changes in higher layer than the one used in your project.
|
|
41
|
+
|
|
42
|
+
TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE=This action has been disabled because the table rows are not available. Please load the table data and try again
|
|
41
43
|
THE_CHANGE_HAS_ALREADY_BEEN_MADE=This option has been disabled because the change has already been made
|
package/dist/ui5/middleware.js
CHANGED
|
@@ -24,6 +24,7 @@ async function createRouter({ resources, options, middlewareUtil }, logger) {
|
|
|
24
24
|
await (0, flp_1.initAdp)(resources.rootProject, config.adp, flp, middlewareUtil, logger);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
27
28
|
const manifest = await resources.rootProject.byPath('/manifest.json');
|
|
28
29
|
if (manifest) {
|
|
29
30
|
await flp.init(JSON.parse(await manifest.getString()));
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.16.
|
|
12
|
+
"version": "0.16.136",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@sap-ux/logger": "0.6.0",
|
|
29
29
|
"@sap-ux/feature-toggle": "0.2.2",
|
|
30
30
|
"@sap-ux/btp-utils": "0.17.0",
|
|
31
|
-
"@sap-ux/adp-tooling": "0.12.
|
|
31
|
+
"@sap-ux/adp-tooling": "0.12.87",
|
|
32
32
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.28",
|
|
33
|
-
"@sap-ux/project-access": "1.28.
|
|
33
|
+
"@sap-ux/project-access": "1.28.8"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/ejs": "3.1.2",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"supertest": "6.3.3",
|
|
47
47
|
"@sap-ux-private/playwright": "0.1.0",
|
|
48
48
|
"dotenv": "16.3.1",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.39",
|
|
50
50
|
"@sap-ux/axios-extension": "1.17.4",
|
|
51
51
|
"@sap-ux/store": "0.9.3",
|
|
52
52
|
"@sap-ux/ui5-info": "0.8.3",
|