@sapui5/sap.rules.ui 1.107.0 → 1.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +7 -4
  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
@@ -17,10 +17,11 @@ sap.ui.define([
17
17
  "sap/rules/ui/ast/constants/Constants",
18
18
  "sap/rules/ui/services/AstExpressionLanguage",
19
19
  "sap/rules/ui/ast/util/AstUtil",
20
- "sap/ui/core/LocaleData"
20
+ "sap/ui/core/LocaleData",
21
+ "./DecisionTableCellRenderer"
21
22
  ],
22
23
  function (jQuery, library, DecisionTableCellExpressionAdvanced, DecisionTableCellFormatter, DecisionTableCellExpressionBasic, Popover,
23
- Constants, ConstantUtils, AstExpressionLanguage, AstUtil, LocaleData) {
24
+ Constants, ConstantUtils, AstExpressionLanguage, AstUtil, LocaleData, DecisionTableCellRenderer) {
24
25
  "use strict";
25
26
 
26
27
  /**
@@ -34,7 +35,7 @@ sap.ui.define([
34
35
  * @extends sap.ui.core.Control
35
36
  *
36
37
  * @author SAP SE
37
- * @version 1.107.0
38
+ * @version 1.108.0
38
39
  *
39
40
  * @constructor
40
41
  * @public
@@ -206,7 +207,9 @@ sap.ui.define([
206
207
  singularName: "astExpressionLanguage"
207
208
  }
208
209
  }
209
- }
210
+ },
211
+
212
+ renderer: DecisionTableCellRenderer
210
213
  });
211
214
 
212
215
  DecisionTableCell.prototype._addNodeObject = function (astNode) {
@@ -11,8 +11,9 @@ sap.ui.define([
11
11
  "./library",
12
12
  "sap/rules/ui/Utils",
13
13
  "sap/rules/ui/AstExpressionBasic",
14
- "sap/rules/ui/Constants"
15
- ], function (jQuery, library, Utils, AstExpressionBasic, Constants) {
14
+ "sap/rules/ui/Constants",
15
+ "./DecisionTableCellAstExpressionBasicRenderer"
16
+ ], function (jQuery, library, Utils, AstExpressionBasic, Constants, DecisionTableCellAstExpressionBasicRenderer) {
16
17
  "use strict";
17
18
 
18
19
  /**
@@ -26,7 +27,7 @@ sap.ui.define([
26
27
  * @extends sap.rules.ui.AstExpressionBasic
27
28
  *
28
29
  * @author SAP SE
29
- * @version 1.107.0
30
+ * @version 1.108.0
30
31
  *
31
32
  * @constructor
32
33
  * @private
@@ -60,7 +61,9 @@ sap.ui.define([
60
61
  bindable: "bindable"
61
62
  }
62
63
  }
63
- }
64
+ },
65
+
66
+ renderer: DecisionTableCellAstExpressionBasicRenderer
64
67
  });
65
68
 
66
69
  DecisionTableCellAstExpressionBasic.prototype.validateExpression = function () {
@@ -5,16 +5,18 @@
5
5
 
6
6
  */
7
7
 
8
- sap.ui.define(['jquery.sap.global', 'sap/rules/ui/AstExpressionBasicRenderer'],
8
+ sap.ui.define(['sap/rules/ui/AstExpressionBasicRenderer'],
9
9
 
10
- function (jQuery, sapRulesUiAstExpressionBasicRenderer) {
10
+ function (sapRulesUiAstExpressionBasicRenderer) {
11
11
  "use strict";
12
12
 
13
13
  /**
14
14
  * DecisionTableCellExpressionAdvanced renderer.
15
15
  * @namespace
16
16
  */
17
- var DecisionTableCellAstExpressionBasicRenderer = {};
17
+ var DecisionTableCellAstExpressionBasicRenderer = {
18
+ apiVersion: 2
19
+ };
18
20
  /**
19
21
  * Renders the HTML for the given control, using the provided
20
22
  * {@link sap.ui.core.RenderManager}.
@@ -1,240 +1,242 @@
1
- /*!
1
+ /*!
2
2
  * SAP UI development toolkit for HTML5 (SAPUI5)
3
3
 
4
4
  (c) Copyright 2009-2016 SAP SE. All rights reserved
5
-
6
- */
7
-
8
- // Provides control sap.rules.ui.ExpressionAdvanced.
9
- sap.ui.define([
10
- "jquery.sap.global",
11
- "./library",
12
- "sap/rules/ui/Utils",
13
- "sap/rules/ui/ExpressionAdvanced",
14
- "sap/rules/ui/Constants"
15
- ], function(jQuery, library, Utils, ExpressionAdvanced, Constants) {
16
- "use strict";
17
-
18
- /**
19
- * Constructor for a new DecisionTableCellExpressionAdvanced sap.rules.ui.ExpressionAdvanced.
20
- *
21
- * @param {string} [sId] id for the new control, generated automatically if no id is given
22
- * @param {object} [mSettings] initial settings for the new control
23
- *
24
- * @class
25
- * The <code>sap.rules.ui.DecisionTableCellExpressionAdvanced</code> control provides the ability to define expressions for complex rules in a decision table.
26
- * @extends sap.rules.ui.ExpressionAdvanced
27
- *
28
- * @author SAP SE
29
- * @version 1.107.0
30
- *
31
- * @constructor
32
- * @private
33
- * @alias sap.rules.ui.DecisionTableCellExpressionAdvanced
34
- * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
35
- */
36
- var DecisionTableCellExpressionAdvanced = ExpressionAdvanced.extend("sap.rules.ui.DecisionTableCellExpressionAdvanced", {
37
- metadata: {
38
-
39
- library: "sap.rules.ui",
40
- properties: {
41
- /**
42
- * Defines the header value of the control.
43
- */
44
- headerValue: {
45
- type: "string",
46
- defaultValue: "",
47
- bindable: "bindable"
48
- },
49
- /**
50
- * Defines the fixed operator value of the control.
51
- */
52
- fixedOperator: {
53
- type: "string",
54
- defaultValue: "",
55
- bindable: "bindable"
56
- },
57
- type: {
58
- type: "sap.rules.ui.ExpressionType",
59
- defaultValue: sap.rules.ui.ExpressionType.BooleanEnhanced,
60
- bindable: "bindable"
61
- }
62
- }
63
- }
64
- });
65
-
66
- DecisionTableCellExpressionAdvanced.prototype.validateExpression = function() {
67
- var expressionValue = this.codeMirror ? this.codeMirror.getValue() : this.getValue();
68
- if (expressionValue) {
69
- var sValue = this.getHeaderValue() + " " + this.getFixedOperator() + " " + expressionValue;
70
- sap.rules.ui.ExpressionAdvanced.prototype.validateExpression.apply(this, [sValue]);
71
- } else {
72
- this.setValueStateText("");
73
- }
74
-
75
- };
76
-
77
- DecisionTableCellExpressionAdvanced.prototype.init = function() {
78
- sap.rules.ui.ExpressionAdvanced.prototype.init.apply(this, arguments);
79
- this.bFlagForChangeBeforeBlur = false;
80
- };
81
-
82
- DecisionTableCellExpressionAdvanced.prototype.onAfterRendering = function() {
83
- sap.rules.ui.ExpressionAdvanced.prototype.onAfterRendering.apply(this, arguments);
84
- this.codeMirror.options.fixedOperator = this.getFixedOperator();
85
- this.codeMirror.options.headerValue = this.getHeaderValue();
86
- this.codeMirror.options.filterOutStructuredCond = true; //Structured conditions should not appear in decision table. (e.g "any of the following...")
87
- this.oDecisionTableCell = (this.getParent() && this.getParent().getParent()) ? this.getParent().getParent() : null;
88
- this._handleValidation();
89
- if (jQuery.sap.byId(this.getId()).closest('td').next().width()) {
90
- this._showPopUp();
91
- }
92
- if (this.oDecisionTableCell) {
93
- var valueStatePath = this.oDecisionTableCell.getValueStatePath();
94
- var dtModel = this.oDecisionTableCell.getModel("dtModel");
95
- var oDisplayedControl = this.oDecisionTableCell.getAggregation("_displayedControl");
96
- if (oDisplayedControl) {
97
- dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
98
- }
99
- }
100
- this.createEventListeners();
101
-
102
- ;
103
- }
104
-
105
- DecisionTableCellExpressionAdvanced.prototype._handleValidation = function() {
106
- this.validateExpression();
107
- this._showErrorMessage();
108
- if (this.getProperty("valueStateText") && this.codeMirror) {
109
- this.codeMirror.options.expressionEditor._showPopUp();
110
- }
111
- };
112
-
113
- DecisionTableCellExpressionAdvanced.prototype._processValidationResult = function(result){
114
- sap.rules.ui.ExpressionAdvanced.prototype._processValidationResult.apply(this, arguments);
115
- if (this.oDecisionTableCell) {
116
- var valueStateTextPath = this.oDecisionTableCell.getValueStateTextPath();
117
- var valueStatePath = this.oDecisionTableCell.getValueStatePath();
118
- var dtModel = this.oDecisionTableCell.getModel("dtModel");
119
- var oDisplayedControl = this.oDecisionTableCell.getAggregation("_displayedControl");
120
- if (oDisplayedControl && result.status === sap.rules.ui.ValidationStatus.Error ) {
121
- var errorDetails = this.getValueStateText();
122
- dtModel.setProperty(valueStateTextPath.slice(8), errorDetails);
123
- if (!this.oDecisionTableCell._oPopover || !this.oDecisionTableCell._oPopover.isOpen()) {
124
- dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.Error);
125
- } else {
126
- dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
127
- }
128
- this.setProperty("valueStateText", errorDetails);
129
- } else if (oDisplayedControl) {
130
- dtModel.setProperty(valueStateTextPath.slice(8), "null");
131
- dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
132
- this.setProperty("valueStateText", "");
133
- }
134
- }
135
- };
136
-
137
- DecisionTableCellExpressionAdvanced.prototype.exit = function() {
138
- sap.rules.ui.ExpressionAdvanced.prototype.exit.apply(this, arguments);
139
- this._handleValidation();
140
- this._closePopUp();
141
- this.pop = null;
142
- var oCodeMirror = this.codeMirror;
143
- // bug RULES-4391 only in FF after choose hints with mouse sometimes the popover will close and auto complete will stay open
144
- if (oCodeMirror && oCodeMirror.state.completionActive) {
145
- oCodeMirror.state.completionActive.onClose();
146
- }
147
- // bug RULES-4833 if we pressed escape - we need to focus cell (dotted border)
148
- if (this.bFocusCellAfterEscape && this.oDecisionTableCell) {
149
- var oHTMLParent = this.oDecisionTableCell.getDomRef().parentElement.parentElement;
150
- if (oHTMLParent) {
151
- jQuery(oHTMLParent).focus();
152
- }
153
- }
154
-
155
- };
156
-
157
- DecisionTableCellExpressionAdvanced.prototype.getFormattingTokens = function (oExpressionLanguage) {
158
- var sExpression = this._liveValue;
159
- var sHeader = this.getHeaderValue();
160
- var sFixOperator = this.getFixedOperator();
161
- var sType = "All";
162
-
163
- // If the cell is of result section - set a header and fixed operator
164
- if (oExpressionLanguage._hasValueSource && sHeader === "" && sFixOperator === "") {
165
- this.attributeId = this.mProperties.attributeInfo;
166
- this.valueListAttrInfo = oExpressionLanguage.getValueListAttribute(this.attributeId);
167
- if (this.valueListAttrInfo) {
168
- sHeader = this.valueListAttrInfo.navPath;
169
- sFixOperator = Constants.IS_EQUAL_TO;
170
- }
171
- }
172
-
173
- var result = oExpressionLanguage.getDecisionTableCellTokens(sHeader, sFixOperator, sExpression, sType);
174
- var expressionTokens;
175
- if (result.tokens && result.tokens.cell) {
176
- expressionTokens = result.tokens.cell;
177
- this.setExpressionTokens(expressionTokens);
178
- }
179
- };
180
-
181
- // Event Listeners for integration between [Code Mirror - ExpressionAdvanced - popover - DTCell] to work together in all browsers and OS
182
- DecisionTableCellExpressionAdvanced.prototype.createEventListeners = function() {
183
-
184
- document.getElementById(this.getId()).addEventListener("keydown", function(oEvent){
185
- var key = oEvent.keyCode || oEvent.charCode;
186
- if ( key === 8 ) { //fix bug - after press backspace and choose autocomplete - popover will not closed
187
- this.bFlagForChangeBeforeBlur = true;
188
- } else if (key === 27 ) { // bug RULES-4833 if we pressed escape - we need to focus cell (dotted border)
189
- this.bFocusCellAfterEscape = true;
190
- }
191
- }.bind(this), true);
192
-
193
- // bug 4848 - touch screen laptops close popover after select autocomplete (trigger touch event)
194
- var click = ('ontouchstart' in document.documentElement) ? 'touchstart' : 'mousedown';
195
-
196
- if (click === 'touchstart') { //if hybrid device
197
- document.addEventListener("mousedown", function(oEvent) {
198
- if (oEvent.target.className.includes("CodeMirror-hint")) {//if click the auto complete
199
- oEvent.stopPropagation();
200
- }
201
- }.bind(this), true);
202
- document.addEventListener("touchstart", function(oEvent) {
203
- if (oEvent.target.className.includes("CodeMirror-hint")) {//if tap the auto complete
204
- oEvent.stopPropagation();
205
- }
206
- }.bind(this), true);
207
- }
208
-
209
- // EventListeners for IE
210
- if (!(window.ActiveXObject) && "ActiveXObject" in window) { //if browser IE
211
- // bug RULES-4810 only in IE Code Mirror blur called validate even popover open - not damaged in other browsers and OS
212
- this.codeMirror.on("blur", function (cm, oEvent) {
213
- this.bFlagForPreventBlurWhenPopOverOpen = true;
214
- }.bind(this));
215
-
216
- //bug RULES-2641 only in IE blur called twice - not damaged in other browsers and OS
217
- document.getElementById(this.getId()).addEventListener("mousedown", function(oEvent){
218
- this.bFlagForChangeBeforeBlur = true;
219
- }.bind(this), true);
220
- }
221
-
222
- // EventListeners for FF
223
- if ((navigator.userAgent.toLowerCase().indexOf('firefox') > -1)){
224
- // bug RULES-4391 only in FF after choose hints with mouse sometimes the popover will close
225
- document.addEventListener("mousedown", function(oEvent){
226
- this.bIsClickedOnTheAutoComplete = oEvent.target.className.includes("CodeMirror-hint");
227
- }.bind(this), true);
228
-
229
- document.addEventListener("blur", function(oEvent){
230
- if (this.bIsClickedOnTheAutoComplete || this.ValueHelpRequested === true) {
231
- this.bIsClickedOnTheAutoComplete = false;
232
- oEvent.stopPropagation();
233
- }
234
- }.bind(this), true);
235
- }
236
- };
237
-
238
- return DecisionTableCellExpressionAdvanced;
239
-
5
+
6
+ */
7
+
8
+ // Provides control sap.rules.ui.ExpressionAdvanced.
9
+ sap.ui.define([
10
+ "jquery.sap.global",
11
+ "./library",
12
+ "sap/rules/ui/Utils",
13
+ "sap/rules/ui/ExpressionAdvanced",
14
+ "sap/rules/ui/Constants",
15
+ "./DecisionTableCellExpressionAdvancedRenderer"
16
+ ], function(jQuery, library, Utils, ExpressionAdvanced, Constants, DecisionTableCellExpressionAdvancedRenderer) {
17
+ "use strict";
18
+
19
+ /**
20
+ * Constructor for a new DecisionTableCellExpressionAdvanced sap.rules.ui.ExpressionAdvanced.
21
+ *
22
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
23
+ * @param {object} [mSettings] initial settings for the new control
24
+ *
25
+ * @class
26
+ * The <code>sap.rules.ui.DecisionTableCellExpressionAdvanced</code> control provides the ability to define expressions for complex rules in a decision table.
27
+ * @extends sap.rules.ui.ExpressionAdvanced
28
+ *
29
+ * @author SAP SE
30
+ * @version 1.108.0
31
+ *
32
+ * @constructor
33
+ * @private
34
+ * @alias sap.rules.ui.DecisionTableCellExpressionAdvanced
35
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
36
+ */
37
+ var DecisionTableCellExpressionAdvanced = ExpressionAdvanced.extend("sap.rules.ui.DecisionTableCellExpressionAdvanced", {
38
+ metadata: {
39
+
40
+ library: "sap.rules.ui",
41
+ properties: {
42
+ /**
43
+ * Defines the header value of the control.
44
+ */
45
+ headerValue: {
46
+ type: "string",
47
+ defaultValue: "",
48
+ bindable: "bindable"
49
+ },
50
+ /**
51
+ * Defines the fixed operator value of the control.
52
+ */
53
+ fixedOperator: {
54
+ type: "string",
55
+ defaultValue: "",
56
+ bindable: "bindable"
57
+ },
58
+ type: {
59
+ type: "sap.rules.ui.ExpressionType",
60
+ defaultValue: sap.rules.ui.ExpressionType.BooleanEnhanced,
61
+ bindable: "bindable"
62
+ }
63
+ }
64
+ },
65
+ renderer: DecisionTableCellExpressionAdvancedRenderer
66
+ });
67
+
68
+ DecisionTableCellExpressionAdvanced.prototype.validateExpression = function() {
69
+ var expressionValue = this.codeMirror ? this.codeMirror.getValue() : this.getValue();
70
+ if (expressionValue) {
71
+ var sValue = this.getHeaderValue() + " " + this.getFixedOperator() + " " + expressionValue;
72
+ sap.rules.ui.ExpressionAdvanced.prototype.validateExpression.apply(this, [sValue]);
73
+ } else {
74
+ this.setValueStateText("");
75
+ }
76
+
77
+ };
78
+
79
+ DecisionTableCellExpressionAdvanced.prototype.init = function() {
80
+ sap.rules.ui.ExpressionAdvanced.prototype.init.apply(this, arguments);
81
+ this.bFlagForChangeBeforeBlur = false;
82
+ };
83
+
84
+ DecisionTableCellExpressionAdvanced.prototype.onAfterRendering = function() {
85
+ sap.rules.ui.ExpressionAdvanced.prototype.onAfterRendering.apply(this, arguments);
86
+ this.codeMirror.options.fixedOperator = this.getFixedOperator();
87
+ this.codeMirror.options.headerValue = this.getHeaderValue();
88
+ this.codeMirror.options.filterOutStructuredCond = true; //Structured conditions should not appear in decision table. (e.g "any of the following...")
89
+ this.oDecisionTableCell = (this.getParent() && this.getParent().getParent()) ? this.getParent().getParent() : null;
90
+ this._handleValidation();
91
+ if (jQuery.sap.byId(this.getId()).closest('td').next().width()) {
92
+ this._showPopUp();
93
+ }
94
+ if (this.oDecisionTableCell) {
95
+ var valueStatePath = this.oDecisionTableCell.getValueStatePath();
96
+ var dtModel = this.oDecisionTableCell.getModel("dtModel");
97
+ var oDisplayedControl = this.oDecisionTableCell.getAggregation("_displayedControl");
98
+ if (oDisplayedControl) {
99
+ dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
100
+ }
101
+ }
102
+ this.createEventListeners();
103
+
104
+ ;
105
+ }
106
+
107
+ DecisionTableCellExpressionAdvanced.prototype._handleValidation = function() {
108
+ this.validateExpression();
109
+ this._showErrorMessage();
110
+ if (this.getProperty("valueStateText") && this.codeMirror) {
111
+ this.codeMirror.options.expressionEditor._showPopUp();
112
+ }
113
+ };
114
+
115
+ DecisionTableCellExpressionAdvanced.prototype._processValidationResult = function(result){
116
+ sap.rules.ui.ExpressionAdvanced.prototype._processValidationResult.apply(this, arguments);
117
+ if (this.oDecisionTableCell) {
118
+ var valueStateTextPath = this.oDecisionTableCell.getValueStateTextPath();
119
+ var valueStatePath = this.oDecisionTableCell.getValueStatePath();
120
+ var dtModel = this.oDecisionTableCell.getModel("dtModel");
121
+ var oDisplayedControl = this.oDecisionTableCell.getAggregation("_displayedControl");
122
+ if (oDisplayedControl && result.status === sap.rules.ui.ValidationStatus.Error ) {
123
+ var errorDetails = this.getValueStateText();
124
+ dtModel.setProperty(valueStateTextPath.slice(8), errorDetails);
125
+ if (!this.oDecisionTableCell._oPopover || !this.oDecisionTableCell._oPopover.isOpen()) {
126
+ dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.Error);
127
+ } else {
128
+ dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
129
+ }
130
+ this.setProperty("valueStateText", errorDetails);
131
+ } else if (oDisplayedControl) {
132
+ dtModel.setProperty(valueStateTextPath.slice(8), "null");
133
+ dtModel.setProperty(valueStatePath.slice(8), sap.ui.core.ValueState.None);
134
+ this.setProperty("valueStateText", "");
135
+ }
136
+ }
137
+ };
138
+
139
+ DecisionTableCellExpressionAdvanced.prototype.exit = function() {
140
+ sap.rules.ui.ExpressionAdvanced.prototype.exit.apply(this, arguments);
141
+ this._handleValidation();
142
+ this._closePopUp();
143
+ this.pop = null;
144
+ var oCodeMirror = this.codeMirror;
145
+ // bug RULES-4391 only in FF after choose hints with mouse sometimes the popover will close and auto complete will stay open
146
+ if (oCodeMirror && oCodeMirror.state.completionActive) {
147
+ oCodeMirror.state.completionActive.onClose();
148
+ }
149
+ // bug RULES-4833 if we pressed escape - we need to focus cell (dotted border)
150
+ if (this.bFocusCellAfterEscape && this.oDecisionTableCell) {
151
+ var oHTMLParent = this.oDecisionTableCell.getDomRef().parentElement.parentElement;
152
+ if (oHTMLParent) {
153
+ jQuery(oHTMLParent).focus();
154
+ }
155
+ }
156
+
157
+ };
158
+
159
+ DecisionTableCellExpressionAdvanced.prototype.getFormattingTokens = function (oExpressionLanguage) {
160
+ var sExpression = this._liveValue;
161
+ var sHeader = this.getHeaderValue();
162
+ var sFixOperator = this.getFixedOperator();
163
+ var sType = "All";
164
+
165
+ // If the cell is of result section - set a header and fixed operator
166
+ if (oExpressionLanguage._hasValueSource && sHeader === "" && sFixOperator === "") {
167
+ this.attributeId = this.mProperties.attributeInfo;
168
+ this.valueListAttrInfo = oExpressionLanguage.getValueListAttribute(this.attributeId);
169
+ if (this.valueListAttrInfo) {
170
+ sHeader = this.valueListAttrInfo.navPath;
171
+ sFixOperator = Constants.IS_EQUAL_TO;
172
+ }
173
+ }
174
+
175
+ var result = oExpressionLanguage.getDecisionTableCellTokens(sHeader, sFixOperator, sExpression, sType);
176
+ var expressionTokens;
177
+ if (result.tokens && result.tokens.cell) {
178
+ expressionTokens = result.tokens.cell;
179
+ this.setExpressionTokens(expressionTokens);
180
+ }
181
+ };
182
+
183
+ // Event Listeners for integration between [Code Mirror - ExpressionAdvanced - popover - DTCell] to work together in all browsers and OS
184
+ DecisionTableCellExpressionAdvanced.prototype.createEventListeners = function() {
185
+
186
+ document.getElementById(this.getId()).addEventListener("keydown", function(oEvent){
187
+ var key = oEvent.keyCode || oEvent.charCode;
188
+ if ( key === 8 ) { //fix bug - after press backspace and choose autocomplete - popover will not closed
189
+ this.bFlagForChangeBeforeBlur = true;
190
+ } else if (key === 27 ) { // bug RULES-4833 if we pressed escape - we need to focus cell (dotted border)
191
+ this.bFocusCellAfterEscape = true;
192
+ }
193
+ }.bind(this), true);
194
+
195
+ // bug 4848 - touch screen laptops close popover after select autocomplete (trigger touch event)
196
+ var click = ('ontouchstart' in document.documentElement) ? 'touchstart' : 'mousedown';
197
+
198
+ if (click === 'touchstart') { //if hybrid device
199
+ document.addEventListener("mousedown", function(oEvent) {
200
+ if (oEvent.target.className.includes("CodeMirror-hint")) {//if click the auto complete
201
+ oEvent.stopPropagation();
202
+ }
203
+ }.bind(this), true);
204
+ document.addEventListener("touchstart", function(oEvent) {
205
+ if (oEvent.target.className.includes("CodeMirror-hint")) {//if tap the auto complete
206
+ oEvent.stopPropagation();
207
+ }
208
+ }.bind(this), true);
209
+ }
210
+
211
+ // EventListeners for IE
212
+ if (!(window.ActiveXObject) && "ActiveXObject" in window) { //if browser IE
213
+ // bug RULES-4810 only in IE Code Mirror blur called validate even popover open - not damaged in other browsers and OS
214
+ this.codeMirror.on("blur", function (cm, oEvent) {
215
+ this.bFlagForPreventBlurWhenPopOverOpen = true;
216
+ }.bind(this));
217
+
218
+ //bug RULES-2641 only in IE blur called twice - not damaged in other browsers and OS
219
+ document.getElementById(this.getId()).addEventListener("mousedown", function(oEvent){
220
+ this.bFlagForChangeBeforeBlur = true;
221
+ }.bind(this), true);
222
+ }
223
+
224
+ // EventListeners for FF
225
+ if ((navigator.userAgent.toLowerCase().indexOf('firefox') > -1)){
226
+ // bug RULES-4391 only in FF after choose hints with mouse sometimes the popover will close
227
+ document.addEventListener("mousedown", function(oEvent){
228
+ this.bIsClickedOnTheAutoComplete = oEvent.target.className.includes("CodeMirror-hint");
229
+ }.bind(this), true);
230
+
231
+ document.addEventListener("blur", function(oEvent){
232
+ if (this.bIsClickedOnTheAutoComplete || this.ValueHelpRequested === true) {
233
+ this.bIsClickedOnTheAutoComplete = false;
234
+ oEvent.stopPropagation();
235
+ }
236
+ }.bind(this), true);
237
+ }
238
+ };
239
+
240
+ return DecisionTableCellExpressionAdvanced;
241
+
240
242
  }, /* bExport= */ true);
@@ -6,16 +6,18 @@
6
6
  */
7
7
 
8
8
 
9
- sap.ui.define(['jquery.sap.global', 'sap/rules/ui/ExpressionAdvancedRenderer'],
9
+ sap.ui.define(['sap/rules/ui/ExpressionAdvancedRenderer'],
10
10
 
11
- function(jQuery, sapRulesUiExpressionAdvancedRenderer) {
11
+ function(sapRulesUiExpressionAdvancedRenderer) {
12
12
  "use strict";
13
13
 
14
14
  /**
15
15
  * DecisionTableCellExpressionAdvanced renderer.
16
16
  * @namespace
17
17
  */
18
- var DecisionTableCellExpressionAdvancedRenderer = {};
18
+ var DecisionTableCellExpressionAdvancedRenderer = {
19
+ apiVersion: 2
20
+ };
19
21
  /**
20
22
  * Renders the HTML for the given control, using the provided
21
23
  * {@link sap.ui.core.RenderManager}.
@@ -32,7 +34,7 @@ sap.ui.define(['jquery.sap.global', 'sap/rules/ui/ExpressionAdvancedRenderer'],
32
34
  return;
33
35
  }
34
36
 
35
- oRm.addClass("sapRULTDecisionTableCellExpressionAdvanced");
37
+ oRm.class("sapRULTDecisionTableCellExpressionAdvanced");
36
38
 
37
39
  sapRulesUiExpressionAdvancedRenderer.render(oRm, oControl);
38
40
  };
@@ -10,8 +10,9 @@ sap.ui.define([
10
10
  "jquery.sap.global",
11
11
  "./library",
12
12
  "sap/rules/ui/ExpressionBasic",
13
- "sap/rules/ui/InstructionRenderer"
14
- ], function(jQuery, library, ExpressionBasic, InstructionRenderer) {
13
+ "sap/rules/ui/InstructionRenderer",
14
+ "./DecisionTableCellExpressionBasicRenderer"
15
+ ], function(jQuery, library, ExpressionBasic, InstructionRenderer, DecisionTableCellExpressionBasicRenderer) {
15
16
  "use strict";
16
17
 
17
18
  /**
@@ -25,7 +26,7 @@ sap.ui.define([
25
26
  * @extends sap.rules.ui.ExpressionBasic
26
27
  *
27
28
  * @author SAP SE
28
- * @version 1.107.0
29
+ * @version 1.108.0
29
30
  *
30
31
  * @constructor
31
32
  * @private
@@ -150,7 +151,9 @@ sap.ui.define([
150
151
  },
151
152
  _onChangeByIndex: function(instructionIndex, sPrefix) {
152
153
  sap.rules.ui.ExpressionBasic.prototype._onChangeByIndex.apply(this, [this.offSet + instructionIndex, this.sHeaderValue + this.FixedOperatorValue, instructionIndex]);
153
- }
154
+ },
155
+
156
+ renderer: DecisionTableCellExpressionBasicRenderer
154
157
  });
155
158
 
156
159
  DecisionTableCellExpressionBasic.prototype.init = function() {