@refinitiv-ui/efx-grid 6.0.12 → 6.0.13

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.
@@ -41,7 +41,8 @@ declare namespace ColumnDefinition {
41
41
  keepModel?: boolean|null,
42
42
  stationary?: boolean|null,
43
43
  leftPinned?: boolean|null,
44
- rightPinned?: boolean|null
44
+ rightPinned?: boolean|null,
45
+ info?: any
45
46
  };
46
47
 
47
48
  }
@@ -142,6 +143,10 @@ declare class ColumnDefinition {
142
143
 
143
144
  public clearUserModel(): void;
144
145
 
146
+ public setColumnInfo(obj: any): void;
147
+
148
+ public getColumnInfo(): any;
149
+
145
150
  }
146
151
 
147
152
  declare const COL_DEF: string;
@@ -48,6 +48,7 @@ import Engine from "../../tr-grid-util/es6/formula/Engine.js";
48
48
  * @property {boolean=} stationary=false If enabled, the column order cannot be changed (i.e., this column and any column to its left cannot be moved)
49
49
  * @property {boolean=} leftPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the left side
50
50
  * @property {boolean=} rightPinned=false If enabled, the column will not be part of the scrollable area and is pinned to the right side
51
+ * @property {Object=} info=null Store additional information
51
52
  */
52
53
 
53
54
  /** mapping of field type to javascript type
@@ -240,6 +241,10 @@ ColumnDefinition.prototype._textSelect = false;
240
241
  * @private
241
242
  */
242
243
  ColumnDefinition.prototype._userModel = null;
244
+ /** @type {Object}
245
+ * @private
246
+ */
247
+ ColumnDefinition.prototype._info = null;
243
248
  //#endregion Private Members
244
249
 
245
250
 
@@ -399,6 +404,11 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
399
404
  this._textSelect = val;
400
405
  }
401
406
 
407
+ val = columnOption["info"];
408
+ if(val) {
409
+ this._info = val;
410
+ }
411
+
402
412
  this._userModel = columnOption;
403
413
  };
404
414
 
@@ -674,6 +684,10 @@ ColumnDefinition.prototype.getClasses = function() {
674
684
  ColumnDefinition.prototype.getConfigObject = function(colOptions) {
675
685
  var obj = colOptions || {};
676
686
 
687
+ if(this._info){
688
+ obj["info"] = this._info;
689
+ }
690
+
677
691
  if(this._field !== "" && !this._field.match(/^COLUMN_/)) {
678
692
  obj["field"] = this._field;
679
693
  }
@@ -1012,5 +1026,20 @@ ColumnDefinition.prototype.clearUserModel = function() {
1012
1026
  this._userModel = null;
1013
1027
  };
1014
1028
 
1029
+ /** @public
1030
+ * @param {Object} obj
1031
+ */
1032
+ ColumnDefinition.prototype.setColumnInfo = function(obj) {
1033
+ this._info = obj;
1034
+ };
1035
+
1036
+ /** @public
1037
+ * @return {Object}
1038
+ */
1039
+ ColumnDefinition.prototype.getColumnInfo = function() {
1040
+ return this._info;
1041
+ };
1042
+
1043
+
1015
1044
  export {ColumnDefinition, COL_DEF};
1016
1045
  export default ColumnDefinition;
@@ -10,12 +10,13 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
10
10
  declare namespace ColumnStackPlugin {
11
11
 
12
12
  type Options = {
13
- fields: (string)[]|null
13
+ fields: (string)[]|null,
14
+ stacks: (ColumnStackPlugin.StackDefinition)[]|null
14
15
  };
15
16
 
16
17
  type ColumnOptions = {
17
18
  stackId?: string|null,
18
- stack?: (string|StackOptions)|null
19
+ stack?: (string|ColumnStackPlugin.StackOptions)|null
19
20
  };
20
21
 
21
22
  type StackOptions = {
@@ -24,6 +25,14 @@ declare namespace ColumnStackPlugin {
24
25
  collapsed?: boolean|null
25
26
  };
26
27
 
28
+ type StackDefinition = {
29
+ id: string,
30
+ spreading?: boolean|null,
31
+ collapsed?: boolean|null,
32
+ children: (string)[]|null,
33
+ name?: string|null
34
+ };
35
+
27
36
  }
28
37
 
29
38
  declare class ColumnStackPlugin extends GridPlugin {
@@ -90,6 +99,10 @@ declare class ColumnStackPlugin extends GridPlugin {
90
99
 
91
100
  public reorderStackColumns(colRefs: (number|string)[]|null, stackId: string): void;
92
101
 
102
+ public setStackName(stackId: string, name: string): void;
103
+
104
+ public getStackName(stackId: string): string;
105
+
93
106
  }
94
107
 
95
108
  export default ColumnStackPlugin;
@@ -10,12 +10,13 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
10
10
  /** @typedef {Object} ColumnStackPlugin~Options
11
11
  * @description Available options describing `columnStack` object specified in grid's option
12
12
  * @property {Array.<string>} fields Fields for stacking. The minimum is 2 fields.
13
+ * @property {Array.<ColumnStackPlugin~StackDefinition>} stacks List of stacking configuration
13
14
  */
14
15
 
15
16
  /** @typedef {Object} ColumnStackPlugin~ColumnOptions
16
17
  * @description Extension column options that can be specified on each individual grid's column option.
17
18
  * @property {string=} stackId Group ID
18
- * @property {(string|StackOptions)=} stack Group ID or StackOptions object
19
+ * @property {(string|ColumnStackPlugin~StackOptions)=} stack Group ID or StackOptions object
19
20
  */
20
21
 
21
22
  /** @typedef {Object} ColumnStackPlugin~StackOptions
@@ -25,6 +26,15 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
25
26
  * @property {boolean=} collapsed=true If disabled, this group will be expanded at the first time
26
27
  */
27
28
 
29
+ /** @typedef {Object} ColumnStackPlugin~StackDefinition
30
+ * @description Available options for setting stack
31
+ * @property {string} id Group ID
32
+ * @property {boolean=} spreading=false If specified true, this group will be running in collapsing mode
33
+ * @property {boolean=} collapsed=true If disabled, this group will be expanded at the first time
34
+ * @property {Array.<string>} children Children column ID
35
+ * @property {string=} name="" Name defined for specific stack
36
+ */
37
+
28
38
  /** @constructor
29
39
  * @extends {GridPlugin}
30
40
  */
@@ -185,7 +195,9 @@ ColumnStackPlugin.prototype.config = function (options) {
185
195
  if(!options) { return; }
186
196
 
187
197
  var columns = options["columns"];
188
- if(!columns) { return; }
198
+ if(!columns) {
199
+ columns = [];
200
+ }
189
201
 
190
202
  var i, len = columns.length;
191
203
  for(i = 0; i < len; ++i) {
@@ -203,6 +215,19 @@ ColumnStackPlugin.prototype.config = function (options) {
203
215
  spreading: columnStack.spreading === true,
204
216
  collapsed: columnStack.collapsed !== false
205
217
  };
218
+ } else if (columnStack.stacks && columnStack.stacks.length) {
219
+ var stackLen = columnStack.stacks.length;
220
+ for(i = 0; i < stackLen; i++){
221
+ var stackConfig = columnStack.stacks[i];
222
+ sid = stackConfig.id || this._generateStackId();
223
+ if(stackConfig.collapsed == null){
224
+ stackConfig.collapsed = true;
225
+ }
226
+ if(stackConfig.spreading == null){
227
+ stackConfig.spreading = false;
228
+ }
229
+ stacks[sid] = stackConfig;
230
+ }
206
231
  }
207
232
  } else {
208
233
  var column, stackOpt;
@@ -231,6 +256,7 @@ ColumnStackPlugin.prototype.config = function (options) {
231
256
  }
232
257
 
233
258
  if(this._initializedGrid) {
259
+ this.removeAllStacks(false);
234
260
  for(sid in stacks) {
235
261
  this.stackColumns(stacks[sid].colRefs, sid, stacks[sid]);
236
262
  }
@@ -250,27 +276,32 @@ ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
250
276
  if (this._columnStack != null) {
251
277
  obj.columnStack = this._columnStack;
252
278
  } else {
253
- var columns = obj.columns;
254
- if (!columns) {
255
- columns = obj.columns = [];
256
- }
257
-
258
- var len = this.getColumnCount();
259
- for (var i = 0; i < len; ++i) {
260
- var column = columns[i];
261
- if (!column) {
262
- column = columns[i] = {};
263
- }
264
-
265
- var stackOpt = this._getColumnStackOptions(i);
266
- if (!stackOpt) continue;
267
-
268
- column.stack = {
269
- id: stackOpt.stackId,
270
- spreading: stackOpt.spreading,
271
- collapsed: stackOpt.collapsed
279
+ var stacks = this._stacks;
280
+ var stackOptions = [];
281
+
282
+ for (var stackKey in stacks) {
283
+ var stackOption = stacks[stackKey];
284
+ var stackConfigObj = {
285
+ id: stackOption.stackId,
286
+ children: this.getStackMemberIds(stackOption.stackId)
272
287
  };
288
+ var name = stackOption.name;
289
+ var collapsed = stackOption.collapsed;
290
+ var spreading = stackOption.spreading;
291
+ if (name) {
292
+ stackConfigObj.name = name;
293
+ }
294
+ if (collapsed !== true) {
295
+ stackConfigObj.collapsed = collapsed;
296
+ }
297
+ if (spreading !== false) {
298
+ stackConfigObj.spreading = spreading;
299
+ }
300
+ stackOptions.push(stackConfigObj);
273
301
  }
302
+
303
+ obj.columnStack = {};
304
+ obj.columnStack.stacks = stackOptions;
274
305
  }
275
306
 
276
307
  return obj;
@@ -280,6 +311,7 @@ ColumnStackPlugin.prototype.getConfigObject = function (gridOptions) {
280
311
  */
281
312
  ColumnStackPlugin.prototype._afterInit = function () {
282
313
  if(this._pendingStacks) {
314
+ this.removeAllStacks(false);
283
315
  for(var sid in this._pendingStacks) {
284
316
  var stackOpt = this._pendingStacks[sid];
285
317
  this.stackColumns(stackOpt.colRefs, sid, stackOpt);
@@ -776,6 +808,10 @@ ColumnStackPlugin.prototype.getStackId = function(colIndex) {
776
808
  * @return {boolean} Return true if all of the given columns is stacked together
777
809
  */
778
810
  ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options, sort) {
811
+ if(options.children && options.children.length > 1) {
812
+ colRefs = this.getColumnIndicesByColumnIds(options.children);
813
+ }
814
+
779
815
  if(!colRefs) {
780
816
  colRefs = this._getSelectedColumns();
781
817
  }
@@ -815,6 +851,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options, s
815
851
  // Collecting data
816
852
  var stack = {};
817
853
  stack.stackId = sid;
854
+ stack.name = options.name || "";
818
855
  stack.spreading = options.spreading === true;
819
856
  if(stack.spreading) {
820
857
  activeIndex = colRefs[len - 1];
@@ -845,6 +882,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options, s
845
882
  csp.selectSingleColumn(activeIndex);
846
883
  }
847
884
  }
885
+
848
886
  this._stacks[sid] = stack;
849
887
 
850
888
  var cfp = this._getPlugin("ColumnFilterPlugin");
@@ -1606,6 +1644,36 @@ ColumnStackPlugin.prototype.reorderStackColumns = function(colRefs, stackId) {
1606
1644
 
1607
1645
  };
1608
1646
 
1647
+ /** @public
1648
+ * @description Set stack name to a stack
1649
+ * @param {string} stackId
1650
+ * @param {string} name
1651
+ */
1652
+ ColumnStackPlugin.prototype.setStackName = function(stackId, name) {
1653
+ if(stackId !== null) {
1654
+ var stack = this._stacks[stackId];
1655
+ if(stack){
1656
+ stack.name = name;
1657
+ }
1658
+ }
1659
+ };
1660
+
1661
+ /** @public
1662
+ * @description Get stack name from specific stack
1663
+ * @param {string} stackId
1664
+ * @return {string} Stack name
1665
+ */
1666
+ ColumnStackPlugin.prototype.getStackName = function(stackId) {
1667
+ var stackName = "";
1668
+ if(stackId !== null) {
1669
+ var stack = this._stacks[stackId];
1670
+ if(stack){
1671
+ stackName = stack.name;
1672
+ }
1673
+ }
1674
+ return stackName;
1675
+ };
1676
+
1609
1677
 
1610
1678
  export default ColumnStackPlugin;
1611
1679
  export { ColumnStackPlugin, ColumnStackPlugin as ColumnStack, ColumnStackPlugin as ColumnStackExtension };
@@ -10,12 +10,13 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
10
10
  declare namespace ColumnStackPlugin {
11
11
 
12
12
  type Options = {
13
- fields: (string)[]|null
13
+ fields: (string)[]|null,
14
+ stacks: (ColumnStackPlugin.StackDefinition)[]|null
14
15
  };
15
16
 
16
17
  type ColumnOptions = {
17
18
  stackId?: string|null,
18
- stack?: (string|StackOptions)|null
19
+ stack?: (string|ColumnStackPlugin.StackOptions)|null
19
20
  };
20
21
 
21
22
  type StackOptions = {
@@ -24,6 +25,14 @@ declare namespace ColumnStackPlugin {
24
25
  collapsed?: boolean|null
25
26
  };
26
27
 
28
+ type StackDefinition = {
29
+ id: string,
30
+ spreading?: boolean|null,
31
+ collapsed?: boolean|null,
32
+ children: (string)[]|null,
33
+ name?: string|null
34
+ };
35
+
27
36
  }
28
37
 
29
38
  declare class ColumnStackPlugin extends GridPlugin {
@@ -90,6 +99,10 @@ declare class ColumnStackPlugin extends GridPlugin {
90
99
 
91
100
  public reorderStackColumns(colRefs: (number|string)[]|null, stackId: string): void;
92
101
 
102
+ public setStackName(stackId: string, name: string): void;
103
+
104
+ public getStackName(stackId: string): string;
105
+
93
106
  }
94
107
 
95
108
  export default ColumnStackPlugin;
package/lib/versions.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "tr-grid-column-grouping": "1.0.24",
13
13
  "tr-grid-column-resizing": "1.0.26",
14
14
  "tr-grid-column-selection": "1.0.25",
15
- "tr-grid-column-stack": "1.0.41",
15
+ "tr-grid-column-stack": "1.0.42",
16
16
  "tr-grid-conditional-coloring": "1.0.57",
17
17
  "tr-grid-content-wrap": "1.0.19",
18
18
  "tr-grid-contextmenu": "1.0.38",
package/package.json CHANGED
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "version": "6.0.12"
48
+ "version": "6.0.13"
49
49
  }