@sap-ux/preview-middleware 0.16.155 → 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 (107) hide show
  1. package/dist/client/adp/api-handler.js +142 -142
  2. package/dist/client/adp/command-executor.js +75 -75
  3. package/dist/client/adp/control-utils.js +44 -44
  4. package/dist/client/adp/controllers/AddFragment.controller.js +5 -6
  5. package/dist/client/adp/controllers/AddFragment.controller.ts +1 -2
  6. package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +0 -1
  7. package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +0 -1
  8. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
  9. package/dist/client/adp/controllers/BaseDialog.controller.ts +0 -4
  10. package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
  11. package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
  12. package/dist/client/adp/dialog-factory.js +115 -0
  13. package/dist/client/adp/dialog-factory.ts +134 -0
  14. package/dist/client/adp/extension-point.js +6 -6
  15. package/dist/client/adp/extension-point.ts +2 -2
  16. package/dist/client/adp/init-dialogs.js +100 -157
  17. package/dist/client/adp/init-dialogs.ts +5 -77
  18. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -54
  19. package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +5 -3
  20. package/dist/client/adp/quick-actions/common/create-page-action.js +50 -49
  21. package/dist/client/adp/quick-actions/common/create-page-action.ts +7 -4
  22. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -35
  23. package/dist/client/adp/quick-actions/common/op-add-custom-section.ts +6 -3
  24. package/dist/client/adp/quick-actions/common/op-add-header-field.js +48 -47
  25. package/dist/client/adp/quick-actions/common/op-add-header-field.ts +7 -4
  26. package/dist/client/adp/quick-actions/common/utils.js +20 -0
  27. package/dist/client/adp/quick-actions/common/utils.ts +7 -0
  28. package/dist/client/adp/quick-actions/control-types.js +23 -0
  29. package/dist/client/adp/quick-actions/control-types.ts +6 -0
  30. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
  31. package/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
  32. package/dist/client/adp/quick-actions/enablement-validator.js +6 -0
  33. package/dist/client/adp/quick-actions/enablement-validator.ts +18 -0
  34. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -100
  35. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +11 -3
  36. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +70 -69
  37. package/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +6 -3
  38. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -95
  39. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +27 -21
  40. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +60 -56
  41. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +8 -3
  42. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -67
  43. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +37 -16
  44. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +57 -57
  45. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
  46. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +99 -0
  47. package/dist/client/adp/quick-actions/fe-v2/registry.js +72 -71
  48. package/dist/client/adp/quick-actions/fe-v2/registry.ts +3 -1
  49. package/dist/client/adp/quick-actions/fe-v2/utils.js +95 -86
  50. package/dist/client/adp/quick-actions/fe-v2/utils.ts +14 -4
  51. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +49 -47
  52. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +5 -1
  53. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +47 -45
  54. package/dist/client/adp/quick-actions/fe-v4/create-table-action.ts +17 -7
  55. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -45
  56. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.ts +11 -12
  57. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +55 -55
  58. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
  59. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +4 -4
  60. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +52 -52
  61. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
  62. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +85 -0
  63. package/dist/client/adp/quick-actions/fe-v4/registry.js +56 -55
  64. package/dist/client/adp/quick-actions/fe-v4/registry.ts +3 -1
  65. package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +11 -17
  66. package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +17 -18
  67. package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
  68. package/dist/client/adp/quick-actions/load.js +44 -44
  69. package/dist/client/adp/quick-actions/quick-action-base.js +55 -0
  70. package/dist/client/adp/quick-actions/quick-action-base.ts +55 -0
  71. package/dist/client/adp/quick-actions/simple-quick-action-base.js +8 -13
  72. package/dist/client/adp/quick-actions/simple-quick-action-base.ts +10 -18
  73. package/dist/client/adp/quick-actions/table-quick-action-base.js +24 -29
  74. package/dist/client/adp/quick-actions/table-quick-action-base.ts +39 -28
  75. package/dist/client/adp/utils.js +160 -160
  76. package/dist/client/cpe/changes/index.js +10 -10
  77. package/dist/client/cpe/changes/service.js +30 -0
  78. package/dist/client/cpe/changes/service.ts +46 -0
  79. package/dist/client/cpe/changes/validator.js +34 -34
  80. package/dist/client/cpe/documentation.js +164 -164
  81. package/dist/client/cpe/feature-service.js +36 -36
  82. package/dist/client/cpe/logger.js +30 -30
  83. package/dist/client/cpe/outline/editable.js +37 -37
  84. package/dist/client/cpe/outline/nodes.js +217 -217
  85. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  86. package/dist/client/cpe/quick-actions/quick-action-definition.ts +5 -1
  87. package/dist/client/cpe/quick-actions/quick-action-service.js +10 -4
  88. package/dist/client/cpe/quick-actions/quick-action-service.ts +9 -3
  89. package/dist/client/cpe/quick-actions/registry.js +143 -143
  90. package/dist/client/cpe/quick-actions/utils.js +92 -92
  91. package/dist/client/cpe/types.js +4 -4
  92. package/dist/client/cpe/ui5-utils.js +33 -33
  93. package/dist/client/cpe/utils.js +138 -138
  94. package/dist/client/flp/WorkspaceConnector.js +86 -86
  95. package/dist/client/flp/common.js +28 -28
  96. package/dist/client/flp/enableFakeConnector.js +83 -83
  97. package/dist/client/flp/initConnectors.js +30 -30
  98. package/dist/client/flp/initRta.js +178 -178
  99. package/dist/client/i18n.js +56 -56
  100. package/dist/client/messagebundle.properties +5 -3
  101. package/dist/client/utils/application.js +32 -32
  102. package/dist/client/utils/core.js +68 -68
  103. package/dist/client/utils/error.js +19 -19
  104. package/dist/client/utils/fe-v4.js +118 -114
  105. package/dist/client/utils/fe-v4.ts +19 -11
  106. package/dist/client/utils/version.js +102 -102
  107. package/package.json +4 -4
@@ -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(
@@ -4,8 +4,10 @@ sap.ui.define([
4
4
  'sap/ui/dt/OverlayUtil',
5
5
  '../../cpe/quick-actions/utils',
6
6
  '../../utils/core',
7
- '../../utils/version'
8
- ], function (___sap_ux_private_control_property_editor_common, OverlayUtil, ____cpe_quick_actions_utils, ____utils_core, ____utils_version) {
7
+ '../../utils/version',
8
+ './quick-action-base',
9
+ './control-types'
10
+ ], function (___sap_ux_private_control_property_editor_common, OverlayUtil, ____cpe_quick_actions_utils, ____utils_core, ____utils_version, ___quick_action_base, ___control_types) {
9
11
  'use strict';
10
12
  const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
11
13
  const getParentContainer = ____cpe_quick_actions_utils['getParentContainer'];
@@ -15,16 +17,17 @@ sap.ui.define([
15
17
  const isManagedObject = ____utils_core['isManagedObject'];
16
18
  const getUi5Version = ____utils_version['getUi5Version'];
17
19
  const isLowerThanMinimalUi5Version = ____utils_version['isLowerThanMinimalUi5Version'];
20
+ const QuickActionDefinitionBase = ___quick_action_base['QuickActionDefinitionBase'];
21
+ const ANALYTICAL_TABLE_TYPE = ___control_types['ANALYTICAL_TABLE_TYPE'];
22
+ const GRID_TABLE_TYPE = ___control_types['GRID_TABLE_TYPE'];
23
+ const M_TABLE_TYPE = ___control_types['M_TABLE_TYPE'];
24
+ const MDC_TABLE_TYPE = ___control_types['MDC_TABLE_TYPE'];
25
+ const SMART_TABLE_TYPE = ___control_types['SMART_TABLE_TYPE'];
26
+ const TREE_TABLE_TYPE = ___control_types['TREE_TABLE_TYPE'];
18
27
  const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
19
28
  const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
20
29
  const SETTINGS_ID = 'CTX_SETTINGS';
21
30
  const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
22
- const SMART_TABLE_TYPE = 'sap.ui.comp.smarttable.SmartTable';
23
- const M_TABLE_TYPE = 'sap.m.Table';
24
- const MDC_TABLE_TYPE = 'sap.ui.mdc.Table';
25
- const TREE_TABLE_TYPE = 'sap.ui.table.TreeTable';
26
- const GRID_TABLE_TYPE = 'sap.ui.table.Table';
27
- const ANALYTICAL_TABLE_TYPE = 'sap.ui.table.AnalyticalTable';
28
31
  async function getActionId(table) {
29
32
  const {major, minor} = await getUi5Version();
30
33
  if (isA(SMART_TABLE_TYPE, table)) {
@@ -39,15 +42,8 @@ sap.ui.define([
39
42
  SETTINGS_ID
40
43
  ];
41
44
  }
42
- class TableQuickActionDefinitionBase {
43
- kind = NESTED_QUICK_ACTION_KIND;
44
- get id() {
45
- return `${ this.context.key }-${ this.type }`;
46
- }
45
+ class TableQuickActionDefinitionBase extends QuickActionDefinitionBase {
47
46
  isApplicable = false;
48
- get tooltip() {
49
- return undefined;
50
- }
51
47
  children = [];
52
48
  tableMap = {};
53
49
  get textKey() {
@@ -55,11 +51,14 @@ sap.ui.define([
55
51
  }
56
52
  constructor(type, controlTypes, defaultTextKey, context) {
57
53
  let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
54
+ let enablementValidators = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
55
+ super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
58
56
  this.type = type;
59
57
  this.controlTypes = controlTypes;
60
58
  this.defaultTextKey = defaultTextKey;
61
59
  this.context = context;
62
60
  this.options = options;
61
+ this.enablementValidators = enablementValidators;
63
62
  }
64
63
  async initialize() {
65
64
  const version = await getUi5Version();
@@ -160,20 +159,20 @@ sap.ui.define([
160
159
  layout
161
160
  });
162
161
  } else if (subSections.length > 1) {
163
- const sectionChild = this.children.find(val => val.label === `${ section.getTitle() } section`);
164
- let tableMapIndex = `${ this.children.length - 1 }`;
162
+ const existingChildIdx = this.children.findIndex(val => val.label === `'${ section.getTitle() }' section`);
163
+ let tableMapIndex;
165
164
  const label = this.getTableLabel(table);
166
165
  const child = this.createChild(label, table);
167
- if (!sectionChild) {
168
- tableMapIndex = `${ tableMapIndex }/0`;
166
+ if (existingChildIdx < 0) {
169
167
  this.children.push({
170
168
  label: `'${ section?.getTitle() }' section`,
171
169
  enabled: true,
172
170
  children: [child]
173
171
  });
172
+ tableMapIndex = `${ this.children.length - 1 }/0`;
174
173
  } else {
175
- tableMapIndex = `${ tableMapIndex }/${ sectionChild.children.length - 1 }`;
176
- sectionChild.children.push(child);
174
+ this.children[existingChildIdx].children.push(child);
175
+ tableMapIndex = `${ existingChildIdx.toFixed(0) }/${ this.children[existingChildIdx].children.length - 1 }`;
177
176
  }
178
177
  this.tableMap[tableMapIndex] = {
179
178
  table,
@@ -192,7 +191,9 @@ sap.ui.define([
192
191
  SMART_TABLE_TYPE,
193
192
  M_TABLE_TYPE,
194
193
  MDC_TABLE_TYPE,
195
- TREE_TABLE_TYPE
194
+ TREE_TABLE_TYPE,
195
+ GRID_TABLE_TYPE,
196
+ ANALYTICAL_TABLE_TYPE
196
197
  ].some(type => isA(type, table))) {
197
198
  const label = this.getTableLabel(table);
198
199
  const child = this.createChild(label, table);
@@ -239,12 +240,6 @@ sap.ui.define([
239
240
  }
240
241
  }
241
242
  var __exports = { __esModule: true };
242
- __exports.SMART_TABLE_TYPE = SMART_TABLE_TYPE;
243
- __exports.M_TABLE_TYPE = M_TABLE_TYPE;
244
- __exports.MDC_TABLE_TYPE = MDC_TABLE_TYPE;
245
- __exports.TREE_TABLE_TYPE = TREE_TABLE_TYPE;
246
- __exports.GRID_TABLE_TYPE = GRID_TABLE_TYPE;
247
- __exports.ANALYTICAL_TABLE_TYPE = ANALYTICAL_TABLE_TYPE;
248
243
  __exports.TableQuickActionDefinitionBase = TableQuickActionDefinitionBase;
249
244
  return __exports;
250
245
  });
@@ -15,17 +15,21 @@ import ObjectPageSection from 'sap/uxap/ObjectPageSection';
15
15
  import ObjectPageSubSection from 'sap/uxap/ObjectPageSubSection';
16
16
  import ObjectPageLayout from 'sap/uxap/ObjectPageLayout';
17
17
  import ManagedObject from 'sap/ui/base/ManagedObject';
18
+ import { EnablementValidator } from './enablement-validator';
19
+ import { QuickActionDefinitionBase } from './quick-action-base';
20
+ import {
21
+ ANALYTICAL_TABLE_TYPE,
22
+ GRID_TABLE_TYPE,
23
+ M_TABLE_TYPE,
24
+ MDC_TABLE_TYPE,
25
+ SMART_TABLE_TYPE,
26
+ TREE_TABLE_TYPE
27
+ } from './control-types';
18
28
 
19
29
  const SMART_TABLE_ACTION_ID = 'CTX_COMP_VARIANT_CONTENT';
20
30
  const M_TABLE_ACTION_ID = 'CTX_ADD_ELEMENTS_AS_CHILD';
21
31
  const SETTINGS_ID = 'CTX_SETTINGS';
22
32
  const ICON_TAB_BAR_TYPE = 'sap.m.IconTabBar';
23
- export const SMART_TABLE_TYPE = 'sap.ui.comp.smarttable.SmartTable';
24
- export const M_TABLE_TYPE = 'sap.m.Table';
25
- export const MDC_TABLE_TYPE = 'sap.ui.mdc.Table';
26
- export const TREE_TABLE_TYPE = 'sap.ui.table.TreeTable';
27
- export const GRID_TABLE_TYPE = 'sap.ui.table.Table';
28
- export const ANALYTICAL_TABLE_TYPE = 'sap.ui.table.AnalyticalTable';
29
33
 
30
34
  async function getActionId(table: UI5Element): Promise<string[]> {
31
35
  const { major, minor } = await getUi5Version();
@@ -48,20 +52,11 @@ export type TableQuickActionsOptions = {
48
52
  /**
49
53
  * Base class for table quick actions.
50
54
  */
51
- export abstract class TableQuickActionDefinitionBase {
52
- readonly kind = NESTED_QUICK_ACTION_KIND;
53
- public get id(): string {
54
- return `${this.context.key}-${this.type}`;
55
- }
56
-
55
+ export abstract class TableQuickActionDefinitionBase extends QuickActionDefinitionBase<
56
+ typeof NESTED_QUICK_ACTION_KIND
57
+ > {
57
58
  public isApplicable = false;
58
59
 
59
- protected isDisabled: boolean | undefined;
60
-
61
- public get tooltip(): string | undefined {
62
- return undefined;
63
- }
64
-
65
60
  public children: NestedQuickActionChild[] = [];
66
61
  public tableMap: Record<
67
62
  string,
@@ -90,8 +85,11 @@ export abstract class TableQuickActionDefinitionBase {
90
85
  protected readonly controlTypes: string[],
91
86
  protected readonly defaultTextKey: string,
92
87
  protected readonly context: QuickActionContext,
93
- protected options: TableQuickActionsOptions = {}
94
- ) {}
88
+ protected options: TableQuickActionsOptions = {},
89
+ protected readonly enablementValidators: EnablementValidator[] = []
90
+ ) {
91
+ super(type, NESTED_QUICK_ACTION_KIND, defaultTextKey, context, enablementValidators);
92
+ }
95
93
 
96
94
  /**
97
95
  * Initializes action object instance
@@ -229,21 +227,25 @@ export abstract class TableQuickActionDefinitionBase {
229
227
  if (subSections?.length === 1) {
230
228
  this.processTable(table, { section, subSection: subSections[0], layout });
231
229
  } else if (subSections.length > 1) {
232
- const sectionChild = this.children.find((val) => val.label === `${section.getTitle()} section`);
233
- let tableMapIndex = `${this.children.length - 1}`;
230
+ const existingChildIdx = this.children.findIndex(
231
+ (val) => val.label === `'${section.getTitle()}' section`
232
+ );
233
+ let tableMapIndex;
234
234
  const label = this.getTableLabel(table);
235
235
  const child = this.createChild(label, table);
236
- if (!sectionChild) {
237
- tableMapIndex = `${tableMapIndex}/0`;
238
-
236
+ if (existingChildIdx < 0) {
239
237
  this.children.push({
240
238
  label: `'${section?.getTitle()}' section`,
241
239
  enabled: true,
242
240
  children: [child]
243
241
  });
242
+
243
+ tableMapIndex = `${this.children.length - 1}/0`;
244
244
  } else {
245
- tableMapIndex = `${tableMapIndex}/${sectionChild.children.length - 1}`;
246
- sectionChild.children.push(child);
245
+ this.children[existingChildIdx].children.push(child);
246
+ tableMapIndex = `${existingChildIdx.toFixed(0)}/${
247
+ this.children[existingChildIdx].children.length - 1
248
+ }`;
247
249
  }
248
250
 
249
251
  this.tableMap[tableMapIndex] = {
@@ -264,7 +266,16 @@ export abstract class TableQuickActionDefinitionBase {
264
266
  table: UI5Element,
265
267
  sectionInfo?: { section: ObjectPageSection; subSection: ObjectPageSubSection; layout?: ObjectPageLayout }
266
268
  ): void {
267
- if ([SMART_TABLE_TYPE, M_TABLE_TYPE, MDC_TABLE_TYPE, TREE_TABLE_TYPE].some((type) => isA(type, table))) {
269
+ if (
270
+ [
271
+ SMART_TABLE_TYPE,
272
+ M_TABLE_TYPE,
273
+ MDC_TABLE_TYPE,
274
+ TREE_TABLE_TYPE,
275
+ GRID_TABLE_TYPE,
276
+ ANALYTICAL_TABLE_TYPE
277
+ ].some((type) => isA(type, table))
278
+ ) {
268
279
  const label = this.getTableLabel(table);
269
280
  const child = this.createChild(label, table);
270
281
  this.children.push(child);