@sap-ux/preview-middleware 1.0.34 → 1.0.36

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.
@@ -76,7 +76,7 @@ export default class AddTableColumnFragments extends BaseDialog<AddTableColumnsF
76
76
  this.overlays = overlays;
77
77
  this.model = new JSONModel({
78
78
  title: options.title
79
- }) as AddTableColumnsFragmentsModel;
79
+ });
80
80
  this.commandExecutor = new CommandExecutor(this.rta);
81
81
  }
82
82
 
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version"], function (_____utils_fe_v4js, ___add_new_subpage_quick_action_basejs, _____utils_corejs, _____utils_versionjs) {
3
+ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "../../../utils/core", "../../../utils/version", "./utils"], function (_____utils_fe_v4js, ___add_new_subpage_quick_action_basejs, _____utils_corejs, _____utils_versionjs, ___utilsjs) {
4
4
  "use strict";
5
5
 
6
6
  const getV4AppComponent = _____utils_fe_v4js["getV4AppComponent"];
@@ -9,7 +9,9 @@ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "
9
9
  const isA = _____utils_corejs["isA"];
10
10
  const getUi5Version = _____utils_versionjs["getUi5Version"];
11
11
  const isLowerThanMinimalUi5Version = _____utils_versionjs["isLowerThanMinimalUi5Version"];
12
+ const getPageId = ___utilsjs["getPageId"];
12
13
  const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
14
+
13
15
  /**
14
16
  * Quick Action for adding a custom page action.
15
17
  */
@@ -121,7 +123,7 @@ sap.ui.define(["../../../utils/fe-v4", "../add-new-subpage-quick-action-base", "
121
123
  }
122
124
  await super.initialize();
123
125
  this.appComponent = getV4AppComponent(this.context.view);
124
- this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
126
+ this.pageId = getPageId(this.context);
125
127
  // remember current page route pattern (used in dialog controller for new page change)
126
128
  const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(r => r.name === this.pageId);
127
129
  if (!currentPageRoute) {
@@ -10,13 +10,10 @@ import FEObjectPageComponent from 'sap/fe/templates/ObjectPage/Component';
10
10
  import FEListReportComponent from 'sap/fe/templates/ListReport/Component';
11
11
  import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version.js';
12
12
  import { PageDescriptorV4 } from '../../controllers/types.js';
13
+ import { getPageId } from './utils.js';
13
14
 
14
15
  export const OBJECT_PAGE_COMPONENT_NAME_V4 = 'sap.fe.templates.ObjectPage.ObjectPage';
15
16
 
16
- interface ViewDataType {
17
- stableId: string;
18
- }
19
-
20
17
  /**
21
18
  * Quick Action for adding a custom page action.
22
19
  */
@@ -168,7 +165,7 @@ export class AddNewSubpage extends AddNewSubpageBase<ODataMetaModelV4> {
168
165
 
169
166
  this.appComponent = getV4AppComponent(this.context.view);
170
167
 
171
- this.pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
168
+ this.pageId = getPageId(this.context);
172
169
  // remember current page route pattern (used in dialog controller for new page change)
173
170
  const currentPageRoute = (this.context.manifest['sap.ui5'].routing?.routes ?? []).find(
174
171
  (r) => r.name === this.pageId
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-quick-action-base", "../../../utils/version", "../dialog-enablement-validator", "../../api-handler", "../../utils", "../../../utils/fe-v4", "../../../utils/core"], function (OverlayRegistry, ____dialog_factoryjs, ___simple_quick_action_basejs, _____utils_versionjs, ___dialog_enablement_validatorjs, ____api_handlerjs, ____utilsjs, _____utils_fe_v4js, _____utils_corejs) {
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-quick-action-base", "../../../utils/version", "../dialog-enablement-validator", "../../api-handler", "../../utils", "../../../utils/core", "./utils"], function (OverlayRegistry, ____dialog_factoryjs, ___simple_quick_action_basejs, _____utils_versionjs, ___dialog_enablement_validatorjs, ____api_handlerjs, ____utilsjs, _____utils_corejs, ___utilsjs) {
4
4
  "use strict";
5
5
 
6
6
  const DialogFactory = ____dialog_factoryjs["DialogFactory"];
@@ -11,8 +11,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
11
11
  const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validatorjs["DIALOG_ENABLEMENT_VALIDATOR"];
12
12
  const getExistingController = ____api_handlerjs["getExistingController"];
13
13
  const getControllerInfoForControl = ____utilsjs["getControllerInfoForControl"];
14
- const getV4AppComponent = _____utils_fe_v4js["getV4AppComponent"];
15
14
  const isA = _____utils_corejs["isA"];
15
+ const getAppDescriptorBase = ___utilsjs["getAppDescriptorBase"];
16
16
  const ADD_PAGE_ACTION = 'add-page-action';
17
17
  const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageLayout'];
18
18
  /**
@@ -23,7 +23,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
23
23
  super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context, [DIALOG_ENABLEMENT_VALIDATOR]);
24
24
  }
25
25
  async initialize() {
26
- this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
26
+ this.appDescriptor = getAppDescriptorBase(this.context);
27
27
  const version = await getUi5Version();
28
28
  if (isLowerThanMinimalUi5Version(version, {
29
29
  major: 1,
@@ -34,6 +34,9 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
34
34
  await super.initialize();
35
35
  }
36
36
  async execute() {
37
+ if (!this.appDescriptor) {
38
+ return [];
39
+ }
37
40
  if (this.control) {
38
41
  const overlay = OverlayRegistry.getOverlay(this.control) || [];
39
42
  const controlInfo = getControllerInfoForControl(this.control);
@@ -43,9 +46,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
43
46
  title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION',
44
47
  controllerReference: controllerPath ? `.extension.${controllerPath}.<REPLACE_WITH_YOUR_HANDLER_NAME>` : '.extension.<ApplicationId.FolderName.ScriptFilename.methodName>',
45
48
  appDescriptor: {
46
- appComponent: getV4AppComponent(this.context.view),
49
+ ...this.appDescriptor,
47
50
  appType: 'fe-v4',
48
- pageId: this.pageId,
49
51
  projectId: this.context.flexSettings.projectId
50
52
  },
51
53
  validateActionId: actionId => {
@@ -8,22 +8,19 @@ import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/vers
8
8
  import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator.js';
9
9
  import { getExistingController } from '../../api-handler.js';
10
10
  import { getControllerInfoForControl } from '../../utils.js';
11
- import { getV4AppComponent } from '../../../utils/fe-v4.js';
12
11
  import { isA } from '../../../utils/core.js';
13
12
  import DynamicPageTitle from 'sap/f/DynamicPageTitle';
14
13
  import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
15
14
  import ObjectPageDynamicHeaderTitle from 'sap/uxap/ObjectPageDynamicHeaderTitle';
15
+ import { getAppDescriptorBase } from './utils.js';
16
16
 
17
17
  export const ADD_PAGE_ACTION = 'add-page-action';
18
18
  const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageLayout'];
19
- interface ViewDataType {
20
- stableId: string;
21
- }
22
19
  /**
23
20
  * Quick Action for adding a custom page action.
24
21
  */
25
22
  export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase implements SimpleQuickActionDefinition {
26
- protected pageId: string | undefined;
23
+ protected appDescriptor: ReturnType<typeof getAppDescriptorBase>;
27
24
  constructor(context: QuickActionContext) {
28
25
  super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context, [
29
26
  DIALOG_ENABLEMENT_VALIDATOR
@@ -31,7 +28,7 @@ export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase im
31
28
  }
32
29
 
33
30
  async initialize(): Promise<void> {
34
- this.pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
31
+ this.appDescriptor = getAppDescriptorBase(this.context);
35
32
  const version = await getUi5Version();
36
33
  if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 120 })) {
37
34
  return;
@@ -40,6 +37,9 @@ export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase im
40
37
  }
41
38
 
42
39
  async execute(): Promise<FlexCommand[]> {
40
+ if (!this.appDescriptor) {
41
+ return [];
42
+ }
43
43
  if (this.control) {
44
44
  const overlay = OverlayRegistry.getOverlay(this.control) || [];
45
45
  const controlInfo = getControllerInfoForControl(this.control);
@@ -56,9 +56,8 @@ export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase im
56
56
  ? `.extension.${controllerPath}.<REPLACE_WITH_YOUR_HANDLER_NAME>`
57
57
  : '.extension.<ApplicationId.FolderName.ScriptFilename.methodName>',
58
58
  appDescriptor: {
59
- appComponent: getV4AppComponent(this.context.view)!,
59
+ ...this.appDescriptor,
60
60
  appType: 'fe-v4',
61
- pageId: this.pageId!,
62
61
  projectId: this.context.flexSettings.projectId
63
62
  },
64
63
  validateActionId: (actionId) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../utils/version", "../dialog-enablement-validator", "../../api-handler", "../../utils", "../../../utils/fe-v4", "../table-quick-action-base", "../control-types", "../../../utils/core", "./utils"], function (OverlayRegistry, ____dialog_factoryjs, _____utils_versionjs, ___dialog_enablement_validatorjs, ____api_handlerjs, ____utilsjs, _____utils_fe_v4js, ___table_quick_action_basejs, ___control_typesjs, _____utils_corejs, ___utilsjs) {
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../utils/version", "../dialog-enablement-validator", "../../api-handler", "../../utils", "../table-quick-action-base", "../control-types", "../../../utils/core", "./utils"], function (OverlayRegistry, ____dialog_factoryjs, _____utils_versionjs, ___dialog_enablement_validatorjs, ____api_handlerjs, ____utilsjs, ___table_quick_action_basejs, ___control_typesjs, _____utils_corejs, ___utilsjs) {
4
4
  "use strict";
5
5
 
6
6
  const DialogFactory = ____dialog_factoryjs["DialogFactory"];
@@ -10,11 +10,11 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../ut
10
10
  const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validatorjs["DIALOG_ENABLEMENT_VALIDATOR"];
11
11
  const getExistingController = ____api_handlerjs["getExistingController"];
12
12
  const getControllerInfoForControl = ____utilsjs["getControllerInfoForControl"];
13
- const getV4AppComponent = _____utils_fe_v4js["getV4AppComponent"];
14
13
  const TableQuickActionDefinitionBase = ___table_quick_action_basejs["TableQuickActionDefinitionBase"];
15
14
  const MDC_TABLE_TYPE = ___control_typesjs["MDC_TABLE_TYPE"];
16
15
  const isA = _____utils_corejs["isA"];
17
16
  const getPropertyPath = ___utilsjs["getPropertyPath"];
17
+ const getAppDescriptorBase = ___utilsjs["getAppDescriptorBase"];
18
18
  const CREATE_TABLE_ACTION = 'create-table-action';
19
19
  const regexForAnnotationPath = /controlConfiguration\/(?:[^@]+\/)?@com\.sap\.vocabularies\.UI\.v1\.LineItem(?:#[^/]+)?\/actions\//;
20
20
 
@@ -26,7 +26,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../ut
26
26
  super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
27
27
  }
28
28
  async initialize() {
29
- this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
29
+ this.appDescriptor = getAppDescriptorBase(this.context);
30
30
  const version = await getUi5Version();
31
31
  if (isLowerThanMinimalUi5Version(version, {
32
32
  major: 1,
@@ -37,6 +37,9 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../ut
37
37
  await super.initialize();
38
38
  }
39
39
  async execute(path) {
40
+ if (!this.appDescriptor) {
41
+ return [];
42
+ }
40
43
  const {
41
44
  table
42
45
  } = this.tableMap[path];
@@ -54,9 +57,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../../../ut
54
57
  controllerReference: controllerPath ? `.extension.${controllerPath}.<methodName>` : '.extension.<ApplicationId.FolderName.ScriptFilename.methodName>',
55
58
  actionType: 'tableAction',
56
59
  appDescriptor: {
57
- appComponent: getV4AppComponent(this.context.view),
60
+ ...this.appDescriptor,
58
61
  appType: 'fe-v4',
59
- pageId: this.pageId,
60
62
  projectId: this.context.flexSettings.projectId
61
63
  },
62
64
  validateActionId: actionId => {
@@ -7,20 +7,16 @@ import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/vers
7
7
  import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator.js';
8
8
  import { getExistingController } from '../../api-handler.js';
9
9
  import { getControllerInfoForControl } from '../../utils.js';
10
- import { getV4AppComponent } from '../../../utils/fe-v4.js';
11
10
  import { TableQuickActionDefinitionBase } from '../table-quick-action-base.js';
12
11
  import { MDC_TABLE_TYPE } from '../control-types.js';
13
12
  import { isA } from '../../../utils/core.js';
14
13
  import Table from 'sap/ui/mdc/Table';
15
14
  import XMLView from 'sap/ui/core/mvc/XMLView';
16
15
  import ActionToolbarAction from 'sap/ui/mdc/actiontoolbar/ActionToolbarAction';
17
- import { getPropertyPath } from './utils.js';
16
+ import { getPropertyPath, getAppDescriptorBase } from './utils.js';
18
17
 
19
18
  export const CREATE_TABLE_ACTION = 'create-table-action';
20
19
 
21
- interface ViewDataType {
22
- stableId: string;
23
- }
24
20
  const regexForAnnotationPath =
25
21
  /controlConfiguration\/(?:[^@]+\/)?@com\.sap\.vocabularies\.UI\.v1\.LineItem(?:#[^/]+)?\/actions\//;
26
22
 
@@ -28,7 +24,7 @@ const regexForAnnotationPath =
28
24
  * Quick Action for adding a custom page action.
29
25
  */
30
26
  export class AddTableActionQuickAction extends TableQuickActionDefinitionBase implements NestedQuickActionDefinition {
31
- protected pageId: string | undefined;
27
+ protected appDescriptor: ReturnType<typeof getAppDescriptorBase>;
32
28
  constructor(context: QuickActionContext) {
33
29
  super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, undefined, [
34
30
  DIALOG_ENABLEMENT_VALIDATOR
@@ -36,7 +32,7 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
36
32
  }
37
33
 
38
34
  async initialize(): Promise<void> {
39
- this.pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
35
+ this.appDescriptor = getAppDescriptorBase(this.context);
40
36
  const version = await getUi5Version();
41
37
  if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 120 })) {
42
38
  return;
@@ -45,6 +41,9 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
45
41
  }
46
42
 
47
43
  async execute(path: string): Promise<FlexCommand[]> {
44
+ if (!this.appDescriptor) {
45
+ return [];
46
+ }
48
47
  const { table } = this.tableMap[path];
49
48
  const propertyPath = `${getPropertyPath(table)}`;
50
49
  if (!table || !propertyPath) {
@@ -67,9 +66,8 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
67
66
  : '.extension.<ApplicationId.FolderName.ScriptFilename.methodName>',
68
67
  actionType: 'tableAction',
69
68
  appDescriptor: {
70
- appComponent: getV4AppComponent(this.context.view)!,
69
+ ...this.appDescriptor,
71
70
  appType: 'fe-v4',
72
- pageId: this.pageId!,
73
71
  projectId: this.context.flexSettings.projectId
74
72
  },
75
73
  validateActionId: (actionId) => {
@@ -11,10 +11,10 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../control-
11
11
  const TREE_TABLE_TYPE = ___control_typesjs["TREE_TABLE_TYPE"];
12
12
  const TableQuickActionDefinitionBase = ___table_quick_action_basejs["TableQuickActionDefinitionBase"];
13
13
  const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validatorjs["DIALOG_ENABLEMENT_VALIDATOR"];
14
- const getV4AppComponent = _____utils_fe_v4js["getV4AppComponent"];
15
14
  const isMacroTable = _____utils_fe_v4js["isMacroTable"];
16
15
  const getLineItemAnnotation = ___utilsjs["getLineItemAnnotation"];
17
16
  const getPropertyPath = ___utilsjs["getPropertyPath"];
17
+ const getAppDescriptorBase = ___utilsjs["getAppDescriptorBase"];
18
18
  const getUi5Version = _____utils_versionjs["getUi5Version"];
19
19
  const isLowerThanMinimalUi5Version = _____utils_versionjs["isLowerThanMinimalUi5Version"];
20
20
  const isA = _____utils_corejs["isA"];
@@ -28,7 +28,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../control-
28
28
  }, [DIALOG_ENABLEMENT_VALIDATOR]);
29
29
  }
30
30
  async initialize() {
31
- this.pageId = this.context.view.getViewData()?.stableId.split('::').pop();
31
+ this.appDescriptor = getAppDescriptorBase(this.context);
32
32
  const version = await getUi5Version();
33
33
  if (isLowerThanMinimalUi5Version(version, {
34
34
  major: 1,
@@ -39,6 +39,9 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../control-
39
39
  await super.initialize();
40
40
  }
41
41
  async execute(path) {
42
+ if (!this.appDescriptor) {
43
+ return [];
44
+ }
42
45
  const {
43
46
  table
44
47
  } = this.tableMap[path];
@@ -53,9 +56,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../control-
53
56
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN',
54
57
  type: 'tableColumn',
55
58
  appDescriptor: {
56
- appComponent: getV4AppComponent(this.context.view),
59
+ ...this.appDescriptor,
57
60
  appType: 'fe-v4',
58
- pageId: this.pageId,
59
61
  projectId: this.context.flexSettings.projectId,
60
62
  anchor
61
63
  },
@@ -8,15 +8,12 @@ import { TableQuickActionDefinitionBase } from '../table-quick-action-base.js';
8
8
 
9
9
  import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator.js';
10
10
  import Table from 'sap/ui/mdc/Table';
11
- import { getV4AppComponent, isMacroTable } from '../../../utils/fe-v4.js';
12
- import { getLineItemAnnotation, getPropertyPath } from './utils.js';
11
+ import { isMacroTable } from '../../../utils/fe-v4.js';
12
+ import { getLineItemAnnotation, getPropertyPath, getAppDescriptorBase } from './utils.js';
13
13
  import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version.js';
14
14
  import { isA } from '../../../utils/core.js';
15
15
  import UI5Element from 'sap/ui/core/Element';
16
16
 
17
- interface ViewDataType {
18
- stableId: string;
19
- }
20
17
  export const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
21
18
  const regexForAnnotationPath =
22
19
  /controlConfiguration\/(?:entity\/)?@com\.sap\.vocabularies\.UI\.v1\.LineItem(?:#[^/]+)?\/columns\//;
@@ -27,7 +24,7 @@ export class AddTableCustomColumnQuickAction
27
24
  extends TableQuickActionDefinitionBase
28
25
  implements NestedQuickActionDefinition
29
26
  {
30
- protected pageId: string | undefined;
27
+ protected appDescriptor: ReturnType<typeof getAppDescriptorBase>;
31
28
  constructor(context: QuickActionContext) {
32
29
  super(
33
30
  CREATE_TABLE_CUSTOM_COLUMN,
@@ -41,7 +38,7 @@ export class AddTableCustomColumnQuickAction
41
38
  );
42
39
  }
43
40
  async initialize(): Promise<void> {
44
- this.pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
41
+ this.appDescriptor = getAppDescriptorBase(this.context);
45
42
  const version = await getUi5Version();
46
43
  if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 120 })) {
47
44
  return;
@@ -50,6 +47,9 @@ export class AddTableCustomColumnQuickAction
50
47
  }
51
48
 
52
49
  async execute(path: string): Promise<FlexCommand[]> {
50
+ if (!this.appDescriptor) {
51
+ return [];
52
+ }
53
53
  const { table } = this.tableMap[path];
54
54
  if (!table) {
55
55
  return [];
@@ -67,9 +67,8 @@ export class AddTableCustomColumnQuickAction
67
67
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN',
68
68
  type: 'tableColumn',
69
69
  appDescriptor: {
70
- appComponent: getV4AppComponent(this.context.view)!,
70
+ ...this.appDescriptor,
71
71
  appType: 'fe-v4',
72
- pageId: this.pageId!,
73
72
  projectId: this.context.flexSettings.projectId,
74
73
  anchor
75
74
  },
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["../../../utils/fe-v4", "../simple-quick-action-base", "../common/op-add-custom-section", "../dialog-enablement-validator", "../../../cpe/quick-actions/utils", "sap/ui/dt/OverlayRegistry", "../../dialog-factory"], function (_____utils_fe_v4js, ___simple_quick_action_basejs, ___common_op_add_custom_sectionjs, ___dialog_enablement_validatorjs, _____cpe_quick_actions_utilsjs, OverlayRegistry, ____dialog_factoryjs) {
3
+ sap.ui.define(["../../../utils/fe-v4", "../simple-quick-action-base", "../common/op-add-custom-section", "../dialog-enablement-validator", "../../../cpe/quick-actions/utils", "sap/ui/dt/OverlayRegistry", "../../dialog-factory", "./utils"], function (_____utils_fe_v4js, ___simple_quick_action_basejs, ___common_op_add_custom_sectionjs, ___dialog_enablement_validatorjs, _____cpe_quick_actions_utilsjs, OverlayRegistry, ____dialog_factoryjs, ___utilsjs) {
4
4
  "use strict";
5
5
 
6
6
  const getV4AppComponent = _____utils_fe_v4js["getV4AppComponent"];
@@ -10,6 +10,7 @@ sap.ui.define(["../../../utils/fe-v4", "../simple-quick-action-base", "../common
10
10
  const getRelevantControlFromActivePage = _____cpe_quick_actions_utilsjs["getRelevantControlFromActivePage"];
11
11
  const DialogFactory = ____dialog_factoryjs["DialogFactory"];
12
12
  const DialogNames = ____dialog_factoryjs["DialogNames"];
13
+ const getPageId = ___utilsjs["getPageId"];
13
14
  const OP_PAGE_LAYOUT = ['sap.uxap.ObjectPageLayout'];
14
15
  /**
15
16
  * Quick Action for adding a custom page action.
@@ -21,7 +22,7 @@ sap.ui.define(["../../../utils/fe-v4", "../simple-quick-action-base", "../common
21
22
  const objectPageLayout = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, OP_PAGE_LAYOUT)[0];
22
23
  const sections = objectPageLayout.getSections();
23
24
  let anchor = null;
24
- const pageId = this.context.view.getViewData()?.stableId.split('::').pop();
25
+ const pageId = getPageId(this.context);
25
26
  if (sections.length > 0) {
26
27
  // Use the first section as the anchor if available
27
28
  anchor = (this.context.view.getLocalId(sections[sections.length - 1].getId()) ?? '').split('::').pop();
@@ -9,12 +9,9 @@ import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/uti
9
9
  import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
10
10
  import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
11
11
  import { DialogFactory, DialogNames } from '../../dialog-factory.js';
12
+ import { getPageId } from './utils.js';
12
13
 
13
14
  const OP_PAGE_LAYOUT = ['sap.uxap.ObjectPageLayout'];
14
-
15
- interface ViewDataType {
16
- stableId: string;
17
- }
18
15
  /**
19
16
  * Quick Action for adding a custom page action.
20
17
  */
@@ -32,7 +29,7 @@ export class AddCustomSectionQuickAction
32
29
  )[0] as ObjectPageLayout;
33
30
  const sections = objectPageLayout.getSections();
34
31
  let anchor: string | null = null;
35
- const pageId = (this.context.view.getViewData() as ViewDataType)?.stableId.split('::').pop() as string;
32
+ const pageId = getPageId(this.context);
36
33
  if (sections.length > 0) {
37
34
  // Use the first section as the anchor if available
38
35
  anchor = (this.context.view.getLocalId(sections[sections.length - 1].getId()) ?? '')
@@ -8,6 +8,24 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
8
8
  const getPageName = _____utils_fe_v4js["getPageName"];
9
9
  const getReference = _____utils_fe_v4js["getReference"];
10
10
  const isMacroTable = _____utils_fe_v4js["isMacroTable"];
11
+ function getPageId(context) {
12
+ return context.view.getViewData()?.stableId.split('::').pop();
13
+ }
14
+
15
+ /**
16
+ * Returns the app component and page ID for use in appDescriptor, or undefined if either is missing.
17
+ */
18
+ function getAppDescriptorBase(context) {
19
+ const appComponent = getV4AppComponent(context.view);
20
+ const pageId = getPageId(context);
21
+ if (!appComponent || !pageId) {
22
+ return undefined;
23
+ }
24
+ return {
25
+ appComponent,
26
+ pageId
27
+ };
28
+ }
11
29
  async function executeToggleAction(context, isButtonEnabled, controlType, propertyPath) {
12
30
  const controls = context.controlIndex[controlType] ?? [];
13
31
  const control = controls[0];
@@ -149,6 +167,8 @@ sap.ui.define(["../../../utils/core", "sap/ui/rta/command/CommandFactory", "../.
149
167
  var __exports = {
150
168
  __esModule: true
151
169
  };
170
+ __exports.getPageId = getPageId;
171
+ __exports.getAppDescriptorBase = getAppDescriptorBase;
152
172
  __exports.executeToggleAction = executeToggleAction;
153
173
  __exports.generateRoutePattern = generateRoutePattern;
154
174
  __exports.getLineItemAnnotation = getLineItemAnnotation;
@@ -4,6 +4,29 @@ import type { QuickActionContext } from '../../../cpe/quick-actions/quick-action
4
4
  import CommandFactory from 'sap/ui/rta/command/CommandFactory';
5
5
  import { getV4AppComponent, getPageName, getReference, isMacroTable } from '../../../utils/fe-v4.js';
6
6
  import UI5Element from 'sap/ui/core/Element';
7
+ import type AppComponent from 'sap/fe/core/AppComponent';
8
+
9
+ interface ViewDataType {
10
+ stableId: string;
11
+ }
12
+
13
+ export function getPageId(context: QuickActionContext): string | undefined {
14
+ return (context.view.getViewData() as ViewDataType)?.stableId.split('::').pop();
15
+ }
16
+
17
+ /**
18
+ * Returns the app component and page ID for use in appDescriptor, or undefined if either is missing.
19
+ */
20
+ export function getAppDescriptorBase(
21
+ context: QuickActionContext
22
+ ): { appComponent: AppComponent; pageId: string } | undefined {
23
+ const appComponent = getV4AppComponent(context.view);
24
+ const pageId = getPageId(context);
25
+ if (!appComponent || !pageId) {
26
+ return undefined;
27
+ }
28
+ return { appComponent, pageId };
29
+ }
7
30
 
8
31
  export async function executeToggleAction(
9
32
  context: QuickActionContext,
@@ -199,7 +199,7 @@ export class ChangeService extends EventTarget {
199
199
  controlId,
200
200
  changeType: type,
201
201
  subtitle
202
- } = await handler(change as unknown as GenericChange, {
202
+ } = await handler(change, {
203
203
  textBundle,
204
204
  appComponent: this.options.rta.getRootControlInstance(),
205
205
  configPropertyControlIdMap: this.configPropertyControlIdMap
@@ -142,7 +142,7 @@ export class ODataHealthChecker {
142
142
 
143
143
  private getServices(): ODataServiceInfo[] {
144
144
  const rootControl = this.rta.getRootControlInstance();
145
- const manifest: Manifest = rootControl.getManifest() as unknown as Manifest;
145
+ const manifest: Manifest = rootControl.getManifest();
146
146
  const dataSources = manifest?.['sap.app']?.dataSources;
147
147
  const odataServices = Object.values(dataSources ?? {}).filter(this.isOdataService);
148
148
 
@@ -63,7 +63,7 @@ function getPropertyDocument(
63
63
  propertyName: property.name,
64
64
  type: ui5Type ?? '-',
65
65
  propertyType: ui5Type ?? '-'
66
- } as PropertiesInfo);
66
+ });
67
67
  }
68
68
 
69
69
  async function addDocumentationForProperties(control: ManagedObject, controlData: Control): Promise<void> {
@@ -8,13 +8,13 @@ import IconPool from 'sap/ui/core/IconPool';
8
8
  */
9
9
  export function getIcons(): IconDetails[] {
10
10
  return IconPool.getIconNames('undefined')
11
- .map((icon: string) => {
11
+ .map((icon: string): IconDetails => {
12
12
  const iconInfo = IconPool.getIconInfo(icon) as IconDetails;
13
13
  return {
14
14
  name: icon.toLowerCase(),
15
15
  content: iconInfo.content,
16
16
  fontFamily: iconInfo.fontFamily
17
- } as IconDetails;
17
+ };
18
18
  })
19
19
  .sort((item1: IconDetails, item2: IconDetails) => {
20
20
  if (item1.name < item2.name) {
@@ -72,7 +72,7 @@ sap.ui.define(["sap/base/util/merge", "sap/ui/fl/write/api/connectors/ObjectStor
72
72
  'content-type': 'application/json'
73
73
  }
74
74
  });
75
- return await response.json();
75
+ return response.json();
76
76
  }
77
77
  },
78
78
  loadFeatures: async function () {
@@ -67,14 +67,14 @@ const connector = merge({}, ObjectStorageConnector, {
67
67
  getItem: function (_key: string) {
68
68
  // not implemented
69
69
  },
70
- getItems: async function () {
70
+ getItems: async function (): Promise<FlexChange[]> {
71
71
  const response = await fetch(changesApiPath, {
72
72
  method: 'GET',
73
73
  headers: {
74
74
  'content-type': 'application/json'
75
75
  }
76
76
  });
77
- return (await response.json()) as unknown as FlexChange[];
77
+ return response.json();
78
78
  }
79
79
  } as typeof ObjectStorageConnector.storage,
80
80
  loadFeatures: async function () {
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
12
12
  },
13
- "version": "1.0.34",
13
+ "version": "1.0.36",
14
14
  "license": "Apache-2.0",
15
15
  "author": "@SAP/ux-tools-team",
16
16
  "main": "dist/index.js",
@@ -28,17 +28,17 @@
28
28
  "mem-fs-editor": "9.4.0",
29
29
  "qrcode": "1.5.4",
30
30
  "@sap/bas-sdk": "3.13.9",
31
- "@sap-ux/adp-tooling": "1.0.25",
32
- "@sap-ux/btp-utils": "2.0.3",
33
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@1.0.6",
34
- "@sap-ux/feature-toggle": "1.0.3",
35
- "@sap-ux/logger": "1.0.1",
36
- "@sap-ux/project-access": "2.1.4",
37
- "@sap-ux/system-access": "1.0.4",
38
- "@sap-ux/i18n": "1.0.1"
31
+ "@sap-ux/adp-tooling": "1.0.27",
32
+ "@sap-ux/btp-utils": "2.0.5",
33
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@1.0.7",
34
+ "@sap-ux/feature-toggle": "1.0.4",
35
+ "@sap-ux/logger": "1.0.2",
36
+ "@sap-ux/project-access": "2.1.6",
37
+ "@sap-ux/system-access": "1.0.6",
38
+ "@sap-ux/i18n": "1.0.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@jest/globals": "30.3.0",
41
+ "@jest/globals": "30.4.1",
42
42
  "@types/connect": "^3.4.38",
43
43
  "@types/qrcode": "1.5.6",
44
44
  "@types/ejs": "3.1.5",
@@ -54,11 +54,11 @@
54
54
  "nock": "14.0.15",
55
55
  "npm-run-all2": "8.0.4",
56
56
  "supertest": "7.2.2",
57
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.0.34",
58
- "@sap-ux-private/playwright": "1.0.3",
59
- "@sap-ux/axios-extension": "2.0.4",
60
- "@sap-ux/store": "2.0.2",
61
- "@sap-ux/ui5-info": "1.0.2"
57
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.0.36",
58
+ "@sap-ux-private/playwright": "1.0.4",
59
+ "@sap-ux/axios-extension": "2.0.6",
60
+ "@sap-ux/store": "2.0.3",
61
+ "@sap-ux/ui5-info": "1.0.4"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "express": "4"