@refinitiv-ui/efx-grid 6.0.79 → 6.0.81

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +1 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +12 -11
  3. package/lib/column-selection-dialog/lib/locale/translation-de.js +2 -1
  4. package/lib/column-selection-dialog/lib/locale/translation-en.js +2 -1
  5. package/lib/column-selection-dialog/lib/locale/translation-ja.js +2 -1
  6. package/lib/column-selection-dialog/lib/locale/translation-zh-hant.js +2 -1
  7. package/lib/column-selection-dialog/lib/locale/translation-zh.js +2 -1
  8. package/lib/column-selection-dialog/themes/base.less +45 -24
  9. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
  10. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  11. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
  12. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  13. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  14. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  15. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  16. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  17. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
  18. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  19. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
  20. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  21. package/lib/core/dist/core.js +26 -1
  22. package/lib/core/dist/core.min.js +1 -1
  23. package/lib/core/es6/data/DataView.d.ts +4 -0
  24. package/lib/core/es6/data/DataView.js +25 -0
  25. package/lib/core/es6/grid/Core.js +1 -1
  26. package/lib/grid/index.js +1 -1
  27. package/lib/tr-grid-checkbox/es6/Checkbox.js +4 -4
  28. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +1 -2
  29. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +12 -42
  30. package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +1 -2
  31. package/lib/tr-grid-contextmenu/es6/ContextMenu.js +99 -132
  32. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +3 -1
  33. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +181 -85
  34. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +2 -0
  35. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +46 -13
  36. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +1 -2
  37. package/lib/tr-grid-row-selection/es6/RowSelection.js +28 -51
  38. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -4
  39. package/lib/tr-grid-textformatting/es6/TextFormatting.js +1 -3
  40. package/lib/types/es6/ColumnSelection.d.ts +1 -2
  41. package/lib/types/es6/ContextMenu.d.ts +1 -2
  42. package/lib/types/es6/Core/data/DataView.d.ts +4 -0
  43. package/lib/types/es6/RealtimeGrid/Grid.d.ts +36 -1
  44. package/lib/types/es6/RowFiltering.d.ts +3 -1
  45. package/lib/types/es6/RowGrouping.d.ts +2 -0
  46. package/lib/types/es6/RowSelection.d.ts +1 -2
  47. package/lib/types/es6/TextFormatting.d.ts +1 -5
  48. package/lib/versions.json +10 -10
  49. package/package.json +2 -2
@@ -89,8 +89,10 @@ The expression can take various forms:<br>
89
89
  * @property {string=} fieldDataType data type of column
90
90
  * @property {string=} lang dialog language
91
91
  * @property {Function=} rawDataAccessor In case you have custom data type for the specified field, data getter is needed to retrieve raw value for filtering
92
- * @property {Function=} formattedDataAccessor In case you have custom data type for the specified field, data getter is needed to retrieve formatted value for display
93
- * @property {Function=} sortLogic sorting function for sort autosuggest list in filter dialog, the values for comparison are raw value not a formatted value
92
+ * @property {Function=} formattedDataAccessor This function will be called on each raw data, allowing formatting data to be displayed on the filter item list
93
+ * @property {Function=} sortLogic This function for sorting filter item list in the dialog. The comparison will perform on raw values, and not formatted values
94
+ * @property {Array=} itemList Item list to be shown in the dialog. If this is not specified, the list will be collected from existing data on the grid
95
+ * @property {Array=} additionalItems Additional items to be put on the itemList
94
96
  */
95
97
 
96
98
  /** @typedef {Object} RowFilteringPlugin~Options
@@ -1662,109 +1664,206 @@ RowFilteringPlugin.prototype._getDataTable = function (dv) {
1662
1664
  return dt;
1663
1665
  };
1664
1666
  /** @public
1667
+ * @deprecated
1665
1668
  * @ignore
1666
1669
  * @param {string} field A field name for getting raw value from row data
1667
1670
  * @param {Function=} formatter A formatter that takes row data, retrieves data, and modified the data for display.
1668
1671
  * @param {string=} fmtField A field name to be used instead of formatter for getting formatted value
1669
1672
  * @param {Function=} rawDataAccessor Data getter to retrieve raw value
1670
1673
  * @param {Function=} formattedDataAccessor Data getter to retrieve formatted value. This paramter will override formatted and fmtField parameters
1671
- * @param {Function=} filterFuncs
1674
+ * @param {Array.<Function>=} filterFuncs
1672
1675
  * @param {Object=} selectedItems
1673
1676
  * @return {Object} Object that maps formatted value to array of raw values
1674
1677
  */
1675
1678
 
1676
1679
 
1677
1680
  RowFilteringPlugin.prototype.getUniqueValues = function (field, formatter, fmtField, rawDataAccessor, formattedDataAccessor, filterFuncs, selectedItems) {
1681
+ var dialogConfig = {
1682
+ rawDataAccessor: rawDataAccessor,
1683
+ formattedDataAccessor: formattedDataAccessor
1684
+ };
1685
+ return this._getUniqueValues(field, dialogConfig, formatter, filterFuncs, selectedItems);
1686
+ };
1687
+ /** @private
1688
+ * @param {*} formattedVal
1689
+ * @param {*} rawVal
1690
+ * @returns {string}
1691
+ */
1692
+
1693
+
1694
+ var _valueToString = function _valueToString(formattedVal, rawVal) {
1695
+ if (typeof formattedVal === "string") {
1696
+ return formattedVal;
1697
+ }
1698
+
1699
+ if (formattedVal) {
1700
+ if (_typeof(formattedVal) != "object") {
1701
+ return rawVal + "";
1702
+ } else if (formattedVal instanceof Date) {
1703
+ return formattedVal.toLocaleString("en-GB");
1704
+ } else {
1705
+ // Object type cannot be converted to string
1706
+ return "";
1707
+ }
1708
+ } else if (formattedVal === 0) {
1709
+ return "0";
1710
+ } else if (formattedVal === false) {
1711
+ return "false";
1712
+ }
1713
+
1714
+ return "";
1715
+ };
1716
+ /** @private
1717
+ * @param {Object} selectedItems
1718
+ * @param {string} formattedVal
1719
+ * @param {Object} row
1720
+ * @param {!Array.<Function>} filterFuncs A selector function that execute on each item to determine the selection
1721
+ */
1722
+
1723
+
1724
+ var _collectSelectedItem = function _collectSelectedItem(selectedItems, formattedVal, row, filterFuncs) {
1725
+ if (filterFuncs) {
1726
+ if (!selectedItems[formattedVal]) {
1727
+ for (var i = filterFuncs.length; --i >= 0;) {
1728
+ if (!filterFuncs[i](row)) {
1729
+ return;
1730
+ }
1731
+ }
1732
+
1733
+ selectedItems[formattedVal] = true;
1734
+ }
1735
+ }
1736
+ };
1737
+ /** @private
1738
+ * @param {Object} uniqueValues
1739
+ * @param {string} formattedVal
1740
+ * @param {*} rawVal
1741
+ */
1742
+
1743
+
1744
+ var _collectUniqueValue = function _collectUniqueValue(uniqueValues, formattedVal, rawVal) {
1745
+ var rawValues = uniqueValues[formattedVal];
1746
+
1747
+ if (rawValues) {
1748
+ if (rawValues.indexOf(rawVal) < 0) {
1749
+ // Check for unique raw values
1750
+ rawValues.push(rawVal);
1751
+ }
1752
+ } else {
1753
+ // The first unique formatted value detected
1754
+ uniqueValues[formattedVal] = [rawVal];
1755
+ }
1756
+ };
1757
+ /** @private
1758
+ * @param {string} field A field name for getting raw value from row data
1759
+ * @param {!Object} dialogConfig
1760
+ * @param {Function} formatter A formatter that takes row data, retrieves data, and modified the data for display.
1761
+ * @param {Array.<Function>} filterFuncs A selector function that execute on each item to determine the selection
1762
+ * @param {Object} selectedItems
1763
+ * @return {Object} Object that maps formatted value to array of raw values
1764
+ */
1765
+
1766
+
1767
+ RowFilteringPlugin.prototype._getUniqueValues = function (field, dialogConfig, formatter, filterFuncs, selectedItems) {
1678
1768
  if (!field) {
1679
1769
  return null;
1680
1770
  }
1681
1771
 
1682
- var dvs = this._getAvailableDataViews();
1683
-
1684
- var dts = dvs.map(this._getDataTable);
1685
- var tblCount = dts.length;
1772
+ var rawDataAccessor = dialogConfig.rawDataAccessor || null;
1773
+ var formattedDataAccessor = dialogConfig.formattedDataAccessor || null;
1774
+ var userItemList = dialogConfig.itemList;
1686
1775
  var uniqueValues = {};
1776
+ var formattedVal = null;
1777
+ var rawVal = null;
1687
1778
 
1688
- for (var t = 0; t < tblCount; ++t) {
1689
- var rows = dts[t].getAllRowData();
1690
- var rowCount = rows.length;
1779
+ if (!Array.isArray(userItemList)) {
1780
+ userItemList = null;
1691
1781
 
1692
- for (var r = 0; r < rowCount; ++r) {
1693
- var row = rows[r];
1782
+ var dvs = this._getAvailableDataViews();
1694
1783
 
1695
- if (this._rowGetter) {
1696
- row = this._rowGetter(row);
1697
- }
1784
+ var dts = dvs.map(this._getDataTable);
1785
+ var tblCount = dts.length;
1698
1786
 
1699
- if (this._rowTransform) {
1700
- row = this._rowTransform(row);
1701
- }
1787
+ for (var t = 0; t < tblCount; ++t) {
1788
+ var rows = dts[t].getAllRowData();
1789
+ var rowCount = rows.length;
1702
1790
 
1703
- var fieldVal = row[field];
1704
- var rawVal = fieldVal;
1791
+ for (var r = 0; r < rowCount; ++r) {
1792
+ var row = rows[r];
1705
1793
 
1706
- if (rawDataAccessor) {
1707
- rawVal = rawDataAccessor(rawVal);
1708
- }
1794
+ if (this._rowGetter) {
1795
+ row = this._rowGetter(row);
1796
+ }
1709
1797
 
1710
- if (!rawVal) {
1711
- // Only valid values are accepted
1712
- if (rawVal !== 0 && rawVal !== false) {
1713
- continue;
1798
+ if (this._rowTransform) {
1799
+ row = this._rowTransform(row);
1714
1800
  }
1715
- }
1716
1801
 
1717
- var formattedVal = rawVal;
1802
+ var fieldVal = row[field];
1803
+ rawVal = fieldVal;
1718
1804
 
1719
- if (formattedDataAccessor) {
1720
- formattedVal = formattedDataAccessor(fieldVal); // The function takes data value
1721
- } else if (formatter) {
1722
- formattedVal = formatter(row); // The function takes row data
1723
- } else if (fmtField) {
1724
- formattedVal = row[fmtField];
1725
- }
1805
+ if (rawDataAccessor) {
1806
+ rawVal = rawDataAccessor(rawVal);
1807
+ }
1726
1808
 
1727
- if (typeof formattedVal != "string") {
1728
- if (formattedVal) {
1729
- if (_typeof(formattedVal) != "object") {
1730
- formattedVal = rawVal + "";
1731
- } else if (formattedVal instanceof Date) {
1732
- formattedVal = formattedVal.toLocaleString("en-GB");
1733
- } else {
1734
- // Object type cannot be converted to string
1735
- formattedVal = "";
1809
+ if (!rawVal) {
1810
+ // Only valid values are accepted
1811
+ if (rawVal !== 0 && rawVal !== false) {
1812
+ continue;
1736
1813
  }
1737
- } else if (formattedVal === 0) {
1738
- formattedVal = "0";
1739
- } else if (formattedVal === false) {
1740
- formattedVal = "false";
1741
1814
  }
1742
- }
1743
1815
 
1744
- if (!formattedVal) {
1745
- continue;
1746
- }
1816
+ formattedVal = rawVal;
1747
1817
 
1748
- if (filterFuncs) {
1749
- if (!selectedItems[formattedVal]) {
1750
- selectedItems[formattedVal] = RowFilteringPlugin._getFilteredValue(row, filterFuncs);
1818
+ if (formattedDataAccessor) {
1819
+ formattedVal = formattedDataAccessor(fieldVal); // The function takes data value
1820
+ } else if (formatter) {
1821
+ formattedVal = formatter(row); // The function takes row data
1751
1822
  }
1752
- }
1753
1823
 
1754
- var rawValues = uniqueValues[formattedVal];
1824
+ formattedVal = _valueToString(formattedVal, rawVal);
1755
1825
 
1756
- if (rawValues) {
1757
- if (rawValues.indexOf(rawVal) < 0) {
1758
- // Check for unique raw values
1759
- rawValues.push(rawVal);
1826
+ if (formattedVal) {
1827
+ _collectSelectedItem(selectedItems, formattedVal, row, filterFuncs);
1828
+
1829
+ _collectUniqueValue(uniqueValues, formattedVal, rawVal);
1760
1830
  }
1761
- } else {
1762
- // The first unique formatted value detected
1763
- uniqueValues[formattedVal] = [rawVal];
1764
1831
  }
1765
1832
  }
1766
1833
  }
1767
1834
 
1835
+ var additionalItems = dialogConfig.additionalItems;
1836
+
1837
+ if (Array.isArray(additionalItems)) {
1838
+ if (userItemList) {
1839
+ userItemList = userItemList.concat(additionalItems);
1840
+ } else {
1841
+ userItemList = additionalItems;
1842
+ }
1843
+ }
1844
+
1845
+ var dummyRow = {};
1846
+ var userItemCount = userItemList ? userItemList.length : 0;
1847
+
1848
+ for (var i = 0; i < userItemCount; ++i) {
1849
+ rawVal = dummyRow[field] = userItemList[i];
1850
+ formattedVal = rawVal;
1851
+
1852
+ if (formattedDataAccessor) {
1853
+ formattedVal = formattedDataAccessor(rawVal);
1854
+ } else if (formatter) {
1855
+ formattedVal = formatter(dummyRow);
1856
+ }
1857
+
1858
+ formattedVal = _valueToString(formattedVal, rawVal);
1859
+
1860
+ if (formattedVal) {
1861
+ _collectSelectedItem(selectedItems, formattedVal, dummyRow, filterFuncs);
1862
+
1863
+ _collectUniqueValue(uniqueValues, formattedVal, rawVal);
1864
+ }
1865
+ }
1866
+
1768
1867
  return uniqueValues;
1769
1868
  };
1770
1869
  /** @private
@@ -1792,23 +1891,6 @@ RowFilteringPlugin._createDialog = function () {
1792
1891
  };
1793
1892
  /** @private
1794
1893
  * @function
1795
- * @param {Object} rowData
1796
- * @param {!Array.<Function>} filters
1797
- * @returns {boolean}
1798
- */
1799
-
1800
-
1801
- RowFilteringPlugin._getFilteredValue = function (rowData, filters) {
1802
- for (var i = filters.length; --i >= 0;) {
1803
- if (!filters[i](rowData)) {
1804
- return false;
1805
- }
1806
- }
1807
-
1808
- return true;
1809
- };
1810
- /** @private
1811
- * @function
1812
1894
  * @param {Array} exp
1813
1895
  * @param {string} field
1814
1896
  * @param {Function} formatter
@@ -1996,8 +2078,8 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
1996
2078
  var cfo = this._initColumnFilterOption(colIndex); // colData["rowFiltering"]["filterOption"]
1997
2079
 
1998
2080
 
1999
- var rawDataAccessor = cfo._rawDataAccessor = dialogConfig.rawDataAccessor || null;
2000
- var formattedDataAccessor = cfo._formattedDataAccessor = dialogConfig.formattedDataAccessor || null;
2081
+ cfo._rawDataAccessor = dialogConfig.rawDataAccessor || null;
2082
+ cfo._formattedDataAccessor = dialogConfig.formattedDataAccessor || null;
2001
2083
  var sortLogic = dialogConfig.sortLogic || null; // Populate data for filter dialog based on existing states
2002
2084
 
2003
2085
  var formatter = this._getFormatter(colIndex);
@@ -2025,7 +2107,9 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
2025
2107
  }
2026
2108
 
2027
2109
  var selectedItems = {};
2028
- var uniqueValues = cfo.uniqueValues = this.getUniqueValues(field, formatter, "", rawDataAccessor, formattedDataAccessor, filterFuncs, selectedItems);
2110
+
2111
+ var uniqueValues = cfo.uniqueValues = this._getUniqueValues(field, dialogConfig, formatter, filterFuncs, selectedItems);
2112
+
2029
2113
  var keys = Object.keys(uniqueValues);
2030
2114
 
2031
2115
  if (sortLogic) {
@@ -2136,6 +2220,18 @@ RowFilteringPlugin._overrideConfig = function (config, userConfig) {
2136
2220
  // Allow null value
2137
2221
  config.sortLogic = sortLogic;
2138
2222
  }
2223
+
2224
+ var itemList = userConfig["itemList"];
2225
+
2226
+ if (itemList != null) {
2227
+ config.itemList = itemList;
2228
+ }
2229
+
2230
+ var additionalItems = userConfig["additionalItems"];
2231
+
2232
+ if (additionalItems != null) {
2233
+ config.additionalItems = additionalItems;
2234
+ }
2139
2235
  };
2140
2236
  /** @private
2141
2237
  * @param {number} colIndex
@@ -87,6 +87,8 @@ declare class RowGroupingPlugin extends GridPlugin {
87
87
 
88
88
  public setDefaultCollapse(collapse: boolean): void;
89
89
 
90
+ public setGroupColor(groupRef: string, groupColor: string): void;
91
+
90
92
  public getDefaultCollapse(): boolean;
91
93
 
92
94
  public sortGroups(): void;
@@ -25,7 +25,7 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
25
25
  * @property {(boolean|number|Array.<number>)=} indentSize Use array to define indent for each group level. Use boolean to turn on or off indentation. Use number to define incremental step.
26
26
  * @property {boolean=} colorTag If not specified, the color tag will be disabled when using extension without halo theme.
27
27
  * @property {Object=} predefinedColors Predefined color object map for color tag
28
- * @property {Object=} groupColors The object map of group ID and predefined color.
28
+ * @property {Object=} groupColors - The object map of group ID and predefined color.
29
29
  * @property {boolean=} defaultCollapse=false Collapsing groups by default when a group is created
30
30
  * @property {Function=} clicked=null Event handler when user clicks on arrows or cells
31
31
  * @property {Function=} groupAdded=null Event handler
@@ -1012,6 +1012,25 @@ RowGroupingPlugin.prototype.setDefaultCollapse = function(collapse) {
1012
1012
  }
1013
1013
  };
1014
1014
 
1015
+ /** @public
1016
+ * @param {string} groupRef
1017
+ * @param {string} groupColor color name from predefinedColors
1018
+ */
1019
+ RowGroupingPlugin.prototype.setGroupColor = function(groupRef, groupColor) {
1020
+ var dv = this.getDataView();
1021
+ if(!dv) {
1022
+ return;
1023
+ }
1024
+ var grp = dv.getGroup(groupRef);
1025
+ if(grp) {
1026
+ grp.setGroupColor(groupColor);
1027
+ var host = this._hosts[0];
1028
+ if(host) {
1029
+ host.requestRowRefresh();
1030
+ }
1031
+ }
1032
+ };
1033
+
1015
1034
  /** @public
1016
1035
  * @return {boolean}
1017
1036
  */
@@ -1172,8 +1191,18 @@ RowGroupingPlugin.prototype._onGroupAdded = function (e) {
1172
1191
  newGroup.disableCollapsing();
1173
1192
  }
1174
1193
  }
1175
- this._dispatch("groupAdded", e);
1176
1194
 
1195
+ var groupColors = this._groupColors;
1196
+ var groupColor;
1197
+ if(groupColors) { // Backward compatibility
1198
+ var groupId = newGroup.getGroupId();
1199
+ groupColor = groupColors[groupId];
1200
+ if(groupColor) {
1201
+ newGroup.setGroupColor(groupColor);
1202
+ }
1203
+ }
1204
+
1205
+ this._dispatch("groupAdded", e);
1177
1206
  if (this._autoGroupSorting) {
1178
1207
  if (!this._sortingTimer) {
1179
1208
  this._sortingTimer = setTimeout(this.sortGroups, 100);
@@ -1387,20 +1416,24 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
1387
1416
  indentSize = maxColWidth;
1388
1417
  }
1389
1418
 
1390
- arg.indentSize = indentSize;
1391
-
1392
- if (this._groupColors) {
1393
- // TODO: Need better method to find the first level parent's group id
1394
- var rootGroup = currentGroup ? currentGroup : dataSource.getGroup(rowId); // Slow
1395
- if (curGroupLevel > 1) {
1396
- for (var i = curGroupLevel; i > 1; i--) {
1397
- rootGroup = rootGroup.getDataSource();
1419
+ var groupColor;
1420
+ if(currentGroup.getGroupColor) {
1421
+ groupColor = currentGroup.getGroupColor();
1422
+ } else { // Backward compatibility
1423
+ if (this._groupColors) {
1424
+ // TODO: Need better method to find the first level parent's group id
1425
+ var rootGroup = currentGroup ? currentGroup : dataSource.getGroup(rowId); // Slow
1426
+ if (curGroupLevel > 1) {
1427
+ for (var i = curGroupLevel; i > 1; i--) {
1428
+ rootGroup = rootGroup.getDataSource();
1429
+ }
1398
1430
  }
1431
+ var groupId = rootGroup.getGroupId();
1432
+ groupColor = this._groupColors[groupId];
1399
1433
  }
1400
- var groupId = rootGroup.getGroupId();
1401
- arg.colorTagClass = this._groupColors[groupId];
1402
1434
  }
1403
-
1435
+ arg.colorTagClass = groupColor;
1436
+ arg.indentSize = indentSize;
1404
1437
  if (groupView) {
1405
1438
  rowPainter.applyHeaderStyle(arg);
1406
1439
  this._dispatch(footerRow ? "groupFooterBinding" : "groupHeaderBinding", arg);
@@ -3,8 +3,7 @@ import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
4
  import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
5
5
  import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
- import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
7
- import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
+ import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
7
 
9
8
  declare namespace RowSelectionPlugin {
10
9
 
@@ -3,8 +3,7 @@ import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
4
  import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
5
5
  import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
6
- import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
7
- import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
+ import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
7
  var isMac = isMacFn();
9
8
  /** Fired when selection is changed by mouse down or key press. A change by JavaScript APIs will not trigger this event.
10
9
  * @event RowSelectionPlugin#selectionChanged
@@ -45,7 +44,6 @@ var RowSelectionPlugin = function (options) {
45
44
  t._onBeforeRowRemoved = t._onBeforeRowRemoved.bind(t);
46
45
  t._onReselection = t._onReselection.bind(t);
47
46
  t._onPostSectionDataBinding = t._onPostSectionDataBinding.bind(t);
48
- t._onThemeLoaded = t._onThemeLoaded.bind(t);
49
47
  t._onRowPositionChanged = t._onRowPositionChanged.bind(t);
50
48
  t._updateMenuIcon = t._updateMenuIcon.bind(t);
51
49
 
@@ -131,6 +129,32 @@ RowSelectionPlugin.prototype._timerMenuId = 0;
131
129
  */
132
130
  RowSelectionPlugin.prototype._pendingSelection = null;
133
131
 
132
+ /** @private
133
+ * @return {string}
134
+ */
135
+ RowSelectionPlugin._styleCalculator = function() {
136
+ var styles = [
137
+ ".row-selection-menu", [
138
+ "position: absolute;",
139
+ "background-color: var(--grid-column-menu-icon-bgcolor);",
140
+ "color: var(--grid-column-menu-icon-color);",
141
+ "z-index: 1;",
142
+ "cursor: pointer;",
143
+ "text-align: center;",
144
+ "width: 16px;",
145
+ "height: 16px;",
146
+ "padding: 6px;"
147
+ ],
148
+ ".row-selection-menu:hover", [
149
+ "background-color: var(--grid-column-menu-icon-hover-bgcolor);"
150
+ ],
151
+ ".row-selection-menu-inside", [
152
+ "padding: 4px;"
153
+ ]
154
+ ];
155
+ return prettifyCss(styles);
156
+ };
157
+
134
158
  /** @public
135
159
  * @return {string}
136
160
  */
@@ -172,57 +196,10 @@ RowSelectionPlugin.prototype.initialize = function (host, options) {
172
196
  this.config(options);
173
197
 
174
198
  if(this._onMenuClicked) { // use styles menu icon only when want to use icon menu
175
- if(RowSelectionPlugin._stylePromise) {
176
- RowSelectionPlugin._applyThemeColor(host);
177
- } else {
178
- RowSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
179
- RowSelectionPlugin._stylePromise.then(this._onThemeLoaded).catch(this._onThemeLoaded);
180
- }
199
+ this.applyStaticStyles(RowSelectionPlugin._styleCalculator);
181
200
  }
182
-
183
201
  };
184
202
 
185
- /** @private
186
- */
187
- RowSelectionPlugin.prototype._onThemeLoaded = function() {
188
- if(!RowSelectionPlugin._styles) {
189
- var styles = [
190
- ".row-selection-menu", [
191
- "position: absolute;",
192
- "background-color: var(--grid-column-menu-icon-bgcolor);",
193
- "color: var(--grid-column-menu-icon-color);",
194
- "z-index: 1;",
195
- "cursor: pointer;",
196
- "text-align: center;",
197
- "width: 16px;",
198
- "height: 16px;",
199
- "padding: 6px;"
200
- ],
201
- ".row-selection-menu:hover", [
202
- "background-color: var(--grid-column-menu-icon-hover-bgcolor);"
203
- ],
204
- ".row-selection-menu-inside", [
205
- "padding: 4px;"
206
- ]
207
- ];
208
- RowSelectionPlugin._styles = prettifyCss(styles);
209
- }
210
- for(var i = this._hosts.length; --i >= 0;) {
211
- RowSelectionPlugin._applyThemeColor(this._hosts[i]);
212
- }
213
- };
214
- /** @private
215
- * @param {Object} grid core grid instance
216
- */
217
- RowSelectionPlugin._applyThemeColor = function(grid) {
218
- if(!grid || grid._rowSelectionStyles) {
219
- return;
220
- }
221
- if(RowSelectionPlugin._styles) {
222
- grid._rowSelectionStyles = true; // Prevent loading the same style twice
223
- injectCss(RowSelectionPlugin._styles, grid.getParent());
224
- }
225
- };
226
203
  /** @public
227
204
  * @param {Object=} host core grid instance
228
205
  */
@@ -24,10 +24,7 @@ declare namespace TextFormattingPlugin {
24
24
  formatLogic?: ((...params: any[]) => any)|null
25
25
  };
26
26
 
27
- type ColumnOptions = {
28
- formatType?: (string|TextFormattingPlugin.FormatOptions)|null,
29
- autoTextFormatting?: boolean|null
30
- };
27
+ type ColumnOptions = TextFormattingPlugin.FormatOptions|null;
31
28
 
32
29
  type GridOptions = {
33
30
  autoTextFormatting?: boolean|null
@@ -40,10 +40,8 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
40
40
  * @property {Function=} formatLogic=null If specified all default formatting will be prevented and replaced by the given function. This should be used when the column has custom rendering. The function must retrieve, format, and insert the data with the provided arguments (i.e., TextFormattingPlugin~FormatLogicArguments).
41
41
  */
42
42
 
43
- /** @typedef {Object} TextFormattingPlugin~ColumnOptions
43
+ /** @typedef {TextFormattingPlugin~FormatOptions} TextFormattingPlugin~ColumnOptions
44
44
  * @description Available options that can be specified on the column configuration object
45
- * @property {(string|TextFormattingPlugin~FormatOptions)=} formatType Format options or a shorthand text (e.g. number, scaled, percent, and datetime).
46
- * @property {boolean=} autoTextFormatting=true If disabled, the extension's automatic formatting will not be triggered, including `formatLogic`
47
45
  */
48
46
 
49
47
  /** @typedef {Object} TextFormattingPlugin~GridOptions
@@ -1,8 +1,7 @@
1
1
  import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
2
  import { Dom } from "../../tr-grid-util/es6/Dom.js";
3
3
  import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
- import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
5
- import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
+ import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
5
 
7
6
  declare namespace ColumnSelectionPlugin {
8
7
 
@@ -2,8 +2,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
2
2
  import Ext from "../../tr-grid-util/es6/Ext.js";
3
3
  import MenuEventAPI from "./MenuEventAPI.js";
4
4
  import PopupMenu from "./PopupMenu.js";
5
- import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
- import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
5
+ import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
7
6
  import CellPainter from "../../tr-grid-util/es6/CellPainter.js";
8
7
 
9
8
  declare namespace ContextMenuPlugin {
@@ -198,6 +198,10 @@ declare class DataView extends EventDispatcher {
198
198
 
199
199
  public disableCollapsing(bool?: boolean|null): void;
200
200
 
201
+ public setGroupColor(groupColor: string): void;
202
+
203
+ public getGroupColor(): string;
204
+
201
205
  public getVisibleRowCount(): number;
202
206
 
203
207
  public isRowDataInGroup(rowData: any, groupID?: string|null): boolean;
@@ -36,6 +36,41 @@ declare namespace Grid {
36
36
  productId?: string|null
37
37
  };
38
38
 
39
+ type GridConfigObject = ExtensionOptions & {
40
+ columns?: (ColumnDefinition.Options|string)[]|null,
41
+ defaultColumnOptions?: ColumnDefinition.Options|null,
42
+ rows?: (RowDefinition.Options)[]|null,
43
+ scrollbar?: boolean|null,
44
+ linearWheelScrolling?: boolean|null,
45
+ stepScroll?: boolean|null,
46
+ autoHideScrollbar?: boolean|null,
47
+ pageSize?: string|null,
48
+ rowHeight?: number|null,
49
+ headerRowHeight?: number|null,
50
+ rowHighlighting?: boolean|null,
51
+ autoLayoutUpdate?: (boolean|number)|null,
52
+ rowVirtualization?: boolean|null,
53
+ columnVirtualization?: boolean|null,
54
+ topFreezingCount?: (number|null|boolean)|null,
55
+ bottomFreezingCount?: (number|null)|null,
56
+ borders?: boolean|null,
57
+ gridlines?: boolean|null,
58
+ verticalLines?: boolean|null,
59
+ contentVerticalLines?: boolean|null,
60
+ horizontalLines?: boolean|null,
61
+ contentRightPadding?: number|null,
62
+ contentBottomPadding?: number|null,
63
+ dataConflationRate?: number|null,
64
+ textSelect?: boolean|null,
65
+ lang?: string|null,
66
+ formulaEngine?: boolean|null,
67
+ adcPollingInterval?: number|null,
68
+ fieldCaching?: boolean|null,
69
+ timeSeriesExpansion?: boolean|null,
70
+ childDataField?: string|null,
71
+ sorting?: SortableTitlePlugin.Options|null
72
+ };
73
+
39
74
  type GridOptions = ExtensionOptions & {
40
75
  columns?: (ColumnDefinition.Options|string)[]|null,
41
76
  defaultColumnOptions?: ColumnDefinition.Options|null,
@@ -130,7 +165,7 @@ declare class Grid extends EventDispatcher {
130
165
 
131
166
  public initialize(gridOption?: Grid.GridOptions|null): void;
132
167
 
133
- public getConfigObject(gridOptions?: any): any;
168
+ public getConfigObject(gridOptions?: any): Grid.GridConfigObject;
134
169
 
135
170
  public setLocale(lang: string): void;
136
171