@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.
- package/dist/client/adp/api-handler.js +153 -153
- package/dist/client/adp/command-executor.js +75 -75
- package/dist/client/adp/control-utils.js +44 -44
- package/dist/client/adp/controllers/AddSubpage.controller.js +128 -0
- package/dist/client/adp/controllers/AddSubpage.controller.ts +195 -0
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
- package/dist/client/adp/controllers/ControllerExtension.controller.js +209 -209
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
- package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
- package/dist/client/adp/dialog-factory.js +133 -125
- package/dist/client/adp/dialog-factory.ts +17 -3
- package/dist/client/adp/init-dialogs.js +107 -107
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
- package/dist/client/adp/quick-actions/common/add-new-subpage.js +140 -0
- package/dist/client/adp/quick-actions/common/add-new-subpage.ts +164 -0
- package/dist/client/adp/quick-actions/common/create-page-action.js +51 -51
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +61 -61
- package/dist/client/adp/quick-actions/common/utils.js +18 -18
- package/dist/client/adp/quick-actions/control-types.js +21 -21
- 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/change-table-columns.js +101 -101
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +104 -104
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
- 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 +76 -75
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +7 -3
- package/dist/client/adp/quick-actions/fe-v2/utils.js +116 -116
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +50 -50
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
- 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 +82 -82
- 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 +58 -58
- package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
- package/dist/client/adp/quick-actions/load.js +44 -44
- package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
- package/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
- package/dist/client/adp/utils.js +160 -160
- package/dist/client/cpe/changes/index.js +10 -10
- package/dist/client/cpe/changes/validator.js +39 -39
- 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 +222 -222
- 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 +138 -138
- package/dist/client/flp/WorkspaceConnector.js +86 -86
- package/dist/client/flp/common.js +28 -28
- package/dist/client/flp/enableFakeConnector.js +83 -83
- 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 +6 -0
- package/dist/client/utils/application.js +32 -32
- package/dist/client/utils/core.js +68 -68
- package/dist/client/utils/error.js +19 -19
- package/dist/client/utils/fe-v2.js +58 -0
- package/dist/client/utils/fe-v2.ts +63 -0
- package/dist/client/utils/fe-v4.js +141 -118
- package/dist/client/utils/fe-v4.ts +19 -0
- package/dist/client/utils/version.js +104 -104
- package/package.json +8 -8
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
'sap/ui/model/json/JSONModel',
|
|
4
|
+
'../../i18n',
|
|
5
|
+
'../command-executor',
|
|
6
|
+
'./BaseDialog.controller',
|
|
7
|
+
'sap/ui/rta/command/CommandFactory',
|
|
8
|
+
'../../cpe/communication-service',
|
|
9
|
+
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common'
|
|
10
|
+
], function (JSONModel, ____i18n, __CommandExecutor, __BaseDialog, CommandFactory, ____cpe_communication_service, ___sap_ux_private_control_property_editor_common) {
|
|
11
|
+
'use strict';
|
|
12
|
+
function _interopRequireDefault(obj) {
|
|
13
|
+
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
14
|
+
}
|
|
15
|
+
const getResourceModel = ____i18n['getResourceModel'];
|
|
16
|
+
const CommandExecutor = _interopRequireDefault(__CommandExecutor);
|
|
17
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
18
|
+
const CommunicationService = ____cpe_communication_service['CommunicationService'];
|
|
19
|
+
const setApplicationRequiresReload = ___sap_ux_private_control_property_editor_common['setApplicationRequiresReload'];
|
|
20
|
+
const AddSubpage = BaseDialog.extend('open.ux.preview.client.adp.controllers.AddSubpage', {
|
|
21
|
+
constructor: function _constructor(name, overlays, rta, options) {
|
|
22
|
+
BaseDialog.prototype.constructor.call(this, name);
|
|
23
|
+
this.options = options;
|
|
24
|
+
this.rta = rta;
|
|
25
|
+
this.overlays = overlays;
|
|
26
|
+
this.model = new JSONModel({
|
|
27
|
+
appType: options.appType,
|
|
28
|
+
appReference: options.appReference,
|
|
29
|
+
pageType: options.pageDescriptor.pageType,
|
|
30
|
+
title: options.title,
|
|
31
|
+
navigationData: options.pageDescriptor.navProperties,
|
|
32
|
+
currentEntitySet: options.pageDescriptor.entitySet
|
|
33
|
+
});
|
|
34
|
+
this.commandExecutor = new CommandExecutor(this.rta);
|
|
35
|
+
},
|
|
36
|
+
setup: async function _setup(dialog) {
|
|
37
|
+
this.dialog = dialog;
|
|
38
|
+
this.setEscapeHandler();
|
|
39
|
+
await this.buildDialogData();
|
|
40
|
+
const resourceModel = await getResourceModel('open.ux.preview.client');
|
|
41
|
+
this.dialog.setModel(resourceModel, 'i18n');
|
|
42
|
+
this.dialog.setModel(this.model);
|
|
43
|
+
this.dialog.open();
|
|
44
|
+
},
|
|
45
|
+
onPageTypeChange: function _onPageTypeChange() {
|
|
46
|
+
},
|
|
47
|
+
onNavigationChange: function _onNavigationChange(event) {
|
|
48
|
+
const source = event.getSource();
|
|
49
|
+
const selectedKey = source.getSelectedKey();
|
|
50
|
+
this.model.setProperty('/selectedNavigation/key', selectedKey);
|
|
51
|
+
},
|
|
52
|
+
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
53
|
+
const source = event.getSource();
|
|
54
|
+
source.setEnabled(false);
|
|
55
|
+
const flexSettings = this.rta.getFlexSettings();
|
|
56
|
+
const navProperty = this.model.getProperty('/selectedNavigation/key');
|
|
57
|
+
const navigation = this.model.getProperty('/navigationData').find(item => item.navProperty = navProperty);
|
|
58
|
+
const targetEntitySet = navigation?.entitySet ?? '';
|
|
59
|
+
const appType = this.model.getProperty('/appType');
|
|
60
|
+
const pageType = this.model.getProperty('/pageType');
|
|
61
|
+
const modifiedValue = appType === 'fe-v2' ? {
|
|
62
|
+
changeType: 'appdescr_ui_generic_app_addNewObjectPage',
|
|
63
|
+
reference: this.model.getProperty('/appReference'),
|
|
64
|
+
parameters: {
|
|
65
|
+
parentPage: {
|
|
66
|
+
component: pageType,
|
|
67
|
+
entitySet: this.model.getProperty('/currentEntitySet')
|
|
68
|
+
},
|
|
69
|
+
childPage: {
|
|
70
|
+
id: `ObjectPage|${ navProperty }`,
|
|
71
|
+
definition: {
|
|
72
|
+
entitySet: targetEntitySet,
|
|
73
|
+
navigationProperty: navProperty
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} : {
|
|
78
|
+
changeType: 'appdescr_fe_addNewPage',
|
|
79
|
+
parameters: {
|
|
80
|
+
sourcePage: {
|
|
81
|
+
id: this.runtimeControl.getId(),
|
|
82
|
+
navigationSource: targetEntitySet
|
|
83
|
+
},
|
|
84
|
+
targetPage: {
|
|
85
|
+
type: 'Component',
|
|
86
|
+
id: `${ targetEntitySet }ObjectPage`,
|
|
87
|
+
name: 'sap.fe.templates.ObjectPage',
|
|
88
|
+
routePattern: `${ targetEntitySet }({key}):?query:`,
|
|
89
|
+
settings: {
|
|
90
|
+
contextPath: `/${ targetEntitySet }`,
|
|
91
|
+
editableHeaderContent: false
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const command = await CommandFactory.getCommandFor(this.runtimeControl, 'appDescriptor', modifiedValue, null, flexSettings);
|
|
97
|
+
await this.commandExecutor.pushAndExecuteCommand(command);
|
|
98
|
+
CommunicationService.sendAction(setApplicationRequiresReload(true));
|
|
99
|
+
this.handleDialogClose();
|
|
100
|
+
},
|
|
101
|
+
buildDialogData: async function _buildDialogData() {
|
|
102
|
+
this.getControlMetadata();
|
|
103
|
+
const pageTypeOptions = [
|
|
104
|
+
{
|
|
105
|
+
key: 'ObjectPage',
|
|
106
|
+
value: 'Object Page'
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: 'CustomPage',
|
|
110
|
+
value: 'Custom Page'
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
this.model.setProperty('/pageTypeOptions', pageTypeOptions);
|
|
114
|
+
this.model.setProperty('/selectedPageType', pageTypeOptions[0]);
|
|
115
|
+
const navigationOptions = this.model.getProperty('/navigationData').map(item => {
|
|
116
|
+
const value = item.entitySet === item.navProperty ? item.entitySet : `${ item.entitySet } (${ item.navProperty })`;
|
|
117
|
+
return {
|
|
118
|
+
key: item.navProperty,
|
|
119
|
+
value
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
this.model.setProperty('/navigationOptions', navigationOptions);
|
|
123
|
+
this.model.setProperty('/selectedNavigation', navigationOptions[0]);
|
|
124
|
+
return Promise.resolve();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return AddSubpage;
|
|
128
|
+
});
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/** sap.m */
|
|
2
|
+
import Button from 'sap/m/Button';
|
|
3
|
+
import type Dialog from 'sap/m/Dialog';
|
|
4
|
+
import type ComboBox from 'sap/m/ComboBox';
|
|
5
|
+
|
|
6
|
+
/** sap.ui.core */
|
|
7
|
+
import type UI5Element from 'sap/ui/core/Element';
|
|
8
|
+
|
|
9
|
+
/** sap.ui.base */
|
|
10
|
+
import type Event from 'sap/ui/base/Event';
|
|
11
|
+
|
|
12
|
+
/** sap.ui.model */
|
|
13
|
+
import JSONModel from 'sap/ui/model/json/JSONModel';
|
|
14
|
+
|
|
15
|
+
/** sap.ui.rta */
|
|
16
|
+
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
17
|
+
|
|
18
|
+
import { getResourceModel } from '../../i18n';
|
|
19
|
+
|
|
20
|
+
import CommandExecutor from '../command-executor';
|
|
21
|
+
|
|
22
|
+
import BaseDialog from './BaseDialog.controller';
|
|
23
|
+
|
|
24
|
+
import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
25
|
+
import { ApplicationType } from '../../utils/application';
|
|
26
|
+
import { CommunicationService } from '../../cpe/communication-service';
|
|
27
|
+
import { setApplicationRequiresReload } from '@sap-ux-private/control-property-editor-common';
|
|
28
|
+
|
|
29
|
+
type SubpageType = 'ObjectPage' | 'CustomPage';
|
|
30
|
+
|
|
31
|
+
export type AddSubpageModel = JSONModel & {
|
|
32
|
+
getProperty(sPath: '/appType'): ApplicationType;
|
|
33
|
+
getProperty(sPath: '/pageType'): string;
|
|
34
|
+
getProperty(sPath: '/appReference'): string;
|
|
35
|
+
getProperty(sPath: '/currentEntitySet'): string;
|
|
36
|
+
getProperty(sPath: '/title'): string;
|
|
37
|
+
getProperty(sPath: '/navigationData'): { navProperty: string; entitySet: string }[];
|
|
38
|
+
getProperty(sPath: '/selectedPageType/key'): SubpageType;
|
|
39
|
+
getProperty(sPath: '/selectedNavigation/key'): string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export interface AddSubpageOptions {
|
|
43
|
+
appType: ApplicationType;
|
|
44
|
+
appReference: string;
|
|
45
|
+
title: string;
|
|
46
|
+
pageDescriptor: {
|
|
47
|
+
pageType: string;
|
|
48
|
+
entitySet: string;
|
|
49
|
+
navProperties: { navProperty: string; entitySet: string }[];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
55
|
+
*/
|
|
56
|
+
export default class AddSubpage extends BaseDialog<AddSubpageModel> {
|
|
57
|
+
constructor(name: string, overlays: UI5Element, rta: RuntimeAuthoring, readonly options: AddSubpageOptions) {
|
|
58
|
+
super(name);
|
|
59
|
+
this.rta = rta;
|
|
60
|
+
this.overlays = overlays;
|
|
61
|
+
this.model = new JSONModel({
|
|
62
|
+
appType: options.appType,
|
|
63
|
+
appReference: options.appReference,
|
|
64
|
+
pageType: options.pageDescriptor.pageType,
|
|
65
|
+
title: options.title,
|
|
66
|
+
navigationData: options.pageDescriptor.navProperties,
|
|
67
|
+
currentEntitySet: options.pageDescriptor.entitySet
|
|
68
|
+
});
|
|
69
|
+
this.commandExecutor = new CommandExecutor(this.rta);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Setups the Dialog and the JSON Model
|
|
74
|
+
*
|
|
75
|
+
* @param {Dialog} dialog - Dialog instance
|
|
76
|
+
*/
|
|
77
|
+
async setup(dialog: Dialog): Promise<void> {
|
|
78
|
+
this.dialog = dialog;
|
|
79
|
+
|
|
80
|
+
this.setEscapeHandler();
|
|
81
|
+
|
|
82
|
+
await this.buildDialogData();
|
|
83
|
+
const resourceModel = await getResourceModel('open.ux.preview.client');
|
|
84
|
+
|
|
85
|
+
this.dialog.setModel(resourceModel, 'i18n');
|
|
86
|
+
this.dialog.setModel(this.model);
|
|
87
|
+
|
|
88
|
+
this.dialog.open();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
onPageTypeChange() {
|
|
92
|
+
// TODO: to be supported in future releases
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onNavigationChange(event: Event) {
|
|
96
|
+
const source = event.getSource<ComboBox>();
|
|
97
|
+
const selectedKey = source.getSelectedKey();
|
|
98
|
+
this.model.setProperty('/selectedNavigation/key', selectedKey);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Handles create button press
|
|
103
|
+
*
|
|
104
|
+
* @param event Event
|
|
105
|
+
*/
|
|
106
|
+
async onCreateBtnPress(event: Event) {
|
|
107
|
+
const source = event.getSource<Button>();
|
|
108
|
+
source.setEnabled(false);
|
|
109
|
+
|
|
110
|
+
const flexSettings = this.rta.getFlexSettings();
|
|
111
|
+
const navProperty = this.model.getProperty('/selectedNavigation/key');
|
|
112
|
+
const navigation = this.model.getProperty('/navigationData').find((item) => (item.navProperty = navProperty));
|
|
113
|
+
const targetEntitySet = navigation?.entitySet ?? '';
|
|
114
|
+
const appType = this.model.getProperty('/appType');
|
|
115
|
+
const pageType = this.model.getProperty('/pageType');
|
|
116
|
+
|
|
117
|
+
const modifiedValue =
|
|
118
|
+
appType === 'fe-v2'
|
|
119
|
+
? {
|
|
120
|
+
changeType: 'appdescr_ui_generic_app_addNewObjectPage',
|
|
121
|
+
reference: this.model.getProperty('/appReference'),
|
|
122
|
+
parameters: {
|
|
123
|
+
parentPage: {
|
|
124
|
+
component: pageType,
|
|
125
|
+
entitySet: this.model.getProperty('/currentEntitySet')
|
|
126
|
+
},
|
|
127
|
+
childPage: {
|
|
128
|
+
id: `ObjectPage|${navProperty}`,
|
|
129
|
+
definition: {
|
|
130
|
+
entitySet: targetEntitySet,
|
|
131
|
+
navigationProperty: navProperty
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
: {
|
|
137
|
+
changeType: 'appdescr_fe_addNewPage',
|
|
138
|
+
parameters: {
|
|
139
|
+
sourcePage: {
|
|
140
|
+
id: this.runtimeControl.getId(),
|
|
141
|
+
navigationSource: targetEntitySet
|
|
142
|
+
},
|
|
143
|
+
targetPage: {
|
|
144
|
+
type: 'Component',
|
|
145
|
+
id: `${targetEntitySet}ObjectPage`,
|
|
146
|
+
name: 'sap.fe.templates.ObjectPage',
|
|
147
|
+
routePattern: `${targetEntitySet}({key}):?query:`,
|
|
148
|
+
settings: {
|
|
149
|
+
contextPath: `/${targetEntitySet}`,
|
|
150
|
+
editableHeaderContent: false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const command = await CommandFactory.getCommandFor(
|
|
157
|
+
this.runtimeControl,
|
|
158
|
+
'appDescriptor',
|
|
159
|
+
modifiedValue,
|
|
160
|
+
null,
|
|
161
|
+
flexSettings
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
await this.commandExecutor.pushAndExecuteCommand(command);
|
|
165
|
+
CommunicationService.sendAction(setApplicationRequiresReload(true));
|
|
166
|
+
|
|
167
|
+
this.handleDialogClose();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Builds data that is used in the dialog
|
|
172
|
+
*/
|
|
173
|
+
async buildDialogData(): Promise<void> {
|
|
174
|
+
this.getControlMetadata(); // is called to fill this.runtimeControl
|
|
175
|
+
|
|
176
|
+
const pageTypeOptions: { key: string; value: string }[] = [
|
|
177
|
+
{ key: 'ObjectPage', value: 'Object Page' },
|
|
178
|
+
{ key: 'CustomPage', value: 'Custom Page' }
|
|
179
|
+
];
|
|
180
|
+
this.model.setProperty('/pageTypeOptions', pageTypeOptions);
|
|
181
|
+
this.model.setProperty('/selectedPageType', pageTypeOptions[0]);
|
|
182
|
+
|
|
183
|
+
const navigationOptions: { key: string; value: string }[] = (
|
|
184
|
+
this.model.getProperty('/navigationData') as { navProperty: string; entitySet: string }[]
|
|
185
|
+
).map((item) => {
|
|
186
|
+
const value =
|
|
187
|
+
item.entitySet === item.navProperty ? item.entitySet : `${item.entitySet} (${item.navProperty})`;
|
|
188
|
+
return { key: item.navProperty, value };
|
|
189
|
+
});
|
|
190
|
+
this.model.setProperty('/navigationOptions', navigationOptions);
|
|
191
|
+
this.model.setProperty('/selectedNavigation', navigationOptions[0]);
|
|
192
|
+
|
|
193
|
+
return Promise.resolve();
|
|
194
|
+
}
|
|
195
|
+
}
|