@openui5/sap.ui.integration 1.100.0 → 1.102.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +18 -0
- package/THIRDPARTY.txt +5 -5
- package/package.json +3 -3
- package/src/sap/ui/integration/.library +1 -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 +1 -1
- package/src/sap/ui/integration/Host.js +1 -1
- package/src/sap/ui/integration/cards/AdaptiveContent.js +1 -1
- package/src/sap/ui/integration/cards/AnalyticalContent.js +4 -2
- package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +1 -1
- package/src/sap/ui/integration/cards/BaseContent.js +4 -3
- package/src/sap/ui/integration/cards/BaseListContent.js +1 -1
- package/src/sap/ui/integration/cards/CalendarContent.js +1 -1
- package/src/sap/ui/integration/cards/ComponentContent.js +1 -1
- package/src/sap/ui/integration/cards/Footer.js +1 -1
- package/src/sap/ui/integration/cards/Header.js +4 -2
- package/src/sap/ui/integration/cards/ListContent.js +1 -1
- package/src/sap/ui/integration/cards/NumericHeader.js +5 -2
- package/src/sap/ui/integration/cards/ObjectContent.js +68 -10
- 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 +1 -1
- package/src/sap/ui/integration/cards/actions/HideCardAction.js +12 -3
- package/src/sap/ui/integration/cards/actions/ShowCardAction.js +33 -1
- 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 +1 -1
- package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +1 -1
- 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/controls/ActionsStrip.js +57 -24
- package/src/sap/ui/integration/controls/ActionsToolbar.js +1 -1
- package/src/sap/ui/integration/controls/LinkWithIcon.js +77 -0
- package/src/sap/ui/integration/controls/LinkWithIconRenderer.js +38 -0
- 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/Paginator.js +218 -18
- package/src/sap/ui/integration/controls/PaginatorRenderer.js +2 -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/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/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/CardEditor.js +98 -10
- package/src/sap/ui/integration/designtime/editor/CardPreview.js +1 -1
- package/src/sap/ui/integration/editor/Editor.js +187 -73
- package/src/sap/ui/integration/editor/EditorResourceBundles.js +1 -1
- 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/Merger.js +0 -1
- package/src/sap/ui/integration/editor/Settings.js +1 -1
- package/src/sap/ui/integration/editor/css/Editor.css +11 -5
- package/src/sap/ui/integration/editor/fields/BaseField.js +50 -16
- 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/IntegerField.js +1 -1
- package/src/sap/ui/integration/editor/fields/NumberField.js +1 -1
- package/src/sap/ui/integration/editor/fields/ObjectField.js +1155 -458
- package/src/sap/ui/integration/editor/fields/ObjectListField.js +187 -198
- package/src/sap/ui/integration/editor/fields/StringField.js +39 -16
- package/src/sap/ui/integration/editor/fields/StringListField.js +38 -52
- 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/library.js +15 -18
- package/src/sap/ui/integration/messagebundle.properties +52 -25
- package/src/sap/ui/integration/messagebundle_ar.properties +32 -14
- package/src/sap/ui/integration/messagebundle_bg.properties +32 -14
- package/src/sap/ui/integration/messagebundle_ca.properties +31 -13
- package/src/sap/ui/integration/messagebundle_cs.properties +31 -13
- package/src/sap/ui/integration/messagebundle_cy.properties +32 -14
- package/src/sap/ui/integration/messagebundle_da.properties +31 -13
- package/src/sap/ui/integration/messagebundle_de.properties +31 -13
- package/src/sap/ui/integration/messagebundle_el.properties +32 -14
- package/src/sap/ui/integration/messagebundle_en.properties +32 -14
- package/src/sap/ui/integration/messagebundle_en_GB.properties +31 -13
- package/src/sap/ui/integration/messagebundle_en_US_sappsd.properties +31 -13
- package/src/sap/ui/integration/messagebundle_en_US_saprigi.properties +31 -13
- package/src/sap/ui/integration/messagebundle_en_US_saptrc.properties +31 -13
- package/src/sap/ui/integration/messagebundle_es.properties +32 -14
- package/src/sap/ui/integration/messagebundle_es_MX.properties +31 -13
- package/src/sap/ui/integration/messagebundle_et.properties +32 -14
- package/src/sap/ui/integration/messagebundle_fi.properties +33 -15
- package/src/sap/ui/integration/messagebundle_fr.properties +31 -13
- package/src/sap/ui/integration/messagebundle_fr_CA.properties +31 -13
- package/src/sap/ui/integration/messagebundle_hi.properties +31 -13
- package/src/sap/ui/integration/messagebundle_hr.properties +31 -13
- package/src/sap/ui/integration/messagebundle_hu.properties +31 -13
- package/src/sap/ui/integration/messagebundle_id.properties +32 -14
- package/src/sap/ui/integration/messagebundle_it.properties +32 -14
- package/src/sap/ui/integration/messagebundle_iw.properties +31 -13
- package/src/sap/ui/integration/messagebundle_ja.properties +31 -13
- package/src/sap/ui/integration/messagebundle_kk.properties +31 -13
- package/src/sap/ui/integration/messagebundle_ko.properties +32 -14
- package/src/sap/ui/integration/messagebundle_lt.properties +31 -13
- package/src/sap/ui/integration/messagebundle_lv.properties +32 -14
- package/src/sap/ui/integration/messagebundle_ms.properties +32 -14
- package/src/sap/ui/integration/messagebundle_nl.properties +31 -13
- package/src/sap/ui/integration/messagebundle_no.properties +31 -13
- package/src/sap/ui/integration/messagebundle_pl.properties +31 -13
- package/src/sap/ui/integration/messagebundle_pt.properties +31 -13
- package/src/sap/ui/integration/messagebundle_pt_PT.properties +32 -14
- package/src/sap/ui/integration/messagebundle_ro.properties +31 -13
- package/src/sap/ui/integration/messagebundle_ru.properties +31 -13
- package/src/sap/ui/integration/messagebundle_sh.properties +32 -14
- package/src/sap/ui/integration/messagebundle_sk.properties +32 -14
- package/src/sap/ui/integration/messagebundle_sl.properties +32 -14
- package/src/sap/ui/integration/messagebundle_sv.properties +32 -14
- package/src/sap/ui/integration/messagebundle_th.properties +32 -14
- package/src/sap/ui/integration/messagebundle_tr.properties +32 -14
- package/src/sap/ui/integration/messagebundle_uk.properties +32 -14
- package/src/sap/ui/integration/messagebundle_vi.properties +32 -14
- package/src/sap/ui/integration/messagebundle_zh_CN.properties +32 -14
- package/src/sap/ui/integration/messagebundle_zh_TW.properties +31 -13
- 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 +73 -3
- package/src/sap/ui/integration/themes/base/CalendarContent.less +2 -2
- package/src/sap/ui/integration/themes/base/Card.less +24 -0
- package/src/sap/ui/integration/themes/base/LinkWithIcon.less +11 -0
- package/src/sap/ui/integration/themes/base/ListContentItem.less +11 -0
- package/src/sap/ui/integration/themes/base/Paginator.less +86 -0
- package/src/sap/ui/integration/themes/base/library.source.less +1 -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 +1 -1
- package/src/sap/ui/integration/util/CardMerger.js +82 -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 +1 -1
- package/src/sap/ui/integration/util/DataProviderFactory.js +1 -1
- 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/HeaderFactory.js +35 -4
- package/src/sap/ui/integration/util/JSONBindingHelper.js +1 -1
- package/src/sap/ui/integration/util/LoadingProvider.js +2 -2
- package/src/sap/ui/integration/util/Manifest.js +2 -1
- 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 +14 -2
- package/src/sap/ui/integration/util/Utils.js +16 -1
- package/src/sap/ui/integration/widgets/Card.js +59 -15
|
@@ -8,57 +8,74 @@ sap.ui.define([
|
|
|
8
8
|
"sap/ui/integration/editor/fields/BaseField",
|
|
9
9
|
"sap/m/Text",
|
|
10
10
|
"sap/m/TextArea",
|
|
11
|
-
"sap/m/Title",
|
|
12
11
|
"sap/m/Input",
|
|
12
|
+
"sap/m/NavContainer",
|
|
13
|
+
"sap/m/Page",
|
|
13
14
|
"sap/m/Popover",
|
|
14
15
|
"sap/m/OverflowToolbar",
|
|
15
16
|
"sap/m/ToolbarSpacer",
|
|
16
17
|
"sap/m/Button",
|
|
17
|
-
"sap/ui/core/Core",
|
|
18
18
|
"sap/ui/model/json/JSONModel",
|
|
19
19
|
"sap/ui/table/Table",
|
|
20
20
|
"sap/ui/table/Column",
|
|
21
21
|
"sap/m/Label",
|
|
22
|
-
"sap/m/
|
|
22
|
+
"sap/m/VBox",
|
|
23
23
|
"sap/ui/model/Filter",
|
|
24
24
|
"sap/ui/model/FilterOperator",
|
|
25
25
|
"sap/base/util/deepEqual",
|
|
26
26
|
"sap/ui/core/Icon",
|
|
27
27
|
"sap/m/Switch",
|
|
28
28
|
"sap/m/CheckBox",
|
|
29
|
+
"sap/m/MessageBox",
|
|
30
|
+
"sap/m/MessageToast",
|
|
29
31
|
"sap/base/util/deepClone",
|
|
30
32
|
"sap/m/Link",
|
|
31
33
|
"sap/ui/layout/form/SimpleForm",
|
|
32
|
-
"sap/base/util/merge"
|
|
34
|
+
"sap/base/util/merge",
|
|
35
|
+
"sap/m/List",
|
|
36
|
+
"sap/m/CustomListItem",
|
|
37
|
+
"sap/ui/model/Sorter",
|
|
38
|
+
"sap/ui/core/CustomData",
|
|
39
|
+
"sap/ui/integration/editor/EditorResourceBundles",
|
|
40
|
+
"sap/base/util/includes",
|
|
41
|
+
"sap/ui/integration/util/Utils"
|
|
33
42
|
], function (
|
|
34
43
|
BaseField,
|
|
35
44
|
Text,
|
|
36
45
|
TextArea,
|
|
37
|
-
Title,
|
|
38
46
|
Input,
|
|
47
|
+
NavContainer,
|
|
48
|
+
Page,
|
|
39
49
|
Popover,
|
|
40
50
|
OverflowToolbar,
|
|
41
51
|
ToolbarSpacer,
|
|
42
52
|
Button,
|
|
43
|
-
Core,
|
|
44
53
|
JSONModel,
|
|
45
54
|
Table,
|
|
46
55
|
Column,
|
|
47
56
|
Label,
|
|
48
|
-
|
|
57
|
+
VBox,
|
|
49
58
|
Filter,
|
|
50
59
|
FilterOperator,
|
|
51
60
|
deepEqual,
|
|
52
61
|
Icon,
|
|
53
62
|
Switch,
|
|
54
63
|
CheckBox,
|
|
64
|
+
MessageBox,
|
|
65
|
+
MessageToast,
|
|
55
66
|
deepClone,
|
|
56
67
|
Link,
|
|
57
68
|
SimpleForm,
|
|
58
|
-
merge
|
|
69
|
+
merge,
|
|
70
|
+
List,
|
|
71
|
+
CustomListItem,
|
|
72
|
+
Sorter,
|
|
73
|
+
CustomData,
|
|
74
|
+
EditorResourceBundles,
|
|
75
|
+
includes,
|
|
76
|
+
Utils
|
|
59
77
|
) {
|
|
60
78
|
"use strict";
|
|
61
|
-
var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
62
79
|
var REGEXP_TRANSLATABLE = /\{\{(?!parameters.)(?!destinations.)([^\}\}]+)\}\}/g;
|
|
63
80
|
|
|
64
81
|
/**
|
|
@@ -67,7 +84,7 @@ sap.ui.define([
|
|
|
67
84
|
* @alias sap.ui.integration.editor.fields.ObjectField
|
|
68
85
|
* @author SAP SE
|
|
69
86
|
* @since 1.100.0
|
|
70
|
-
* @version 1.
|
|
87
|
+
* @version 1.102.1
|
|
71
88
|
* @private
|
|
72
89
|
* @experimental since 1.100.0
|
|
73
90
|
* @ui5-restricted
|
|
@@ -82,7 +99,12 @@ sap.ui.define([
|
|
|
82
99
|
|
|
83
100
|
ObjectField.prototype.initVisualization = function (oConfig) {
|
|
84
101
|
var that = this;
|
|
85
|
-
that._newObjectTemplate = {
|
|
102
|
+
that._newObjectTemplate = {
|
|
103
|
+
"_dt": {
|
|
104
|
+
"_selected": true,
|
|
105
|
+
"_uuid": ""
|
|
106
|
+
}
|
|
107
|
+
};
|
|
86
108
|
var oVisualization = oConfig.visualization;
|
|
87
109
|
if (!oVisualization) {
|
|
88
110
|
if (oConfig.value && !oConfig.properties && (!oConfig.values || (oConfig.values && !oConfig.values.metadata))) {
|
|
@@ -122,9 +144,12 @@ sap.ui.define([
|
|
|
122
144
|
if (typeof oConfig.value === "object" && !deepEqual(oConfig.value, {}) && !Array.isArray(oConfig.value) && !oConfig.properties) {
|
|
123
145
|
var oProperties = {};
|
|
124
146
|
for (var n in oConfig.value) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
147
|
+
// not show _dt property which generated and used by editor
|
|
148
|
+
if (n !== "_dt") {
|
|
149
|
+
var sType = typeof oConfig.value[n];
|
|
150
|
+
var oProperty = sType === "string" ? {} : {"type": sType};
|
|
151
|
+
oProperties[n] = oProperty;
|
|
152
|
+
}
|
|
128
153
|
}
|
|
129
154
|
if (!deepEqual(oProperties, {})) {
|
|
130
155
|
oConfig.properties = oProperties;
|
|
@@ -155,12 +180,11 @@ sap.ui.define([
|
|
|
155
180
|
type: Table,
|
|
156
181
|
settings: {
|
|
157
182
|
rows: "{" + sPath + "}",
|
|
158
|
-
selectionMode: "MultiToggle",
|
|
159
|
-
enableSelectAll: that._bIsEnableSelectAllInTable === true,
|
|
160
183
|
visibleRowCount: 5,
|
|
161
184
|
busy: "{currentSettings>_loading}",
|
|
162
185
|
columns: columns,
|
|
163
|
-
|
|
186
|
+
selectionBehavior: "RowOnly",
|
|
187
|
+
rowSelectionChange: that.onTableSelectionChange.bind(that),
|
|
164
188
|
toolbar: oTableToolbar,
|
|
165
189
|
filter: that.onFilter.bind(that)
|
|
166
190
|
}
|
|
@@ -170,14 +194,23 @@ sap.ui.define([
|
|
|
170
194
|
|
|
171
195
|
ObjectField.prototype.createSimpleFormVisualization = function(oConfig) {
|
|
172
196
|
var that = this;
|
|
197
|
+
var oResourceBundle = that.getResourceBundle();
|
|
173
198
|
var fnChange = function() {
|
|
174
199
|
var oModel = this.getAggregation("_field").getModel();
|
|
175
200
|
oModel.checkUpdate(true);
|
|
176
201
|
var oValue = oModel.getProperty("/value");
|
|
202
|
+
// generate uuid if not exists
|
|
203
|
+
if (!oValue._dt) {
|
|
204
|
+
oValue._dt = {
|
|
205
|
+
_uuid: Utils.generateUuidV4()
|
|
206
|
+
};
|
|
207
|
+
} else if (!oValue._dt._uuid) {
|
|
208
|
+
oValue._dt._uuid = Utils.generateUuidV4();
|
|
209
|
+
}
|
|
177
210
|
oValue = deepClone(oValue, 500);
|
|
178
|
-
this.
|
|
211
|
+
this.setValue(oValue);
|
|
179
212
|
}.bind(that);
|
|
180
|
-
var aObjectPropertyFormContents = that.createFormContents(fnChange, "/value/");
|
|
213
|
+
var aObjectPropertyFormContents = that.createFormContents(fnChange, "/value/", false, that.openTranslationPopup);
|
|
181
214
|
var oEditModeButton = new Button({
|
|
182
215
|
icon: {
|
|
183
216
|
path: '/editMode',
|
|
@@ -223,8 +256,13 @@ sap.ui.define([
|
|
|
223
256
|
}
|
|
224
257
|
},
|
|
225
258
|
press: function (oEvent) {
|
|
226
|
-
that.
|
|
259
|
+
that.setValue(undefined);
|
|
227
260
|
var oModel = that.getAggregation("_field").getModel();
|
|
261
|
+
// delete the translation texts when deleting the object
|
|
262
|
+
var oObject = oModel.getProperty("/value");
|
|
263
|
+
if (oObject && oObject._dt && oObject._dt._uuid) {
|
|
264
|
+
that.deleteTranslationValueInTexts(undefined, oObject._dt._uuid);
|
|
265
|
+
}
|
|
228
266
|
oModel.setProperty("/value", {});
|
|
229
267
|
oModel.checkUpdate(true);
|
|
230
268
|
}
|
|
@@ -291,131 +329,184 @@ sap.ui.define([
|
|
|
291
329
|
return oVisualization;
|
|
292
330
|
};
|
|
293
331
|
|
|
332
|
+
ObjectField.prototype.buildSelectionColumnLables = function() {
|
|
333
|
+
var that = this;
|
|
334
|
+
var oConfig = that.getConfiguration();
|
|
335
|
+
var oResourceBundle = that.getResourceBundle();
|
|
336
|
+
return new Button({
|
|
337
|
+
icon: "sap-icon://clear-all",
|
|
338
|
+
type: "Transparent",
|
|
339
|
+
enabled: typeof oConfig.values === "undefined" ? false : "{/_hasSelected}",
|
|
340
|
+
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_COLUMN_SELECTION_TOOLTIP_REMOVE"),
|
|
341
|
+
press: that.onUnSelectAll.bind(that)
|
|
342
|
+
});
|
|
343
|
+
};
|
|
344
|
+
|
|
294
345
|
ObjectField.prototype.buildTableColumns = function() {
|
|
295
346
|
var that = this;
|
|
296
347
|
var oConfig = that.getConfiguration();
|
|
297
348
|
var aColumns = [];
|
|
298
|
-
var
|
|
299
|
-
|
|
300
|
-
var
|
|
301
|
-
var
|
|
302
|
-
var
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
var sCellType = oProperty.cell && oProperty.cell.type ? oProperty.cell.type : oProperty.type || "Text";
|
|
320
|
-
var oCellTemplate;
|
|
321
|
-
var oCellSettings;
|
|
322
|
-
var oCell = deepClone(oProperty.cell) || {};
|
|
323
|
-
delete oCell.type;
|
|
324
|
-
switch (sCellType) {
|
|
325
|
-
case "int":
|
|
326
|
-
case "number":
|
|
327
|
-
oCellSettings = {
|
|
328
|
-
text: sDefaultValue,
|
|
329
|
-
wrapping: false
|
|
330
|
-
};
|
|
331
|
-
oCellSettings = merge(oCellSettings, oCell);
|
|
332
|
-
oCellTemplate = new Text(oCellSettings);
|
|
333
|
-
break;
|
|
334
|
-
case "string":
|
|
335
|
-
case "Text":
|
|
336
|
-
oCellSettings = {
|
|
337
|
-
text: sDefaultValue,
|
|
338
|
-
tooltip: sDefaultValue,
|
|
339
|
-
wrapping: false
|
|
340
|
-
};
|
|
341
|
-
oCellSettings = merge(oCellSettings, oCell);
|
|
342
|
-
var oText = oCellSettings.text;
|
|
343
|
-
if (typeof oText === "string") {
|
|
344
|
-
if (oText.match(REGEXP_TRANSLATABLE)) {
|
|
345
|
-
// check the text property, if it match syntax {{KEY}}, translate it
|
|
346
|
-
oCellSettings.text = oCardResourceBundle.getText(oText.substring(2, oText.length - 2));
|
|
347
|
-
} else if (oText.startsWith("{i18n>") && oText.endsWith('}')) {
|
|
348
|
-
// check the text property, if it match syntax {i18n>KEY}, translate it
|
|
349
|
-
oCellSettings.text = oCardResourceBundle.getText(oText.substring(6, oText.length - 1));
|
|
350
|
-
} else if (oText.startsWith('{') && oText.endsWith('}')) {
|
|
351
|
-
oCellSettings.text = {
|
|
352
|
-
path: oText.substring(1, oText.length - 1),
|
|
353
|
-
formatter: function(oValue) {
|
|
354
|
-
if (!oValue) {
|
|
355
|
-
return undefined;
|
|
356
|
-
} else if (oValue.match(REGEXP_TRANSLATABLE)) {
|
|
357
|
-
// check the text property, if it match syntax {{KEY}}, translate it
|
|
358
|
-
return oCardResourceBundle.getText(oValue.substring(2, oValue.length - 2));
|
|
359
|
-
} else if (oValue.startsWith("{i18n>") && oValue.endsWith('}')) {
|
|
360
|
-
// check the text property, if it match syntax {i18n>KEY}, translate it
|
|
361
|
-
return oCardResourceBundle.getText(oValue.substring(6, oValue.length - 1));
|
|
362
|
-
}
|
|
363
|
-
return oValue;
|
|
349
|
+
var aKeys = Object.keys(oConfig.properties);
|
|
350
|
+
if (aKeys.length > 0) {
|
|
351
|
+
var oResourceBundle = that.getResourceBundle();
|
|
352
|
+
var oSelectionColumnLabels = that.buildSelectionColumnLables();
|
|
353
|
+
var oSelectionColumn = new Column({
|
|
354
|
+
width: "3.2rem",
|
|
355
|
+
hAlign: "Center",
|
|
356
|
+
multiLabels: [
|
|
357
|
+
oSelectionColumnLabels
|
|
358
|
+
],
|
|
359
|
+
template: new CheckBox({
|
|
360
|
+
selected: "{_dt/_selected}",
|
|
361
|
+
enabled: typeof oConfig.values === "undefined" ? false : true,
|
|
362
|
+
tooltip: {
|
|
363
|
+
path: '_dt/_selected',
|
|
364
|
+
formatter: function(bSelected) {
|
|
365
|
+
if (bSelected) {
|
|
366
|
+
if (oConfig.type === "object") {
|
|
367
|
+
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_COLUMN_SELECTION_CELL_TOOLTIP_UNSELECT");
|
|
368
|
+
} else {
|
|
369
|
+
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_LIST_TABLE_COLUMN_SELECTION_CELL_TOOLTIP_REMOVE");
|
|
364
370
|
}
|
|
365
|
-
}
|
|
371
|
+
} else if (oConfig.type === "object") {
|
|
372
|
+
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_COLUMN_SELECTION_CELL_TOOLTIP_SELECT");
|
|
373
|
+
} else {
|
|
374
|
+
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_LIST_TABLE_COLUMN_SELECTION_CELL_TOOLTIP_ADD");
|
|
375
|
+
}
|
|
366
376
|
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
377
|
+
},
|
|
378
|
+
select: that.onSelectionChange.bind(that)
|
|
379
|
+
})
|
|
380
|
+
});
|
|
381
|
+
aColumns.push(oSelectionColumn);
|
|
382
|
+
for (var n in oConfig.properties) {
|
|
383
|
+
var oProperty = oConfig.properties[n];
|
|
384
|
+
var sDefaultLabel = oProperty.label || n;
|
|
385
|
+
var sDefaultValue = "{" + n + "}";
|
|
386
|
+
if (oProperty.defaultValue) {
|
|
387
|
+
that._newObjectTemplate[n] = oProperty.defaultValue;
|
|
388
|
+
}
|
|
389
|
+
var oColumnSettings = {
|
|
390
|
+
"width": "7rem",
|
|
391
|
+
"label": sDefaultLabel
|
|
392
|
+
};
|
|
393
|
+
if (oProperty.column) {
|
|
394
|
+
oColumnSettings = merge(oColumnSettings, oProperty.column);
|
|
395
|
+
}
|
|
396
|
+
// change translate syntax {{KEY}} to {i18n>KEY}
|
|
397
|
+
if (oColumnSettings.label.match(REGEXP_TRANSLATABLE)) {
|
|
398
|
+
oColumnSettings.label = "{i18n>" + oColumnSettings.label.substring(2, oColumnSettings.label.length - 1);
|
|
399
|
+
}
|
|
400
|
+
oColumnSettings.tooltip = oColumnSettings.label;
|
|
401
|
+
|
|
402
|
+
var sCellType = oProperty.cell && oProperty.cell.type ? oProperty.cell.type : oProperty.type || "Text";
|
|
403
|
+
var oCellTemplate;
|
|
404
|
+
var oCellSettings;
|
|
405
|
+
var oCell = deepClone(oProperty.cell) || {};
|
|
406
|
+
delete oCell.type;
|
|
407
|
+
switch (sCellType) {
|
|
408
|
+
case "int":
|
|
409
|
+
case "number":
|
|
410
|
+
oCellSettings = {
|
|
411
|
+
text: sDefaultValue,
|
|
412
|
+
wrapping: false
|
|
413
|
+
};
|
|
414
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
415
|
+
oCellTemplate = new Text(oCellSettings);
|
|
416
|
+
break;
|
|
417
|
+
case "string":
|
|
418
|
+
case "Text":
|
|
419
|
+
oCellSettings = {
|
|
420
|
+
text: sDefaultValue,
|
|
421
|
+
wrapping: false
|
|
422
|
+
};
|
|
423
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
424
|
+
var oText = oCellSettings.text;
|
|
425
|
+
var oTextSettingsModel = new JSONModel({
|
|
426
|
+
translatable: oProperty.translatable || false,
|
|
427
|
+
property: n
|
|
428
|
+
});
|
|
429
|
+
if (typeof oText === "string") {
|
|
430
|
+
var sTranslationKey = that.getTranslationKey(oText);
|
|
431
|
+
if (sTranslationKey) {
|
|
432
|
+
oCellSettings.text = oResourceBundle.getText(sTranslationKey);
|
|
433
|
+
} else if (oText.startsWith('{') && oText.endsWith('}')) {
|
|
434
|
+
oCellSettings.text = {
|
|
435
|
+
path: oText.substring(1, oText.length - 1),
|
|
436
|
+
formatter: function(oValue) {
|
|
437
|
+
var oBindingContext = this.getBindingContext(),
|
|
438
|
+
oTranslationValue,
|
|
439
|
+
oSettings = this.getModel("settings").getData(),
|
|
440
|
+
sTranslationKeyInCellValue = that.getTranslationKey(oValue);
|
|
441
|
+
if (oSettings.translatable || sTranslationKeyInCellValue) {
|
|
442
|
+
if (oBindingContext && oBindingContext.getObject() && oBindingContext.getObject()._dt) {
|
|
443
|
+
oTranslationValue = that.getTranslationValueInTexts(oResourceBundle.sLocale.replaceAll('_', '-'), oBindingContext.getObject()._dt._uuid, oSettings.property);
|
|
444
|
+
if (oTranslationValue) {
|
|
445
|
+
return oTranslationValue;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (sTranslationKeyInCellValue) {
|
|
449
|
+
oValue = oResourceBundle.getText(sTranslationKeyInCellValue);
|
|
450
|
+
return oValue;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return oValue;
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
oCellSettings.tooltip = oCell.tooltip || oCellSettings.text;
|
|
459
|
+
oCellTemplate = new Text(oCellSettings);
|
|
460
|
+
oCellTemplate.setModel(oTextSettingsModel,"settings");
|
|
461
|
+
break;
|
|
462
|
+
case "Icon":
|
|
463
|
+
oCellSettings = {
|
|
464
|
+
src: sDefaultValue
|
|
465
|
+
};
|
|
466
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
467
|
+
oCellTemplate = new Icon(oCellSettings);
|
|
468
|
+
break;
|
|
469
|
+
case "boolean":
|
|
470
|
+
oCellSettings = {
|
|
471
|
+
selected: sDefaultValue,
|
|
472
|
+
enabled: false
|
|
473
|
+
};
|
|
474
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
475
|
+
oCellTemplate = new CheckBox(oCellSettings);
|
|
476
|
+
break;
|
|
477
|
+
case "Switch":
|
|
478
|
+
oCellSettings = {
|
|
479
|
+
state: sDefaultValue,
|
|
480
|
+
enabled: false
|
|
481
|
+
};
|
|
482
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
483
|
+
oCellTemplate = new Switch(oCellSettings);
|
|
484
|
+
break;
|
|
485
|
+
case "Link":
|
|
486
|
+
oCellSettings = {
|
|
487
|
+
text: sDefaultValue,
|
|
488
|
+
target: "_blank",
|
|
489
|
+
href: sDefaultValue
|
|
490
|
+
};
|
|
491
|
+
oCellSettings = merge(oCellSettings, oCell);
|
|
492
|
+
oCellTemplate = new Link(oCellSettings);
|
|
493
|
+
break;
|
|
494
|
+
default:
|
|
495
|
+
oCellTemplate = new Text({
|
|
496
|
+
text: sDefaultValue,
|
|
497
|
+
wrapping: false
|
|
498
|
+
});
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
oColumnSettings.template = oCellTemplate;
|
|
502
|
+
var oColumn = new Column(oColumnSettings);
|
|
503
|
+
aColumns.push(oColumn);
|
|
408
504
|
}
|
|
409
|
-
oColumnSettings.template = oCellTemplate;
|
|
410
|
-
var oColumn = new Column(oColumnSettings);
|
|
411
|
-
aColumns.push(oColumn);
|
|
412
505
|
}
|
|
413
|
-
var oActionColumn = that.createActionColumn();
|
|
414
|
-
aColumns.push(oActionColumn);
|
|
415
506
|
return aColumns;
|
|
416
507
|
};
|
|
417
508
|
|
|
418
|
-
ObjectField.prototype.
|
|
509
|
+
ObjectField.prototype.checkHasFilterDefined = function(oConfig) {
|
|
419
510
|
var bHasFilterDefined = true;
|
|
420
511
|
if (oConfig._propertiesParsedFromValue === true) {
|
|
421
512
|
bHasFilterDefined = false;
|
|
@@ -428,11 +519,13 @@ sap.ui.define([
|
|
|
428
519
|
|
|
429
520
|
ObjectField.prototype.createTableToolbar = function(oConfig) {
|
|
430
521
|
var that = this;
|
|
522
|
+
var oResourceBundle = that.getResourceBundle();
|
|
431
523
|
// check if has filterProperty defined in each column of config.properties
|
|
432
|
-
var bHasFilterDefined = that.
|
|
524
|
+
var bHasFilterDefined = that.checkHasFilterDefined(oConfig);
|
|
433
525
|
var bAddButtonVisible = oConfig.enabled !== false;
|
|
526
|
+
var sAddButtonTooltip = oConfig.addButtonText || oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_ADD_TOOLTIP");
|
|
434
527
|
if (bAddButtonVisible && oConfig.values) {
|
|
435
|
-
bAddButtonVisible = oConfig.values.
|
|
528
|
+
bAddButtonVisible = oConfig.values.allowAdd === true;
|
|
436
529
|
}
|
|
437
530
|
return new OverflowToolbar({
|
|
438
531
|
content: [
|
|
@@ -440,130 +533,127 @@ sap.ui.define([
|
|
|
440
533
|
new Button({
|
|
441
534
|
icon: "sap-icon://add",
|
|
442
535
|
visible: bAddButtonVisible,
|
|
443
|
-
tooltip:
|
|
444
|
-
press: that.
|
|
536
|
+
tooltip: sAddButtonTooltip,
|
|
537
|
+
press: that.addNewObject.bind(that)
|
|
538
|
+
}),
|
|
539
|
+
new Button({
|
|
540
|
+
icon: "sap-icon://edit",
|
|
541
|
+
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_EDIT_TOOLTIP"),
|
|
542
|
+
enabled: "{= !!${/_hasTableSelected}}",
|
|
543
|
+
press: that.onEditOrViewDetail.bind(that)
|
|
544
|
+
}),
|
|
545
|
+
new Button({
|
|
546
|
+
icon: "sap-icon://delete",
|
|
547
|
+
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE"),
|
|
548
|
+
enabled: "{= !!${/_canDelete}}",
|
|
549
|
+
press: that.onDelete.bind(that)
|
|
550
|
+
}),
|
|
551
|
+
new Icon({
|
|
552
|
+
src: "sap-icon://vertical-grip"
|
|
445
553
|
}),
|
|
446
554
|
new Button({
|
|
447
555
|
icon: "sap-icon://clear-filter",
|
|
448
556
|
visible: bHasFilterDefined,
|
|
557
|
+
enabled: "{= !!${/_hasFilter}}",
|
|
449
558
|
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_CLEAR_ALL_FILTERS_TOOLTIP"),
|
|
450
559
|
press: that.clearAllFilters.bind(that)
|
|
560
|
+
}),
|
|
561
|
+
new Button({
|
|
562
|
+
icon: "sap-icon://multiselect-all",
|
|
563
|
+
enabled: "{= !${/_hasTableAllSelected}}",
|
|
564
|
+
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_SELECT_ALL_SELETIONS_TOOLTIP"),
|
|
565
|
+
press: that.selectAllTableSelections.bind(that)
|
|
566
|
+
}),
|
|
567
|
+
new Button({
|
|
568
|
+
icon: "sap-icon://multiselect-none",
|
|
569
|
+
enabled: "{= !!${/_hasTableSelected}}",
|
|
570
|
+
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_CLEAR_ALL_SELETIONS_TOOLTIP"),
|
|
571
|
+
press: that.clearAllTableSelections.bind(that)
|
|
451
572
|
})
|
|
452
573
|
]
|
|
453
574
|
});
|
|
454
575
|
};
|
|
455
576
|
|
|
456
|
-
ObjectField.prototype.
|
|
577
|
+
ObjectField.prototype.onUnSelectAll = function(oEvent) {
|
|
457
578
|
var that = this;
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
var oTable = oRow.getParent();
|
|
461
|
-
var iRowIndex = oRow.getIndex();
|
|
462
|
-
|
|
463
|
-
// get the real index via path since the rows may be filtered
|
|
464
|
-
var oRowContexts = oTable.getBinding("rows").getContexts();
|
|
465
|
-
var sDeletedObjectPath = oRowContexts[iRowIndex].getPath();
|
|
466
|
-
var iRealIndex = sDeletedObjectPath.substring(sDeletedObjectPath.lastIndexOf("/") + 1);
|
|
467
|
-
|
|
468
|
-
var oParameter;
|
|
469
|
-
var bHasBeforeValue = that.checkHasValue();
|
|
470
|
-
oParameter = {
|
|
471
|
-
selectedIndex: oTable.getSelectedIndex(),
|
|
472
|
-
selectedIndices: oTable.getSelectedIndices(),
|
|
473
|
-
rowIndex: iRowIndex,
|
|
474
|
-
realIndex: iRealIndex
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
// delete object in value model
|
|
579
|
+
var oTable = that.getAggregation("_field");
|
|
580
|
+
var sPath = oTable.getBindingContext().getPath();
|
|
478
581
|
var oModel = oTable.getModel();
|
|
479
|
-
var sPath = oTable.getBinding("rows").getPath();
|
|
480
582
|
var oData = oModel.getProperty(sPath);
|
|
481
|
-
oData.
|
|
583
|
+
oData.forEach(function (oItem) {
|
|
584
|
+
oItem._dt = oItem._dt || {};
|
|
585
|
+
oItem._dt._selected = false;
|
|
586
|
+
});
|
|
587
|
+
oModel.setProperty("/_hasSelected", false);
|
|
482
588
|
oModel.checkUpdate(true);
|
|
483
|
-
|
|
484
|
-
// restore the selections since the selections are lost, BCP: 2280048930, JIRA: CPOUIFTEAMB-252
|
|
485
|
-
if (bHasBeforeValue) {
|
|
486
|
-
that.applyBeforeValueAndSelections("delete", oParameter);
|
|
487
|
-
}
|
|
589
|
+
that.setValue(undefined);
|
|
488
590
|
};
|
|
489
591
|
|
|
490
592
|
ObjectField.prototype.onEditOrViewDetail = function(oEvent) {
|
|
491
593
|
var that = this;
|
|
492
|
-
var
|
|
493
|
-
|
|
494
|
-
|
|
594
|
+
var oTable = that.getAggregation("_field");
|
|
595
|
+
|
|
596
|
+
var iSelectIndex = oTable.getSelectedIndex();
|
|
597
|
+
var oRowContexts = oTable.getBinding("rows").getContexts();
|
|
598
|
+
var oItem = oRowContexts[iSelectIndex].getObject();
|
|
599
|
+
var iFirstIndex = oTable.getFirstVisibleRow();
|
|
600
|
+
var oRow = oTable.getRows()[iSelectIndex - iFirstIndex];
|
|
601
|
+
var oCell1 = oRow.getCells()[0];
|
|
602
|
+
that.openObjectDetailsPopover(oItem, oCell1, !oItem._dt || oItem._dt._editable !== false ? "update" : "view");
|
|
495
603
|
};
|
|
496
604
|
|
|
497
605
|
ObjectField.prototype.onFilter = function(oEvent) {
|
|
498
606
|
var that = this;
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
607
|
+
var oTable = that.getAggregation("_field");
|
|
608
|
+
oTable.detachEvent("rowsUpdated", that.updateTable, that);
|
|
609
|
+
oTable.attachEventOnce("rowsUpdated", that.updateTable, that);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
ObjectField.prototype.updateTable = function(oEvent) {
|
|
613
|
+
var that = this;
|
|
614
|
+
that.updateSelectionColumn();
|
|
615
|
+
that.updateToolbar();
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
ObjectField.prototype.updateSelectionColumn = function() {
|
|
619
|
+
var that = this;
|
|
620
|
+
var oTable = that.getAggregation("_field");
|
|
621
|
+
var oRowContexts = oTable.getBinding("rows").getContexts();
|
|
622
|
+
var bHasSelected = false;
|
|
623
|
+
for (var i = 0; i < oRowContexts.length; i++) {
|
|
624
|
+
var oObject = oRowContexts[i].getObject();
|
|
625
|
+
if (oObject._dt && oObject._dt._selected) {
|
|
626
|
+
bHasSelected = true;
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
508
629
|
}
|
|
630
|
+
oTable.getModel().setProperty("/_hasSelected", bHasSelected);
|
|
509
631
|
};
|
|
510
632
|
|
|
511
|
-
ObjectField.prototype.
|
|
633
|
+
ObjectField.prototype.updateToolbar = function() {
|
|
512
634
|
var that = this;
|
|
513
|
-
var
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return "sap-icon://display";
|
|
530
|
-
} else {
|
|
531
|
-
return "sap-icon://edit";
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
tooltip: {
|
|
536
|
-
path: '_editable',
|
|
537
|
-
formatter: function(bEditable) {
|
|
538
|
-
if (bEditable === false) {
|
|
539
|
-
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_DISPLAY_TOOLTIP");
|
|
540
|
-
} else {
|
|
541
|
-
return oResourceBundle.getText("EDITOR_FIELD_OBJECT_TABLE_BUTTON_EDIT_TOOLTIP");
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
},
|
|
545
|
-
press: that.onEditOrViewDetail.bind(that)
|
|
546
|
-
}),
|
|
547
|
-
new Button({
|
|
548
|
-
type: "Transparent",
|
|
549
|
-
icon: "sap-icon://delete",
|
|
550
|
-
visible: oConfig.editable === false ? false : "{= ${_editable} !== false}",
|
|
551
|
-
tooltip: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE"),
|
|
552
|
-
press: that.onDelete.bind(that)
|
|
553
|
-
})
|
|
554
|
-
]
|
|
555
|
-
})
|
|
556
|
-
});
|
|
635
|
+
var oTable = that.getAggregation("_field");
|
|
636
|
+
var aColumns = oTable.getColumns();
|
|
637
|
+
var bHasFilter = false;
|
|
638
|
+
for (var i = 0; i < aColumns.length; i++) {
|
|
639
|
+
var oMenu = aColumns[i].getMenu();
|
|
640
|
+
var oMenuItems = oMenu.getItems();
|
|
641
|
+
if (oMenuItems.length > 0) {
|
|
642
|
+
var oFilter = oMenuItems[0];
|
|
643
|
+
var sValue = oFilter.getValue();
|
|
644
|
+
if (sValue && sValue !== "") {
|
|
645
|
+
bHasFilter = true;
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
oTable.getModel().setProperty("/_hasFilter", bHasFilter);
|
|
557
651
|
};
|
|
558
652
|
|
|
559
653
|
ObjectField.prototype.columnFactory = function(sId, oContext) {
|
|
560
|
-
var that = this;
|
|
561
654
|
var sPath = oContext.getPath();
|
|
562
655
|
var sName = sPath.substring(oContext.getPath().lastIndexOf("/") + 1);
|
|
563
656
|
var sType = oContext.getProperty("$Type");
|
|
564
|
-
if (sType === "Actions") {
|
|
565
|
-
return that.createActionColumn();
|
|
566
|
-
}
|
|
567
657
|
var iLen = oContext.getProperty("$MaxLength");
|
|
568
658
|
var sColumnWidth = "7rem";
|
|
569
659
|
|
|
@@ -586,68 +676,143 @@ sap.ui.define([
|
|
|
586
676
|
});
|
|
587
677
|
};
|
|
588
678
|
|
|
679
|
+
ObjectField.prototype.onTableSelectionChange = function (oEvent) {
|
|
680
|
+
var that = this;
|
|
681
|
+
var oTable = that.getAggregation("_field");
|
|
682
|
+
var oModel = oTable.getModel();
|
|
683
|
+
var aSelectedIndices = oTable.getSelectedIndices();
|
|
684
|
+
if (aSelectedIndices.length > 0) {
|
|
685
|
+
oModel.setProperty("/_hasTableSelected", true);
|
|
686
|
+
} else {
|
|
687
|
+
oModel.setProperty("/_hasTableSelected", false);
|
|
688
|
+
oModel.setProperty("/_canDelete", false);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
if (aSelectedIndices.length === oTable.getBinding("rows").getContexts().length) {
|
|
692
|
+
oModel.setProperty("/_hasTableAllSelected", true);
|
|
693
|
+
} else {
|
|
694
|
+
oModel.setProperty("/_hasTableAllSelected", false);
|
|
695
|
+
}
|
|
696
|
+
var aSelectedPaths = [];
|
|
697
|
+
var aRowContexts = oTable.getBinding("rows").getContexts();
|
|
698
|
+
aSelectedIndices.forEach(function (iSelectIndex) {
|
|
699
|
+
var oObject = aRowContexts[iSelectIndex].getObject();
|
|
700
|
+
if (oObject._dt && oObject._dt._editable !== false) {
|
|
701
|
+
var sPath = aRowContexts[iSelectIndex].getPath();
|
|
702
|
+
aSelectedPaths.push(sPath);
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
if (aSelectedPaths.length === 0) {
|
|
706
|
+
oModel.setProperty("/_canDelete", false);
|
|
707
|
+
} else {
|
|
708
|
+
oModel.setProperty("/_canDelete", true);
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
ObjectField.prototype.selectAllTableSelections = function (oEvent) {
|
|
713
|
+
var that = this;
|
|
714
|
+
var oTable = that.getAggregation("_field");
|
|
715
|
+
oTable.selectAll();
|
|
716
|
+
oTable.getModel().setProperty("/_hasTableAllSelected", true);
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
ObjectField.prototype.clearAllTableSelections = function (oEvent) {
|
|
720
|
+
var that = this;
|
|
721
|
+
var oTable = that.getAggregation("_field");
|
|
722
|
+
var oModel = oTable.getModel();
|
|
723
|
+
oTable.clearSelection();
|
|
724
|
+
oModel.setProperty("/_hasTableSelected", false);
|
|
725
|
+
oModel.setProperty("/_canDelete", false);
|
|
726
|
+
oModel.setProperty("/_hasTableAllSelected", false);
|
|
727
|
+
};
|
|
728
|
+
|
|
589
729
|
ObjectField.prototype.onSelectionChange = function (oEvent) {
|
|
590
730
|
var that = this;
|
|
591
731
|
var oControl = oEvent.getSource();
|
|
592
|
-
var
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
732
|
+
var bSelected = oEvent.getParameter("selected");
|
|
733
|
+
var oTable = that.getAggregation("_field");
|
|
734
|
+
var sPath = oTable.getBindingContext().getPath();
|
|
735
|
+
var oModel = oTable.getModel();
|
|
736
|
+
if (bSelected) {
|
|
737
|
+
var oData = oModel.getProperty(sPath);
|
|
738
|
+
oData.forEach(function (oItem) {
|
|
739
|
+
oItem._dt = oItem._dt || {};
|
|
740
|
+
oItem._dt._selected = false;
|
|
741
|
+
});
|
|
742
|
+
var oObject = oControl.getBindingContext().getObject();
|
|
743
|
+
oObject._dt._selected = true;
|
|
744
|
+
var oClonedObject = deepClone(oObject);
|
|
745
|
+
oModel.setProperty("/_hasSelected", true);
|
|
746
|
+
that.setValue(oClonedObject);
|
|
747
|
+
} else {
|
|
748
|
+
oModel.setProperty("/_hasSelected", false);
|
|
749
|
+
that.setValue(undefined);
|
|
608
750
|
}
|
|
609
751
|
};
|
|
610
752
|
|
|
611
|
-
ObjectField.prototype.
|
|
753
|
+
ObjectField.prototype.addNewObject = function (oEvent) {
|
|
612
754
|
var that = this;
|
|
613
755
|
var oControl = oEvent.getSource();
|
|
614
|
-
that.
|
|
756
|
+
that._newObjectTemplate._dt._uuid = Utils.generateUuidV4();
|
|
757
|
+
that.openObjectDetailsPopover(that._newObjectTemplate, oControl, "add");
|
|
615
758
|
};
|
|
616
759
|
|
|
617
760
|
ObjectField.prototype.mergeValueWithRequestResult = function (tResult) {
|
|
618
761
|
var that = this;
|
|
619
762
|
var oConfig = that.getConfiguration();
|
|
620
763
|
var oTable = that.getAggregation("_field");
|
|
764
|
+
var oModel = oTable.getModel();
|
|
621
765
|
if (oConfig.value && (typeof oConfig.value === "object") && !deepEqual(oConfig.value, {})) {
|
|
622
|
-
var oValue
|
|
766
|
+
var oValue = deepClone(oConfig.value, 500),
|
|
767
|
+
sPath = oTable.getBinding("rows").getPath();
|
|
623
768
|
if (Array.isArray(tResult) && tResult.length > 0) {
|
|
624
|
-
if (
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
769
|
+
if (oValue._dt && oValue._dt._editable === false) {
|
|
770
|
+
var sUUID = oValue._dt._uuid || Utils.generateUuidV4();
|
|
771
|
+
delete oValue._dt._uuid;
|
|
772
|
+
tResult.forEach(function(oResult) {
|
|
773
|
+
// find the selected request result, change the uuid by the one of the value
|
|
774
|
+
if (deepEqual(oResult, oValue)) {
|
|
775
|
+
oResult._dt._selected = true;
|
|
776
|
+
oResult._dt._uuid = sUUID;
|
|
777
|
+
} else {
|
|
778
|
+
oResult._dt._uuid = Utils.generateUuidV4();
|
|
631
779
|
}
|
|
632
|
-
}
|
|
633
|
-
oTable.setSelectedIndex(iSelectedIndex);
|
|
780
|
+
});
|
|
634
781
|
} else {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
782
|
+
// add uuid for each request result
|
|
783
|
+
tResult.forEach(function(oResult) {
|
|
784
|
+
oResult._dt._uuid = Utils.generateUuidV4();
|
|
785
|
+
});
|
|
786
|
+
oValue._dt = oValue._dt || {};
|
|
787
|
+
oValue._dt._selected = true;
|
|
788
|
+
// add uuid for the value if not exist
|
|
789
|
+
oValue._dt._uuid = oValue._dt._uuid || Utils.generateUuidV4();
|
|
790
|
+
tResult.unshift(oValue);
|
|
638
791
|
}
|
|
639
792
|
} else {
|
|
640
|
-
oValue =
|
|
793
|
+
oValue._dt = oValue._dt || {};
|
|
794
|
+
oValue._dt._selected = true;
|
|
795
|
+
// add uuid for the value if not exist
|
|
796
|
+
oValue._dt._uuid = oValue._dt._uuid || Utils.generateUuidV4();
|
|
641
797
|
tResult = [oValue];
|
|
642
|
-
oTable.getModel().checkUpdate();
|
|
643
|
-
oTable.setSelectedIndex(0);
|
|
644
798
|
}
|
|
799
|
+
oModel.setProperty("/_hasSelected", true);
|
|
800
|
+
oModel.setProperty(sPath, tResult);
|
|
801
|
+
} else {
|
|
802
|
+
// add uuid for each request result
|
|
803
|
+
if (Array.isArray(tResult) && tResult.length > 0) {
|
|
804
|
+
tResult.forEach(function(oResult) {
|
|
805
|
+
oResult._dt._uuid = Utils.generateUuidV4();
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
oModel.setProperty("/_hasSelected", false);
|
|
645
809
|
}
|
|
646
|
-
|
|
810
|
+
oModel.checkUpdate();
|
|
647
811
|
};
|
|
648
812
|
|
|
649
813
|
ObjectField.prototype.onChangeOfTextArea = function (oEvent) {
|
|
650
814
|
var that = this;
|
|
815
|
+
var oResourceBundle = that.getResourceBundle();
|
|
651
816
|
var oTextArea = oEvent.getSource();
|
|
652
817
|
var sValue = oTextArea.getValue();
|
|
653
818
|
if (!sValue || sValue === "") {
|
|
@@ -670,6 +835,7 @@ sap.ui.define([
|
|
|
670
835
|
|
|
671
836
|
ObjectField.prototype.onChangeOfTextAreaInPopover = function (oEvent) {
|
|
672
837
|
var that = this;
|
|
838
|
+
var oResourceBundle = that.getResourceBundle();
|
|
673
839
|
var oTextArea = oEvent.getSource();
|
|
674
840
|
var sValue = oTextArea.getValue();
|
|
675
841
|
if (!sValue || sValue === "") {
|
|
@@ -690,10 +856,10 @@ sap.ui.define([
|
|
|
690
856
|
}
|
|
691
857
|
};
|
|
692
858
|
|
|
693
|
-
ObjectField.prototype.createFormContents = function (fnChange, sPathPrefix, bIsInPopover) {
|
|
859
|
+
ObjectField.prototype.createFormContents = function (fnChange, sPathPrefix, bIsInPopover, fnNavToTranslation) {
|
|
694
860
|
var that = this;
|
|
695
861
|
var oConfig = that.getConfiguration();
|
|
696
|
-
var aContentList = that.createPropertyContents(fnChange, sPathPrefix);
|
|
862
|
+
var aContentList = that.createPropertyContents(fnChange, sPathPrefix, fnNavToTranslation);
|
|
697
863
|
aContentList.push(new Label({
|
|
698
864
|
visible: false
|
|
699
865
|
}).addStyleClass("sapFormLabel"));
|
|
@@ -716,17 +882,17 @@ sap.ui.define([
|
|
|
716
882
|
return vValue;
|
|
717
883
|
}
|
|
718
884
|
},
|
|
719
|
-
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
885
|
+
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
720
886
|
width: "100%",
|
|
721
887
|
placeholder: "{config/placeholder}",
|
|
722
888
|
visible: "{= ${/editMode} === 'Json'}",
|
|
723
889
|
change: bIsInPopover === true ? this.onChangeOfTextAreaInPopover.bind(that) : this.onChangeOfTextArea.bind(that),
|
|
724
|
-
rows: bIsInPopover === true ?
|
|
890
|
+
rows: bIsInPopover === true ? 11 : 7
|
|
725
891
|
}));
|
|
726
892
|
return aContentList;
|
|
727
893
|
};
|
|
728
894
|
|
|
729
|
-
ObjectField.prototype.createPropertyContents = function (fnChange, sPathPrefix) {
|
|
895
|
+
ObjectField.prototype.createPropertyContents = function (fnChange, sPathPrefix, fnNavToTranslation) {
|
|
730
896
|
var that = this;
|
|
731
897
|
var oConfig = that.getConfiguration();
|
|
732
898
|
var aPropertyContentList = [];
|
|
@@ -755,7 +921,7 @@ sap.ui.define([
|
|
|
755
921
|
oProperties[m] = {
|
|
756
922
|
type: "number"
|
|
757
923
|
};
|
|
758
|
-
} else
|
|
924
|
+
} else {
|
|
759
925
|
oProperties[m] = {
|
|
760
926
|
type: "string"
|
|
761
927
|
};
|
|
@@ -782,13 +948,22 @@ sap.ui.define([
|
|
|
782
948
|
});
|
|
783
949
|
aPropertyContentList.push(oLable);
|
|
784
950
|
var oValueControl;
|
|
951
|
+
var oPropertySettings = deepClone(oProperty, 500);
|
|
952
|
+
delete oPropertySettings.type;
|
|
953
|
+
delete oPropertySettings.label;
|
|
954
|
+
delete oPropertySettings.translatable;
|
|
955
|
+
delete oPropertySettings.defaultValue;
|
|
956
|
+
delete oPropertySettings.formatter;
|
|
957
|
+
delete oPropertySettings.column;
|
|
958
|
+
delete oPropertySettings.cell;
|
|
959
|
+
var oSettings;
|
|
785
960
|
switch (oProperty.type) {
|
|
786
961
|
case "boolean":
|
|
787
962
|
if (oProperty.cell && oProperty.cell.type === "Switch") {
|
|
788
|
-
|
|
963
|
+
oSettings = {
|
|
789
964
|
state: "{" + sPathPrefix + n + "}",
|
|
790
965
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
791
|
-
enabled: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
966
|
+
enabled: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
792
967
|
change: fnChange
|
|
793
968
|
};
|
|
794
969
|
if (oProperty.cell.customTextOn) {
|
|
@@ -797,45 +972,52 @@ sap.ui.define([
|
|
|
797
972
|
if (oProperty.cell.customTextOff) {
|
|
798
973
|
oSettings.customTextOff = oProperty.cell.customTextOff;
|
|
799
974
|
}
|
|
975
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
800
976
|
oValueControl = new Switch(oSettings);
|
|
801
977
|
} else {
|
|
802
|
-
|
|
978
|
+
oSettings = {
|
|
803
979
|
selected: "{" + sPathPrefix + n + "}",
|
|
804
980
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
805
|
-
enabled: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
981
|
+
enabled: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
806
982
|
select: fnChange
|
|
807
|
-
}
|
|
983
|
+
};
|
|
984
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
985
|
+
oValueControl = new CheckBox(oSettings);
|
|
808
986
|
}
|
|
809
987
|
break;
|
|
810
988
|
case "int":
|
|
811
989
|
case "integer":
|
|
812
|
-
|
|
990
|
+
oSettings = {
|
|
813
991
|
value: {
|
|
814
992
|
path: sPathPrefix + n,
|
|
815
993
|
type: "sap.ui.model.type.Integer",
|
|
816
994
|
formatOptions: oProperty.formatter
|
|
817
995
|
},
|
|
818
996
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
819
|
-
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
997
|
+
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
820
998
|
type: "Number",
|
|
821
999
|
change: fnChange
|
|
822
|
-
}
|
|
1000
|
+
};
|
|
1001
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
1002
|
+
oValueControl = new Input(oSettings);
|
|
823
1003
|
break;
|
|
824
1004
|
case "number":
|
|
825
|
-
|
|
1005
|
+
oSettings = {
|
|
826
1006
|
value: {
|
|
827
1007
|
path: sPathPrefix + n,
|
|
828
1008
|
type: "sap.ui.model.type.Float",
|
|
829
1009
|
formatOptions: oProperty.formatter
|
|
830
1010
|
},
|
|
831
1011
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
832
|
-
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
1012
|
+
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
833
1013
|
type: "Number",
|
|
834
1014
|
change: fnChange
|
|
835
|
-
}
|
|
1015
|
+
};
|
|
1016
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
1017
|
+
oValueControl = new Input(oSettings);
|
|
836
1018
|
break;
|
|
837
1019
|
case "object":
|
|
838
|
-
|
|
1020
|
+
oSettings = {
|
|
839
1021
|
value: {
|
|
840
1022
|
path: sPathPrefix + n,
|
|
841
1023
|
formatter: function(vValue) {
|
|
@@ -852,18 +1034,71 @@ sap.ui.define([
|
|
|
852
1034
|
}
|
|
853
1035
|
},
|
|
854
1036
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
855
|
-
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
1037
|
+
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
856
1038
|
change: fnChange,
|
|
857
1039
|
rows: 3
|
|
858
|
-
}
|
|
1040
|
+
};
|
|
1041
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
1042
|
+
oValueControl = new TextArea(oSettings);
|
|
859
1043
|
break;
|
|
860
1044
|
default:
|
|
861
|
-
|
|
1045
|
+
var oTextSettingsModel = new JSONModel({
|
|
1046
|
+
translatable: oProperty.translatable || false,
|
|
1047
|
+
uuidPath: sPathPrefix + "_dt/_uuid",
|
|
1048
|
+
property: n
|
|
1049
|
+
});
|
|
1050
|
+
oSettings = {
|
|
862
1051
|
value: "{" + sPathPrefix + n + "}",
|
|
863
1052
|
visible: "{= ${/editMode} === 'Properties'}",
|
|
864
|
-
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_editable} !== false}",
|
|
865
|
-
change:
|
|
866
|
-
|
|
1053
|
+
editable: oConfig.editable === false ? false : "{= ${" + sPathPrefix + "_dt/_editable} !== false}",
|
|
1054
|
+
change: function(oEvent) {
|
|
1055
|
+
var oControl = oEvent.getSource();
|
|
1056
|
+
var sValue = oEvent.getParameter("value");
|
|
1057
|
+
// change the translation format {{KEY}} to {i18n>KEY} since manifest will translate it, but we don't want
|
|
1058
|
+
// more info in JIRA DIGITALWORKPLACE-3974
|
|
1059
|
+
if (sValue && sValue.match(REGEXP_TRANSLATABLE)) {
|
|
1060
|
+
var sKey = sValue.substring(2, sValue.length - 2);
|
|
1061
|
+
sValue = "{i18n>" + sKey + "}";
|
|
1062
|
+
oControl.setValue(sValue);
|
|
1063
|
+
oControl.fireChange();
|
|
1064
|
+
} else if (fnChange) {
|
|
1065
|
+
fnChange(oEvent);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
oSettings = merge(oSettings, oPropertySettings);
|
|
1070
|
+
// show the translation help icon of the input
|
|
1071
|
+
if (fnNavToTranslation) {
|
|
1072
|
+
oSettings.valueHelpIconSrc = "sap-icon://translate";
|
|
1073
|
+
oSettings.valueHelpRequest = fnNavToTranslation.bind(that, n);
|
|
1074
|
+
if (oProperty.translatable) {
|
|
1075
|
+
oSettings.showValueHelp = true;
|
|
1076
|
+
} else {
|
|
1077
|
+
oSettings.showValueHelp = {
|
|
1078
|
+
path: sPathPrefix + n,
|
|
1079
|
+
formatter: function(oValue) {
|
|
1080
|
+
var oSettings = this.getModel("settings").getData();
|
|
1081
|
+
var sUUID = this.getModel().getProperty(oSettings.uuidPath);
|
|
1082
|
+
var sConfigName = "translatable";
|
|
1083
|
+
if (that.getTranslationKey(oValue)) {
|
|
1084
|
+
if (!this.getShowValueHelp() && that.getObjectPropertyConfigValueInDesigntime(sUUID, oSettings.property, sConfigName) === false) {
|
|
1085
|
+
that.setObjectPropertyConfigValueInDesigntime(sUUID, oSettings.property, sConfigName, true);
|
|
1086
|
+
}
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
if (this.getShowValueHelp()) {
|
|
1090
|
+
// clean the translation values and updated language since the translation feature is off
|
|
1091
|
+
that.deleteTranslationValueInTexts(undefined, sUUID, oSettings.property);
|
|
1092
|
+
that.setObjectPropertyConfigValueInDesigntime(sUUID, oSettings.property, sConfigName, false);
|
|
1093
|
+
that._oUpdatedTranslations = {};
|
|
1094
|
+
}
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
oValueControl = new Input(oSettings);
|
|
1101
|
+
oValueControl.setModel(oTextSettingsModel,"settings");
|
|
867
1102
|
}
|
|
868
1103
|
aPropertyContentList.push(oValueControl);
|
|
869
1104
|
}
|
|
@@ -874,7 +1109,7 @@ sap.ui.define([
|
|
|
874
1109
|
var that = this;
|
|
875
1110
|
var oValueModel;
|
|
876
1111
|
if (!bIsInDetailsPopover) {
|
|
877
|
-
that.
|
|
1112
|
+
that.setValue(oValue);
|
|
878
1113
|
oValueModel = that.getAggregation("_field").getModel();
|
|
879
1114
|
if (oValueModel) {
|
|
880
1115
|
oValue = deepClone(oValue, 500);
|
|
@@ -905,7 +1140,7 @@ sap.ui.define([
|
|
|
905
1140
|
oModel.checkUpdate(true);
|
|
906
1141
|
var oValue = oModel.getProperty("/value");
|
|
907
1142
|
oValue = deepClone(oValue, 500);
|
|
908
|
-
that.
|
|
1143
|
+
that.setValue(oValue);
|
|
909
1144
|
};
|
|
910
1145
|
var aPropertyContents = that.createPropertyContents(fnChange, "/value/");
|
|
911
1146
|
aPropertyContents = aPropertyContents.concat(aContents);
|
|
@@ -914,25 +1149,78 @@ sap.ui.define([
|
|
|
914
1149
|
});
|
|
915
1150
|
};
|
|
916
1151
|
|
|
1152
|
+
// get origin values in i18n files
|
|
1153
|
+
ObjectField.prototype.getOriginTranslatedValues = function(sKey) {
|
|
1154
|
+
var aOriginTranslatedValues = [];
|
|
1155
|
+
var aEditorResourceBundles = EditorResourceBundles.getInstance();
|
|
1156
|
+
for (var p in aEditorResourceBundles) {
|
|
1157
|
+
var oResourceBundleTemp = aEditorResourceBundles[p];
|
|
1158
|
+
var sTranslatedValue = "";
|
|
1159
|
+
var sOriginValue = "";
|
|
1160
|
+
if (sKey && oResourceBundleTemp) {
|
|
1161
|
+
var sText = oResourceBundleTemp.resourceBundle && oResourceBundleTemp.resourceBundle.getText(sKey);
|
|
1162
|
+
sTranslatedValue = sText;
|
|
1163
|
+
sOriginValue = sText;
|
|
1164
|
+
} else {
|
|
1165
|
+
// if no translation key which means item defined as string value directly.
|
|
1166
|
+
// set the sTranslatedValue and sOriginValue for each language with item manifest value or default value.
|
|
1167
|
+
sTranslatedValue = "";
|
|
1168
|
+
sOriginValue = "";
|
|
1169
|
+
}
|
|
1170
|
+
var oLanguage = {
|
|
1171
|
+
"key": p,
|
|
1172
|
+
"desription": oResourceBundleTemp.language,
|
|
1173
|
+
"value": sTranslatedValue,
|
|
1174
|
+
"originValue": sOriginValue,
|
|
1175
|
+
"editable": true
|
|
1176
|
+
};
|
|
1177
|
+
aOriginTranslatedValues.push(oLanguage);
|
|
1178
|
+
}
|
|
1179
|
+
return aOriginTranslatedValues;
|
|
1180
|
+
};
|
|
1181
|
+
|
|
1182
|
+
// build origin translation values if translation type is "property"
|
|
1183
|
+
ObjectField.prototype.buildPropertyTranslationValues = function(sKey) {
|
|
1184
|
+
var aOriginTranslatedValues = [];
|
|
1185
|
+
var aEditorResourceBundles = EditorResourceBundles.getInstance();
|
|
1186
|
+
for (var p in aEditorResourceBundles) {
|
|
1187
|
+
aOriginTranslatedValues.push({
|
|
1188
|
+
"key": p,
|
|
1189
|
+
"desription": aEditorResourceBundles[p].language,
|
|
1190
|
+
"value": sKey,
|
|
1191
|
+
"originValue": sKey,
|
|
1192
|
+
"editable": true
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1195
|
+
return aOriginTranslatedValues;
|
|
1196
|
+
};
|
|
1197
|
+
|
|
917
1198
|
ObjectField.prototype.openObjectDetailsPopover = function (oItem, oControl, sMode) {
|
|
918
1199
|
var that = this;
|
|
919
|
-
var
|
|
1200
|
+
var oResourceBundle = that.getResourceBundle();
|
|
920
1201
|
var oItemCloned = deepClone(oItem, 500);
|
|
921
1202
|
var oModel;
|
|
1203
|
+
var sPlacement = sMode === "add" && that._previewPosition !== "right" ? "Left" : "Right";
|
|
922
1204
|
if (!that._oObjectDetailsPopover) {
|
|
923
|
-
var
|
|
924
|
-
text: oResourceBundle.getText("
|
|
925
|
-
visible: sMode === "
|
|
1205
|
+
var oAddButton = new Button({
|
|
1206
|
+
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_ADD"),
|
|
1207
|
+
visible: sMode === "add",
|
|
926
1208
|
enabled: {
|
|
927
1209
|
path: '/value',
|
|
928
1210
|
formatter: function(vValue) {
|
|
929
|
-
if (
|
|
1211
|
+
if (typeof vValue !== "object" || deepEqual(vValue, {})) {
|
|
930
1212
|
return false;
|
|
1213
|
+
} else {
|
|
1214
|
+
var oValue = deepClone(vValue);
|
|
1215
|
+
delete oValue._dt;
|
|
1216
|
+
if (deepEqual(oValue, {})) {
|
|
1217
|
+
return false;
|
|
1218
|
+
}
|
|
931
1219
|
}
|
|
932
1220
|
return true;
|
|
933
1221
|
}
|
|
934
1222
|
},
|
|
935
|
-
press: that.
|
|
1223
|
+
press: that.onAdd.bind(that)
|
|
936
1224
|
});
|
|
937
1225
|
var oUpdateButton = new Button({
|
|
938
1226
|
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_UPDATE"),
|
|
@@ -948,27 +1236,25 @@ sap.ui.define([
|
|
|
948
1236
|
},
|
|
949
1237
|
press: that.onUpdate.bind(that)
|
|
950
1238
|
});
|
|
951
|
-
|
|
952
|
-
"
|
|
953
|
-
|
|
1239
|
+
var oCancelButton = new Button({
|
|
1240
|
+
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_CANCEL"),
|
|
1241
|
+
visible: sMode !== "view",
|
|
1242
|
+
press: function () {
|
|
1243
|
+
if (sMode === "add") {
|
|
1244
|
+
// clean the translations for the cancelled new object
|
|
1245
|
+
var oNewObject = that._oObjectDetailsPopover.getModel().getProperty("/value");
|
|
1246
|
+
that.deleteTranslationValueInTexts(undefined, oNewObject._dt._uuid);
|
|
1247
|
+
}
|
|
1248
|
+
that._oObjectDetailsPopover.close();
|
|
1249
|
+
}
|
|
954
1250
|
});
|
|
955
|
-
var
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
if (oNewObject && oNewObject !== "" && typeof oNewObject === "object" && !deepEqual(oNewObject, {})) {
|
|
961
|
-
oCreateButton.setEnabled(true);
|
|
962
|
-
} else {
|
|
963
|
-
oCreateButton.setEnabled(false);
|
|
1251
|
+
var oCloseButton = new Button({
|
|
1252
|
+
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_CLOSE"),
|
|
1253
|
+
visible: sMode === "view",
|
|
1254
|
+
press: function () {
|
|
1255
|
+
that._oObjectDetailsPopover.close();
|
|
964
1256
|
}
|
|
965
|
-
};
|
|
966
|
-
var fnChange = function() {};
|
|
967
|
-
if (oItem._editable !== false) {
|
|
968
|
-
aObjectPropertyFormContents = that.createFormContents(fnChangeWithDataSave, "/value/", true);
|
|
969
|
-
} else {
|
|
970
|
-
aObjectPropertyFormContents = that.createFormContents(fnChange, "/value/", true);
|
|
971
|
-
}
|
|
1257
|
+
});
|
|
972
1258
|
var oEditModeButton = new Button({
|
|
973
1259
|
icon: {
|
|
974
1260
|
path: '/editMode',
|
|
@@ -1001,6 +1287,50 @@ sap.ui.define([
|
|
|
1001
1287
|
}
|
|
1002
1288
|
}
|
|
1003
1289
|
});
|
|
1290
|
+
var aObjectPropertyFormContents;
|
|
1291
|
+
that._oNavContainer = new NavContainer();
|
|
1292
|
+
that._oObjectDetailsPage = new Page({
|
|
1293
|
+
title: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_TITLE"),
|
|
1294
|
+
headerContent: oEditModeButton,
|
|
1295
|
+
footer: new OverflowToolbar({
|
|
1296
|
+
content: [
|
|
1297
|
+
new ToolbarSpacer(),
|
|
1298
|
+
oAddButton,
|
|
1299
|
+
oUpdateButton,
|
|
1300
|
+
oCancelButton,
|
|
1301
|
+
oCloseButton
|
|
1302
|
+
]
|
|
1303
|
+
})
|
|
1304
|
+
});
|
|
1305
|
+
var fnNavBack = function (oEvent) {
|
|
1306
|
+
that._oNavContainer.back();
|
|
1307
|
+
that._oObjectDetailsPage.focus();
|
|
1308
|
+
};
|
|
1309
|
+
var oList = that.buildTranslationsList();
|
|
1310
|
+
var oTranslationsFooter = that.buildTranslationsFooter(oList, false);
|
|
1311
|
+
that._oTranslationListPage = new Page({
|
|
1312
|
+
title: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TRANSLATION_LIST_TITLE", "{languages>/property}"),
|
|
1313
|
+
showNavButton: true,
|
|
1314
|
+
navButtonPress: fnNavBack,
|
|
1315
|
+
content: oList,
|
|
1316
|
+
footer: oTranslationsFooter
|
|
1317
|
+
});
|
|
1318
|
+
var fnChangeWithDataSave = function(oEvent) {
|
|
1319
|
+
var oModel = that._oObjectDetailsPopover.getModel();
|
|
1320
|
+
oModel.checkUpdate(true);
|
|
1321
|
+
var oNewObject = oModel.getProperty("/value");
|
|
1322
|
+
if (oNewObject && oNewObject !== "" && typeof oNewObject === "object" && !deepEqual(oNewObject, {})) {
|
|
1323
|
+
oAddButton.setEnabled(true);
|
|
1324
|
+
} else {
|
|
1325
|
+
oAddButton.setEnabled(false);
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
var fnChange = function() {};
|
|
1329
|
+
if (oItem._dt && oItem._dt._editable === false) {
|
|
1330
|
+
aObjectPropertyFormContents = that.createFormContents(fnChange, "/value/", true, that.navToTranslationPage);
|
|
1331
|
+
} else {
|
|
1332
|
+
aObjectPropertyFormContents = that.createFormContents(fnChangeWithDataSave, "/value/", true, that.navToTranslationPage);
|
|
1333
|
+
}
|
|
1004
1334
|
var oForm = new SimpleForm({
|
|
1005
1335
|
layout: "ResponsiveGridLayout",
|
|
1006
1336
|
labelSpanXL: 4,
|
|
@@ -1017,118 +1347,434 @@ sap.ui.define([
|
|
|
1017
1347
|
columnsM: 1,
|
|
1018
1348
|
content: aObjectPropertyFormContents
|
|
1019
1349
|
});
|
|
1020
|
-
|
|
1350
|
+
that._oObjectDetailsPage.addContent(oForm);
|
|
1351
|
+
that._oNavContainer.addPage(that._oObjectDetailsPage);
|
|
1352
|
+
/*
|
|
1353
|
+
_oTranslationListPage.addContent();
|
|
1354
|
+
*/
|
|
1355
|
+
that._oNavContainer.addPage(that._oTranslationListPage);
|
|
1021
1356
|
that._oObjectDetailsPopover = new Popover({
|
|
1022
1357
|
placement: sPlacement,
|
|
1358
|
+
showHeader: false,
|
|
1023
1359
|
contentWidth: "300px",
|
|
1024
1360
|
contentHeight: "345px",
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
content: [
|
|
1028
|
-
new Title({
|
|
1029
|
-
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_TITLE")
|
|
1030
|
-
}),
|
|
1031
|
-
new ToolbarSpacer(),
|
|
1032
|
-
oEditModeButton
|
|
1033
|
-
]
|
|
1034
|
-
}),
|
|
1035
|
-
footer: new OverflowToolbar({
|
|
1036
|
-
content: [
|
|
1037
|
-
new ToolbarSpacer(),
|
|
1038
|
-
oCreateButton,
|
|
1039
|
-
oUpdateButton,
|
|
1040
|
-
new Button({
|
|
1041
|
-
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_CLOSE"),
|
|
1042
|
-
press: function () {
|
|
1043
|
-
that._oObjectDetailsPopover.close();
|
|
1044
|
-
}
|
|
1045
|
-
})
|
|
1046
|
-
]
|
|
1047
|
-
})
|
|
1361
|
+
modal: true,
|
|
1362
|
+
content: that._oNavContainer
|
|
1048
1363
|
}).addStyleClass("sapUiIntegrationEditorItemObjectFieldDetailsPopover");
|
|
1364
|
+
oModel = new JSONModel({
|
|
1365
|
+
"value": oItemCloned,
|
|
1366
|
+
"editMode": "Properties"
|
|
1367
|
+
});
|
|
1049
1368
|
that._oObjectDetailsPopover.setModel(oModel);
|
|
1050
1369
|
that._oObjectDetailsPopover.setModel(that.getModel("i18n"), "i18n");
|
|
1051
|
-
that._oObjectDetailsPopover.
|
|
1370
|
+
that._oObjectDetailsPopover._oAddButton = oAddButton;
|
|
1052
1371
|
that._oObjectDetailsPopover._oUpdateButton = oUpdateButton;
|
|
1372
|
+
that._oObjectDetailsPopover._oCancelButton = oCancelButton;
|
|
1373
|
+
that._oObjectDetailsPopover._oCloseButton = oCloseButton;
|
|
1053
1374
|
that._oObjectDetailsPopover._openBy = oControl;
|
|
1054
1375
|
} else {
|
|
1055
1376
|
oModel = that._oObjectDetailsPopover.getModel();
|
|
1056
1377
|
oModel.setProperty("/value", oItemCloned);
|
|
1057
|
-
|
|
1058
|
-
|
|
1378
|
+
oModel.checkUpdate(true);
|
|
1379
|
+
if (sMode === "add") {
|
|
1380
|
+
that._oObjectDetailsPopover._oAddButton.setVisible(true);
|
|
1059
1381
|
that._oObjectDetailsPopover._oUpdateButton.setVisible(false);
|
|
1382
|
+
that._oObjectDetailsPopover._oCancelButton.setVisible(true);
|
|
1383
|
+
that._oObjectDetailsPopover._oCloseButton.setVisible(false);
|
|
1060
1384
|
} else if (sMode === "update") {
|
|
1061
|
-
that._oObjectDetailsPopover.
|
|
1385
|
+
that._oObjectDetailsPopover._oAddButton.setVisible(false);
|
|
1062
1386
|
that._oObjectDetailsPopover._oUpdateButton.setVisible(true);
|
|
1387
|
+
that._oObjectDetailsPopover._oCancelButton.setVisible(true);
|
|
1388
|
+
that._oObjectDetailsPopover._oCloseButton.setVisible(false);
|
|
1063
1389
|
} else {
|
|
1064
|
-
that._oObjectDetailsPopover.
|
|
1390
|
+
that._oObjectDetailsPopover._oAddButton.setVisible(false);
|
|
1065
1391
|
that._oObjectDetailsPopover._oUpdateButton.setVisible(false);
|
|
1392
|
+
that._oObjectDetailsPopover._oCancelButton.setVisible(false);
|
|
1393
|
+
that._oObjectDetailsPopover._oCloseButton.setVisible(true);
|
|
1066
1394
|
}
|
|
1067
1395
|
that._oObjectDetailsPopover._openBy = oControl;
|
|
1396
|
+
that._oObjectDetailsPopover.setPlacement(sPlacement);
|
|
1397
|
+
// nav back to main page
|
|
1398
|
+
that._oNavContainer.back();
|
|
1068
1399
|
}
|
|
1069
1400
|
that._oObjectDetailsPopover.openBy(oControl);
|
|
1070
1401
|
};
|
|
1071
1402
|
|
|
1072
|
-
|
|
1403
|
+
// build the translation data of the translation list
|
|
1404
|
+
ObjectField.prototype.buildTranslationsData = function (sKey, sType, sUUID, sProperty) {
|
|
1073
1405
|
var that = this;
|
|
1074
|
-
var
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1406
|
+
var oResourceBundle = that.getResourceBundle();
|
|
1407
|
+
that._oOriginTranslatedValues = that._oOriginTranslatedValues || {};
|
|
1408
|
+
that._oUpdatedTranslations = that._oUpdatedTranslations || {};
|
|
1409
|
+
var sPropertyKey = sUUID + "_" + sProperty;
|
|
1410
|
+
var sTranslationKey = sKey;
|
|
1411
|
+
// get or build the initial translation data
|
|
1412
|
+
if (sType === "key") {
|
|
1413
|
+
if (!that._oOriginTranslatedValues[sKey]) {
|
|
1414
|
+
that._oOriginTranslatedValues[sKey] = that.getOriginTranslatedValues(sKey);
|
|
1415
|
+
}
|
|
1416
|
+
} else if (sType === "property") {
|
|
1417
|
+
sTranslationKey = sPropertyKey;
|
|
1418
|
+
that._oOriginTranslatedValues[sTranslationKey] = that.buildPropertyTranslationValues(sKey);
|
|
1419
|
+
}
|
|
1420
|
+
var aTempTranslatedLanguages = [];
|
|
1421
|
+
// merge with the current translation texts
|
|
1422
|
+
that._oOriginTranslatedValues[sTranslationKey].forEach(function (originTranslatedValue) {
|
|
1423
|
+
var oTempTranslatedValue = deepClone(originTranslatedValue, 500);
|
|
1424
|
+
oTempTranslatedValue.status = oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_LISTITEM_GROUP_NOTUPDATED");
|
|
1425
|
+
var sTranslateText = that.getTranslationValueInTexts(oTempTranslatedValue.key, sUUID, sProperty);
|
|
1426
|
+
if (sTranslateText) {
|
|
1427
|
+
oTempTranslatedValue.value = sTranslateText;
|
|
1428
|
+
if (includes(that._oUpdatedTranslations[sTranslationKey], oTempTranslatedValue.key)) {
|
|
1429
|
+
oTempTranslatedValue.value = that.getTranslationValueInTexts(oTempTranslatedValue.key, sUUID, sProperty);
|
|
1430
|
+
oTempTranslatedValue.status = oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_LISTITEM_GROUP_UPDATED");
|
|
1431
|
+
} else {
|
|
1432
|
+
oTempTranslatedValue.originValue = oTempTranslatedValue.value;
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
if (oTempTranslatedValue.key === oResourceBundle.sLocale.replaceAll('_', '-')) {
|
|
1436
|
+
oTempTranslatedValue.desription += " (" + oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_CURRENTLANGUAGE") + ")";
|
|
1437
|
+
aTempTranslatedLanguages.unshift(oTempTranslatedValue);
|
|
1438
|
+
} else {
|
|
1439
|
+
aTempTranslatedLanguages.push(oTempTranslatedValue);
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
var oTranslatedValues = {
|
|
1443
|
+
"isUpdated": false,
|
|
1444
|
+
"key": sKey,
|
|
1445
|
+
"translationKey": sTranslationKey,
|
|
1446
|
+
"translationType": sType,
|
|
1447
|
+
"uuid": sUUID,
|
|
1448
|
+
"property": sProperty,
|
|
1449
|
+
"translatedLanguages": aTempTranslatedLanguages
|
|
1450
|
+
};
|
|
1451
|
+
return oTranslatedValues;
|
|
1452
|
+
};
|
|
1453
|
+
|
|
1454
|
+
ObjectField.prototype.getTranslationKey = function (sValue) {
|
|
1455
|
+
var sKey;
|
|
1456
|
+
if (sValue && sValue.match(REGEXP_TRANSLATABLE)) {
|
|
1457
|
+
sKey = sValue.substring(2, sValue.length - 2);
|
|
1458
|
+
} else if (sValue && sValue.startsWith("{i18n>") && sValue.endsWith('}')) {
|
|
1459
|
+
sKey = sValue.substring(6, sValue.length - 1);
|
|
1460
|
+
}
|
|
1461
|
+
return sKey;
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1464
|
+
ObjectField.prototype.buildTranslationsModel = function (oTranslatedValues) {
|
|
1465
|
+
var that = this;
|
|
1466
|
+
var oResourceBundle = that.getResourceBundle();
|
|
1467
|
+
var oTranslatonsModel = new JSONModel(oTranslatedValues);
|
|
1468
|
+
oTranslatonsModel.attachPropertyChange(function(oEvent) {
|
|
1469
|
+
//update the status of each translation for grouping
|
|
1470
|
+
//update the isUpdated property
|
|
1471
|
+
var oData = oTranslatonsModel.getData();
|
|
1472
|
+
var sUpdatedStr = oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_LISTITEM_GROUP_UPDATED");
|
|
1473
|
+
var sNotUpdatedStr = oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_LISTITEM_GROUP_NOTUPDATED");
|
|
1474
|
+
var bIsUpdated = false;
|
|
1475
|
+
oData.translatedLanguages.forEach(function(oLanguage) {
|
|
1476
|
+
if (oLanguage.value !== oLanguage.originValue) {
|
|
1477
|
+
oLanguage.status = sUpdatedStr;
|
|
1478
|
+
bIsUpdated = true;
|
|
1479
|
+
} else {
|
|
1480
|
+
oLanguage.status = sNotUpdatedStr;
|
|
1481
|
+
}
|
|
1482
|
+
});
|
|
1483
|
+
oData.isUpdated = bIsUpdated;
|
|
1484
|
+
oTranslatonsModel.setData(oData);
|
|
1485
|
+
oTranslatonsModel.checkUpdate(true);
|
|
1486
|
+
});
|
|
1487
|
+
return oTranslatonsModel;
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1490
|
+
ObjectField.prototype.buildTranslationsList = function () {
|
|
1491
|
+
return new List({
|
|
1492
|
+
items: {
|
|
1493
|
+
path: "languages>/translatedLanguages",
|
|
1494
|
+
template: new CustomListItem({
|
|
1495
|
+
content: [
|
|
1496
|
+
new VBox({
|
|
1497
|
+
items: [
|
|
1498
|
+
new Text({
|
|
1499
|
+
text: "{languages>desription}"
|
|
1500
|
+
}),
|
|
1501
|
+
new Input({
|
|
1502
|
+
value: "{languages>value}",
|
|
1503
|
+
editable: "{languages>editable}"
|
|
1504
|
+
})
|
|
1505
|
+
]
|
|
1506
|
+
})
|
|
1507
|
+
],
|
|
1508
|
+
customData: [
|
|
1509
|
+
new CustomData({
|
|
1510
|
+
key: "{languages>key}",
|
|
1511
|
+
value: "{languages>desription}"
|
|
1512
|
+
})
|
|
1513
|
+
]
|
|
1514
|
+
}),
|
|
1515
|
+
sorter: [new Sorter({
|
|
1516
|
+
path: 'status',
|
|
1517
|
+
descending: true,
|
|
1518
|
+
group: true
|
|
1519
|
+
})]
|
|
1520
|
+
}
|
|
1521
|
+
});
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
ObjectField.prototype.buildTranslationsFooter = function (oList, bIsInTranslationPopover) {
|
|
1525
|
+
var that = this;
|
|
1526
|
+
var oResourceBundle = that.getResourceBundle();
|
|
1527
|
+
var sCurrentLanugae = oResourceBundle.sLocale.replaceAll('_', '-');
|
|
1528
|
+
var oSaveTranslationButton = new Button({
|
|
1529
|
+
type: "Emphasized",
|
|
1530
|
+
text: oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_BUTTON_SAVE"),
|
|
1531
|
+
enabled: "{languages>/isUpdated}",
|
|
1532
|
+
press: function () {
|
|
1533
|
+
var oTranslationModel = oList.getModel("languages");
|
|
1534
|
+
var oData = oTranslationModel.getData();
|
|
1535
|
+
//get changes in the popup
|
|
1536
|
+
var aUpdatedLanguages = [];
|
|
1537
|
+
var sKey = oData.key;
|
|
1538
|
+
var sTranslationKey = oData.translationKey;
|
|
1539
|
+
var sType = oData.translationType;
|
|
1540
|
+
var sUUID = oData.uuid;
|
|
1541
|
+
var sProperty = oData.property;
|
|
1542
|
+
oData.translatedLanguages.forEach(function(oLanguage) {
|
|
1543
|
+
if (oLanguage.value !== oLanguage.originValue) {
|
|
1544
|
+
that.setTranslationValueInTexts(oLanguage.key, sUUID, sProperty, oLanguage.value);
|
|
1545
|
+
aUpdatedLanguages.push(oLanguage.key);
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
var bUpdateDependentFieldsAndPreview = false;
|
|
1549
|
+
if (aUpdatedLanguages.length > 0) {
|
|
1550
|
+
that._oUpdatedTranslations = that._oUpdatedTranslations || {};
|
|
1551
|
+
that._oUpdatedTranslations[sTranslationKey] = aUpdatedLanguages;
|
|
1552
|
+
if (includes(aUpdatedLanguages, sCurrentLanugae)) {
|
|
1553
|
+
bUpdateDependentFieldsAndPreview = true;
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
// refresh the translation list
|
|
1557
|
+
oData = that.buildTranslationsData(sKey, sType, sUUID, sProperty);
|
|
1558
|
+
oTranslationModel.setData(oData);
|
|
1559
|
+
oTranslationModel.checkUpdate(true);
|
|
1560
|
+
// update table
|
|
1561
|
+
if (that.getModel()) {
|
|
1562
|
+
that.getModel().checkUpdate(true);
|
|
1563
|
+
}
|
|
1564
|
+
// update preview and dependent fields
|
|
1565
|
+
if (bUpdateDependentFieldsAndPreview && that._oValueBinding) {
|
|
1566
|
+
that._oValueBinding.fireEvent("change");
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
var oResetTranslationButton = new Button({
|
|
1571
|
+
text: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DETAILS_POPOVER_BUTTON_RESET"),
|
|
1572
|
+
enabled: "{languages>/isUpdated}",
|
|
1573
|
+
press: function(oEvent) {
|
|
1574
|
+
var oTranslationModel = oList.getModel("languages");
|
|
1575
|
+
var oData = oTranslationModel.getData();
|
|
1576
|
+
// set value to origin value
|
|
1577
|
+
oData.translatedLanguages.forEach(function (translatedValue) {
|
|
1578
|
+
translatedValue.value = translatedValue.originValue;
|
|
1579
|
+
translatedValue.status = oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_LISTITEM_GROUP_NOTUPDATED");
|
|
1580
|
+
});
|
|
1581
|
+
oData.isUpdated = false;
|
|
1582
|
+
oTranslationModel.setData(oData);
|
|
1583
|
+
oTranslationModel.checkUpdate(true);
|
|
1584
|
+
}
|
|
1585
|
+
});
|
|
1586
|
+
var oCancelButton = new Button({
|
|
1587
|
+
text: oResourceBundle.getText("EDITOR_FIELD_TRANSLATION_LIST_POPOVER_BUTTON_CANCEL"),
|
|
1588
|
+
visible: bIsInTranslationPopover,
|
|
1589
|
+
press: function () {
|
|
1590
|
+
that._oTranslationPopover.close();
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
return new OverflowToolbar({
|
|
1594
|
+
content: [
|
|
1595
|
+
new ToolbarSpacer(),
|
|
1596
|
+
oSaveTranslationButton,
|
|
1597
|
+
oResetTranslationButton,
|
|
1598
|
+
oCancelButton
|
|
1599
|
+
]
|
|
1600
|
+
});
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
ObjectField.prototype.openTranslationPopup = function (sProperty, oEvent) {
|
|
1604
|
+
var that = this;
|
|
1605
|
+
var oControl = oEvent.getSource();
|
|
1606
|
+
var oResourceBundle = that.getResourceBundle();
|
|
1607
|
+
var oNewObject = oControl.getModel().getProperty("/value");
|
|
1608
|
+
if (!oNewObject._dt) {
|
|
1609
|
+
oNewObject._dt = {
|
|
1610
|
+
_uuid: Utils.generateUuidV4()
|
|
1081
1611
|
};
|
|
1612
|
+
} else if (!oNewObject._dt._uuid) {
|
|
1613
|
+
oNewObject._dt._uuid = Utils.generateUuidV4();
|
|
1614
|
+
}
|
|
1615
|
+
var sValue = oControl.getValue();
|
|
1616
|
+
//get translation key of the value
|
|
1617
|
+
var sKey = that.getTranslationKey(sValue);
|
|
1618
|
+
var sType = "property";
|
|
1619
|
+
if (sKey && sKey !== "") {
|
|
1620
|
+
sType = "key";
|
|
1621
|
+
} else {
|
|
1622
|
+
sKey = sValue;
|
|
1623
|
+
}
|
|
1624
|
+
var oTranslatedValues = that.buildTranslationsData(sKey, sType, oNewObject._dt._uuid, sProperty);
|
|
1625
|
+
var oTranslatonsModel;
|
|
1626
|
+
if (!that._oTranslationPopover) {
|
|
1627
|
+
var oList = that.buildTranslationsList();
|
|
1628
|
+
var oTranslationsFooter = that.buildTranslationsFooter(oList, true);
|
|
1629
|
+
var sPlacement = that._previewPosition === "right" ? "Right" : "Left";
|
|
1630
|
+
that._oTranslationPopover = new Popover({
|
|
1631
|
+
placement: sPlacement,
|
|
1632
|
+
contentWidth: "300px",
|
|
1633
|
+
contentHeight: "345px",
|
|
1634
|
+
title: oResourceBundle.getText("EDITOR_FIELD_OBJECT_TRANSLATION_LIST_TITLE", "{languages>/property}"),
|
|
1635
|
+
content: oList,
|
|
1636
|
+
footer: oTranslationsFooter
|
|
1637
|
+
}).addStyleClass("sapUiIntegrationFieldTranslation");
|
|
1638
|
+
oTranslatonsModel = that.buildTranslationsModel(oTranslatedValues);
|
|
1639
|
+
that._oTranslationPopover.setModel(oTranslatonsModel, "languages");
|
|
1640
|
+
} else {
|
|
1641
|
+
oTranslatonsModel = that._oTranslationPopover.getModel("languages");
|
|
1642
|
+
oTranslatonsModel.setData(oTranslatedValues);
|
|
1643
|
+
oTranslatonsModel.checkUpdate(true);
|
|
1644
|
+
}
|
|
1645
|
+
that._oTranslationPopover.openBy(oControl._oValueHelpIcon);
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
ObjectField.prototype.navToTranslationPage = function (sProperty, oEvent) {
|
|
1649
|
+
var that = this;
|
|
1650
|
+
var oNewObject = that._oObjectDetailsPopover.getModel().getProperty("/value");
|
|
1651
|
+
var sValue = oNewObject[sProperty];
|
|
1652
|
+
//get translation key of the value
|
|
1653
|
+
var sKey = that.getTranslationKey(sValue);
|
|
1654
|
+
var sType = "property";
|
|
1655
|
+
if (sKey && sKey !== "") {
|
|
1656
|
+
sType = "key";
|
|
1657
|
+
} else {
|
|
1658
|
+
sKey = sValue;
|
|
1082
1659
|
}
|
|
1660
|
+
var oTranslatedValues = that.buildTranslationsData(sKey, sType, oNewObject._dt._uuid, sProperty);
|
|
1661
|
+
var oTranslatonsModel = that._oTranslationListPage.getModel("languages");
|
|
1662
|
+
if (!oTranslatonsModel) {
|
|
1663
|
+
oTranslatonsModel = that.buildTranslationsModel(oTranslatedValues);
|
|
1664
|
+
that._oTranslationListPage.setModel(oTranslatonsModel, "languages");
|
|
1665
|
+
} else {
|
|
1666
|
+
oTranslatonsModel.setData(oTranslatedValues);
|
|
1667
|
+
}
|
|
1668
|
+
that._oNavContainer.to(that._oTranslationListPage);
|
|
1669
|
+
that._oTranslationListPage.focus();
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
ObjectField.prototype.onAdd = function(oEvent) {
|
|
1673
|
+
var that = this;
|
|
1674
|
+
var oControl = that.getAggregation("_field");
|
|
1675
|
+
var oModel = oControl.getModel();
|
|
1083
1676
|
var oNewObject = that._oObjectDetailsPopover.getModel().getProperty("/value");
|
|
1084
1677
|
var sPath = oControl.getBinding("rows").getPath();
|
|
1085
|
-
var oData =
|
|
1678
|
+
var oData = oModel.getProperty(sPath);
|
|
1679
|
+
oData.forEach(function (oItem) {
|
|
1680
|
+
if (oItem._dt._selected) {
|
|
1681
|
+
oItem._dt._selected = false;
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1086
1684
|
oData.push(oNewObject);
|
|
1087
|
-
|
|
1685
|
+
oModel.setProperty("/_hasSelected", true);
|
|
1686
|
+
oModel.setProperty("/_hasTableAllSelected", false);
|
|
1687
|
+
oModel.setProperty("/_hasTableSelected", false);
|
|
1688
|
+
oModel.checkUpdate();
|
|
1689
|
+
that.refreshValue();
|
|
1690
|
+
that.updateTable();
|
|
1088
1691
|
that._oObjectDetailsPopover.close();
|
|
1089
|
-
|
|
1090
|
-
// restore the selections since the selections are lost, BCP: 2280048930, JIRA: CPOUIFTEAMB-252
|
|
1091
|
-
if (bHasBeforeValue) {
|
|
1092
|
-
that.applyBeforeValueAndSelections("create", oParameter);
|
|
1093
|
-
}
|
|
1094
1692
|
};
|
|
1095
1693
|
|
|
1096
1694
|
ObjectField.prototype.onUpdate = function (oEvent) {
|
|
1097
1695
|
var that = this;
|
|
1098
|
-
var
|
|
1696
|
+
var oTable = that.getAggregation("_field");
|
|
1099
1697
|
var oObject = that._oObjectDetailsPopover.getModel().getProperty("/value");
|
|
1100
|
-
var oModel =
|
|
1101
|
-
var oRow = that._oObjectDetailsPopover._openBy.getParent()
|
|
1698
|
+
var oModel = oTable.getModel();
|
|
1699
|
+
var oRow = that._oObjectDetailsPopover._openBy.getParent();
|
|
1102
1700
|
var iRowIndex = oRow.getIndex();
|
|
1103
1701
|
|
|
1104
1702
|
// get the real index via path since the rows may be filtered
|
|
1105
|
-
var
|
|
1106
|
-
var sPath =
|
|
1107
|
-
|
|
1108
|
-
var oParameter;
|
|
1109
|
-
var bHasBeforeValue = that.checkHasValue();
|
|
1110
|
-
if (bHasBeforeValue) {
|
|
1111
|
-
var aRowContexts = oControl.getBinding("rows").getContexts();
|
|
1112
|
-
oParameter = {
|
|
1113
|
-
updatedObject: oObject,
|
|
1114
|
-
rowIndex: iRowIndex,
|
|
1115
|
-
path: sPath,
|
|
1116
|
-
selectedIndex: oControl.getSelectedIndex(),
|
|
1117
|
-
selectedIndices: oControl.getSelectedIndices(),
|
|
1118
|
-
rowNumber: aRowContexts ? aRowContexts.length : 0
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1703
|
+
var aRowContexts = oTable.getBinding("rows").getContexts();
|
|
1704
|
+
var sPath = aRowContexts[iRowIndex].getPath();
|
|
1122
1705
|
// update the object in control value model
|
|
1123
1706
|
oModel.setProperty(sPath, deepClone(oObject, 500));
|
|
1124
1707
|
oModel.checkUpdate();
|
|
1125
1708
|
|
|
1709
|
+
//update object in field value if it is selected
|
|
1710
|
+
if (oObject._dt && oObject._dt._selected) {
|
|
1711
|
+
that.refreshValue();
|
|
1712
|
+
}
|
|
1713
|
+
that.updateTable();
|
|
1714
|
+
|
|
1126
1715
|
that._oObjectDetailsPopover.close();
|
|
1716
|
+
};
|
|
1127
1717
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1718
|
+
ObjectField.prototype.onDelete = function(oEvent) {
|
|
1719
|
+
var that = this;
|
|
1720
|
+
var oTable = that.getAggregation("_field");
|
|
1721
|
+
var oResourceBundle = that.getResourceBundle();
|
|
1722
|
+
var aSelectedIndices = oTable.getSelectedIndices();
|
|
1723
|
+
var aSelectedIndexs = [];
|
|
1724
|
+
var aRowContexts = oTable.getBinding("rows").getContexts();
|
|
1725
|
+
aSelectedIndices.forEach(function (iSelectIndex) {
|
|
1726
|
+
var oObject = aRowContexts[iSelectIndex].getObject();
|
|
1727
|
+
if (oObject._dt && oObject._dt._editable !== false) {
|
|
1728
|
+
var sPath = aRowContexts[iSelectIndex].getPath();
|
|
1729
|
+
var iRealIndex = sPath.substring(sPath.lastIndexOf("/") + 1);
|
|
1730
|
+
aSelectedIndexs.push(iRealIndex);
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
if (aSelectedIndexs.length === 0) {
|
|
1734
|
+
MessageBox.error(oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE_ERROR_MSG"));
|
|
1735
|
+
return;
|
|
1131
1736
|
}
|
|
1737
|
+
MessageBox.confirm(oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE_CONFIRM_MSG"), {
|
|
1738
|
+
title: oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE_CONFIRM_TITLE"),
|
|
1739
|
+
onClose: function(sAction) {
|
|
1740
|
+
if (sAction === MessageBox.Action.OK) {
|
|
1741
|
+
var sPath = oTable.getBindingContext().getPath();
|
|
1742
|
+
var oModel = oTable.getModel();
|
|
1743
|
+
var oData = oModel.getProperty(sPath);
|
|
1744
|
+
var oNewData = [];
|
|
1745
|
+
for (var i = 0; i < oData.length; i++) {
|
|
1746
|
+
if (includes(aSelectedIndexs, i + "")) {
|
|
1747
|
+
that.deleteTranslationValueInTexts(undefined, oData[i]._dt._uuid);
|
|
1748
|
+
} else {
|
|
1749
|
+
oNewData.push(oData[i]);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
oModel.setProperty(sPath, oNewData);
|
|
1753
|
+
oModel.checkUpdate(true);
|
|
1754
|
+
that.refreshValue();
|
|
1755
|
+
that.updateTable();
|
|
1756
|
+
} else {
|
|
1757
|
+
MessageToast.show(oResourceBundle.getText("EDITOR_FIELD_OBJECT_DELETE_CONFIRM_CANCLE"));
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
});
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1763
|
+
ObjectField.prototype.refreshValue = function () {
|
|
1764
|
+
var that = this;
|
|
1765
|
+
var oTable = that.getAggregation("_field");
|
|
1766
|
+
var oModel = oTable.getModel();
|
|
1767
|
+
var sPath = oTable.getBinding("rows").getPath();
|
|
1768
|
+
var oData = oModel.getProperty(sPath);
|
|
1769
|
+
var oValue;
|
|
1770
|
+
for (var i = 0; i < oData.length; i++) {
|
|
1771
|
+
var oItem = oData[i];
|
|
1772
|
+
if (oItem._dt._selected) {
|
|
1773
|
+
oValue = deepClone(oItem);
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
that.setValue(oValue);
|
|
1132
1778
|
};
|
|
1133
1779
|
|
|
1134
1780
|
ObjectField.prototype.clearAllFilters = function(oEvent) {
|
|
@@ -1145,93 +1791,144 @@ sap.ui.define([
|
|
|
1145
1791
|
}
|
|
1146
1792
|
};
|
|
1147
1793
|
|
|
1148
|
-
ObjectField.prototype.
|
|
1794
|
+
ObjectField.prototype.setValue = function(oValue) {
|
|
1149
1795
|
var that = this;
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1796
|
+
that.cleanDT(oValue);
|
|
1797
|
+
that._setCurrentProperty("value", oValue);
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
ObjectField.prototype.cleanDT = function(oValue) {
|
|
1801
|
+
if (oValue && oValue._dt && oValue._dt._selected) {
|
|
1802
|
+
delete oValue._dt._selected;
|
|
1803
|
+
}
|
|
1804
|
+
if (oValue && oValue._dt && deepEqual(oValue._dt, {})) {
|
|
1805
|
+
delete oValue._dt;
|
|
1153
1806
|
}
|
|
1154
|
-
return false;
|
|
1155
1807
|
};
|
|
1156
1808
|
|
|
1157
|
-
//
|
|
1158
|
-
ObjectField.prototype.
|
|
1809
|
+
// get the translation text
|
|
1810
|
+
ObjectField.prototype.getTranslationValueInTexts = function (sLanguage, sUUID, sProperty) {
|
|
1159
1811
|
var that = this;
|
|
1160
|
-
var
|
|
1161
|
-
var
|
|
1162
|
-
var
|
|
1163
|
-
var
|
|
1164
|
-
var
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1812
|
+
var oConfig = that.getConfiguration();
|
|
1813
|
+
var sTranslationPath = "/texts/" + sLanguage;
|
|
1814
|
+
var oProperty = this._settingsModel.getProperty(sTranslationPath) || {};
|
|
1815
|
+
var oValue = oProperty[oConfig.manifestpath];
|
|
1816
|
+
var sValue;
|
|
1817
|
+
if (oValue && oValue[sUUID]) {
|
|
1818
|
+
sValue = oValue[sUUID][sProperty];
|
|
1819
|
+
}
|
|
1820
|
+
return sValue;
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1823
|
+
// set the config value of the property in designtime
|
|
1824
|
+
ObjectField.prototype.setObjectPropertyConfigValueInDesigntime = function (sUUID, sProperty, sConfigName, vConfigValue) {
|
|
1825
|
+
var that = this;
|
|
1826
|
+
var oConfig = that.getConfiguration();
|
|
1827
|
+
var sDesigntimePath = "/:designtime";
|
|
1828
|
+
var oData = this._settingsModel.getData();
|
|
1829
|
+
if (!oData) {
|
|
1830
|
+
return;
|
|
1831
|
+
}
|
|
1832
|
+
var oDesigntime;
|
|
1833
|
+
if (!oData.hasOwnProperty(":designtime")) {
|
|
1834
|
+
oDesigntime = {};
|
|
1835
|
+
} else {
|
|
1836
|
+
oDesigntime = deepClone(oData[":designtime"], 500);
|
|
1837
|
+
}
|
|
1838
|
+
if (!oDesigntime.hasOwnProperty(oConfig.manifestpath)) {
|
|
1839
|
+
oDesigntime[oConfig.manifestpath] = {};
|
|
1840
|
+
}
|
|
1841
|
+
if (!oDesigntime[oConfig.manifestpath].hasOwnProperty(sUUID)) {
|
|
1842
|
+
oDesigntime[oConfig.manifestpath][sUUID] = {};
|
|
1843
|
+
}
|
|
1844
|
+
if (!oDesigntime[oConfig.manifestpath][sUUID].hasOwnProperty(sProperty)) {
|
|
1845
|
+
oDesigntime[oConfig.manifestpath][sUUID][sProperty] = {};
|
|
1846
|
+
}
|
|
1847
|
+
oDesigntime[oConfig.manifestpath][sUUID][sProperty][sConfigName] = vConfigValue;
|
|
1848
|
+
this._settingsModel.setProperty(sDesigntimePath, oDesigntime);
|
|
1849
|
+
};
|
|
1850
|
+
|
|
1851
|
+
// get the config value of the property in designtime
|
|
1852
|
+
ObjectField.prototype.getObjectPropertyConfigValueInDesigntime = function (sUUID, sProperty, sConfigName) {
|
|
1853
|
+
var that = this;
|
|
1854
|
+
var vConfigValue;
|
|
1855
|
+
var oConfig = that.getConfiguration();
|
|
1856
|
+
var oData = this._settingsModel.getData();
|
|
1857
|
+
if (oData && oData[":designtime"]
|
|
1858
|
+
&& oData[":designtime"][oConfig.manifestpath]
|
|
1859
|
+
&& oData[":designtime"][oConfig.manifestpath][sUUID]
|
|
1860
|
+
&& oData[":designtime"][oConfig.manifestpath][sUUID][sProperty]
|
|
1861
|
+
&& oData[":designtime"][oConfig.manifestpath][sUUID][sProperty].hasOwnProperty(sConfigName)) {
|
|
1862
|
+
vConfigValue = oData[":designtime"][oConfig.manifestpath][sUUID][sProperty][sConfigName];
|
|
1863
|
+
}
|
|
1864
|
+
return vConfigValue;
|
|
1865
|
+
};
|
|
1866
|
+
|
|
1867
|
+
// set the translation text
|
|
1868
|
+
ObjectField.prototype.setTranslationValueInTexts = function (sLanguage, sUUID, sProperty, sValue) {
|
|
1869
|
+
var that = this;
|
|
1870
|
+
var oConfig = that.getConfiguration();
|
|
1871
|
+
var sTranslationPath = "/texts";
|
|
1872
|
+
var oData = this._settingsModel.getData();
|
|
1873
|
+
if (!oData) {
|
|
1874
|
+
return;
|
|
1875
|
+
}
|
|
1876
|
+
var oTexts;
|
|
1877
|
+
if (!oData.hasOwnProperty("texts")) {
|
|
1878
|
+
oTexts = {};
|
|
1879
|
+
} else {
|
|
1880
|
+
oTexts = deepClone(oData.texts, 500);
|
|
1881
|
+
}
|
|
1882
|
+
if (!oTexts.hasOwnProperty(sLanguage)) {
|
|
1883
|
+
oTexts[sLanguage] = {};
|
|
1884
|
+
}
|
|
1885
|
+
if (!oTexts[sLanguage].hasOwnProperty(oConfig.manifestpath)) {
|
|
1886
|
+
oTexts[sLanguage][oConfig.manifestpath] = {};
|
|
1887
|
+
}
|
|
1888
|
+
if (!oTexts[sLanguage][oConfig.manifestpath].hasOwnProperty(sUUID)) {
|
|
1889
|
+
oTexts[sLanguage][oConfig.manifestpath][sUUID] = {};
|
|
1890
|
+
}
|
|
1891
|
+
oTexts[sLanguage][oConfig.manifestpath][sUUID][sProperty] = sValue;
|
|
1892
|
+
this._settingsModel.setProperty(sTranslationPath, oTexts);
|
|
1893
|
+
};
|
|
1894
|
+
|
|
1895
|
+
// delete the translation text
|
|
1896
|
+
ObjectField.prototype.deleteTranslationValueInTexts = function (sLanguage, sUUID, sProperty) {
|
|
1897
|
+
var that = this;
|
|
1898
|
+
var oData = that._settingsModel.getData();
|
|
1899
|
+
if (!oData || !oData.texts || !sUUID) {
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
var oConfig = that.getConfiguration();
|
|
1903
|
+
var sTranslationPath = "/texts";
|
|
1904
|
+
var oTexts = deepClone(oData.texts, 500);
|
|
1905
|
+
if (sLanguage) {
|
|
1906
|
+
if (oTexts[sLanguage]
|
|
1907
|
+
&& oTexts[sLanguage][oConfig.manifestpath]
|
|
1908
|
+
&& oTexts[sLanguage][oConfig.manifestpath][sUUID]) {
|
|
1909
|
+
if (sProperty) {
|
|
1910
|
+
if (oTexts[sLanguage][oConfig.manifestpath][sUUID].hasOwnProperty(sProperty)) {
|
|
1911
|
+
delete oTexts[sLanguage][oConfig.manifestpath][sUUID][sProperty];
|
|
1912
|
+
if (deepEqual(oTexts[sLanguage][oConfig.manifestpath][sUUID], {})) {
|
|
1913
|
+
delete oTexts[sLanguage][oConfig.manifestpath][sUUID];
|
|
1914
|
+
}
|
|
1915
|
+
this._settingsModel.setProperty(sTranslationPath, oTexts);
|
|
1187
1916
|
}
|
|
1188
|
-
oControl.setSelectedIndex(iSelectedIndex);
|
|
1189
|
-
}
|
|
1190
|
-
break;
|
|
1191
|
-
case "delete":
|
|
1192
|
-
if (iSelectedIndex === iRowIndex) {
|
|
1193
|
-
that._setCurrentProperty("value", undefined);
|
|
1194
|
-
} else if (iSelectedIndex > iRowIndex) {
|
|
1195
|
-
oControl.setSelectedIndex(iSelectedIndex - 1);
|
|
1196
1917
|
} else {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
if (iRealIndexOfFilteredOut > oParameter.realIndex) {
|
|
1203
|
-
iRealIndexOfFilteredOut--;
|
|
1204
|
-
oControl._sPathOfFilteredOut = sPath + "/" + iRealIndexOfFilteredOut;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
break;
|
|
1208
|
-
case "filter":
|
|
1209
|
-
var oColumn = oParameter.column;
|
|
1210
|
-
if (iSelectedIndex > -1) {
|
|
1211
|
-
oControl._sPathOfFilteredOut = aRowContexts && aRowContexts[iSelectedIndex].getPath();
|
|
1212
|
-
}
|
|
1213
|
-
if (oColumn._applySelection !== false && oControl._sPathOfFilteredOut) {
|
|
1214
|
-
oControl.attachEventOnce("rowsUpdated", function() {
|
|
1215
|
-
var aFilteredRowContexts = oControl.getBinding("rows").getContexts() || [];
|
|
1216
|
-
var sNewIndex = -1;
|
|
1217
|
-
if (aFilteredRowContexts.length > 0 && oControl._sPathOfFilteredOut) {
|
|
1218
|
-
for (var i = 0; i < aFilteredRowContexts.length; i++) {
|
|
1219
|
-
var oContext = aFilteredRowContexts[i];
|
|
1220
|
-
if (oContext.getPath() === oControl._sPathOfFilteredOut) {
|
|
1221
|
-
sNewIndex = i;
|
|
1222
|
-
oControl._sPathOfFilteredOut = undefined;
|
|
1223
|
-
break;
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
if (sNewIndex > -1) {
|
|
1228
|
-
oControl.setSelectedIndex(sNewIndex);
|
|
1918
|
+
delete oTexts[sLanguage][oConfig.manifestpath][sUUID];
|
|
1919
|
+
if (deepEqual(oTexts[sLanguage][oConfig.manifestpath], {})) {
|
|
1920
|
+
delete oTexts[sLanguage][oConfig.manifestpath];
|
|
1921
|
+
if (deepEqual(oTexts[sLanguage], {})) {
|
|
1922
|
+
delete oTexts[sLanguage];
|
|
1229
1923
|
}
|
|
1230
|
-
}
|
|
1924
|
+
}
|
|
1925
|
+
this._settingsModel.setProperty(sTranslationPath, oTexts);
|
|
1231
1926
|
}
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1927
|
+
}
|
|
1928
|
+
} else {
|
|
1929
|
+
for (var n in oTexts) {
|
|
1930
|
+
that.deleteTranslationValueInTexts(n, sUUID, sProperty);
|
|
1931
|
+
}
|
|
1235
1932
|
}
|
|
1236
1933
|
};
|
|
1237
1934
|
|