@openui5/sap.ui.mdc 1.101.0 → 1.103.0
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/.eslintrc.json +19 -0
- package/THIRDPARTY.txt +1 -1
- package/package.json +4 -4
- package/src/sap/ui/mdc/.library +1 -1
- package/src/sap/ui/mdc/ActionToolbar.js +1 -1
- package/src/sap/ui/mdc/AggregationBaseDelegate.js +11 -0
- package/src/sap/ui/mdc/Chart.js +111 -55
- package/src/sap/ui/mdc/ChartDelegate.js +97 -92
- package/src/sap/ui/mdc/Control.js +1 -1
- package/src/sap/ui/mdc/Element.js +1 -1
- package/src/sap/ui/mdc/Field.js +9 -2
- package/src/sap/ui/mdc/FilterBar.js +1 -1
- package/src/sap/ui/mdc/FilterField.js +2 -2
- package/src/sap/ui/mdc/Link.js +4 -1
- package/src/sap/ui/mdc/MultiValueField.js +1 -1
- package/src/sap/ui/mdc/Table.js +114 -160
- package/src/sap/ui/mdc/TableDelegate.js +3 -23
- package/src/sap/ui/mdc/ValueHelp.js +20 -32
- package/src/sap/ui/mdc/ValueHelpDelegate.js +9 -3
- package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +2 -1
- package/src/sap/ui/mdc/chart/ChartSelectionDetails.js +1 -2
- package/src/sap/ui/mdc/chart/ChartToolbar.js +38 -3
- package/src/sap/ui/mdc/chart/DrillBreadcrumbs.js +6 -2
- package/src/sap/ui/mdc/chart/Item.js +6 -11
- package/src/sap/ui/mdc/chart/PropertyHelper.js +7 -8
- package/src/sap/ui/mdc/chart/SelectionDetailsActions.js +2 -3
- package/src/sap/ui/mdc/condition/Condition.js +1 -1
- package/src/sap/ui/mdc/condition/ConditionConverter.js +16 -131
- package/src/sap/ui/mdc/condition/ConditionModel.js +50 -21
- package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
- package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +11 -11
- package/src/sap/ui/mdc/condition/Operator.js +85 -15
- package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +5 -3
- package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
- package/src/sap/ui/mdc/designtime/actiontoolbar/ActionToolbar.designtime.js +6 -3
- package/src/sap/ui/mdc/designtime/actiontoolbar/ActionToolbarAction.designtime.js +53 -0
- package/src/sap/ui/mdc/designtime/chart/Chart.designtime.js +13 -1
- package/src/sap/ui/mdc/designtime/field/Field.designtime.js +9 -4
- package/src/sap/ui/mdc/designtime/table/Table.designtime.js +1 -1
- package/src/sap/ui/mdc/enum/PropagationReason.js +2 -2
- package/src/sap/ui/mdc/enum/SelectType.js +3 -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 +166 -52
- package/src/sap/ui/mdc/field/ConditionsType.js +76 -11
- package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -2
- package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
- package/src/sap/ui/mdc/field/DefineConditionPanel.js +107 -99
- package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +9 -62
- package/src/sap/ui/mdc/field/FieldBase.js +108 -73
- package/src/sap/ui/mdc/field/FieldBaseDelegate.js +20 -1
- package/src/sap/ui/mdc/field/FieldHelpBase.js +1 -39
- package/src/sap/ui/mdc/field/FieldInfoBase.js +1 -1
- package/src/sap/ui/mdc/field/FieldInput.js +2 -2
- package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
- package/src/sap/ui/mdc/field/FieldMultiInput.js +2 -2
- package/src/sap/ui/mdc/field/FieldValueHelp.js +1 -1
- package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -19
- package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +3 -1
- package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +13 -1
- package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +3 -3
- package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +28 -29
- package/src/sap/ui/mdc/field/InParameter.js +1 -4
- package/src/sap/ui/mdc/field/ListFieldHelp.js +1 -1
- 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/TokenDisplay.js +2 -2
- package/src/sap/ui/mdc/field/TokenizerDisplay.js +2 -2
- package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -5
- package/src/sap/ui/mdc/field/content/ContentFactory.js +8 -0
- package/src/sap/ui/mdc/field/content/DateContent.js +3 -3
- package/src/sap/ui/mdc/field/content/DateTimeContent.js +43 -2
- package/src/sap/ui/mdc/filterbar/FilterBarBase.js +4 -4
- package/src/sap/ui/mdc/filterbar/IFilterContainer.js +1 -1
- package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
- package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +21 -1
- package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +1 -1
- package/src/sap/ui/mdc/flexibility/ActionToolbar.flexibility.js +80 -4
- package/src/sap/ui/mdc/flexibility/AggregateFlex.js +19 -38
- package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
- package/src/sap/ui/mdc/flexibility/ChartTypeFlex.js +23 -41
- package/src/sap/ui/mdc/flexibility/ConditionFlex.js +43 -58
- 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/GroupFlex.js +25 -55
- package/src/sap/ui/mdc/flexibility/ItemBaseFlex.js +21 -42
- package/src/sap/ui/mdc/flexibility/SortFlex.js +23 -52
- package/src/sap/ui/mdc/flexibility/Table.flexibility.js +3 -3
- package/src/sap/ui/mdc/flexibility/Util.js +82 -0
- package/src/sap/ui/mdc/flexibility/xConfigFlex.js +137 -0
- package/src/sap/ui/mdc/flp/FlpLinkDelegate.js +3 -1
- package/src/sap/ui/mdc/library.js +6 -17
- 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/ContactDetailsRenderer.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 +9 -1
- package/src/sap/ui/mdc/link/Panel.js +25 -13
- package/src/sap/ui/mdc/link/PanelItem.js +10 -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 +13 -1
- package/src/sap/ui/mdc/messagebundle_ar.properties +11 -3
- package/src/sap/ui/mdc/messagebundle_bg.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_ca.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_cs.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_cy.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_da.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_de.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_el.properties +20 -12
- package/src/sap/ui/mdc/messagebundle_en.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_en_GB.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +8 -0
- package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +8 -0
- package/src/sap/ui/mdc/messagebundle_es.properties +15 -7
- package/src/sap/ui/mdc/messagebundle_es_MX.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_et.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_fi.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_fr.properties +10 -2
- package/src/sap/ui/mdc/messagebundle_fr_CA.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_hi.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_hr.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_hu.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_id.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_it.properties +10 -2
- package/src/sap/ui/mdc/messagebundle_iw.properties +10 -2
- package/src/sap/ui/mdc/messagebundle_ja.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_kk.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_ko.properties +11 -3
- package/src/sap/ui/mdc/messagebundle_lt.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_lv.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_ms.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_nl.properties +23 -15
- package/src/sap/ui/mdc/messagebundle_no.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_pl.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_pt.properties +18 -10
- package/src/sap/ui/mdc/messagebundle_pt_PT.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_ro.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_ru.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_sh.properties +10 -2
- package/src/sap/ui/mdc/messagebundle_sk.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_sl.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_sv.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_th.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_tr.properties +11 -3
- package/src/sap/ui/mdc/messagebundle_uk.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_vi.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_zh_CN.properties +9 -1
- package/src/sap/ui/mdc/messagebundle_zh_TW.properties +10 -2
- package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
- package/src/sap/ui/mdc/mixin/DelegateMixin.js +1 -1
- package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +1 -1
- package/src/sap/ui/mdc/mixin/PromiseMixin.js +1 -1
- package/src/sap/ui/mdc/mixin/PropertyHelperMixin.js +4 -4
- package/src/sap/ui/mdc/odata/TypeUtil.js +25 -2
- package/src/sap/ui/mdc/odata/v4/ChartPropertyHelper.js +5 -5
- package/src/sap/ui/mdc/odata/v4/FieldBaseDelegate.js +6 -0
- package/src/sap/ui/mdc/odata/v4/TypeUtil.js +6 -6
- package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +0 -33
- package/src/sap/ui/mdc/odata/v4/vizChart/ChartDelegate.js +378 -154
- package/src/sap/ui/mdc/p13n/Engine.js +8 -4
- package/src/sap/ui/mdc/p13n/PersistenceProvider.js +1 -0
- 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/modules/DefaultProviderRegistry.js +14 -11
- package/src/sap/ui/mdc/p13n/panels/ActionToolbarPanel.js +133 -0
- package/src/sap/ui/mdc/p13n/panels/FilterPanel.js +41 -42
- package/src/sap/ui/mdc/p13n/panels/GroupView.js +1 -0
- package/src/sap/ui/mdc/p13n/panels/LinkSelectionPanel.js +12 -4
- package/src/sap/ui/mdc/p13n/subcontroller/ActionToolbarController.js +1 -1
- package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +1 -1
- package/src/sap/ui/mdc/p13n/subcontroller/LinkPanelController.js +22 -27
- package/src/sap/ui/mdc/table/Column.js +4 -1
- package/src/sap/ui/mdc/table/CreationRow.js +3 -1
- package/src/sap/ui/mdc/table/GridTableType.js +0 -5
- package/src/sap/ui/mdc/table/PropertyHelper.js +27 -74
- package/src/sap/ui/mdc/table/ResponsiveTableType.js +29 -17
- package/src/sap/ui/mdc/table/RowActionItem.js +1 -1
- package/src/sap/ui/mdc/table/RowSettings.js +1 -1
- package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
- package/src/sap/ui/mdc/table/menu/QuickActionContainer.js +3 -3
- package/src/sap/ui/mdc/themes/base/Chart.less +5 -0
- package/src/sap/ui/mdc/themes/base/InfoPanel.less +1 -0
- package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +5 -0
- package/src/sap/ui/mdc/util/DateUtil.js +30 -5
- package/src/sap/ui/mdc/util/FilterUtil.js +2 -2
- package/src/sap/ui/mdc/util/PromiseCache.js +1 -1
- package/src/sap/ui/mdc/util/PropertyHelper.js +1 -1
- package/src/sap/ui/mdc/util/TypeUtil.js +105 -17
- package/src/sap/ui/mdc/valuehelp/Dialog.js +148 -48
- package/src/sap/ui/mdc/valuehelp/Popover.js +16 -3
- package/src/sap/ui/mdc/valuehelp/base/Container.js +45 -32
- package/src/sap/ui/mdc/valuehelp/base/Content.js +60 -28
- package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +5 -5
- package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +75 -32
- package/src/sap/ui/mdc/valuehelp/base/ListContent.js +3 -3
- package/src/sap/ui/mdc/valuehelp/content/Bool.js +4 -4
- package/src/sap/ui/mdc/valuehelp/content/Conditions.js +11 -3
- package/src/sap/ui/mdc/valuehelp/content/FixedList.js +1 -1
- package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +7 -3
- package/src/sap/ui/mdc/valuehelp/content/MTable.js +9 -3
- package/test/sap/ui/mdc/testutils/opa/chart/ActionsBase.js +48 -2
- package/test/sap/ui/mdc/testutils/opa/chart/TestObjects.js +3 -3
- package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +3 -3
- package/test/sap/ui/mdc/testutils/opa/filterbar/Actions.js +55 -4
- package/test/sap/ui/mdc/testutils/opa/filterbar/TestObjects.js +2 -2
- package/test/sap/ui/mdc/testutils/opa/link/Actions.js +53 -12
- package/test/sap/ui/mdc/testutils/opa/link/TestObjects.js +6 -6
- package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +121 -202
- package/test/sap/ui/mdc/testutils/opa/p13n/waitForSelectWithSelectedTextOnPanel.js +5 -2
- package/test/sap/ui/mdc/testutils/opa/table/Actions.js +70 -0
- package/test/sap/ui/mdc/testutils/opa/table/TestObjects.js +9 -7
- package/test/sap/ui/mdc/testutils/opa/valueHelp/Actions.js +2 -2
- package/src/sap/ui/mdc/flexibility/AggregationConfigFlex.js +0 -139
- package/src/sap/ui/mdc/valuehelp/content/ListCollection.js +0 -205
|
@@ -36,9 +36,12 @@ sap.ui.define([
|
|
|
36
36
|
merge,
|
|
37
37
|
whitespaceReplacer,
|
|
38
38
|
SyncPromise
|
|
39
|
-
|
|
39
|
+
) {
|
|
40
40
|
"use strict";
|
|
41
41
|
|
|
42
|
+
var sTargetTypeRaw = "sap.ui.mdc.raw";
|
|
43
|
+
var sTargetTypeRawComposite = "sap.ui.mdc.raw:";
|
|
44
|
+
|
|
42
45
|
/**
|
|
43
46
|
* Constructor for a Condition type.
|
|
44
47
|
*
|
|
@@ -48,7 +51,7 @@ sap.ui.define([
|
|
|
48
51
|
* @extends sap.ui.model.SimpleType
|
|
49
52
|
*
|
|
50
53
|
* @author SAP SE
|
|
51
|
-
* @version 1.
|
|
54
|
+
* @version 1.103.0
|
|
52
55
|
*
|
|
53
56
|
* @since 1.62.0
|
|
54
57
|
* @private
|
|
@@ -56,7 +59,7 @@ sap.ui.define([
|
|
|
56
59
|
* @MDC_PUBLIC_CANDIDATE
|
|
57
60
|
*
|
|
58
61
|
* @param {object} [oFormatOptions] Formatting options
|
|
59
|
-
* @param {sap.ui.model.Type} [oFormatOptions.valueType] Type of the value of the condition (used for formatting and
|
|
62
|
+
* @param {sap.ui.model.Type} [oFormatOptions.valueType] Type of the value of the condition (used for formatting, parsing and validating)
|
|
60
63
|
* @param {string[]} [oFormatOptions.operators] Possible operators to be used in the condition
|
|
61
64
|
* @param {sap.ui.mdc.enum.FieldDisplay} [oFormatOptions.display] DisplayFormat used to visualize a value
|
|
62
65
|
* @param {string} [oFormatOptions.fieldHelpID] ID of the field help to determine the key and description // TODO: async request????
|
|
@@ -65,6 +68,7 @@ sap.ui.define([
|
|
|
65
68
|
* @param {sap.ui.model.Context} [oFormatOptions.bindingContext] <code>BindingContext</code> of field. Used to get a key or description from the value help using in/out parameters. (In a table, the value help might be connected to a different row)
|
|
66
69
|
* @param {sap.ui.model.Type} [oFormatOptions.originalDateType] Type used on field, for example, for date types; a different type is used internally to have different <code>formatOptions</code>
|
|
67
70
|
* @param {sap.ui.model.Type} [oFormatOptions.additionalType] additional Type used on other part of a field. (This is the case for unit fields.)
|
|
71
|
+
* @param {sap.ui.model.Type[]} [oFormatOptions.compositeTypes] additional Types used for parts of a <code>CompositeType</code>
|
|
68
72
|
* @param {function} [oFormatOptions.getConditions] Function to get the existing conditions of the field. Only used if <code>isUnit</code> is set. // TODO: better solution
|
|
69
73
|
* @param {function} [oFormatOptions.asyncParsing] Callback function to tell the <code>Field</code> the parsing is asynchronous.
|
|
70
74
|
* @param {object} [oFormatOptions.navigateCondition] Condition of keyboard navigation. If this is filled, no real parsing is needed as the condition has already been determined and is just returned
|
|
@@ -103,7 +107,28 @@ sap.ui.define([
|
|
|
103
107
|
|
|
104
108
|
};
|
|
105
109
|
|
|
106
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Formats the given condition to an output value of the given target type.
|
|
112
|
+
* This values are formatted using the given data type. Depending of the operator
|
|
113
|
+
* and the configuration (set in <code>FormatOptions</code>) a description will be determined via given value help or delegate.
|
|
114
|
+
*
|
|
115
|
+
* @param {sap.ui.mdc.condition.ConditionObject} oCondition
|
|
116
|
+
* The condition to be formatted
|
|
117
|
+
* @param {string} sTargetType
|
|
118
|
+
* The target type; see {@link topic:ac56d92162ed47ff858fdf1ce26c18c4 Allowed Property Types}
|
|
119
|
+
* In addition to the standard target types <code>sap.ui.mdc.raw</code> can be used. In this case the value is not formatted and just
|
|
120
|
+
* forwarded to the target. If the value is an array representing data for a <code>CompositeType</code> the index of the needed raw value can be added to the
|
|
121
|
+
* name (For example if a unit should be forwarded as raw value <code>sap.ui.mdc.raw:1</code> can be used).
|
|
122
|
+
* @return {any|Promise}
|
|
123
|
+
* The formatted output value or a <code>Promise</code> resolving with the formatted value
|
|
124
|
+
* @throws {sap.ui.model.FormatException}
|
|
125
|
+
* If formatting to the target type is not possible
|
|
126
|
+
*
|
|
127
|
+
* @private
|
|
128
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
129
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
130
|
+
*/
|
|
131
|
+
ConditionType.prototype.formatValue = function(oCondition, sTargetType) {
|
|
107
132
|
|
|
108
133
|
if (oCondition == undefined || oCondition == null || this._bDestroyed) { // if destroyed do nothing
|
|
109
134
|
return null;
|
|
@@ -114,8 +139,8 @@ sap.ui.define([
|
|
|
114
139
|
throw new FormatException("No valid condition provided");
|
|
115
140
|
}
|
|
116
141
|
|
|
117
|
-
if (!
|
|
118
|
-
|
|
142
|
+
if (!sTargetType) {
|
|
143
|
+
sTargetType = "string";
|
|
119
144
|
}
|
|
120
145
|
|
|
121
146
|
var oType = _getValueType.call(this);
|
|
@@ -124,7 +149,7 @@ sap.ui.define([
|
|
|
124
149
|
|
|
125
150
|
_attachCurrentValueAtType.call(this, oCondition, oType); // use original condition
|
|
126
151
|
|
|
127
|
-
switch (this.getPrimitiveType(
|
|
152
|
+
switch (this.getPrimitiveType(sTargetType)) {
|
|
128
153
|
case "string":
|
|
129
154
|
case "any":
|
|
130
155
|
var sDisplay = _getDisplay.call(this);
|
|
@@ -145,7 +170,7 @@ sap.ui.define([
|
|
|
145
170
|
var vKey = bIsUnit ? oCondition.values[0][1] : oCondition.values[0];
|
|
146
171
|
|
|
147
172
|
return SyncPromise.resolve().then(function() {
|
|
148
|
-
return _getDescription.call(this, vKey, oCondition, oBindingContext, oConditionModel, sConditionModelName);
|
|
173
|
+
return _getDescription.call(this, vKey, oCondition, oType, oBindingContext, oConditionModel, sConditionModelName);
|
|
149
174
|
}.bind(this)).then(function(vDescription) { // if description needs to be requested -> return if it is resolved
|
|
150
175
|
if (vDescription) {
|
|
151
176
|
oCondition = merge({}, oCondition); // do not manipulate original object
|
|
@@ -180,12 +205,20 @@ sap.ui.define([
|
|
|
180
205
|
|
|
181
206
|
return _returnResult.call(this, oCondition, undefined, iCallCount, true, oType);
|
|
182
207
|
default:
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
208
|
+
var iIndex = _getIndexOfRawValue(sTargetType);
|
|
209
|
+
if (iIndex >= 0) {
|
|
210
|
+
if (_isCompositeType.call(this, oType)) {
|
|
211
|
+
//used for compositeTypes if just one value needs to be transfered without any formatting (e.g. for Timezone)
|
|
212
|
+
return oCondition.values.length >= 1 ? oCondition.values[0][iIndex] : null;
|
|
213
|
+
}
|
|
214
|
+
} else if (sTargetType === sTargetTypeRaw) {
|
|
215
|
+
return oCondition.values.length >= 1 ? oCondition.values[0] : null; // TODO: how to handle operators <> EQ
|
|
216
|
+
} else if (oType && oCondition.values.length >= 1) {
|
|
217
|
+
// operators can only be formatted to string. But other controls (like Slider) might just use the value
|
|
218
|
+
return oType.formatValue(oCondition.values[0], sTargetType);
|
|
186
219
|
}
|
|
187
220
|
|
|
188
|
-
throw new FormatException("Don't know how to format Condition to " +
|
|
221
|
+
throw new FormatException("Don't know how to format Condition to " + sTargetType);
|
|
189
222
|
}
|
|
190
223
|
|
|
191
224
|
};
|
|
@@ -203,12 +236,13 @@ sap.ui.define([
|
|
|
203
236
|
|
|
204
237
|
var bHideOperator = (this.oFormatOptions.hideOperator && oCondition.values.length === 1) || bIsUnit;
|
|
205
238
|
var oOperator = FilterOperatorUtil.getOperator(oCondition.operator);
|
|
239
|
+
var aCompositeTypes = _getCompositeTypes.call(this);
|
|
206
240
|
|
|
207
241
|
if (!oOperator) {
|
|
208
242
|
throw new FormatException("No valid condition provided, Operator wrong.");
|
|
209
243
|
}
|
|
210
244
|
|
|
211
|
-
var sResult = oOperator.format(oCondition, oType, sDisplay, bHideOperator);
|
|
245
|
+
var sResult = oOperator.format(oCondition, oType, sDisplay, bHideOperator, aCompositeTypes);
|
|
212
246
|
var bConvertWhitespaces = this.oFormatOptions.convertWhitespaces;
|
|
213
247
|
|
|
214
248
|
if (bConvertWhitespaces && (_getBaseType.call(this, oType) === BaseType.String || sDisplay !== FieldDisplay.Value)) {
|
|
@@ -254,22 +288,47 @@ sap.ui.define([
|
|
|
254
288
|
|
|
255
289
|
}
|
|
256
290
|
|
|
257
|
-
|
|
291
|
+
/**
|
|
292
|
+
* Parses an external value of the given source type to a condition that holds the value in model
|
|
293
|
+
* representation.
|
|
294
|
+
* These values are parsed using the given data type. Depending of the operator
|
|
295
|
+
* and the configuration (set in <code>FormatOptions</code>) a value will be determined via given value help or delegate.
|
|
296
|
+
*
|
|
297
|
+
* @param {any} vValue
|
|
298
|
+
* The value to be parsed
|
|
299
|
+
* @param {string} sSourceType
|
|
300
|
+
* The type of the given value; see
|
|
301
|
+
* {@link topic:ac56d92162ed47ff858fdf1ce26c18c4 Allowed Property Types}
|
|
302
|
+
* In addition to the standard source types <code>sap.ui.mdc.raw</code> can be used. In this case the value is not parsed and just
|
|
303
|
+
* used in the condition. If the value of the condition is an array representing data for a <code>CompositeType</code> the index of the needed raw value can be added to the
|
|
304
|
+
* name (For example if a unit should be forwarded as raw value <code>sap.ui.mdc.raw:1</code> can be used).
|
|
305
|
+
* @return {null|sap.ui.mdc.condition.ConditionObject|Promise<null|sap.ui.mdc.condition.ConditionObject>}
|
|
306
|
+
* The condition or a <code>Promise</code> resolving with the condition.
|
|
307
|
+
* If there is no value <code>null</code> is returned.
|
|
308
|
+
* @throws {sap.ui.model.ParseException}
|
|
309
|
+
* If parsing to the model type is not possible; the message of the exception is language
|
|
310
|
+
* dependent as it may be displayed on the UI
|
|
311
|
+
*
|
|
312
|
+
* @private
|
|
313
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
314
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
315
|
+
*/
|
|
316
|
+
ConditionType.prototype.parseValue = function(vValue, sSourceType) {
|
|
258
317
|
|
|
259
318
|
if (this._bDestroyed) { // if destroyed do nothing
|
|
260
319
|
return null;
|
|
261
320
|
}
|
|
262
321
|
|
|
263
|
-
if (!
|
|
264
|
-
|
|
265
|
-
} else if (
|
|
266
|
-
|
|
322
|
+
if (!sSourceType) {
|
|
323
|
+
sSourceType = "string";
|
|
324
|
+
} else if (sSourceType === "any" && typeof vValue === "string") {
|
|
325
|
+
sSourceType = "string";
|
|
267
326
|
}
|
|
268
327
|
|
|
269
328
|
var oNavigateCondition = this.oFormatOptions.navigateCondition;
|
|
270
329
|
if (oNavigateCondition) {
|
|
271
330
|
// condition already known from navigation. Just check if it is really the same as the input.
|
|
272
|
-
var vOutput = this.formatValue(oNavigateCondition,
|
|
331
|
+
var vOutput = this.formatValue(oNavigateCondition, sSourceType);
|
|
273
332
|
if (vOutput === vValue) {
|
|
274
333
|
return merge({}, oNavigateCondition); // use copy
|
|
275
334
|
}
|
|
@@ -291,7 +350,7 @@ sap.ui.define([
|
|
|
291
350
|
|
|
292
351
|
_initCurrentValueAtType.call(this, oType);
|
|
293
352
|
|
|
294
|
-
switch (this.getPrimitiveType(
|
|
353
|
+
switch (this.getPrimitiveType(sSourceType)) {
|
|
295
354
|
case "string":
|
|
296
355
|
var oOperator;
|
|
297
356
|
var bCheckForDefault = false;
|
|
@@ -335,6 +394,7 @@ sap.ui.define([
|
|
|
335
394
|
}
|
|
336
395
|
var oCondition;
|
|
337
396
|
var bCompositeType = _isCompositeType.call(this, oType);
|
|
397
|
+
var aCompositeTypes = _getCompositeTypes.call(this);
|
|
338
398
|
this._oCalls.active++;
|
|
339
399
|
this._oCalls.last++;
|
|
340
400
|
var iCallCount = this._oCalls.last;
|
|
@@ -354,7 +414,7 @@ sap.ui.define([
|
|
|
354
414
|
// parse using unit part
|
|
355
415
|
oCondition = Condition.createCondition(oOperator.name, [oType.parseValue(vValue, "string", oType._aCurrentValue)], undefined, undefined, ConditionValidated.NotValidated);
|
|
356
416
|
} else {
|
|
357
|
-
oCondition = oOperator.getCondition(vValue, oType, sDisplay, bUseDefaultOperator);
|
|
417
|
+
oCondition = oOperator.getCondition(vValue, oType, sDisplay, bUseDefaultOperator, aCompositeTypes);
|
|
358
418
|
}
|
|
359
419
|
} catch (oException) {
|
|
360
420
|
var oMyException = oException;
|
|
@@ -393,10 +453,22 @@ sap.ui.define([
|
|
|
393
453
|
}
|
|
394
454
|
}
|
|
395
455
|
if (sDefaultOperator) {
|
|
396
|
-
|
|
456
|
+
var iIndex = _getIndexOfRawValue(sSourceType);
|
|
457
|
+
if (iIndex >= 0) {
|
|
458
|
+
if (_isCompositeType.call(this, oType)) {
|
|
459
|
+
//used for compositeTypes if just one value needs to be transfered without any parsing (Timezone)
|
|
460
|
+
var aValue = merge([], oType._aCurrentValue);
|
|
461
|
+
aValue[iIndex] = vValue;
|
|
462
|
+
return Condition.createCondition(sDefaultOperator, [aValue], undefined, undefined, ConditionValidated.NotValidated);
|
|
463
|
+
}
|
|
464
|
+
} else if (sSourceType === sTargetTypeRaw) {
|
|
465
|
+
return Condition.createCondition(sDefaultOperator, [vValue], undefined, undefined, ConditionValidated.NotValidated);
|
|
466
|
+
} else {
|
|
467
|
+
return Condition.createCondition(sDefaultOperator, [oType.parseValue(vValue, sSourceType)], undefined, undefined, ConditionValidated.NotValidated);
|
|
468
|
+
}
|
|
397
469
|
}
|
|
398
470
|
}
|
|
399
|
-
throw new ParseException("Don't know how to parse Condition from " +
|
|
471
|
+
throw new ParseException("Don't know how to parse Condition from " + sSourceType);
|
|
400
472
|
}
|
|
401
473
|
|
|
402
474
|
};
|
|
@@ -404,16 +476,21 @@ sap.ui.define([
|
|
|
404
476
|
function _finishParseFromString(oCondition, oType) {
|
|
405
477
|
|
|
406
478
|
var bIsUnit = _isUnit(oType);
|
|
479
|
+
var bCompositeType = _isCompositeType.call(this, oType);
|
|
407
480
|
|
|
408
|
-
if (oCondition && !bIsUnit) {
|
|
409
|
-
var
|
|
481
|
+
if (oCondition && !bIsUnit && bCompositeType) {
|
|
482
|
+
var oOriginalType = _getOriginalType.call(this) || oType; // use original type for determination if unit as valueType might mapped different (if no original type, valueType is original)
|
|
483
|
+
var sName = oOriginalType.getMetadata().getName();
|
|
484
|
+
var oFormatOptions = oOriginalType.getFormatOptions();
|
|
485
|
+
var oConstraints = oOriginalType.getConstraints();
|
|
410
486
|
var oDelegate = this.oFormatOptions.delegate;
|
|
411
487
|
var oPayload = this.oFormatOptions.payload;
|
|
412
|
-
|
|
488
|
+
var sBaseType = oDelegate && oDelegate.getTypeUtil(oPayload).getBaseType(sName, oFormatOptions, oConstraints); // don't use _getBaseType to get "real" unit type
|
|
489
|
+
if ((sBaseType === BaseType.Unit || sBaseType === BaseType.DateTime) &&
|
|
413
490
|
!oCondition.values[0][1] && oType._aCurrentValue) {
|
|
414
491
|
// TODO: if no unit provided use last one
|
|
415
492
|
var sUnit = oType._aCurrentValue[1] ? oType._aCurrentValue[1] : null; // if no unit set null
|
|
416
|
-
oCondition.values[0][1] =
|
|
493
|
+
oCondition.values[0][1] = sUnit;
|
|
417
494
|
if (oCondition.operator === "BT") {
|
|
418
495
|
oCondition.values[1][1] = sUnit;
|
|
419
496
|
}
|
|
@@ -549,7 +626,7 @@ sap.ui.define([
|
|
|
549
626
|
}
|
|
550
627
|
|
|
551
628
|
return SyncPromise.resolve().then(function() {
|
|
552
|
-
return _getItemForValue.call(this, vCheckValue, vCheckParsedValue, oBindingContext, bCheckKeyFirst, bCheckKey, bCheckDescription, oConditionModel, sConditionModelName);
|
|
629
|
+
return _getItemForValue.call(this, vCheckValue, vCheckParsedValue, oType, oBindingContext, bCheckKeyFirst, bCheckKey, bCheckDescription, oConditionModel, sConditionModelName);
|
|
553
630
|
}.bind(this)).then(function(oResult) {
|
|
554
631
|
return fnGetResult.call(this, oResult, fnSuccess);
|
|
555
632
|
}.bind(this)).catch(function(oException) {
|
|
@@ -609,12 +686,28 @@ sap.ui.define([
|
|
|
609
686
|
|
|
610
687
|
}
|
|
611
688
|
|
|
689
|
+
/**
|
|
690
|
+
* Validates a given condition. The values of the condition are validated using the given data type.
|
|
691
|
+
*
|
|
692
|
+
* @param {sap.ui.mdc.condition.ConditionObject} oCondition
|
|
693
|
+
* The condition to be validated
|
|
694
|
+
* @returns {void|Promise}
|
|
695
|
+
* <code>undefined</code> or a <code>Promise</code> resolving with an undefined value
|
|
696
|
+
* @throws {sap.ui.model.ValidateException}
|
|
697
|
+
* If at least one of the values of the condition is not valid for the given data type; the message of the exception is
|
|
698
|
+
* language dependent as it may be displayed on the UI
|
|
699
|
+
*
|
|
700
|
+
* @private
|
|
701
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
702
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
703
|
+
*/
|
|
612
704
|
ConditionType.prototype.validateValue = function(oCondition) {
|
|
613
705
|
|
|
614
706
|
var oType = _getValueType.call(this);
|
|
615
707
|
var oOriginalType = _getOriginalType.call(this);
|
|
616
708
|
var aOperators = _getOperators.call(this);
|
|
617
709
|
var bIsUnit = _isUnit(oType);
|
|
710
|
+
var aCompositeTypes = _getCompositeTypes.call(this);
|
|
618
711
|
|
|
619
712
|
if (oCondition === undefined || this._bDestroyed) { // if destroyed do nothing
|
|
620
713
|
return null;
|
|
@@ -659,13 +752,13 @@ sap.ui.define([
|
|
|
659
752
|
}
|
|
660
753
|
|
|
661
754
|
try {
|
|
662
|
-
oOperator.validate(oCondition.values, oType);
|
|
755
|
+
oOperator.validate(oCondition.values, oType, aCompositeTypes);
|
|
663
756
|
} catch (oException) {
|
|
664
757
|
if (oException instanceof ValidateException && oOriginalType) {
|
|
665
758
|
// As internal yyyy-MM-dd is used as pattern for dates (times similar) the
|
|
666
759
|
// ValidateException might contain this as pattern. The user should see the pattern thats shown
|
|
667
760
|
// So try to validate date with the original type to get ValidateException with right pattern.
|
|
668
|
-
oOperator.validate(oCondition.values, oOriginalType);
|
|
761
|
+
oOperator.validate(oCondition.values, oOriginalType, aCompositeTypes);
|
|
669
762
|
}
|
|
670
763
|
throw oException;
|
|
671
764
|
}
|
|
@@ -748,13 +841,22 @@ sap.ui.define([
|
|
|
748
841
|
|
|
749
842
|
}
|
|
750
843
|
|
|
844
|
+
function _getCompositeTypes() {
|
|
845
|
+
|
|
846
|
+
return this.oFormatOptions.compositeTypes;
|
|
847
|
+
|
|
848
|
+
}
|
|
849
|
+
|
|
751
850
|
function _isUnit(oType) {
|
|
752
851
|
|
|
753
852
|
if (_isCompositeType(oType)) {
|
|
754
853
|
var oFormatOptions = oType.getFormatOptions();
|
|
755
854
|
var bShowMeasure = !oFormatOptions || !oFormatOptions.hasOwnProperty("showMeasure") || oFormatOptions.showMeasure;
|
|
756
855
|
var bShowNumber = !oFormatOptions || !oFormatOptions.hasOwnProperty("showNumber") || oFormatOptions.showNumber;
|
|
757
|
-
|
|
856
|
+
var bShowTimezone = !oFormatOptions || !oFormatOptions.hasOwnProperty("showTimezone") || oFormatOptions.showTimezone; // handle timezone as unit
|
|
857
|
+
var bShowDate = !oFormatOptions || !oFormatOptions.hasOwnProperty("showDate") || oFormatOptions.showDate;
|
|
858
|
+
var bShowTime = !oFormatOptions || !oFormatOptions.hasOwnProperty("showTime") || oFormatOptions.showTime;
|
|
859
|
+
if ((bShowMeasure && !bShowNumber) || (bShowTimezone && !bShowDate && !bShowTime)) {
|
|
758
860
|
return true;
|
|
759
861
|
}
|
|
760
862
|
}
|
|
@@ -766,16 +868,16 @@ sap.ui.define([
|
|
|
766
868
|
function _attachCurrentValueAtType(oCondition, oType) {
|
|
767
869
|
|
|
768
870
|
if (_isCompositeType.call(this, oType) && oCondition && oCondition.values[0]) {
|
|
769
|
-
oType._aCurrentValue = oCondition.values[0];
|
|
871
|
+
oType._aCurrentValue = merge([], oCondition.values[0]); // use copy to prevent changes on original arry change aCurrentValue too
|
|
770
872
|
|
|
771
873
|
var oAdditionalType = _getAdditionalType.call(this);
|
|
772
874
|
if (_isCompositeType.call(this, oAdditionalType)) { // store in corresponding unit or measure type too
|
|
773
|
-
oAdditionalType._aCurrentValue = oCondition.values[0];
|
|
875
|
+
oAdditionalType._aCurrentValue = merge([], oCondition.values[0]);
|
|
774
876
|
}
|
|
775
877
|
|
|
776
878
|
var oOriginalType = _getOriginalType.call(this);
|
|
777
879
|
if (_isCompositeType.call(this, oOriginalType)) { // store in original type too (Currently not used in Unit/Currency type, but basically in CompositeType for parsing)
|
|
778
|
-
oOriginalType._aCurrentValue = oCondition.values[0];
|
|
880
|
+
oOriginalType._aCurrentValue = merge([], oCondition.values[0]);
|
|
779
881
|
}
|
|
780
882
|
}
|
|
781
883
|
|
|
@@ -868,7 +970,7 @@ sap.ui.define([
|
|
|
868
970
|
|
|
869
971
|
}
|
|
870
972
|
|
|
871
|
-
function _getItemForValue(vValue, vParsedValue, oBindingContext, bCheckKeyFirst, bCheckKey, bCheckDescription, oConditionModel, sConditionModelName) {
|
|
973
|
+
function _getItemForValue(vValue, vParsedValue, oType, oBindingContext, bCheckKeyFirst, bCheckKey, bCheckDescription, oConditionModel, sConditionModelName) {
|
|
872
974
|
|
|
873
975
|
var oFieldHelp = _getFieldHelp.call(this);
|
|
874
976
|
var oDelegate = this.oFormatOptions.delegate;
|
|
@@ -877,6 +979,7 @@ sap.ui.define([
|
|
|
877
979
|
var oConfig = {
|
|
878
980
|
value: vValue,
|
|
879
981
|
parsedValue: vParsedValue,
|
|
982
|
+
dataType: oType,
|
|
880
983
|
inParameters: undefined, // TODO: needed?
|
|
881
984
|
outParameters: undefined, // TODO: needed?
|
|
882
985
|
bindingContext: oBindingContext,
|
|
@@ -899,31 +1002,32 @@ sap.ui.define([
|
|
|
899
1002
|
|
|
900
1003
|
}
|
|
901
1004
|
|
|
902
|
-
function _getDescription(vKey, oCondition, oBindingContext, oConditionModel, sConditionModelName) {
|
|
1005
|
+
function _getDescription(vKey, oCondition, oType, oBindingContext, oConditionModel, sConditionModelName) {
|
|
903
1006
|
|
|
904
1007
|
var oFieldHelp = _getFieldHelp.call(this);
|
|
905
1008
|
var oDelegate = this.oFormatOptions.delegate;
|
|
906
1009
|
var oPayload = this.oFormatOptions.payload;
|
|
907
1010
|
var oControl = this.oFormatOptions.control;
|
|
908
1011
|
if (oDelegate) {
|
|
909
|
-
return oDelegate.getDescription(oPayload, oFieldHelp, vKey, oCondition.inParameters, oCondition.outParameters, oBindingContext, oConditionModel, sConditionModelName, oCondition.payload, oControl);
|
|
1012
|
+
return oDelegate.getDescription(oPayload, oFieldHelp, vKey, oCondition.inParameters, oCondition.outParameters, oBindingContext, oConditionModel, sConditionModelName, oCondition.payload, oControl, oType);
|
|
910
1013
|
} else if (oFieldHelp) {
|
|
911
1014
|
if (oFieldHelp.isA("sap.ui.mdc.ValueHelp")) {
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1015
|
+
var oConfig = {
|
|
1016
|
+
value: vKey,
|
|
1017
|
+
parsedValue: vKey,
|
|
1018
|
+
dataType: oType,
|
|
1019
|
+
context: {inParameters: oCondition.inParameters, outParameters: oCondition.outParameters, payload: oCondition.payload},
|
|
1020
|
+
bindingContext: oBindingContext,
|
|
1021
|
+
conditionModel: oConditionModel,
|
|
1022
|
+
conditionModelName: sConditionModelName,
|
|
1023
|
+
checkKey: true,
|
|
1024
|
+
checkDescription: false,
|
|
1025
|
+
caseSensitive: true, // case sensitive as used to get description for known key
|
|
1026
|
+
exception: FormatException,
|
|
1027
|
+
control: oControl
|
|
1028
|
+
};
|
|
1029
|
+
return oFieldHelp.getItemForValue(oConfig);
|
|
1030
|
+
} else {
|
|
927
1031
|
return oFieldHelp.getTextForKey(vKey, oCondition.inParameters, oCondition.outParameters, oBindingContext, oConditionModel, sConditionModelName);
|
|
928
1032
|
}
|
|
929
1033
|
}
|
|
@@ -956,6 +1060,16 @@ sap.ui.define([
|
|
|
956
1060
|
|
|
957
1061
|
}
|
|
958
1062
|
|
|
1063
|
+
function _getIndexOfRawValue(sType) {
|
|
1064
|
+
|
|
1065
|
+
var iIndex = -1;
|
|
1066
|
+
if (sType.startsWith(sTargetTypeRawComposite)) {
|
|
1067
|
+
iIndex = parseInt(sType[sTargetTypeRawComposite.length]);
|
|
1068
|
+
}
|
|
1069
|
+
return iIndex;
|
|
1070
|
+
|
|
1071
|
+
}
|
|
1072
|
+
|
|
959
1073
|
return ConditionType;
|
|
960
1074
|
|
|
961
1075
|
});
|
|
@@ -36,7 +36,7 @@ sap.ui.define([
|
|
|
36
36
|
* @extends sap.ui.model.SimpleType
|
|
37
37
|
*
|
|
38
38
|
* @author SAP SE
|
|
39
|
-
* @version 1.
|
|
39
|
+
* @version 1.103.0
|
|
40
40
|
*
|
|
41
41
|
* @since 1.62.0
|
|
42
42
|
* @private
|
|
@@ -44,7 +44,7 @@ sap.ui.define([
|
|
|
44
44
|
* @MDC_PUBLIC_CANDIDATE
|
|
45
45
|
*
|
|
46
46
|
* @param {object} [oFormatOptions] Formatting options
|
|
47
|
-
* @param {sap.ui.model.Type} [oFormatOptions.valueType] Type of the value of the condition (used for formatting and
|
|
47
|
+
* @param {sap.ui.model.Type} [oFormatOptions.valueType] Type of the value of the condition (used for formatting, parsing and validating)
|
|
48
48
|
* @param {string[]} [oFormatOptions.operators] Possible operators to be used in the condition
|
|
49
49
|
* @param {sap.ui.mdc.enum.FieldDisplay} [oFormatOptions.display] DisplayFormat used to visualize a value
|
|
50
50
|
* @param {string} [oFormatOptions.fieldHelpID] ID of the field help to determine the key and description // TODO: async request????
|
|
@@ -53,6 +53,7 @@ sap.ui.define([
|
|
|
53
53
|
* @param {sap.ui.model.Context} [oFormatOptions.bindingContext] <code>BindingContext</code> of field. Used to get a key or description from the value help using in/out parameters. (In a table, the value help might be connected to a different row)
|
|
54
54
|
* @param {sap.ui.model.Type} [oFormatOptions.originalDateType] Type used on field, for example, for date types; a different type is used internally to have different <code>formatOptions</code>
|
|
55
55
|
* @param {sap.ui.model.Type} [oFormatOptions.additionalType] additional Type used on other part of a field. (This is the case for unit fields.)
|
|
56
|
+
* @param {sap.ui.model.Type[]} [oFormatOptions.compositeTypes] additional Types used for parts of a <code>CompositeType</code>
|
|
56
57
|
* @param {function} [oFormatOptions.getConditions] Function to get the existing conditions of the field. Only used if <code>isUnit</code> is set. TODO: better solution
|
|
57
58
|
* @param {function} [oFormatOptions.asyncParsing] Callback function to tell the <code>Field</code> the parsing is asynchronous.
|
|
58
59
|
* @param {object} [oFormatOptions.navigateCondition] Condition of keyboard navigation. If this is filled, no real parsing is needed as the condition has already been determined and is just returned
|
|
@@ -127,7 +128,28 @@ sap.ui.define([
|
|
|
127
128
|
|
|
128
129
|
};
|
|
129
130
|
|
|
130
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Formats the given conditions to an output value of the given target type.
|
|
133
|
+
* This values are formatted using the given data type. Depending of the operator
|
|
134
|
+
* and the configuration (set in <code>FormatOptions</code>) a description will be determined via given value help or delegate.
|
|
135
|
+
*
|
|
136
|
+
* @param {sap.ui.mdc.condition.ConditionObject[]} aConditions
|
|
137
|
+
* The conditions to be formatted
|
|
138
|
+
* @param {string} sTargetType
|
|
139
|
+
* The target type; see {@link topic:ac56d92162ed47ff858fdf1ce26c18c4 Allowed Property Types}
|
|
140
|
+
* In addition to the standard target types <code>sap.ui.mdc.raw</code> can be used. In this case the value is not formatted and just
|
|
141
|
+
* forwarded to the target. If the value is an array representing data for a <code>CompositeType</code> the index of the needed raw value can be added to the
|
|
142
|
+
* name (For example if a unit should be forwarded as raw value <code>sap.ui.mdc.raw:1</code> can be used).
|
|
143
|
+
* @return {any|Promise}
|
|
144
|
+
* The formatted output value or a <code>Promise</code> resolving with the formatted value
|
|
145
|
+
* @throws {sap.ui.model.FormatException}
|
|
146
|
+
* If formatting to the target type is not possible
|
|
147
|
+
*
|
|
148
|
+
* @private
|
|
149
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
150
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
151
|
+
*/
|
|
152
|
+
ConditionsType.prototype.formatValue = function(aConditions, sTargetType) {
|
|
131
153
|
|
|
132
154
|
if (aConditions == undefined || aConditions == null || this._bDestroyed) { // if destroyed do nothing
|
|
133
155
|
return null;
|
|
@@ -139,23 +161,23 @@ sap.ui.define([
|
|
|
139
161
|
|
|
140
162
|
var vValue;
|
|
141
163
|
|
|
142
|
-
if (!
|
|
164
|
+
if (!sTargetType || sTargetType === "string" || sTargetType === "any") {
|
|
143
165
|
vValue = ""; // if string requested use string
|
|
144
|
-
} else if (
|
|
166
|
+
} else if (sTargetType === "float" || sTargetType === "int") {
|
|
145
167
|
vValue = 0; // if number requested use number
|
|
146
168
|
}
|
|
147
169
|
|
|
148
170
|
var iMaxConditions = _getMaxConditions.call(this);
|
|
149
171
|
|
|
150
172
|
var aSyncPromises = [];
|
|
151
|
-
var fnCreateSyncPromise = function (oCondition,
|
|
173
|
+
var fnCreateSyncPromise = function (oCondition, sTargetType) { // as function should not be declared inside a loop
|
|
152
174
|
return SyncPromise.resolve().then(function() {
|
|
153
|
-
return this._oConditionType.formatValue(oCondition,
|
|
175
|
+
return this._oConditionType.formatValue(oCondition, sTargetType);
|
|
154
176
|
}.bind(this));
|
|
155
177
|
};
|
|
156
178
|
|
|
157
179
|
for (var i = 0; i < aConditions.length; i++) {
|
|
158
|
-
aSyncPromises.push(fnCreateSyncPromise.call(this, aConditions[i],
|
|
180
|
+
aSyncPromises.push(fnCreateSyncPromise.call(this, aConditions[i], sTargetType));
|
|
159
181
|
|
|
160
182
|
if (iMaxConditions > 0 && i >= iMaxConditions - 1) {
|
|
161
183
|
break;
|
|
@@ -182,7 +204,32 @@ sap.ui.define([
|
|
|
182
204
|
|
|
183
205
|
}
|
|
184
206
|
|
|
185
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Parses an external value of the given source type to an array of conditions that holds the value in model
|
|
209
|
+
* representation.
|
|
210
|
+
* These values are parsed using the given data type. Depending of the operator
|
|
211
|
+
* and the configuration (set in <code>FormatOptions</code>) a value will be determined via given value help or delegate.
|
|
212
|
+
*
|
|
213
|
+
* @param {any} vValue
|
|
214
|
+
* The value to be parsed
|
|
215
|
+
* @param {string} sSourceType
|
|
216
|
+
* The type of the given value; see
|
|
217
|
+
* {@link topic:ac56d92162ed47ff858fdf1ce26c18c4 Allowed Property Types}
|
|
218
|
+
* In addition to the standard source types <code>sap.ui.mdc.raw</code> can be used. In this case the value is not parsed and just
|
|
219
|
+
* used in the condition. If the value of the condition is an array representing data for a <code>CompositeType</code> the index of the needed raw value can be added to the
|
|
220
|
+
* name (For example if a unit should be forwarded as raw value <code>sap.ui.mdc.raw:1</code> can be used).
|
|
221
|
+
* @return {null|sap.ui.mdc.condition.ConditionObject[]|Promise<null|sap.ui.mdc.condition.ConditionObject[]>}
|
|
222
|
+
* The array of conditions or a <code>Promise</code> resolving with the array of conditions.
|
|
223
|
+
* If there is no value <code>null</code> is returned.
|
|
224
|
+
* @throws {sap.ui.model.ParseException}
|
|
225
|
+
* If parsing to the model type is not possible; the message of the exception is language
|
|
226
|
+
* dependent as it may be displayed on the UI
|
|
227
|
+
*
|
|
228
|
+
* @private
|
|
229
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
230
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
231
|
+
*/
|
|
232
|
+
ConditionsType.prototype.parseValue = function(vValue, sSourceType) {
|
|
186
233
|
|
|
187
234
|
if (this._bDestroyed) { // if destroyed do nothing
|
|
188
235
|
return null;
|
|
@@ -194,7 +241,7 @@ sap.ui.define([
|
|
|
194
241
|
}
|
|
195
242
|
|
|
196
243
|
var oCondition = SyncPromise.resolve().then(function() {
|
|
197
|
-
return this._oConditionType.parseValue(
|
|
244
|
+
return this._oConditionType.parseValue(vValue, sSourceType);
|
|
198
245
|
}.bind(this)).then(function(oCondition) {
|
|
199
246
|
return _parseConditionToConditions.call(this, oCondition);
|
|
200
247
|
}.bind(this)).unwrap();
|
|
@@ -252,6 +299,21 @@ sap.ui.define([
|
|
|
252
299
|
|
|
253
300
|
}
|
|
254
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Validates a given array of conditions. The values of the conditions are validated using the given data type.
|
|
304
|
+
*
|
|
305
|
+
* @param {sap.ui.mdc.condition.ConditionObject[]} aConditions
|
|
306
|
+
* The conditions to be validated
|
|
307
|
+
* @returns {void|Promise}
|
|
308
|
+
* <code>undefined</code> or a <code>Promise</code> resolving with an undefined value
|
|
309
|
+
* @throws {sap.ui.model.ValidateException}
|
|
310
|
+
* If at least one of the values of the conditions is not valid for the given data type; the message of the exception is
|
|
311
|
+
* language dependent as it may be displayed on the UI
|
|
312
|
+
*
|
|
313
|
+
* @private
|
|
314
|
+
* @ui5-restricted sap.ui.mdc.field.FieldBase, sap.fe
|
|
315
|
+
* @MDC_PUBLIC_CANDIDATE
|
|
316
|
+
*/
|
|
255
317
|
ConditionsType.prototype.validateValue = function(aConditions) {
|
|
256
318
|
|
|
257
319
|
if (aConditions === undefined || aConditions === null || this._bDestroyed) { // if destroyed do nothing
|
|
@@ -294,7 +356,10 @@ sap.ui.define([
|
|
|
294
356
|
var oFormatOptions = oType.getFormatOptions();
|
|
295
357
|
var bShowMeasure = !oFormatOptions || !oFormatOptions.hasOwnProperty("showMeasure") || oFormatOptions.showMeasure;
|
|
296
358
|
var bShowNumber = !oFormatOptions || !oFormatOptions.hasOwnProperty("showNumber") || oFormatOptions.showNumber;
|
|
297
|
-
|
|
359
|
+
var bShowTimezone = !oFormatOptions || !oFormatOptions.hasOwnProperty("showTimezone") || oFormatOptions.showTimezone; // handle timezone as unit
|
|
360
|
+
var bShowDate = !oFormatOptions || !oFormatOptions.hasOwnProperty("showDate") || oFormatOptions.showDate;
|
|
361
|
+
var bShowTime = !oFormatOptions || !oFormatOptions.hasOwnProperty("showTime") || oFormatOptions.showTime;
|
|
362
|
+
if ((bShowMeasure && !bShowNumber) || (bShowTimezone && !bShowDate && !bShowTime)) {
|
|
298
363
|
return true;
|
|
299
364
|
}
|
|
300
365
|
}
|
|
@@ -16,7 +16,7 @@ sap.ui.define([
|
|
|
16
16
|
* @param {object} [mSettings] Initial settings for the new control
|
|
17
17
|
* @class A field help used in the <code>FieldHelp</code> association in <code>FieldBase</code> controls that allows you to add custom content.
|
|
18
18
|
* @extends sap.ui.mdc.field.FieldHelpBase
|
|
19
|
-
* @version 1.
|
|
19
|
+
* @version 1.103.0
|
|
20
20
|
* @constructor
|
|
21
21
|
* @private
|
|
22
22
|
* @ui5-restricted sap.fe
|
|
@@ -81,7 +81,6 @@ sap.ui.define([
|
|
|
81
81
|
* @private
|
|
82
82
|
* @ui5-restricted sap.fe
|
|
83
83
|
* @MDC_PUBLIC_CANDIDATE
|
|
84
|
-
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
|
|
85
84
|
*/
|
|
86
85
|
CustomFieldHelp.prototype.fireSelectEvent = function(aConditions) {
|
|
87
86
|
|
|
@@ -16,7 +16,7 @@ sap.ui.define([
|
|
|
16
16
|
* @param {object} [mSettings] Initial settings for the new control
|
|
17
17
|
* @class A field help used in the <code>FieldInfo</code> aggregation in <code>FieldBase</code> controls that allows you to add custom content.
|
|
18
18
|
* @extends sap.ui.mdc.field.FieldInfoBase
|
|
19
|
-
* @version 1.
|
|
19
|
+
* @version 1.103.0
|
|
20
20
|
* @constructor
|
|
21
21
|
* @private
|
|
22
22
|
* @ui5-restricted sap.fe
|