@sap-ux/preview-middleware 0.17.43 → 0.17.44

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.
@@ -126,6 +126,10 @@ sap.ui.define([
126
126
  this.model.setProperty('/selectedIndex', indexArray.length - 1);
127
127
  this.model.setProperty('/targetAggregation', controlAggregation);
128
128
  this.model.setProperty('/index', indexArray);
129
+ const defaultIndex = Number(this.options.defaultAggregationArrayIndex);
130
+ if (defaultIndex >= 0) {
131
+ this.model.setProperty('/selectedIndex', indexArray.length - 1 > 0 ? defaultIndex : 0);
132
+ }
129
133
  },
130
134
  createFragmentChange: async function _createFragmentChange(fragmentData) {
131
135
  const {fragmentName, index, targetAggregation} = fragmentData;
@@ -52,6 +52,7 @@ export type AddFragmentModel = JSONModel & {
52
52
  export interface AddFragmentOptions {
53
53
  title: string;
54
54
  aggregation?: string;
55
+ defaultAggregationArrayIndex?: number;
55
56
  }
56
57
 
57
58
  /**
@@ -203,6 +204,10 @@ export default class AddFragment extends BaseDialog<AddFragmentModel> {
203
204
  this.model.setProperty('/selectedIndex', indexArray.length - 1);
204
205
  this.model.setProperty('/targetAggregation', controlAggregation);
205
206
  this.model.setProperty('/index', indexArray);
207
+ const defaultIndex = Number(this.options.defaultAggregationArrayIndex);
208
+ if (defaultIndex >= 0) {
209
+ this.model.setProperty('/selectedIndex', indexArray.length - 1 > 0 ? defaultIndex : 0);
210
+ }
206
211
  }
207
212
 
208
213
  /**
@@ -54,6 +54,9 @@ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.con
54
54
  ...('aggregation' in options && {
55
55
  aggregation: options.aggregation
56
56
  }),
57
+ ...('defaultAggregationArrayIndex' in options && {
58
+ defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
59
+ }),
57
60
  title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
58
61
  });
59
62
  break;
@@ -62,6 +62,9 @@ export class DialogFactory {
62
62
  case DialogNames.ADD_FRAGMENT:
63
63
  controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
64
64
  ...('aggregation' in options && { aggregation: options.aggregation }),
65
+ ...('defaultAggregationArrayIndex' in options && {
66
+ defaultAggregationArrayIndex: options.defaultAggregationArrayIndex
67
+ }),
65
68
  title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
66
69
  });
67
70
  break;
@@ -19,11 +19,11 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
19
19
  class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase {
20
20
  constructor(context) {
21
21
  super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context, [DIALOG_ENABLEMENT_VALIDATOR]);
22
+ this.appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
22
23
  }
23
24
  async initialize() {
24
- const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
25
25
  const version = await getUi5Version();
26
- if (appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, {
26
+ if (this.appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, {
27
27
  major: 1,
28
28
  minor: 130
29
29
  })) {
@@ -36,7 +36,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../simple-q
36
36
  const overlay = OverlayRegistry.getOverlay(this.control) || [];
37
37
  await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
38
38
  aggregation: 'actions',
39
- title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION'
39
+ title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION',
40
+ defaultAggregationArrayIndex: 1
40
41
  });
41
42
  }
42
43
  return [];
@@ -4,7 +4,7 @@ import FlexCommand from 'sap/ui/rta/command/FlexCommand';
4
4
  import { DialogFactory, DialogNames } from '../../dialog-factory';
5
5
  import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
6
6
  import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
7
- import { getApplicationType } from '../../../utils/application';
7
+ import { ApplicationType, getApplicationType } from '../../../utils/application';
8
8
  import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
9
9
  import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
10
10
 
@@ -15,16 +15,17 @@ const CONTROL_TYPES = ['sap.f.DynamicPageTitle', 'sap.uxap.ObjectPageHeader', 's
15
15
  * Quick Action for adding a custom page action.
16
16
  */
17
17
  export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase implements SimpleQuickActionDefinition {
18
+ private readonly appType: ApplicationType;
18
19
  constructor(context: QuickActionContext) {
19
20
  super(ADD_PAGE_ACTION, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION', context, [
20
21
  DIALOG_ENABLEMENT_VALIDATOR
21
22
  ]);
23
+ this.appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
22
24
  }
23
25
 
24
26
  async initialize(): Promise<void> {
25
- const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
26
27
  const version = await getUi5Version();
27
- if (appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, { major: 1, minor: 130 })) {
28
+ if (this.appType === 'fe-v4' && isLowerThanMinimalUi5Version(version, { major: 1, minor: 130 })) {
28
29
  return;
29
30
  }
30
31
  await super.initialize();
@@ -35,7 +36,8 @@ export class AddPageActionQuickAction extends SimpleQuickActionDefinitionBase im
35
36
  const overlay = OverlayRegistry.getOverlay(this.control) || [];
36
37
  await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
37
38
  aggregation: 'actions',
38
- title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION'
39
+ title: 'QUICK_ACTION_ADD_CUSTOM_PAGE_ACTION',
40
+ defaultAggregationArrayIndex: 1
39
41
  });
40
42
  }
41
43
  return [];
@@ -68,7 +68,8 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/core", "../../dialog
68
68
  const overlay = OverlayRegistry.getOverlay(headerToolbar) || [];
69
69
  await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
70
70
  aggregation: 'content',
71
- title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
71
+ title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION',
72
+ defaultAggregationArrayIndex: 1
72
73
  });
73
74
  }
74
75
  return [];
@@ -73,7 +73,8 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
73
73
  const overlay = OverlayRegistry.getOverlay(headerToolbar as UI5Element) || [];
74
74
  await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
75
75
  aggregation: 'content',
76
- title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
76
+ title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION',
77
+ defaultAggregationArrayIndex: 1
77
78
  });
78
79
  }
79
80
  return [];
@@ -35,6 +35,7 @@ sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../utils/core", "../../dialog-fac
35
35
  controlOverlay.setSelected(true);
36
36
  await DialogFactory.createDialog(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
37
37
  aggregation: 'actions',
38
+ defaultAggregationArrayIndex: 0,
38
39
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
39
40
  });
40
41
  }
@@ -35,6 +35,7 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
35
35
 
36
36
  await DialogFactory.createDialog(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
37
37
  aggregation: 'actions',
38
+ defaultAggregationArrayIndex: 0,
38
39
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
39
40
  });
40
41
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.17.43",
12
+ "version": "0.17.44",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -27,9 +27,9 @@
27
27
  "mem-fs-editor": "9.4.0",
28
28
  "@sap-ux/logger": "0.6.0",
29
29
  "@sap-ux/feature-toggle": "0.2.3",
30
- "@sap-ux/btp-utils": "1.0.1",
31
30
  "@sap-ux/adp-tooling": "0.12.136",
32
31
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.37",
32
+ "@sap-ux/btp-utils": "1.0.1",
33
33
  "@sap-ux/project-access": "1.29.8"
34
34
  },
35
35
  "devDependencies": {
@@ -48,11 +48,11 @@
48
48
  "supertest": "6.3.3",
49
49
  "@sap-ux-private/playwright": "0.1.0",
50
50
  "dotenv": "16.3.1",
51
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.66",
51
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.67",
52
52
  "@sap-ux/axios-extension": "1.18.6",
53
- "@sap-ux/ui5-info": "0.8.3",
53
+ "@sap-ux/store": "1.0.0",
54
54
  "@sap-ux/i18n": "0.2.1",
55
- "@sap-ux/store": "1.0.0"
55
+ "@sap-ux/ui5-info": "0.8.3"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "express": "4"