@sap-ux/preview-middleware 0.16.156 → 0.16.157

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 (54) hide show
  1. package/dist/client/adp/controllers/AddFragment.controller.js +0 -1
  2. package/dist/client/adp/controllers/AddFragment.controller.ts +0 -1
  3. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +0 -1
  4. package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +0 -1
  5. package/dist/client/adp/controllers/BaseDialog.controller.ts +0 -4
  6. package/dist/client/adp/dialog-factory.js +115 -0
  7. package/dist/client/adp/dialog-factory.ts +134 -0
  8. package/dist/client/adp/extension-point.js +6 -6
  9. package/dist/client/adp/extension-point.ts +2 -2
  10. package/dist/client/adp/init-dialogs.js +5 -62
  11. package/dist/client/adp/init-dialogs.ts +5 -77
  12. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +6 -5
  13. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +5 -3
  14. package/dist/client/adp/quick-actions/common/create-page-action.js +7 -6
  15. package/dist/client/adp/quick-actions/common/create-page-action.ts +7 -4
  16. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +6 -5
  17. package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +6 -3
  18. package/dist/client/adp/quick-actions/common/op-add-header-field.js +7 -6
  19. package/dist/client/adp/quick-actions/common/op-add-header-field.ts +7 -4
  20. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
  21. package/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
  22. package/dist/client/adp/quick-actions/enablement-validator.js +6 -0
  23. package/dist/client/adp/quick-actions/enablement-validator.ts +18 -0
  24. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +3 -2
  25. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +11 -3
  26. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +6 -5
  27. package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +6 -3
  28. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +6 -5
  29. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +25 -13
  30. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +6 -2
  31. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +8 -3
  32. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +19 -9
  33. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +36 -15
  34. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +3 -2
  35. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +4 -1
  36. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +6 -5
  37. package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +16 -7
  38. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +6 -5
  39. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +8 -5
  40. package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +8 -14
  41. package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +10 -14
  42. package/dist/client/adp/quick-actions/quick-action-base.js +55 -0
  43. package/dist/client/adp/quick-actions/quick-action-base.ts +55 -0
  44. package/dist/client/adp/quick-actions/simple-quick-action-base.js +8 -13
  45. package/dist/client/adp/quick-actions/simple-quick-action-base.ts +10 -18
  46. package/dist/client/adp/quick-actions/table-quick-action-base.js +7 -9
  47. package/dist/client/adp/quick-actions/table-quick-action-base.ts +10 -14
  48. package/dist/client/cpe/changes/service.js +30 -0
  49. package/dist/client/cpe/changes/service.ts +46 -0
  50. package/dist/client/cpe/quick-actions/quick-action-definition.ts +5 -1
  51. package/dist/client/cpe/quick-actions/quick-action-service.js +10 -4
  52. package/dist/client/cpe/quick-actions/quick-action-service.ts +9 -3
  53. package/dist/client/messagebundle.properties +1 -0
  54. package/package.json +5 -5
@@ -22,13 +22,27 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../control-types", "./utils"
22
22
  */
23
23
  class EnableTableFilteringQuickAction extends SimpleQuickActionDefinitionBase {
24
24
  constructor(context) {
25
- super(ENABLE_TABLE_FILTERING, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context);
25
+ super(ENABLE_TABLE_FILTERING, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context, [{
26
+ run: () => {
27
+ if (this.control) {
28
+ const id = this.control.getProperty('persistencyKey') ?? this.control.getId();
29
+ if (typeof id !== 'string') {
30
+ throw new Error('Could not retrieve configuration property because control id is not valid!');
31
+ }
32
+ const value = this.context.changeService.getConfigurationPropertyValue(id, 'enableTableFilterInPageVariant');
33
+ const isFilterEnabled = value === undefined ? this.control.data('p13nDialogSettings')?.filter?.visible : value;
34
+ if (isFilterEnabled) {
35
+ return {
36
+ type: 'error',
37
+ message: this.context.resourceBundle.getText('TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE')
38
+ };
39
+ }
40
+ }
41
+ return undefined;
42
+ }
43
+ }]);
26
44
  }
27
45
  forceRefreshAfterExecution = true;
28
- lsTableMap = {};
29
- get tooltip() {
30
- return this.isDisabled ? this.context.resourceBundle.getText('TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE') : undefined;
31
- }
32
46
  async initialize() {
33
47
  const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
34
48
  if (!manifestChangesSupported) {
@@ -36,16 +50,13 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../control-types", "./utils"
36
50
  }
37
51
  for (const table of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, CONTROL_TYPES)) {
38
52
  if (table) {
39
- const isFilterEnabled = table.data('p13nDialogSettings').filter.visible;
40
53
  const isActionApplicable = pageHasControlId(this.context.view, table.getId());
41
54
  if (isActionApplicable) {
42
- this.isDisabled = isFilterEnabled;
43
55
  this.control = table;
44
56
  break;
45
57
  }
46
58
  }
47
59
  }
48
- return Promise.resolve();
49
60
  }
50
61
  async execute() {
51
62
  if (!this.control) {
@@ -55,7 +66,6 @@ sap.ui.define(["../../../cpe/quick-actions/utils", "../control-types", "./utils"
55
66
  const command = await prepareManifestChange(this.context, 'component/settings', this.control, COMPONENT, entitySet, {
56
67
  enableTableFilterInPageVariant: !this.isDisabled
57
68
  });
58
- this.isDisabled = !this.isDisabled;
59
69
  return command;
60
70
  }
61
71
  }
@@ -1,4 +1,7 @@
1
- import FlexCommand from 'sap/ui/rta/command/FlexCommand';
1
+ import SmartTable from 'sap/ui/comp/smarttable/SmartTable';
2
+
3
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
4
+
2
5
  import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
3
6
  import { getRelevantControlFromActivePage, pageHasControlId } from '../../../cpe/quick-actions/utils';
4
7
  import { GRID_TABLE_TYPE, M_TABLE_TYPE, SMART_TABLE_TYPE, TREE_TABLE_TYPE } from '../control-types';
@@ -6,7 +9,7 @@ import { areManifestChangesSupported, prepareManifestChange } from './utils';
6
9
 
7
10
  import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
8
11
  import { isA } from '../../../utils/core';
9
- import SmartTable from 'sap/ui/comp/smarttable/SmartTable';
12
+
10
13
  const COMPONENT = 'sap.suite.ui.generic.template.ListReport';
11
14
 
12
15
  export const ENABLE_TABLE_FILTERING = 'enable-table-filtering';
@@ -21,15 +24,39 @@ export class EnableTableFilteringQuickAction
21
24
  implements SimpleQuickActionDefinition
22
25
  {
23
26
  constructor(context: QuickActionContext) {
24
- super(ENABLE_TABLE_FILTERING, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context);
27
+ super(ENABLE_TABLE_FILTERING, CONTROL_TYPES, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context, [
28
+ {
29
+ run: () => {
30
+ if (this.control) {
31
+ const id = (this.control.getProperty('persistencyKey') as unknown) ?? this.control.getId();
32
+ if (typeof id !== 'string') {
33
+ throw new Error(
34
+ 'Could not retrieve configuration property because control id is not valid!'
35
+ );
36
+ }
37
+ const value = this.context.changeService.getConfigurationPropertyValue(
38
+ id,
39
+ 'enableTableFilterInPageVariant'
40
+ );
41
+ const isFilterEnabled: boolean =
42
+ value === undefined
43
+ ? (this.control.data('p13nDialogSettings')?.filter?.visible as boolean)
44
+ : (value as boolean);
45
+ if (isFilterEnabled) {
46
+ return {
47
+ type: 'error',
48
+ message: this.context.resourceBundle.getText(
49
+ 'TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE'
50
+ )
51
+ };
52
+ }
53
+ }
54
+ return undefined;
55
+ }
56
+ }
57
+ ]);
25
58
  }
26
- isActive: boolean;
27
59
  readonly forceRefreshAfterExecution = true;
28
- lsTableMap: Record<string, number> = {};
29
- public get tooltip(): string | undefined {
30
- return this.isDisabled ? this.context.resourceBundle.getText('TABLE_FILTERING_CHANGE_HAS_ALREADY_BEEN_MADE') : undefined;
31
- }
32
-
33
60
  async initialize(): Promise<void> {
34
61
  const manifestChangesSupported = await areManifestChangesSupported(this.context.manifest);
35
62
  if (!manifestChangesSupported) {
@@ -41,17 +68,13 @@ export class EnableTableFilteringQuickAction
41
68
  CONTROL_TYPES
42
69
  )) {
43
70
  if (table) {
44
- const isFilterEnabled = table.data('p13nDialogSettings').filter.visible;
45
71
  const isActionApplicable = pageHasControlId(this.context.view, table.getId());
46
72
  if (isActionApplicable) {
47
- this.isDisabled = isFilterEnabled;
48
73
  this.control = table;
49
74
  break;
50
75
  }
51
76
  }
52
77
  }
53
-
54
- return Promise.resolve();
55
78
  }
56
79
 
57
80
  async execute(): Promise<FlexCommand[]> {
@@ -71,8 +94,6 @@ export class EnableTableFilteringQuickAction
71
94
  }
72
95
  );
73
96
 
74
- this.isDisabled = !this.isDisabled;
75
-
76
97
  return command;
77
98
  }
78
99
  }
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI", "../../../cpe/quick-actions/utils", "../../../utils/core", "./table-quick-action-base", "../control-types"], function (OverlayUtil, FlexRuntimeInfoAPI, _____cpe_quick_actions_utils, _____utils_core, ___table_quick_action_base, ___control_types) {
3
+ sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI", "../../../cpe/quick-actions/utils", "../../../utils/core", "./table-quick-action-base", "../control-types", "../dialog-enablement-validator"], function (OverlayUtil, FlexRuntimeInfoAPI, _____cpe_quick_actions_utils, _____utils_core, ___table_quick_action_base, ___control_types, ___dialog_enablement_validator) {
4
4
  "use strict";
5
5
 
6
6
  const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
7
7
  const getControlById = _____utils_core["getControlById"];
8
8
  const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
9
9
  const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
10
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
10
11
  const CHANGE_TABLE_COLUMNS = 'change-table-columns';
11
12
  const ACTION_ID = 'CTX_SETTINGS0';
12
13
  const CONTROL_TYPE = 'sap.ui.mdc.Table';
@@ -16,7 +17,7 @@ sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI"
16
17
  */
17
18
  class ChangeTableColumnsQuickAction extends TableQuickActionDefinitionBase {
18
19
  constructor(context) {
19
- super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context);
20
+ super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
20
21
  }
21
22
  async execute(path) {
22
23
  const index = this.tableMap[path];
@@ -6,6 +6,7 @@ import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/uti
6
6
  import { getControlById } from '../../../utils/core';
7
7
  import { TableQuickActionDefinitionBase } from './table-quick-action-base';
8
8
  import { MDC_TABLE_TYPE } from '../control-types';
9
+ import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
9
10
 
10
11
  export const CHANGE_TABLE_COLUMNS = 'change-table-columns';
11
12
  const ACTION_ID = 'CTX_SETTINGS0';
@@ -19,7 +20,9 @@ export class ChangeTableColumnsQuickAction
19
20
  implements NestedQuickActionDefinition
20
21
  {
21
22
  constructor(context: QuickActionContext) {
22
- super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context);
23
+ super(CHANGE_TABLE_COLUMNS, [MDC_TABLE_TYPE], 'V4_QUICK_ACTION_CHANGE_TABLE_COLUMNS', context, undefined, [
24
+ DIALOG_ENABLEMENT_VALIDATOR
25
+ ]);
23
26
  }
24
27
 
25
28
  async execute(path: string): Promise<FlexCommand[]> {
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../cpe/quick-actions/utils", "../../../utils/core", "../../init-dialogs", "./table-quick-action-base", "../control-types"], function (OverlayUtil, _____cpe_quick_actions_utils, _____utils_core, ____init_dialogs, ___table_quick_action_base, ___control_types) {
3
+ sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../cpe/quick-actions/utils", "../../../utils/core", "../../dialog-factory", "../dialog-enablement-validator", "./table-quick-action-base", "../control-types"], function (OverlayUtil, _____cpe_quick_actions_utils, _____utils_core, ____dialog_factory, ___dialog_enablement_validator, ___table_quick_action_base, ___control_types) {
4
4
  "use strict";
5
5
 
6
6
  const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
7
7
  const getControlById = _____utils_core["getControlById"];
8
- const DialogNames = ____init_dialogs["DialogNames"];
9
- const handler = ____init_dialogs["handler"];
8
+ const DialogFactory = ____dialog_factory["DialogFactory"];
9
+ const DialogNames = ____dialog_factory["DialogNames"];
10
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
10
11
  const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
11
12
  const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
12
13
  const CREATE_TABLE_ACTION = 'create_table_action';
@@ -17,7 +18,7 @@ sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../cpe/quick-actions/utils", "../
17
18
  */
18
19
  class AddTableActionQuickAction extends TableQuickActionDefinitionBase {
19
20
  constructor(context) {
20
- super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, true);
21
+ super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, true, [DIALOG_ENABLEMENT_VALIDATOR]);
21
22
  }
22
23
  async execute(path) {
23
24
  const index = this.tableMap[path];
@@ -28,7 +29,7 @@ sap.ui.define(["sap/ui/dt/OverlayUtil", "../../../cpe/quick-actions/utils", "../
28
29
  const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
29
30
  if (controlOverlay) {
30
31
  controlOverlay.setSelected(true);
31
- await handler(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
32
+ await DialogFactory.createDialog(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
32
33
  aggregation: 'actions',
33
34
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
34
35
  });
@@ -1,10 +1,11 @@
1
1
  import OverlayUtil from 'sap/ui/dt/OverlayUtil';
2
- import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
3
3
 
4
4
  import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
5
5
  import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
6
6
  import { getControlById } from '../../../utils/core';
7
- import { DialogNames, handler } from '../../init-dialogs';
7
+ import { DialogFactory, DialogNames } from '../../dialog-factory';
8
+ import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
8
9
  import { TableQuickActionDefinitionBase } from './table-quick-action-base';
9
10
  import { MDC_TABLE_TYPE } from '../control-types';
10
11
 
@@ -16,7 +17,9 @@ const TOOLBAR_ACTION = 'sap.ui.mdc.ActionToolbar';
16
17
  */
17
18
  export class AddTableActionQuickAction extends TableQuickActionDefinitionBase implements NestedQuickActionDefinition {
18
19
  constructor(context: QuickActionContext) {
19
- super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, true);
20
+ super(CREATE_TABLE_ACTION, [MDC_TABLE_TYPE], 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION', context, true, [
21
+ DIALOG_ENABLEMENT_VALIDATOR
22
+ ]);
20
23
  }
21
24
 
22
25
  async execute(path: string): Promise<FlexCommand[]> {
@@ -32,10 +35,16 @@ export class AddTableActionQuickAction extends TableQuickActionDefinitionBase im
32
35
  const controlOverlay = OverlayUtil.getClosestOverlayFor(section);
33
36
  if (controlOverlay) {
34
37
  controlOverlay.setSelected(true);
35
- await handler(controlOverlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
36
- aggregation: 'actions',
37
- title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
38
- });
38
+ await DialogFactory.createDialog(
39
+ controlOverlay,
40
+ this.context.rta,
41
+ DialogNames.ADD_FRAGMENT,
42
+ undefined,
43
+ {
44
+ aggregation: 'actions',
45
+ title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_ACTION'
46
+ }
47
+ );
39
48
  }
40
49
  }
41
50
  }
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
 
3
- sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../init-dialogs", "../control-types", "../table-quick-action-base", "../fe-v2/create-table-custom-column"], function (OverlayRegistry, ____init_dialogs, ___control_types, ___table_quick_action_base, ___fe_v2_create_table_custom_column) {
3
+ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../dialog-factory", "../control-types", "../table-quick-action-base", "../fe-v2/create-table-custom-column", "../dialog-enablement-validator"], function (OverlayRegistry, ____dialog_factory, ___control_types, ___table_quick_action_base, ___fe_v2_create_table_custom_column, ___dialog_enablement_validator) {
4
4
  "use strict";
5
5
 
6
- const DialogNames = ____init_dialogs["DialogNames"];
7
- const handler = ____init_dialogs["handler"];
6
+ const DialogFactory = ____dialog_factory["DialogFactory"];
7
+ const DialogNames = ____dialog_factory["DialogNames"];
8
8
  const SMART_TABLE_TYPE = ___control_types["SMART_TABLE_TYPE"];
9
9
  const GRID_TABLE_TYPE = ___control_types["GRID_TABLE_TYPE"];
10
10
  const MDC_TABLE_TYPE = ___control_types["MDC_TABLE_TYPE"];
11
11
  const TREE_TABLE_TYPE = ___control_types["TREE_TABLE_TYPE"];
12
12
  const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
13
13
  const preprocessActionExecution = ___fe_v2_create_table_custom_column["preprocessActionExecution"];
14
+ const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
14
15
  const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
15
16
  const CONTROL_TYPES = [SMART_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE, GRID_TABLE_TYPE];
16
17
  class AddTableCustomColumnQuickAction extends TableQuickActionDefinitionBase {
17
18
  constructor(context) {
18
- super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context);
19
+ super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, undefined, [DIALOG_ENABLEMENT_VALIDATOR]);
19
20
  }
20
21
  async execute(path) {
21
22
  const {
@@ -29,7 +30,7 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../init-dialogs", "../control-ty
29
30
  preprocessActionExecution(table, sectionInfo, this.iconTabBar, iconTabBarFilterKey);
30
31
  this.selectOverlay(table);
31
32
  const overlay = OverlayRegistry.getOverlay(table);
32
- await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
33
+ await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
33
34
  aggregation: 'columns',
34
35
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN'
35
36
  });
@@ -1,12 +1,13 @@
1
- import FlexCommand from 'sap/ui/rta/command/FlexCommand';
1
+ import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
+ import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
2
3
 
3
4
  import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
4
- import OverlayRegistry from 'sap/ui/dt/OverlayRegistry';
5
- import { DialogNames, handler } from '../../init-dialogs';
5
+ import { DialogFactory, DialogNames } from '../../dialog-factory';
6
6
  import { SMART_TABLE_TYPE, GRID_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE } from '../control-types';
7
7
  import { TableQuickActionDefinitionBase } from '../table-quick-action-base';
8
8
 
9
9
  import { preprocessActionExecution } from '../fe-v2/create-table-custom-column';
10
+ import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
10
11
 
11
12
  export const CREATE_TABLE_CUSTOM_COLUMN = 'create-table-custom-column';
12
13
 
@@ -17,7 +18,9 @@ export class AddTableCustomColumnQuickAction
17
18
  implements NestedQuickActionDefinition
18
19
  {
19
20
  constructor(context: QuickActionContext) {
20
- super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context);
21
+ super(CREATE_TABLE_CUSTOM_COLUMN, CONTROL_TYPES, 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN', context, undefined, [
22
+ DIALOG_ENABLEMENT_VALIDATOR
23
+ ]);
21
24
  }
22
25
 
23
26
  async execute(path: string): Promise<FlexCommand[]> {
@@ -30,7 +33,7 @@ export class AddTableCustomColumnQuickAction
30
33
  this.selectOverlay(table);
31
34
 
32
35
  const overlay = OverlayRegistry.getOverlay(table);
33
- await handler(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
36
+ await DialogFactory.createDialog(overlay, this.context.rta, DialogNames.ADD_FRAGMENT, undefined, {
34
37
  aggregation: 'columns',
35
38
  title: 'QUICK_ACTION_ADD_CUSTOM_TABLE_COLUMN'
36
39
  });
@@ -2,34 +2,28 @@
2
2
  sap.ui.define([
3
3
  'sap/ui/fl/apply/api/FlexRuntimeInfoAPI',
4
4
  'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
5
- '../../../cpe/quick-actions/utils'
6
- ], function (FlexRuntimeInfoAPI, ___sap_ux_private_control_property_editor_common, _____cpe_quick_actions_utils) {
5
+ '../../../cpe/quick-actions/utils',
6
+ '../quick-action-base'
7
+ ], function (FlexRuntimeInfoAPI, ___sap_ux_private_control_property_editor_common, _____cpe_quick_actions_utils, ___quick_action_base) {
7
8
  'use strict';
8
9
  const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
9
10
  const getRelevantControlFromActivePage = _____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
11
+ const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
10
12
  const ACTION_ID = 'CTX_SETTINGS0';
11
- class TableQuickActionDefinitionBase {
12
- kind = NESTED_QUICK_ACTION_KIND;
13
- get id() {
14
- return `${ this.context.key }-${ this.type }`;
15
- }
16
- get textKey() {
17
- return this.defaultTextKey;
18
- }
13
+ class TableQuickActionDefinitionBase extends QuickActionDefinitionBase {
19
14
  isApplicable = false;
20
- isDisabled = false;
21
- get tooltip() {
22
- return undefined;
23
- }
24
15
  isClearButtonEnabled = false;
25
16
  children = [];
26
17
  tableMap = {};
27
18
  constructor(type, controlTypes, defaultTextKey, context, isSkipVariantManagementCheck) {
19
+ let enablementValidators = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
20
+ super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
28
21
  this.type = type;
29
22
  this.controlTypes = controlTypes;
30
23
  this.defaultTextKey = defaultTextKey;
31
24
  this.context = context;
32
25
  this.isSkipVariantManagementCheck = isSkipVariantManagementCheck;
26
+ this.enablementValidators = enablementValidators;
33
27
  }
34
28
  async initialize() {
35
29
  let index = 0;
@@ -6,22 +6,15 @@ import { NESTED_QUICK_ACTION_KIND } from '@sap-ux-private/control-property-edito
6
6
 
7
7
  import { QuickActionContext } from '../../../cpe/quick-actions/quick-action-definition';
8
8
  import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
9
+ import { EnablementValidator } from '../enablement-validator';
10
+ import { QuickActionDefinitionBase } from '../quick-action-base';
9
11
 
10
12
  const ACTION_ID = 'CTX_SETTINGS0';
11
13
 
12
- export abstract class TableQuickActionDefinitionBase {
13
- readonly kind = NESTED_QUICK_ACTION_KIND;
14
- public get id(): string {
15
- return `${this.context.key}-${this.type}`;
16
- }
17
- protected get textKey(): string {
18
- return this.defaultTextKey;
19
- }
14
+ export abstract class TableQuickActionDefinitionBase extends QuickActionDefinitionBase<
15
+ typeof NESTED_QUICK_ACTION_KIND
16
+ > {
20
17
  isApplicable = false;
21
- protected isDisabled = false;
22
- public get tooltip(): string | undefined {
23
- return undefined;
24
- }
25
18
 
26
19
  isClearButtonEnabled = false;
27
20
  children: NestedQuickActionChild[] = [];
@@ -31,8 +24,11 @@ export abstract class TableQuickActionDefinitionBase {
31
24
  protected readonly controlTypes: string[],
32
25
  protected readonly defaultTextKey: string,
33
26
  protected readonly context: QuickActionContext,
34
- protected readonly isSkipVariantManagementCheck?: boolean
35
- ) {}
27
+ protected readonly isSkipVariantManagementCheck?: boolean,
28
+ protected readonly enablementValidators: EnablementValidator[] = []
29
+ ) {
30
+ super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
31
+ }
36
32
 
37
33
  async initialize(): Promise<void> {
38
34
  let index = 0;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Base class for all quick actions.
8
+ */
9
+ class QuickActionDefinitionBase {
10
+ get id() {
11
+ return `${this.context.key}-${this.type}`;
12
+ }
13
+
14
+ /**
15
+ * Quick Actions tooltip.
16
+ */
17
+ get tooltip() {
18
+ if (this.validationResult) {
19
+ const validationErrors = this.validationResult.filter(result => result?.type === 'error');
20
+ if (validationErrors.length > 0) {
21
+ const error = validationErrors[0];
22
+ return error.message;
23
+ }
24
+ }
25
+ return undefined;
26
+ }
27
+ get isDisabled() {
28
+ if (this.validationResult === undefined) {
29
+ return false;
30
+ }
31
+ const validationErrors = this.validationResult.filter(result => result?.type === 'error');
32
+ return validationErrors.length > 0;
33
+ }
34
+ get textKey() {
35
+ return this.defaultTextKey;
36
+ }
37
+ constructor(type, kind, defaultTextKey, context) {
38
+ let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
39
+ this.type = type;
40
+ this.kind = kind;
41
+ this.defaultTextKey = defaultTextKey;
42
+ this.context = context;
43
+ this.enablementValidators = enablementValidators;
44
+ }
45
+ async runEnablementValidators() {
46
+ this.validationResult = await Promise.all(this.enablementValidators.map(async validator => await validator.run()));
47
+ }
48
+ }
49
+ var __exports = {
50
+ __esModule: true
51
+ };
52
+ __exports.QuickActionDefinitionBase = QuickActionDefinitionBase;
53
+ return __exports;
54
+ });
55
+ //# sourceMappingURL=quick-action-base.js.map
@@ -0,0 +1,55 @@
1
+ import { QuickActionContext } from '../../cpe/quick-actions/quick-action-definition';
2
+
3
+ import { EnablementValidator, EnablementValidatorError, EnablementValidatorResult } from './enablement-validator';
4
+
5
+ /**
6
+ * Base class for all quick actions.
7
+ */
8
+ export abstract class QuickActionDefinitionBase<T extends string> {
9
+ public get id(): string {
10
+ return `${this.context.key}-${this.type}`;
11
+ }
12
+
13
+ /**
14
+ * Quick Actions tooltip.
15
+ */
16
+ public get tooltip(): string | undefined {
17
+ if (this.validationResult) {
18
+ const validationErrors = this.validationResult.filter(
19
+ (result): result is EnablementValidatorError => result?.type === 'error'
20
+ );
21
+ if (validationErrors.length > 0) {
22
+ const error = validationErrors[0];
23
+ return error.message;
24
+ }
25
+ }
26
+ return undefined;
27
+ }
28
+
29
+ protected validationResult: EnablementValidatorResult[] | undefined;
30
+ protected get isDisabled(): boolean {
31
+ if (this.validationResult === undefined) {
32
+ return false;
33
+ }
34
+ const validationErrors = this.validationResult.filter((result) => result?.type === 'error');
35
+ return validationErrors.length > 0;
36
+ }
37
+
38
+ protected get textKey(): string {
39
+ return this.defaultTextKey;
40
+ }
41
+
42
+ constructor(
43
+ public readonly type: string,
44
+ public readonly kind: T,
45
+ protected readonly defaultTextKey: string,
46
+ protected readonly context: QuickActionContext,
47
+ protected readonly enablementValidators: EnablementValidator[] = []
48
+ ) {}
49
+
50
+ async runEnablementValidators(): Promise<void> {
51
+ this.validationResult = await Promise.all(
52
+ this.enablementValidators.map(async (validator) => await validator.run())
53
+ );
54
+ }
55
+ }
@@ -1,30 +1,25 @@
1
1
  'use strict';
2
2
  sap.ui.define([
3
3
  'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
- '../../cpe/quick-actions/utils'
5
- ], function (___sap_ux_private_control_property_editor_common, ____cpe_quick_actions_utils) {
4
+ '../../cpe/quick-actions/utils',
5
+ './quick-action-base'
6
+ ], function (___sap_ux_private_control_property_editor_common, ____cpe_quick_actions_utils, ___quick_action_base) {
6
7
  'use strict';
7
8
  const SIMPLE_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['SIMPLE_QUICK_ACTION_KIND'];
8
9
  const getRelevantControlFromActivePage = ____cpe_quick_actions_utils['getRelevantControlFromActivePage'];
9
- class SimpleQuickActionDefinitionBase {
10
- kind = SIMPLE_QUICK_ACTION_KIND;
11
- get id() {
12
- return `${ this.context.key }-${ this.type }`;
13
- }
10
+ const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
11
+ class SimpleQuickActionDefinitionBase extends QuickActionDefinitionBase {
14
12
  get isApplicable() {
15
13
  return this.control !== undefined;
16
14
  }
17
- get tooltip() {
18
- return undefined;
19
- }
20
- get textKey() {
21
- return this.defaultTextKey;
22
- }
23
15
  constructor(type, controlTypes, defaultTextKey, context) {
16
+ let enablementValidators = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
17
+ super(type, SIMPLE_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
24
18
  this.type = type;
25
19
  this.controlTypes = controlTypes;
26
20
  this.defaultTextKey = defaultTextKey;
27
21
  this.context = context;
22
+ this.enablementValidators = enablementValidators;
28
23
  }
29
24
  initialize() {
30
25
  for (const control of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, this.controlTypes)) {
@@ -4,38 +4,30 @@ import { SIMPLE_QUICK_ACTION_KIND, SimpleQuickAction } from '@sap-ux-private/con
4
4
 
5
5
  import { getRelevantControlFromActivePage } from '../../cpe/quick-actions/utils';
6
6
  import { QuickActionContext } from '../../cpe/quick-actions/quick-action-definition';
7
+ import { EnablementValidator } from './enablement-validator';
8
+ import { QuickActionDefinitionBase } from './quick-action-base';
7
9
 
8
10
  /**
9
11
  * Base class for all simple quick actions.
10
12
  */
11
- export abstract class SimpleQuickActionDefinitionBase {
12
- readonly kind = SIMPLE_QUICK_ACTION_KIND;
13
- public get id(): string {
14
- return `${this.context.key}-${this.type}`;
15
- }
16
-
13
+ export abstract class SimpleQuickActionDefinitionBase extends QuickActionDefinitionBase<
14
+ typeof SIMPLE_QUICK_ACTION_KIND
15
+ > {
17
16
  public get isApplicable(): boolean {
18
17
  return this.control !== undefined;
19
18
  }
20
19
 
21
- protected isDisabled: boolean | undefined;
22
-
23
- public get tooltip(): string | undefined {
24
- return undefined;
25
- }
26
-
27
- protected get textKey(): string {
28
- return this.defaultTextKey;
29
- }
30
-
31
20
  protected control: UI5Element | undefined;
32
21
 
33
22
  constructor(
34
23
  public readonly type: string,
35
24
  protected readonly controlTypes: string[],
36
25
  protected readonly defaultTextKey: string,
37
- protected readonly context: QuickActionContext
38
- ) {}
26
+ protected readonly context: QuickActionContext,
27
+ protected readonly enablementValidators: EnablementValidator[] = []
28
+ ) {
29
+ super(type, SIMPLE_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
30
+ }
39
31
 
40
32
  initialize(): void {
41
33
  for (const control of getRelevantControlFromActivePage(