@sap-ux/preview-middleware 0.16.131 → 0.16.133
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.
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +3 -1
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +11 -48
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +16 -44
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +69 -0
- package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +79 -0
- package/dist/client/adp/quick-actions/fe-v2/registry.js +3 -2
- package/dist/client/adp/quick-actions/fe-v2/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v2/utils.js +77 -0
- package/dist/client/adp/quick-actions/fe-v2/utils.ts +72 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +1 -5
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +0 -4
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +84 -0
- package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
- package/dist/client/adp/quick-actions/fe-v4/registry.js +3 -2
- package/dist/client/adp/quick-actions/fe-v4/registry.ts +3 -1
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.js +9 -3
- package/dist/client/adp/quick-actions/fe-v4/table-quick-action-base.ts +10 -3
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +6 -2
- package/dist/client/adp/quick-actions/simple-quick-action-base.ts +9 -2
- package/dist/client/adp/quick-actions/table-quick-action-base.js +57 -23
- package/dist/client/adp/quick-actions/table-quick-action-base.ts +73 -25
- package/dist/client/cpe/changes/flex-change.js +7 -19
- package/dist/client/cpe/changes/flex-change.ts +5 -29
- package/dist/client/cpe/quick-actions/quick-action-definition.ts +1 -6
- package/dist/client/cpe/quick-actions/quick-action-service.js +1 -1
- package/dist/client/cpe/quick-actions/quick-action-service.ts +1 -1
- package/dist/client/messagebundle.properties +4 -1
- package/dist/client/utils/fe-v4.js +30 -1
- package/dist/client/utils/fe-v4.ts +45 -1
- package/package.json +4 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./table-quick-action-base", "../../../cpe/quick-actions/utils", "../../../utils/fe-v4", "../../../utils/version"], function (___table_quick_action_base, _____cpe_quick_actions_utils, _____utils_fe_v4, _____utils_version) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const TableQuickActionDefinitionBase = ___table_quick_action_base["TableQuickActionDefinitionBase"];
|
|
7
|
+
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
8
|
+
const createManifestPropertyChange = _____utils_fe_v4["createManifestPropertyChange"];
|
|
9
|
+
const getUi5Version = _____utils_version["getUi5Version"];
|
|
10
|
+
const isLowerThanMinimalUi5Version = _____utils_version["isLowerThanMinimalUi5Version"];
|
|
11
|
+
const ENABLE_TABLE_FILTERING = 'enable-table-filtering';
|
|
12
|
+
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
13
|
+
/**
|
|
14
|
+
* Quick Action for enabling table filtering using table personalization settings.
|
|
15
|
+
*/
|
|
16
|
+
class EnableTableFilteringQuickAction extends TableQuickActionDefinitionBase {
|
|
17
|
+
constructor(context) {
|
|
18
|
+
super(ENABLE_TABLE_FILTERING, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context);
|
|
19
|
+
}
|
|
20
|
+
forceRefreshAfterExecution = true;
|
|
21
|
+
async initialize() {
|
|
22
|
+
const version = await getUi5Version();
|
|
23
|
+
if (isLowerThanMinimalUi5Version(version, {
|
|
24
|
+
major: 1,
|
|
25
|
+
minor: 131
|
|
26
|
+
})) {
|
|
27
|
+
this.isApplicable = false;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const tooltipText = this.context.resourceBundle.getText('THE_CHANGE_HAS_ALREADY_BEEN_MADE');
|
|
31
|
+
let index = 0;
|
|
32
|
+
for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [CONTROL_TYPE])) {
|
|
33
|
+
const personalizationData = smartTable.getP13nMode();
|
|
34
|
+
const value = this.context.changeService.getConfigurationPropertyValue(smartTable.getId(), 'personalization');
|
|
35
|
+
const isFilterEnabled = value?.filter === undefined ? personalizationData.includes('Filter') : value.filter;
|
|
36
|
+
this.children.push({
|
|
37
|
+
label: `'${smartTable.getHeader()}' table`,
|
|
38
|
+
enabled: !isFilterEnabled,
|
|
39
|
+
tooltip: isFilterEnabled ? tooltipText : undefined,
|
|
40
|
+
children: []
|
|
41
|
+
});
|
|
42
|
+
this.tableMap[`${this.children.length - 1}`] = index;
|
|
43
|
+
index++;
|
|
44
|
+
}
|
|
45
|
+
if (this.children.length > 0) {
|
|
46
|
+
this.isApplicable = true;
|
|
47
|
+
}
|
|
48
|
+
return Promise.resolve();
|
|
49
|
+
}
|
|
50
|
+
async execute(path) {
|
|
51
|
+
const {
|
|
52
|
+
flexSettings
|
|
53
|
+
} = this.context;
|
|
54
|
+
const index = this.tableMap[path];
|
|
55
|
+
const smartTables = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [CONTROL_TYPE]);
|
|
56
|
+
const modifiedControl = smartTables[index];
|
|
57
|
+
if (!modifiedControl) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
const propertyChange = {
|
|
61
|
+
personalization: {
|
|
62
|
+
sort: true,
|
|
63
|
+
column: true,
|
|
64
|
+
filter: true,
|
|
65
|
+
group: true,
|
|
66
|
+
aggregate: true
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const command = await createManifestPropertyChange(modifiedControl, flexSettings, propertyChange);
|
|
70
|
+
if (command) {
|
|
71
|
+
return [command];
|
|
72
|
+
} else {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
var __exports = {
|
|
78
|
+
__esModule: true
|
|
79
|
+
};
|
|
80
|
+
__exports.ENABLE_TABLE_FILTERING = ENABLE_TABLE_FILTERING;
|
|
81
|
+
__exports.EnableTableFilteringQuickAction = EnableTableFilteringQuickAction;
|
|
82
|
+
return __exports;
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=lr-enable-table-filtering.js.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
2
|
+
|
|
3
|
+
import { NestedQuickActionDefinition, QuickActionContext } from '../../../cpe/quick-actions/quick-action-definition';
|
|
4
|
+
import Table from 'sap/ui/mdc/Table';
|
|
5
|
+
import { TableQuickActionDefinitionBase } from './table-quick-action-base';
|
|
6
|
+
import { getRelevantControlFromActivePage } from '../../../cpe/quick-actions/utils';
|
|
7
|
+
import { createManifestPropertyChange } from '../../../utils/fe-v4';
|
|
8
|
+
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
9
|
+
|
|
10
|
+
export const ENABLE_TABLE_FILTERING = 'enable-table-filtering';
|
|
11
|
+
const CONTROL_TYPE = 'sap.ui.mdc.Table';
|
|
12
|
+
|
|
13
|
+
type Personalization = {
|
|
14
|
+
sort: boolean;
|
|
15
|
+
column: boolean;
|
|
16
|
+
filter: boolean;
|
|
17
|
+
group: boolean;
|
|
18
|
+
aggregate: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Quick Action for enabling table filtering using table personalization settings.
|
|
23
|
+
*/
|
|
24
|
+
export class EnableTableFilteringQuickAction
|
|
25
|
+
extends TableQuickActionDefinitionBase
|
|
26
|
+
implements NestedQuickActionDefinition
|
|
27
|
+
{
|
|
28
|
+
constructor(context: QuickActionContext) {
|
|
29
|
+
super(ENABLE_TABLE_FILTERING, 'QUICK_ACTION_ENABLE_TABLE_FILTERING', context);
|
|
30
|
+
}
|
|
31
|
+
readonly forceRefreshAfterExecution = true;
|
|
32
|
+
|
|
33
|
+
async initialize(): Promise<void> {
|
|
34
|
+
const version = await getUi5Version();
|
|
35
|
+
if (isLowerThanMinimalUi5Version(version, { major: 1, minor: 131 })) {
|
|
36
|
+
this.isApplicable = false;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const tooltipText = this.context.resourceBundle.getText('THE_CHANGE_HAS_ALREADY_BEEN_MADE');
|
|
41
|
+
let index = 0;
|
|
42
|
+
for (const smartTable of getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
|
|
43
|
+
CONTROL_TYPE
|
|
44
|
+
])) {
|
|
45
|
+
const personalizationData = (smartTable as Table).getP13nMode();
|
|
46
|
+
const value = this.context.changeService.getConfigurationPropertyValue(
|
|
47
|
+
smartTable.getId(),
|
|
48
|
+
'personalization'
|
|
49
|
+
) as Personalization;
|
|
50
|
+
const isFilterEnabled = value?.filter === undefined ? personalizationData.includes('Filter') : value.filter;
|
|
51
|
+
this.children.push({
|
|
52
|
+
label: `'${(smartTable as Table).getHeader()}' table`,
|
|
53
|
+
enabled: !isFilterEnabled,
|
|
54
|
+
tooltip: isFilterEnabled ? tooltipText : undefined,
|
|
55
|
+
children: []
|
|
56
|
+
});
|
|
57
|
+
this.tableMap[`${this.children.length - 1}`] = index;
|
|
58
|
+
index++;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.children.length > 0) {
|
|
62
|
+
this.isApplicable = true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return Promise.resolve();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async execute(path: string): Promise<FlexCommand[]> {
|
|
69
|
+
const { flexSettings } = this.context;
|
|
70
|
+
const index = this.tableMap[path];
|
|
71
|
+
|
|
72
|
+
const smartTables = getRelevantControlFromActivePage(this.context.controlIndex, this.context.view, [
|
|
73
|
+
CONTROL_TYPE
|
|
74
|
+
]);
|
|
75
|
+
|
|
76
|
+
const modifiedControl = smartTables[index];
|
|
77
|
+
if (!modifiedControl) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const propertyChange = {
|
|
81
|
+
personalization: {
|
|
82
|
+
sort: true,
|
|
83
|
+
column: true,
|
|
84
|
+
filter: true,
|
|
85
|
+
group: true,
|
|
86
|
+
aggregate: true
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const command = await createManifestPropertyChange(modifiedControl, flexSettings, propertyChange);
|
|
90
|
+
if (command) {
|
|
91
|
+
return [command];
|
|
92
|
+
} else {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "./create-table-custom-column", "../common/create-page-action", "./create-table-action", "./lr-enable-semantic-date-range-filter-bar"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___create_table_custom_column, ___common_create_page_action, ___create_table_action, ___lr_enable_semantic_date_range_filter_bar) {
|
|
3
|
+
sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-to-page", "./lr-toggle-clear-filter-bar", "./change-table-columns", "../common/op-add-header-field", "../common/op-add-custom-section", "./create-table-custom-column", "../common/create-page-action", "./create-table-action", "./lr-enable-table-filtering", "./lr-enable-semantic-date-range-filter-bar"], function (_____cpe_quick_actions_registry, ___common_add_controller_to_page, ___lr_toggle_clear_filter_bar, ___change_table_columns, ___common_op_add_header_field, ___common_op_add_custom_section, ___create_table_custom_column, ___common_create_page_action, ___create_table_action, ___lr_enable_table_filtering, ___lr_enable_semantic_date_range_filter_bar) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const QuickActionDefinitionRegistry = _____cpe_quick_actions_registry["QuickActionDefinitionRegistry"];
|
|
@@ -12,6 +12,7 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
|
|
|
12
12
|
const AddTableCustomColumnQuickAction = ___create_table_custom_column["AddTableCustomColumnQuickAction"];
|
|
13
13
|
const AddPageActionQuickAction = ___common_create_page_action["AddPageActionQuickAction"];
|
|
14
14
|
const AddTableActionQuickAction = ___create_table_action["AddTableActionQuickAction"];
|
|
15
|
+
const EnableTableFilteringQuickAction = ___lr_enable_table_filtering["EnableTableFilteringQuickAction"];
|
|
15
16
|
const ToggleSemanticDateRangeFilterBar = ___lr_enable_semantic_date_range_filter_bar["ToggleSemanticDateRangeFilterBar"];
|
|
16
17
|
const LIST_REPORT_TYPE = 'sap.fe.templates.ListReport.ListReport';
|
|
17
18
|
const OBJECT_PAGE_TYPE = 'sap.fe.templates.ObjectPage.ObjectPage';
|
|
@@ -35,7 +36,7 @@ sap.ui.define(["../../../cpe/quick-actions/registry", "../common/add-controller-
|
|
|
35
36
|
if (name === 'listReport') {
|
|
36
37
|
definitionGroups.push({
|
|
37
38
|
title: 'LIST REPORT',
|
|
38
|
-
definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction],
|
|
39
|
+
definitions: [AddControllerToPageQuickAction, AddPageActionQuickAction, ToggleClearFilterBarQuickAction, ToggleSemanticDateRangeFilterBar, ChangeTableColumnsQuickAction, AddTableActionQuickAction, AddTableCustomColumnQuickAction, EnableTableFilteringQuickAction],
|
|
39
40
|
view,
|
|
40
41
|
key: name + index
|
|
41
42
|
});
|
|
@@ -12,6 +12,7 @@ import { AddCustomSectionQuickAction } from '../common/op-add-custom-section';
|
|
|
12
12
|
import { AddTableCustomColumnQuickAction } from './create-table-custom-column';
|
|
13
13
|
import { AddPageActionQuickAction } from '../common/create-page-action';
|
|
14
14
|
import { AddTableActionQuickAction } from './create-table-action';
|
|
15
|
+
import { EnableTableFilteringQuickAction } from './lr-enable-table-filtering';
|
|
15
16
|
import { ToggleSemanticDateRangeFilterBar } from './lr-enable-semantic-date-range-filter-bar';
|
|
16
17
|
|
|
17
18
|
type PageName = 'listReport' | 'objectPage';
|
|
@@ -43,7 +44,8 @@ export default class FEV4QuickActionRegistry extends QuickActionDefinitionRegist
|
|
|
43
44
|
ToggleSemanticDateRangeFilterBar,
|
|
44
45
|
ChangeTableColumnsQuickAction,
|
|
45
46
|
AddTableActionQuickAction,
|
|
46
|
-
AddTableCustomColumnQuickAction
|
|
47
|
+
AddTableCustomColumnQuickAction,
|
|
48
|
+
EnableTableFilteringQuickAction
|
|
47
49
|
],
|
|
48
50
|
view,
|
|
49
51
|
key: name + index
|
|
@@ -17,7 +17,11 @@ sap.ui.define([
|
|
|
17
17
|
get textKey() {
|
|
18
18
|
return this.defaultTextKey;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
isApplicable = false;
|
|
21
|
+
isDisabled = false;
|
|
22
|
+
get tooltip() {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
21
25
|
isClearButtonEnabled = false;
|
|
22
26
|
children = [];
|
|
23
27
|
tableMap = {};
|
|
@@ -41,6 +45,7 @@ sap.ui.define([
|
|
|
41
45
|
if (changeColumnAction) {
|
|
42
46
|
this.children.push({
|
|
43
47
|
label: `'${ smartTable.getHeader() }' table`,
|
|
48
|
+
enabled: true,
|
|
44
49
|
children: []
|
|
45
50
|
});
|
|
46
51
|
this.tableMap[`${ this.children.length - 1 }`] = index;
|
|
@@ -48,14 +53,15 @@ sap.ui.define([
|
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
if (this.children.length > 0) {
|
|
51
|
-
this.
|
|
56
|
+
this.isApplicable = true;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
59
|
getActionObject() {
|
|
55
60
|
return {
|
|
56
61
|
kind: NESTED_QUICK_ACTION_KIND,
|
|
57
62
|
id: this.id,
|
|
58
|
-
enabled: this.
|
|
63
|
+
enabled: !this.isDisabled,
|
|
64
|
+
tooltip: this.tooltip,
|
|
59
65
|
title: this.context.resourceBundle.getText(this.textKey),
|
|
60
66
|
children: this.children
|
|
61
67
|
};
|
|
@@ -17,7 +17,12 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
17
17
|
protected get textKey(): string {
|
|
18
18
|
return this.defaultTextKey;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
isApplicable = false;
|
|
21
|
+
protected isDisabled = false;
|
|
22
|
+
public get tooltip(): string | undefined {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
isClearButtonEnabled = false;
|
|
22
27
|
children: NestedQuickActionChild[] = [];
|
|
23
28
|
tableMap: Record<string, number> = {};
|
|
@@ -45,6 +50,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
45
50
|
if (changeColumnAction) {
|
|
46
51
|
this.children.push({
|
|
47
52
|
label: `'${(smartTable as Table).getHeader()}' table`,
|
|
53
|
+
enabled: true,
|
|
48
54
|
children: []
|
|
49
55
|
});
|
|
50
56
|
this.tableMap[`${this.children.length - 1}`] = index;
|
|
@@ -53,7 +59,7 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
if (this.children.length > 0) {
|
|
56
|
-
this.
|
|
62
|
+
this.isApplicable = true;
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
65
|
|
|
@@ -61,7 +67,8 @@ export abstract class TableQuickActionDefinitionBase {
|
|
|
61
67
|
return {
|
|
62
68
|
kind: NESTED_QUICK_ACTION_KIND,
|
|
63
69
|
id: this.id,
|
|
64
|
-
enabled: this.
|
|
70
|
+
enabled: !this.isDisabled,
|
|
71
|
+
tooltip: this.tooltip,
|
|
65
72
|
title: this.context.resourceBundle.getText(this.textKey),
|
|
66
73
|
children: this.children
|
|
67
74
|
};
|
|
@@ -11,9 +11,12 @@ sap.ui.define([
|
|
|
11
11
|
get id() {
|
|
12
12
|
return `${ this.context.key }-${ this.type }`;
|
|
13
13
|
}
|
|
14
|
-
get
|
|
14
|
+
get isApplicable() {
|
|
15
15
|
return this.control !== undefined;
|
|
16
16
|
}
|
|
17
|
+
get tooltip() {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
17
20
|
get textKey() {
|
|
18
21
|
return this.defaultTextKey;
|
|
19
22
|
}
|
|
@@ -33,7 +36,8 @@ sap.ui.define([
|
|
|
33
36
|
return {
|
|
34
37
|
kind: SIMPLE_QUICK_ACTION_KIND,
|
|
35
38
|
id: this.id,
|
|
36
|
-
enabled: this.
|
|
39
|
+
enabled: !this.isDisabled,
|
|
40
|
+
tooltip: this.tooltip,
|
|
37
41
|
title: this.context.resourceBundle.getText(this.textKey)
|
|
38
42
|
};
|
|
39
43
|
}
|
|
@@ -14,10 +14,16 @@ export abstract class SimpleQuickActionDefinitionBase {
|
|
|
14
14
|
return `${this.context.key}-${this.type}`;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public get
|
|
17
|
+
public get isApplicable(): boolean {
|
|
18
18
|
return this.control !== undefined;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
protected isDisabled: boolean | undefined;
|
|
22
|
+
|
|
23
|
+
public get tooltip(): string | undefined {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
protected get textKey(): string {
|
|
22
28
|
return this.defaultTextKey;
|
|
23
29
|
}
|
|
@@ -46,7 +52,8 @@ export abstract class SimpleQuickActionDefinitionBase {
|
|
|
46
52
|
return {
|
|
47
53
|
kind: SIMPLE_QUICK_ACTION_KIND,
|
|
48
54
|
id: this.id,
|
|
49
|
-
enabled: this.
|
|
55
|
+
enabled: !this.isDisabled,
|
|
56
|
+
tooltip: this.tooltip,
|
|
50
57
|
title: this.context.resourceBundle.getText(this.textKey)
|
|
51
58
|
};
|
|
52
59
|
}
|
|
@@ -44,18 +44,22 @@ sap.ui.define([
|
|
|
44
44
|
get id() {
|
|
45
45
|
return `${ this.context.key }-${ this.type }`;
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
isApplicable = false;
|
|
48
|
+
get tooltip() {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
48
51
|
children = [];
|
|
49
52
|
tableMap = {};
|
|
50
53
|
get textKey() {
|
|
51
54
|
return this.defaultTextKey;
|
|
52
55
|
}
|
|
53
|
-
constructor(type, controlTypes, defaultTextKey, context
|
|
56
|
+
constructor(type, controlTypes, defaultTextKey, context) {
|
|
57
|
+
let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
54
58
|
this.type = type;
|
|
55
59
|
this.controlTypes = controlTypes;
|
|
56
60
|
this.defaultTextKey = defaultTextKey;
|
|
57
61
|
this.context = context;
|
|
58
|
-
this.
|
|
62
|
+
this.options = options;
|
|
59
63
|
}
|
|
60
64
|
async initialize() {
|
|
61
65
|
const version = await getUi5Version();
|
|
@@ -63,7 +67,7 @@ sap.ui.define([
|
|
|
63
67
|
major: 1,
|
|
64
68
|
minor: 96
|
|
65
69
|
})) {
|
|
66
|
-
this.
|
|
70
|
+
this.isApplicable = false;
|
|
67
71
|
return;
|
|
68
72
|
}
|
|
69
73
|
const iconTabBarfilterMap = this.buildIconTabBarFilterMap();
|
|
@@ -73,10 +77,9 @@ sap.ui.define([
|
|
|
73
77
|
if (section) {
|
|
74
78
|
this.collectChildrenInSection(section, table);
|
|
75
79
|
} else if (this.iconTabBar && tabKey) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
+
const label = `'${ iconTabBarfilterMap[tabKey] }' table`;
|
|
81
|
+
const child = this.createChild(label, table);
|
|
82
|
+
this.children.push(child);
|
|
80
83
|
this.tableMap[`${ this.children.length - 1 }`] = {
|
|
81
84
|
table,
|
|
82
85
|
iconTabBarFilterKey: tabKey,
|
|
@@ -85,7 +88,7 @@ sap.ui.define([
|
|
|
85
88
|
} else {
|
|
86
89
|
this.processTable(table);
|
|
87
90
|
}
|
|
88
|
-
if (this.includeServiceAction) {
|
|
91
|
+
if (this.options.includeServiceAction) {
|
|
89
92
|
const actions = await this.context.actionService.get(table.getId());
|
|
90
93
|
const actionsIds = await getActionId(table);
|
|
91
94
|
const changeColumnAction = actionsIds.find(actionId => actions.findIndex(action => action.id === actionId) > -1);
|
|
@@ -95,7 +98,24 @@ sap.ui.define([
|
|
|
95
98
|
}
|
|
96
99
|
}
|
|
97
100
|
if (this.children.length > 0) {
|
|
98
|
-
this.
|
|
101
|
+
this.isApplicable = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
getInternalTable(table) {
|
|
105
|
+
try {
|
|
106
|
+
let tableInternal;
|
|
107
|
+
if (isA(SMART_TABLE_TYPE, table)) {
|
|
108
|
+
const itemsAggregation = table.getAggregation('items');
|
|
109
|
+
tableInternal = itemsAggregation.find(item => [
|
|
110
|
+
M_TABLE_TYPE,
|
|
111
|
+
TREE_TABLE_TYPE,
|
|
112
|
+
ANALYTICAL_TABLE_TYPE,
|
|
113
|
+
GRID_TABLE_TYPE
|
|
114
|
+
].some(tType => isA(tType, item)));
|
|
115
|
+
}
|
|
116
|
+
return tableInternal;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
return undefined;
|
|
99
119
|
}
|
|
100
120
|
}
|
|
101
121
|
getTableLabel(table) {
|
|
@@ -142,21 +162,18 @@ sap.ui.define([
|
|
|
142
162
|
} else if (subSections.length > 1) {
|
|
143
163
|
const sectionChild = this.children.find(val => val.label === `${ section.getTitle() } section`);
|
|
144
164
|
let tableMapIndex = `${ this.children.length - 1 }`;
|
|
165
|
+
const label = this.getTableLabel(table);
|
|
166
|
+
const child = this.createChild(label, table);
|
|
145
167
|
if (!sectionChild) {
|
|
146
168
|
tableMapIndex = `${ tableMapIndex }/0`;
|
|
147
169
|
this.children.push({
|
|
148
170
|
label: `'${ section?.getTitle() }' section`,
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
children: []
|
|
152
|
-
}]
|
|
171
|
+
enabled: true,
|
|
172
|
+
children: [child]
|
|
153
173
|
});
|
|
154
174
|
} else {
|
|
155
175
|
tableMapIndex = `${ tableMapIndex }/${ sectionChild.children.length - 1 }`;
|
|
156
|
-
sectionChild.children.push(
|
|
157
|
-
label: this.getTableLabel(table),
|
|
158
|
-
children: []
|
|
159
|
-
});
|
|
176
|
+
sectionChild.children.push(child);
|
|
160
177
|
}
|
|
161
178
|
this.tableMap[tableMapIndex] = {
|
|
162
179
|
table,
|
|
@@ -177,10 +194,9 @@ sap.ui.define([
|
|
|
177
194
|
MDC_TABLE_TYPE,
|
|
178
195
|
TREE_TABLE_TYPE
|
|
179
196
|
].some(type => isA(type, table))) {
|
|
180
|
-
this.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
197
|
+
const label = this.getTableLabel(table);
|
|
198
|
+
const child = this.createChild(label, table);
|
|
199
|
+
this.children.push(child);
|
|
184
200
|
}
|
|
185
201
|
this.tableMap[`${ this.children.length - 1 }`] = {
|
|
186
202
|
table,
|
|
@@ -198,11 +214,29 @@ sap.ui.define([
|
|
|
198
214
|
return {
|
|
199
215
|
kind: NESTED_QUICK_ACTION_KIND,
|
|
200
216
|
id: this.id,
|
|
201
|
-
enabled: this.
|
|
217
|
+
enabled: !this.isDisabled,
|
|
218
|
+
tooltip: this.tooltip,
|
|
202
219
|
title: this.context.resourceBundle.getText(this.textKey),
|
|
203
220
|
children: this.children
|
|
204
221
|
};
|
|
205
222
|
}
|
|
223
|
+
createChild(label, table) {
|
|
224
|
+
const child = {
|
|
225
|
+
label,
|
|
226
|
+
enabled: true,
|
|
227
|
+
children: []
|
|
228
|
+
};
|
|
229
|
+
if (!this.options.areTableRowsRequired) {
|
|
230
|
+
return child;
|
|
231
|
+
}
|
|
232
|
+
const innerTable = this.getInternalTable(table);
|
|
233
|
+
const tableRows = innerTable?.getAggregation('items') || [];
|
|
234
|
+
if (isA(M_TABLE_TYPE, innerTable) && !tableRows.length) {
|
|
235
|
+
child.enabled = false;
|
|
236
|
+
child.tooltip = this.context.resourceBundle.getText('TABLE_CUSTOM_COLUMN_ACTION_NOT_AVAILABLE');
|
|
237
|
+
}
|
|
238
|
+
return child;
|
|
239
|
+
}
|
|
206
240
|
}
|
|
207
241
|
var __exports = { __esModule: true };
|
|
208
242
|
__exports.SMART_TABLE_TYPE = SMART_TABLE_TYPE;
|