@openui5/sap.ui.integration 1.111.2 → 1.112.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -3
- package/src/sap/ui/integration/.library +10 -1
- package/src/sap/ui/integration/ActionDefinition.js +1 -1
- package/src/sap/ui/integration/Designtime.js +1 -1
- package/src/sap/ui/integration/Extension.js +5 -1
- package/src/sap/ui/integration/Host.js +5 -1
- package/src/sap/ui/integration/cards/AdaptiveContent.js +1 -1
- package/src/sap/ui/integration/cards/AnalyticalContent.js +1 -1
- package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +1 -1
- package/src/sap/ui/integration/cards/BaseContent.js +12 -3
- package/src/sap/ui/integration/cards/BaseContentRenderer.js +12 -7
- package/src/sap/ui/integration/cards/BaseListContent.js +1 -1
- package/src/sap/ui/integration/cards/CalendarContent.js +11 -8
- package/src/sap/ui/integration/cards/ComponentContent.js +12 -2
- package/src/sap/ui/integration/cards/Footer.js +2 -2
- package/src/sap/ui/integration/cards/Header.js +1 -1
- package/src/sap/ui/integration/cards/ListContent.js +1 -1
- package/src/sap/ui/integration/cards/NumericHeader.js +1 -1
- package/src/sap/ui/integration/cards/ObjectContent.js +106 -101
- package/src/sap/ui/integration/cards/TableContent.js +1 -1
- package/src/sap/ui/integration/cards/TimelineContent.js +1 -1
- package/src/sap/ui/integration/cards/WebPageContent.js +1 -1
- package/src/sap/ui/integration/cards/actions/CardActions.js +15 -13
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputChoiceSet.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputDate.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputNumber.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputText.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputToggle.js +1 -1
- package/src/sap/ui/integration/cards/filters/BaseFilter.js +22 -13
- package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +12 -6
- package/src/sap/ui/integration/cards/filters/FilterBar.js +1 -1
- package/src/sap/ui/integration/cards/filters/FilterBarFactory.js +1 -1
- package/src/sap/ui/integration/cards/filters/SearchFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/SelectFilter.js +1 -1
- package/src/sap/ui/integration/cards/list/MicrochartsResizeHelper.js +1 -1
- package/src/sap/ui/integration/controls/ActionsStrip.js +1 -1
- package/src/sap/ui/integration/controls/ActionsToolbar.js +1 -1
- package/src/sap/ui/integration/controls/LinkWithIcon.js +1 -1
- package/src/sap/ui/integration/controls/ListContentItem.js +1 -1
- package/src/sap/ui/integration/controls/Microchart.js +1 -1
- package/src/sap/ui/integration/controls/MicrochartLegend.js +1 -1
- package/src/sap/ui/integration/controls/ObjectStatus.js +1 -1
- package/src/sap/ui/integration/controls/Paginator.js +1 -1
- package/src/sap/ui/integration/customElements/CustomElementCardEditor.js +3 -0
- package/src/sap/ui/integration/customElements/CustomElementEditor.js +3 -0
- package/src/sap/ui/integration/designtime/baseEditor/BaseEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditors.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/BasePropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/PropertyEditorFactory.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/arrayEditor/ArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/codeEditor/CodeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/enumStringEditor/EnumStringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/groupEditor/GroupEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IsInIconPool.validator.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/integerEditor/IntegerEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/jsonEditor/JsonEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/listEditor/ListEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/multiSelectEditor/MultiSelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/numberEditor/NumberEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/objectArrayEditor/ObjectArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/selectEditor/SelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/separatorEditor/SeparatorEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/stringEditor/StringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/textAreaEditor/TextAreaEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/binding/ObjectBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/unset.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsBoolean.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsDate.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsInteger.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsNumber.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsSelectedKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsStringList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsValidBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/MaxLength.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/NotABinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/ValidatorRegistry.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/config/ObjectCardConfig.js +12 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n.properties +6 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ar.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_bg.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ca.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_cs.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_cy.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_da.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_de.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_el.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_GB.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_sappsd.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_saprigi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_saptrc.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_es.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_es_MX.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_et.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fr.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fr_CA.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hi.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hr.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hu.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_id.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_it.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_iw.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ja.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_kk.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ko.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_lt.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_lv.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ms.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_nl.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_no.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pl.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pt.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pt_PT.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ro.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ru.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sh.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sk.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sl.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sv.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_th.properties +5 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_tr.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_uk.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_vi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_zh_CN.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_zh_TW.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/complexMapEditor/ComplexMapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/destinationsEditor/DestinationsEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/filtersEditor/FiltersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/parametersEditor/ParametersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/editor/Card.js +59 -0
- package/src/sap/ui/integration/designtime/editor/CardEditor.js +31 -20
- package/src/sap/ui/integration/designtime/editor/CardPreview.js +200 -64
- package/src/sap/ui/integration/designtime/editor/CardRenderer.js +65 -0
- package/src/sap/ui/integration/designtime/editor/css/CardPreview.css +82 -20
- package/src/sap/ui/integration/editor/Editor.js +93 -73
- package/src/sap/ui/integration/editor/EditorResourceBundles.js +94 -0
- package/src/sap/ui/integration/editor/Extension.js +1 -1
- package/src/sap/ui/integration/editor/Manifest.js +1 -1
- package/src/sap/ui/integration/editor/Settings.js +1 -1
- package/src/sap/ui/integration/editor/fields/BaseField.js +1 -1
- package/src/sap/ui/integration/editor/fields/BooleanField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateTimeField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DestinationField.js +1 -1
- package/src/sap/ui/integration/editor/fields/GroupField.js +1 -1
- package/src/sap/ui/integration/editor/fields/IntegerField.js +1 -1
- package/src/sap/ui/integration/editor/fields/NumberField.js +1 -1
- package/src/sap/ui/integration/editor/fields/ObjectField.js +9 -5
- package/src/sap/ui/integration/editor/fields/ObjectListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/StringField.js +6 -3
- package/src/sap/ui/integration/editor/fields/StringListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/fragment/Controller.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ColorSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/IconSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ShapeSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/VizBase.js +1 -1
- package/src/sap/ui/integration/library-bootstrap.js +1 -1
- package/src/sap/ui/integration/library.js +31 -2
- package/src/sap/ui/integration/messagebundle.properties +9 -0
- package/src/sap/ui/integration/messagebundle_ar.properties +4 -2
- package/src/sap/ui/integration/messagebundle_bg.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ca.properties +4 -2
- package/src/sap/ui/integration/messagebundle_cs.properties +4 -2
- package/src/sap/ui/integration/messagebundle_cy.properties +4 -2
- package/src/sap/ui/integration/messagebundle_da.properties +4 -2
- package/src/sap/ui/integration/messagebundle_de.properties +4 -2
- package/src/sap/ui/integration/messagebundle_el.properties +4 -2
- package/src/sap/ui/integration/messagebundle_en.properties +3 -1
- package/src/sap/ui/integration/messagebundle_en_GB.properties +3 -1
- package/src/sap/ui/integration/messagebundle_en_US_sappsd.properties +2 -0
- package/src/sap/ui/integration/messagebundle_en_US_saprigi.properties +3 -1
- package/src/sap/ui/integration/messagebundle_en_US_saptrc.properties +2 -0
- package/src/sap/ui/integration/messagebundle_es.properties +4 -2
- package/src/sap/ui/integration/messagebundle_es_MX.properties +4 -2
- package/src/sap/ui/integration/messagebundle_et.properties +4 -2
- package/src/sap/ui/integration/messagebundle_fi.properties +4 -2
- package/src/sap/ui/integration/messagebundle_fr.properties +4 -2
- package/src/sap/ui/integration/messagebundle_fr_CA.properties +4 -2
- package/src/sap/ui/integration/messagebundle_hi.properties +4 -2
- package/src/sap/ui/integration/messagebundle_hr.properties +4 -2
- package/src/sap/ui/integration/messagebundle_hu.properties +4 -2
- package/src/sap/ui/integration/messagebundle_id.properties +4 -2
- package/src/sap/ui/integration/messagebundle_it.properties +4 -2
- package/src/sap/ui/integration/messagebundle_iw.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ja.properties +4 -2
- package/src/sap/ui/integration/messagebundle_kk.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ko.properties +4 -2
- package/src/sap/ui/integration/messagebundle_lt.properties +4 -2
- package/src/sap/ui/integration/messagebundle_lv.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ms.properties +4 -2
- package/src/sap/ui/integration/messagebundle_nl.properties +4 -2
- package/src/sap/ui/integration/messagebundle_no.properties +4 -2
- package/src/sap/ui/integration/messagebundle_pl.properties +4 -2
- package/src/sap/ui/integration/messagebundle_pt.properties +4 -2
- package/src/sap/ui/integration/messagebundle_pt_PT.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ro.properties +4 -2
- package/src/sap/ui/integration/messagebundle_ru.properties +4 -2
- package/src/sap/ui/integration/messagebundle_sh.properties +4 -2
- package/src/sap/ui/integration/messagebundle_sk.properties +4 -2
- package/src/sap/ui/integration/messagebundle_sl.properties +4 -2
- package/src/sap/ui/integration/messagebundle_sv.properties +4 -2
- package/src/sap/ui/integration/messagebundle_th.properties +4 -2
- package/src/sap/ui/integration/messagebundle_tr.properties +4 -2
- package/src/sap/ui/integration/messagebundle_uk.properties +4 -2
- package/src/sap/ui/integration/messagebundle_vi.properties +4 -2
- package/src/sap/ui/integration/messagebundle_zh_CN.properties +4 -2
- package/src/sap/ui/integration/messagebundle_zh_TW.properties +4 -2
- package/src/sap/ui/integration/model/ContextModel.js +1 -1
- package/src/sap/ui/integration/model/ObservableModel.js +1 -1
- package/src/sap/ui/integration/model/PagingModelListBinding.js +1 -1
- package/src/sap/ui/integration/schemas/sap-card.json +51 -4
- package/src/sap/ui/integration/themes/base/ObjectContent.less +24 -0
- package/src/sap/ui/integration/util/BaseFactory.js +1 -1
- package/src/sap/ui/integration/util/BindingHelper.js +1 -1
- package/src/sap/ui/integration/util/BindingResolver.js +15 -8
- package/src/sap/ui/integration/util/CardObserver.js +1 -1
- package/src/sap/ui/integration/util/ContentFactory.js +1 -1
- package/src/sap/ui/integration/util/CsrfTokenHandler.js +1 -1
- package/src/sap/ui/integration/util/DataProvider.js +12 -12
- package/src/sap/ui/integration/util/DataProviderFactory.js +53 -20
- package/src/sap/ui/integration/util/Destinations.js +1 -1
- package/src/sap/ui/integration/util/ExtensionDataProvider.js +1 -1
- package/src/sap/ui/integration/util/Form.js +440 -0
- package/src/sap/ui/integration/util/HeaderFactory.js +1 -1
- package/src/sap/ui/integration/util/JSONBindingHelper.js +1 -1
- package/src/sap/ui/integration/util/LoadingProvider.js +1 -1
- package/src/sap/ui/integration/util/Manifest.js +1 -1
- package/src/sap/ui/integration/util/ManifestResolver.js +11 -4
- package/src/sap/ui/integration/util/Measurement.js +64 -33
- package/src/sap/ui/integration/util/RequestDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceManager.js +1 -1
- package/src/sap/ui/integration/util/SkeletonCard.js +1 -1
- package/src/sap/ui/integration/util/Utils.js +1 -1
- package/src/sap/ui/integration/util/Validators.js +1 -1
- package/src/sap/ui/integration/widgets/Card.js +96 -50
- package/src/sap/ui/integration/widgets/CardRenderer.js +5 -0
- package/src/sap-ui-integration.js +1 -1
- package/ui5.yaml +8 -0
- package/src/sap/ui/integration/util/Forms.js +0 -204
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/ui/base/ManagedObject",
|
|
8
|
+
"sap/ui/core/library",
|
|
9
|
+
"sap/base/Log",
|
|
10
|
+
"sap/base/util/deepExtend",
|
|
11
|
+
"./Validators",
|
|
12
|
+
"./BindingResolver"
|
|
13
|
+
], function (ManagedObject, coreLibrary, Log, deepExtend, Validators, BindingResolver) {
|
|
14
|
+
"use strict";
|
|
15
|
+
|
|
16
|
+
var ValueState = coreLibrary.ValueState;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Utility class for handling forms in the cards.
|
|
20
|
+
*
|
|
21
|
+
* @author SAP SE
|
|
22
|
+
* @version 1.112.2
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
* @ui5-restricted
|
|
26
|
+
* @alias sap.ui.integration.util.Form
|
|
27
|
+
*/
|
|
28
|
+
var Form = ManagedObject.extend("sap.ui.integration.util.Form", {
|
|
29
|
+
constructor: function (oCard) {
|
|
30
|
+
ManagedObject.apply(this);
|
|
31
|
+
|
|
32
|
+
this._oCard = oCard;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
metadata: {
|
|
36
|
+
library: "sap.ui.integration"
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
Form.prototype.init = function () {
|
|
41
|
+
this._mControls = new Map();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Form.prototype.exit = function () {
|
|
45
|
+
this._mControls.clear();
|
|
46
|
+
delete this._mControls;
|
|
47
|
+
delete this._oCard;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Adds the ObjectGroupItem to the form.
|
|
52
|
+
* Changes based on the provided event fired by the ObjectGroupItem will be reflected in the model "form".
|
|
53
|
+
* @param {string} sEventType event type
|
|
54
|
+
* @param {sap.ui.core.Control} oControl control instance
|
|
55
|
+
* @param {object} oItem ObjectGroupItem definition from the manifest
|
|
56
|
+
* @param {string} sPath path to this ObjectGroupItem in the manifest
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
Form.prototype.addControl = function (sEventType, oControl, oItem, sPath) {
|
|
60
|
+
if (!this._isValidControlId(oItem.id)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this._syncToFormModelOn(sEventType, oControl, oItem, sPath);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Performs the defined validations on the form controls.
|
|
69
|
+
* @param {boolean} bShowValueState Whether to show the value state on the form controls
|
|
70
|
+
* @param {boolean} bSkipFiringStateChangedEvent Whether to skip firing stateChanged event
|
|
71
|
+
*/
|
|
72
|
+
Form.prototype.validate = function (bShowValueState, bSkipFiringStateChangedEvent) {
|
|
73
|
+
var bStateChanged = false;
|
|
74
|
+
|
|
75
|
+
this._mControls.forEach(function (oControl) {
|
|
76
|
+
if (this._validateControl(oControl, bShowValueState)) {
|
|
77
|
+
bStateChanged = true;
|
|
78
|
+
}
|
|
79
|
+
}.bind(this));
|
|
80
|
+
|
|
81
|
+
if (bStateChanged && !bSkipFiringStateChangedEvent) {
|
|
82
|
+
this._oCard._fireStateChanged();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Resolves an ObjectGroupItem with the values from the form control it corresponds to
|
|
88
|
+
* @param {object} oItem ObjectGroupItem definition
|
|
89
|
+
* @returns {object} object containing the form control data
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
Form.prototype.resolveControl = function (oItem) {
|
|
93
|
+
var oResolved = {},
|
|
94
|
+
vValue,
|
|
95
|
+
aValidations = this.getModel("messages").getProperty("/records"),
|
|
96
|
+
oValueState = aValidations.find(function (oValidation) {
|
|
97
|
+
return oValidation.bindingPath === "/" + oItem.id;
|
|
98
|
+
}),
|
|
99
|
+
oControl = this._mControls.get(oItem.id);
|
|
100
|
+
|
|
101
|
+
if (oValueState && (oControl && oControl._bShowValueState)) { // should we return the very first validation, even when the control hasn't been touched yet? this is when the form control is not dirty
|
|
102
|
+
oResolved.valueState = { message: oValueState.message, type: oValueState.type };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (oItem.type === "ComboBox") {
|
|
106
|
+
vValue = this.getModel("form").getProperty("/" + oItem.id);
|
|
107
|
+
oResolved.selectedKey = vValue.key;
|
|
108
|
+
vValue = vValue.value;
|
|
109
|
+
} else {
|
|
110
|
+
vValue = this.getModel("form").getProperty("/" + oItem.id);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
oResolved.value = vValue;
|
|
114
|
+
|
|
115
|
+
return oResolved;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Assigns a value to a form control.
|
|
120
|
+
* @param {object} oFormControlData Object with key and respective value property to set.
|
|
121
|
+
* The name of the value property is named based on the type of the ObjectGroupItem as defined in the manifest.
|
|
122
|
+
* @public
|
|
123
|
+
*/
|
|
124
|
+
Form.prototype.setControlValue = function (oFormControlData) {
|
|
125
|
+
if (!this._isControlDataValid(oFormControlData)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var sId = oFormControlData.id,
|
|
130
|
+
oControl = this._mControls.get(sId);
|
|
131
|
+
|
|
132
|
+
if (oControl.isA("sap.m.ComboBox")) {
|
|
133
|
+
this._setComboBoxValue(oControl, oFormControlData);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if ("value" in oFormControlData && oControl.isA(["sap.m.TextArea", "sap.m.Input"])) {
|
|
137
|
+
oControl.setValue(oFormControlData.value);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this._validateAndUpdate(oControl);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
Form.prototype._setComboBoxValue = function (oComboBox, oControlData) {
|
|
144
|
+
var oSelectedItem;
|
|
145
|
+
|
|
146
|
+
if ("key" in oControlData) {
|
|
147
|
+
oComboBox.setSelectedKey(oControlData.key);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if ("value" in oControlData && !("key" in oControlData)) {
|
|
151
|
+
oSelectedItem = oComboBox.getItems().find(function (oItem) {
|
|
152
|
+
return oItem.getText() === oControlData.value;
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
if (oSelectedItem) {
|
|
156
|
+
oComboBox.setSelectedItem(oSelectedItem);
|
|
157
|
+
} else {
|
|
158
|
+
oComboBox.setSelectedKey(""); // now entering unknown value, reset selectedKey to keep it in sync
|
|
159
|
+
oComboBox.setValue(oControlData.value);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
Form.prototype._isValidControlId = function (sId) {
|
|
165
|
+
if (!sId) {
|
|
166
|
+
Log.error("Each input control must have an ID.", "sap.ui.integration.widgets.Card");
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (this._mControls.has(sId)) {
|
|
171
|
+
Log.error("Duplicate form control ID - '" + sId + "'" , "sap.ui.integration.widgets.Card");
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return true;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
Form.prototype._syncToFormModelOn = function (sEventType, oControl, oItem, sPath) {
|
|
179
|
+
this._prepareValidationForControl(oControl, oItem, sPath);
|
|
180
|
+
|
|
181
|
+
oControl.attachEvent(sEventType, this._validateAndUpdate, this);
|
|
182
|
+
oControl.addEventDelegate({ onAfterRendering: this._updateModel }, this);
|
|
183
|
+
|
|
184
|
+
this._mControls.set(oItem.id, oControl);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
Form.prototype._updateModel = function (oControlOrEvent) {
|
|
188
|
+
var oControl = oControlOrEvent.srcControl ? oControlOrEvent.srcControl : oControlOrEvent;
|
|
189
|
+
|
|
190
|
+
this.getModel("form").setProperty("/" + oControl._oItem.id, _getValue(oControl));
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
Form.prototype._validateAndUpdate = function (oControlOrEvent) {
|
|
194
|
+
var oControl = oControlOrEvent.getSource ? oControlOrEvent.getSource() : oControlOrEvent;
|
|
195
|
+
|
|
196
|
+
this._validateControl(oControl, true);
|
|
197
|
+
this._updateModel(oControl);
|
|
198
|
+
|
|
199
|
+
this._oCard._fireStateChanged();
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
Form.prototype._isControlDataValid = function (oData) {
|
|
203
|
+
if (!oData) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
var sId = oData.id;
|
|
208
|
+
if (!sId) {
|
|
209
|
+
Log.error("Form control data is missing property 'id'." , "sap.ui.integration.widgets.Card");
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var oControl = this._mControls.get(sId);
|
|
214
|
+
if (!oControl) {
|
|
215
|
+
Log.error("Form control with ID - '" + sId + "' does not exist." , "sap.ui.integration.widgets.Card");
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (oControl.isA(["sap.m.TextArea", "sap.m.Input"]) && !("value" in oData)) {
|
|
220
|
+
Log.error("Form data for control ID - '" + sId + "' is missing property 'value'." , "sap.ui.integration.widgets.Card");
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (oControl.isA("sap.m.ComboBox")) {
|
|
225
|
+
if ("value" in oData || "key" in oData) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
Log.error("Form data for control ID - '" + sId + "' requires properties 'key' or 'value'." , "sap.ui.integration.widgets.Card");
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return true;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
Form.prototype._prepareValidationForControl = function (oControl, oItem, sPath) {
|
|
237
|
+
var oClonedItem = deepExtend({}, oItem);
|
|
238
|
+
|
|
239
|
+
// this is needed in order to skip binding for "pattern"
|
|
240
|
+
if (oClonedItem.validations) {
|
|
241
|
+
oClonedItem.validations.forEach(function (oValidation, iIndex) {
|
|
242
|
+
if (oValidation.pattern) {
|
|
243
|
+
oValidation.pattern = this._oCard.getManifestEntry(sPath + "/validations/" + iIndex)["pattern"];
|
|
244
|
+
}
|
|
245
|
+
}.bind(this));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
oControl._oItem = oClonedItem;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Validates control based on the defined validations from the manifest.
|
|
253
|
+
* The control will receive a validation error message for the first defined validation that fails.
|
|
254
|
+
*
|
|
255
|
+
* @param {sap.ui.core.Control} oControl control instance to validate
|
|
256
|
+
* @param {boolean} bShowValueState whether to display the new value state on the control
|
|
257
|
+
* @returns {boolean} true if the control is invalid
|
|
258
|
+
*/
|
|
259
|
+
Form.prototype._validateControl = function (oControl, bShowValueState) {
|
|
260
|
+
var oExtension = this._oCard.getAggregation("_extension"),
|
|
261
|
+
oItem = oControl._oItem,
|
|
262
|
+
oBindingContext = oControl.getBindingContext(),
|
|
263
|
+
sBindingPath = oBindingContext ? oBindingContext.getPath() : "",
|
|
264
|
+
bHasErrorSet = false,
|
|
265
|
+
aResolvedValidations;
|
|
266
|
+
|
|
267
|
+
this._removeMessageFromControl(oControl);
|
|
268
|
+
|
|
269
|
+
if (!oItem || !oItem.validations) {
|
|
270
|
+
return bHasErrorSet;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
aResolvedValidations = BindingResolver.resolveValue(oItem.validations, oControl, sBindingPath);
|
|
274
|
+
|
|
275
|
+
bHasErrorSet = !aResolvedValidations.every(function (mValidationConfig) {
|
|
276
|
+
return this._checkValidationItem(mValidationConfig, oControl, oItem, bShowValueState, oExtension);
|
|
277
|
+
}.bind(this));
|
|
278
|
+
|
|
279
|
+
this._updateMessageModel();
|
|
280
|
+
|
|
281
|
+
return bHasErrorSet;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
Form.prototype._checkValidationItem = function (mValidationConfig, oControl, oItem, bShowValueState, oExtension) {
|
|
285
|
+
var oValidator = Validators[this._getFormControlType(oItem)],
|
|
286
|
+
oValidationValue,
|
|
287
|
+
bValid,
|
|
288
|
+
sValidationFunctionName,
|
|
289
|
+
fnValidationFunc,
|
|
290
|
+
oRB = this.getModel("i18n").getResourceBundle(),
|
|
291
|
+
bValidationPassed = true;
|
|
292
|
+
|
|
293
|
+
for (var sKey in mValidationConfig) {
|
|
294
|
+
oValidationValue = mValidationConfig[sKey];
|
|
295
|
+
|
|
296
|
+
if (sKey === "validate") {
|
|
297
|
+
sValidationFunctionName = this._getExtensionFunctionName(oValidationValue, oExtension);
|
|
298
|
+
|
|
299
|
+
if (sValidationFunctionName) {
|
|
300
|
+
fnValidationFunc = oExtension[sValidationFunctionName];
|
|
301
|
+
}
|
|
302
|
+
} else {
|
|
303
|
+
fnValidationFunc = oValidator[sKey];
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (typeof fnValidationFunc !== "function") {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
bValid = fnValidationFunc(_getValue(oControl), oValidationValue);
|
|
311
|
+
if (!bValid) {
|
|
312
|
+
this._addMessageToControl(oControl, bShowValueState, {
|
|
313
|
+
type: mValidationConfig.type || ValueState.Error,
|
|
314
|
+
message: mValidationConfig.message || oRB.getText(oValidator[sKey + "Txt"], oValidationValue),
|
|
315
|
+
bindingPath: "/" + oItem.id
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
bValidationPassed = false;
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return bValidationPassed;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
Form.prototype._addMessageToControl = function (oControl, bShowValueState, oMessage) {
|
|
327
|
+
var oMessagesModel = this.getModel("messages"),
|
|
328
|
+
oModelData = oMessagesModel.getData();
|
|
329
|
+
|
|
330
|
+
oModelData.records.push(oMessage);
|
|
331
|
+
|
|
332
|
+
oMessagesModel.setData(oModelData);
|
|
333
|
+
|
|
334
|
+
if (bShowValueState || oControl._bShowValueState) {
|
|
335
|
+
oControl._bShowValueState = true; // control has been touched once. mark it "dirty"
|
|
336
|
+
oControl.setValueState(oMessage.type);
|
|
337
|
+
oControl.setValueStateText(oMessage.message);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
this._updateMessageModel();
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
Form.prototype._removeMessageFromControl = function (oControl) {
|
|
344
|
+
var oMessagesModel = this.getModel("messages"),
|
|
345
|
+
sBindingPath = "/" + oControl._oItem.id,
|
|
346
|
+
oMessagesModelData = oMessagesModel.getData(),
|
|
347
|
+
bHasChange = false;
|
|
348
|
+
|
|
349
|
+
oControl.setValueState(ValueState.None);
|
|
350
|
+
|
|
351
|
+
for (var i = 0; i < oMessagesModelData.records.length; i++) {
|
|
352
|
+
if (oMessagesModelData.records[i].bindingPath === sBindingPath) {
|
|
353
|
+
oMessagesModelData.records.splice(i, 1);
|
|
354
|
+
bHasChange = true;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (bHasChange) {
|
|
360
|
+
oMessagesModel.setData(oMessagesModelData);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
this._updateMessageModel();
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
Form.prototype._updateMessageModel = function () {
|
|
367
|
+
var oMessagesModel = this.getModel("messages"),
|
|
368
|
+
aRecords = oMessagesModel.getProperty("/records");
|
|
369
|
+
|
|
370
|
+
oMessagesModel.setProperty("/hasErrors", aRecords.some(function (oRecord) {
|
|
371
|
+
return oRecord.type === ValueState.Error;
|
|
372
|
+
}));
|
|
373
|
+
|
|
374
|
+
oMessagesModel.setProperty("/hasWarnings", aRecords.some(function (oRecord) {
|
|
375
|
+
return oRecord.type === ValueState.Warning;
|
|
376
|
+
}));
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
Form.prototype.getRequiredValidationValue = function (oItem) {
|
|
380
|
+
var aValidations = oItem.validations || [],
|
|
381
|
+
oValidation,
|
|
382
|
+
i,
|
|
383
|
+
sKey;
|
|
384
|
+
|
|
385
|
+
for (i = 0; i < aValidations.length; i++) {
|
|
386
|
+
oValidation = aValidations[i];
|
|
387
|
+
|
|
388
|
+
for (sKey in oValidation) {
|
|
389
|
+
if (sKey === "required") {
|
|
390
|
+
return oValidation[sKey];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return false;
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
Form.prototype._getExtensionFunctionName = function (sValue, oExtension) {
|
|
399
|
+
if (!sValue.startsWith("extension.")) {
|
|
400
|
+
Log.error("Validation function should start with 'extension'.");
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (!oExtension) {
|
|
405
|
+
Log.error("Extension is not defined.");
|
|
406
|
+
return false;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var sValidationFunctionName = sValue.replace("extension.", "");
|
|
410
|
+
|
|
411
|
+
if (!oExtension[sValidationFunctionName]) {
|
|
412
|
+
Log.error("No such function.", sValidationFunctionName, "sap.ui.integration.widgets.Card");
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return sValidationFunctionName;
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
Form.prototype._getFormControlType = function (oItem) {
|
|
420
|
+
switch (oItem.type) {
|
|
421
|
+
case "ComboBox":
|
|
422
|
+
return "keyValuePair";
|
|
423
|
+
default:
|
|
424
|
+
return "string";
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
function _getValue(oControl) {
|
|
429
|
+
if (oControl.isA("sap.m.ComboBox")) {
|
|
430
|
+
return {
|
|
431
|
+
key: oControl.getSelectedKey(),
|
|
432
|
+
value: oControl.getValue()
|
|
433
|
+
};
|
|
434
|
+
} else {
|
|
435
|
+
return oControl.getValue();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return Form;
|
|
440
|
+
});
|
|
@@ -9,14 +9,16 @@ sap.ui.define([
|
|
|
9
9
|
"sap/ui/integration/util/BindingResolver",
|
|
10
10
|
"sap/ui/integration/util/Utils",
|
|
11
11
|
"sap/m/IllustratedMessageType",
|
|
12
|
-
"sap/m/IllustratedMessageSize"
|
|
12
|
+
"sap/m/IllustratedMessageSize",
|
|
13
|
+
"sap/base/Log"
|
|
13
14
|
], function (
|
|
14
15
|
Core,
|
|
15
16
|
BindingHelper,
|
|
16
17
|
BindingResolver,
|
|
17
18
|
Utils,
|
|
18
19
|
IllustratedMessageType,
|
|
19
|
-
IllustratedMessageSize
|
|
20
|
+
IllustratedMessageSize,
|
|
21
|
+
Log
|
|
20
22
|
) {
|
|
21
23
|
"use strict";
|
|
22
24
|
|
|
@@ -89,6 +91,9 @@ sap.ui.define([
|
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
try {
|
|
94
|
+
// Prepare binding infos only once for all sections
|
|
95
|
+
oManifest = BindingHelper.createBindingInfos(oManifest, oCard.getBindingNamespaces());
|
|
96
|
+
|
|
92
97
|
if (oCard.getAggregation("_filterBar")) {
|
|
93
98
|
aFilters = oCard.getAggregation("_filterBar")._getFilters().map(function (oFilter) {
|
|
94
99
|
return ["/sap.card/configuration/filters/" + oFilter.getKey(), oFilter];
|
|
@@ -124,8 +129,8 @@ sap.ui.define([
|
|
|
124
129
|
delete oSubConfig.data;
|
|
125
130
|
}
|
|
126
131
|
|
|
127
|
-
|
|
128
|
-
oSubConfig = BindingResolver.resolveValue(oSubConfig, oContext, sDataPath);
|
|
132
|
+
// Resolve only binding infos which are left unresolved, we must not resolve sections twice.
|
|
133
|
+
oSubConfig = BindingResolver.resolveValue(oSubConfig, oContext, sDataPath, true);
|
|
129
134
|
Utils.setNestedPropertyValue(oManifest, sManifestPath, oSubConfig);
|
|
130
135
|
});
|
|
131
136
|
|
|
@@ -146,6 +151,8 @@ sap.ui.define([
|
|
|
146
151
|
var oManifest = oCard.getManifestEntry("/"),
|
|
147
152
|
oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
148
153
|
|
|
154
|
+
Log.error(oError, "sap.ui.integration.util.ManifestResolver");
|
|
155
|
+
|
|
149
156
|
if (oManifest === null) {
|
|
150
157
|
oManifest = {};
|
|
151
158
|
}
|
|
@@ -5,58 +5,89 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/ui/
|
|
9
|
-
], function (
|
|
8
|
+
"sap/ui/core/Configuration"
|
|
9
|
+
], function (Configuration) {
|
|
10
10
|
"use strict";
|
|
11
11
|
|
|
12
|
-
var bNowAPIExists = performance && performance.now;
|
|
13
12
|
var bMarkAPIExists = performance && performance.mark;
|
|
13
|
+
var bMeasureAPIExists = performance && performance.measure;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
var mMeasurements = new Map();
|
|
24
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Contains static methods for work with performance markers.
|
|
17
|
+
* @private
|
|
18
|
+
* @ui5-restricted sap.ui.integration
|
|
19
|
+
* @class
|
|
20
|
+
*/
|
|
25
21
|
var Measurement = {
|
|
22
|
+
/**
|
|
23
|
+
* Adds a start marker with performance.mark().
|
|
24
|
+
* @param {string} sId The id of the marker. Suffix "-start" will be added at the end.
|
|
25
|
+
* @param {string} sDetail Details for the marker.
|
|
26
|
+
* @returns {PerformanceMark} The start marker.
|
|
27
|
+
*/
|
|
26
28
|
start: function (sId, sDetail) {
|
|
27
|
-
if (!
|
|
28
|
-
return;
|
|
29
|
+
if (!this.getActive()) {
|
|
30
|
+
return null;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
return performance.mark(sId + "-start", {
|
|
32
34
|
detail: sDetail
|
|
33
35
|
});
|
|
34
|
-
|
|
35
|
-
if (bMarkAPIExists){
|
|
36
|
-
performance.mark(sId + "-start");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
CoreMeasurement.start(sId, sDetail + measurementStartTime());
|
|
40
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* Adds an end marker with performance.mark().
|
|
39
|
+
* Also adds a measurement between the end and the start marker with performance.measure().
|
|
40
|
+
* @param {string} sId The base id of the marker. Suffix "-end" will be added at the end.
|
|
41
|
+
* @returns {PerformanceMark} The end marker.
|
|
42
|
+
*/
|
|
41
43
|
end: function (sId) {
|
|
42
|
-
if (!
|
|
43
|
-
return;
|
|
44
|
+
if (!this.getActive()) {
|
|
45
|
+
return null;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
var
|
|
48
|
+
var oStartMark = performance.getEntriesByName(sId + "-start")[0],
|
|
49
|
+
oEndMark,
|
|
50
|
+
sDetail = "";
|
|
47
51
|
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
start: sId,
|
|
51
|
-
detail: oMeasurement.detail
|
|
52
|
-
});
|
|
52
|
+
if (oStartMark) {
|
|
53
|
+
sDetail = oStartMark.detail;
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
oEndMark = performance.mark(sId + "-end", {
|
|
57
|
+
start: sId,
|
|
58
|
+
detail: sDetail
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
performance.measure(sId, {
|
|
62
|
+
start: sId + "-start",
|
|
63
|
+
end: sId + "-end",
|
|
64
|
+
detail: sDetail
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return oEndMark;
|
|
57
68
|
},
|
|
69
|
+
/**
|
|
70
|
+
* Checks if an end marker was already added.
|
|
71
|
+
* @param {string} sId The base id of the marker.
|
|
72
|
+
* @returns {boolean} True if the end marker is there. False otherwise.
|
|
73
|
+
*/
|
|
58
74
|
hasEnded: function (sId) {
|
|
59
|
-
|
|
75
|
+
if (!this.getActive()) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var oEndMark = performance.getEntriesByName(sId + "-end")[0];
|
|
80
|
+
|
|
81
|
+
return !!oEndMark;
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Should the performance measurement be activated.
|
|
85
|
+
* @returns {boolean} True if it should be active. False otherwise.
|
|
86
|
+
*/
|
|
87
|
+
getActive: function () {
|
|
88
|
+
var bActive = Configuration.getMeasureCards(); // @todo
|
|
89
|
+
|
|
90
|
+
return bActive && bMarkAPIExists && bMeasureAPIExists;
|
|
60
91
|
}
|
|
61
92
|
};
|
|
62
93
|
|