@openui5/sap.ui.mdc 1.93.3 → 1.96.2
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/.reuse/dep5 +6 -11
- package/THIRDPARTY.txt +10 -16
- package/package.json +4 -4
- package/src/sap/ui/mdc/.library +1 -1
- package/src/sap/ui/mdc/ActionToolbar.js +236 -334
- package/src/sap/ui/mdc/AggregationBaseDelegate.js +2 -1
- package/src/sap/ui/mdc/Chart.js +150 -22
- package/src/sap/ui/mdc/ChartDelegateNew.js +15 -0
- package/src/sap/ui/mdc/ChartNew.js +107 -66
- package/src/sap/ui/mdc/Control.js +4 -3
- package/src/sap/ui/mdc/Element.js +5 -4
- package/src/sap/ui/mdc/Field.js +2 -2
- package/src/sap/ui/mdc/FilterBar.js +1 -10
- package/src/sap/ui/mdc/FilterField.js +28 -4
- package/src/sap/ui/mdc/Link.js +2 -2
- package/src/sap/ui/mdc/MultiValueField.js +1 -1
- package/src/sap/ui/mdc/Table.js +172 -79
- package/src/sap/ui/mdc/TableDelegate.js +20 -3
- package/src/sap/ui/mdc/ValueHelp.js +1474 -0
- package/src/sap/ui/mdc/ValueHelpDelegate.js +147 -0
- package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +49 -104
- package/src/sap/ui/mdc/chart/DimensionItem.js +3 -3
- package/src/sap/ui/mdc/chart/Item.js +2 -3
- package/src/sap/ui/mdc/chart/MeasureItem.js +2 -2
- package/src/sap/ui/mdc/chart/SelectionDetailsActions.js +21 -2
- package/src/sap/ui/mdc/chart/ToolbarHandler.js +237 -225
- package/src/sap/ui/mdc/chartNew/ChartSelectionDetailsNew.js +1 -1
- package/src/sap/ui/mdc/chartNew/ChartToolbarNew.js +14 -10
- package/src/sap/ui/mdc/chartNew/ChartTypeButtonNew.js +1 -1
- package/src/sap/ui/mdc/chartNew/DrillStackHandlerNew.js +12 -10
- package/src/sap/ui/mdc/chartNew/ItemNew.js +0 -1
- package/src/sap/ui/mdc/chartNew/PropertyHelperNew.js +1 -1
- package/src/sap/ui/mdc/condition/Condition.js +2 -2
- package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
- package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
- package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
- package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +13 -7
- package/src/sap/ui/mdc/condition/Operator.js +4 -4
- package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
- package/src/sap/ui/mdc/designtime/actiontoolbar/ActionToolbar.designtime.js +43 -0
- package/src/sap/ui/mdc/designtime/chart/ChartNew.designtime.js +91 -0
- package/src/sap/ui/mdc/designtime/filterbar/FilterBar.designtime.js +20 -0
- package/src/sap/ui/mdc/designtime/filterbar/FilterBarBase.designtime.js +31 -0
- package/src/sap/ui/mdc/designtime/table/Table.designtime.js +5 -0
- package/src/sap/ui/mdc/enum/ContentMode.js +25 -4
- package/src/sap/ui/mdc/enum/SelectType.js +43 -0
- package/src/sap/ui/mdc/field/BoolFieldHelp.js +1 -1
- package/src/sap/ui/mdc/field/ConditionFieldHelp.js +1 -1
- package/src/sap/ui/mdc/field/ConditionType.js +19 -4
- package/src/sap/ui/mdc/field/ConditionsType.js +5 -4
- package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -1
- package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
- package/src/sap/ui/mdc/field/DefineConditionPanel.js +38 -14
- package/src/sap/ui/mdc/field/FieldBase.js +92 -41
- package/src/sap/ui/mdc/field/FieldBaseDelegate.js +9 -2
- package/src/sap/ui/mdc/field/FieldHelpBase.js +64 -4
- package/src/sap/ui/mdc/field/FieldInfoBase.js +9 -1
- package/src/sap/ui/mdc/field/FieldInput.js +1 -1
- package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
- package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
- package/src/sap/ui/mdc/field/FieldValueHelp.js +7 -1
- package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -1
- package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +1 -1
- package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +1 -1
- package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +2 -2
- package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +1 -1
- package/src/sap/ui/mdc/field/InParameter.js +1 -1
- package/src/sap/ui/mdc/field/ListFieldHelp.js +3 -3
- package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
- package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
- package/src/sap/ui/mdc/field/OutParameter.js +1 -1
- package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -1
- package/src/sap/ui/mdc/field/content/BooleanContent.js +15 -3
- package/src/sap/ui/mdc/field/content/ContentFactory.js +16 -8
- package/src/sap/ui/mdc/field/content/DefaultContent.js +64 -23
- package/src/sap/ui/mdc/field/content/LinkContent.js +6 -0
- package/src/sap/ui/mdc/field/content/SearchContent.js +21 -3
- package/src/sap/ui/mdc/field/content/UnitContent.js +2 -2
- package/src/sap/ui/mdc/filterbar/FilterBarBase.js +105 -44
- package/src/sap/ui/mdc/filterbar/PropertyHelper.js +52 -0
- package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +10 -51
- package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +1 -1
- package/src/sap/ui/mdc/flexibility/ActionToolbar.flexibility.js +22 -0
- package/src/sap/ui/mdc/flexibility/ActionToolbarAction.flexibility.js +19 -0
- package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
- package/src/sap/ui/mdc/flexibility/ConditionFlex.js +57 -46
- package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
- package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
- package/src/sap/ui/mdc/flexibility/ItemBaseFlex.js +203 -197
- package/src/sap/ui/mdc/library.js +588 -8
- package/src/sap/ui/mdc/link/ContactDetails.js +1 -1
- package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
- package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
- package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
- package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
- package/src/sap/ui/mdc/link/Factory.js +1 -1
- package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
- package/src/sap/ui/mdc/link/LinkItem.js +1 -1
- package/src/sap/ui/mdc/link/Panel.js +1 -1
- package/src/sap/ui/mdc/link/PanelItem.js +1 -1
- package/src/sap/ui/mdc/link/PanelListItem.js +1 -1
- package/src/sap/ui/mdc/link/SelectionDialog.js +2 -2
- package/src/sap/ui/mdc/link/SelectionDialogItem.js +1 -1
- package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
- package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
- package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
- package/src/sap/ui/mdc/messagebundle.properties +31 -5
- package/src/sap/ui/mdc/messagebundle_ar.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_bg.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_ca.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_cs.properties +31 -16
- package/src/sap/ui/mdc/messagebundle_cy.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_da.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_de.properties +20 -5
- package/src/sap/ui/mdc/messagebundle_el.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_en.properties +17 -2
- package/src/sap/ui/mdc/messagebundle_en_GB.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +11 -3
- package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +19 -3
- package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +11 -2
- package/src/sap/ui/mdc/messagebundle_es.properties +43 -28
- package/src/sap/ui/mdc/messagebundle_es_MX.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_et.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_fi.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_fr.properties +32 -17
- package/src/sap/ui/mdc/messagebundle_fr_CA.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_hi.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_hr.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_hu.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_id.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_it.properties +41 -26
- package/src/sap/ui/mdc/messagebundle_iw.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_ja.properties +28 -13
- package/src/sap/ui/mdc/messagebundle_kk.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_ko.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_lt.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_lv.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_ms.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_nl.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_no.properties +25 -10
- package/src/sap/ui/mdc/messagebundle_pl.properties +22 -7
- package/src/sap/ui/mdc/messagebundle_pt.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_pt_PT.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_ro.properties +21 -6
- package/src/sap/ui/mdc/messagebundle_ru.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_sh.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_sk.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_sl.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_sv.properties +19 -4
- package/src/sap/ui/mdc/messagebundle_th.properties +24 -9
- package/src/sap/ui/mdc/messagebundle_tr.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_uk.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_vi.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_zh_CN.properties +18 -3
- package/src/sap/ui/mdc/messagebundle_zh_TW.properties +18 -3
- package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
- package/src/sap/ui/mdc/mixin/DelegateMixin.js +2 -2
- package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +3 -3
- package/src/sap/ui/mdc/mixin/PromiseMixin.js +94 -0
- package/src/sap/ui/mdc/odata/v4/ChartPropertyHelperNew.js +1 -1
- package/src/sap/ui/mdc/odata/v4/FilterBarDelegate.js +6 -6
- package/src/sap/ui/mdc/odata/v4/TableDelegate.js +37 -10
- package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +94 -0
- package/src/sap/ui/mdc/odata/v4/vizChart/ChartDelegateNew.js +492 -203
- package/src/sap/ui/mdc/p13n/DefaultProviderRegistry.js +1 -1
- package/src/sap/ui/mdc/p13n/Engine.js +3 -2
- package/src/sap/ui/mdc/p13n/P13nBuilder.js +6 -60
- package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
- package/src/sap/ui/mdc/p13n/UIManager.js +1 -1
- package/src/sap/ui/mdc/p13n/modification/ModificationHandler.js +22 -24
- package/src/sap/ui/mdc/p13n/panels/ActionToolbarPanel.js +59 -0
- package/src/sap/ui/mdc/p13n/panels/AdaptFiltersPanel.js +1 -2
- package/src/sap/ui/mdc/p13n/panels/BasePanel.js +17 -8
- package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +1 -2
- package/src/sap/ui/mdc/p13n/panels/ChartItemPanelNew.js +1171 -0
- package/src/sap/ui/mdc/p13n/panels/GroupPanel.js +1 -1
- package/src/sap/ui/mdc/p13n/panels/GroupView.js +7 -11
- package/src/sap/ui/mdc/p13n/panels/ListView.js +5 -3
- package/src/sap/ui/mdc/p13n/panels/QueryPanel.js +16 -9
- package/src/sap/ui/mdc/p13n/panels/SelectionPanel.js +0 -1
- package/src/sap/ui/mdc/p13n/panels/SortPanel.js +0 -1
- package/src/sap/ui/mdc/p13n/panels/SortQueryPanel.js +1 -1
- package/src/sap/ui/mdc/p13n/panels/Wrapper.js +1 -1
- package/src/sap/ui/mdc/p13n/subcontroller/ActionToolbarController.js +89 -0
- package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +9 -6
- package/src/sap/ui/mdc/p13n/subcontroller/ChartItemController.js +33 -4
- package/src/sap/ui/mdc/p13n/subcontroller/ColumnController.js +9 -15
- package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +12 -0
- package/src/sap/ui/mdc/p13n/subcontroller/GroupController.js +5 -12
- package/src/sap/ui/mdc/p13n/subcontroller/SortController.js +19 -21
- package/src/sap/ui/mdc/table/Column.js +35 -9
- package/src/sap/ui/mdc/table/CreationRow.js +1 -1
- package/src/sap/ui/mdc/table/GridTableType.js +0 -1
- package/src/sap/ui/mdc/table/PropertyHelper.js +108 -5
- package/src/sap/ui/mdc/table/ResponsiveTableType.js +19 -3
- package/src/sap/ui/mdc/table/RowSettings.js +1 -1
- package/src/sap/ui/mdc/table/TableTypeBase.js +0 -1
- package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
- package/src/sap/ui/mdc/themes/base/FilterBar.less +2 -2
- package/src/sap/ui/mdc/themes/base/GroupView.less +2 -2
- package/src/sap/ui/mdc/themes/base/ListView.less +2 -2
- package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +56 -21
- package/src/sap/ui/mdc/ui/Container.js +2 -2
- package/src/sap/ui/mdc/ui/ContainerItem.js +2 -2
- package/src/sap/ui/mdc/util/Common.js +26 -0
- package/src/sap/ui/mdc/util/FilterUtil.js +12 -1
- package/src/sap/ui/mdc/util/IdentifierUtil.js +4 -0
- package/src/sap/ui/mdc/util/PromiseCache.js +266 -0
- package/src/sap/ui/mdc/util/PropertyHelper.js +22 -1
- package/src/sap/ui/mdc/valuehelp/Dialog.js +498 -0
- package/src/sap/ui/mdc/valuehelp/Popover.js +362 -0
- package/src/sap/ui/mdc/valuehelp/base/Container.js +642 -0
- package/src/sap/ui/mdc/valuehelp/base/Content.js +628 -0
- package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +139 -0
- package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +557 -0
- package/src/sap/ui/mdc/valuehelp/base/ListContent.js +133 -0
- package/src/sap/ui/mdc/valuehelp/content/Bool.js +318 -0
- package/src/sap/ui/mdc/valuehelp/content/Conditions.js +276 -0
- package/src/sap/ui/mdc/valuehelp/content/FixedList.js +532 -0
- package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +638 -0
- package/src/sap/ui/mdc/valuehelp/content/MTable.js +916 -0
- package/test/sap/ui/mdc/testutils/opa/TestLibrary.js +3 -2
- package/test/sap/ui/mdc/testutils/opa/actions/OpenContextMenu.js +48 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/ActionsBase.js +310 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/ActionsViz.js +39 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/AssertionsBase.js +118 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/AssertionsViz.js +137 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/ChartNew.js +24 -0
- package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +289 -0
- package/test/sap/ui/mdc/testutils/opa/filterbar/Actions.js +250 -0
- package/test/sap/ui/mdc/testutils/opa/filterbar/Assertions.js +91 -0
- package/test/sap/ui/mdc/testutils/opa/filterbar/TestObjects.js +137 -0
- package/test/sap/ui/mdc/testutils/opa/filterbar/Util.js +25 -0
- package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +401 -93
- package/test/sap/ui/mdc/testutils/opa/p13n/Util.js +4 -1
- package/test/sap/ui/mdc/testutils/opa/p13n/{waitForP13nButtonWithParentAndIcon.js → waitForP13nButtonWithMatchers.js} +5 -18
- package/test/sap/ui/mdc/testutils/opa/table/TestObjects.js +0 -1
|
@@ -0,0 +1,916 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ! OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
'sap/ui/mdc/valuehelp/base/FilterableListContent',
|
|
9
|
+
'sap/ui/mdc/condition/FilterConverter',
|
|
10
|
+
'sap/ui/mdc/util/loadModules',
|
|
11
|
+
'sap/m/library',
|
|
12
|
+
'sap/ui/model/FilterType',
|
|
13
|
+
'sap/ui/model/Filter',
|
|
14
|
+
'sap/ui/model/FilterOperator',
|
|
15
|
+
'sap/ui/model/FilterProcessor',
|
|
16
|
+
'sap/ui/mdc/util/Common',
|
|
17
|
+
'sap/base/strings/formatMessage',
|
|
18
|
+
'sap/base/util/merge',
|
|
19
|
+
'sap/ui/mdc/enum/SelectType',
|
|
20
|
+
'sap/base/Log'
|
|
21
|
+
], function(
|
|
22
|
+
FilterableListContent,
|
|
23
|
+
FilterConverter,
|
|
24
|
+
loadModules,
|
|
25
|
+
library,
|
|
26
|
+
FilterType,
|
|
27
|
+
Filter,
|
|
28
|
+
FilterOperator,
|
|
29
|
+
FilterProcessor,
|
|
30
|
+
Common,
|
|
31
|
+
formatMessage,
|
|
32
|
+
merge,
|
|
33
|
+
SelectType,
|
|
34
|
+
Log
|
|
35
|
+
) {
|
|
36
|
+
"use strict";
|
|
37
|
+
|
|
38
|
+
var ListMode = library.ListMode;
|
|
39
|
+
var Sticky = library.Sticky;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Constructor for a new <code>MTable</code> content.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} [sId] ID for the new control, generated automatically if no ID is given
|
|
45
|
+
* @param {object} [mSettings] Initial settings for the new control
|
|
46
|
+
* @class Content for the <code>sap.ui.mdc.valuehelp.base.Container</code> element using a sap.m.Table.
|
|
47
|
+
* @extends sap.ui.mdc.valuehelp.base.FilterableListContent
|
|
48
|
+
* @version 1.96.2
|
|
49
|
+
* @constructor
|
|
50
|
+
* @abstract
|
|
51
|
+
* @private
|
|
52
|
+
* @ui5-restricted sap.ui.mdc
|
|
53
|
+
* @since 1.95.0
|
|
54
|
+
* @alias sap.ui.mdc.valuehelp.content.MTable
|
|
55
|
+
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
|
|
56
|
+
*/
|
|
57
|
+
var MTable = FilterableListContent.extend("sap.ui.mdc.valuehelp.content.MTable", /** @lends sap.ui.mdc.valuehelp.content.MTable.prototype */
|
|
58
|
+
{
|
|
59
|
+
metadata: {
|
|
60
|
+
library: "sap.ui.mdc",
|
|
61
|
+
interfaces: [
|
|
62
|
+
"sap.ui.mdc.valuehelp.ITypeaheadContent",
|
|
63
|
+
"sap.ui.mdc.valuehelp.IDialogContent"
|
|
64
|
+
],
|
|
65
|
+
properties: {
|
|
66
|
+
|
|
67
|
+
},
|
|
68
|
+
aggregations: {
|
|
69
|
+
/**
|
|
70
|
+
* Table to be used in value help
|
|
71
|
+
*/
|
|
72
|
+
table: {
|
|
73
|
+
type: "sap.m.Table",
|
|
74
|
+
multiple: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
events: {
|
|
78
|
+
/**
|
|
79
|
+
* This event is fired if the content of the table is updated
|
|
80
|
+
*/
|
|
81
|
+
contentUpdated: {} // TODO: Better way to solve missing popover maxheight? Part of ITypeahead? Or is this explicitly for IPopoverContent?
|
|
82
|
+
},
|
|
83
|
+
defaultAggregation: "table"
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
MTable.prototype.init = function() {
|
|
88
|
+
FilterableListContent.prototype.init.apply(this, arguments);
|
|
89
|
+
|
|
90
|
+
this._oObserver.observe(this, {
|
|
91
|
+
aggregations: ["table"]
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
this._addPromise("listBinding");
|
|
95
|
+
this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
|
|
96
|
+
this._oMResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.m");
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
MTable.prototype.getValueHelpIcon = function() {
|
|
100
|
+
|
|
101
|
+
if (this.getUseAsValueHelp()) {
|
|
102
|
+
return "sap-icon://slim-arrow-down";
|
|
103
|
+
} else {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
function _updateSelection () {
|
|
111
|
+
if (this._oTable) {
|
|
112
|
+
// var aSelectedIds = this.getConditions().filter(function (oCondition) {
|
|
113
|
+
// return oCondition.operator === "EQ";
|
|
114
|
+
// }).map(function (oCondition) {
|
|
115
|
+
// return oCondition.values[0];
|
|
116
|
+
// });
|
|
117
|
+
var aItems = this._oTable.getItems();
|
|
118
|
+
var aConditions = this.getConditions();
|
|
119
|
+
|
|
120
|
+
for (var iId in aItems) {
|
|
121
|
+
var oItem = aItems[iId];
|
|
122
|
+
// var oContext = oItem && oItem.getBindingContext();
|
|
123
|
+
// var oContextValue = oContext && oContext.getObject();
|
|
124
|
+
// var bSelected = oContextValue && aSelectedIds.indexOf(oContextValue[this.getKeyPath()]) >= 0;
|
|
125
|
+
var bSelected = this._isItemSelected(oItem, aConditions);
|
|
126
|
+
oItem.setSelected(bSelected);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// function _getListItemKey(oListItem) {
|
|
132
|
+
// var oContext = oListItem.getBindingContext();
|
|
133
|
+
// var oContextValue = oContext && oContext.getObject();
|
|
134
|
+
// return oContextValue && oContextValue[this.getKeyPath()];
|
|
135
|
+
// }
|
|
136
|
+
MTable.prototype.applyFilters = function(sFieldSearch) {
|
|
137
|
+
var oListBinding = this._getListBinding();
|
|
138
|
+
var bValueHelpDelegateInitialized = this._isValueHelpDelegateInitialized();
|
|
139
|
+
|
|
140
|
+
if ((!oListBinding || !bValueHelpDelegateInitialized) && (this.isContainerOpening() || this.isTypeahead())) {
|
|
141
|
+
Promise.all([this._retrievePromise("listBinding"), this._awaitValueHelpDelegate()]).then(function () {
|
|
142
|
+
if (!this.bIsDestroyed) {
|
|
143
|
+
this.applyFilters(sFieldSearch);
|
|
144
|
+
}
|
|
145
|
+
}.bind(this));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!bValueHelpDelegateInitialized || (!this.isTypeahead() && !this.isContainerOpen() && oListBinding.isSuspended())) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
var oDelegate = this._getValueHelpDelegate();
|
|
154
|
+
var oDelegatePayload = this._getValueHelpDelegatePayload();
|
|
155
|
+
|
|
156
|
+
var oFilterBar = this._getPriorityFilterBar();
|
|
157
|
+
var oConditions = oFilterBar ? oFilterBar.getInternalConditions() : this.getProperty("inConditions"); // use InParameter if no FilterBar
|
|
158
|
+
var oConditionTypes = oConditions && this._getTypesForConditions(oConditions);
|
|
159
|
+
var oFilter = oConditions && FilterConverter.createFilters( oConditions, oConditionTypes, undefined, this.getCaseSensitive());
|
|
160
|
+
var aFilters = oFilter && [oFilter];
|
|
161
|
+
var sSearch = this.isTypeahead() ? sFieldSearch : oFilterBar && oFilterBar.getSearch();
|
|
162
|
+
|
|
163
|
+
var bUseFilter = true;
|
|
164
|
+
var oFilterInfo;
|
|
165
|
+
|
|
166
|
+
// TODO: Talk to Sebastian or Model guys why this does not work in this scenario (Cannot read property 'getAST' of undefined)
|
|
167
|
+
try {
|
|
168
|
+
oFilterInfo = oListBinding.getFilterInfo();
|
|
169
|
+
} catch (error) {
|
|
170
|
+
Log.info("ValueHelp-Filter: getFilterInfo threw error");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (!aFilters) {
|
|
174
|
+
aFilters = [];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (aFilters.length === 0 && !oFilterInfo) {
|
|
178
|
+
// no filter already exists and none should be set (Suggestion without In-Parameter)
|
|
179
|
+
bUseFilter = false;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (oDelegate && oDelegate.isSearchSupported(oDelegatePayload, oListBinding)){
|
|
183
|
+
if (!oListBinding.isSuspended() && bUseFilter) {
|
|
184
|
+
// as we trigger two changes this would result to two requests therefore we suspend the binding
|
|
185
|
+
oListBinding.suspend();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
oDelegate.executeSearch(oDelegatePayload, oListBinding, sSearch);
|
|
189
|
+
Log.info("ValueHelp-Search: " + sSearch);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (bUseFilter) {
|
|
193
|
+
oListBinding.filter(aFilters, FilterType.Application);
|
|
194
|
+
Log.info("ValueHelp-Filter: " + this._prettyPrintFilters.call(this, aFilters));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (oListBinding.isSuspended()) {
|
|
198
|
+
// if ListBinding is suspended resume it after filters are set
|
|
199
|
+
oListBinding.resume();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
MTable.prototype._handleSelectionChange = function (oEvent) {
|
|
204
|
+
var bIsTypeahead = this.isTypeahead();
|
|
205
|
+
if (!bIsTypeahead || !this._isSingleSelect()) {
|
|
206
|
+
var oParams = oEvent.getParameters();
|
|
207
|
+
var aListItems = oParams.listItems || oParams.listItem && [oParams.listItem];
|
|
208
|
+
var aConditions = aListItems.map(function (oItem) {
|
|
209
|
+
var oValues = this._getItemFromContext(oItem.getBindingContext());
|
|
210
|
+
return oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
|
|
211
|
+
}.bind(this));
|
|
212
|
+
this.fireSelect({type: oParams.selected ? SelectType.Add : SelectType.Remove, conditions: aConditions});
|
|
213
|
+
if (bIsTypeahead) {
|
|
214
|
+
this.fireConfirm();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
MTable.prototype._handleItemPress = function (oEvent) {
|
|
220
|
+
var oItem = oEvent.getParameter("listItem");
|
|
221
|
+
var oValues = this._getItemFromContext(oItem.getBindingContext());
|
|
222
|
+
var bIsSingleSelect = this._isSingleSelect();
|
|
223
|
+
var bSelected = bIsSingleSelect ? true : !oItem.getSelected();
|
|
224
|
+
var sSelectType = SelectType.Set;
|
|
225
|
+
|
|
226
|
+
if (!bIsSingleSelect) {
|
|
227
|
+
oItem.setSelected(bSelected);
|
|
228
|
+
sSelectType = bSelected ? SelectType.Add : SelectType.Remove;
|
|
229
|
+
}
|
|
230
|
+
var oCondition = this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
|
|
231
|
+
this.fireSelect({type: sSelectType, conditions: [oCondition]});
|
|
232
|
+
if (this.isTypeahead()) {
|
|
233
|
+
this.fireConfirm({close: true});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
MTable.prototype._handleUpdateFinished = function () {
|
|
238
|
+
_updateSelection.apply(this);
|
|
239
|
+
this.fireContentUpdated();
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
MTable.prototype._getTable = function () {
|
|
243
|
+
return this._oTable;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
MTable.prototype.onShow = function () {
|
|
247
|
+
var oTable = this._getTable();
|
|
248
|
+
if (oTable) {
|
|
249
|
+
if (!oTable.hasStyleClass("sapMComboBoxList")) { // TODO: only in typeahead case?
|
|
250
|
+
oTable.addStyleClass("sapMComboBoxList"); // to allow focus outline in navigation
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
FilterableListContent.prototype.onShow.apply(this, arguments);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
MTable.prototype.onHide = function () {
|
|
258
|
+
FilterableListContent.prototype.onHide.apply(this, arguments);
|
|
259
|
+
var oTable = this.getTable();
|
|
260
|
+
if (oTable) {
|
|
261
|
+
this.removeFocus();
|
|
262
|
+
if (oTable.hasStyleClass("sapMComboBoxList")) {
|
|
263
|
+
oTable.removeStyleClass("sapMComboBoxList");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
MTable.prototype._handleConditionsUpdate = function(oChanges) {
|
|
269
|
+
_updateSelection.call(this);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
MTable.prototype.getContent = function () {
|
|
273
|
+
if (!this.isTypeahead()) {
|
|
274
|
+
return this._retrievePromise("wrappedContent", function () {
|
|
275
|
+
return loadModules([
|
|
276
|
+
"sap/ui/layout/FixFlex",
|
|
277
|
+
"sap/m/VBox",
|
|
278
|
+
"sap/m/Panel",
|
|
279
|
+
"sap/m/ScrollContainer",
|
|
280
|
+
"sap/ui/model/resource/ResourceModel"
|
|
281
|
+
]).then(function(aModules) {
|
|
282
|
+
|
|
283
|
+
var FixFlex = aModules[0];
|
|
284
|
+
var VBox = aModules[1];
|
|
285
|
+
var Panel = aModules[2];
|
|
286
|
+
var ScrollContainer = aModules[3];
|
|
287
|
+
var ResourceModel = aModules[4];
|
|
288
|
+
|
|
289
|
+
if (!this._oContentLayout) {
|
|
290
|
+
|
|
291
|
+
this._oFilterBarVBox = new VBox(this.getId() + "-FilterBarBox");
|
|
292
|
+
this._oFilterBarVBox.addStyleClass("sapMdcValueHelpPanelFilterbar");
|
|
293
|
+
this._oFilterBarVBox._oWrapper = this;
|
|
294
|
+
this._oFilterBarVBox.getItems = function () {
|
|
295
|
+
return [this._oWrapper._getPriorityFilterBar.call(this._oWrapper)];
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
this.setModel(new ResourceModel({ bundleName: "sap/ui/mdc/messagebundle", async: false }), "$i18n");
|
|
299
|
+
var _formatTableTitle = function (sText) {
|
|
300
|
+
var iItems = 0; //TODO from where do we get the count
|
|
301
|
+
if (iItems === 0) {
|
|
302
|
+
sText = this.getModel("$i18n").getResourceBundle().getText("valuehelp.TABLETITLENONUMBER");
|
|
303
|
+
}
|
|
304
|
+
return formatMessage(sText, iItems);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
this._oTablePanel = new Panel(this.getId() + "-TablePanel", { expanded: true, height: "100%", headerText: {parts: ['$i18n>valuehelp.TABLETITLE'], formatter: _formatTableTitle}});
|
|
308
|
+
this._oTablePanel.addStyleClass("sapMdcTablePanel");
|
|
309
|
+
|
|
310
|
+
this._oContentLayout = new FixFlex(this.getId() + "-FF", {minFlexSize: 200, fixContent: this._oFilterBarVBox, flexContent: this._oTablePanel});
|
|
311
|
+
|
|
312
|
+
this._oScrollContainer = new ScrollContainer(this.getId() + "-SC", {
|
|
313
|
+
height: "100%",
|
|
314
|
+
width: "100%",
|
|
315
|
+
vertical: true
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
this._oScrollContainer._oWrapper = this;
|
|
319
|
+
this._oScrollContainer.getContent = function() {
|
|
320
|
+
var aContent = [];
|
|
321
|
+
var oTable = this._oWrapper && this._oWrapper._oTable;
|
|
322
|
+
if (oTable) {
|
|
323
|
+
aContent.push(oTable);
|
|
324
|
+
}
|
|
325
|
+
return aContent;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
this._oTablePanel.addContent(this._oScrollContainer);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
this.setAggregation("displayContent", this._oContentLayout);
|
|
332
|
+
|
|
333
|
+
var oFilterBar = this._getPriorityFilterBar();
|
|
334
|
+
if (!oFilterBar) {
|
|
335
|
+
return this._createDefaultFilterBar().then(function () {
|
|
336
|
+
return this._oContentLayout;
|
|
337
|
+
}.bind(this));
|
|
338
|
+
}
|
|
339
|
+
return this._oContentLayout;
|
|
340
|
+
}.bind(this));
|
|
341
|
+
}.bind(this));
|
|
342
|
+
}
|
|
343
|
+
return this._oTable;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
MTable.prototype.getItemForValue = function (oConfig) {
|
|
347
|
+
|
|
348
|
+
if (!oConfig.checkKey && oConfig.parsedValue && !oConfig.checkDescription) {
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* load data from model if nothing is found in the current items / contexts
|
|
353
|
+
/ steps:
|
|
354
|
+
0. determine if key or desc entered ??
|
|
355
|
+
1. wait for table binding
|
|
356
|
+
2. consider existing inparameters
|
|
357
|
+
*/
|
|
358
|
+
oConfig.caseSensitive = oConfig.caseSensitive || this.getCaseSensitive();
|
|
359
|
+
|
|
360
|
+
return _checkListBindingPending.call(this).then(function(bPending) {
|
|
361
|
+
var oResult;
|
|
362
|
+
|
|
363
|
+
if (!bPending) {
|
|
364
|
+
var oTable = this.getTable();
|
|
365
|
+
oResult = _filterItems.call(this, oConfig, oTable.getItems());
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (!oResult) {
|
|
369
|
+
oResult = this._loadItemForValue(oConfig);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return oResult;
|
|
373
|
+
}.bind(this));
|
|
374
|
+
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
function _checkListBindingPending() {
|
|
378
|
+
return this._retrievePromise("listBinding").then(function (oListBinding) {
|
|
379
|
+
var oDelegate = this._getValueHelpDelegate();
|
|
380
|
+
var oDelegatePayload = this._getValueHelpDelegatePayload();
|
|
381
|
+
var oListBindingInfo = this._getListBindingInfo();
|
|
382
|
+
if (oListBinding && oDelegate){
|
|
383
|
+
return oDelegate.checkListBindingPending(oDelegatePayload, oListBinding, oListBindingInfo);
|
|
384
|
+
} else {
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
}.bind(this));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function _filterItems(oConfig, aItems) {
|
|
391
|
+
|
|
392
|
+
if (aItems.length === 0) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
var aFields = [];
|
|
397
|
+
|
|
398
|
+
if (oConfig.checkKey && oConfig.hasOwnProperty("parsedValue")) { // empty string or false could be key too
|
|
399
|
+
aFields.push({path: this.getKeyPath(), value: oConfig.parsedValue});
|
|
400
|
+
}
|
|
401
|
+
if (oConfig.checkDescription && oConfig.value) {
|
|
402
|
+
aFields.push({path: this.getDescriptionPath(), value: oConfig.value});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
var _getFilterValue = function(oItem, sPath) {
|
|
406
|
+
var oBindingContext = oItem.isA("sap.ui.model.Context") ? oItem : oItem.getBindingContext();
|
|
407
|
+
return oBindingContext.getProperty(sPath);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
var oFilter;
|
|
411
|
+
var aFilters = [];
|
|
412
|
+
var aInParameters;
|
|
413
|
+
var aOutParameters;
|
|
414
|
+
var i = 0;
|
|
415
|
+
|
|
416
|
+
for (i = 0; i < aFields.length; i++) {
|
|
417
|
+
if (!aFields[i].path) {
|
|
418
|
+
throw new Error("path for filter missing"); // as we cannot filter key or description without path
|
|
419
|
+
}
|
|
420
|
+
aFilters.push(new Filter({path: aFields[i].path, operator: FilterOperator.EQ, value1: aFields[i].value, caseSensitive: oConfig.caseSensitive}));
|
|
421
|
+
}
|
|
422
|
+
if (aFilters.length === 1) {
|
|
423
|
+
oFilter = aFilters[0];
|
|
424
|
+
} else {
|
|
425
|
+
oFilter = new Filter({filters: aFilters, and: false}); // key OR description
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (oConfig.inParameters/* || oConfig.outParameters*/) {
|
|
429
|
+
aFilters = [oFilter];
|
|
430
|
+
if (oConfig.inParameters) {
|
|
431
|
+
aFilters.push(oConfig.inParameters);
|
|
432
|
+
aInParameters = []; // TODO: maybe provide paths from outside? No need to analyze Filters backwards
|
|
433
|
+
if (!oConfig.inParameters.aFilters) {
|
|
434
|
+
aInParameters.push(oConfig.inParameters.sPath);
|
|
435
|
+
} else {
|
|
436
|
+
for (i = 0; i < oConfig.inParameters.aFilters.length; i++) {
|
|
437
|
+
if (aInParameters.indexOf(oConfig.inParameters.aFilters[i].sPath) < 0) {
|
|
438
|
+
aInParameters.push(oConfig.inParameters.aFilters[i].sPath);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// if (oConfig.outParameters) {
|
|
444
|
+
// aFilters.push(oConfig.outParameters);
|
|
445
|
+
// }
|
|
446
|
+
oFilter = new Filter({filters: aFilters, and: true});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
var aFilteredItems = FilterProcessor.apply(aItems, oFilter, _getFilterValue);
|
|
450
|
+
if (aFilteredItems.length === 1) {
|
|
451
|
+
var oValue = this._getItemFromContext(aFilteredItems[0].getBindingContext(), {inParameters: aInParameters, outParameters: aOutParameters});
|
|
452
|
+
return {key: oValue.key, description: oValue.description, inParameters: oValue.inParameters, outParameters: oValue.outParameters};
|
|
453
|
+
} else if (aFilteredItems.length > 1) {
|
|
454
|
+
if (!oConfig.caseSensitive) {
|
|
455
|
+
// try with case sensitive search
|
|
456
|
+
var oNewConfig = merge({}, oConfig);
|
|
457
|
+
oNewConfig.caseSensitive = true;
|
|
458
|
+
return _filterItems.call(this, oNewConfig, aItems);
|
|
459
|
+
}
|
|
460
|
+
throw _createException.call(this, oConfig.exception, true, aFields[0].value);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
MTable.prototype._getListBinding = function () {
|
|
466
|
+
var oTable = this._getTable();
|
|
467
|
+
return oTable && oTable.getBinding("items");
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
MTable.prototype._getListBindingInfo = function () {
|
|
471
|
+
var oTable = this._getTable();
|
|
472
|
+
return oTable && oTable.getBindingInfo("items");
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
MTable.prototype._loadItemForValue = function (oConfig) {
|
|
476
|
+
|
|
477
|
+
if (!oConfig.checkKey && oConfig.parsedValue && !oConfig.checkDescription) {
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/* steps:
|
|
482
|
+
TODO: 1. wait for table binding
|
|
483
|
+
2. consider existing inparameters
|
|
484
|
+
*/
|
|
485
|
+
var sKeyPath = this.getKeyPath();
|
|
486
|
+
var sDescriptionPath = this.getDescriptionPath();
|
|
487
|
+
var bUseFirstMatch = this.getUseFirstMatch();
|
|
488
|
+
var bCaseSensitive = oConfig.caseSensitive;
|
|
489
|
+
|
|
490
|
+
var oTable = this._getTable();
|
|
491
|
+
var oListBinding = oTable && oTable.getBinding("items"); //this.getListBinding();
|
|
492
|
+
var oBindingContext = oListBinding && oListBinding.getContext();
|
|
493
|
+
var oModel = oListBinding && oListBinding.getModel();
|
|
494
|
+
var sPath = oListBinding && oListBinding.getPath();
|
|
495
|
+
|
|
496
|
+
var oDelegate = this._getValueHelpDelegate();
|
|
497
|
+
var oDelegatePayload = this._getValueHelpDelegatePayload();
|
|
498
|
+
|
|
499
|
+
var sPromiseKey = ["loadItemForValue", sPath, sKeyPath, oConfig.parsedValue || oConfig.value].join("_");
|
|
500
|
+
|
|
501
|
+
return this._retrievePromise(sPromiseKey, function () {
|
|
502
|
+
|
|
503
|
+
var aFilters = [];
|
|
504
|
+
|
|
505
|
+
if (oConfig.checkKey && oConfig.hasOwnProperty("parsedValue")) { // empty string or false could be key too
|
|
506
|
+
aFilters.push(new Filter({ path: sKeyPath, operator: FilterOperator.EQ, value1: oConfig.parsedValue, caseSensitive: bCaseSensitive}));
|
|
507
|
+
}
|
|
508
|
+
if (oConfig.checkDescription && oConfig.value) {
|
|
509
|
+
aFilters.push(new Filter({path: sDescriptionPath, operator: FilterOperator.EQ, value1: oConfig.value, caseSensitive: bCaseSensitive}));
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
var oFilter = aFilters.length > 1 ? new Filter({filters: aFilters, and: false}) : aFilters[0];
|
|
513
|
+
aFilters = [oFilter];
|
|
514
|
+
|
|
515
|
+
var aInParameters;
|
|
516
|
+
if (oConfig.inParameters) {
|
|
517
|
+
// use in-parameters as additional filters
|
|
518
|
+
aFilters.push(oConfig.inParameters);
|
|
519
|
+
aInParameters = []; // TODO: maybe provide paths from outside? No need to analyze Filters backwards
|
|
520
|
+
if (!oConfig.inParameters.aFilters) {
|
|
521
|
+
aInParameters.push(oConfig.inParameters.sPath);
|
|
522
|
+
} else {
|
|
523
|
+
for (var i = 0; i < oConfig.inParameters.aFilters.length; i++) {
|
|
524
|
+
if (aInParameters.indexOf(oConfig.inParameters.aFilters[i].sPath) < 0) {
|
|
525
|
+
aInParameters.push(oConfig.inParameters.aFilters[i].sPath);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
// if (oConfig.oOutParameters) {
|
|
531
|
+
// // use out-parameters as additional filters (only if not already set by InParameter
|
|
532
|
+
// if (oConfig.oInParameters) {
|
|
533
|
+
// var aOutFilters = oConfig.oOutParameters.aFilters ? oConfig.oOutParameters.aFilters : [oConfig.oOutParameters];
|
|
534
|
+
// var aInFilters = oConfig.oInParameters.aFilters ? oConfig.oInParameters.aFilters : [oConfig.oInParameters];
|
|
535
|
+
// for (var i = 0; i < aOutFilters.length; i++) {
|
|
536
|
+
// var oOutFilter = aOutFilters[i];
|
|
537
|
+
// var bFound = false;
|
|
538
|
+
// for (var j = 0; j < aInFilters.length; j++) {
|
|
539
|
+
// var oInFilter = aInFilters[j];
|
|
540
|
+
// if (oInFilter.sPath === oOutFilter.sPath && oInFilter.oValue1 === oOutFilter.oValue1 && oInFilter.oValue2 === oOutFilter.oValue2) {
|
|
541
|
+
// bFound = true;
|
|
542
|
+
// break;
|
|
543
|
+
// }
|
|
544
|
+
// }
|
|
545
|
+
// if (!bFound) {
|
|
546
|
+
// aFilters.push(oOutFilter);
|
|
547
|
+
// }
|
|
548
|
+
// }
|
|
549
|
+
// } else {
|
|
550
|
+
// aFilters.push(oConfig.oOutParameters);
|
|
551
|
+
// }
|
|
552
|
+
// }
|
|
553
|
+
|
|
554
|
+
oFilter = aFilters.length > 1 ? new Filter({filters: aFilters, and: true}) : aFilters[0];
|
|
555
|
+
var oFilterListBinding = oModel.bindList(sPath, oBindingContext);
|
|
556
|
+
|
|
557
|
+
return oDelegate.executeFilter(oDelegatePayload, oFilterListBinding, oFilter, 2).then(function (oBinding) {
|
|
558
|
+
var aContexts = oBinding.getContexts();
|
|
559
|
+
|
|
560
|
+
setTimeout(function() { // as Binding might process other steps after event was fired - destroy it lazy
|
|
561
|
+
oFilterListBinding.destroy();
|
|
562
|
+
}, 0);
|
|
563
|
+
|
|
564
|
+
if (aContexts.length && (aContexts.length < 2 || bUseFirstMatch)) {
|
|
565
|
+
return this._getItemFromContext(aContexts[0], {keyPath: sKeyPath, descriptionPath: sDescriptionPath, inParameters: aInParameters});
|
|
566
|
+
} else if (oConfig.checkKey && oConfig.parsedValue === "" && aContexts.length === 0) {
|
|
567
|
+
// nothing found for empty key -> this is not an error
|
|
568
|
+
return null;
|
|
569
|
+
} else {
|
|
570
|
+
var oException = _createException.call(this, oConfig.exception, aContexts.length > 1, oConfig.value);
|
|
571
|
+
throw oException;
|
|
572
|
+
}
|
|
573
|
+
}.bind(this));
|
|
574
|
+
}.bind(this));
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
function _createException(Exception, bNotUnique, vValue) {
|
|
578
|
+
|
|
579
|
+
var sError;
|
|
580
|
+
if (bNotUnique) {
|
|
581
|
+
sError = this._oResourceBundle.getText("valuehelp.VALUE_NOT_UNIQUE", [vValue]);
|
|
582
|
+
} else {
|
|
583
|
+
sError = this._oResourceBundle.getText("valuehelp.VALUE_NOT_EXIST", [vValue]);
|
|
584
|
+
}
|
|
585
|
+
var oException = new Exception(sError);
|
|
586
|
+
oException._bNotUnique = bNotUnique; // TODO: better solution?
|
|
587
|
+
return oException;
|
|
588
|
+
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
MTable.prototype.isValidationSupported = function(oConfig) {
|
|
592
|
+
return true;
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
MTable.prototype.navigate = function (iStep) {
|
|
596
|
+
|
|
597
|
+
var oListBinding = this._getListBinding();
|
|
598
|
+
|
|
599
|
+
if (!oListBinding || !oListBinding.getLength()) {
|
|
600
|
+
return _checkListBindingPending.call(this).then(function (bPending) {
|
|
601
|
+
if (!bPending && oListBinding.getLength() !== 0) { // if no items - no navigation is possible
|
|
602
|
+
return this.navigate(iStep);
|
|
603
|
+
}
|
|
604
|
+
return false;
|
|
605
|
+
}.bind(this));
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
var oTable = this._getTable();
|
|
609
|
+
oTable.addStyleClass("sapMListFocus"); // to show focus outline on navigated item
|
|
610
|
+
|
|
611
|
+
var aItems = this._oTable.getItems();
|
|
612
|
+
var oSelectedItem = oTable.getSelectedItem();
|
|
613
|
+
var iItems = aItems.length;
|
|
614
|
+
var iSelectedIndex = 0;
|
|
615
|
+
var bLeaveFocus = false;
|
|
616
|
+
|
|
617
|
+
if (oSelectedItem) {
|
|
618
|
+
iSelectedIndex = aItems.indexOf(oSelectedItem);
|
|
619
|
+
iSelectedIndex = iSelectedIndex + iStep;
|
|
620
|
+
} else if (iStep >= 0){
|
|
621
|
+
iSelectedIndex = iStep - 1;
|
|
622
|
+
} else {
|
|
623
|
+
iSelectedIndex = iItems + iStep;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (this._getMaxConditions() !== 1) { // || (oFirstSelectedItem && !oTableItemForFirstSelection) prevent navigation if selected item noch present in table?
|
|
627
|
+
if (this.getParent().isOpen()) {
|
|
628
|
+
oTable.focus();
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
var bSearchForNext;
|
|
634
|
+
if (iSelectedIndex < 0) {
|
|
635
|
+
iSelectedIndex = 0;
|
|
636
|
+
bSearchForNext = true;
|
|
637
|
+
bLeaveFocus = true;
|
|
638
|
+
} else if (iSelectedIndex >= iItems - 1) {
|
|
639
|
+
iSelectedIndex = iItems - 1;
|
|
640
|
+
bSearchForNext = false;
|
|
641
|
+
} else {
|
|
642
|
+
bSearchForNext = iStep >= 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
while (aItems[iSelectedIndex] && aItems[iSelectedIndex].isA("sap.m.GroupHeaderListItem")) { // ignore group headers
|
|
646
|
+
if (bSearchForNext) {
|
|
647
|
+
iSelectedIndex++;
|
|
648
|
+
} else {
|
|
649
|
+
iSelectedIndex--;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (iSelectedIndex < 0 || iSelectedIndex > iItems - 1) {
|
|
653
|
+
// find last not groupable item
|
|
654
|
+
bSearchForNext = !bSearchForNext;
|
|
655
|
+
bLeaveFocus = iSelectedIndex < 0;
|
|
656
|
+
iSelectedIndex = iSelectedIndex < 0 ? 0 : iItems - 1;
|
|
657
|
+
while (aItems[iSelectedIndex] && aItems[iSelectedIndex].isA("sap.m.GroupHeaderListItem")) { // ignore group headers
|
|
658
|
+
if (bSearchForNext) {
|
|
659
|
+
iSelectedIndex++;
|
|
660
|
+
} else {
|
|
661
|
+
iSelectedIndex--;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
var oItem = aItems[iSelectedIndex];
|
|
667
|
+
if (oItem) {
|
|
668
|
+
var oCondition;
|
|
669
|
+
if (oItem !== oSelectedItem) {
|
|
670
|
+
oItem.setSelected(true);
|
|
671
|
+
|
|
672
|
+
var oValues = this._getItemFromContext(oItem.getBindingContext());
|
|
673
|
+
oCondition = oValues && this._createCondition(oValues.key, oValues.description, oValues.inParameters, oValues.outParameters);
|
|
674
|
+
this.setProperty("conditions", [oCondition], true);
|
|
675
|
+
|
|
676
|
+
if (this._bVisible) {
|
|
677
|
+
this._handleScrolling(oItem);
|
|
678
|
+
}
|
|
679
|
+
this.fireNavigated({condition: oCondition, itemId: oItem.getId(), leaveFocus: false});
|
|
680
|
+
} else if (bLeaveFocus) {
|
|
681
|
+
this.fireNavigated({condition: undefined, itemId: undefined, leaveFocus: bLeaveFocus});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
MTable.prototype._handleScrolling = function (oItem) {
|
|
687
|
+
var oScrollDelegate = this.getScrollDelegate();
|
|
688
|
+
if (oScrollDelegate) {
|
|
689
|
+
var oTable = this._getTable();
|
|
690
|
+
var iIndex = !isNaN(oItem) ? oItem : oTable.indexOfItem(oItem);
|
|
691
|
+
oTable.scrollToIndex(iIndex).catch(function (oError) {
|
|
692
|
+
// TODO: Handle scroll error?
|
|
693
|
+
});
|
|
694
|
+
return true;
|
|
695
|
+
}
|
|
696
|
+
return false;
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// Table needs to know the ScrollDelegate of the parent, so we provide it here.
|
|
700
|
+
MTable.prototype.getScrollDelegate = function() {
|
|
701
|
+
if (/* !this.isTypeahead() && */ this._oScrollContainer) {
|
|
702
|
+
return this._oScrollContainer.getScrollDelegate();
|
|
703
|
+
}
|
|
704
|
+
return FilterableListContent.prototype.getScrollDelegate.apply(this, arguments);
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
MTable.prototype.removeFocus = function() {
|
|
709
|
+
|
|
710
|
+
var oTable = this.getTable();
|
|
711
|
+
if (oTable) {
|
|
712
|
+
oTable.removeStyleClass("sapMListFocus");
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
MTable.prototype.getAriaAttributes = function(iMaxConditions) {
|
|
718
|
+
|
|
719
|
+
var oTable = this.getTable();
|
|
720
|
+
|
|
721
|
+
return { // return default values, but needs to be implemented by specific content
|
|
722
|
+
contentId: oTable && oTable.getId(), // if open, table should be there; if closed, not needed
|
|
723
|
+
ariaHasPopup: "listbox",
|
|
724
|
+
roleDescription: null // TODO: no multi-selection
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
|
|
728
|
+
MTable.prototype.getContainerConfig = function () {
|
|
729
|
+
return {
|
|
730
|
+
'sap.ui.mdc.valuehelp.Popover': {
|
|
731
|
+
getContentHeight: function () {
|
|
732
|
+
var oTable = this._getTable();
|
|
733
|
+
var oDomRef = oTable && oTable.getDomRef();
|
|
734
|
+
return oDomRef && Math.round(oDomRef.getBoundingClientRect().height);
|
|
735
|
+
}.bind(this),
|
|
736
|
+
getFooter: function () {
|
|
737
|
+
return this._retrievePromise("footer", function () {
|
|
738
|
+
return this._retrievePromise("listBinding").then(function (oListBinding) {
|
|
739
|
+
var oBindingInfo = this._getListBindingInfo();
|
|
740
|
+
if (oBindingInfo && oBindingInfo.length) {
|
|
741
|
+
return loadModules(["sap/m/Button", "sap/m/Toolbar", "sap/m/ToolbarSpacer"]).then(function (aModules) {
|
|
742
|
+
var Button = aModules[0];
|
|
743
|
+
var Toolbar = aModules[1];
|
|
744
|
+
var ToolbarSpacer = aModules[2];
|
|
745
|
+
var oShowAllItemsButton = new Button(this.getId() + "-showAllItems", {
|
|
746
|
+
text: this._oMResourceBundle.getText("INPUT_SUGGESTIONS_SHOW_ALL"),
|
|
747
|
+
press: function () {
|
|
748
|
+
this.fireRequestSwitchToDialog();
|
|
749
|
+
}.bind(this)
|
|
750
|
+
});
|
|
751
|
+
var aToolbarContent = [new ToolbarSpacer(this.getId() + "-Spacer")].concat(oShowAllItemsButton);
|
|
752
|
+
var oFooter = new Toolbar(this.getId() + "-TB", {
|
|
753
|
+
content: aToolbarContent
|
|
754
|
+
});
|
|
755
|
+
return oFooter;
|
|
756
|
+
}.bind(this));
|
|
757
|
+
}
|
|
758
|
+
}.bind(this));
|
|
759
|
+
}.bind(this));
|
|
760
|
+
}.bind(this)
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
function _adjustTable () {
|
|
766
|
+
if (this._oTable && this.getParent()) {
|
|
767
|
+
|
|
768
|
+
var aSticky = this._oTable.getSticky();
|
|
769
|
+
if (!aSticky || aSticky.length === 0) {
|
|
770
|
+
// make headers sticky
|
|
771
|
+
this._oTable.setSticky([Sticky.ColumnHeaders]);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
if (this.isTypeahead()) {
|
|
775
|
+
if (this._isSingleSelect()) {
|
|
776
|
+
this._oTable.setMode(ListMode.SingleSelectMaster);
|
|
777
|
+
} else {
|
|
778
|
+
this._oTable.setMode(ListMode.MultiSelect);
|
|
779
|
+
}
|
|
780
|
+
} else if (this._isSingleSelect()) {
|
|
781
|
+
this._oTable.setMode(ListMode.SingleSelectLeft);
|
|
782
|
+
} else {
|
|
783
|
+
this._oTable.setMode(ListMode.MultiSelect);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
MTable.prototype.setParent = function(oParent) {
|
|
788
|
+
FilterableListContent.prototype.setParent.apply(this, arguments);
|
|
789
|
+
_adjustTable.call(this);
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
var _handleSearch = function () {
|
|
793
|
+
return this.applyFilters(this.getFilterValue());
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
MTable.prototype._observeChanges = function (oChanges) {
|
|
797
|
+
|
|
798
|
+
var oFilterBar, oDefaultFilterBar;
|
|
799
|
+
if (oChanges.name === "_defaultFilterBar") {
|
|
800
|
+
oDefaultFilterBar = oChanges.child;
|
|
801
|
+
if (oChanges.mutation === "insert") {
|
|
802
|
+
oFilterBar = this.getFilterBar();
|
|
803
|
+
if (!oFilterBar) {
|
|
804
|
+
oDefaultFilterBar.attachSearch(_handleSearch, this);
|
|
805
|
+
}
|
|
806
|
+
} else {
|
|
807
|
+
oDefaultFilterBar.detachSearch(_handleSearch, this);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
if (oChanges.name === "filterBar") {
|
|
812
|
+
oFilterBar = oChanges.child;
|
|
813
|
+
oDefaultFilterBar = this.getAggregation("_defaultFilterBar");
|
|
814
|
+
if (oChanges.mutation === "insert") {
|
|
815
|
+
if (oDefaultFilterBar) {
|
|
816
|
+
oDefaultFilterBar.detachSearch(_handleSearch, this);
|
|
817
|
+
}
|
|
818
|
+
oFilterBar.attachSearch(_handleSearch, this);
|
|
819
|
+
} else {
|
|
820
|
+
if (oDefaultFilterBar) {
|
|
821
|
+
oDefaultFilterBar.attachSearch(_handleSearch, this);
|
|
822
|
+
}
|
|
823
|
+
oFilterBar.detachSearch(_handleSearch, this);
|
|
824
|
+
this._createDefaultFilterBar(); // TODO: should this be part of FilterableListContent?
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if (oChanges.name === "config") {
|
|
829
|
+
_adjustTable.call(this);
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
if (oChanges.name === "items" && oChanges.mutation === "ready") {
|
|
833
|
+
this._resolvePromise("listBinding", oChanges.bindingInfo.binding);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
if (oChanges.name === "table") {
|
|
837
|
+
var oTable = oChanges.child;
|
|
838
|
+
|
|
839
|
+
if (oChanges.mutation === "remove") {
|
|
840
|
+
this._oObserver.unobserve(oTable);
|
|
841
|
+
oTable.removeDelegate(this._oTableDelegate);
|
|
842
|
+
this._oTable.detachItemPress(this._handleItemPress, this);
|
|
843
|
+
this._oTable.detachSelectionChange(this._handleSelectionChange, this);
|
|
844
|
+
this._oTable.detachUpdateFinished(this._handleUpdateFinished, this);
|
|
845
|
+
this._oTable = null;
|
|
846
|
+
this._removePromise("footer");
|
|
847
|
+
this._addPromise("listBinding");
|
|
848
|
+
} else {
|
|
849
|
+
this._oTable = oTable;
|
|
850
|
+
_adjustTable.call(this);
|
|
851
|
+
this._oTable.attachItemPress(this._handleItemPress, this);
|
|
852
|
+
this._oTable.attachSelectionChange(this._handleSelectionChange, this);
|
|
853
|
+
this._oTable.attachUpdateFinished(this._handleUpdateFinished, this);
|
|
854
|
+
this._oTableDelegate = this._oTableDelegate || {
|
|
855
|
+
onsapprevious: this._handleTableEvent,
|
|
856
|
+
onsapnext: this._handleTableEvent,
|
|
857
|
+
cellClick: this._handleTableEvent
|
|
858
|
+
};
|
|
859
|
+
oTable.addDelegate(this._oTableDelegate, true, this);
|
|
860
|
+
|
|
861
|
+
var oListBinding = oTable.getBinding("items"); // TODO: wait for binding ready??
|
|
862
|
+
if (oListBinding) {
|
|
863
|
+
this._resolvePromise("listBinding", oListBinding);
|
|
864
|
+
} else {
|
|
865
|
+
this._oObserver.observe(oChanges.child, {bindings: ["items"]});
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
FilterableListContent.prototype._observeChanges.apply(this, arguments);
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
MTable.prototype._handleTableEvent = function (oEvent) {
|
|
874
|
+
|
|
875
|
+
if (!this.isTypeahead()) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
var oTable = this._getTable();
|
|
880
|
+
var oItem = jQuery(oEvent.target).control(0);
|
|
881
|
+
|
|
882
|
+
switch (oEvent.type) {
|
|
883
|
+
case "sapprevious":
|
|
884
|
+
if (oItem.isA("sap.m.ListItemBase")) {
|
|
885
|
+
if (oTable.indexOfItem(oItem) === 0) {
|
|
886
|
+
this.fireNavigated({condition: undefined, itemId: undefined, leaveFocus: true});
|
|
887
|
+
oEvent.preventDefault();
|
|
888
|
+
oEvent.stopPropagation();
|
|
889
|
+
oEvent.stopImmediatePropagation(true);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
break;
|
|
893
|
+
default:
|
|
894
|
+
break;
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
MTable.prototype.isQuickSelectSupported = function() {
|
|
899
|
+
return true;
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
MTable.prototype.shouldOpenOnNavigate = function() {
|
|
903
|
+
return true;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
MTable.prototype.exit = function () {
|
|
907
|
+
|
|
908
|
+
Common.cleanup(this, [
|
|
909
|
+
"_sTableWidth", "_oTable", "_oScrollContainer", "_oContentLayout", "_oTablePanel", "_oFilterBarVBox", "_oMResourceBundle", "_oResourceBundle"
|
|
910
|
+
]);
|
|
911
|
+
|
|
912
|
+
FilterableListContent.prototype.exit.apply(this, arguments);
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
return MTable;
|
|
916
|
+
});
|