@refinitiv-ui/efx-grid 6.0.32 → 6.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/dist/core.js +86 -11
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +4 -0
- package/lib/core/es6/grid/Core.js +27 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +1 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +29 -5
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +521 -179
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +14 -13
- package/lib/rt-grid/es6/RowDefinition.js +1 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +58 -30
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +35 -12
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +2 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.js +15 -0
- package/lib/tr-grid-util/es6/Util.d.ts +3 -0
- package/lib/tr-grid-util/es6/Util.js +15 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +12 -2
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +170 -47
- package/lib/types/es6/ColumnGrouping.d.ts +4 -0
- package/lib/types/es6/ColumnSelection.d.ts +2 -0
- package/lib/types/es6/ColumnStack.d.ts +2 -0
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +6 -2
- package/lib/types/es6/RowDragging.d.ts +23 -1
- package/lib/types/es6/StatisticsRow.d.ts +25 -25
- package/lib/versions.json +3 -3
- package/package.json +1 -1
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -2337,7 +2337,7 @@ Grid.prototype.removeRow = function(rowRef) {
|
|
2337
2337
|
if(this._mainGrid) {
|
2338
2338
|
return this._mainGrid.removeRow(this._getRowId(rowRef));
|
2339
2339
|
}
|
2340
|
-
var rowDef = this.
|
2340
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2341
2341
|
if(rowDef) {
|
2342
2342
|
if(!rowDef.isAutoGenerated()) { // Users cannot remove auto-generated row by themselves
|
2343
2343
|
this._removeRow(rowDef);
|
@@ -2368,7 +2368,7 @@ Grid.prototype.removeRows = function(rowRefs) {
|
|
2368
2368
|
|
2369
2369
|
// Verify user input
|
2370
2370
|
for(i = 0; i < len; ++i) {
|
2371
|
-
rowDef = this.
|
2371
|
+
rowDef = this._getRowDefinitionByRef(rowRefs[i]);
|
2372
2372
|
if(rowDef) {
|
2373
2373
|
if(!rowDef.isAutoGenerated()) {
|
2374
2374
|
rowDefs.push(rowDef);
|
@@ -2504,7 +2504,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2504
2504
|
this._mainGrid.setRic(this._toRowId(rowRef), str);
|
2505
2505
|
return;
|
2506
2506
|
}
|
2507
|
-
var rowDef = this.
|
2507
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2508
2508
|
if(rowDef) {
|
2509
2509
|
options = options || {};
|
2510
2510
|
var newChain = false;
|
@@ -2539,7 +2539,7 @@ Grid.prototype.setRic = function(rowRef, str, options) {
|
|
2539
2539
|
* @param {Grid~RowReference} rowRef
|
2540
2540
|
*/
|
2541
2541
|
Grid.prototype.unlinkChain = function(rowRef) {
|
2542
|
-
var rowDef = this.
|
2542
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2543
2543
|
if(!rowDef) {
|
2544
2544
|
return;
|
2545
2545
|
}
|
@@ -2718,7 +2718,8 @@ Grid.prototype.getRowType = function(rowRef) {
|
|
2718
2718
|
var rowDef = this.getRowDefinition(rowRef);
|
2719
2719
|
return rowDef ? rowDef.getType() : "";
|
2720
2720
|
};
|
2721
|
-
/**
|
2721
|
+
/** Get RowDefinition object by either number or row id
|
2722
|
+
* @public
|
2722
2723
|
* @param {number|string} rowRef Row index as shown in the view or row id (string)
|
2723
2724
|
* @return {RowDefinition}
|
2724
2725
|
*/
|
@@ -2748,7 +2749,7 @@ Grid.prototype._getRowDefinitionById = function(rowId) {
|
|
2748
2749
|
* @param {Grid~RowReference} rowRef
|
2749
2750
|
* @return {RowDefinition}
|
2750
2751
|
*/
|
2751
|
-
Grid.prototype.
|
2752
|
+
Grid.prototype._getRowDefinitionByRef = function(rowRef) {
|
2752
2753
|
if(rowRef instanceof RowDefinition) {
|
2753
2754
|
if(rowRef.getRowId()) { // The row may have been removed from the grid
|
2754
2755
|
return /** @type{!RowDefinition} */(rowRef);
|
@@ -2852,7 +2853,7 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
2852
2853
|
* @param {Object} values {"FIELD1": value1, "FIELD2": value2, ...} Use null to remove current row data (not row in the view).
|
2853
2854
|
*/
|
2854
2855
|
Grid.prototype.setRowData = function(rowRef, values) {
|
2855
|
-
var rowDef = this.
|
2856
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2856
2857
|
if(rowDef) {
|
2857
2858
|
rowDef.setRowData(values);
|
2858
2859
|
}
|
@@ -2864,7 +2865,7 @@ Grid.prototype.setRowData = function(rowRef, values) {
|
|
2864
2865
|
* @param {Object} values
|
2865
2866
|
*/
|
2866
2867
|
Grid.prototype.setStaticRowData = function(rowRef, values) {
|
2867
|
-
var rowDef = this.
|
2868
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2868
2869
|
if(rowDef) {
|
2869
2870
|
rowDef.setStaticRowData(values);
|
2870
2871
|
}
|
@@ -2877,7 +2878,7 @@ Grid.prototype.setStaticRowData = function(rowRef, values) {
|
|
2877
2878
|
* @param {*} value
|
2878
2879
|
*/
|
2879
2880
|
Grid.prototype.setStaticData = function(rowRef, field, value) {
|
2880
|
-
var rowDef = this.
|
2881
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
2881
2882
|
if(rowDef) {
|
2882
2883
|
rowDef.setStaticData(field, value);
|
2883
2884
|
}
|
@@ -3227,7 +3228,7 @@ Grid.prototype._onDataChanged = function(e) {
|
|
3227
3228
|
// The new data update has no row definition, meaning that we have found a new constituent from a chain.
|
3228
3229
|
var subId = rowData[SUB_ID]; // The constituent will share the same sub id as its parent
|
3229
3230
|
if(subId) {
|
3230
|
-
var parentDef = this.
|
3231
|
+
var parentDef = this._getRowDefinitionById(subId);
|
3231
3232
|
if(parentDef && parentDef.getRic() !== rowData["RIC"]) { // TODO: Check for delayed ric
|
3232
3233
|
if(!this._chainMembers) {
|
3233
3234
|
this._chainMembers = {};
|
@@ -3259,7 +3260,7 @@ Grid.prototype._addMemberOfChain = function(rowData) {
|
|
3259
3260
|
for(i = 0; i < len; ++i) {
|
3260
3261
|
rowData = /** @type{!Object} */(rows[i]);
|
3261
3262
|
var subId = rowData[SUB_ID];
|
3262
|
-
var parentDef = this.
|
3263
|
+
var parentDef = this._getRowDefinitionById(subId);
|
3263
3264
|
if(parentDef) {
|
3264
3265
|
var childDef = parentDef.addConstituent(/** @type{string} */(rowData["RIC"]), this._dt);
|
3265
3266
|
if(childDef) {
|
@@ -3405,7 +3406,7 @@ Grid.prototype.getPageCount = function() {
|
|
3405
3406
|
* @param {Grid~RowReference} rowRef
|
3406
3407
|
*/
|
3407
3408
|
Grid.prototype.toggleChain = function(rowRef) {
|
3408
|
-
var rowDef = this.
|
3409
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
3409
3410
|
if(rowDef) {
|
3410
3411
|
rowDef.toggleChain();
|
3411
3412
|
}
|
@@ -3417,7 +3418,7 @@ Grid.prototype.toggleChain = function(rowRef) {
|
|
3417
3418
|
* @return {boolean}
|
3418
3419
|
*/
|
3419
3420
|
Grid.prototype.setClassification = function(rowRef, fields) {
|
3420
|
-
var rowDef = this.
|
3421
|
+
var rowDef = this._getRowDefinitionByRef(rowRef);
|
3421
3422
|
if(rowDef) {
|
3422
3423
|
return this._dt.setSegmentClassification(rowDef.getRowId(), fields);
|
3423
3424
|
}
|
@@ -49,7 +49,7 @@ var ROW_TYPES = {
|
|
49
49
|
*/
|
50
50
|
var RowDefinition = function(rowOptions) {
|
51
51
|
this._changes = {};
|
52
|
-
if(rowOptions && rowOptions["segmentId"]) {
|
52
|
+
if(rowOptions && rowOptions["segmentId"]) { // This row will be classification header row
|
53
53
|
this._dataId = this._rowId = rowOptions["segmentId"];
|
54
54
|
this._autoGenerated = true;
|
55
55
|
this._subSegment = true;
|
@@ -37,6 +37,8 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
37
37
|
|
38
38
|
public getConfigObject(gridOptions?: any): any;
|
39
39
|
|
40
|
+
public renderGroups(): void;
|
41
|
+
|
40
42
|
public addColumnToGroup(column: any, groupId: string, colIndex: number): void;
|
41
43
|
|
42
44
|
public addGroup(groupDef: ColumnGroupingPlugin.GroupDefinition|null): string;
|
@@ -55,6 +57,8 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
55
57
|
|
56
58
|
public setGroupChildren(groupId: string, newChildList: (string)[]|null): boolean;
|
57
59
|
|
60
|
+
public setGroupName(groupId: string, groupName: string): void;
|
61
|
+
|
58
62
|
public getGroupChildren(groupId: string): (string)[]|null;
|
59
63
|
|
60
64
|
public getChildColumnIndices(groupId: string): (number)[]|null;
|
@@ -661,9 +661,10 @@ ColumnGroupingPlugin.prototype._spanGroupHorizontally = function (titleSection)
|
|
661
661
|
}
|
662
662
|
}
|
663
663
|
};
|
664
|
-
/**
|
664
|
+
/** Render all column group headers without affecting cell spans.
|
665
|
+
* @public
|
665
666
|
*/
|
666
|
-
ColumnGroupingPlugin.prototype.
|
667
|
+
ColumnGroupingPlugin.prototype.renderGroups = function () {
|
667
668
|
var hostCount = this._hosts.length;
|
668
669
|
var groupMap = this._visibleGroupMap;
|
669
670
|
for (var i = 0; i < hostCount; ++i) {
|
@@ -671,35 +672,42 @@ ColumnGroupingPlugin.prototype._renderGroups = function () {
|
|
671
672
|
if (!section) {
|
672
673
|
continue;
|
673
674
|
}
|
674
|
-
var arg = {};
|
675
675
|
for (var id in groupMap) {
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
676
|
+
this._renderGroup(groupMap[id], section);
|
677
|
+
}
|
678
|
+
}
|
679
|
+
};
|
680
|
+
/** Render single column group header without affecting cell span.
|
681
|
+
* @private
|
682
|
+
* @param {Object} groupDef
|
683
|
+
* @param {Object} section
|
684
|
+
*/
|
685
|
+
ColumnGroupingPlugin.prototype._renderGroup = function (groupDef, section) {
|
686
|
+
var colIndex = groupDef["colIndex"];
|
687
|
+
if (colIndex == null) {
|
688
|
+
return;
|
689
|
+
}
|
690
|
+
var rowIndex = groupDef["onRow"];
|
691
|
+
var cell = section.getCell(colIndex, rowIndex);
|
692
|
+
if (cell) {
|
693
|
+
// Overide the defaults
|
694
|
+
cell.setStyle("text-align", groupDef["alignment"] || "");
|
695
|
+
cell.setTooltip(ColumnGroupingPlugin._getTooltip(groupDef));
|
696
|
+
cell.setContent(groupDef["name"] || groupDef["title"]);
|
688
697
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
}
|
698
|
+
// Additional cell settings must be removed in the _applyGrouping() method
|
699
|
+
cell.addClass("no-sort");
|
700
|
+
cell.setAttribute("group-id", groupDef["id"]);
|
701
|
+
if (groupDef["legacyRender"]) {
|
702
|
+
// Built-in version if render receive colIndex, cell, groupDefinition as arguments
|
703
|
+
groupDef["legacyRender"](colIndex, cell, groupDef);
|
704
|
+
}
|
705
|
+
if (groupDef["render"]) {
|
706
|
+
var arg = {};
|
707
|
+
arg["cell"] = cell;
|
708
|
+
arg["colIndex"] = colIndex;
|
709
|
+
arg["groupNode"] = groupDef;
|
710
|
+
groupDef["render"](arg);
|
703
711
|
}
|
704
712
|
}
|
705
713
|
};
|
@@ -709,7 +717,7 @@ ColumnGroupingPlugin.prototype._renderGroups = function () {
|
|
709
717
|
*/
|
710
718
|
ColumnGroupingPlugin.prototype._onPostSectionRender = function (e) {
|
711
719
|
if (e.sectionType === "title" && !this._restructuring) {
|
712
|
-
this.
|
720
|
+
this.renderGroups();
|
713
721
|
}
|
714
722
|
};
|
715
723
|
|
@@ -1029,6 +1037,26 @@ ColumnGroupingPlugin.prototype.setGroupChildren = function (groupId, newChildLis
|
|
1029
1037
|
}
|
1030
1038
|
return false;
|
1031
1039
|
};
|
1040
|
+
/** @public
|
1041
|
+
* @param {string} groupId
|
1042
|
+
* @param {string} groupName
|
1043
|
+
*/
|
1044
|
+
ColumnGroupingPlugin.prototype.setGroupName = function (groupId, groupName) {
|
1045
|
+
if (this._groupDefs.setGroupName(groupId, groupName)) {
|
1046
|
+
var groupDef = this._visibleGroupMap[groupId];
|
1047
|
+
if (groupDef) {
|
1048
|
+
groupDef.name = groupName;
|
1049
|
+
var hostCount = this._hosts.length;
|
1050
|
+
for (var i = 0; i < hostCount; ++i) {
|
1051
|
+
var section = this._hosts[i].getSection("title");
|
1052
|
+
if (!section) {
|
1053
|
+
continue;
|
1054
|
+
}
|
1055
|
+
this._renderGroup(groupDef, section);
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
};
|
1032
1060
|
/** @private
|
1033
1061
|
* @param {string} groupId
|
1034
1062
|
* @return {!Array.<string>} The list of immediate valid child, including invisible child groups
|
@@ -119,6 +119,8 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
119
119
|
|
120
120
|
public getActiveColumnField(stackId: string): string;
|
121
121
|
|
122
|
+
public getActiveColumnIndex(stackId: string): number;
|
123
|
+
|
122
124
|
public addStackChild(stackId: string, colRef: number|string|null): void;
|
123
125
|
|
124
126
|
public removeStackChild(stackId: string, colRef: number|string|null): void;
|
@@ -1045,8 +1045,22 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
|
|
1045
1045
|
stack.activeColumn = stack.stackRefs[stack.stackRefs.length - 1]; // Right most column is the active column
|
1046
1046
|
} else {
|
1047
1047
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1048
|
-
if(csp && csp.isEnabled())
|
1049
|
-
|
1048
|
+
if(csp && csp.isEnabled()){
|
1049
|
+
var stackSelection = false;
|
1050
|
+
for(i = 0; i < len; ++i){
|
1051
|
+
colIndex = colRefs[i];
|
1052
|
+
if(colIndex === activeIndex){
|
1053
|
+
continue;
|
1054
|
+
}
|
1055
|
+
if(csp.isSelectedColumn(colIndex)){
|
1056
|
+
stackSelection = true;
|
1057
|
+
break;
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
if(stackSelection) {
|
1061
|
+
csp.selectSingleColumn(activeIndex);
|
1062
|
+
csp.dispatchSelectionChanged();
|
1063
|
+
}
|
1050
1064
|
}
|
1051
1065
|
}
|
1052
1066
|
|
@@ -1113,7 +1127,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1113
1127
|
}
|
1114
1128
|
|
1115
1129
|
var dirty = false;
|
1116
|
-
var selFrom, selLen;
|
1117
1130
|
|
1118
1131
|
for(var sid in stacks) {
|
1119
1132
|
var stack = this._stacks[sid];
|
@@ -1124,8 +1137,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1124
1137
|
|
1125
1138
|
var stackRefs = stack.stackRefs;
|
1126
1139
|
len = stackRefs.length;
|
1127
|
-
selFrom = this._getColumnIndex(stack.stackRefs[0]);
|
1128
|
-
selLen = len - 1;
|
1129
1140
|
|
1130
1141
|
for(i = 0; i < len; ++i) {
|
1131
1142
|
var stackRef = stackRefs[i];
|
@@ -1140,10 +1151,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1140
1151
|
delete this._stacks[sid]; // Remove all reference to the stack
|
1141
1152
|
}
|
1142
1153
|
if(dirty) {
|
1143
|
-
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1144
|
-
if(csp && csp.isEnabled()) {
|
1145
|
-
csp.selectRange(selFrom, selLen);
|
1146
|
-
}
|
1147
1154
|
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1148
1155
|
if(cfp) {
|
1149
1156
|
cfp["refresh"]();
|
@@ -1256,6 +1263,7 @@ ColumnStackPlugin.prototype.swapColumn = function(colRef, swappingIndex) {
|
|
1256
1263
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1257
1264
|
if(csp && csp.isEnabled()) {
|
1258
1265
|
csp.selectSingleColumn(newActiveColumnIndex);
|
1266
|
+
csp.dispatchSelectionChanged();
|
1259
1267
|
}
|
1260
1268
|
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1261
1269
|
if(cfp) {
|
@@ -1513,6 +1521,7 @@ ColumnStackPlugin.prototype._onStackButtonClicked = function(e) {
|
|
1513
1521
|
pos["columnIndices"] = colIndices;
|
1514
1522
|
pos["activeColIndex"] = this._getColumnIndex(colData.activeColumn);
|
1515
1523
|
pos["event"] = e;
|
1524
|
+
pos["stackId"] = colData.stackId;
|
1516
1525
|
|
1517
1526
|
elem.focus();
|
1518
1527
|
this._dispatch("clicked", pos);
|
@@ -1809,15 +1818,29 @@ ColumnStackPlugin.prototype.getStackName = function(stackId) {
|
|
1809
1818
|
*/
|
1810
1819
|
ColumnStackPlugin.prototype.getActiveColumnField = function(stackId) {
|
1811
1820
|
var field = "";
|
1821
|
+
var activeColIndex = this.getActiveColumnIndex(stackId);
|
1822
|
+
if(activeColIndex !== -1){
|
1823
|
+
field = this._getField(activeColIndex);
|
1824
|
+
}
|
1825
|
+
return field;
|
1826
|
+
};
|
1827
|
+
|
1828
|
+
/** @public
|
1829
|
+
* @description Get active column index of specific stack
|
1830
|
+
* @param {string} stackId
|
1831
|
+
* @return {number} active column index
|
1832
|
+
*/
|
1833
|
+
ColumnStackPlugin.prototype.getActiveColumnIndex = function(stackId) {
|
1834
|
+
var activeColIndex = -1;
|
1812
1835
|
if(stackId !== null) {
|
1813
1836
|
var stack = this._stacks[stackId];
|
1814
1837
|
if(stack){
|
1815
|
-
|
1816
|
-
field = this._getField(activeColIndex);
|
1838
|
+
activeColIndex = this._getColumnIndex(stack.activeColumn);
|
1817
1839
|
}
|
1818
1840
|
}
|
1819
|
-
return
|
1841
|
+
return activeColIndex;
|
1820
1842
|
};
|
1843
|
+
//getActiveColumnIndex
|
1821
1844
|
|
1822
1845
|
/** @public
|
1823
1846
|
* @param {string} stackId
|
@@ -562,6 +562,21 @@ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
|
|
562
562
|
}
|
563
563
|
return false;
|
564
564
|
};
|
565
|
+
/** @public
|
566
|
+
* @param {string} groupId
|
567
|
+
* @param {string} groupName
|
568
|
+
* @return {boolean}
|
569
|
+
*/
|
570
|
+
GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
|
571
|
+
var groupDef = this._groupMap[groupId];
|
572
|
+
if(groupDef) {
|
573
|
+
if(groupDef.name !== groupName) {
|
574
|
+
groupDef.name = groupName;
|
575
|
+
return true;
|
576
|
+
}
|
577
|
+
}
|
565
578
|
|
579
|
+
return false;
|
580
|
+
};
|
566
581
|
export default GroupDefinitions;
|
567
582
|
export { GroupDefinitions };
|
@@ -18,6 +18,8 @@ declare function extendObject(obj: any, extender?: any, limiters?: (string)[]|nu
|
|
18
18
|
|
19
19
|
declare function cloneObject(obj: any, limiters?: (string)[]|null): any;
|
20
20
|
|
21
|
+
declare function isEmptyObject(obj: any): boolean;
|
22
|
+
|
21
23
|
declare function arrayToObject(data?: any[]|null, fields?: (string)[]|null): any|null|null;
|
22
24
|
|
23
25
|
declare function extendProperty(obj: any, extender: any, propName: string): void;
|
@@ -49,6 +51,7 @@ export {
|
|
49
51
|
Util,
|
50
52
|
extendObject,
|
51
53
|
cloneObject,
|
54
|
+
isEmptyObject,
|
52
55
|
arrayToObject,
|
53
56
|
extendProperty,
|
54
57
|
extendArrayProperty,
|
@@ -138,6 +138,20 @@ var extendObject = function (obj, extender, limiters) {
|
|
138
138
|
var cloneObject = function (obj, limiters) {
|
139
139
|
return extendObject({}, obj, limiters);
|
140
140
|
};
|
141
|
+
|
142
|
+
/** Check empty object
|
143
|
+
* @public
|
144
|
+
* @function
|
145
|
+
* @param {Object} obj
|
146
|
+
* @return {boolean}=true, if the obj is empty
|
147
|
+
*/
|
148
|
+
var isEmptyObject = function (obj) {
|
149
|
+
for (var key in obj) {
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
return true;
|
153
|
+
};
|
154
|
+
|
141
155
|
/** @public
|
142
156
|
* @param {Array=} data
|
143
157
|
* @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
|
@@ -512,6 +526,7 @@ export {
|
|
512
526
|
Util,
|
513
527
|
extendObject,
|
514
528
|
cloneObject,
|
529
|
+
isEmptyObject,
|
515
530
|
arrayToObject,
|
516
531
|
extendProperty,
|
517
532
|
extendArrayProperty,
|
@@ -1,4 +1,6 @@
|
|
1
|
-
/** @
|
1
|
+
/** @description CollectionDict stores a collection (Array) of any value using a text (string) as a key for accessing the collection.
|
2
|
+
* @constructor
|
3
|
+
*/
|
2
4
|
var CollectionDict = function() {
|
3
5
|
this._dict = {};
|
4
6
|
};
|
@@ -125,9 +127,17 @@ CollectionDict.prototype.getAllItems = function() {
|
|
125
127
|
return null;
|
126
128
|
};
|
127
129
|
/** @public
|
130
|
+
* @param {string=} key
|
128
131
|
* @return {number}
|
129
132
|
*/
|
130
|
-
CollectionDict.prototype.getItemCount = function() {
|
133
|
+
CollectionDict.prototype.getItemCount = function(key) {
|
134
|
+
if(key) {
|
135
|
+
var items = this._dict[key] || null;
|
136
|
+
if(items) {
|
137
|
+
return items.length;
|
138
|
+
}
|
139
|
+
return 0;
|
140
|
+
}
|
131
141
|
return this._count;
|
132
142
|
};
|
133
143
|
/** @public
|