@sapui5/sap.ui.comp
Advanced tools
Comparing version 1.80.1 to 1.81.0
{ | ||
"name": "@sapui5/sap.ui.comp", | ||
"version": "1.80.1", | ||
"version": "1.81.0", | ||
"description": "SAPUI5 Library sap.ui.comp", | ||
@@ -5,0 +5,0 @@ "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/", |
@@ -12,2 +12,7 @@ /* | ||
function filterIgnoredFields(oRelevantContainer, mODataProperty ) { | ||
var sIgnoredFields = oRelevantContainer.getMetadata().getName() === "sap.ui.comp.smartform.SmartForm" ? oRelevantContainer.getIgnoredFields() : ""; | ||
return sIgnoredFields.indexOf(mODataProperty.name) === -1; | ||
} | ||
return { | ||
@@ -38,7 +43,7 @@ name : { | ||
}, | ||
addODataProperty: { | ||
changeType: "addFields", | ||
filter: function(oRelevantContainer, mODataProperty ) { | ||
var sIgnoredFields = oRelevantContainer.getMetadata().getName() === "sap.ui.comp.smartform.SmartForm" ? oRelevantContainer.getIgnoredFields() : ""; | ||
return sIgnoredFields.indexOf(mODataProperty.name) === -1; | ||
add : { | ||
delegate: { | ||
changeType: "addFields", | ||
supportsDefaultDelegate: true, //only needed for design time aspects | ||
filter: filterIgnoredFields | ||
} | ||
@@ -103,2 +108,2 @@ } | ||
}, /* bExport= */true); | ||
}, /* bExport= */true); |
@@ -75,2 +75,5 @@ /* | ||
ignore: true | ||
}, | ||
validationMode: { | ||
ignore: true | ||
} | ||
@@ -77,0 +80,0 @@ } |
@@ -17,3 +17,3 @@ /* | ||
var mockedGroupMetadata = merge({}, GroupDesigntime); | ||
mockedGroupMetadata.aggregations.formElements.actions.addODataProperty.changeType = "addMultiEditField"; | ||
mockedGroupMetadata.aggregations.formElements.actions.add.delegate.changeType = "addMultiEditField"; | ||
@@ -32,2 +32,2 @@ return { | ||
}; | ||
}); | ||
}); |
@@ -41,3 +41,3 @@ /* | ||
// Check if element is related to SmartLink (allow both SmartLink and ObjectIdentifier for RTA) | ||
function isSmartLinkRelated(oElement){ | ||
function isSmartLinkRelated(oElement) { | ||
return oElement.isA(["sap.ui.comp.navpopover.SmartLink", "sap.m.ObjectIdentifier"]); | ||
@@ -62,4 +62,4 @@ } | ||
actions: { | ||
addXML : { | ||
jsOnly : true | ||
addXML: { | ||
jsOnly: true | ||
} | ||
@@ -70,7 +70,7 @@ } | ||
return { | ||
actionsEffectiveAfter : "RECREATE", // actions like property change & addXML need to be done before SmartTable is initialized | ||
actionsEffectiveAfter: "RECREATE", // actions like property change & addXML need to be done before SmartTable is initialized | ||
actions: null, | ||
aggregations : { | ||
columns : { | ||
specialIndexHandling : true // p13nData columnIndex has to be used | ||
aggregations: { | ||
columns: { | ||
specialIndexHandling: true // p13nData columnIndex has to be used | ||
} | ||
@@ -81,7 +81,7 @@ } | ||
return { | ||
actionsEffectiveAfter : "RECREATE", // actions like property change & addXML need to be done before SmartTable is initialized | ||
actionsEffectiveAfter: "RECREATE", // actions like property change & addXML need to be done before SmartTable is initialized | ||
actions: null, | ||
aggregations : { | ||
cells : { | ||
specialIndexHandling : true // p13nData columnIndex has to be used | ||
aggregations: { | ||
cells: { | ||
specialIndexHandling: true // p13nData columnIndex has to be used | ||
} | ||
@@ -173,4 +173,2 @@ } | ||
* | ||
* <b>Note:</b> Currently only OData V2 annotation is supported. | ||
* | ||
* <i>XML Example of OData V4 with Excluded Customer and CompanyCode Properties from Filtering</i> | ||
@@ -248,2 +246,3 @@ * <pre> | ||
* <b>Note:</b> Currently only <code>FieldControlType/Hidden</code> is supported for statically hiding the columns. | ||
* <b>Note:</b> The static <code>FieldControlType/Hidden</code> is replaced by <code>UI.Hidden</code>. | ||
* | ||
@@ -573,3 +572,3 @@ * <i>XML Example of OData V4 with Hidden Customer and CompanyCode Properties</i> | ||
appliesTo: ["columns/cellContent"], | ||
group:["Behavior"], | ||
group: ["Behavior"], | ||
since: "1.28.1" | ||
@@ -627,3 +626,3 @@ }, | ||
appliesTo: ["columns/cellContent"], | ||
group:["Behavior"], | ||
group: ["Behavior"], | ||
since: "1.38.1" | ||
@@ -662,3 +661,3 @@ }, | ||
appliesTo: ["columns/criticality"], | ||
group:["Behavior"], | ||
group: ["Behavior"], | ||
since: "1.38.1" | ||
@@ -701,3 +700,3 @@ }, | ||
appliesTo: ["columns/criticalityIcon"], | ||
group:["Behavior"], | ||
group: ["Behavior"], | ||
since: "1.38.1" | ||
@@ -857,3 +856,3 @@ }, | ||
/** | ||
* Describes the arrangement of a code value and its text. The <code>TextArragement</code> annotation requires the | ||
* Describes the arrangement of a code value and its text. The <code>TextArrangement</code> annotation requires the | ||
* <code>com.sap.vocabularies.Common.v1.Text</code> annotation to be defined. | ||
@@ -1134,3 +1133,3 @@ * The enumeration members can have the following values: | ||
}, | ||
enableAutoBinding:{ | ||
enableAutoBinding: { | ||
ignore: false | ||
@@ -1137,0 +1136,0 @@ }, |
@@ -10,3 +10,26 @@ /* | ||
return { | ||
actions: "not-adaptable", | ||
actions: { | ||
settings: function () { | ||
return { | ||
name: "VARIANT_MANAGEMENT_MANAGEDIALOG", | ||
handler: function(oControl, mPropertyBag) { | ||
return new Promise(function (resolve, reject) { | ||
if (oControl.isA("sap.ui.comp.smartvariants.SmartVariantManagement")) { | ||
if (!oControl.getShowShare()) { | ||
reject("share not enabled"); | ||
return; | ||
} | ||
var fCallBack = function(aData) { | ||
resolve(aData); | ||
}; | ||
oControl.openManageViewsDialogForKeyUser(mPropertyBag.styleClass, fCallBack); | ||
} else { | ||
reject("wrong conrol type"); | ||
} | ||
}); | ||
} | ||
}; | ||
} | ||
}, | ||
aggregations: { | ||
@@ -28,2 +51,5 @@ personalizableControls: { | ||
ignore: true | ||
}, | ||
adaptationInfo: { | ||
ignore: true | ||
} | ||
@@ -33,2 +59,2 @@ }, | ||
}; | ||
}); | ||
}); |
@@ -170,6 +170,10 @@ /* | ||
VariantConverterFrom.prototype._getParameterMetaDataNonStrictMode = function(sOrigName, oFilterBar, bIsParameter) { | ||
var oMetadata, sNameWithPrefix, sNameWithoutPrefix, sTryName, sName = sOrigName; | ||
var oMetadata, sNameWithPrefix, sNameWithoutPrefix, sTryName, sName = sOrigName, bHasAnalyticalPrefix = false, | ||
_bIsFilterParameter = function() { | ||
return (bHasAnalyticalPrefix && sName === sTryName) || (!bHasAnalyticalPrefix && sName !== sTryName); | ||
}; | ||
if (sOrigName.indexOf(ANALYTICAL_PARAMETER_PREFIX) === 0) { | ||
sName = sOrigName.substr(ANALYTICAL_PARAMETER_PREFIX.length); // remove $Parameter. prefix | ||
bHasAnalyticalPrefix = true; | ||
} | ||
@@ -201,9 +205,7 @@ | ||
if (!bIsParameter) { // SelectOptions | ||
oMetadata = this._getFilter(sOrigName, oFilterBar); | ||
if (_bIsFilterParameter()) { | ||
oMetadata = this._getFilter(sNameWithoutPrefix, oFilterBar); | ||
if (oMetadata) { | ||
return oMetadata; | ||
} | ||
} | ||
@@ -210,0 +212,0 @@ |
@@ -28,3 +28,3 @@ /* | ||
name: "sap.ui.comp", | ||
version: "1.80.1", | ||
version: "1.81.0", | ||
dependencies: [ | ||
@@ -53,3 +53,4 @@ "sap.ui.core", | ||
"sap.ui.comp.smartfilterbar.SelectOptionSign", | ||
"sap.ui.comp.smartfilterbar.DisplayBehaviour" | ||
"sap.ui.comp.smartfilterbar.DisplayBehaviour", | ||
"sap.ui.comp.smartform.SmartFormValidationMode" | ||
], | ||
@@ -150,2 +151,14 @@ interfaces: [ | ||
} | ||
}, | ||
"executeOnSelect": { | ||
"changeHandler": "sap/ui/comp/smartvariants/flexibility/changes/executeOnSelect", | ||
"layers": { | ||
"USER": false | ||
} | ||
}, | ||
"defaultDefaultVariant": { | ||
"changeHandler": "sap/ui/comp/smartvariants/flexibility/changes/defaultVariant", | ||
"layers": { | ||
"USER": false | ||
} | ||
} | ||
@@ -1188,2 +1201,30 @@ }, | ||
/** | ||
* Enumeration of SmartForm validation mode. | ||
* | ||
* @enum {string} | ||
* @public | ||
* @since 1.81 | ||
* @ui5-metamodel This enumeration will also be described in the UI5 (legacy) design time meta model. | ||
*/ | ||
sap.ui.comp.smartform.SmartFormValidationMode = { | ||
/** | ||
* Standard validation mode which handles the validation only of nested <code>SmartField</code> with synchronous | ||
* validation. | ||
* @public | ||
*/ | ||
Standard: "Standard", | ||
/** | ||
* Async validation mode. This mode handles all types of <code>SmartField</code> controls both with sync and | ||
* async validation. | ||
* | ||
* Note: This is the recommended validation mode. | ||
* | ||
* @public | ||
*/ | ||
Async: "Async" | ||
}; | ||
/** | ||
* Marker interface for SmartForm layouts. | ||
@@ -1190,0 +1231,0 @@ * |
@@ -10,3 +10,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -13,0 +13,0 @@ * @since 1.36.0 |
@@ -15,3 +15,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -18,0 +18,0 @@ * @since 1.58.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.44.0 |
@@ -10,3 +10,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -13,0 +13,0 @@ * @since 1.25.0 |
@@ -29,3 +29,3 @@ /* | ||
* @param {string} oFormatOptions.calendarType format options. | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental This module is only for internal/experimental use! | ||
@@ -32,0 +32,0 @@ * @private |
@@ -16,3 +16,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -19,0 +19,0 @@ * @experimental This module is only for internal/experimental use! |
@@ -17,3 +17,3 @@ /* | ||
* @experimental to be productized soon | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.31.0 | ||
@@ -20,0 +20,0 @@ * @alias sap.ui.comp.odata.SideEffects |
@@ -21,3 +21,3 @@ /* | ||
* @param {object} oConstraints constraints. | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental | ||
@@ -24,0 +24,0 @@ * @private |
@@ -26,3 +26,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental | ||
@@ -29,0 +29,0 @@ * @since 1.54.0 |
@@ -19,3 +19,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @constructor | ||
@@ -22,0 +22,0 @@ * @experimental This module is only for internal/experimental use! |
@@ -29,3 +29,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -32,0 +32,0 @@ * @since 1.26.0 |
@@ -30,3 +30,3 @@ /* eslint-disable strict */ | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @constructor | ||
@@ -33,0 +33,0 @@ * @experimental This module is only for internal/experimental use! |
@@ -20,3 +20,3 @@ /* eslint-disable strict */ | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -23,0 +23,0 @@ * @since 1.34.0 |
@@ -16,3 +16,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -19,0 +19,0 @@ * @since 1.34.0 |
@@ -10,3 +10,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -13,0 +13,0 @@ * @since 1.25.0 |
@@ -10,3 +10,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -13,0 +13,0 @@ * @since 1.48.0 |
@@ -440,3 +440,3 @@ /*! | ||
//get the existing validators. We call this in our new added validator | ||
this._aOrgValidators = this._oInput.getAggregation("tokenizer") ? this._oInput.getAggregation("tokenizer")._aTokenValidators.slice() : []; | ||
this._aOrgValidators = this._oInput && this._oInput.isA('sap.m.MultiInput') ? this._oInput.getValidators().slice() : []; | ||
@@ -443,0 +443,0 @@ this._oInput.removeAllValidators(); |
@@ -193,3 +193,2 @@ /* | ||
if (this._shouldHaveRecommendations() || this._shouldHaveHistory()) { | ||
this._bindInnerControlSuggestions(); | ||
this._setupSuggestionInteractions(); | ||
@@ -610,3 +609,3 @@ } | ||
if (this.oControl.addValidator) { | ||
this._aValidators = this.oControl.getAggregation("tokenizer") ? this.oControl.getAggregation("tokenizer")._aTokenValidators.slice() : []; | ||
this._aValidators = this.oControl && this.oControl.isA('sap.m.MultiInput') ? this.oControl.getValidators().slice() : []; | ||
this.oControl.removeAllValidators(); | ||
@@ -909,2 +908,7 @@ | ||
if (this.aSelect && this.aSelect.length) { | ||
mParams["select"] = this.aSelect.toString(); | ||
delete mParams["$select"]; | ||
} | ||
this.oControl.bindAggregation(this.sAggregationName, { | ||
@@ -977,2 +981,6 @@ path: "/" + this.sValueListEntitySetName, | ||
aData = that._getDistinctSuggestions(aData); | ||
// Filter data based on In Params | ||
aData = aData.filter( | ||
that._filterSuggestionsWithInParams.bind(that, that.mFilterInputData) | ||
); | ||
@@ -1336,2 +1344,3 @@ that._showSuggestionsMoreButton(aSuggestions.length >= length); | ||
onmousedown: function (oEvent) { | ||
this._bindInnerControlSuggestions(); | ||
if (oEvent.target.tagName !== "INPUT") { | ||
@@ -1341,5 +1350,8 @@ return; | ||
this._showInitialSuggestions("suggestionRows", oInput.getValue()); | ||
}, | ||
setTimeout(function () { | ||
this._showInitialSuggestions("suggestionRows", oInput.getValue()); | ||
}.bind(this)); | ||
}, | ||
onkeyup: function (oEvent) { | ||
this._bindInnerControlSuggestions(); | ||
if (oEvent.keyCode !== 9) { | ||
@@ -1349,3 +1361,5 @@ return; | ||
this._showInitialSuggestions("suggestionRows", oInput.getValue()); | ||
setTimeout(function () { | ||
this._showInitialSuggestions("suggestionRows", oInput.getValue()); | ||
}.bind(this)); | ||
} | ||
@@ -1385,2 +1399,4 @@ }, this); | ||
onmousedown: function (oEvent) { | ||
this._bindInnerControlSuggestions(); | ||
if (oEvent.target.tagName !== "INPUT") { | ||
@@ -1390,5 +1406,8 @@ return; | ||
this._showInitialSuggestions("items", oComboBox.getValue()); | ||
setTimeout(function () { | ||
this._showInitialSuggestions("items", oComboBox.getValue()); | ||
}.bind(this)); | ||
}, | ||
onkeyup: function (oEvent) { | ||
this._bindInnerControlSuggestions(); | ||
if (oEvent.keyCode !== 9) { | ||
@@ -1398,3 +1417,5 @@ return; | ||
this._showInitialSuggestions("items", oComboBox.getValue()); | ||
setTimeout(function () { | ||
this._showInitialSuggestions("items", oComboBox.getValue()); | ||
}.bind(this)); | ||
} | ||
@@ -1457,10 +1478,31 @@ }, this); | ||
this._calculateFilterInputData(); | ||
this.oControl.showItems(function (sValue, oItem) { | ||
var sModelName = that._getSuggestionsModelName(), | ||
iOrder = oItem.getBindingContext(sModelName).getObject()[HistoryConstants.getSuggestionsGroupPropertyName()]; | ||
oItemBindingContext = oItem.getBindingContext(sModelName), | ||
oItemData = oItemBindingContext ? oItemBindingContext.getObject() : {}, | ||
iOrder = oItemData[HistoryConstants.getSuggestionsGroupPropertyName()]; | ||
return aGroupsToShow.indexOf(iOrder) !== -1; | ||
return that._filterSuggestionsWithInParams(that.mFilterInputData, oItemData) && aGroupsToShow.indexOf(iOrder) !== -1; | ||
}); | ||
}; | ||
ValueListProvider.prototype._filterSuggestionsWithInParams = function (oFilterInputData, oItemData) { | ||
if (!oFilterInputData || oFilterInputData.length === 0) { | ||
// in case we do not have any filter input data just return true | ||
// so no filtering by input data will be made | ||
return true; | ||
} | ||
return Object.keys(oFilterInputData).every(function (sKey) { | ||
var oCurrentItem = oItemData[sKey]; | ||
if (!oCurrentItem){ | ||
return true; | ||
} | ||
return oFilterInputData[sKey] === oCurrentItem; | ||
}); | ||
}; | ||
ValueListProvider.prototype._getSuggestionsModelName = function () { | ||
@@ -1467,0 +1509,0 @@ var sPath; |
@@ -12,3 +12,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -15,0 +15,0 @@ * @since 1.29.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -196,2 +196,3 @@ * @since 1.28.0 | ||
oControl.attachValidationSuccess(function(oEvent) { | ||
that._oParent.onValidation(oEvent); | ||
fState(ValueState.None, oEvent); | ||
@@ -326,3 +327,4 @@ }); | ||
ControlFactoryBase.prototype.createValueHelp = function(mSettings) { | ||
var oEdmProperty = mSettings.edmProperty, | ||
var oValueListProviderSettings, | ||
oEdmProperty = mSettings.edmProperty, | ||
oValueHelp = mSettings.valueHelp; | ||
@@ -407,3 +409,3 @@ | ||
if (!oValueHelp.noTypeAhead || !oControl.isA("sap.m.Input")) { | ||
var oValueList = new ValueListProvider({ | ||
oValueListProviderSettings = { | ||
control: oControl, | ||
@@ -425,4 +427,6 @@ model: oModel, | ||
fieldHistoryEnabled: bHistoryEnabled | ||
}); | ||
}; | ||
var oValueList = new ValueListProvider(this.getValueListProviderConfiguration(oValueListProviderSettings)); | ||
if (!oValueHelp.noTypeAhead) { | ||
@@ -445,2 +449,28 @@ | ||
/** | ||
* Gets the ValueListProvider configuration | ||
* | ||
* @param {object} oSettings object instance to be updated | ||
* @returns {object} Display behavior or <code>null</code> | ||
* @protected | ||
*/ | ||
ControlFactoryBase.prototype.getValueListProviderConfiguration = function(oSettings) { | ||
return { | ||
control: oSettings.control, | ||
model: oSettings.model, | ||
dateFormatSettings: oSettings.dateFormatSettings, | ||
displayBehaviour: oSettings.displayBehaviour, | ||
fieldViewMetadata: oSettings.fieldViewMetadata, | ||
loadAnnotation: true, | ||
fullyQualifiedFieldName: oSettings.fullyQualifiedFieldName, | ||
metadataAnalyser: oSettings.metadataAnalyser, | ||
annotation: oSettings.annotation, | ||
aggregation: oSettings.aggregation, | ||
typeAheadEnabled: oSettings.typeAheadEnabled, | ||
dropdownItemKeyType: oSettings.dropdownItemKeyType, | ||
maxLength: oSettings.maxLength, | ||
fieldHistoryEnabled: oSettings.fieldHistoryEnabled | ||
}; | ||
}; | ||
/** | ||
* Returns a binding for a given attribute, if no binding is specified a fixed value or <code>null</code>, which is deduced from the | ||
@@ -447,0 +477,0 @@ * information maintained on the parent. |
@@ -27,3 +27,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -30,0 +30,0 @@ * @constructor |
@@ -50,9 +50,21 @@ /*! | ||
DelegateMediator.registerDefaultDelegate({ | ||
"modelType": "sap.ui.model.odata.v2.ODataModel", | ||
"delegate": "sap/ui/comp/smartfield/flexibility/ODataV2Delegate" | ||
modelType: "sap.ui.model.odata.v2.ODataModel", | ||
delegate: "sap/ui/comp/smartfield/flexibility/ODataV2Delegate", | ||
requiredLibraries: { | ||
"sap.ui.comp": { | ||
minVersion: "1.81", | ||
lazy: false | ||
} | ||
} | ||
}); | ||
DelegateMediator.registerDefaultDelegate({ | ||
"modelType": "sap.ui.model.odata.ODataModel", | ||
"delegate": "sap/ui/comp/smartfield/flexibility/ODataV2Delegate" | ||
modelType: "sap.ui.model.odata.ODataModel", | ||
delegate: "sap/ui/comp/smartfield/flexibility/ODataV2Delegate", | ||
requiredLibraries: { | ||
"sap.ui.comp": { | ||
minVersion: "1.81", | ||
lazy: false | ||
} | ||
} | ||
}); | ||
@@ -59,0 +71,0 @@ |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -12,3 +12,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.28.0 | ||
@@ -15,0 +15,0 @@ * @returns {sap.ui.comp.smartfield.ODataControlSelector} new control selector instance. |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -65,3 +65,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -323,12 +323,18 @@ * @constructor | ||
ODataTypes.prototype._getDecimalConstraints = function(oProperty, mConstraints) { | ||
var oEdmProperty = oProperty.property; | ||
mConstraints = mConstraints || {}; | ||
if (oProperty.property.precision) { | ||
mConstraints.precision = parseInt(oProperty.property.precision); | ||
if (oEdmProperty.precision) { | ||
mConstraints.precision = parseInt(oEdmProperty.precision); | ||
} | ||
if (oProperty.property.scale) { | ||
mConstraints.scale = parseInt(oProperty.property.scale); | ||
if (oEdmProperty.scale) { | ||
mConstraints.scale = parseInt(oEdmProperty.scale); | ||
} | ||
if (oEdmProperty["sap:variable-scale"]) { | ||
mConstraints.variableScale = oEdmProperty["sap:variable-scale"] === "true"; | ||
} | ||
return mConstraints; | ||
@@ -564,3 +570,4 @@ }; | ||
precision: oConstraints.precision, | ||
scale: oConstraints.scale | ||
scale: oConstraints.scale, | ||
variableScale: oConstraints.variableScale | ||
}; | ||
@@ -567,0 +574,0 @@ } |
@@ -14,3 +14,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -17,0 +17,0 @@ * @since 1.31.0 |
@@ -26,2 +26,3 @@ /*! | ||
BaseObject.apply(this, arguments); | ||
this.oTextArrangementType = null; | ||
this.oFactory = oFactory; | ||
@@ -103,10 +104,12 @@ this.oSmartField = oFactory._oParent; | ||
TextArrangementDelegate.prototype.getBindingInfo = function(oSettings) { | ||
var oSmartField = this.oSmartField, | ||
var oFormatOptions = {}, | ||
oSmartField = this.oSmartField, | ||
oFactory = this.oFactory, | ||
oType = oSettings && oSettings.type, | ||
oMetadata = oFactory._oMetaData; | ||
if (!oType) { | ||
this.oTextArrangementType = oSettings && oSettings.type; | ||
if (!this.oTextArrangementType) { | ||
var oBindingInfo = oSmartField.getBindingInfo("value"); | ||
oType = (oBindingInfo && oBindingInfo.type) || {}; | ||
this.oTextArrangementType = (oBindingInfo && oBindingInfo.type) || {}; | ||
var mTextArrangementBindingPaths = TextArrangementDelegate.getPaths( | ||
@@ -117,3 +120,7 @@ oFactory._bTextInDisplayModeValueList ? TextInEditModeSource.ValueList : oSmartField.getTextInEditModeSource(), | ||
oType = oFactory._oTypes.getType(oMetadata.property, oType.oFormatOptions, oType.oConstraints, { | ||
if (oSettings.sDisplayFormat) { | ||
oFormatOptions.displayFormat = oSettings.sDisplayFormat; | ||
} | ||
this.oTextArrangementType = oFactory._oTypes.getType(oMetadata.property, Object.assign(oFormatOptions, this.oTextArrangementType.oFormatOptions), this.oTextArrangementType.oConstraints, { | ||
composite: true, | ||
@@ -135,3 +142,3 @@ keyField: mTextArrangementBindingPaths.keyField, | ||
model: oMetadata.model, | ||
type: oType, | ||
type: this.oTextArrangementType, | ||
parts: [ | ||
@@ -343,2 +350,8 @@ { | ||
if (this.oTextArrangementType && | ||
this.oTextArrangementType.oFormatOptions && | ||
this.oTextArrangementType.oFormatOptions.displayFormat === "UpperCase") { | ||
oSettings.value = oSettings.value.toUpperCase(); | ||
} | ||
var aFilters = this.getFilters(oSettings.value, oFiltersSettings); | ||
@@ -345,0 +358,0 @@ |
@@ -18,3 +18,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -21,0 +21,0 @@ * @since 1.28.0 |
@@ -50,3 +50,4 @@ /* | ||
sValue = vValues[0], | ||
bNullValue = sValue === null; | ||
bNullValue = sValue === null, | ||
iScale = 0; | ||
@@ -63,9 +64,23 @@ if (this.oConstraints.nullable && (bNullValue || (sValue === this.oFormatOptions.emptyString))) { | ||
var iIntegerDigits = aMatches[2].length, | ||
var iIntegerValue = parseInt(aMatches[2]), | ||
iIntegerDigits = iIntegerValue === 0 ? 0 : aMatches[2].length, | ||
iFractionDigits = (aMatches[3] || "").length, | ||
iPrecision = this.oConstraints.precision || Infinity, | ||
iConstraintsPrecision = this.oConstraints.precision, | ||
iPrecision = typeof iConstraintsPrecision === "number" ? iConstraintsPrecision : Infinity, | ||
sCurrency = vValues[1], | ||
iScaleOfCurrency = this.oOutputFormat.oLocaleData.getCurrencyDigits(sCurrency), | ||
iScaleOfCurrency = this.oOutputFormat.oLocaleData.getCurrencyDigits(sCurrency); | ||
if (this.oConstraints.variableScale) { | ||
// In case of sap:variable-scale="true" the provided scale can vary depending on the current currency scale | ||
// up to the size of the precision. | ||
iScale = Math.min(iPrecision, iScaleOfCurrency); | ||
} else { | ||
iScale = Math.min(this.oConstraints.scale || 0, iScaleOfCurrency); | ||
} | ||
// The Scale value can range from 0 through the specified Precision value. | ||
if (iScale > iPrecision) { | ||
iScale = iPrecision; | ||
} | ||
if (iFractionDigits > iScale) { | ||
@@ -90,4 +105,4 @@ | ||
// Keep in mind the following: If Precision is equal to Scale, a single zero MUST precede the decimal point. | ||
if (iIntegerDigits > (iPrecision - iScale)) { | ||
// enter a number with a maximum of {iPrecision - iScale} digits to the left of | ||
@@ -94,0 +109,0 @@ // the decimal separator |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.31.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.28.0 |
@@ -69,9 +69,19 @@ /* | ||
TextArrangement.prototype.parseValue = function(vValue, sSourceType, aCurrentValues) { | ||
var sTextArrangement = this.oFormatOptions.textArrangement; | ||
var aResult, sTextArrangement = this.oFormatOptions.textArrangement; | ||
if (typeof vValue === "string" ) { | ||
vValue = vValue.replace(/\s+$/, ""); | ||
} | ||
if (vValue === "" || (sTextArrangement === "idOnly")) { | ||
return this.parseIDOnly(vValue, sSourceType); | ||
aResult = this.parseIDOnly(vValue, sSourceType); | ||
} | ||
return this.fnParser(vValue, sSourceType, aCurrentValues, this.oFormatOptions, this.oSettings); | ||
aResult = this.fnParser(vValue, sSourceType, aCurrentValues, this.oFormatOptions, this.oSettings); | ||
if (aResult[0] && aResult[0].toUpperCase && this.oFormatOptions.displayFormat === "UpperCase") { | ||
aResult[0] = aResult[0].toUpperCase(); | ||
} | ||
return aResult; | ||
}; | ||
@@ -227,10 +237,15 @@ | ||
TextArrangement.prototype.validateIDAndDescription = function(aValues, oSettings) { | ||
// filter for description given the ID | ||
var aDescription = filterValuesByKey(aValues[0], { | ||
var oFilterSettings = { | ||
key: oSettings.keyField, | ||
value: oSettings.descriptionField, | ||
data: oSettings.data | ||
}); | ||
}; | ||
if (this.oFormatOptions && this.oFormatOptions.displayFormat) { | ||
oFilterSettings.displayFormat = this.oFormatOptions.displayFormat; | ||
} | ||
// filter for description given the ID | ||
var aDescription = filterValuesByKey(aValues[0], oFilterSettings); | ||
var fnReject = oSettings.reject; | ||
@@ -277,2 +292,6 @@ | ||
if (this.oFormatOptions.displayFormat === "UpperCase") { | ||
sKey = sKey.toUpperCase(); | ||
} | ||
var vDescription = aValues[1]; | ||
@@ -339,5 +358,8 @@ | ||
var aValues = []; | ||
if (mSettings.displayFormat === "UpperCase") { | ||
sKey = sKey.toLowerCase(); | ||
} | ||
mSettings.data.forEach(function(mData, iIndex, aData) { | ||
if (mData[mSettings.key] === sKey) { | ||
var sCurrKey = mSettings.displayFormat === "UpperCase" ? mData[mSettings.key].toLowerCase() : mData[mSettings.key]; | ||
if (sCurrKey === sKey) { | ||
aValues.push(mData[mSettings.value]); | ||
@@ -344,0 +366,0 @@ } |
@@ -11,3 +11,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @private | ||
@@ -14,0 +14,0 @@ * @since 1.34.0 |
@@ -29,3 +29,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -32,0 +32,0 @@ * @constructor |
@@ -23,3 +23,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -26,0 +26,0 @@ */ |
@@ -7,8 +7,74 @@ /*! | ||
sap.ui.define([ | ||
"sap/base/Log", | ||
"sap/ui/fl/changeHandler/Base", | ||
"sap/ui/core/util/reflection/JsControlTreeModifier" | ||
], function(Log, Base, JsControlTreeModifier) { | ||
"sap/ui/fl/apply/api/DelegateMediatorAPI", | ||
"sap/ui/core/util/reflection/JsControlTreeModifier", | ||
"sap/base/util/merge", | ||
"sap/base/util/ObjectPath" | ||
], function( | ||
Base, | ||
DelegateMediatorAPI, | ||
JsControlTreeModifier, | ||
merge, | ||
ObjectPath | ||
) { | ||
"use strict"; | ||
function isFunction(fn) { | ||
return typeof fn === "function"; | ||
} | ||
function getNewFieldId(sGroupElementId, iIndex) { | ||
return sGroupElementId + "-element" + iIndex; | ||
} | ||
function checkChangeDefinition(oChangeDefinition) { | ||
var bMandatoryContentPresent = false; | ||
bMandatoryContentPresent = oChangeDefinition.content.field | ||
&& (oChangeDefinition.content.field.selector || oChangeDefinition.content.field.id) | ||
&& oChangeDefinition.content.field.jsTypes | ||
&& oChangeDefinition.content.field.value | ||
&& oChangeDefinition.content.field.valueProperty; | ||
if (!bMandatoryContentPresent) { | ||
throw new Error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" | ||
+ oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); | ||
} | ||
} | ||
function getDelegateControlForPropertyAndLabel(mDelegatePropertyBag, oDelegate) { | ||
var mDelegateSettings = merge({}, mDelegatePropertyBag); | ||
mDelegateSettings.fieldSelector.id = getNewFieldId(mDelegateSettings.fieldSelector.id, 0); | ||
return oDelegate.createControlForProperty(mDelegateSettings) | ||
.then(function(mSpecificControlInfo) { | ||
var sNewFieldId = mDelegatePropertyBag.modifier.getId(mSpecificControlInfo.control); | ||
mDelegatePropertyBag.labelFor = sNewFieldId; | ||
return oDelegate.createLabel(mDelegatePropertyBag).then(function(oLabel) { | ||
return { | ||
label: oLabel, | ||
control: mSpecificControlInfo.control | ||
}; | ||
}); | ||
}); | ||
} | ||
function getControlsFromDelegate(mDelegate, mPropertyBag) { | ||
var mDelegatePropertyBag = merge({ | ||
aggregationName: "formElements", | ||
payload: mDelegate.payload || {} | ||
}, mPropertyBag); | ||
var oDelegate = mDelegate.instance; | ||
return Promise.resolve() | ||
.then(function() { | ||
if (isFunction(oDelegate.createLayout)) { | ||
return oDelegate.createLayout(mDelegatePropertyBag); | ||
} | ||
}) | ||
.then(function(mLayoutControlInfo) { | ||
if (ObjectPath.get("control", mLayoutControlInfo)) { | ||
mLayoutControlInfo.layoutControl = true; | ||
return mLayoutControlInfo; | ||
} | ||
return getDelegateControlForPropertyAndLabel(mDelegatePropertyBag, oDelegate); | ||
}); | ||
} | ||
/** | ||
@@ -19,3 +85,3 @@ * Change handler for adding a smart form group element (representing one or more fields). | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.33.0 | ||
@@ -34,3 +100,3 @@ */ | ||
* @param {object} mPropertyBag.view - View object or xml element representing an ui5 view | ||
* @return {boolean} True if successfully added | ||
* @return {Promise} Resolving when fields are added | ||
* @public | ||
@@ -40,29 +106,23 @@ */ | ||
var oChangeDefinition = oChange.getDefinition(); | ||
var fnCheckChangeDefinition = function(oChangeDefinition) { | ||
var bContentPresent = oChangeDefinition.content; | ||
var bMandatoryContentPresent = false; | ||
if (bContentPresent) { | ||
bMandatoryContentPresent = oChangeDefinition.content.field && (oChangeDefinition.content.field.selector || oChangeDefinition.content.field.id) && | ||
oChangeDefinition.content.field.jsTypes && oChangeDefinition.content.field.value && oChangeDefinition.content.field.valueProperty; | ||
} | ||
return bContentPresent && bMandatoryContentPresent; | ||
}; | ||
var mChangeContent = oChange.getContent(); | ||
var oModifier = mPropertyBag.modifier; | ||
var oAppComponent = mPropertyBag.appComponent; | ||
var oFieldSelector = mChangeContent.field.selector; | ||
var oView = mPropertyBag.view; | ||
if (fnCheckChangeDefinition(oChangeDefinition)) { | ||
var sFieldId = mChangeContent.field.id; | ||
var oFieldSelector = oChangeDefinition.content.field.selector; | ||
var sFieldId = oChangeDefinition.content.field.id; | ||
if (oModifier.bySelector(oFieldSelector || sFieldId, oAppComponent, oView)) { | ||
return Base.markAsNotApplicable("Control to be created already exists:" + oFieldSelector || sFieldId); | ||
} | ||
var insertIndex = oChangeDefinition.content.field.index; | ||
var oGroupElement; | ||
if (oModifier.bySelector(oFieldSelector || sFieldId, oAppComponent, oView)) { | ||
return Base.markAsNotApplicable("Control to be created already exists:" + oFieldSelector || sFieldId); | ||
} | ||
oGroupElement = oModifier.createControl("sap.ui.comp.smartform.GroupElement", oAppComponent, oView, oFieldSelector || sFieldId); | ||
var insertIndex = mChangeContent.field.index; | ||
var oSmartForm = oChange.getDependentControl("form", mPropertyBag); //recently changes contain the info about the form | ||
var mDelegateInfo = oSmartForm && oModifier.getFlexDelegate(oSmartForm); | ||
if (!mDelegateInfo){ | ||
//stay sync for legacy and no-delegate changes | ||
checkChangeDefinition(oChangeDefinition); | ||
var oGroupElement = oModifier.createControl("sap.ui.comp.smartform.GroupElement", oAppComponent, oView, oFieldSelector || sFieldId); | ||
if (!oFieldSelector) { | ||
@@ -73,7 +133,7 @@ oFieldSelector = oModifier.getSelector(sFieldId, oAppComponent); | ||
for (var i = 0; i < oChangeDefinition.content.field.jsTypes.length; i++) { | ||
var sJsType = oChangeDefinition.content.field.jsTypes[i]; | ||
var sPropertyName = oChangeDefinition.content.field.valueProperty[i]; | ||
var oPropertyValue = oChangeDefinition.content.field.value[i]; | ||
var oEntitySet = oChangeDefinition.content.field.entitySet; | ||
for (var i = 0; i < mChangeContent.field.jsTypes.length; i++) { | ||
var sJsType = mChangeContent.field.jsTypes[i]; | ||
var sPropertyName = mChangeContent.field.valueProperty[i]; | ||
var oPropertyValue = mChangeContent.field.value[i]; | ||
var oEntitySet = mChangeContent.field.entitySet; | ||
@@ -84,16 +144,81 @@ this.addElementIntoGroupElement(oModifier, oView, oGroupElement, sJsType, sPropertyName, oPropertyValue, oEntitySet, i, oAppComponent); | ||
oModifier.insertAggregation(oGroup, "groupElements", oGroupElement, insertIndex); | ||
return true; | ||
} else { | ||
Log.error("Change does not contain sufficient information to be applied: [" + oChangeDefinition.layer + "]" | ||
+ oChangeDefinition.namespace + "/" + oChangeDefinition.fileName + "." + oChangeDefinition.fileType); | ||
// however subsequent changes should be applied | ||
} | ||
//with delegate present we get async | ||
return AddFields._addFieldFromDelegate( | ||
oSmartForm, | ||
oGroup, | ||
oFieldSelector, | ||
sFieldId, | ||
insertIndex, | ||
mChangeContent.field.value[0], | ||
oChange, | ||
oModifier, | ||
oView, | ||
oAppComponent | ||
); | ||
}; | ||
//smart multiedit is calling it | ||
AddFields._addFieldFromDelegate = function(oSmartForm, oGroup, oFieldSelector, sFieldId, insertIndex, sBindinPath, oChange, oModifier, oView, oAppComponent) { | ||
return DelegateMediatorAPI.getDelegateForControl({ | ||
control: oSmartForm, | ||
modifier: oModifier | ||
//we don't want to get default delegate in the change handler as default case was handled before with smart field | ||
}).then(function (mDelegate) { | ||
var mCreateProperties = { | ||
appComponent: oAppComponent, | ||
view: oView, | ||
fieldSelector: oFieldSelector || sFieldId, | ||
bindingPath: sBindinPath, | ||
modifier: oModifier, | ||
element: oSmartForm | ||
}; | ||
return getControlsFromDelegate(mDelegate, mCreateProperties); | ||
}).then(function(mInnerControls) { | ||
var oGroupElement; | ||
// "layoutControl" property is present only when the control is returned from Delegate.createLayout() | ||
if (!mInnerControls.layoutControl) { | ||
oGroupElement = oModifier.createControl( | ||
"sap.ui.comp.smartform.GroupElement", | ||
oAppComponent, | ||
oView, | ||
oFieldSelector || sFieldId | ||
); | ||
oModifier.insertAggregation(oGroupElement, "label", mInnerControls.label, 0, oView); | ||
oModifier.insertAggregation(oGroupElement, "fields", mInnerControls.control, 0, oView); | ||
} else { | ||
oGroupElement = mInnerControls.control; | ||
} | ||
oModifier.insertAggregation(oGroup, | ||
"groupElements", | ||
oGroupElement, | ||
insertIndex, | ||
oView | ||
); | ||
if (mInnerControls.valueHelp) { | ||
oModifier.insertAggregation( | ||
oSmartForm, | ||
"dependents", | ||
mInnerControls.valueHelp, | ||
0, | ||
oView | ||
); | ||
} | ||
if (!oFieldSelector) { | ||
oFieldSelector = oModifier.getSelector(sFieldId, oAppComponent); | ||
} | ||
oChange.setRevertData({ | ||
newFieldSelector: oFieldSelector, | ||
valueHelpSelector: mInnerControls.valueHelp && oModifier.getSelector(mInnerControls.valueHelp, oAppComponent) | ||
}); | ||
}); | ||
}; | ||
AddFields.addElementIntoGroupElement = function(oModifier, oView, oGroupElement, sJsType, sPropertyName, oPropertyValue, sEntitySet, iIndex, oAppComponent) { | ||
var oValueControl; | ||
var sGroupElementId = oModifier.getId(oGroupElement); | ||
var sValueControlId = sGroupElementId + "-element" + iIndex; | ||
var sValueControlId = getNewFieldId(sGroupElementId, iIndex); | ||
try { | ||
@@ -171,2 +296,6 @@ oValueControl = oModifier.createControl(sJsType, oAppComponent, oView, sValueControlId); | ||
} | ||
if (oSpecificChangeInfo.relevantContainerId) { | ||
// new add via delegate changes contain the smartform | ||
oChange.addDependentControl(oSpecificChangeInfo.relevantContainerId, "form", mPropertyBag); | ||
} | ||
@@ -191,3 +320,4 @@ }; | ||
var oModifier = mPropertyBag.modifier; | ||
var mFieldSelector = oChange.getRevertData().newFieldSelector; | ||
var mRevertData = oChange.getRevertData(); | ||
var mFieldSelector = mRevertData.newFieldSelector; | ||
@@ -197,2 +327,10 @@ var oGroupElement = oModifier.bySelector(mFieldSelector, oAppComponent, oView); | ||
oModifier.destroy(oGroupElement); | ||
var mValueHelpSelector = mRevertData.valueHelpSelector; | ||
if (mValueHelpSelector) { | ||
var oValueHelp = oModifier.bySelector(mValueHelpSelector, oAppComponent, oView); | ||
var oSmartForm = oChange.getDependentControl("form", mPropertyBag); //recently changes contain the info about the form | ||
oModifier.removeAggregation(oSmartForm, "dependents", oValueHelp); | ||
oModifier.destroy(oValueHelp); | ||
} | ||
oChange.resetRevertData(); | ||
@@ -199,0 +337,0 @@ |
@@ -17,3 +17,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -20,0 +20,0 @@ */ |
@@ -20,3 +20,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.46 | ||
@@ -23,0 +23,0 @@ */ |
@@ -17,3 +17,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -20,0 +20,0 @@ */ |
@@ -17,3 +17,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -20,0 +20,0 @@ */ |
@@ -13,3 +13,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -16,0 +16,0 @@ */ |
@@ -14,3 +14,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -17,0 +17,0 @@ */ |
@@ -24,3 +24,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -27,0 +27,0 @@ */ |
@@ -18,3 +18,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.27.0 | ||
@@ -21,0 +21,0 @@ */ |
@@ -14,3 +14,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.46 | ||
@@ -17,0 +17,0 @@ */ |
@@ -15,3 +15,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.46 | ||
@@ -18,0 +18,0 @@ */ |
@@ -13,3 +13,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @experimental Since 1.44.0 | ||
@@ -16,0 +16,0 @@ */ |
@@ -25,2 +25,3 @@ /* | ||
var mLibrary; | ||
var SmartFormValidationMode = library.smartform.SmartFormValidationMode; | ||
@@ -190,2 +191,22 @@ var mFormLayouts = { | ||
defaultValue: true | ||
}, | ||
/** | ||
* Controls the SmartForm validation mode. The default mode handles only nested <code>SmartField</code> | ||
* controls with synchronous validation. If the <code>SmartForm</code> should also handle controls with | ||
* asynchronous validation the property should be set to <code>Async</code> mode which is the | ||
* recommended mode to be used as all types of nested fields validation are handled. | ||
* | ||
* Note: Using <code>Async</code> mode the method <code>check</code> will return a promise instead of an | ||
* array. | ||
* | ||
* Note: Using <code>Async</code> mode the event <code>checked</code> will be called asynchronously when | ||
* all the nested <code>SmartField</code> validations are executed. | ||
* | ||
* @since 1.81 | ||
*/ | ||
validationMode: { | ||
type: "sap.ui.comp.smartform.SmartFormValidationMode", | ||
group: "Misc", | ||
defaultValue: SmartFormValidationMode.Standard | ||
} | ||
@@ -535,3 +556,4 @@ }, | ||
* @param {boolean} [vSettings.handleSuccess=false] Indicates whether client error checks are performed for the current value regardless of the current error state of the text input fields of the <code>SmartForm</code> control. If the <code>handleSuccess</code> setting is set to <code>true</code>, the {@link sap.ui.base.EventProvider#event:validationSuccess} will be fired by every of the text input fields if their validation passes | ||
* @returns {string[]} An array of fields with errors | ||
* @returns {string[]|Promise[]} An array of fields with errors or a promise depending on the <code>validationMode</code> property setting. If | ||
* the <code>validationMode</code> is asynchronous the returned promise will resolve with an array containing IDs of all the fields with errors. | ||
* @public | ||
@@ -547,3 +569,7 @@ */ | ||
return this._checkClientError(oSettings); | ||
if (this.getValidationMode() === SmartFormValidationMode.Standard) { | ||
return this._checkClientError(oSettings); | ||
} else { | ||
return this._checkClientErrorAsync(oSettings); | ||
} | ||
}; | ||
@@ -593,2 +619,61 @@ | ||
/** | ||
* Check for client errors which are capable of handling SmartFields with async validation. | ||
* | ||
* @param {object} oSettings Settings object | ||
* @param {boolean} [oSettings.considerOnlyVisible=true] determines if only visible filters of visible <code>groups</code> | ||
* and <code>groupElements</code> should be considered. Default value is <code>true</code> | ||
* @param {boolean} [oSettings.handleSuccess=false] Indicates whether client error checks are performed for the current | ||
* value regardless of the current error state of the text input fields. If the <code>handleSuccess</code> setting | ||
* is set to <code>true</code>, the text input fields will fire a | ||
* {@link sap.ui.base.EventProvider#event:validationSuccess} if their validation passes | ||
* @returns {Promise[]} when resolved all the individual fields validations are passed and an array containing | ||
* all the IDs of the fields in error state is returned. | ||
* @private | ||
*/ | ||
SmartForm.prototype._checkClientErrorAsync = function(oSettings) { | ||
var aFields = this.getSmartFields(oSettings.considerOnlyVisible, oSettings.considerOnlyVisible), | ||
aPromises, | ||
aErroneousFields = [], | ||
oGroup; | ||
this.setBusy(true); | ||
// By default we consider only visible fields | ||
if (oSettings.considerOnlyVisible === undefined) { | ||
oSettings.considerOnlyVisible = true; | ||
} | ||
aPromises = aFields.map(function (oField) { | ||
// We check for non-visible fields if required | ||
if (oSettings.considerOnlyVisible && !oField.getVisible()) { | ||
return false; | ||
} | ||
// In the Promise.catch we get only the fields with validation issues. | ||
return oField.checkValuesValidity({handleSuccess: oSettings.handleSuccess}).catch(function () { | ||
oGroup = oField.getParent(); | ||
while (oGroup.getParent) { | ||
oGroup = oGroup.getParent(); | ||
if (oGroup.isA("sap.ui.comp.smartform.Group")) { | ||
if (!oGroup.getExpanded()) { | ||
oGroup.setExpanded(true); | ||
} | ||
break; | ||
} | ||
} | ||
aErroneousFields.push(oField.getId()); | ||
}); | ||
}); | ||
// When all promises are handled we return an array with all the fields with validation issues | ||
return Promise.all(aPromises).then(function () { | ||
this.setBusy(false); | ||
return aErroneousFields; | ||
}.bind(this)); | ||
}; | ||
/** | ||
* Displays error message. | ||
@@ -643,4 +728,12 @@ * @param {array} aErroneousFields field with error | ||
function _checkForErrorAsync() { | ||
return this.check(true).then(function (aErroneousFields) { | ||
if (aErroneousFields && aErroneousFields.length) { | ||
this._displayError(aErroneousFields); | ||
} | ||
return aErroneousFields; | ||
}.bind(this)); | ||
} | ||
SmartForm.prototype.setEditable = function(bEditable) { | ||
var bOldEditable = this.getEditable(); | ||
@@ -653,9 +746,37 @@ bEditable = this.validateProperty("editable", bEditable); | ||
// If we need validation | ||
if (!bEditable && this.hasListeners("editToggled")) { | ||
if (_checkForError.call(this)) { | ||
return this; | ||
if (this.getValidationMode() === SmartFormValidationMode.Standard) { | ||
// Sync validation | ||
if (_checkForError.call(this)) { | ||
return this; | ||
} | ||
} else { | ||
// Async validation | ||
_checkForErrorAsync.call(this).then(function (aErroneousFields) { | ||
if (aErroneousFields.length) { | ||
// We restore property to editable as there are errors | ||
return this.setProperty("editable", true); | ||
} | ||
_changeEditable.call(this, bEditable); | ||
}.bind(this)); | ||
// We stop here -_changeEditable will be executed async in the callBack method | ||
return this.setProperty("editable", bEditable); | ||
} | ||
} | ||
this.setProperty("editable", bEditable); | ||
_changeEditable.call(this, bEditable); | ||
return this; | ||
}; | ||
/** | ||
* Change the editable API property and handle needed transformations | ||
* @param {boolean} bEditable the target state | ||
* @private | ||
*/ | ||
function _changeEditable(bEditable) { | ||
if (this._oForm) { | ||
@@ -680,7 +801,4 @@ this._oForm.setEditable(bEditable); | ||
} | ||
} | ||
return this; | ||
}; | ||
function _observeChanges(oChanges){ | ||
@@ -1509,3 +1627,6 @@ | ||
this._oCheckButton.attachPress(_checkForm, this); | ||
// Attach the appropriate event handler depending on the validation mode | ||
this._oCheckButton.attachPress( | ||
(this.getValidationMode() === SmartFormValidationMode.Standard) ? _checkForm : _checkFormAsync | ||
, this); | ||
} | ||
@@ -1546,2 +1667,10 @@ | ||
function _checkFormAsync(oEvent) { | ||
this.check(true).then(function (aErroneousFields) { | ||
this.fireChecked({ | ||
erroneousFields: aErroneousFields | ||
}); | ||
}.bind(this)); | ||
} | ||
function _addSeparatorToToolbar(oToolbar) { | ||
@@ -1548,0 +1677,0 @@ |
@@ -48,3 +48,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.38 | ||
@@ -51,0 +51,0 @@ * @constructor |
@@ -36,3 +36,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.38 | ||
@@ -39,0 +39,0 @@ * @constructor |
@@ -37,3 +37,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.60 | ||
@@ -40,0 +40,0 @@ * @constructor |
@@ -38,3 +38,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.58 | ||
@@ -41,0 +41,0 @@ * @constructor |
@@ -34,3 +34,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.61 | ||
@@ -37,0 +37,0 @@ * @constructor |
@@ -34,3 +34,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @constructor | ||
@@ -37,0 +37,0 @@ * @public |
@@ -37,3 +37,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.60 | ||
@@ -40,0 +40,0 @@ * @constructor |
@@ -35,3 +35,3 @@ /* | ||
* @extends sap.ui.core.Control | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.38 | ||
@@ -38,0 +38,0 @@ * @constructor |
@@ -1010,3 +1010,3 @@ /* | ||
return NumberFormat.getInstance({ | ||
return NumberFormat.getFloatInstance({ | ||
style: "short", | ||
@@ -1013,0 +1013,0 @@ showScale: true, |
@@ -10,3 +10,3 @@ /*! | ||
* @static | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.38.0 | ||
@@ -13,0 +13,0 @@ */ |
@@ -32,3 +32,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @constructor | ||
@@ -35,0 +35,0 @@ * @public |
@@ -35,3 +35,3 @@ /* | ||
* @extends sap.ui.comp.smartmicrochart.SmartMicroChartBase | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.58 | ||
@@ -38,0 +38,0 @@ * @constructor |
@@ -26,3 +26,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -29,0 +29,0 @@ * @public |
@@ -111,3 +111,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -631,3 +631,3 @@ * @public | ||
} else { | ||
vValue = { value: NumberFormat.getFloatInstance().parse(vCompositeValue) }; | ||
vValue = { value: (NumberFormat.getFloatInstance().parse(vCompositeValue)).toString()}; | ||
} | ||
@@ -640,6 +640,4 @@ vUomValue = this.getUnitOfMeasure(); | ||
} | ||
} else if (this.isInteger()) { | ||
} else if (this.isInteger() && this.getDataType() !== "Edm.Int64") { | ||
vValue = NumberFormat.getIntegerInstance().parse(this.getValue()); | ||
} else if (this.isFloat()) { | ||
vValue = NumberFormat.getFloatInstance().parse(this.getValue()); | ||
} else { | ||
@@ -646,0 +644,0 @@ vValue = this.getValue(); |
@@ -9,4 +9,5 @@ /*! | ||
"sap/ui/core/util/reflection/JsControlTreeModifier", | ||
"sap/ui/comp/smartmultiedit/Container" | ||
], function (Log, JsControlTreeModifier, Container) { | ||
"sap/ui/comp/smartmultiedit/Container", | ||
"sap/ui/comp/smartform/flexibility/changes/AddFields" | ||
], function (Log, JsControlTreeModifier, Container, AddFields) { | ||
"use strict"; | ||
@@ -19,3 +20,3 @@ | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
*/ | ||
@@ -38,29 +39,37 @@ var AddMultiEditFields = {}; | ||
var oChangeDefinition = oChange.getDefinition(); | ||
var oModifier = mPropertyBag.modifier; | ||
var oAppComponent = mPropertyBag.appComponent; | ||
var oFieldSelector = oChangeDefinition.content.field.selector; | ||
var oView = mPropertyBag.view; | ||
var sFieldId = oChangeDefinition.content.field.id; | ||
var iInsertIndex = oChangeDefinition.content.field.index; | ||
var sPropertyName = oChangeDefinition.content.field.propertyName; | ||
if (this._checkChangeDefinition(oChangeDefinition)) { | ||
var oModifier = mPropertyBag.modifier, | ||
oFieldSelector = oChangeDefinition.content.field.selector, | ||
sFieldId = oChangeDefinition.content.field.id, | ||
iInsertIndex = oChangeDefinition.content.field.index, | ||
sJsType = oChangeDefinition.content.field.jsType, | ||
sPropertyName = oChangeDefinition.content.field.propertyName, | ||
oEntitySet = oChangeDefinition.content.field.entitySet; | ||
var oSmartForm = oChange.getDependentControl("form", mPropertyBag); //recently changes contain the info about the form | ||
var mDelegateInfo = oSmartForm && oModifier.getFlexDelegate(oSmartForm); | ||
if (!mDelegateInfo){ | ||
var oGroupElement = oModifier.createControl("sap.ui.comp.smartform.GroupElement", mPropertyBag.appComponent, mPropertyBag.view, oFieldSelector || sFieldId); | ||
var oField = this._createGroupElementField(oModifier, mPropertyBag.view, oGroupElement, sJsType, sPropertyName, oEntitySet, mPropertyBag.appComponent); | ||
oModifier.insertAggregation(oGroup, "groupElements", oGroupElement, iInsertIndex, mPropertyBag.view); | ||
if (this._checkChangeDefinition(oChangeDefinition)) { | ||
var sJsType = oChangeDefinition.content.field.jsType, | ||
oEntitySet = oChangeDefinition.content.field.entitySet; | ||
// Index the new sap.ui.comp.smartmultiedit.Field in its sap.ui.comp.smartmultiedit.Container | ||
var oContainer = this._getContainerFromGroup(oGroup); | ||
if (oContainer) { | ||
oContainer.indexField(oField); | ||
} | ||
var oGroupElement = oModifier.createControl("sap.ui.comp.smartform.GroupElement", mPropertyBag.appComponent, mPropertyBag.view, oFieldSelector || sFieldId); | ||
var oField = this._createGroupElementField(oModifier, mPropertyBag.view, oGroupElement, sJsType, sPropertyName, oEntitySet, mPropertyBag.appComponent); | ||
oModifier.insertAggregation(oGroup, "groupElements", oGroupElement, iInsertIndex, mPropertyBag.view); | ||
oChange.setRevertData(oModifier.getSelector(oGroupElement, mPropertyBag.appComponent)); | ||
// Index the new sap.ui.comp.smartmultiedit.Field in its sap.ui.comp.smartmultiedit.Container | ||
var oContainer = this._getContainerFromGroup(oGroup); | ||
if (oContainer) { | ||
oContainer.indexField(oField); | ||
} | ||
oChange.setRevertData({newFieldSelector: oModifier.getSelector(oGroupElement, mPropertyBag.appComponent)}); | ||
return true; | ||
} else { | ||
Log.error("Change doesn't contain sufficient information to be applied: " + this._getChangeInfo(oChangeDefinition)); | ||
// however subsequent changes should be applied | ||
return true; | ||
} else { | ||
Log.error("Change doesn't contain sufficient information to be applied: " + this._getChangeInfo(oChangeDefinition)); | ||
// however subsequent changes should be applied | ||
} | ||
} | ||
//with delegate present we get async | ||
return AddFields._addFieldFromDelegate(oSmartForm, oGroup, oFieldSelector, sFieldId, iInsertIndex, sPropertyName, oChange, oModifier, oView, oAppComponent); | ||
}; | ||
@@ -79,26 +88,28 @@ | ||
var oChangeDefinition = oChange.getDefinition(), | ||
oSelector = oChange.getRevertData(); | ||
mRevertData = oChange.getRevertData(), | ||
oSelector = mRevertData.newFieldSelector, | ||
oModifier = mPropertyBag.modifier; | ||
if (oSelector) { | ||
var sSelectorId = oSelector.idIsLocal ? mPropertyBag.appComponent.getId() + oSelector.id : oSelector.id; | ||
var oGroupElement = sap.ui.getCore().byId(sSelectorId); | ||
var oGroupElement = oModifier.bySelector(oSelector, mPropertyBag.appComponent, mPropertyBag.view); | ||
oModifier.removeAggregation(oGroup, "groupElements", oGroupElement); | ||
oModifier.destroy(oGroupElement); | ||
if (oGroupElement) { | ||
mPropertyBag.modifier.removeAggregation(oGroup, "groupElements", oGroupElement); | ||
// Refresh the indexing of sap.ui.comp.smartmultiedit.Fields in its sap.ui.comp.smartmultiedit.Container | ||
var oContainer = this._getContainerFromGroup(oGroup); | ||
if (oContainer) { | ||
oContainer._refreshFields(); | ||
} | ||
var mValueHelpSelector = mRevertData.valueHelpSelector; | ||
if (mValueHelpSelector) { | ||
var oAppComponent = mPropertyBag.appComponent; | ||
var oView = mPropertyBag.view; | ||
var oValueHelp = oModifier.bySelector(mValueHelpSelector, oAppComponent, oView); | ||
var oSmartForm = oChange.getDependentControl("form", mPropertyBag); //recently changes contain the info about the form | ||
oModifier.removeAggregation(oSmartForm, "dependents", oValueHelp); | ||
oModifier.destroy(oValueHelp); | ||
} | ||
oChange.resetRevertData(); | ||
// Refresh the indexing of sap.ui.comp.smartmultiedit.Fields in its sap.ui.comp.smartmultiedit.Container | ||
var oContainer = this._getContainerFromGroup(oGroup); | ||
if (oContainer) { | ||
oContainer._refreshFields(); | ||
} | ||
oChange.resetRevertData(); | ||
return true; | ||
} else { | ||
Log.error( | ||
"Change could not be reverted because selector '" + sSelectorId + "' did not find any control: " + | ||
this._getChangeInfo(oChangeDefinition) | ||
); | ||
} | ||
} else { | ||
@@ -161,2 +172,6 @@ Log.error( | ||
} | ||
if (oSpecificChangeInfo.relevantContainerId) { | ||
// new add via delegate changes contain the smartform | ||
oChange.addDependentControl(oSpecificChangeInfo.relevantContainerId, "form", mPropertyBag); | ||
} | ||
@@ -163,0 +178,0 @@ }; |
@@ -29,7 +29,8 @@ /* | ||
"sap/ui/core/library", | ||
"sap/ui/core/ResizeHandler" | ||
"sap/ui/core/ResizeHandler", | ||
"sap/base/util/isEmptyObject" | ||
], function( | ||
MLibrary, List, Popover, StandardListItem, MultiInput, MultiComboBox, Token, Tokenizer, SmartField, | ||
MetadataAnalyser, ParseException, ValidateException, BindingMode, ODataType, ValueHelpProvider, FormatUtil, | ||
DateFormat, FilterProvider, Log, deepEqual, library, coreLibrary, ResizeHandler | ||
DateFormat, FilterProvider, Log, deepEqual, library, coreLibrary, ResizeHandler, isEmptyObject | ||
) { | ||
@@ -88,3 +89,3 @@ "use strict"; | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* | ||
@@ -249,8 +250,2 @@ * @public | ||
var mAttributes = this._createAttributes(); | ||
// in version 1.61 new property 'autocomplete' was added to sap.m.Input | ||
// this property is true by default | ||
// autocomplete is somehow connected to suggestions popover and in combination with ValueHelpProvider that is used on the MultiInput | ||
// and which does its own validation, causes repeated TokenUpdate calls when user writes text into MultiInput | ||
// and suggestions popover is already opened and than use for example tab key to change focus | ||
mAttributes.autocomplete = false; | ||
@@ -382,3 +377,7 @@ this._oMultiInput = new MultiInput(this.getId() + sIdSuffix, mAttributes); | ||
} else { | ||
aNewTokens.push(oOldToken); | ||
// push new token to copy modified text (if any) | ||
var oNewToken = aTokens.filter(function (oToken) { | ||
return oOldToken.getKey() === oToken.getKey(); | ||
})[0]; | ||
aNewTokens.push(oNewToken); | ||
} | ||
@@ -539,7 +538,7 @@ }); | ||
SmartMultiInput.prototype._bindMultiInputOneWay = function () { | ||
this._bindMultiInputTokens(); | ||
this._bindMultiInputTokens(this._oMultiInput); | ||
}; | ||
SmartMultiInput.prototype._bindMultiInputTwoWay = function () { | ||
this._bindMultiInputTokens(); | ||
this._bindMultiInputTokens(this._oMultiInput); | ||
@@ -553,12 +552,9 @@ this._oMultiInput.attachTokenUpdate(function (oEvent) { | ||
}; | ||
SmartMultiInput.prototype._bindMultiInputTokens = function () { | ||
SmartMultiInput.prototype._bindMultiInputTokens = function (oParentControl) { | ||
var sNavigationPath = this._getNavigationPath(), | ||
oSelectParameters; | ||
if (this.getEnableODataSelect()) { | ||
oSelectParameters = { | ||
"select": this._addODataSelectParameters() | ||
}; | ||
this._oMultiInput.bindAggregation("tokens", { | ||
oSelectExpandParameter = this._getSelectExpandParameter(); | ||
if (!isEmptyObject(oSelectExpandParameter)) { | ||
oParentControl.bindAggregation("tokens", { | ||
path: sNavigationPath, | ||
parameters: oSelectParameters, | ||
parameters: oSelectExpandParameter, | ||
// create token for each entity from the navigation property | ||
@@ -568,3 +564,3 @@ factory: this._tokensFactory.bind(this) | ||
} else { | ||
this._oMultiInput.bindAggregation("tokens", { | ||
oParentControl.bindAggregation("tokens", { | ||
path: sNavigationPath, | ||
@@ -578,2 +574,13 @@ // create token for each entity from the navigation property | ||
SmartMultiInput.prototype._getSelectExpandParameter = function () { | ||
var oParameter = {}; | ||
if (this.getEnableODataSelect()) { | ||
oParameter.select = this._addODataSelectParameters(); | ||
} | ||
if (this._oFactory._oMetaData.annotations.text && this._oFactory._oMetaData.annotations.text.navigationPathHelp) { | ||
oParameter.expand = this._oFactory._oMetaData.annotations.text.navigationPathHelp; | ||
} | ||
return oParameter; | ||
}; | ||
SmartMultiInput.prototype._addODataSelectParameters = function (oBinding) { | ||
@@ -689,3 +696,3 @@ //get the property and description | ||
//binding is done in one common place | ||
this._bindMultiInputTokens(); | ||
this._bindMultiInputTokens(this._oMultiInput); | ||
@@ -813,3 +820,2 @@ var oBinding = this._oMultiInput.getBinding("tokens"); | ||
SmartMultiInput.prototype._createTokenizer = function () { | ||
var sNavigationPath = this._getNavigationPath(); | ||
@@ -824,7 +830,3 @@ this._oTokenizer = new Tokenizer(this.getId() + sDisplayIdSuffix, { | ||
if (this.getBindingContext()) { | ||
this._oTokenizer.bindAggregation("tokens", { | ||
path: sNavigationPath, | ||
// create token for each entity from the navigation property | ||
factory: this._tokensFactory.bind(this) | ||
}); | ||
this._bindMultiInputTokens(this._oTokenizer); | ||
} else { | ||
@@ -1276,2 +1278,5 @@ // has to be called every time display mode is changed | ||
if (oDescriptionField) { | ||
if (oDescriptionField.navigationPathHelp) { | ||
return oDescriptionField.navigationPathHelp + "/" + oDescriptionField.property.property.name; | ||
} | ||
return oDescriptionField.property.property.name; | ||
@@ -1278,0 +1283,0 @@ } |
@@ -7,6 +7,5 @@ /* | ||
sap.ui.define([ | ||
"sap/ui/thirdparty/jquery", | ||
"sap/base/Log", | ||
'sap/ui/comp/library' | ||
], function(jQuery, Log, library) { | ||
'sap/base/util/merge', | ||
"sap/base/Log" | ||
], function(merge, Log) { | ||
"use strict"; | ||
@@ -24,53 +23,96 @@ | ||
/** | ||
* Adds the favorite flag to a variant. | ||
* | ||
* @param {sap.ui.fl.Change} oChange | ||
* @param {sap.ui.comp.variants.VariantManagement} oVariantManagement control | ||
* @param {object} mPropertyBag | ||
* @private | ||
*/ | ||
AddFavorite.applyChange = function(oChange, oVariantManagement, mPropertyBag) { | ||
var oChangeContent = oChange.getContent(); | ||
if (jQuery.isEmptyObject(oChangeContent)) { | ||
if (!oChangeContent) { | ||
Log.error("Change does not contain sufficient information to be applied"); | ||
return false; | ||
return; | ||
} | ||
var oModifier = mPropertyBag.modifier; | ||
// Update the value of 'favorites' property | ||
oVariantManagement.getItems().some(function(oItem) { | ||
if (oItem.getKey() === oChangeContent.key) { | ||
// Also if the current visibility is equal to the visibility of the change we have to call '_updateAvailableAction' in order to update | ||
// the 'Define Links' text. | ||
// mPropertyBag.modifier.setProperty(oItem, "visible", oChangeContent.visible); | ||
oItem.setFavorite(oChangeContent.visible); | ||
return true; | ||
} else if (oItem.getKey() === library.STANDARD_VARIANT_NAME) { | ||
var mPersoInfo = merge({}, oModifier.getProperty(oVariantManagement, "adaptationInfo")); | ||
if (!mPersoInfo.addFavorites) { | ||
mPersoInfo.addFavorites = {}; | ||
} | ||
if (oVariantManagement.setStandardFavorite) { | ||
if (oChangeContent.key === oVariantManagement.STANDARDVARIANTKEY) { | ||
oChange.setRevertData({ | ||
key: oChangeContent.key, | ||
visible: oVariantManagement.getStandardFavorite() | ||
}); | ||
oVariantManagement.setStandardFavorite(oChangeContent.visible); | ||
return true; | ||
} else { | ||
var oItem = oVariantManagement.getItemByKey(oChangeContent.key); | ||
if (oItem) { | ||
oChange.setRevertData({ | ||
key: oChangeContent.key, | ||
visible: oItem.getFavorite() | ||
}); | ||
oItem.setFavorite(oChangeContent.visible); | ||
} | ||
} | ||
}); | ||
return true; | ||
} else { | ||
if (mPersoInfo.addFavorites.hasOwnProperty(oChangeContent.key)) { | ||
oChange.setRevertData({ | ||
key: oChangeContent.key, | ||
visible: mPersoInfo.addFavorites[oChangeContent.key] | ||
}); | ||
} | ||
} | ||
mPersoInfo.addFavorites[oChangeContent.key] = oChangeContent.visible; | ||
oModifier.setProperty(oVariantManagement, "adaptationInfo", mPersoInfo); | ||
}; | ||
/** | ||
* Completes the change by adding change handler specific content | ||
* | ||
* @param {sap.ui.fl.Change} oChange Change wrapper object to be completed | ||
* @param {object} oSpecificChangeInfo | ||
* @param {object} mPropertyBag | ||
* @private | ||
*/ | ||
AddFavorite.completeChangeContent = function(oChange, oSpecificChangeInfo, mPropertyBag) { | ||
if (jQuery.isEmptyObject(oSpecificChangeInfo.content)) { | ||
if (!oSpecificChangeInfo.hasOwnProperty("content")) { | ||
throw new Error("oSpecificChangeInfo.content should be filled"); | ||
} | ||
if (!oSpecificChangeInfo.content.key) { | ||
if (!oSpecificChangeInfo.content.hasOwnProperty("key")) { | ||
throw new Error("In oSpecificChangeInfo.content.key attribute is required"); | ||
} | ||
if (oSpecificChangeInfo.content.visible !== true) { | ||
throw new Error("In oSpecificChangeInfo.content.select attribute should be 'true'"); | ||
if (!oSpecificChangeInfo.content.hasOwnProperty("visible")) { | ||
throw new Error("In oSpecificChangeInfo.content.visible attribute attribute is required"); | ||
} | ||
}; | ||
oChange.setContent(oSpecificChangeInfo.content); | ||
AddFavorite.revertChange = function(oChange, oVariantManagement, mPropertyBag) { | ||
var oModifier = mPropertyBag.modifier; | ||
var mPersoInfo = merge({}, oModifier.getProperty(oVariantManagement, "adaptationInfo")); | ||
var oChangeContent = oChange.getRevertData(); | ||
if (oChangeContent) { | ||
if (oVariantManagement.setStandardFavorite) { | ||
if (oChangeContent.key === oVariantManagement.STANDARDVARIANTKEY) { | ||
oVariantManagement.setStandardFavorite(oChangeContent.visible); | ||
} else { | ||
var oItem = oVariantManagement.getItemByKey(oChangeContent.key); | ||
if (oItem) { | ||
oItem.setFavorite(oChangeContent.visible); | ||
} | ||
} | ||
} | ||
oChange.resetRevertData(); | ||
mPersoInfo.addFavorites[oChangeContent.key] = oChangeContent.visible; | ||
} else { | ||
oChangeContent = oChange.getContent(); | ||
if (mPersoInfo.addFavorites && mPersoInfo.addFavorites.hasOwnProperty(oChangeContent.key)) { | ||
delete mPersoInfo.addFavorites[oChangeContent.key]; | ||
} | ||
} | ||
oModifier.setProperty(oVariantManagement, "adaptationInfo", mPersoInfo); | ||
}; | ||
@@ -77,0 +119,0 @@ |
@@ -96,3 +96,3 @@ /* | ||
global: true, | ||
executeOnSelection: false, | ||
executeOnSelection: this._getExecuteOnSelection(oVariantManagement, sVariantKey), | ||
lifecycleTransportId: "", | ||
@@ -109,22 +109,6 @@ lifecyclePackage: "", | ||
aVariantKeys.push(sVariantKey); | ||
// } else { | ||
// bNewStandard = this._defaultSelectionVariantHandling(oVariantManagement, oSPVariant); | ||
} | ||
}); | ||
}.bind(this)); | ||
// if (!oVariantManagement._getDefaultVariantKey()) { | ||
// if (oVariantManagement.getDefaultVariantKey()) { | ||
// sDefaultKey = sKeyPrefix + this.getDefaultVariantName(); | ||
// oVariantManagement.setInitialSelectionKey(sDefaultKey); | ||
// oVariantManagement.fireSelect({ | ||
// key: sDefaultKey | ||
// }); | ||
// } else if (bNewStandard) { | ||
// oVariantManagement.fireSelect({ | ||
// key: this._oSmartVariantManagement.STANDARDVARIANTKEY | ||
// }); | ||
// } | ||
// } | ||
oVariantManagement.applyDefaultFavorites(aVariantKeys, true); | ||
@@ -135,2 +119,11 @@ } | ||
SmartVariantManagementAdapter.prototype._getExecuteOnSelection = function(oVariantManagement, sKey) { | ||
var oAdaptionInfo = oVariantManagement.getProperty("adaptationInfo"); | ||
if (oAdaptionInfo && oAdaptionInfo.executeOnSelect) { | ||
return !!oAdaptionInfo.executeOnSelect[sKey]; | ||
} | ||
return false; | ||
}; | ||
SmartVariantManagementAdapter.prototype.destroy = function() { | ||
@@ -137,0 +130,0 @@ Element.prototype.destroy.apply(this, arguments); |
@@ -17,3 +17,3 @@ /* | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @constructor | ||
@@ -110,2 +110,26 @@ * @public | ||
type: "object" | ||
}, | ||
/** | ||
* Structure containing Date range semantic data of the filter value. | ||
* | ||
* <pre><code> | ||
* { | ||
* Dates: [ | ||
* { | ||
* PropertyName: string, | ||
* Data: { | ||
* calendarType: string, | ||
* key: string, | ||
* operation: string, | ||
* value1: int, | ||
* value2: int | ||
* } | ||
* } | ||
* ] | ||
* } | ||
* </code></pre> | ||
*/ | ||
semanticDates: { | ||
type: "object" | ||
} | ||
@@ -174,3 +198,3 @@ } | ||
oSelOption.Ranges.forEach(function(oRange) { | ||
if (oRange.Option === "EQ") { | ||
if (oRange.Option === "EQ" && oRange.Sign === "I") { | ||
oObj.keys.push(oRange.Low); | ||
@@ -538,4 +562,82 @@ } | ||
}; | ||
/** | ||
* Constructs the value state out of a given selection variant and the current model data | ||
* @protected | ||
* @param {object} oSelectionVariant selection variant object | ||
* @param {map} mData the filter provider model data | ||
* @returns {object} the values texts format | ||
*/ | ||
UIState.calcSemanticDates = function(oSelectionVariant, mData) { | ||
var oSemanticDates = null; | ||
var fAddEntry = function(sPropertyName, oEntry) { | ||
var oPropTextEntry = null; | ||
if (!oSemanticDates) { | ||
oSemanticDates = { | ||
"Dates": [] | ||
}; | ||
} | ||
for (var i = 0; i < oSemanticDates.Dates.length; i++) { | ||
if (oSemanticDates.Dates[i].PropertyName === sPropertyName) { | ||
oPropTextEntry = oSemanticDates.Dates[i]; | ||
break; | ||
} | ||
} | ||
if (!oPropTextEntry) { | ||
oPropTextEntry = { | ||
"PropertyName": sPropertyName, | ||
"Data" : oEntry.conditionTypeInfo.data | ||
}; | ||
oSemanticDates.Dates.push(oPropTextEntry); | ||
} | ||
}; | ||
if (mData && oSelectionVariant && oSelectionVariant.SelectOptions) { | ||
oSelectionVariant.SelectOptions.forEach(function(oSelectOption) { | ||
if (mData[oSelectOption.PropertyName]) { | ||
if (mData[oSelectOption.PropertyName].ranges) { | ||
if (mData[oSelectOption.PropertyName].hasOwnProperty("conditionTypeInfo")) { | ||
fAddEntry(oSelectOption.PropertyName, mData[oSelectOption.PropertyName]); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
return oSemanticDates; | ||
}; | ||
/** | ||
* Enriches the internal filter bar value format with the information from the value state. | ||
* @protected | ||
* @param {string} sPayload the filter bar inner data format | ||
* @param {object} oValueTexts the value texts format containing the eventual descriptions. | ||
* @returns {string} enriched the filter bar inner data format | ||
*/ | ||
UIState.enrichWithSemanticDates = function(sPayload, oSemanticDates) { | ||
var bEnriched = false, oPayload, sEnrichedPayload = sPayload; | ||
if (oSemanticDates && oSemanticDates.Dates) { | ||
if (!oPayload) { | ||
oPayload = JSON.parse(sPayload); | ||
} | ||
oSemanticDates.Dates.forEach(function(oProperty) { | ||
var oPayloadProperty = oPayload[oProperty.PropertyName]; | ||
if (oPayloadProperty && oPayloadProperty.ranges && oProperty.Data) { | ||
bEnriched = true; | ||
if (!oPayloadProperty.items) { | ||
oPayloadProperty.items = []; | ||
} | ||
oPayloadProperty.ranges[0].semantic = oProperty.Data; | ||
} | ||
}); | ||
if (bEnriched) { | ||
sEnrichedPayload = JSON.stringify(oPayload); | ||
} | ||
} | ||
return sEnrichedPayload; | ||
}; | ||
return UIState; | ||
}); |
@@ -33,3 +33,3 @@ /*! | ||
* @author SAP SE | ||
* @version 1.80.1 | ||
* @version 1.81.0 | ||
* @since 1.63.0 | ||
@@ -36,0 +36,0 @@ * |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5526258
322
93069