@sap-ux/preview-middleware 0.16.64 → 0.16.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/client/adp/command-executor.ts +2 -2
  2. package/dist/client/adp/controllers/AddFragment.controller.js +13 -0
  3. package/dist/client/adp/controllers/AddFragment.controller.ts +17 -1
  4. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -69
  5. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +11 -23
  6. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +34 -0
  7. package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +35 -0
  8. package/dist/client/adp/quick-actions/common/op-add-header-field.js +42 -58
  9. package/dist/client/adp/quick-actions/common/op-add-header-field.ts +5 -34
  10. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -65
  11. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +12 -27
  12. package/dist/client/adp/quick-actions/fe-v2/registry.js +3 -2
  13. package/dist/client/adp/quick-actions/fe-v2/registry.ts +3 -1
  14. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +76 -83
  15. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +11 -19
  16. package/dist/client/adp/quick-actions/fe-v4/registry.js +3 -2
  17. package/dist/client/adp/quick-actions/fe-v4/registry.ts +3 -1
  18. package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -0
  19. package/dist/client/adp/quick-actions/simple-quick-action-base.ts +53 -0
  20. package/dist/client/cpe/changes/service.js +4 -1
  21. package/dist/client/cpe/changes/service.ts +4 -1
  22. package/dist/client/messagebundle.properties +1 -0
  23. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +5 -1
  24. package/package.json +7 -7
  25. package/dist/client/tsconfig.tsbuildinfo +0 -1
@@ -28,13 +28,13 @@ export default class CommandExecutor {
28
28
  * @param designMetadata Design time metadata
29
29
  * @param flexSettings Additional flex settings
30
30
  */
31
- public async getCommand(
31
+ public async getCommand<T>(
32
32
  runtimeControl: ManagedObject,
33
33
  commandName: CommandNames,
34
34
  modifiedValue: object,
35
35
  designMetadata: DesignTimeMetadata,
36
36
  flexSettings: FlexSettings
37
- ): Promise<FlexCommand> {
37
+ ): Promise<FlexCommand<T>> {
38
38
  try {
39
39
  return await CommandFactory.getCommandFor(
40
40
  runtimeControl,
@@ -214,7 +214,20 @@ sap.ui.define(["sap/ui/model/json/JSONModel", "sap/ui/dt/OverlayRegistry", "../c
214
214
  targetAggregation: targetAggregation ?? 'content'
215
215
  };
216
216
  const command = await this.commandExecutor.getCommand(this.runtimeControl, 'addXML', modifiedValue, designMetadata, flexSettings);
217
+ const templateName = this.getFragmentTemplateName(modifiedValue.targetAggregation);
218
+ if (templateName) {
219
+ const preparedChange = command.getPreparedChange();
220
+ const content = preparedChange.getContent();
221
+ preparedChange.setContent({
222
+ ...content,
223
+ templateName
224
+ });
225
+ }
217
226
  await this.commandExecutor.pushAndExecuteCommand(command);
227
+ },
228
+ getFragmentTemplateName: function _getFragmentTemplateName(targetAggregation) {
229
+ const currentControlName = this.runtimeControl.getMetadata().getName();
230
+ return currentControlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections' ? 'OBJECT_PAGE_CUSTOM_SECTION' : '';
218
231
  }
219
232
  });
220
233
  return AddFragment;
@@ -20,6 +20,9 @@ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
20
20
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
21
21
  import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
22
22
 
23
+ /** sap.ui.fl */
24
+ import {type AddFragmentChangeContentType} from 'sap/ui/fl/Change';
25
+
23
26
  import ControlUtils from '../control-utils';
24
27
  import CommandExecutor from '../command-executor';
25
28
  import { getFragments } from '../api-handler';
@@ -274,7 +277,7 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
274
277
  targetAggregation: targetAggregation ?? 'content'
275
278
  };
276
279
 
277
- const command = await this.commandExecutor.getCommand(
280
+ const command = await this.commandExecutor.getCommand<AddFragmentChangeContentType>(
278
281
  this.runtimeControl,
279
282
  'addXML',
280
283
  modifiedValue,
@@ -282,6 +285,19 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
282
285
  flexSettings
283
286
  );
284
287
 
288
+ const templateName = this.getFragmentTemplateName(modifiedValue.targetAggregation);
289
+ if (templateName) {
290
+ const preparedChange = command.getPreparedChange();
291
+ const content = preparedChange.getContent();
292
+ preparedChange.setContent({ ...content, templateName });
293
+ }
285
294
  await this.commandExecutor.pushAndExecuteCommand(command);
286
295
  }
296
+
297
+ private getFragmentTemplateName(targetAggregation: string): string {
298
+ const currentControlName = this.runtimeControl.getMetadata().getName();
299
+ return currentControlName === 'sap.uxap.ObjectPageLayout' && targetAggregation === 'sections'
300
+ ? 'OBJECT_PAGE_CUSTOM_SECTION'
301
+ : '';
302
+ }
287
303
  }
@@ -1,70 +1,56 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/dt/OverlayRegistry',
4
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../../utils/version',
6
- '../../utils',
7
- '../../../cpe/quick-actions/utils',
8
- '../../init-dialogs',
9
- '../../api-handler'
10
- ], function (OverlayRegistry, ___sap_ux_private_control_property_editor_common, _____utils_version, ____utils, _____cpe_quick_actions_utils, ____init_dialogs, ____api_handler) {
11
- 'use strict';
12
- const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
13
- const getUi5Version = _____utils_version['getUi5Version'];
14
- const getAllSyncViewsIds = ____utils['getAllSyncViewsIds'];
15
- const getControllerInfoForControl = ____utils['getControllerInfoForControl'];
16
- const getRelevantControlFromActivePage = _____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
17
- const DialogNames = ____init_dialogs['DialogNames'];
18
- const handler = ____init_dialogs['handler'];
19
- const isControllerExtensionEnabledForControl = ____init_dialogs['isControllerExtensionEnabledForControl'];
20
- const getExistingController = ____api_handler['getExistingController'];
21
- const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
22
- const CONTROL_TYPES = [
23
- 'sap.f.DynamicPage',
24
- 'sap.uxap.ObjectPageLayout'
25
- ];
26
- class AddControllerToPageQuickAction {
27
- kind = SIMPLE_QUICK_ACTION_KIND;
28
- type = ADD_CONTROLLER_TO_PAGE_TYPE;
29
- get id() {
30
- return `${ this.context.key }-${ this.type }`;
31
- }
32
- isActive = false;
33
- controllerExists = false;
34
- constructor(context) {
35
- this.context = context;
36
- }
37
- async initialize() {
38
- for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
39
- const version = await getUi5Version();
40
- const syncViewsIds = await getAllSyncViewsIds(version);
41
- const controlInfo = getControllerInfoForControl(control);
42
- const data = await getExistingController(controlInfo.controllerName);
43
- this.isActive = isControllerExtensionEnabledForControl(control, syncViewsIds, version);
44
- this.controllerExists = data?.controllerExists;
45
- this.control = control;
46
- break;
47
- }
48
- }
49
- getActionObject() {
50
- const key = this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
51
- return {
52
- kind: SIMPLE_QUICK_ACTION_KIND,
53
- id: this.id,
54
- enabled: this.isActive,
55
- title: this.context.resourceBundle.getText(key)
56
- };
57
- }
58
- async execute() {
59
- if (this.control) {
60
- const overlay = OverlayRegistry.getOverlay(this.control) || [];
61
- await handler(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
62
- }
63
- return [];
64
- }
1
+ "use strict";
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) {
4
+ "use strict";
5
+
6
+ const getUi5Version = _____utils_version["getUi5Version"];
7
+ const getAllSyncViewsIds = ____utils["getAllSyncViewsIds"];
8
+ const getControllerInfoForControl = ____utils["getControllerInfoForControl"];
9
+ const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
10
+ const DialogNames = ____init_dialogs["DialogNames"];
11
+ const handler = ____init_dialogs["handler"];
12
+ const isControllerExtensionEnabledForControl = ____init_dialogs["isControllerExtensionEnabledForControl"];
13
+ const getExistingController = ____api_handler["getExistingController"];
14
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
15
+ const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
16
+ const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
17
+
18
+ /**
19
+ * Quick Action for adding controller to a page.
20
+ */
21
+ class AddControllerToPageQuickAction extends SimpleQuickActionDefinitionBase {
22
+ constructor(context) {
23
+ super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context);
65
24
  }
66
- var __exports = { __esModule: true };
67
- __exports.ADD_CONTROLLER_TO_PAGE_TYPE = ADD_CONTROLLER_TO_PAGE_TYPE;
68
- __exports.AddControllerToPageQuickAction = AddControllerToPageQuickAction;
69
- return __exports;
70
- });
25
+ controllerExists = false;
26
+ async initialize() {
27
+ for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
28
+ const version = await getUi5Version();
29
+ const syncViewsIds = await getAllSyncViewsIds(version);
30
+ const controlInfo = getControllerInfoForControl(control);
31
+ const data = await getExistingController(controlInfo.controllerName);
32
+ this.controllerExists = data?.controllerExists;
33
+ const isActiveAction = isControllerExtensionEnabledForControl(control, syncViewsIds, version);
34
+ this.control = isActiveAction ? control : undefined;
35
+ break;
36
+ }
37
+ }
38
+ get textKey() {
39
+ return this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
40
+ }
41
+ async execute() {
42
+ if (this.control) {
43
+ const overlay = OverlayRegistry.getOverlay(this.control) || [];
44
+ await handler(overlay, this.context.rta, DialogNames.CONTROLLER_EXTENSION);
45
+ }
46
+ return [];
47
+ }
48
+ }
49
+ var __exports = {
50
+ __esModule: true
51
+ };
52
+ __exports.ADD_CONTROLLER_TO_PAGE_TYPE = ADD_CONTROLLER_TO_PAGE_TYPE;
53
+ __exports.AddControllerToPageQuickAction = AddControllerToPageQuickAction;
54
+ return __exports;
55
+ });
56
+ //# sourceMappingURL=add-controller-to-page.js.map
@@ -1,8 +1,5 @@
1
1
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
2
2
  import FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
- import UI5Element from 'sap/ui/core/Element';
4
-
5
- import { SIMPLE_QUICK_ACTION_KIND, SimpleQuickAction } from '@sap-ux-private/control-property-editor-common';
6
3
 
7
4
  import { getUi5Version } from '../../../utils/version';
8
5
  import { getAllSyncViewsIds, getControllerInfoForControl } from '../../utils';
@@ -11,28 +8,25 @@ import type {
11
8
  QuickActionContext,
12
9
  SimpleQuickActionDefinition
13
10
  } from '../../../cpe/quick-actions/quick-action-definition';
14
-
15
11
  import { DialogNames, handler, isControllerExtensionEnabledForControl } from '../../init-dialogs';
16
12
  import { getExistingController } from '../../api-handler';
13
+ import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
17
14
 
18
15
  export const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
19
16
  const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
20
17
 
21
-
22
18
  /**
23
19
  * Quick Action for adding controller to a page.
24
20
  */
25
- export class AddControllerToPageQuickAction implements SimpleQuickActionDefinition {
26
- readonly kind = SIMPLE_QUICK_ACTION_KIND;
27
- readonly type = ADD_CONTROLLER_TO_PAGE_TYPE;
28
- public get id(): string {
29
- return `${this.context.key}-${this.type}`;
21
+ export class AddControllerToPageQuickAction
22
+ extends SimpleQuickActionDefinitionBase
23
+ implements SimpleQuickActionDefinition
24
+ {
25
+ constructor(context: QuickActionContext) {
26
+ super(ADD_CONTROLLER_TO_PAGE_TYPE, CONTROL_TYPES, '', context);
30
27
  }
31
28
 
32
- isActive = false;
33
29
  private controllerExists = false;
34
- private control: UI5Element | undefined;
35
- constructor(private context: QuickActionContext) {}
36
30
 
37
31
  async initialize(): Promise<void> {
38
32
  for (const control of getRelevantControlFromActivePage(
@@ -44,21 +38,15 @@ export class AddControllerToPageQuickAction implements SimpleQuickActionDefiniti
44
38
  const syncViewsIds = await getAllSyncViewsIds(version);
45
39
  const controlInfo = getControllerInfoForControl(control);
46
40
  const data = await getExistingController(controlInfo.controllerName);
47
- this.isActive = isControllerExtensionEnabledForControl(control, syncViewsIds, version);
48
41
  this.controllerExists = data?.controllerExists;
49
- this.control = control;
42
+ const isActiveAction = isControllerExtensionEnabledForControl(control, syncViewsIds, version);
43
+ this.control = isActiveAction ? control : undefined;
50
44
  break;
51
45
  }
52
46
  }
53
47
 
54
- getActionObject(): SimpleQuickAction {
55
- const key = this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
56
- return {
57
- kind: SIMPLE_QUICK_ACTION_KIND,
58
- id: this.id,
59
- enabled: this.isActive,
60
- title: this.context.resourceBundle.getText(key)
61
- };
48
+ protected get textKey() {
49
+ return this.controllerExists ? 'QUICK_ACTION_SHOW_PAGE_CONTROLLER' : 'QUICK_ACTION_ADD_PAGE_CONTROLLER';
62
50
  }
63
51
 
64
52
  async execute(): Promise<FlexCommand[]> {
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../init-dialogs", "../../../cpe/quick-actions/utils", "../simple-quick-action-base"], function (OverlayRegistry, ____init_dialogs, _____cpe_quick_actions_utils, ___simple_quick_action_base) {
4
+ "use strict";
5
+
6
+ const DialogNames = ____init_dialogs["DialogNames"];
7
+ const handler = ____init_dialogs["handler"];
8
+ const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
9
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
10
+ const OP_ADD_CUSTOM_SECTION = 'op-add-custom-section';
11
+ const CONTROL_TYPES = ['sap.uxap.ObjectPageLayout'];
12
+
13
+ /**
14
+ * Quick Action for adding a Header Field to an Object Page.
15
+ */
16
+ class AddCustomSectionQuickAction extends SimpleQuickActionDefinitionBase {
17
+ constructor(context) {
18
+ super(OP_ADD_CUSTOM_SECTION, CONTROL_TYPES, 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION', context);
19
+ }
20
+ async execute() {
21
+ const objectPageLayout = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)[0];
22
+ const overlay = OverlayRegistry.getOverlay(objectPageLayout) || [];
23
+ await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'sections');
24
+ return [];
25
+ }
26
+ }
27
+ var __exports = {
28
+ __esModule: true
29
+ };
30
+ __exports.OP_ADD_CUSTOM_SECTION = OP_ADD_CUSTOM_SECTION;
31
+ __exports.AddCustomSectionQuickAction = AddCustomSectionQuickAction;
32
+ return __exports;
33
+ });
34
+ //# sourceMappingURL=op-add-custom-section.js.map
@@ -0,0 +1,35 @@
1
+ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
2
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
+ import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
4
+
5
+ import { DialogNames, handler } from '../../init-dialogs';
6
+ import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
7
+ import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
8
+ import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
9
+
10
+ export const OP_ADD_CUSTOM_SECTION = 'op-add-custom-section';
11
+ const CONTROL_TYPES = ['sap.uxap.ObjectPageLayout'];
12
+
13
+ /**
14
+ * Quick Action for adding a Header Field to an Object Page.
15
+ */
16
+ export class AddCustomSectionQuickAction
17
+ extends SimpleQuickActionDefinitionBase
18
+ implements SimpleQuickActionDefinition
19
+ {
20
+ constructor(context: QuickActionContext) {
21
+ super(OP_ADD_CUSTOM_SECTION, CONTROL_TYPES, 'QUICK_ACTION_OP_ADD_CUSTOM_SECTION', context);
22
+ }
23
+
24
+ async execute(): Promise<FlexCommand[]> {
25
+ const objectPageLayout = getRelevantControlFromActivePage(
26
+ this.context.controlIndex,
27
+ this.context.view,
28
+ CONTROL_TYPES
29
+ )[0] as ObjectPageLayout;
30
+
31
+ const overlay = OverlayRegistry.getOverlay(objectPageLayout) || [];
32
+ await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'sections');
33
+ return [];
34
+ }
35
+ }
@@ -1,59 +1,43 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/dt/OverlayRegistry',
4
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../../adp/init-dialogs',
6
- '../../../cpe/quick-actions/utils',
7
- '../../../utils/core'
8
- ], function (OverlayRegistry, ___sap_ux_private_control_property_editor_common, _____adp_init_dialogs, _____cpe_quick_actions_utils, _____utils_core) {
9
- 'use strict';
10
- const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
11
- const DialogNames = _____adp_init_dialogs['DialogNames'];
12
- const handler = _____adp_init_dialogs['handler'];
13
- const getRelevantControlFromActivePage = _____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
14
- const isA = _____utils_core['isA'];
15
- const OP_ADD_HEADER_FIELD_TYPE = 'op-add-header-field';
16
- const CONTROL_TYPES = ['sap.uxap.ObjectPageLayout'];
17
- class AddHeaderFieldQuickAction {
18
- kind = SIMPLE_QUICK_ACTION_KIND;
19
- type = OP_ADD_HEADER_FIELD_TYPE;
20
- get id() {
21
- return `${ this.context.key }-${ this.type }`;
22
- }
23
- isActive = false;
24
- constructor(context) {
25
- this.context = context;
26
- }
27
- initialize() {
28
- for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
29
- this.isActive = true;
30
- this.control = control;
31
- break;
32
- }
33
- }
34
- getActionObject() {
35
- return {
36
- kind: SIMPLE_QUICK_ACTION_KIND,
37
- id: this.id,
38
- enabled: this.isActive,
39
- title: this.context.resourceBundle.getText('QUICK_ACTION_OP_ADD_HEADER_FIELD')
40
- };
41
- }
42
- async execute() {
43
- const objectPageLayout = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)[0];
44
- const headerContent = objectPageLayout.getHeaderContent();
45
- if (headerContent.length === 1 && isA('sap.m.FlexBox', headerContent[0])) {
46
- const overlay = OverlayRegistry.getOverlay(headerContent[0]) || [];
47
- await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'items');
48
- } else if (this.control) {
49
- const overlay = OverlayRegistry.getOverlay(this.control) || [];
50
- await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'headerContent');
51
- }
52
- return [];
53
- }
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../adp/init-dialogs", "../../../cpe/quick-actions/utils", "../../../utils/core", "../simple-quick-action-base"], function (OverlayRegistry, _____adp_init_dialogs, _____cpe_quick_actions_utils, _____utils_core, ___simple_quick_action_base) {
4
+ "use strict";
5
+
6
+ const DialogNames = _____adp_init_dialogs["DialogNames"];
7
+ const handler = _____adp_init_dialogs["handler"];
8
+ const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
9
+ const isA = _____utils_core["isA"];
10
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
11
+ const OP_ADD_HEADER_FIELD_TYPE = 'op-add-header-field';
12
+ const CONTROL_TYPES = ['sap.uxap.ObjectPageLayout'];
13
+
14
+ /**
15
+ * Quick Action for adding a Header Field to an Object Page.
16
+ */
17
+ class AddHeaderFieldQuickAction extends SimpleQuickActionDefinitionBase {
18
+ constructor(context) {
19
+ super(OP_ADD_HEADER_FIELD_TYPE, CONTROL_TYPES, 'QUICK_ACTION_OP_ADD_HEADER_FIELD', context);
54
20
  }
55
- var __exports = { __esModule: true };
56
- __exports.OP_ADD_HEADER_FIELD_TYPE = OP_ADD_HEADER_FIELD_TYPE;
57
- __exports.AddHeaderFieldQuickAction = AddHeaderFieldQuickAction;
58
- return __exports;
59
- });
21
+ async execute() {
22
+ const objectPageLayout = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)[0];
23
+ const headerContent = objectPageLayout.getHeaderContent();
24
+
25
+ // check if only flex box exist in the headerContent.
26
+ if (headerContent.length === 1 && isA('sap.m.FlexBox', headerContent[0])) {
27
+ const overlay = OverlayRegistry.getOverlay(headerContent[0]) || [];
28
+ await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'items');
29
+ } else if (this.control) {
30
+ const overlay = OverlayRegistry.getOverlay(this.control) || [];
31
+ await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, 'headerContent');
32
+ }
33
+ return [];
34
+ }
35
+ }
36
+ var __exports = {
37
+ __esModule: true
38
+ };
39
+ __exports.OP_ADD_HEADER_FIELD_TYPE = OP_ADD_HEADER_FIELD_TYPE;
40
+ __exports.AddHeaderFieldQuickAction = AddHeaderFieldQuickAction;
41
+ return __exports;
42
+ });
43
+ //# sourceMappingURL=op-add-header-field.js.map
@@ -1,52 +1,23 @@
1
1
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
2
2
  import FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
- import UI5Element from 'sap/ui/core/Element';
4
3
  import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
5
4
  import FlexBox from 'sap/m/FlexBox';
6
5
 
7
- import { SIMPLE_QUICK_ACTION_KIND, SimpleQuickAction } from '@sap-ux-private/control-property-editor-common';
8
-
9
6
  import { DialogNames, handler } from '../../../adp/init-dialogs';
10
-
11
7
  import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
12
8
  import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
13
9
  import { isA } from '../../../utils/core';
10
+ import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
11
+
14
12
  export const OP_ADD_HEADER_FIELD_TYPE = 'op-add-header-field';
15
13
  const CONTROL_TYPES = ['sap.uxap.ObjectPageLayout'];
16
14
 
17
15
  /**
18
16
  * Quick Action for adding a Header Field to an Object Page.
19
17
  */
20
- export class AddHeaderFieldQuickAction implements SimpleQuickActionDefinition {
21
- readonly kind = SIMPLE_QUICK_ACTION_KIND;
22
- readonly type = OP_ADD_HEADER_FIELD_TYPE;
23
- public get id(): string {
24
- return `${this.context.key}-${this.type}`;
25
- }
26
-
27
- isActive = false;
28
- private control: UI5Element | undefined;
29
- constructor(private context: QuickActionContext) {}
30
-
31
- initialize(): void {
32
- for (const control of getRelevantControlFromActivePage(
33
- this.context.controlIndex,
34
- this.context.view,
35
- CONTROL_TYPES
36
- )) {
37
- this.isActive = true;
38
- this.control = control;
39
- break;
40
- }
41
- }
42
-
43
- getActionObject(): SimpleQuickAction {
44
- return {
45
- kind: SIMPLE_QUICK_ACTION_KIND,
46
- id: this.id,
47
- enabled: this.isActive,
48
- title: this.context.resourceBundle.getText('QUICK_ACTION_OP_ADD_HEADER_FIELD')
49
- };
18
+ export class AddHeaderFieldQuickAction extends SimpleQuickActionDefinitionBase implements SimpleQuickActionDefinition {
19
+ constructor(context: QuickActionContext) {
20
+ super(OP_ADD_HEADER_FIELD_TYPE, CONTROL_TYPES, 'QUICK_ACTION_OP_ADD_HEADER_FIELD', context);
50
21
  }
51
22
 
52
23
  async execute(): Promise<FlexCommand[]> {
@@ -1,67 +1,59 @@
1
- 'use strict';
2
- sap.ui.define([
3
- 'sap/ui/rta/command/CommandFactory',
4
- 'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../../cpe/quick-actions/utils',
6
- '../../../utils/core'
7
- ], function (CommandFactory, ___sap_ux_private_control_property_editor_common, _____cpe_quick_actions_utils, _____utils_core) {
8
- 'use strict';
9
- const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
10
- const pageHasControlId = _____cpe_quick_actions_utils['pageHasControlId'];
11
- const getControlById = _____utils_core['getControlById'];
12
- const ENABLE_CLEAR_FILTER_BAR_TYPE = 'enable-clear-filter-bar';
13
- const PROPERTY_NAME = 'showClearOnFB';
14
- const CONTROL_TYPE = 'sap.ui.comp.smartfilterbar.SmartFilterBar';
15
- class ToggleClearFilterBarQuickAction {
16
- kind = SIMPLE_QUICK_ACTION_KIND;
17
- type = ENABLE_CLEAR_FILTER_BAR_TYPE;
18
- get id() {
19
- return `${ this.context.key }-${ this.type }`;
20
- }
21
- get isActive() {
22
- return !!this.filterBar;
23
- }
24
- isClearButtonEnabled = false;
25
- constructor(context) {
26
- this.context = context;
27
- }
28
- initialize() {
29
- const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
30
- for (const control of controls) {
31
- const isActionApplicable = pageHasControlId(this.context.view, control.controlId);
32
- const modifiedControl = getControlById(control.controlId);
33
- if (isActionApplicable && modifiedControl) {
34
- this.isClearButtonEnabled = modifiedControl.getShowClearOnFB();
35
- this.filterBar = modifiedControl;
36
- }
37
- }
38
- }
39
- getActionObject() {
40
- const key = this.isClearButtonEnabled ? 'V2_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR' : 'V2_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR';
41
- return {
42
- kind: SIMPLE_QUICK_ACTION_KIND,
43
- id: this.id,
44
- enabled: this.isActive,
45
- title: this.context.resourceBundle.getText(key)
46
- };
47
- }
48
- async execute() {
49
- if (this.filterBar) {
50
- const {flexSettings} = this.context;
51
- const modifiedValue = {
52
- generator: flexSettings.generator,
53
- propertyName: PROPERTY_NAME,
54
- newValue: !this.isClearButtonEnabled
55
- };
56
- const command = await CommandFactory.getCommandFor(this.filterBar, 'Property', modifiedValue, null, flexSettings);
57
- this.isClearButtonEnabled = !this.isClearButtonEnabled;
58
- return [command];
59
- }
60
- return [];
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/rta/command/CommandFactory", "../../../cpe/quick-actions/utils", "../../../utils/core", "../simple-quick-action-base"], function (CommandFactory, _____cpe_quick_actions_utils, _____utils_core, ___simple_quick_action_base) {
4
+ "use strict";
5
+
6
+ const pageHasControlId = _____cpe_quick_actions_utils["pageHasControlId"];
7
+ const getControlById = _____utils_core["getControlById"];
8
+ const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
9
+ const ENABLE_CLEAR_FILTER_BAR_TYPE = 'enable-clear-filter-bar';
10
+ const PROPERTY_NAME = 'showClearOnFB';
11
+ const CONTROL_TYPE = 'sap.ui.comp.smartfilterbar.SmartFilterBar';
12
+
13
+ /**
14
+ * Quick Action for toggling the visibility of "clear filter bar" button in List Report page.
15
+ */
16
+ class ToggleClearFilterBarQuickAction extends SimpleQuickActionDefinitionBase {
17
+ constructor(context) {
18
+ super(ENABLE_CLEAR_FILTER_BAR_TYPE, [], '', context);
19
+ }
20
+ isClearButtonEnabled = false;
21
+ initialize() {
22
+ const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
23
+ for (const control of controls) {
24
+ const isActionApplicable = pageHasControlId(this.context.view, control.controlId);
25
+ const modifiedControl = getControlById(control.controlId);
26
+ if (isActionApplicable && modifiedControl) {
27
+ this.isClearButtonEnabled = modifiedControl.getShowClearOnFB();
28
+ this.control = modifiedControl;
61
29
  }
30
+ }
31
+ }
32
+ get textKey() {
33
+ return this.isClearButtonEnabled ? 'V2_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR' : 'V2_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR';
34
+ }
35
+ async execute() {
36
+ if (this.control) {
37
+ const {
38
+ flexSettings
39
+ } = this.context;
40
+ const modifiedValue = {
41
+ generator: flexSettings.generator,
42
+ propertyName: PROPERTY_NAME,
43
+ newValue: !this.isClearButtonEnabled
44
+ };
45
+ const command = await CommandFactory.getCommandFor(this.control, 'Property', modifiedValue, null, flexSettings);
46
+ this.isClearButtonEnabled = !this.isClearButtonEnabled;
47
+ return [command];
48
+ }
49
+ return [];
62
50
  }
63
- var __exports = { __esModule: true };
64
- __exports.ENABLE_CLEAR_FILTER_BAR_TYPE = ENABLE_CLEAR_FILTER_BAR_TYPE;
65
- __exports.ToggleClearFilterBarQuickAction = ToggleClearFilterBarQuickAction;
66
- return __exports;
67
- });
51
+ }
52
+ var __exports = {
53
+ __esModule: true
54
+ };
55
+ __exports.ENABLE_CLEAR_FILTER_BAR_TYPE = ENABLE_CLEAR_FILTER_BAR_TYPE;
56
+ __exports.ToggleClearFilterBarQuickAction = ToggleClearFilterBarQuickAction;
57
+ return __exports;
58
+ });
59
+ //# sourceMappingURL=lr-toggle-clear-filter-bar.js.map