@sap-ux/preview-middleware 0.16.57 → 0.16.59

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 (71) hide show
  1. package/dist/client/adp/controllers/AddFragment.controller.js +3 -2
  2. package/dist/client/adp/controllers/AddFragment.controller.ts +2 -2
  3. package/dist/client/adp/controllers/ControllerExtension.controller.js +3 -18
  4. package/dist/client/adp/controllers/ControllerExtension.controller.ts +2 -24
  5. package/dist/client/adp/init-dialogs.js +22 -7
  6. package/dist/client/adp/init-dialogs.ts +31 -8
  7. package/dist/client/adp/init.js +19 -40
  8. package/dist/client/adp/init.ts +17 -56
  9. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +70 -0
  10. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +71 -0
  11. package/dist/client/adp/quick-actions/common/op-add-header-field.js +59 -0
  12. package/dist/client/adp/quick-actions/common/op-add-header-field.ts +71 -0
  13. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +261 -0
  14. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +305 -0
  15. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +67 -0
  16. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +84 -0
  17. package/dist/client/adp/quick-actions/fe-v2/registry.js +57 -0
  18. package/dist/client/adp/quick-actions/fe-v2/registry.ts +69 -0
  19. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +84 -0
  20. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +90 -0
  21. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +88 -0
  22. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +97 -0
  23. package/dist/client/adp/quick-actions/fe-v4/registry.js +51 -0
  24. package/dist/client/adp/quick-actions/fe-v4/registry.ts +58 -0
  25. package/dist/client/adp/quick-actions/fe-v4/utils.js +54 -0
  26. package/dist/client/adp/quick-actions/fe-v4/utils.ts +47 -0
  27. package/dist/client/adp/quick-actions/load.js +46 -0
  28. package/dist/client/adp/quick-actions/load.ts +23 -0
  29. package/dist/client/adp/utils.js +97 -1
  30. package/dist/client/adp/utils.ts +83 -0
  31. package/dist/client/cpe/changes/service.js +2 -2
  32. package/dist/client/cpe/changes/service.ts +2 -2
  33. package/dist/client/cpe/control-data.js +3 -3
  34. package/dist/client/cpe/control-data.ts +8 -7
  35. package/dist/client/cpe/init.js +14 -8
  36. package/dist/client/cpe/init.ts +25 -11
  37. package/dist/client/cpe/outline/{utils.js → editable.js} +3 -30
  38. package/dist/client/cpe/outline/{utils.ts → editable.ts} +1 -29
  39. package/dist/client/cpe/outline/nodes.js +27 -9
  40. package/dist/client/cpe/outline/nodes.ts +33 -8
  41. package/dist/client/cpe/outline/service.js +60 -0
  42. package/dist/client/cpe/outline/service.ts +73 -0
  43. package/dist/client/cpe/quick-actions/quick-action-definition.js +6 -0
  44. package/dist/client/cpe/quick-actions/quick-action-definition.ts +115 -0
  45. package/dist/client/cpe/quick-actions/quick-action-service.js +101 -0
  46. package/dist/client/cpe/quick-actions/quick-action-service.ts +142 -0
  47. package/dist/client/cpe/quick-actions/registry.js +145 -0
  48. package/dist/client/cpe/quick-actions/registry.ts +156 -0
  49. package/dist/client/cpe/quick-actions/utils.js +94 -0
  50. package/dist/client/cpe/quick-actions/utils.ts +114 -0
  51. package/dist/client/cpe/rta-service.ts +1 -0
  52. package/dist/client/cpe/selection.js +3 -3
  53. package/dist/client/cpe/selection.ts +1 -1
  54. package/dist/client/cpe/types.ts +7 -3
  55. package/dist/client/cpe/ui5-utils.js +1 -17
  56. package/dist/client/cpe/ui5-utils.ts +0 -17
  57. package/dist/client/cpe/utils.js +50 -1
  58. package/dist/client/cpe/utils.ts +54 -0
  59. package/dist/client/i18n.js +43 -0
  60. package/dist/client/i18n.ts +34 -0
  61. package/dist/client/manifest.json +1 -1
  62. package/dist/client/messagebundle.properties +17 -0
  63. package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +6 -1
  64. package/dist/client/tsconfig.tsbuildinfo +1 -0
  65. package/dist/client/utils/application.js +34 -0
  66. package/dist/client/utils/application.ts +27 -0
  67. package/dist/client/utils/core.js +70 -0
  68. package/dist/client/utils/core.ts +61 -0
  69. package/package.json +5 -5
  70. package/dist/client/cpe/outline/index.js +0 -40
  71. package/dist/client/cpe/outline/index.ts +0 -37
@@ -0,0 +1,90 @@
1
+ import OverlayUtil from 'sap/ui/dt/OverlayUtil';
2
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
+ import Table from 'sap/ui/mdc/Table';
4
+ import FlexRuntimeInfoAPI from 'sap/ui/fl/apply/api/FlexRuntimeInfoAPI';
5
+
6
+ import type { NestedQuickActionChild, NestedQuickAction } from '@sap-ux-private/control-property-editor-common';
7
+ import { NESTED_QUICK_ACTION_KIND } from '@sap-ux-private/control-property-editor-common';
8
+
9
+ import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
10
+ import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
11
+ import { getControlById } from '../../../utils/core';
12
+
13
+ export const CHANGE_TABLE_COLUMNS = 'change-table-columns';
14
+ const ACTION_ID = 'CTX_SETTINGS0';
15
+ const CONTROL_TYPE = 'sap.ui.mdc.Table';
16
+
17
+
18
+ /**
19
+ * Quick Action for changing table columns.
20
+ */
21
+ export class ChangeTableColumnsQuickAction implements NestedQuickActionDefinition {
22
+ readonly kind = NESTED_QUICK_ACTION_KIND;
23
+ readonly type = CHANGE_TABLE_COLUMNS;
24
+ public get id(): string {
25
+ return `${this.context.key}-${this.type}`;
26
+ }
27
+ isActive = false;
28
+ isClearButtonEnabled = false;
29
+ children: NestedQuickActionChild[] = [];
30
+ tableMap: Record<string, number> = {};
31
+ constructor(private context: QuickActionContext) {}
32
+
33
+ async initialize(): Promise<void> {
34
+ let index = 0;
35
+ for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
36
+ CONTROL_TYPE
37
+ ])) {
38
+ const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTable });
39
+ if (!hasVariantManagement) {
40
+ continue;
41
+ }
42
+ const actions = await this.context.actionService.get(smartTable.getId());
43
+ const changeColumnAction = actions.find((action) => action.id === ACTION_ID);
44
+ if (changeColumnAction) {
45
+ this.children.push({
46
+ label: `'${(smartTable as Table).getHeader()}' table`,
47
+ children: []
48
+ });
49
+ this.tableMap[`${this.children.length - 1}`] = index;
50
+ index++;
51
+ }
52
+ }
53
+ if (this.children.length > 0) {
54
+ this.isActive = true;
55
+ }
56
+ }
57
+
58
+ getActionObject(): NestedQuickAction {
59
+ return {
60
+ kind: NESTED_QUICK_ACTION_KIND,
61
+ id: this.id,
62
+ enabled: this.isActive,
63
+ title: this.context.resourceBundle.getText('V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS'),
64
+ children: this.children
65
+ };
66
+ }
67
+
68
+ async execute(path: string): Promise<FlexCommand[]> {
69
+ const index = this.tableMap[path];
70
+ const smartTables = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
71
+ CONTROL_TYPE
72
+ ]);
73
+ for (let i = 0; i < smartTables.length; i++) {
74
+ if (i === index) {
75
+ const section = getControlById(smartTables[i].getId());
76
+ const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
77
+ if (controlOverlay) {
78
+ controlOverlay.setSelected(true);
79
+ }
80
+ const hasVariantManagement = FlexRuntimeInfoAPI.hasVariantManagement({ element: smartTables[i] });
81
+ if (!hasVariantManagement) {
82
+ continue;
83
+ }
84
+ await this.context.actionService.execute(smartTables[i].getId(), ACTION_ID);
85
+ }
86
+ }
87
+
88
+ return [];
89
+ }
90
+ }
@@ -0,0 +1,88 @@
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
+ './utils'
8
+ ], function (CommandFactory, ___sap_ux_private_control_property_editor_common, _____cpe_quick_actions_utils, _____utils_core, ___utils) {
9
+ 'use strict';
10
+ const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
11
+ const pageHasControlId = _____cpe_quick_actions_utils['pageHasControlId'];
12
+ const getControlById = _____utils_core['getControlById'];
13
+ const getAppComponent = ___utils['getAppComponent'];
14
+ const getPageName = ___utils['getPageName'];
15
+ const getReference = ___utils['getReference'];
16
+ const ENABLE_CLEAR_FILTER_BAR_TYPE = 'enable-clear-filter-bar';
17
+ const PROPERTY_PATH = 'controlConfiguration/@com.sap.vocabularies.UI.v1.SelectionFields/showClearButton';
18
+ const CONTROL_TYPE = 'sap.fe.macros.controls.FilterBar';
19
+ class ToggleClearFilterBarQuickAction {
20
+ kind = SIMPLE_QUICK_ACTION_KIND;
21
+ type = ENABLE_CLEAR_FILTER_BAR_TYPE;
22
+ forceRefreshAfterExecution = true;
23
+ get id() {
24
+ return `${ this.context.key }-${ this.type }`;
25
+ }
26
+ isActive = false;
27
+ isClearButtonEnabled = false;
28
+ constructor(context) {
29
+ this.context = context;
30
+ }
31
+ initialize() {
32
+ const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
33
+ for (const control of controls) {
34
+ const isActionApplicable = pageHasControlId(this.context.view, control.controlId);
35
+ const filterBar = getControlById(control.controlId);
36
+ if (isActionApplicable && filterBar) {
37
+ this.isActive = true;
38
+ this.isClearButtonEnabled = filterBar.getShowClearButton();
39
+ }
40
+ }
41
+ }
42
+ getActionObject() {
43
+ const key = this.isClearButtonEnabled ? 'V4_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR' : 'V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR';
44
+ return {
45
+ kind: SIMPLE_QUICK_ACTION_KIND,
46
+ id: this.id,
47
+ enabled: this.isActive,
48
+ title: this.context.resourceBundle.getText(key)
49
+ };
50
+ }
51
+ async execute() {
52
+ const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
53
+ const control = controls[0];
54
+ if (control) {
55
+ const modifiedControl = getControlById(control.controlId);
56
+ if (!modifiedControl) {
57
+ return [];
58
+ }
59
+ const {flexSettings} = this.context;
60
+ const parent = modifiedControl.getParent();
61
+ if (!parent) {
62
+ return [];
63
+ }
64
+ const modifiedValue = {
65
+ reference: getReference(modifiedControl),
66
+ appComponent: getAppComponent(modifiedControl),
67
+ changeType: 'appdescr_fe_changePageConfiguration',
68
+ parameters: {
69
+ page: getPageName(parent),
70
+ entityPropertyChange: {
71
+ propertyPath: PROPERTY_PATH,
72
+ propertyValue: !this.isClearButtonEnabled,
73
+ operation: 'UPSERT'
74
+ }
75
+ }
76
+ };
77
+ const command = await CommandFactory.getCommandFor(modifiedControl, 'appDescriptor', modifiedValue, null, flexSettings);
78
+ this.isClearButtonEnabled = !this.isClearButtonEnabled;
79
+ return [command];
80
+ }
81
+ return [];
82
+ }
83
+ }
84
+ var __exports = { __esModule: true };
85
+ __exports.ENABLE_CLEAR_FILTER_BAR_TYPE = ENABLE_CLEAR_FILTER_BAR_TYPE;
86
+ __exports.ToggleClearFilterBarQuickAction = ToggleClearFilterBarQuickAction;
87
+ return __exports;
88
+ });
@@ -0,0 +1,97 @@
1
+ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+ import CommandFactory from 'sap/ui/rta/command/CommandFactory';
3
+ import FilterBar from 'sap/ui/mdc/FilterBar';
4
+
5
+ import { SIMPLE_QUICK_ACTION_KIND, SimpleQuickAction } from '@sap-ux-private/control-property-editor-common';
6
+
7
+ import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
8
+ import { pageHasControlId } from '../../../cpe/quick-actions/utils';
9
+ import { getControlById } from '../../../utils/core';
10
+ import { getAppComponent, getPageName, getReference } from './utils';
11
+
12
+ export const ENABLE_CLEAR_FILTER_BAR_TYPE = 'enable-clear-filter-bar';
13
+ const PROPERTY_PATH = 'controlConfiguration/@com.sap.vocabularies.UI.v1.SelectionFields/showClearButton';
14
+ const CONTROL_TYPE = 'sap.fe.macros.controls.FilterBar';
15
+
16
+ /**
17
+ * Quick Action for toggling the visibility of "clear filter bar" button in List Report page.
18
+ */
19
+ export class ToggleClearFilterBarQuickAction implements SimpleQuickActionDefinition {
20
+ readonly kind = SIMPLE_QUICK_ACTION_KIND;
21
+ readonly type = ENABLE_CLEAR_FILTER_BAR_TYPE;
22
+ readonly forceRefreshAfterExecution = true;
23
+ public get id(): string {
24
+ return `${this.context.key}-${this.type}`;
25
+ }
26
+ isActive = false;
27
+ private isClearButtonEnabled = false;
28
+ constructor(private context: QuickActionContext) {}
29
+
30
+ initialize(): void {
31
+ const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
32
+ for (const control of controls) {
33
+ const isActionApplicable = pageHasControlId(this.context.view, control.controlId);
34
+ const filterBar = getControlById<FilterBar>(control.controlId);
35
+ if (isActionApplicable && filterBar) {
36
+ this.isActive = true;
37
+ this.isClearButtonEnabled = filterBar.getShowClearButton();
38
+ }
39
+ }
40
+ }
41
+
42
+ getActionObject(): SimpleQuickAction {
43
+ const key = this.isClearButtonEnabled
44
+ ? 'V4_QUICK_ACTION_LR_DISABLE_CLEAR_FILTER_BAR'
45
+ : 'V4_QUICK_ACTION_LR_ENABLE_CLEAR_FILTER_BAR';
46
+ return {
47
+ kind: SIMPLE_QUICK_ACTION_KIND,
48
+ id: this.id,
49
+ enabled: this.isActive,
50
+ title: this.context.resourceBundle.getText(key)
51
+ };
52
+ }
53
+
54
+ async execute(): Promise<FlexCommand[]> {
55
+ const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
56
+ const control = controls[0];
57
+ if (control) {
58
+ const modifiedControl = getControlById(control.controlId);
59
+ if (!modifiedControl) {
60
+ return [];
61
+ }
62
+
63
+ const { flexSettings } = this.context;
64
+ const parent = modifiedControl.getParent();
65
+ if (!parent) {
66
+ return [];
67
+ }
68
+
69
+ const modifiedValue = {
70
+ reference: getReference(modifiedControl),
71
+ appComponent: getAppComponent(modifiedControl),
72
+ changeType: 'appdescr_fe_changePageConfiguration',
73
+ parameters: {
74
+ page: getPageName(parent),
75
+ entityPropertyChange: {
76
+ propertyPath: PROPERTY_PATH,
77
+ propertyValue: !this.isClearButtonEnabled,
78
+ operation: 'UPSERT'
79
+ }
80
+ }
81
+ };
82
+
83
+ const command = await CommandFactory.getCommandFor<FlexCommand>(
84
+ modifiedControl,
85
+ 'appDescriptor',
86
+ modifiedValue,
87
+ null,
88
+ flexSettings
89
+ );
90
+
91
+ this.isClearButtonEnabled = !this.isClearButtonEnabled;
92
+ return [command];
93
+ }
94
+
95
+ return [];
96
+ }
97
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field) {
4
+ "use strict";
5
+
6
+ const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
7
+ const AddControllerToPageQuickAction = ___common_add_controller_to_page["AddControllerToPageQuickAction"];
8
+ const ToggleClearFilterBarQuickAction = ___lr_toggle_clear_filter_bar["ToggleClearFilterBarQuickAction"];
9
+ const ChangeTableColumnsQuickAction = ___change_table_columns["ChangeTableColumnsQuickAction"];
10
+ const AddHeaderFieldQuickAction = ___common_op_add_header_field["AddHeaderFieldQuickAction"];
11
+ const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
12
+ const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
13
+
14
+ /**
15
+ * Quick Action provider for SAP Fiori Elements V4 applications.
16
+ */
17
+ class FEV4QuickActionRegistry extends QuickActionDefinitionRegistry {
18
+ PAGE_NAME_MAP = {
19
+ [LIST_REPORT_TYPE]: 'listReport',
20
+ [OBJECT_PAGE_TYPE]: 'objectPage'
21
+ };
22
+ getDefinitions(context) {
23
+ const activePages = this.getActivePageContent(context.controlIndex);
24
+ const definitionGroups = [];
25
+ for (let index = 0; index < activePages.length; index++) {
26
+ const {
27
+ name,
28
+ view
29
+ } = activePages[index];
30
+ if (name === 'listReport') {
31
+ definitionGroups.push({
32
+ title: 'LIST REPORT',
33
+ definitions: [ToggleClearFilterBarQuickAction, AddControllerToPageQuickAction, ChangeTableColumnsQuickAction],
34
+ view,
35
+ key: name + index
36
+ });
37
+ } else if (name === 'objectPage') {
38
+ definitionGroups.push({
39
+ title: 'OBJECT PAGE',
40
+ definitions: [AddControllerToPageQuickAction, ChangeTableColumnsQuickAction, AddHeaderFieldQuickAction],
41
+ view,
42
+ key: name + index
43
+ });
44
+ }
45
+ }
46
+ return definitionGroups;
47
+ }
48
+ }
49
+ return FEV4QuickActionRegistry;
50
+ });
51
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1,58 @@
1
+ import type {
2
+ QuickActionActivationContext,
3
+ QuickActionDefinitionGroup
4
+ } from '../../../cpe/quick-actions/quick-action-definition';
5
+ import { QuickActionDefinitionRegistry } from '../../../cpe/quick-actions/registry';
6
+
7
+ import { AddControllerToPageQuickAction } from '../common/add-controller-to-page';
8
+ import { ToggleClearFilterBarQuickAction } from './lr-toggle-clear-filter-bar';
9
+ import { ChangeTableColumnsQuickAction } from './change-table-columns';
10
+ import { AddHeaderFieldQuickAction } from '../common/op-add-header-field';
11
+
12
+ type PageName = 'listReport' | 'objectPage';
13
+
14
+ const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
15
+ const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
16
+
17
+ /**
18
+ * Quick Action provider for SAP Fiori Elements V4 applications.
19
+ */
20
+ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegistry<PageName> {
21
+ PAGE_NAME_MAP: Record<string, PageName> = {
22
+ [LIST_REPORT_TYPE]: 'listReport',
23
+ [OBJECT_PAGE_TYPE]: 'objectPage'
24
+ };
25
+ getDefinitions(context: QuickActionActivationContext): QuickActionDefinitionGroup[] {
26
+ const activePages = this.getActivePageContent(context.controlIndex);
27
+
28
+ const definitionGroups: QuickActionDefinitionGroup[] = [];
29
+ for (let index = 0; index < activePages.length; index++) {
30
+ const { name, view } = activePages[index];
31
+
32
+ if (name === 'listReport') {
33
+ definitionGroups.push({
34
+ title: 'LIST REPORT',
35
+ definitions: [
36
+ ToggleClearFilterBarQuickAction,
37
+ AddControllerToPageQuickAction,
38
+ ChangeTableColumnsQuickAction
39
+ ],
40
+ view,
41
+ key: name + index
42
+ });
43
+ } else if (name === 'objectPage') {
44
+ definitionGroups.push({
45
+ title: 'OBJECT PAGE',
46
+ definitions: [
47
+ AddControllerToPageQuickAction,
48
+ ChangeTableColumnsQuickAction,
49
+ AddHeaderFieldQuickAction
50
+ ],
51
+ view,
52
+ key: name + index
53
+ });
54
+ }
55
+ }
56
+ return definitionGroups;
57
+ }
58
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Component", "../../../utils/core"], function (Component, _____utils_core) {
4
+ "use strict";
5
+
6
+ const isA = _____utils_core["isA"];
7
+ /**
8
+ * Get the containing app component of a control.
9
+ *
10
+ * @param control - UI5 control instance.
11
+ * @returns App component to which the control belongs.
12
+ */
13
+ function getAppComponent(control) {
14
+ const ownerComponent = Component.getOwnerComponentFor(control);
15
+ if (isA('sap.fe.core.TemplateComponent', ownerComponent)) {
16
+ return ownerComponent.getAppComponent();
17
+ }
18
+ return undefined;
19
+ }
20
+ /**
21
+ * Get the containing page name of a control.
22
+ *
23
+ * @param control - UI5 control instance.
24
+ * @returns Page name to which the control belongs.
25
+ */
26
+ function getPageName(control) {
27
+ const component = Component.getOwnerComponentFor(control);
28
+ if (!isA('sap.fe.core.TemplateComponent', component)) {
29
+ return undefined;
30
+ }
31
+ const view = component.getRootControl();
32
+ return view.getId().split('::').pop();
33
+ }
34
+
35
+ /**
36
+ * Gets a reference id for a control.
37
+ *
38
+ * @param control - UI5 control instance.
39
+ * @returns Reference id.
40
+ */
41
+ function getReference(control) {
42
+ // probably same as flex setting id or base id TODO: CONFIRM
43
+ const manifest = getAppComponent(control)?.getManifest();
44
+ return manifest?.['sap.app']?.id ?? '';
45
+ }
46
+ var __exports = {
47
+ __esModule: true
48
+ };
49
+ __exports.getAppComponent = getAppComponent;
50
+ __exports.getPageName = getPageName;
51
+ __exports.getReference = getReference;
52
+ return __exports;
53
+ });
54
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,47 @@
1
+ import type ManagedObject from 'sap/ui/base/ManagedObject';
2
+ import type { Manifest } from 'sap/ui/rta/RuntimeAuthoring';
3
+ import Component from 'sap/ui/core/Component';
4
+ import type TemplateComponent from 'sap/fe/core/TemplateComponent';
5
+ import type AppComponent from 'sap/fe/core/AppComponent';
6
+
7
+ import { isA } from '../../../utils/core';
8
+
9
+ /**
10
+ * Get the containing app component of a control.
11
+ *
12
+ * @param control - UI5 control instance.
13
+ * @returns App component to which the control belongs.
14
+ */
15
+ export function getAppComponent(control: ManagedObject): AppComponent | undefined {
16
+ const ownerComponent = Component.getOwnerComponentFor(control);
17
+ if (isA<TemplateComponent>('sap.fe.core.TemplateComponent', ownerComponent)) {
18
+ return ownerComponent.getAppComponent();
19
+ }
20
+ return undefined;
21
+ }
22
+ /**
23
+ * Get the containing page name of a control.
24
+ *
25
+ * @param control - UI5 control instance.
26
+ * @returns Page name to which the control belongs.
27
+ */
28
+ export function getPageName(control: ManagedObject): string | undefined {
29
+ const component = Component.getOwnerComponentFor(control);
30
+ if (!isA<TemplateComponent>('sap.fe.core.TemplateComponent', component)) {
31
+ return undefined;
32
+ }
33
+ const view = component.getRootControl();
34
+ return view.getId().split('::').pop();
35
+ }
36
+
37
+ /**
38
+ * Gets a reference id for a control.
39
+ *
40
+ * @param control - UI5 control instance.
41
+ * @returns Reference id.
42
+ */
43
+ export function getReference(control: ManagedObject): string {
44
+ // probably same as flex setting id or base id TODO: CONFIRM
45
+ const manifest = getAppComponent(control)?.getManifest() as Manifest;
46
+ return manifest?.['sap.app']?.id ?? '';
47
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ function __ui5_require_async(path) {
7
+ return new Promise(function (resolve, reject) {
8
+ sap.ui.require([path], function (module) {
9
+ if (!(module && module.__esModule)) {
10
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
+ default: module
12
+ } : module;
13
+ Object.defineProperty(module, "__esModule", {
14
+ value: true
15
+ });
16
+ }
17
+ resolve(module);
18
+ }, function (err) {
19
+ reject(err);
20
+ });
21
+ });
22
+ }
23
+ /**
24
+ * Loads the appropriate Quick Action registries for the given application type.
25
+ *
26
+ * @param appType - Application type.
27
+ * @returns Quick Action registries.
28
+ */
29
+ async function loadDefinitions(appType) {
30
+ if (appType === 'fe-v2') {
31
+ const FEV2QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v2/registry')).default;
32
+ return [new FEV2QuickActionRegistry()];
33
+ }
34
+ if (appType === 'fe-v4') {
35
+ const FEV4QuickActionRegistry = (await __ui5_require_async('open/ux/preview/client/adp/quick-actions/fe-v4/registry')).default;
36
+ return [new FEV4QuickActionRegistry()];
37
+ }
38
+ return [];
39
+ }
40
+ var __exports = {
41
+ __esModule: true
42
+ };
43
+ __exports.loadDefinitions = loadDefinitions;
44
+ return __exports;
45
+ });
46
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1,23 @@
1
+ import type { QuickActionDefinitionRegistry } from '../../cpe/quick-actions/registry';
2
+ import type { ApplicationType } from '../../utils/application';
3
+
4
+ /**
5
+ * Loads the appropriate Quick Action registries for the given application type.
6
+ *
7
+ * @param appType - Application type.
8
+ * @returns Quick Action registries.
9
+ */
10
+ export async function loadDefinitions(appType: ApplicationType): Promise<QuickActionDefinitionRegistry<string>[]> {
11
+ if (appType === 'fe-v2') {
12
+ const FEV2QuickActionRegistry = (await import('open/ux/preview/client/adp/quick-actions/fe-v2/registry'))
13
+ .default;
14
+
15
+ return [new FEV2QuickActionRegistry()];
16
+ }
17
+ if (appType === 'fe-v4') {
18
+ const FEV4QuickActionRegistry = (await import('open/ux/preview/client/adp/quick-actions/fe-v4/registry'))
19
+ .default;
20
+ return [new FEV4QuickActionRegistry()];
21
+ }
22
+ return [];
23
+ }
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/m/MessageToast"], function (MessageToast) {
3
+ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/Element", "sap/base/Log", "sap/ui/fl/Utils", "../utils/error", "../utils/version"], function (MessageToast, Element, Log, FlexUtils, ___utils_error, ___utils_version) {
4
4
  "use strict";
5
5
 
6
+ function __ui5_require_async(path) {
7
+ return new Promise(function (resolve, reject) {
8
+ sap.ui.require([path], function (module) {
9
+ if (!(module && module.__esModule)) {
10
+ module = module === null || !(typeof module === "object" && path.endsWith("/library")) ? {
11
+ default: module
12
+ } : module;
13
+ Object.defineProperty(module, "__esModule", {
14
+ value: true
15
+ });
16
+ }
17
+ resolve(module);
18
+ }, function (err) {
19
+ reject(err);
20
+ });
21
+ });
22
+ }
23
+ const getError = ___utils_error["getError"];
24
+ const isLowerThanMinimalUi5Version = ___utils_version["isLowerThanMinimalUi5Version"];
6
25
  /**
7
26
  * Defers the resolution of the promise, stores resolve/reject functions so that they can be accessed at a later stage.
8
27
  *
@@ -55,12 +74,89 @@ sap.ui.define(["sap/m/MessageToast"], function (MessageToast) {
55
74
  duration
56
75
  });
57
76
  }
77
+
78
+ /**
79
+ * Check if element is sync view
80
+ *
81
+ * @param element Design time Element
82
+ * @returns boolean if element is sync view or not
83
+ */
84
+ function isSyncView(element) {
85
+ return element?.getMetadata()?.getName()?.includes('XMLView') && element?.oAsyncState === undefined;
86
+ }
87
+
88
+ /**
89
+ * Get Ids for all sync views
90
+ *
91
+ * @param ui5VersionInfo UI5 Version Information
92
+ *
93
+ * @returns array of Ids for application sync views
94
+ */
95
+ async function getAllSyncViewsIds(ui5VersionInfo) {
96
+ const syncViewIds = [];
97
+ try {
98
+ if (isLowerThanMinimalUi5Version(ui5VersionInfo, {
99
+ major: 1,
100
+ minor: 120
101
+ })) {
102
+ const elements = Element.registry.filter(() => true);
103
+ elements.forEach(ui5Element => {
104
+ if (isSyncView(ui5Element)) {
105
+ syncViewIds.push(ui5Element.getId());
106
+ }
107
+ });
108
+ } else {
109
+ const ElementRegistry = (await __ui5_require_async('sap/ui/core/ElementRegistry')).default;
110
+ const elements = ElementRegistry.all();
111
+ Object.entries(elements).forEach(_ref => {
112
+ let [key, ui5Element] = _ref;
113
+ if (isSyncView(ui5Element)) {
114
+ syncViewIds.push(key);
115
+ }
116
+ });
117
+ }
118
+ } catch (error) {
119
+ Log.error('Could not get application sync views', getError(error));
120
+ }
121
+ return syncViewIds;
122
+ }
123
+ /**
124
+ * Gets controller name and view ID for the given UI5 control.
125
+ *
126
+ * @param control UI5 control.
127
+ * @returns The controller name and view ID.
128
+ */
129
+
130
+ function getControllerInfoForControl(control) {
131
+ const view = FlexUtils.getViewForControl(control);
132
+ const controllerName = view.getController().getMetadata().getName();
133
+ const viewId = view.getId();
134
+ return {
135
+ controllerName,
136
+ viewId
137
+ };
138
+ }
139
+
140
+ /**
141
+ * Gets controller name and view ID for the given overlay control.
142
+ *
143
+ * @param overlayControl The overlay control.
144
+ * @returns The controller name and view ID.
145
+ */
146
+
147
+ function getControllerInfo(overlayControl) {
148
+ const control = overlayControl.getElement();
149
+ return getControllerInfoForControl(control);
150
+ }
58
151
  var __exports = {
59
152
  __esModule: true
60
153
  };
61
154
  __exports.createDeferred = createDeferred;
62
155
  __exports.matchesFragmentName = matchesFragmentName;
63
156
  __exports.notifyUser = notifyUser;
157
+ __exports.getAllSyncViewsIds = getAllSyncViewsIds;
158
+ __exports.getControllerInfoForControl = getControllerInfoForControl;
159
+ __exports.getControllerInfo = getControllerInfo;
64
160
  return __exports;
65
161
  });
66
162
  //# sourceMappingURL=utils.js.map