@refinitiv-ui/efx-grid 6.0.105 → 6.0.106

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,8 @@ declare namespace FieldDefinition {
6
6
 
7
7
  function set(field: string, def: any): void;
8
8
 
9
+ function resetAll(): void;
10
+
9
11
  function get(field: string): any;
10
12
 
11
13
  function getFieldInfo(field: string): any;
@@ -35,7 +35,11 @@ let FieldDefinition = {};
35
35
  /** @type {Object.<string, Object>}
36
36
  * @private
37
37
  */
38
- FieldDefinition._defs = {
38
+ FieldDefinition._defs = {};
39
+ /** @type {Object.<string, Object>}
40
+ * @private
41
+ */
42
+ FieldDefinition._defaults = {
39
43
  "CF_NAME": {
40
44
  name: "Name",
41
45
  rank: 2800003,
@@ -180,6 +184,17 @@ FieldDefinition.set = function(field, def) {
180
184
  /** Get field definition object
181
185
  * @public
182
186
  * @function
187
+ */
188
+ FieldDefinition.resetAll = function() {
189
+ let defs = FieldDefinition._defs = {};
190
+ let defaultFields = FieldDefinition._defaults;
191
+ for(let key in defaultFields) {
192
+ defs[key] = defaultFields[key];
193
+ }
194
+ };
195
+ /** Get field definition object
196
+ * @public
197
+ * @function
183
198
  * @param {string} field
184
199
  * @return {Object}
185
200
  */
@@ -535,8 +550,9 @@ function onLoadEnd(e) {
535
550
  }
536
551
 
537
552
  (function() { // Add "field" property to all default field definitions. This reduces file size and redundancy
538
- for(let key in FieldDefinition._defs) {
539
- FieldDefinition._defs[key]["field"] = key;
553
+ for(let key in FieldDefinition._defaults) {
554
+ FieldDefinition._defaults[key]["field"] = key;
555
+ FieldDefinition._defs[key] = FieldDefinition._defaults[key];
540
556
  }
541
557
  })();
542
558
 
@@ -6,9 +6,11 @@ declare class CellWriter extends ElementWrapper {
6
6
 
7
7
  constructor();
8
8
 
9
- public getContent(): Node|null|null;
9
+ public getParent(): Node|null;
10
10
 
11
- public setContent(content: any, opt_tooltip?: boolean|null): Element|null;
11
+ public getContent(): Node|null;
12
+
13
+ public setContent(content: any, tooltip?: boolean|null): Element|null;
12
14
 
13
15
  public setTooltip(str: string): void;
14
16
 
@@ -26,11 +28,9 @@ declare class CellWriter extends ElementWrapper {
26
28
 
27
29
  public listen(): void;
28
30
 
29
- public setTooltip(): void;
30
-
31
31
  public addClass(str: string): void;
32
32
 
33
- public hasClass(str: string): void;
33
+ public hasClass(str: string): boolean;
34
34
 
35
35
  public removeClass(str: string): void;
36
36
 
@@ -46,4 +46,5 @@ declare class CellWriter extends ElementWrapper {
46
46
 
47
47
  }
48
48
 
49
+ export default CellWriter;
49
50
  export { CellWriter };
@@ -6,7 +6,7 @@ import { Dom } from "../../tr-grid-util/es6/Dom.js";
6
6
  * @constructor
7
7
  * @extends {ElementWrapper}
8
8
  */
9
- var CellWriter = function () {
9
+ let CellWriter = function () {
10
10
  };
11
11
  Ext.inherits(CellWriter, ElementWrapper);
12
12
 
@@ -23,19 +23,34 @@ CellWriter.prototype._floatingPanel = null;
23
23
  */
24
24
  CellWriter.prototype._frontPanel = null;
25
25
 
26
+ /** @private
27
+ * @type {Element}
28
+ */
29
+ CellWriter.prototype._parent = null;
30
+
26
31
 
27
32
  /** @public
28
- * @return {Node|null} content
33
+ * @return {Node} content
34
+ */
35
+ CellWriter.prototype.getParent = function () {
36
+ if(!this._parent) {
37
+ this._parent = document.createElement("div");
38
+ }
39
+ return this._parent;
40
+ };
41
+ /** @public
42
+ * @return {Node} content
29
43
  */
30
44
  CellWriter.prototype.getContent = function () {
31
45
  return this._elem.children[0] || null;
32
46
  };
33
47
  /** @public
34
48
  * @param {*} content
35
- * @param {boolean=} opt_tooltip
49
+ * @param {boolean=} tooltip
36
50
  * @return {Element}
37
51
  */
38
- CellWriter.prototype.setContent = function (content, opt_tooltip) {
52
+ CellWriter.prototype.setContent = function (content, tooltip) {
53
+ Dom.removeChildren(this._elem);
39
54
  if(content == null) {
40
55
  return null;
41
56
  }
@@ -44,7 +59,7 @@ CellWriter.prototype.setContent = function (content, opt_tooltip) {
44
59
  } else if(content.nodeType !== 1) {
45
60
  content = this._createTextContent(content);
46
61
  }
47
- Dom.removeChildren(this._elem);
62
+
48
63
  this._elem.appendChild(/** @type{Node} */(content));
49
64
  return /** @type{Element} */(content);
50
65
  };
@@ -82,7 +97,7 @@ CellWriter.prototype.addContent = function (n) {
82
97
  * @return {Element}
83
98
  */
84
99
  CellWriter.prototype._createTextContent = function (str) {
85
- var div = Dom.div("text");
100
+ let div = Dom.div("text");
86
101
  if(str != null) {
87
102
  div.textContent = str;
88
103
  this["percentText"] = str; // HACK
@@ -97,6 +112,26 @@ CellWriter.prototype._createTextContent = function (str) {
97
112
  CellWriter.prototype.setStyle = function (str, val) {
98
113
  this._elem.style[str] = val;
99
114
  };
115
+ /** @private
116
+ * @returns {!Element} flex row
117
+ */
118
+ CellWriter.prototype._insertFlexRow = function () {
119
+ let flexRow = this._flexRow;
120
+ if(!flexRow) {
121
+ flexRow = this._flexRow = document.createElement("div");
122
+ flexRow.className = "tr-printing-flex-row";
123
+ }
124
+
125
+ let elem = this._elem;
126
+ if(elem.firstChild !== flexRow) {
127
+ while(elem.firstChild) {
128
+ flexRow.appendChild(elem.firstChild);
129
+ }
130
+ elem.appendChild(flexRow);
131
+ }
132
+
133
+ return flexRow;
134
+ };
100
135
  /** @public
101
136
  * @param {*} n
102
137
  */
@@ -106,26 +141,14 @@ CellWriter.prototype.removeIcon = function (n) {};
106
141
  */
107
142
  CellWriter.prototype.updateIcon = function (elem) {
108
143
  if(elem && elem.nodeType === 1) {
109
- var fp = this._frontPanel;
144
+ let flexRow = this._insertFlexRow();
145
+ let fp = this._frontPanel;
110
146
  if(!fp) {
111
- this._flexRow = document.createElement("div");
112
- this._flexRow.className = "tr-printing-flex-row";
113
-
114
- fp = this._floatingPanel = document.createElement("div");
115
- fp.className = "tr-printing-float-right";
116
- this._flexRow.appendChild(fp);
117
- var chdr = this._elem.children;
118
- var childCount = chdr.length;
119
- if(childCount) {
120
- var ary = new Array(childCount);
121
- for(var i = 0; i < childCount; ++i) {
122
- ary[i] = chdr[i];
123
- }
124
- Dom.appendChild(this._flexRow, ary);
125
- }
126
- this._elem.appendChild(this._flexRow);
147
+ fp = this._frontPanel = document.createElement("div");
148
+ fp.className = "tr-printing-float-right"; // WARNING: This may need to be float-left
149
+ flexRow.insertBefore(fp, flexRow.firstChild);
127
150
  }
128
- fp.appendChild(elem.cloneNode(true));
151
+ fp.appendChild(elem.cloneNode(true)); // WARNING: This may not need to be cloned
129
152
  }
130
153
  };
131
154
  /** @public
@@ -135,10 +158,6 @@ CellWriter.prototype.unlisten = function () {};
135
158
  */
136
159
  CellWriter.prototype.listen = function () {};
137
160
 
138
- /** @public
139
- */
140
- CellWriter.prototype.setTooltip = function () {};
141
-
142
161
  /** @public
143
162
  * @param {string} str
144
163
  */
@@ -147,9 +166,10 @@ CellWriter.prototype.addClass = function (str) {
147
166
  };
148
167
  /** @public
149
168
  * @param {string} str
169
+ * @returns {boolean}
150
170
  */
151
171
  CellWriter.prototype.hasClass = function (str) {
152
- this._elem.classList.contains(str);
172
+ return this._elem.classList.contains(str);
153
173
  };
154
174
  /** @public
155
175
  * @param {string} str
@@ -175,26 +195,14 @@ CellWriter.prototype.enableClass = function (str, bool) {
175
195
  */
176
196
  CellWriter.prototype.insertFloatingIcon = function (elem, order) {
177
197
  if(elem && elem.nodeType === 1) {
178
- var fp = this._floatingPanel;
198
+ let flexRow = this._insertFlexRow();
199
+ let fp = this._floatingPanel;
179
200
  if(!fp) {
180
- this._flexRow = document.createElement("div");
181
- this._flexRow.className = "tr-printing-flex-row";
182
-
183
- var chdr = this._elem.children;
184
- var childCount = chdr.length;
185
- if(childCount) {
186
- var ary = new Array(childCount);
187
- for(var i = 0; i < childCount; ++i) {
188
- ary[i] = chdr[i];
189
- }
190
- Dom.appendChild(this._flexRow, ary);
191
- }
192
201
  fp = this._floatingPanel = document.createElement("div");
193
202
  fp.className = "tr-printing-float-right";
194
- this._flexRow.appendChild(fp);
195
- this._elem.appendChild(this._flexRow);
203
+ flexRow.appendChild(fp);
196
204
  }
197
- fp.appendChild(elem.cloneNode(true));
205
+ fp.appendChild(elem.cloneNode(true)); // WARNING: This may not need to be cloned
198
206
  }
199
207
  };
200
208
  /** @public
@@ -214,13 +222,13 @@ CellWriter.prototype.getSection = function () {
214
222
  * @param {Element} elem
215
223
  */
216
224
  CellWriter.prototype.cloak = function (elem) {
217
- delete this.percentText;
218
- delete this._flexRow;
219
- delete this._floatingPanel;
220
- delete this._frontPanel;
225
+ this.percentText = ""; // Hack
226
+ this._flexRow = this._frontPanel = this._floatingPanel = null;
221
227
  elem.className = "cell";
222
228
  this._elem = elem;
223
229
  };
224
230
 
225
231
 
232
+
233
+ export default CellWriter;
226
234
  export { CellWriter };
@@ -9,4 +9,5 @@ declare class ColumnWriter extends ElementWrapper {
9
9
 
10
10
  }
11
11
 
12
+ export default ColumnWriter;
12
13
  export { ColumnWriter };
@@ -5,7 +5,7 @@ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js";
5
5
  * @constructor
6
6
  * @extends {ElementWrapper}
7
7
  */
8
- var ColumnWriter = function () {
8
+ let ColumnWriter = function () {
9
9
  };
10
10
  Ext.inherits(ColumnWriter, ElementWrapper);
11
11
 
@@ -18,4 +18,6 @@ ColumnWriter.prototype.isActive = function () {
18
18
  };
19
19
 
20
20
 
21
+
22
+ export default ColumnWriter;
21
23
  export { ColumnWriter };