@sapui5/sap.rules.ui 1.107.0 → 1.108.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.
Files changed (70) hide show
  1. package/package.json +1 -1
  2. package/src/sap/rules/ui/.library +1 -1
  3. package/src/sap/rules/ui/AstExpressionBasic.js +27 -6
  4. package/src/sap/rules/ui/AstExpressionBasicRenderer.js +71 -55
  5. package/src/sap/rules/ui/AutoCompleteSuggestionContent.js +5 -3
  6. package/src/sap/rules/ui/AutoCompleteSuggestionContentRenderer.js +39 -40
  7. package/src/sap/rules/ui/BindingSpy.js +1 -1
  8. package/src/sap/rules/ui/DecisionTable.js +2157 -2154
  9. package/src/sap/rules/ui/DecisionTableCell.js +7 -4
  10. package/src/sap/rules/ui/DecisionTableCellAstExpressionBasic.js +7 -4
  11. package/src/sap/rules/ui/DecisionTableCellAstExpressionBasicRenderer.js +5 -3
  12. package/src/sap/rules/ui/DecisionTableCellExpressionAdvanced.js +238 -236
  13. package/src/sap/rules/ui/DecisionTableCellExpressionAdvancedRenderer.js +6 -4
  14. package/src/sap/rules/ui/DecisionTableCellExpressionBasic.js +29 -22
  15. package/src/sap/rules/ui/DecisionTableCellExpressionBasicRenderer.js +6 -4
  16. package/src/sap/rules/ui/DecisionTableCellRenderer.js +10 -10
  17. package/src/sap/rules/ui/DecisionTableConfiguration.js +1 -1
  18. package/src/sap/rules/ui/DecisionTableRenderer.js +163 -161
  19. package/src/sap/rules/ui/DecisionTableSettings.js +6 -4
  20. package/src/sap/rules/ui/DecisionTableSettingsOld.js +963 -961
  21. package/src/sap/rules/ui/DecisionTableSettingsOldRenderer.js +9 -10
  22. package/src/sap/rules/ui/DecisionTableSettingsRenderer.js +9 -10
  23. package/src/sap/rules/ui/ExpressionAdvanced.js +1726 -1724
  24. package/src/sap/rules/ui/ExpressionAdvancedRenderer.js +8 -8
  25. package/src/sap/rules/ui/ExpressionBase.js +1 -1
  26. package/src/sap/rules/ui/ExpressionBasic.js +7 -4
  27. package/src/sap/rules/ui/ExpressionBasicRenderer.js +8 -7
  28. package/src/sap/rules/ui/InstructionRenderer.js +73 -33
  29. package/src/sap/rules/ui/RuleBase.js +1 -1
  30. package/src/sap/rules/ui/RuleBuilder.js +433 -430
  31. package/src/sap/rules/ui/RuleBuilderRenderer.js +8 -9
  32. package/src/sap/rules/ui/TextRule.js +7 -4
  33. package/src/sap/rules/ui/TextRuleConfiguration.js +1 -1
  34. package/src/sap/rules/ui/TextRuleRenderer.js +45 -44
  35. package/src/sap/rules/ui/TextRuleSettings.js +6 -4
  36. package/src/sap/rules/ui/TextRuleSettingsRenderer.js +9 -9
  37. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionAdvancedFunctionPanel.js +4 -3
  38. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionAdvancedFunctionPanelRenderer.js +10 -11
  39. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionAggregateFunctionPanel.js +100 -98
  40. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionAggregateFunctionPanelRenderer.js +9 -10
  41. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionArrayOperatorPanel.js +4 -3
  42. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionArrayOperatorPanelRenderer.js +10 -10
  43. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionComparisionOperatorPanel.js +109 -107
  44. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionComparisionOperatorPanelRenderer.js +39 -40
  45. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionDateAndTimePanel.js +5 -3
  46. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionDateAndTimePanelRenderer.js +10 -10
  47. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionFixedValuePanel.js +840 -838
  48. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionFixedValuePanelRenderer.js +40 -40
  49. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionFunctionalOperatorPanel.js +4 -3
  50. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionFunctionalOperatorPanelRenderer.js +10 -11
  51. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionLogicalOperatorPanel.js +112 -110
  52. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionLogicalOperatorPanelRenderer.js +39 -40
  53. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionLoopFunctionPanel.js +100 -98
  54. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionLoopFunctionPanelRenderer.js +9 -10
  55. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionMathematicalOperatorPanel.js +122 -119
  56. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionMathematicalOperatorPanelRenderer.js +39 -40
  57. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionMiscellaneousOperatorPanel.js +5 -2
  58. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionMiscellaneousOperatorPanelRenderer.js +10 -11
  59. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionOperationsPanel.js +4 -3
  60. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionOperationsPanelRenderer.js +10 -11
  61. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionRangeOperatorPanel.js +4 -3
  62. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionRangeOperatorPanelRenderer.js +10 -11
  63. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionSelectFunctionPanel.js +108 -106
  64. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionSelectFunctionPanelRenderer.js +40 -40
  65. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionTimeAndDurationFunctionPanel.js +254 -252
  66. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionTimeAndDurationFunctionPanelRenderer.js +40 -40
  67. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionVocabularyPanel.js +631 -629
  68. package/src/sap/rules/ui/ast/autoCompleteContent/AutoSuggestionVocabularyPanelRenderer.js +40 -40
  69. package/src/sap/rules/ui/library.js +31 -10
  70. package/src/sap/rules/ui/type/ExpressionAbs.js +1 -1
@@ -1,629 +1,631 @@
1
- sap.ui.define([
2
- "sap/ui/thirdparty/jquery",
3
- "../../library",
4
- "sap/ui/core/Control",
5
- "sap/m/List",
6
- "sap/ui/model/json/JSONModel",
7
- "sap/m/ListMode",
8
- "sap/ui/core/CustomData",
9
- "sap/ui/model/Sorter",
10
- "sap/rules/ui/parser/infrastructure/util/utilsBase"
11
- ], function (jQuery, library, Control, List, JSONModel, ListMode, CustomData, Sorter, infraUtils) {
12
- "use strict";
13
-
14
- var autoSuggestionVocabularyPanel = Control.extend("sap.rules.ui.ast.autoCompleteContent.AutoSuggestionVocabularyPanel", {
15
- metadata: {
16
- library: "sap.rules.ui",
17
- properties: {
18
- reference: {
19
- type: "object",
20
- defaultValue: null,
21
- },
22
- dialogOpenedCallbackReference: {
23
- type: "object",
24
- defaultValue: null,
25
- },
26
- data: {
27
- type: "object",
28
- defaultValue: null
29
- },
30
- context: {
31
- type: "string",
32
- defaultValue: ""
33
- },
34
- },
35
- aggregations: {
36
- PanelLayout: {
37
- type: "sap.m.Panel",
38
- multiple: false
39
- }
40
- },
41
- events: {}
42
- },
43
-
44
- init: function () {
45
- this.oBundle = sap.ui.getCore().getLibraryResourceBundle("sap.rules.ui.i18n");
46
- this.infraUtils = new sap.rules.ui.parser.infrastructure.util.utilsBase.utilsBaseLib();
47
- this.needCreateLayout = true;
48
- this.AttributeSegmentSelected = true;
49
- this.dataObjectName = "";
50
- },
51
- onBeforeRendering: function () {
52
- this._reference = this.getReference();
53
- this._dialogOpenedCallbackReference = this.getDialogOpenedCallbackReference();
54
- if (this.needCreateLayout) {
55
- var layout = this._createLayout();
56
- this.setAggregation("PanelLayout", layout, true);
57
- this.needCreateLayout = false;
58
- }
59
- },
60
-
61
- initializeVariables: function () {
62
-
63
- },
64
-
65
- _createAggregateFunctionSection: function () {
66
- var AggregateFunctionsPanel = new sap.m.Panel({
67
- expandable: false,
68
- expanded: true,
69
- width: "auto",
70
- content: [new sap.m.Link({
71
- wrapping: true,
72
- text: this.oBundle.getText("aggregateFunctionPanelTitle"),
73
- press: function (oEvent) {
74
- var functionAndOfLayout = new sap.ui.layout.HorizontalLayout({
75
- content: [
76
- new sap.m.Label({
77
- text: this.oBundle.getText("function") + ": "
78
- }),
79
- new sap.m.Select({
80
- width: "200px",
81
- height: "60px"
82
- }),
83
- new sap.m.Label({
84
- text: " " + this.oBundle.getText("oflabel") + " "
85
- }),
86
- new sap.m.TextArea({
87
- value: "",
88
- showExceededText: true,
89
- width: "150%",
90
- height: "65px"
91
- })
92
- ]
93
- });
94
-
95
- var whereLayout = new sap.ui.layout.HorizontalLayout({
96
- content: [
97
- new sap.m.Label({
98
- text: this.oBundle.getText("where_label") + ":"
99
- }),
100
- new sap.m.TextArea({
101
- value: "",
102
- showExceededText: true,
103
- width: "300px"
104
- })
105
- ]
106
- });
107
-
108
- var GroupByLayout = new sap.ui.layout.HorizontalLayout({
109
- content: [
110
- new sap.m.Label({
111
- text: this.oBundle.getText("group_by") + ": "
112
- }),
113
- new sap.m.TextArea({
114
- value: "",
115
- showExceededText: true,
116
- width: "300px"
117
- })
118
- ]
119
- });
120
-
121
- var FunctionLabelLayout = new sap.ui.layout.HorizontalLayout({
122
- content: [
123
- new sap.m.Label({
124
- text: this.oBundle.getText("function_label") + ":",
125
- }),
126
- new sap.m.TextArea({
127
- value: "",
128
- enabled: false,
129
- width: "300px"
130
- })
131
- ]
132
- });
133
-
134
- var verticalLayoutForAggregateFunction = new sap.ui.layout.VerticalLayout({
135
- content: [functionAndOfLayout, whereLayout, GroupByLayout, FunctionLabelLayout]
136
- });
137
- var that = this;
138
- var aggregateFunctionsDialog = new sap.m.Dialog({
139
- title: this.oBundle.getText("configure_aggr_title"),
140
- contentWidth: "800px",
141
- contentHeight: "500px",
142
- showHeader: true,
143
- content: [verticalLayoutForAggregateFunction],
144
- afterClose: function () {
145
- that._dialogOpenedCallbackReference(false);
146
- },
147
- buttons: [
148
- new sap.m.Button({
149
- text: this.oBundle.getText("applyChangesBtn"),
150
- tooltip: this.oBundle.getText("applyChangesBtn"),
151
- press: function (event) {
152
- aggregateFunctionsDialog.close();
153
- }
154
- }),
155
- new sap.m.Button({
156
- text: this.oBundle.getText("cancelBtn"),
157
- tooltip: this.oBundle.getText("cancelBtn"),
158
- press: function (event) {
159
- aggregateFunctionsDialog.close();
160
- }
161
- })
162
- ]
163
- });
164
-
165
- aggregateFunctionsDialog.open();
166
- }
167
- })]
168
- })
169
-
170
- var AggregateFunctionsItem = new sap.m.CustomListItem({
171
- content: AggregateFunctionsPanel
172
- })
173
- return AggregateFunctionsItem;
174
- },
175
-
176
- _createLayout: function () {
177
- var that = this;
178
- this.VocabularyTerms = this.getData();
179
- // create a Model with this data
180
- var model = new sap.ui.model.json.JSONModel();
181
-
182
- /*Setting growing shows the growing trigger button with text as 2/14 which we do not need
183
- Hence, setting to top 5 and the rest will be shown in More link */
184
- var topFiveVocabularyData = [];
185
- for (var termCount = 0; termCount < 5 && termCount < this.VocabularyTerms.length; termCount++) {
186
- topFiveVocabularyData.push(this.VocabularyTerms[termCount]);
187
- }
188
- model.setData(topFiveVocabularyData);
189
-
190
- // create a list
191
- this.vocabularylist = new sap.m.List({
192
- growingScrollToLoad: true,
193
- enableBusyIndicator: true
194
- });
195
-
196
- //for every item, add relevant icon and description and add item to the list
197
- // bind the List items to the data collection
198
- this.vocabularylist.bindItems({
199
- path: "/",
200
- sorter: new sap.ui.model.Sorter("label"),
201
- rememberSelections: false,
202
- mode: ListMode.SingleSelectMaster,
203
- template: new sap.m.DisplayListItem({
204
- label: "{label}",
205
- type: "Active",
206
- press: function (oEvent) {
207
- that._setModal(false);
208
- that._reference(oEvent);
209
- }
210
- })
211
- });
212
-
213
- // set the model to the List, so it knows which data to use
214
- this.vocabularylist.setModel(model);
215
- var moreVocabularyLink = this.getMoreVocabulariesLink();
216
-
217
- // add list to the panel
218
- var vocabularyListPanel = new sap.m.Panel({
219
- headerText: this.oBundle.getText("vocabularyPanelTitle"),
220
- expandable: true,
221
- expanded: true,
222
- // expand: this.onExpand,
223
- content: this.vocabularylist,
224
- width: "auto"
225
- });
226
- if (this.VocabularyTerms.length >= 5){
227
- vocabularyListPanel.addContent(moreVocabularyLink);
228
- }
229
-
230
- return vocabularyListPanel;
231
- },
232
-
233
- _setModal: function (value) {
234
- var pop = sap.ui.getCore().byId("popover");
235
- if (pop) {
236
- pop.setModal(value);
237
- }
238
- },
239
-
240
- getMoreVocabulariesLink: function () {
241
- var that = this;
242
- var moreVocabularyLink = new sap.m.Link({
243
- text: this.oBundle.getText("more_link"),
244
- tooltip: this.oBundle.getText("more_link_tooltip"),
245
- enabled: true,
246
- press: function (oEvent) {
247
- that._setModal(true);
248
- that._dialogOpenedCallbackReference(true);
249
- var bDoAndAttrsPresent = that.isDoAndAttrsPresent(that.VocabularyTerms);
250
- if (bDoAndAttrsPresent || that.VocabularyTerms[0].isParentEntity) {
251
- that.getDataObjectsDialog();
252
- } else {
253
- that.getAttributesDialog(that.dataObjectName);
254
- }
255
- }
256
- });
257
- return moreVocabularyLink;
258
-
259
- },
260
-
261
- isDoAndAttrsPresent : function(aTerms){
262
- if(aTerms){
263
- var doPresent = false;
264
- var attrPresent = false;
265
- for(var index = 0 ; index < aTerms.length ; index++){
266
- if(aTerms[index].isParentEntity && aTerms[index].type !== "AO" && aTerms[index].type !== "R"){
267
- doPresent = true;
268
- }else{
269
- attrPresent = true;
270
- }
271
- }
272
- return doPresent && attrPresent;
273
- }
274
- return false;
275
- },
276
-
277
- getDataObjectsDialog: function () {
278
- var that = this;
279
- var searchFieldText = this.oBundle.getText("searchTextVocabulary");
280
- var searchField = this.getSearchField(searchFieldText);
281
- this.detailedVocabularyList = this.initializeVocabularyList(this.VocabularyTerms);
282
- this.bindFilteredTermsToList(this.detailedVocabularyList, "DataObjects", "", false);
283
- var verticalLayoutForVocabularyFunction = new sap.ui.layout.VerticalLayout({
284
- content: [searchField, that.detailedVocabularyList]
285
- }).addStyleClass("sapAstVocabularyPanel");
286
-
287
- this.dataObjectsDialog = new sap.m.Dialog({
288
- title: this.oBundle.getText("selectVocabularyTitle"),
289
- contentWidth: "500px",
290
- contentHeight: "500px",
291
- showHeader: true,
292
- content: [verticalLayoutForVocabularyFunction],
293
- afterClose: function () {
294
- that._dialogOpenedCallbackReference(false);
295
- },
296
- buttons: [
297
- new sap.m.Button({
298
- text: this.oBundle.getText("cancelBtn"),
299
- tooltip: this.oBundle.getText("cancelBtn"),
300
- press: function (event) {
301
- that._setModal(false);
302
- that.dataObjectsDialog.close();
303
- }
304
- })
305
- ]
306
- });
307
- that.dataObjectsDialog.open();
308
-
309
- },
310
-
311
- getAttributesDialog: function (dataObjectName) {
312
- var that = this;
313
- var segmentedButton = this.getAttributesSegmentedButtons();
314
- //deafault
315
- var searchFieldText = this.oBundle.getText("searchTextAttr");
316
- if (this.AttributeSegmentSelected) {
317
- searchFieldText = this.oBundle.getText("searchTextAttr");
318
- }
319
- if (this.AssociationSegmentSelected) {
320
- searchFieldText = this.oBundle.getText("searchTextAssoc");
321
- }
322
- var searchField = this.getSearchField(searchFieldText);
323
- this.detailedVocabularyList = this.initializeVocabularyList(this.VocabularyTerms);
324
- this.bindFilteredAttributesAndAssociationsToList(this.detailedVocabularyList, "Attributes", "E", false);
325
-
326
- var verticalLayoutForAttributesFunction = new sap.ui.layout.VerticalLayout({
327
- content: [segmentedButton, searchField, that.detailedVocabularyList]
328
- }).addStyleClass("sapAstVocabularyPanel");
329
- that.attributesDialog = new sap.m.Dialog({
330
- title: this.oBundle.getText("selectAttrAssocTitle"),
331
- contentWidth: "500px",
332
- contentHeight: "500px",
333
- showHeader: true,
334
- content: [verticalLayoutForAttributesFunction],
335
- afterClose: function () {
336
- that._dialogOpenedCallbackReference(false);
337
- },
338
- buttons: [
339
- new sap.m.Button({
340
- text: this.oBundle.getText("cancelBtn"),
341
- tooltip: this.oBundle.getText("cancelBtn"),
342
- press: function (event) {
343
- that._setModal(false);
344
- that.attributesDialog.close();
345
- }
346
- })
347
- ]
348
- });
349
-
350
- that.attributesDialog.open();
351
-
352
- },
353
-
354
- getAttributesSegmentedButtons: function () {
355
- var that = this;
356
- var SegmentedButton = new sap.m.SegmentedButton({
357
- items: [new sap.m.SegmentedButtonItem({
358
- text: this.oBundle.getText("attributes"),
359
- width: "230px",
360
- press: function () {
361
- that._setModal(false);
362
- that.AttributeSegmentSelected = true;
363
- that.AssociationSegmentSelected = false;
364
- that.searchField.setValue("")
365
- that.searchField.setPlaceholder(that.oBundle.getText("searchTextAttr"));
366
- that.bindFilteredAttributesAndAssociationsToList(that.detailedVocabularyList, "Attributes", "E", false);
367
- }
368
- }),
369
- new sap.m.SegmentedButtonItem({
370
- text: this.oBundle.getText("associations"),
371
- width: "230px",
372
- press: function () {
373
- that._setModal(false);
374
- that.AttributeSegmentSelected = false;
375
- that.AssociationSegmentSelected = true;
376
- that.searchField.setValue("")
377
- that.searchField.setPlaceholder(that.oBundle.getText("searchTextAssoc"));
378
- that.bindFilteredAttributesAndAssociationsToList(that.detailedVocabularyList, "Association", "AO", false);
379
- }
380
- })
381
- ]
382
- });
383
- return SegmentedButton;
384
- },
385
-
386
- bindFilteredTermsToList: function (oList, objectPath, searchText, requireSearch) {
387
- var model = new sap.ui.model.json.JSONModel(this.VocabularyTerms);
388
- for (var entry in model.oData) {
389
- if (model.oData[entry].type === "T") {
390
- model.oData[entry].displayType = "Table";
391
- } else if (model.oData[entry].type === "S") {
392
- model.oData[entry].displayType = "Structure";
393
- } else if (model.oData[entry].type === "E") {
394
- if(model.oData[entry].isParentEntity){
395
- model.oData[entry].displayType = "Element";
396
- }else{
397
- var displayType = "Attribute";
398
- model.oData[entry].displayType = model.oData[entry].bussinessDataType ? displayType +
399
- " (" + model.oData[entry].bussinessDataType +")" : displayType;
400
- }
401
- } else if (model.oData[entry].type === "AO") {
402
- model.oData[entry].displayType = "Association";
403
- } else if (model.oData[entry].ResultDataObjectId && !model.oData[entry].type) {
404
- model.oData[entry].displayType = "Rule";
405
- } else {
406
- model.oData[entry].displayType = model.oData[entry].type;
407
- }
408
- }
409
- var that = this;
410
- var datapath = "/";
411
- if (!oList) {
412
- oList = new sap.m.List({});
413
- }
414
- oList.setModel(model);
415
- oList.bindItems({
416
- path: datapath,
417
- sorter: new sap.ui.model.Sorter("type"),
418
- template: new sap.m.DisplayListItem({
419
- label: "{label}",
420
- value: "{displayType}",
421
- type: "Active",
422
- customData: [new CustomData({
423
- Type: "sap.ui.core.CustomData",
424
- key: "id",
425
- value: "{id}"
426
- })],
427
- press: function (oEvent) {
428
- that._setModal(false);
429
- if (that.dataObjectsDialog.isOpen()) {
430
- that.dataObjectsDialog.close();
431
- } else {
432
- that.attributesDialog.close()
433
- }
434
- that._reference(oEvent);
435
- }
436
- }),
437
- rememberSelections: false,
438
- mode: ListMode.SingleSelectMaster
439
- });
440
- if (requireSearch) {
441
- var filterArray = [];
442
- var filterProperty = "label";
443
- filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
444
- oList.getBinding("items").filter(filterArray);
445
- oList.getModel().refresh(true);
446
- }
447
- },
448
-
449
- bindFilteredAttributesAndAssociationsToList: function (oList, objectPath, searchText, requireSearch) {
450
- var model = new sap.ui.model.json.JSONModel(this.VocabularyTerms);
451
- var that = this;
452
- var datapath = "/";
453
- if (!oList) {
454
- oList = new sap.m.List({});
455
- }
456
- if(model && model.oData){
457
- for (var entry in model.oData) {
458
- if (model.oData[entry].type === "E") {
459
- var displayType = "Attribute";
460
- model.oData[entry].displayType = model.oData[entry].bussinessDataType ? displayType +
461
- " (" + model.oData[entry].bussinessDataType +")" : displayType;
462
- } else if (model.oData[entry].type === "R") {
463
- var displayType = "Reference";
464
- model.oData[entry].displayType = displayType;
465
- }
466
- }
467
- }
468
- oList.setModel(model);
469
- oList.bindItems({
470
- path: datapath,
471
- sorter: new sap.ui.model.Sorter("label"),
472
- template: new sap.m.DisplayListItem({
473
- label: "{label}",
474
- value: "{displayType}",
475
- type: "Active",
476
- press: function (oEvent) {
477
- that._setModal(false);
478
- that.attributesDialog.close();
479
- that._reference(oEvent);
480
- }
481
- }),
482
- rememberSelections: false,
483
- mode: ListMode.SingleSelectMaster
484
- });
485
-
486
- if (requireSearch) {
487
- if(objectPath === "AO") {
488
- oList.getBinding("items").filter(new sap.ui.model.Filter({
489
- filters: [
490
- this.getSearchFiltersAttributesAssociation(searchText,objectPath)
491
- ],
492
- and: true
493
- }));
494
- } else {
495
- oList.getBinding("items").filter(new sap.ui.model.Filter({
496
- filters: [
497
- this.getSearchFiltersReference(searchText),
498
- this.getSearchFiltersAttributesAssociation(searchText,objectPath)
499
- ],
500
- and: false
501
- }));
502
- }
503
- } else {
504
- var filterArray = [];
505
- var filterProperty = "type";
506
- if (searchText === "E") {
507
- filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
508
- filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, "R"));
509
- } else {
510
- filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
511
- }
512
- oList.getBinding("items").filter(new sap.ui.model.Filter({
513
- filters: filterArray,
514
- and: false
515
- }));
516
- oList.getModel().refresh(true);
517
- }
518
- },
519
-
520
- getSearchFiltersReference: function(searchText) {
521
- return new sap.ui.model.Filter({
522
- filters: [
523
- new sap.ui.model.Filter("type", sap.ui.model.FilterOperator.Contains, "R"),
524
- new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
525
- ],
526
- and: true,
527
- });
528
- },
529
-
530
- getSearchFiltersAttributesAssociation: function(searchText,type) {
531
- return new sap.ui.model.Filter({
532
- filters: [
533
- new sap.ui.model.Filter("type", sap.ui.model.FilterOperator.Contains, type),
534
- new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
535
- ],
536
- and: true,
537
- });
538
- },
539
-
540
- getDataObjectFilter: function () {
541
- if (this.AttributeSegmentSelected) {
542
- return new sap.ui.model.Filter("DataObjectId", sap.ui.model.FilterOperator.Contains, this.dataObjectId)
543
- }
544
- if (this.AssociationSegmentSelected) {
545
- return new sap.ui.model.Filter("SourceDataObjectId", sap.ui.model.FilterOperator.Contains, this.dataObjectId)
546
- }
547
- },
548
-
549
- getSearchFilters: function (searchText) {
550
- return new sap.ui.model.Filter({
551
- filters: [
552
- new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.Contains, searchText),
553
- new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
554
- ],
555
- and: false
556
- });
557
- },
558
-
559
- getSearchField: function (placeHolderText) {
560
- var that = this;
561
- this.searchField = new sap.m.SearchField({
562
- showSearchButton: false,
563
- width: "462px",
564
- placeholder: placeHolderText, //searchType,
565
- liveChange: function (oEvent) {
566
- if (that.dataObjectsDialog) {
567
- that.searchTheValueInDataObjects(oEvent.getParameter("newValue"), searchType);
568
- } else {
569
- // Deafult case when no tab is selected by the user, we search on the first tab which is "Attribute"
570
- var searchType = "Attributes";
571
- if (that.AttributeSegmentSelected) {
572
- searchType = "Attributes";
573
- }
574
- if (that.AssociationSegmentSelected) {
575
- searchType = "Association";
576
- }
577
-
578
- //if Attributes or Association is selected, we will have to search in them
579
- that.searchValueInAttributesAndAssociation(oEvent.getParameter("newValue"), searchType);
580
- }
581
-
582
- }
583
- })
584
- return this.searchField;
585
- },
586
-
587
- searchTheValueInDataObjects: function (searchText, searchType) {
588
- this.bindFilteredTermsToList(this.detailedVocabularyList, searchType, searchText, true);
589
- },
590
-
591
- searchValueInAttributesAndAssociation: function (searchText, searchType) {
592
- if (this.AttributeSegmentSelected) {
593
- searchType = "E";
594
- }
595
- if (this.AssociationSegmentSelected) {
596
- searchType = "AO";
597
- }
598
- this.bindFilteredAttributesAndAssociationsToList(this.detailedVocabularyList, searchType, searchText, true);
599
- },
600
-
601
- initializeVocabularyList: function (vocabularyData) {
602
- var model = new sap.ui.model.json.JSONModel(vocabularyData);
603
- var datapath = "/";
604
- var vocabularylist = new sap.m.List({
605
- headerText: this.oBundle.getText("vocabulary")
606
- });
607
- vocabularylist.setModel(model);
608
- vocabularylist.bindItems({
609
- path: datapath,
610
- sorter: new sap.ui.model.Sorter("label"),
611
- template: new sap.m.DisplayListItem({
612
- label: "{label}",
613
- value: "{type}",
614
- type: "Active",
615
- customData: [new CustomData({
616
- Type: "sap.ui.core.CustomData",
617
- key: "id",
618
- value: "{id}"
619
- })]
620
- })
621
-
622
- });
623
- return vocabularylist;
624
- }
625
-
626
- });
627
-
628
- return autoSuggestionVocabularyPanel;
629
- }, /* bExport= */ true);
1
+ sap.ui.define([
2
+ "sap/ui/thirdparty/jquery",
3
+ "../../library",
4
+ "sap/ui/core/Control",
5
+ "sap/m/List",
6
+ "sap/ui/model/json/JSONModel",
7
+ "sap/m/ListMode",
8
+ "sap/ui/core/CustomData",
9
+ "sap/ui/model/Sorter",
10
+ "sap/rules/ui/parser/infrastructure/util/utilsBase",
11
+ "./AutoSuggestionVocabularyPanelRenderer"
12
+ ], function (jQuery, library, Control, List, JSONModel, ListMode, CustomData, Sorter, infraUtils, AutoSuggestionVocabularyPanelRenderer) {
13
+ "use strict";
14
+
15
+ var autoSuggestionVocabularyPanel = Control.extend("sap.rules.ui.ast.autoCompleteContent.AutoSuggestionVocabularyPanel", {
16
+ metadata: {
17
+ library: "sap.rules.ui",
18
+ properties: {
19
+ reference: {
20
+ type: "object",
21
+ defaultValue: null,
22
+ },
23
+ dialogOpenedCallbackReference: {
24
+ type: "object",
25
+ defaultValue: null,
26
+ },
27
+ data: {
28
+ type: "object",
29
+ defaultValue: null
30
+ },
31
+ context: {
32
+ type: "string",
33
+ defaultValue: ""
34
+ },
35
+ },
36
+ aggregations: {
37
+ PanelLayout: {
38
+ type: "sap.m.Panel",
39
+ multiple: false
40
+ }
41
+ },
42
+ events: {}
43
+ },
44
+
45
+ init: function () {
46
+ this.oBundle = sap.ui.getCore().getLibraryResourceBundle("sap.rules.ui.i18n");
47
+ this.infraUtils = new sap.rules.ui.parser.infrastructure.util.utilsBase.utilsBaseLib();
48
+ this.needCreateLayout = true;
49
+ this.AttributeSegmentSelected = true;
50
+ this.dataObjectName = "";
51
+ },
52
+ onBeforeRendering: function () {
53
+ this._reference = this.getReference();
54
+ this._dialogOpenedCallbackReference = this.getDialogOpenedCallbackReference();
55
+ if (this.needCreateLayout) {
56
+ var layout = this._createLayout();
57
+ this.setAggregation("PanelLayout", layout, true);
58
+ this.needCreateLayout = false;
59
+ }
60
+ },
61
+
62
+ initializeVariables: function () {
63
+
64
+ },
65
+
66
+ _createAggregateFunctionSection: function () {
67
+ var AggregateFunctionsPanel = new sap.m.Panel({
68
+ expandable: false,
69
+ expanded: true,
70
+ width: "auto",
71
+ content: [new sap.m.Link({
72
+ wrapping: true,
73
+ text: this.oBundle.getText("aggregateFunctionPanelTitle"),
74
+ press: function (oEvent) {
75
+ var functionAndOfLayout = new sap.ui.layout.HorizontalLayout({
76
+ content: [
77
+ new sap.m.Label({
78
+ text: this.oBundle.getText("function") + ": "
79
+ }),
80
+ new sap.m.Select({
81
+ width: "200px",
82
+ height: "60px"
83
+ }),
84
+ new sap.m.Label({
85
+ text: " " + this.oBundle.getText("oflabel") + " "
86
+ }),
87
+ new sap.m.TextArea({
88
+ value: "",
89
+ showExceededText: true,
90
+ width: "150%",
91
+ height: "65px"
92
+ })
93
+ ]
94
+ });
95
+
96
+ var whereLayout = new sap.ui.layout.HorizontalLayout({
97
+ content: [
98
+ new sap.m.Label({
99
+ text: this.oBundle.getText("where_label") + ":"
100
+ }),
101
+ new sap.m.TextArea({
102
+ value: "",
103
+ showExceededText: true,
104
+ width: "300px"
105
+ })
106
+ ]
107
+ });
108
+
109
+ var GroupByLayout = new sap.ui.layout.HorizontalLayout({
110
+ content: [
111
+ new sap.m.Label({
112
+ text: this.oBundle.getText("group_by") + ": "
113
+ }),
114
+ new sap.m.TextArea({
115
+ value: "",
116
+ showExceededText: true,
117
+ width: "300px"
118
+ })
119
+ ]
120
+ });
121
+
122
+ var FunctionLabelLayout = new sap.ui.layout.HorizontalLayout({
123
+ content: [
124
+ new sap.m.Label({
125
+ text: this.oBundle.getText("function_label") + ":",
126
+ }),
127
+ new sap.m.TextArea({
128
+ value: "",
129
+ enabled: false,
130
+ width: "300px"
131
+ })
132
+ ]
133
+ });
134
+
135
+ var verticalLayoutForAggregateFunction = new sap.ui.layout.VerticalLayout({
136
+ content: [functionAndOfLayout, whereLayout, GroupByLayout, FunctionLabelLayout]
137
+ });
138
+ var that = this;
139
+ var aggregateFunctionsDialog = new sap.m.Dialog({
140
+ title: this.oBundle.getText("configure_aggr_title"),
141
+ contentWidth: "800px",
142
+ contentHeight: "500px",
143
+ showHeader: true,
144
+ content: [verticalLayoutForAggregateFunction],
145
+ afterClose: function () {
146
+ that._dialogOpenedCallbackReference(false);
147
+ },
148
+ buttons: [
149
+ new sap.m.Button({
150
+ text: this.oBundle.getText("applyChangesBtn"),
151
+ tooltip: this.oBundle.getText("applyChangesBtn"),
152
+ press: function (event) {
153
+ aggregateFunctionsDialog.close();
154
+ }
155
+ }),
156
+ new sap.m.Button({
157
+ text: this.oBundle.getText("cancelBtn"),
158
+ tooltip: this.oBundle.getText("cancelBtn"),
159
+ press: function (event) {
160
+ aggregateFunctionsDialog.close();
161
+ }
162
+ })
163
+ ]
164
+ });
165
+
166
+ aggregateFunctionsDialog.open();
167
+ }
168
+ })]
169
+ })
170
+
171
+ var AggregateFunctionsItem = new sap.m.CustomListItem({
172
+ content: AggregateFunctionsPanel
173
+ })
174
+ return AggregateFunctionsItem;
175
+ },
176
+
177
+ _createLayout: function () {
178
+ var that = this;
179
+ this.VocabularyTerms = this.getData();
180
+ // create a Model with this data
181
+ var model = new sap.ui.model.json.JSONModel();
182
+
183
+ /*Setting growing shows the growing trigger button with text as 2/14 which we do not need
184
+ Hence, setting to top 5 and the rest will be shown in More link */
185
+ var topFiveVocabularyData = [];
186
+ for (var termCount = 0; termCount < 5 && termCount < this.VocabularyTerms.length; termCount++) {
187
+ topFiveVocabularyData.push(this.VocabularyTerms[termCount]);
188
+ }
189
+ model.setData(topFiveVocabularyData);
190
+
191
+ // create a list
192
+ this.vocabularylist = new sap.m.List({
193
+ growingScrollToLoad: true,
194
+ enableBusyIndicator: true
195
+ });
196
+
197
+ //for every item, add relevant icon and description and add item to the list
198
+ // bind the List items to the data collection
199
+ this.vocabularylist.bindItems({
200
+ path: "/",
201
+ sorter: new sap.ui.model.Sorter("label"),
202
+ rememberSelections: false,
203
+ mode: ListMode.SingleSelectMaster,
204
+ template: new sap.m.DisplayListItem({
205
+ label: "{label}",
206
+ type: "Active",
207
+ press: function (oEvent) {
208
+ that._setModal(false);
209
+ that._reference(oEvent);
210
+ }
211
+ })
212
+ });
213
+
214
+ // set the model to the List, so it knows which data to use
215
+ this.vocabularylist.setModel(model);
216
+ var moreVocabularyLink = this.getMoreVocabulariesLink();
217
+
218
+ // add list to the panel
219
+ var vocabularyListPanel = new sap.m.Panel({
220
+ headerText: this.oBundle.getText("vocabularyPanelTitle"),
221
+ expandable: true,
222
+ expanded: true,
223
+ // expand: this.onExpand,
224
+ content: this.vocabularylist,
225
+ width: "auto"
226
+ });
227
+ if (this.VocabularyTerms.length >= 5){
228
+ vocabularyListPanel.addContent(moreVocabularyLink);
229
+ }
230
+
231
+ return vocabularyListPanel;
232
+ },
233
+
234
+ _setModal: function (value) {
235
+ var pop = sap.ui.getCore().byId("popover");
236
+ if (pop) {
237
+ pop.setModal(value);
238
+ }
239
+ },
240
+
241
+ getMoreVocabulariesLink: function () {
242
+ var that = this;
243
+ var moreVocabularyLink = new sap.m.Link({
244
+ text: this.oBundle.getText("more_link"),
245
+ tooltip: this.oBundle.getText("more_link_tooltip"),
246
+ enabled: true,
247
+ press: function (oEvent) {
248
+ that._setModal(true);
249
+ that._dialogOpenedCallbackReference(true);
250
+ var bDoAndAttrsPresent = that.isDoAndAttrsPresent(that.VocabularyTerms);
251
+ if (bDoAndAttrsPresent || that.VocabularyTerms[0].isParentEntity) {
252
+ that.getDataObjectsDialog();
253
+ } else {
254
+ that.getAttributesDialog(that.dataObjectName);
255
+ }
256
+ }
257
+ });
258
+ return moreVocabularyLink;
259
+
260
+ },
261
+
262
+ isDoAndAttrsPresent : function(aTerms){
263
+ if(aTerms){
264
+ var doPresent = false;
265
+ var attrPresent = false;
266
+ for(var index = 0 ; index < aTerms.length ; index++){
267
+ if(aTerms[index].isParentEntity && aTerms[index].type !== "AO" && aTerms[index].type !== "R"){
268
+ doPresent = true;
269
+ }else{
270
+ attrPresent = true;
271
+ }
272
+ }
273
+ return doPresent && attrPresent;
274
+ }
275
+ return false;
276
+ },
277
+
278
+ getDataObjectsDialog: function () {
279
+ var that = this;
280
+ var searchFieldText = this.oBundle.getText("searchTextVocabulary");
281
+ var searchField = this.getSearchField(searchFieldText);
282
+ this.detailedVocabularyList = this.initializeVocabularyList(this.VocabularyTerms);
283
+ this.bindFilteredTermsToList(this.detailedVocabularyList, "DataObjects", "", false);
284
+ var verticalLayoutForVocabularyFunction = new sap.ui.layout.VerticalLayout({
285
+ content: [searchField, that.detailedVocabularyList]
286
+ }).addStyleClass("sapAstVocabularyPanel");
287
+
288
+ this.dataObjectsDialog = new sap.m.Dialog({
289
+ title: this.oBundle.getText("selectVocabularyTitle"),
290
+ contentWidth: "500px",
291
+ contentHeight: "500px",
292
+ showHeader: true,
293
+ content: [verticalLayoutForVocabularyFunction],
294
+ afterClose: function () {
295
+ that._dialogOpenedCallbackReference(false);
296
+ },
297
+ buttons: [
298
+ new sap.m.Button({
299
+ text: this.oBundle.getText("cancelBtn"),
300
+ tooltip: this.oBundle.getText("cancelBtn"),
301
+ press: function (event) {
302
+ that._setModal(false);
303
+ that.dataObjectsDialog.close();
304
+ }
305
+ })
306
+ ]
307
+ });
308
+ that.dataObjectsDialog.open();
309
+
310
+ },
311
+
312
+ getAttributesDialog: function (dataObjectName) {
313
+ var that = this;
314
+ var segmentedButton = this.getAttributesSegmentedButtons();
315
+ //deafault
316
+ var searchFieldText = this.oBundle.getText("searchTextAttr");
317
+ if (this.AttributeSegmentSelected) {
318
+ searchFieldText = this.oBundle.getText("searchTextAttr");
319
+ }
320
+ if (this.AssociationSegmentSelected) {
321
+ searchFieldText = this.oBundle.getText("searchTextAssoc");
322
+ }
323
+ var searchField = this.getSearchField(searchFieldText);
324
+ this.detailedVocabularyList = this.initializeVocabularyList(this.VocabularyTerms);
325
+ this.bindFilteredAttributesAndAssociationsToList(this.detailedVocabularyList, "Attributes", "E", false);
326
+
327
+ var verticalLayoutForAttributesFunction = new sap.ui.layout.VerticalLayout({
328
+ content: [segmentedButton, searchField, that.detailedVocabularyList]
329
+ }).addStyleClass("sapAstVocabularyPanel");
330
+ that.attributesDialog = new sap.m.Dialog({
331
+ title: this.oBundle.getText("selectAttrAssocTitle"),
332
+ contentWidth: "500px",
333
+ contentHeight: "500px",
334
+ showHeader: true,
335
+ content: [verticalLayoutForAttributesFunction],
336
+ afterClose: function () {
337
+ that._dialogOpenedCallbackReference(false);
338
+ },
339
+ buttons: [
340
+ new sap.m.Button({
341
+ text: this.oBundle.getText("cancelBtn"),
342
+ tooltip: this.oBundle.getText("cancelBtn"),
343
+ press: function (event) {
344
+ that._setModal(false);
345
+ that.attributesDialog.close();
346
+ }
347
+ })
348
+ ]
349
+ });
350
+
351
+ that.attributesDialog.open();
352
+
353
+ },
354
+
355
+ getAttributesSegmentedButtons: function () {
356
+ var that = this;
357
+ var SegmentedButton = new sap.m.SegmentedButton({
358
+ items: [new sap.m.SegmentedButtonItem({
359
+ text: this.oBundle.getText("attributes"),
360
+ width: "230px",
361
+ press: function () {
362
+ that._setModal(false);
363
+ that.AttributeSegmentSelected = true;
364
+ that.AssociationSegmentSelected = false;
365
+ that.searchField.setValue("")
366
+ that.searchField.setPlaceholder(that.oBundle.getText("searchTextAttr"));
367
+ that.bindFilteredAttributesAndAssociationsToList(that.detailedVocabularyList, "Attributes", "E", false);
368
+ }
369
+ }),
370
+ new sap.m.SegmentedButtonItem({
371
+ text: this.oBundle.getText("associations"),
372
+ width: "230px",
373
+ press: function () {
374
+ that._setModal(false);
375
+ that.AttributeSegmentSelected = false;
376
+ that.AssociationSegmentSelected = true;
377
+ that.searchField.setValue("")
378
+ that.searchField.setPlaceholder(that.oBundle.getText("searchTextAssoc"));
379
+ that.bindFilteredAttributesAndAssociationsToList(that.detailedVocabularyList, "Association", "AO", false);
380
+ }
381
+ })
382
+ ]
383
+ });
384
+ return SegmentedButton;
385
+ },
386
+
387
+ bindFilteredTermsToList: function (oList, objectPath, searchText, requireSearch) {
388
+ var model = new sap.ui.model.json.JSONModel(this.VocabularyTerms);
389
+ for (var entry in model.oData) {
390
+ if (model.oData[entry].type === "T") {
391
+ model.oData[entry].displayType = "Table";
392
+ } else if (model.oData[entry].type === "S") {
393
+ model.oData[entry].displayType = "Structure";
394
+ } else if (model.oData[entry].type === "E") {
395
+ if(model.oData[entry].isParentEntity){
396
+ model.oData[entry].displayType = "Element";
397
+ }else{
398
+ var displayType = "Attribute";
399
+ model.oData[entry].displayType = model.oData[entry].bussinessDataType ? displayType +
400
+ " (" + model.oData[entry].bussinessDataType +")" : displayType;
401
+ }
402
+ } else if (model.oData[entry].type === "AO") {
403
+ model.oData[entry].displayType = "Association";
404
+ } else if (model.oData[entry].ResultDataObjectId && !model.oData[entry].type) {
405
+ model.oData[entry].displayType = "Rule";
406
+ } else {
407
+ model.oData[entry].displayType = model.oData[entry].type;
408
+ }
409
+ }
410
+ var that = this;
411
+ var datapath = "/";
412
+ if (!oList) {
413
+ oList = new sap.m.List({});
414
+ }
415
+ oList.setModel(model);
416
+ oList.bindItems({
417
+ path: datapath,
418
+ sorter: new sap.ui.model.Sorter("type"),
419
+ template: new sap.m.DisplayListItem({
420
+ label: "{label}",
421
+ value: "{displayType}",
422
+ type: "Active",
423
+ customData: [new CustomData({
424
+ Type: "sap.ui.core.CustomData",
425
+ key: "id",
426
+ value: "{id}"
427
+ })],
428
+ press: function (oEvent) {
429
+ that._setModal(false);
430
+ if (that.dataObjectsDialog.isOpen()) {
431
+ that.dataObjectsDialog.close();
432
+ } else {
433
+ that.attributesDialog.close()
434
+ }
435
+ that._reference(oEvent);
436
+ }
437
+ }),
438
+ rememberSelections: false,
439
+ mode: ListMode.SingleSelectMaster
440
+ });
441
+ if (requireSearch) {
442
+ var filterArray = [];
443
+ var filterProperty = "label";
444
+ filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
445
+ oList.getBinding("items").filter(filterArray);
446
+ oList.getModel().refresh(true);
447
+ }
448
+ },
449
+
450
+ bindFilteredAttributesAndAssociationsToList: function (oList, objectPath, searchText, requireSearch) {
451
+ var model = new sap.ui.model.json.JSONModel(this.VocabularyTerms);
452
+ var that = this;
453
+ var datapath = "/";
454
+ if (!oList) {
455
+ oList = new sap.m.List({});
456
+ }
457
+ if(model && model.oData){
458
+ for (var entry in model.oData) {
459
+ if (model.oData[entry].type === "E") {
460
+ var displayType = "Attribute";
461
+ model.oData[entry].displayType = model.oData[entry].bussinessDataType ? displayType +
462
+ " (" + model.oData[entry].bussinessDataType +")" : displayType;
463
+ } else if (model.oData[entry].type === "R") {
464
+ var displayType = "Reference";
465
+ model.oData[entry].displayType = displayType;
466
+ }
467
+ }
468
+ }
469
+ oList.setModel(model);
470
+ oList.bindItems({
471
+ path: datapath,
472
+ sorter: new sap.ui.model.Sorter("label"),
473
+ template: new sap.m.DisplayListItem({
474
+ label: "{label}",
475
+ value: "{displayType}",
476
+ type: "Active",
477
+ press: function (oEvent) {
478
+ that._setModal(false);
479
+ that.attributesDialog.close();
480
+ that._reference(oEvent);
481
+ }
482
+ }),
483
+ rememberSelections: false,
484
+ mode: ListMode.SingleSelectMaster
485
+ });
486
+
487
+ if (requireSearch) {
488
+ if(objectPath === "AO") {
489
+ oList.getBinding("items").filter(new sap.ui.model.Filter({
490
+ filters: [
491
+ this.getSearchFiltersAttributesAssociation(searchText,objectPath)
492
+ ],
493
+ and: true
494
+ }));
495
+ } else {
496
+ oList.getBinding("items").filter(new sap.ui.model.Filter({
497
+ filters: [
498
+ this.getSearchFiltersReference(searchText),
499
+ this.getSearchFiltersAttributesAssociation(searchText,objectPath)
500
+ ],
501
+ and: false
502
+ }));
503
+ }
504
+ } else {
505
+ var filterArray = [];
506
+ var filterProperty = "type";
507
+ if (searchText === "E") {
508
+ filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
509
+ filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, "R"));
510
+ } else {
511
+ filterArray.push(new sap.ui.model.Filter(filterProperty, sap.ui.model.FilterOperator.Contains, searchText));
512
+ }
513
+ oList.getBinding("items").filter(new sap.ui.model.Filter({
514
+ filters: filterArray,
515
+ and: false
516
+ }));
517
+ oList.getModel().refresh(true);
518
+ }
519
+ },
520
+
521
+ getSearchFiltersReference: function(searchText) {
522
+ return new sap.ui.model.Filter({
523
+ filters: [
524
+ new sap.ui.model.Filter("type", sap.ui.model.FilterOperator.Contains, "R"),
525
+ new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
526
+ ],
527
+ and: true,
528
+ });
529
+ },
530
+
531
+ getSearchFiltersAttributesAssociation: function(searchText,type) {
532
+ return new sap.ui.model.Filter({
533
+ filters: [
534
+ new sap.ui.model.Filter("type", sap.ui.model.FilterOperator.Contains, type),
535
+ new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
536
+ ],
537
+ and: true,
538
+ });
539
+ },
540
+
541
+ getDataObjectFilter: function () {
542
+ if (this.AttributeSegmentSelected) {
543
+ return new sap.ui.model.Filter("DataObjectId", sap.ui.model.FilterOperator.Contains, this.dataObjectId)
544
+ }
545
+ if (this.AssociationSegmentSelected) {
546
+ return new sap.ui.model.Filter("SourceDataObjectId", sap.ui.model.FilterOperator.Contains, this.dataObjectId)
547
+ }
548
+ },
549
+
550
+ getSearchFilters: function (searchText) {
551
+ return new sap.ui.model.Filter({
552
+ filters: [
553
+ new sap.ui.model.Filter("name", sap.ui.model.FilterOperator.Contains, searchText),
554
+ new sap.ui.model.Filter("label", sap.ui.model.FilterOperator.Contains, searchText)
555
+ ],
556
+ and: false
557
+ });
558
+ },
559
+
560
+ getSearchField: function (placeHolderText) {
561
+ var that = this;
562
+ this.searchField = new sap.m.SearchField({
563
+ showSearchButton: false,
564
+ width: "462px",
565
+ placeholder: placeHolderText, //searchType,
566
+ liveChange: function (oEvent) {
567
+ if (that.dataObjectsDialog) {
568
+ that.searchTheValueInDataObjects(oEvent.getParameter("newValue"), searchType);
569
+ } else {
570
+ // Deafult case when no tab is selected by the user, we search on the first tab which is "Attribute"
571
+ var searchType = "Attributes";
572
+ if (that.AttributeSegmentSelected) {
573
+ searchType = "Attributes";
574
+ }
575
+ if (that.AssociationSegmentSelected) {
576
+ searchType = "Association";
577
+ }
578
+
579
+ //if Attributes or Association is selected, we will have to search in them
580
+ that.searchValueInAttributesAndAssociation(oEvent.getParameter("newValue"), searchType);
581
+ }
582
+
583
+ }
584
+ })
585
+ return this.searchField;
586
+ },
587
+
588
+ searchTheValueInDataObjects: function (searchText, searchType) {
589
+ this.bindFilteredTermsToList(this.detailedVocabularyList, searchType, searchText, true);
590
+ },
591
+
592
+ searchValueInAttributesAndAssociation: function (searchText, searchType) {
593
+ if (this.AttributeSegmentSelected) {
594
+ searchType = "E";
595
+ }
596
+ if (this.AssociationSegmentSelected) {
597
+ searchType = "AO";
598
+ }
599
+ this.bindFilteredAttributesAndAssociationsToList(this.detailedVocabularyList, searchType, searchText, true);
600
+ },
601
+
602
+ initializeVocabularyList: function (vocabularyData) {
603
+ var model = new sap.ui.model.json.JSONModel(vocabularyData);
604
+ var datapath = "/";
605
+ var vocabularylist = new sap.m.List({
606
+ headerText: this.oBundle.getText("vocabulary")
607
+ });
608
+ vocabularylist.setModel(model);
609
+ vocabularylist.bindItems({
610
+ path: datapath,
611
+ sorter: new sap.ui.model.Sorter("label"),
612
+ template: new sap.m.DisplayListItem({
613
+ label: "{label}",
614
+ value: "{type}",
615
+ type: "Active",
616
+ customData: [new CustomData({
617
+ Type: "sap.ui.core.CustomData",
618
+ key: "id",
619
+ value: "{id}"
620
+ })]
621
+ })
622
+
623
+ });
624
+ return vocabularylist;
625
+ },
626
+ renderer: AutoSuggestionVocabularyPanelRenderer
627
+
628
+ });
629
+
630
+ return autoSuggestionVocabularyPanel;
631
+ }, /* bExport= */ true);