@sap-ux/preview-middleware 0.16.156 → 0.16.157
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/controllers/AddFragment.controller.js +0 -1
- package/dist/client/adp/controllers/AddFragment.controller.ts +0 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +0 -1
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +0 -1
- package/dist/client/adp/controllers/BaseDialog.controller.ts +0 -4
- package/dist/client/adp/dialog-factory.js +115 -0
- package/dist/client/adp/dialog-factory.ts +134 -0
- package/dist/client/adp/extension-point.js +6 -6
- package/dist/client/adp/extension-point.ts +2 -2
- package/dist/client/adp/init-dialogs.js +5 -62
- package/dist/client/adp/init-dialogs.ts +5 -77
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +6 -5
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +5 -3
- package/dist/client/adp/quick-actions/common/create-page-action.js +7 -6
- package/dist/client/adp/quick-actions/common/create-page-action.ts +7 -4
- package/dist/client/adp/quick-actions/common/op-add-custom-section.js +6 -5
- package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +6 -3
- package/dist/client/adp/quick-actions/common/op-add-header-field.js +7 -6
- package/dist/client/adp/quick-actions/common/op-add-header-field.ts +7 -4
- package/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
- package/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
- package/dist/client/adp/quick-actions/enablement-validator.js +6 -0
- package/dist/client/adp/quick-actions/enablement-validator.ts +18 -0
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +3 -2
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +11 -3
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +6 -5
- package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +6 -3
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +6 -5
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +25 -13
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +6 -2
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +8 -3
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +19 -9
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +36 -15
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +3 -2
- package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +4 -1
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +6 -5
- package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +16 -7
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +6 -5
- package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +8 -5
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +8 -14
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +10 -14
- package/dist/client/adp/quick-actions/quick-action-base.js +55 -0
- package/dist/client/adp/quick-actions/quick-action-base.ts +55 -0
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +8 -13
- package/dist/client/adp/quick-actions/simple-quick-action-base.ts +10 -18
- package/dist/client/adp/quick-actions/table-quick-action-base.js +7 -9
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +10 -14
- package/dist/client/cpe/changes/service.js +30 -0
- package/dist/client/cpe/changes/service.ts +46 -0
- package/dist/client/cpe/quick-actions/quick-action-definition.ts +5 -1
- package/dist/client/cpe/quick-actions/quick-action-service.js +10 -4
- package/dist/client/cpe/quick-actions/quick-action-service.ts +9 -3
- package/dist/client/messagebundle.properties +1 -0
- package/package.json +5 -5
|
@@ -37,7 +37,6 @@ sap.ui.define([
|
|
|
37
37
|
this.rta = rta;
|
|
38
38
|
this.overlays = overlays;
|
|
39
39
|
this.model = new JSONModel({ title: options.title });
|
|
40
|
-
this.ui5Version = sap.ui.version;
|
|
41
40
|
this.commandExecutor = new CommandExecutor(this.rta);
|
|
42
41
|
},
|
|
43
42
|
setup: async function _setup(dialog) {
|
|
@@ -66,7 +66,6 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
|
|
|
66
66
|
this.model = new JSONModel({
|
|
67
67
|
title: options.title
|
|
68
68
|
}) as AddTableColumnsFragmentsModel;
|
|
69
|
-
this.ui5Version = sap.ui.version;
|
|
70
69
|
this.commandExecutor = new CommandExecutor(this.rta);
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.controller", "./controllers/AddTableColumnFragments.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller"], function (Fragment, ___i18n, __AddFragment, __AddTableColumnFragments, __ControllerExtension, __ExtensionPoint) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
const getTextBundle = ___i18n["getTextBundle"];
|
|
10
|
+
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
11
|
+
const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
|
|
12
|
+
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
13
|
+
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
14
|
+
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
15
|
+
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
16
|
+
DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
|
|
17
|
+
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
18
|
+
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
19
|
+
return DialogNames;
|
|
20
|
+
}(DialogNames || {});
|
|
21
|
+
const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
|
|
22
|
+
class DialogFactory {
|
|
23
|
+
static eventTarget = new EventTarget();
|
|
24
|
+
static isDialogOpen = false;
|
|
25
|
+
/**
|
|
26
|
+
* Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
static get canOpenDialog() {
|
|
30
|
+
return !this.isDialogOpen;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Factory method for creating a new dialog.
|
|
35
|
+
*
|
|
36
|
+
* @param overlay - Control overlay.
|
|
37
|
+
* @param rta - Runtime Authoring instance.
|
|
38
|
+
* @param dialogName - Dialog name.
|
|
39
|
+
* @param extensionPointData - Control ID.
|
|
40
|
+
* @param options - Dialog options.
|
|
41
|
+
*/
|
|
42
|
+
static async createDialog(overlay, rta, dialogName, extensionPointData) {
|
|
43
|
+
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
44
|
+
if (this.isDialogOpen) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
let controller;
|
|
48
|
+
const resources = await getTextBundle();
|
|
49
|
+
switch (dialogName) {
|
|
50
|
+
case DialogNames.ADD_FRAGMENT:
|
|
51
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
52
|
+
aggregation: options.aggregation,
|
|
53
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
57
|
+
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
58
|
+
aggregation: options.aggregation,
|
|
59
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
60
|
+
});
|
|
61
|
+
break;
|
|
62
|
+
case DialogNames.CONTROLLER_EXTENSION:
|
|
63
|
+
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
64
|
+
break;
|
|
65
|
+
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
66
|
+
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
70
|
+
const dialog = await Fragment.load({
|
|
71
|
+
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
72
|
+
controller,
|
|
73
|
+
id
|
|
74
|
+
});
|
|
75
|
+
this.isDialogOpen = true;
|
|
76
|
+
dialog.attachBeforeClose(() => {
|
|
77
|
+
this.updateStatus(false);
|
|
78
|
+
});
|
|
79
|
+
await controller.setup(dialog);
|
|
80
|
+
this.updateStatus(true);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Updates open dialog status.
|
|
85
|
+
*
|
|
86
|
+
* @param isDialogOpen Flag indicating if there is an open dialog.
|
|
87
|
+
*/
|
|
88
|
+
static updateStatus(isDialogOpen) {
|
|
89
|
+
this.isDialogOpen = isDialogOpen;
|
|
90
|
+
const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
|
|
91
|
+
this.eventTarget.dispatchEvent(event);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
|
|
96
|
+
*
|
|
97
|
+
* @param handler Event handler.
|
|
98
|
+
* @returns Function that removes listener.
|
|
99
|
+
*/
|
|
100
|
+
static onOpenDialogStatusChange(handler) {
|
|
101
|
+
this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
102
|
+
return () => {
|
|
103
|
+
this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var __exports = {
|
|
108
|
+
__esModule: true
|
|
109
|
+
};
|
|
110
|
+
__exports.DialogNames = DialogNames;
|
|
111
|
+
__exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
|
|
112
|
+
__exports.DialogFactory = DialogFactory;
|
|
113
|
+
return __exports;
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=dialog-factory.js.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import Dialog from 'sap/m/Dialog';
|
|
2
|
+
import UI5Element from 'sap/ui/core/Element';
|
|
3
|
+
import Fragment from 'sap/ui/core/Fragment';
|
|
4
|
+
import RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
5
|
+
|
|
6
|
+
import { getTextBundle } from '../i18n';
|
|
7
|
+
|
|
8
|
+
import AddFragment, { AddFragmentOptions } from './controllers/AddFragment.controller';
|
|
9
|
+
import AddTableColumnFragments from './controllers/AddTableColumnFragments.controller';
|
|
10
|
+
import ControllerExtension from './controllers/ControllerExtension.controller';
|
|
11
|
+
import ExtensionPoint from './controllers/ExtensionPoint.controller';
|
|
12
|
+
|
|
13
|
+
import { ExtensionPointData } from './extension-point';
|
|
14
|
+
|
|
15
|
+
export const enum DialogNames {
|
|
16
|
+
ADD_FRAGMENT = 'AddFragment',
|
|
17
|
+
ADD_TABLE_COLUMN_FRAGMENTS = 'AddTableColumnFragments',
|
|
18
|
+
CONTROLLER_EXTENSION = 'ControllerExtension',
|
|
19
|
+
ADD_FRAGMENT_AT_EXTENSION_POINT = 'ExtensionPoint'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type Controller = AddFragment | AddTableColumnFragments | ControllerExtension | ExtensionPoint;
|
|
23
|
+
|
|
24
|
+
export const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
|
|
25
|
+
|
|
26
|
+
export class DialogFactory {
|
|
27
|
+
private static readonly eventTarget = new EventTarget();
|
|
28
|
+
private static isDialogOpen = false;
|
|
29
|
+
/**
|
|
30
|
+
* Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
public static get canOpenDialog(): boolean {
|
|
34
|
+
return !this.isDialogOpen;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Factory method for creating a new dialog.
|
|
39
|
+
*
|
|
40
|
+
* @param overlay - Control overlay.
|
|
41
|
+
* @param rta - Runtime Authoring instance.
|
|
42
|
+
* @param dialogName - Dialog name.
|
|
43
|
+
* @param extensionPointData - Control ID.
|
|
44
|
+
* @param options - Dialog options.
|
|
45
|
+
*/
|
|
46
|
+
public static async createDialog(
|
|
47
|
+
overlay: UI5Element,
|
|
48
|
+
rta: RuntimeAuthoring,
|
|
49
|
+
dialogName: DialogNames,
|
|
50
|
+
extensionPointData?: ExtensionPointData,
|
|
51
|
+
options: Partial<AddFragmentOptions> = {}
|
|
52
|
+
): Promise<void> {
|
|
53
|
+
if (this.isDialogOpen) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let controller: Controller;
|
|
57
|
+
const resources = await getTextBundle();
|
|
58
|
+
|
|
59
|
+
switch (dialogName) {
|
|
60
|
+
case DialogNames.ADD_FRAGMENT:
|
|
61
|
+
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
62
|
+
aggregation: options.aggregation,
|
|
63
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
67
|
+
controller = new AddTableColumnFragments(
|
|
68
|
+
`open.ux.preview.client.adp.controllers.${dialogName}`,
|
|
69
|
+
overlay,
|
|
70
|
+
rta,
|
|
71
|
+
{
|
|
72
|
+
aggregation: options.aggregation,
|
|
73
|
+
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
break;
|
|
77
|
+
case DialogNames.CONTROLLER_EXTENSION:
|
|
78
|
+
controller = new ControllerExtension(
|
|
79
|
+
`open.ux.preview.client.adp.controllers.${dialogName}`,
|
|
80
|
+
overlay,
|
|
81
|
+
rta
|
|
82
|
+
);
|
|
83
|
+
break;
|
|
84
|
+
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
85
|
+
controller = new ExtensionPoint(
|
|
86
|
+
`open.ux.preview.client.adp.controllers.${dialogName}`,
|
|
87
|
+
overlay,
|
|
88
|
+
rta,
|
|
89
|
+
extensionPointData!
|
|
90
|
+
);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
95
|
+
|
|
96
|
+
const dialog = (await Fragment.load({
|
|
97
|
+
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
98
|
+
controller,
|
|
99
|
+
id
|
|
100
|
+
})) as Dialog;
|
|
101
|
+
|
|
102
|
+
this.isDialogOpen = true;
|
|
103
|
+
dialog.attachBeforeClose(() => {
|
|
104
|
+
this.updateStatus(false);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
await controller.setup(dialog);
|
|
108
|
+
this.updateStatus(true);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Updates open dialog status.
|
|
113
|
+
*
|
|
114
|
+
* @param isDialogOpen Flag indicating if there is an open dialog.
|
|
115
|
+
*/
|
|
116
|
+
private static updateStatus(isDialogOpen: boolean) {
|
|
117
|
+
this.isDialogOpen = isDialogOpen;
|
|
118
|
+
const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
|
|
119
|
+
this.eventTarget.dispatchEvent(event);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
|
|
124
|
+
*
|
|
125
|
+
* @param handler Event handler.
|
|
126
|
+
* @returns Function that removes listener.
|
|
127
|
+
*/
|
|
128
|
+
public static onOpenDialogStatusChange(handler: (event: CustomEvent) => void | Promise<void>): () => void {
|
|
129
|
+
this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler as EventListener);
|
|
130
|
+
return () => {
|
|
131
|
+
this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler as EventListener);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -4,15 +4,15 @@ sap.ui.define([
|
|
|
4
4
|
'sap/ui/rta/command/CommandFactory',
|
|
5
5
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
6
6
|
'./utils',
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
], function (AddXMLAtExtensionPoint, CommandFactory, ___sap_ux_private_control_property_editor_common, ___utils,
|
|
7
|
+
'./dialog-factory',
|
|
8
|
+
'../cpe/communication-service'
|
|
9
|
+
], function (AddXMLAtExtensionPoint, CommandFactory, ___sap_ux_private_control_property_editor_common, ___utils, ___dialog_factory, ___cpe_communication_service) {
|
|
10
10
|
'use strict';
|
|
11
11
|
const addExtensionPoint = ___sap_ux_private_control_property_editor_common['addExtensionPoint'];
|
|
12
12
|
const createDeferred = ___utils['createDeferred'];
|
|
13
|
+
const DialogFactory = ___dialog_factory['DialogFactory'];
|
|
14
|
+
const DialogNames = ___dialog_factory['DialogNames'];
|
|
13
15
|
const CommunicationService = ___cpe_communication_service['CommunicationService'];
|
|
14
|
-
const DialogNames = ___init_dialogs['DialogNames'];
|
|
15
|
-
const handler = ___init_dialogs['handler'];
|
|
16
16
|
class ExtensionPointService {
|
|
17
17
|
actionId = 'CTX_ADDXML_AT_EXTENSIONPOINT';
|
|
18
18
|
constructor(rta) {
|
|
@@ -47,7 +47,7 @@ sap.ui.define([
|
|
|
47
47
|
async fragmentHandler(overlay, info) {
|
|
48
48
|
let deferred = createDeferred();
|
|
49
49
|
const name = this.selectedExtensionPointName;
|
|
50
|
-
await
|
|
50
|
+
await DialogFactory.createDialog(overlay, this.rta, DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT, {
|
|
51
51
|
name,
|
|
52
52
|
info,
|
|
53
53
|
deferred
|
|
@@ -7,9 +7,9 @@ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
|
7
7
|
import { ExternalAction, addExtensionPoint } from '@sap-ux-private/control-property-editor-common';
|
|
8
8
|
|
|
9
9
|
import { Deferred, createDeferred } from './utils';
|
|
10
|
+
import { DialogFactory, DialogNames } from './dialog-factory';
|
|
10
11
|
|
|
11
12
|
import { CommunicationService } from '../cpe/communication-service';
|
|
12
|
-
import { DialogNames, handler } from './init-dialogs';
|
|
13
13
|
|
|
14
14
|
type ActionService = {
|
|
15
15
|
execute: (controlId: string, actionId: string) => void;
|
|
@@ -100,7 +100,7 @@ export default class ExtensionPointService {
|
|
|
100
100
|
let deferred = createDeferred<DeferredExtPointData>();
|
|
101
101
|
const name = this.selectedExtensionPointName;
|
|
102
102
|
|
|
103
|
-
await
|
|
103
|
+
await DialogFactory.createDialog(overlay, this.rta, DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT, {
|
|
104
104
|
name,
|
|
105
105
|
info,
|
|
106
106
|
deferred
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/
|
|
3
|
+
sap.ui.define(["sap/ui/rta/util/hasStableId", "sap/ui/fl/Utils", "../cpe/utils", "./dialog-factory"], function (hasStableId, FlUtils, ___cpe_utils, ___dialog_factory) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
-
}
|
|
9
|
-
const AddFragment = _interopRequireDefault(__AddFragment);
|
|
10
|
-
const ControllerExtension = _interopRequireDefault(__ControllerExtension);
|
|
11
|
-
const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
|
|
12
6
|
const isReuseComponent = ___cpe_utils["isReuseComponent"];
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
var DialogNames = /*#__PURE__*/function (DialogNames) {
|
|
16
|
-
DialogNames["ADD_FRAGMENT"] = "AddFragment";
|
|
17
|
-
DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
|
|
18
|
-
DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
|
|
19
|
-
DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
|
|
20
|
-
return DialogNames;
|
|
21
|
-
}(DialogNames || {});
|
|
7
|
+
const DialogFactory = ___dialog_factory["DialogFactory"];
|
|
8
|
+
const DialogNames = ___dialog_factory["DialogNames"];
|
|
22
9
|
/**
|
|
23
10
|
* Handler for enablement of Extend With Controller context menu entry
|
|
24
11
|
*
|
|
@@ -78,48 +65,6 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl
|
|
|
78
65
|
return 'Add: Fragment';
|
|
79
66
|
};
|
|
80
67
|
|
|
81
|
-
/**
|
|
82
|
-
* Handler for new context menu entry
|
|
83
|
-
*
|
|
84
|
-
* @param overlay Control overlays
|
|
85
|
-
* @param rta Runtime Authoring
|
|
86
|
-
* @param dialogName Dialog name
|
|
87
|
-
* @param extensionPointData Control ID
|
|
88
|
-
* @param options Dialog options
|
|
89
|
-
*/
|
|
90
|
-
async function handler(overlay, rta, dialogName, extensionPointData) {
|
|
91
|
-
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
92
|
-
let controller;
|
|
93
|
-
const resources = await getTextBundle();
|
|
94
|
-
switch (dialogName) {
|
|
95
|
-
case DialogNames.ADD_FRAGMENT:
|
|
96
|
-
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
97
|
-
aggregation: options.aggregation,
|
|
98
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
99
|
-
});
|
|
100
|
-
break;
|
|
101
|
-
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
102
|
-
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
103
|
-
aggregation: options.aggregation,
|
|
104
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
105
|
-
});
|
|
106
|
-
break;
|
|
107
|
-
case DialogNames.CONTROLLER_EXTENSION:
|
|
108
|
-
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
109
|
-
break;
|
|
110
|
-
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
111
|
-
controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
115
|
-
const dialog = await Fragment.load({
|
|
116
|
-
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
117
|
-
controller,
|
|
118
|
-
id
|
|
119
|
-
});
|
|
120
|
-
await controller.setup(dialog);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
68
|
/**
|
|
124
69
|
* Adds a new item to the context menu
|
|
125
70
|
*
|
|
@@ -132,14 +77,14 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl
|
|
|
132
77
|
contextMenu.addMenuItem({
|
|
133
78
|
id: 'ADD_FRAGMENT',
|
|
134
79
|
text: getAddFragmentItemText,
|
|
135
|
-
handler: async overlays => await
|
|
80
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
136
81
|
icon: 'sap-icon://attachment-html',
|
|
137
82
|
enabled: overlays => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
138
83
|
});
|
|
139
84
|
contextMenu.addMenuItem({
|
|
140
85
|
id: 'EXTEND_CONTROLLER',
|
|
141
86
|
text: 'Extend With Controller',
|
|
142
|
-
handler: async overlays => await
|
|
87
|
+
handler: async overlays => await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
143
88
|
icon: 'sap-icon://create-form',
|
|
144
89
|
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
145
90
|
});
|
|
@@ -147,12 +92,10 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/rta/util/hasStableId", "sap/ui/fl
|
|
|
147
92
|
var __exports = {
|
|
148
93
|
__esModule: true
|
|
149
94
|
};
|
|
150
|
-
__exports.DialogNames = DialogNames;
|
|
151
95
|
__exports.isControllerExtensionEnabledForControl = isControllerExtensionEnabledForControl;
|
|
152
96
|
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
153
97
|
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
154
98
|
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
155
|
-
__exports.handler = handler;
|
|
156
99
|
__exports.initDialogs = initDialogs;
|
|
157
100
|
return __exports;
|
|
158
101
|
});
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
/** sap.m */
|
|
2
|
-
import type Dialog from 'sap/m/Dialog';
|
|
3
|
-
|
|
4
1
|
/** sap.ui.core */
|
|
5
|
-
import Fragment from 'sap/ui/core/Fragment';
|
|
6
2
|
import UI5Element from 'sap/ui/core/Element';
|
|
7
3
|
|
|
8
4
|
/** sap.ui.rta */
|
|
@@ -15,24 +11,10 @@ import FlUtils from 'sap/ui/fl/Utils';
|
|
|
15
11
|
/** sap.ui.dt */
|
|
16
12
|
import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
|
|
17
13
|
|
|
18
|
-
import AddFragment, { AddFragmentOptions } from './controllers/AddFragment.controller';
|
|
19
|
-
import ControllerExtension from './controllers/ControllerExtension.controller';
|
|
20
|
-
import { ExtensionPointData } from './extension-point';
|
|
21
|
-
import ExtensionPoint from './controllers/ExtensionPoint.controller';
|
|
22
14
|
import ManagedObject from 'sap/ui/base/ManagedObject';
|
|
23
15
|
import { isReuseComponent } from '../cpe/utils';
|
|
24
16
|
import { Ui5VersionInfo } from '../utils/version';
|
|
25
|
-
import {
|
|
26
|
-
import AddTableColumnFragments from './controllers/AddTableColumnFragments.controller';
|
|
27
|
-
|
|
28
|
-
export const enum DialogNames {
|
|
29
|
-
ADD_FRAGMENT = 'AddFragment',
|
|
30
|
-
ADD_TABLE_COLUMN_FRAGMENTS = 'AddTableColumnFragments',
|
|
31
|
-
CONTROLLER_EXTENSION = 'ControllerExtension',
|
|
32
|
-
ADD_FRAGMENT_AT_EXTENSION_POINT = 'ExtensionPoint'
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type Controller = AddFragment | AddTableColumnFragments | ControllerExtension | ExtensionPoint;
|
|
17
|
+
import { DialogFactory, DialogNames } from './dialog-factory';
|
|
36
18
|
|
|
37
19
|
/**
|
|
38
20
|
* Handler for enablement of Extend With Controller context menu entry
|
|
@@ -105,62 +87,6 @@ export const getAddFragmentItemText = (overlay: ElementOverlay) => {
|
|
|
105
87
|
return 'Add: Fragment';
|
|
106
88
|
};
|
|
107
89
|
|
|
108
|
-
/**
|
|
109
|
-
* Handler for new context menu entry
|
|
110
|
-
*
|
|
111
|
-
* @param overlay Control overlays
|
|
112
|
-
* @param rta Runtime Authoring
|
|
113
|
-
* @param dialogName Dialog name
|
|
114
|
-
* @param extensionPointData Control ID
|
|
115
|
-
* @param options Dialog options
|
|
116
|
-
*/
|
|
117
|
-
export async function handler(
|
|
118
|
-
overlay: UI5Element,
|
|
119
|
-
rta: RuntimeAuthoring,
|
|
120
|
-
dialogName: DialogNames,
|
|
121
|
-
extensionPointData?: ExtensionPointData,
|
|
122
|
-
options: Partial<AddFragmentOptions> = {}
|
|
123
|
-
): Promise<void> {
|
|
124
|
-
let controller: Controller;
|
|
125
|
-
const resources = await getTextBundle();
|
|
126
|
-
|
|
127
|
-
switch (dialogName) {
|
|
128
|
-
case DialogNames.ADD_FRAGMENT:
|
|
129
|
-
controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
130
|
-
aggregation: options.aggregation,
|
|
131
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
132
|
-
});
|
|
133
|
-
break;
|
|
134
|
-
case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
|
|
135
|
-
controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
|
|
136
|
-
aggregation: options.aggregation,
|
|
137
|
-
title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
|
|
138
|
-
});
|
|
139
|
-
break;
|
|
140
|
-
case DialogNames.CONTROLLER_EXTENSION:
|
|
141
|
-
controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
|
|
142
|
-
break;
|
|
143
|
-
case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
|
|
144
|
-
controller = new ExtensionPoint(
|
|
145
|
-
`open.ux.preview.client.adp.controllers.${dialogName}`,
|
|
146
|
-
overlay,
|
|
147
|
-
rta,
|
|
148
|
-
extensionPointData!
|
|
149
|
-
);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
|
|
154
|
-
|
|
155
|
-
const dialog = await Fragment.load({
|
|
156
|
-
name: `open.ux.preview.client.adp.ui.${dialogName}`,
|
|
157
|
-
controller,
|
|
158
|
-
id
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
await controller.setup(dialog as Dialog);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
90
|
/**
|
|
165
91
|
* Adds a new item to the context menu
|
|
166
92
|
*
|
|
@@ -174,7 +100,8 @@ export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[], ui5Ve
|
|
|
174
100
|
contextMenu.addMenuItem({
|
|
175
101
|
id: 'ADD_FRAGMENT',
|
|
176
102
|
text: getAddFragmentItemText,
|
|
177
|
-
handler: async (overlays: UI5Element[]) =>
|
|
103
|
+
handler: async (overlays: UI5Element[]) =>
|
|
104
|
+
await DialogFactory.createDialog(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
178
105
|
icon: 'sap-icon://attachment-html',
|
|
179
106
|
enabled: (overlays: ElementOverlay[]) => isFragmentCommandEnabled(overlays, ui5VersionInfo)
|
|
180
107
|
});
|
|
@@ -182,7 +109,8 @@ export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[], ui5Ve
|
|
|
182
109
|
contextMenu.addMenuItem({
|
|
183
110
|
id: 'EXTEND_CONTROLLER',
|
|
184
111
|
text: 'Extend With Controller',
|
|
185
|
-
handler: async (overlays: UI5Element[]) =>
|
|
112
|
+
handler: async (overlays: UI5Element[]) =>
|
|
113
|
+
await DialogFactory.createDialog(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
186
114
|
icon: 'sap-icon://create-form',
|
|
187
115
|
enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds, ui5VersionInfo)
|
|
188
116
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "../../init-dialogs", "../../api-handler", "../simple-quick-action-base"], function (OverlayRegistry, _____utils_version, ____utils, _____cpe_quick_actions_utils, ____init_dialogs, ____api_handler, ___simple_quick_action_base) {
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "../../dialog-factory", "../../init-dialogs", "../../api-handler", "../simple-quick-action-base", "../dialog-enablement-validator"], function (OverlayRegistry, _____utils_version, ____utils, _____cpe_quick_actions_utils, ____dialog_factory, ____init_dialogs, ____api_handler, ___simple_quick_action_base, ___dialog_enablement_validator) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const getUi5Version = _____utils_version["getUi5Version"];
|
|
7
7
|
const getAllSyncViewsIds = ____utils["getAllSyncViewsIds"];
|
|
8
8
|
const getControllerInfoForControl = ____utils["getControllerInfoForControl"];
|
|
9
9
|
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const DialogFactory = ____dialog_factory["DialogFactory"];
|
|
11
|
+
const DialogNames = ____dialog_factory["DialogNames"];
|
|
12
12
|
const isControllerExtensionEnabledForControl = ____init_dialogs["isControllerExtensionEnabledForControl"];
|
|
13
13
|
const getExistingController = ____api_handler["getExistingController"];
|
|
14
14
|
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
15
|
+
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
15
16
|
const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
16
17
|
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
17
18
|
|
|
@@ -20,7 +21,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../uti
|
|
|
20
21
|
*/
|
|
21
22
|
class AddControllerToPageQuickAction extends SimpleQuickActionDefinitionBase {
|
|
22
23
|
constructor(context) {
|
|
23
|
-
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context);
|
|
24
|
+
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
|
|
24
25
|
}
|
|
25
26
|
controllerExists = false;
|
|
26
27
|
async initialize() {
|
|
@@ -41,7 +42,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../uti
|
|
|
41
42
|
async execute() {
|
|
42
43
|
if (this.control) {
|
|
43
44
|
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
44
|
-
await
|
|
45
|
+
await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
|
|
45
46
|
}
|
|
46
47
|
return [];
|
|
47
48
|
}
|
|
@@ -8,9 +8,11 @@ import type {
|
|
|
8
8
|
QuickActionContext,
|
|
9
9
|
SimpleQuickActionDefinition
|
|
10
10
|
} from '../../../cpe/quick-actions/quick-action-definition';
|
|
11
|
-
import {
|
|
11
|
+
import { DialogFactory, DialogNames } from '../../dialog-factory';
|
|
12
|
+
import { isControllerExtensionEnabledForControl } from '../../init-dialogs';
|
|
12
13
|
import { getExistingController } from '../../api-handler';
|
|
13
14
|
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
15
|
+
import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
|
|
14
16
|
|
|
15
17
|
export const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
16
18
|
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
@@ -23,7 +25,7 @@ export class AddControllerToPageQuickAction
|
|
|
23
25
|
implements SimpleQuickActionDefinition
|
|
24
26
|
{
|
|
25
27
|
constructor(context: QuickActionContext) {
|
|
26
|
-
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context);
|
|
28
|
+
super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context, [DIALOG_ENABLEMENT_VALIDATOR]);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
private controllerExists = false;
|
|
@@ -52,7 +54,7 @@ export class AddControllerToPageQuickAction
|
|
|
52
54
|
async execute(): Promise<FlexCommand[]> {
|
|
53
55
|
if (this.control) {
|
|
54
56
|
const overlay = OverlayRegistry.getOverlay(this.control) || [];
|
|
55
|
-
await
|
|
57
|
+
await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
|
|
56
58
|
}
|
|
57
59
|
return [];
|
|
58
60
|
}
|