@sap-ux/preview-middleware 0.16.168 → 0.16.169

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.
@@ -37,7 +37,7 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../../../utils/core", "../si
37
37
  throw new Error('Could not retrieve configuration property because control id is not valid!');
38
38
  }
39
39
  const value = this.context.changeService.getConfigurationPropertyValue(id, 'useDateRange');
40
- this.isUseDateRangeTypeEnabled = value === undefined ? this.control.data('useDateRangeType') : value;
40
+ this.isUseDateRangeTypeEnabled = value === undefined ? this.control.getUseDateRangeType() : value;
41
41
  }
42
42
  }
43
43
  }
@@ -1,5 +1,4 @@
1
1
  import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
- import type FilterBar from 'sap/ui/comp/filterbar/FilterBar';
3
2
  import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
3
  import { pageHasControlId } from '../../../cpe/quick-actions/utils';
5
4
  import { getControlById, isA } from '../../../utils/core';
@@ -14,7 +13,7 @@ const COMPONENT = 'sap.suite.ui.generic.template.ListReport';
14
13
  * Quick Action for toggling the visibility of "semantic date range" for filterbar fields.
15
14
  */
16
15
  export class ToggleSemanticDateRangeFilterBar
17
- extends SimpleQuickActionDefinitionBase
16
+ extends SimpleQuickActionDefinitionBase<SmartFilterBar>
18
17
  implements SimpleQuickActionDefinition
19
18
  {
20
19
  constructor(context: QuickActionContext) {
@@ -31,7 +30,7 @@ export class ToggleSemanticDateRangeFilterBar
31
30
  const controls = this.context.controlIndex[CONTROL_TYPE] ?? [];
32
31
  for (const control of controls) {
33
32
  const isActionApplicable = pageHasControlId(this.context.view, control.controlId);
34
- const modifiedControl = getControlById<FilterBar>(control.controlId);
33
+ const modifiedControl = getControlById<SmartFilterBar>(control.controlId);
35
34
  if (isActionApplicable && modifiedControl) {
36
35
  this.control = modifiedControl;
37
36
 
@@ -41,7 +40,7 @@ export class ToggleSemanticDateRangeFilterBar
41
40
  }
42
41
  const value = this.context.changeService.getConfigurationPropertyValue(id, 'useDateRange');
43
42
  this.isUseDateRangeTypeEnabled =
44
- value === undefined ? (this.control.data('useDateRangeType') as boolean) : (value as boolean);
43
+ value === undefined ? this.control.getUseDateRangeType() : (value as boolean);
45
44
  }
46
45
  }
47
46
  }
@@ -10,14 +10,14 @@ import { QuickActionDefinitionBase } from './quick-action-base';
10
10
  /**
11
11
  * Base class for all simple quick actions.
12
12
  */
13
- export abstract class SimpleQuickActionDefinitionBase extends QuickActionDefinitionBase<
14
- typeof SIMPLE_QUICK_ACTION_KIND
15
- > {
13
+ export abstract class SimpleQuickActionDefinitionBase<
14
+ T extends UI5Element = UI5Element
15
+ > extends QuickActionDefinitionBase<typeof SIMPLE_QUICK_ACTION_KIND> {
16
16
  public get isApplicable(): boolean {
17
17
  return this.control !== undefined;
18
18
  }
19
19
 
20
- protected control: UI5Element | undefined;
20
+ protected control: T | undefined;
21
21
 
22
22
  constructor(
23
23
  public readonly type: string,
@@ -30,7 +30,7 @@ export abstract class SimpleQuickActionDefinitionBase extends QuickActionDefinit
30
30
  }
31
31
 
32
32
  initialize(): void {
33
- for (const control of getRelevantControlFromActivePage(
33
+ for (const control of getRelevantControlFromActivePage<T>(
34
34
  this.context.controlIndex,
35
35
  this.context.view,
36
36
  this.controlTypes
@@ -63,16 +63,16 @@ function isDescendantOfPage(control: ManagedObject | null | undefined, rootContr
63
63
  * @param controlTypes - Relevant control types.
64
64
  * @returns A list of UI5 controls.
65
65
  */
66
- export function getRelevantControlFromActivePage(
66
+ export function getRelevantControlFromActivePage<T extends UI5Element = UI5Element>(
67
67
  controlIndex: ControlTreeIndex,
68
68
  activePage: Control,
69
69
  controlTypes: string[]
70
- ): UI5Element[] {
71
- const relevantControls: UI5Element[] = [];
70
+ ): T[] {
71
+ const relevantControls: T[] = [];
72
72
  for (const type of controlTypes) {
73
73
  const controls = controlIndex[type] ?? [];
74
74
  for (const control of controls) {
75
- const ui5Control = getControlById(control.controlId);
75
+ const ui5Control = getControlById<T>(control.controlId);
76
76
  const parent = ui5Control?.getParent();
77
77
  const isActionApplicable = isDescendantOfPage(parent, activePage);
78
78
 
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.16.168",
12
+ "version": "0.16.169",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,12 +25,12 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/feature-toggle": "0.2.3",
28
+ "@sap-ux/logger": "0.6.0",
29
29
  "@sap-ux/btp-utils": "0.17.2",
30
- "@sap-ux/adp-tooling": "0.12.109",
31
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.32",
30
+ "@sap-ux/feature-toggle": "0.2.3",
32
31
  "@sap-ux/project-access": "1.28.10",
33
- "@sap-ux/logger": "0.6.0"
32
+ "@sap-ux/adp-tooling": "0.12.109",
33
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.5.32"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/ejs": "3.1.2",
@@ -46,9 +46,9 @@
46
46
  "supertest": "6.3.3",
47
47
  "@sap-ux-private/playwright": "0.1.0",
48
48
  "dotenv": "16.3.1",
49
- "@sap-ux/axios-extension": "1.18.1",
50
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.48",
49
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.49",
51
50
  "@sap-ux/store": "1.0.0",
51
+ "@sap-ux/axios-extension": "1.18.1",
52
52
  "@sap-ux/ui5-info": "0.8.3",
53
53
  "@sap-ux/i18n": "0.2.0"
54
54
  },