@deephaven/iris-grid 0.6.3-beta.11 → 0.6.4

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 (73) hide show
  1. package/dist/Formatter.d.ts +7 -14
  2. package/dist/Formatter.d.ts.map +1 -1
  3. package/dist/Formatter.js +6 -6
  4. package/dist/Formatter.js.map +1 -1
  5. package/dist/FormatterUtils.d.ts +8 -0
  6. package/dist/FormatterUtils.d.ts.map +1 -1
  7. package/dist/FormatterUtils.js +15 -0
  8. package/dist/FormatterUtils.js.map +1 -1
  9. package/dist/IrisGrid.d.ts +8 -0
  10. package/dist/IrisGrid.d.ts.map +1 -1
  11. package/dist/IrisGrid.js +39 -71
  12. package/dist/IrisGrid.js.map +1 -1
  13. package/dist/IrisGridBottomBar.js +1 -1
  14. package/dist/IrisGridModelUpdater.js +1 -1
  15. package/dist/IrisGridModelUpdater.js.map +1 -1
  16. package/dist/IrisGridTableModel.d.ts.map +1 -1
  17. package/dist/IrisGridTableModel.js +4 -8
  18. package/dist/IrisGridTableModel.js.map +1 -1
  19. package/dist/IrisGridTreeTableModel.js +1 -1
  20. package/dist/IrisGridUtils.js +32 -32
  21. package/dist/IrisGridUtils.js.map +1 -1
  22. package/dist/PendingDataBottomBar.js +1 -1
  23. package/dist/PendingDataBottomBar.js.map +1 -1
  24. package/dist/TableUtils.d.ts.map +1 -1
  25. package/dist/TableUtils.js +3 -1
  26. package/dist/TableUtils.js.map +1 -1
  27. package/dist/ToastBottomBar.js +1 -1
  28. package/dist/ToastBottomBar.js.map +1 -1
  29. package/dist/formatters/DateTimeColumnFormatter.d.ts +8 -7
  30. package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
  31. package/dist/formatters/DateTimeColumnFormatter.js +1 -2
  32. package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
  33. package/dist/formatters/DecimalColumnFormatter.d.ts +55 -59
  34. package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
  35. package/dist/formatters/DecimalColumnFormatter.js +66 -27
  36. package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
  37. package/dist/formatters/IntegerColumnFormatter.d.ts +50 -29
  38. package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
  39. package/dist/formatters/IntegerColumnFormatter.js +60 -19
  40. package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
  41. package/dist/formatters/index.d.ts +7 -7
  42. package/dist/formatters/index.d.ts.map +1 -1
  43. package/dist/formatters/index.js +3 -3
  44. package/dist/formatters/index.js.map +1 -1
  45. package/dist/memoizeClear.js +1 -1
  46. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.d.ts.map +1 -1
  47. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +12 -4
  48. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +1 -1
  49. package/dist/mousehandlers/IrisGridContextMenuHandler.js +1 -1
  50. package/dist/sidebar/AdvancedSettingsMenu.js +2 -2
  51. package/dist/sidebar/CustomColumnBuilder.js +2 -2
  52. package/dist/sidebar/CustomColumnBuilder.js.map +1 -1
  53. package/dist/sidebar/InputEditor.js +1 -1
  54. package/dist/sidebar/RollupRows.js +10 -10
  55. package/dist/sidebar/RollupRows.js.map +1 -1
  56. package/dist/sidebar/SelectDistinctBuilder.js +5 -5
  57. package/dist/sidebar/SelectDistinctBuilder.js.map +1 -1
  58. package/dist/sidebar/TableCsvExporter.d.ts.map +1 -1
  59. package/dist/sidebar/TableCsvExporter.js +10 -3
  60. package/dist/sidebar/TableCsvExporter.js.map +1 -1
  61. package/dist/sidebar/TableSaver.d.ts +1 -0
  62. package/dist/sidebar/TableSaver.d.ts.map +1 -1
  63. package/dist/sidebar/TableSaver.js +20 -1
  64. package/dist/sidebar/TableSaver.js.map +1 -1
  65. package/dist/sidebar/VisibilityOrderingBuilder.js +10 -10
  66. package/dist/sidebar/VisibilityOrderingBuilder.js.map +1 -1
  67. package/dist/sidebar/aggregations/AggregationEdit.js +3 -3
  68. package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -1
  69. package/dist/sidebar/aggregations/AggregationUtils.js +1 -1
  70. package/dist/sidebar/aggregations/Aggregations.js +4 -4
  71. package/dist/sidebar/aggregations/Aggregations.js.map +1 -1
  72. package/dist/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +12 -13
@@ -19,20 +19,13 @@ declare class Formatter {
19
19
  };
20
20
  /**
21
21
  * @param {Array} columnFormattingRules Optional array of column formatting rules
22
- * @param {Object} dateTimeOptions Optional object with DateTime configuration
23
- * @param {string} dateTimeOptions.timeZone Time zone
24
- * @param {boolean} dateTimeOptions.showTimeZone Show time zone in DateTime values
25
- * @param {boolean} dateTimeOptions.showTSeparator Show 'T' separator in DateTime values
26
- * @param {string} dateTimeOptions.defaultDateTimeFormatString DateTime format to use if columnFormats for DateTime isn't set
22
+ * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration
23
+ * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration
24
+ * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration
27
25
  */
28
- constructor(columnFormattingRules?: any[], dateTimeOptions?: {
29
- timeZone: string;
30
- showTimeZone: boolean;
31
- showTSeparator: boolean;
32
- defaultDateTimeFormatString: string;
33
- });
26
+ constructor(columnFormattingRules?: any[], dateTimeOptions?: any, decimalFormatOptions?: any, integerFormatOptions?: any);
34
27
  defaultColumnFormatter: DefaultColumnFormatter;
35
- typeFormatterMap: Map<string, DateTimeColumnFormatter>;
28
+ typeFormatterMap: Map<string, CharColumnFormatter>;
36
29
  columnFormatMap: any;
37
30
  /**
38
31
  * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary
@@ -48,7 +41,7 @@ declare class Formatter {
48
41
  * @returns format object or null for Default
49
42
  */
50
43
  getColumnFormat(columnType: string, columnName: string): any;
51
- getColumnTypeFormatter(columnType: any): DateTimeColumnFormatter | DefaultColumnFormatter | undefined;
44
+ getColumnTypeFormatter(columnType: any): CharColumnFormatter | DefaultColumnFormatter | undefined;
52
45
  /**
53
46
  * Gets formatted string for a given value, column type and name
54
47
  * @param {Any} value Value to format
@@ -64,5 +57,5 @@ declare class Formatter {
64
57
  get timeZone(): string;
65
58
  }
66
59
  import { DefaultColumnFormatter } from "./formatters";
67
- import { DateTimeColumnFormatter } from "./formatters";
60
+ import { CharColumnFormatter } from "./formatters";
68
61
  //# sourceMappingURL=Formatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.js"],"names":[],"mappings":";AAUA;IACE;;;;OAIG;IACH,8DAaC;IAED;;;;;OAKG;IACH;;;;MAMC;IAED;;;;;;;OAOG;IACH;QALmC,QAAQ,EAAhC,MAAM;QACmB,YAAY,EAArC,OAAO;QACkB,cAAc,EAAvC,OAAO;QACiB,2BAA2B,EAAnD,MAAM;OAwBhB;IAhBC,+CAA0D;IAG1D,uDASE;IAGF,qBAA2E;IAG7E;;;;;OAKG;IACH,gFAMC;IAED;;;;;OAKG;IACH,6DAMC;IAED,sGAMC;IAED;;;;;;OAMG;IACH,yGAeC;IAED;;;OAGG;IACH,uBAGC;CACF"}
1
+ {"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.js"],"names":[],"mappings":";AAUA;IACE;;;;OAIG;IACH,8DAaC;IAED;;;;;OAKG;IACH;;;;MAMC;IAED;;;;;OAKG;IACH,0HAiCC;IAtBC,+CAA0D;IAG1D,mDAeE;IAGF,qBAA2E;IAG7E;;;;;OAKG;IACH,gFAMC;IAED;;;;;OAKG;IACH,6DAMC;IAED,kGAMC;IAED;;;;;;OAMG;IACH,yGAeC;IAED;;;OAGG;IACH,uBAGC;CACF"}
package/dist/Formatter.js CHANGED
@@ -41,24 +41,24 @@ class Formatter {
41
41
  }
42
42
  /**
43
43
  * @param {Array} columnFormattingRules Optional array of column formatting rules
44
- * @param {Object} dateTimeOptions Optional object with DateTime configuration
45
- * @param {string} dateTimeOptions.timeZone Time zone
46
- * @param {boolean} dateTimeOptions.showTimeZone Show time zone in DateTime values
47
- * @param {boolean} dateTimeOptions.showTSeparator Show 'T' separator in DateTime values
48
- * @param {string} dateTimeOptions.defaultDateTimeFormatString DateTime format to use if columnFormats for DateTime isn't set
44
+ * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration
45
+ * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration
46
+ * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration
49
47
  */
50
48
 
51
49
 
52
50
  constructor() {
53
51
  var columnFormattingRules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
54
52
  var dateTimeOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
53
+ var decimalFormatOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
54
+ var integerFormatOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
55
55
  // Formatting order:
56
56
  // - columnFormatMap[type][name]
57
57
  // - typeFormatterMap[type]
58
58
  // - defaultColumnFormatter
59
59
  this.defaultColumnFormatter = new DefaultColumnFormatter(); // Default formatters by data type
60
60
 
61
- this.typeFormatterMap = new Map([[TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()], [TableUtils.dataType.CHAR, new CharColumnFormatter()], [TableUtils.dataType.DATETIME, new DateTimeColumnFormatter(dateTimeOptions)], [TableUtils.dataType.DECIMAL, new DecimalColumnFormatter()], [TableUtils.dataType.INT, new IntegerColumnFormatter()]]); // Formats indexed by data type and column name
61
+ this.typeFormatterMap = new Map([[TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()], [TableUtils.dataType.CHAR, new CharColumnFormatter()], [TableUtils.dataType.DATETIME, new DateTimeColumnFormatter(dateTimeOptions)], [TableUtils.dataType.DECIMAL, new DecimalColumnFormatter(decimalFormatOptions)], [TableUtils.dataType.INT, new IntegerColumnFormatter(integerFormatOptions)]]); // Formats indexed by data type and column name
62
62
 
63
63
  this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);
64
64
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Formatter.js"],"names":["TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","columnFormatMap","getColumnFormatMapForType","createIfNecessary","getColumnFormat","getColumnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":"OAAOA,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB;;AAGF,MAAMC,SAAN,CAAgB;AACd;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB,CAACC,qBAAD,EAAwB;AAChD,QAAIA,qBAAqB,IAAI,IAA7B,EAAmC;AACjC,aAAO,IAAIC,GAAJ,EAAP;AACD;;AACD,WAAOD,qBAAqB,CAACE,MAAtB,CAA6B,CAACC,GAAD,EAAMC,IAAN,KAAe;AACjD,UAAMC,QAAQ,GAAGd,UAAU,CAACe,iBAAX,CAA6BF,IAAI,CAACG,UAAlC,CAAjB;;AACA,UAAI,CAACJ,GAAG,CAACK,GAAJ,CAAQH,QAAR,CAAL,EAAwB;AACtBF,QAAAA,GAAG,CAACM,GAAJ,CAAQJ,QAAR,EAAkB,IAAIJ,GAAJ,EAAlB;AACD;;AACD,UAAMS,SAAS,GAAGP,GAAG,CAACQ,GAAJ,CAAQN,QAAR,CAAlB;AACAK,MAAAA,SAAS,CAACD,GAAV,CAAcL,IAAI,CAACQ,UAAnB,EAA+BR,IAAI,CAACS,MAApC;AACA,aAAOV,G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AiCK,UAAjC,CADpB;AAGA,WAAOoB,SAAS,CAACnB,MAAV,CAAiBiB,KAAjB,EAAwBjB,MAAxB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARoB,QAAQ,GAAG;AAAA;;AACb,oCAAO,KAAKf,gBAAL,CAAsBP,GAAtB,CAA0BpB,UAAU,CAACc,QAAX,CAAoBgB,QAA9C,CAAP,oFAAO,sBAAyDa,UAAhE,2DAAO,uBACHC,EADJ;AAED;;AAtIa;;AAyIhB,eAAerC,SAAf","sourcesContent":["import TableUtils from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n} from './formatters';\n\nclass Formatter {\n /**\n * Converts [{columnType, columnName, format}] to Map { dataType, Map { columnName, format }}\n * @param {Array} columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(columnFormattingRules) {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (!map.has(dataType)) {\n map.set(dataType, new Map());\n }\n const formatMap = map.get(dataType);\n formatMap.set(next.columnName, next.format);\n return map;\n }, new Map());\n }\n\n /**\n * Creates a column formatting rule\n * @param {String} columnType Normalized data type\n * @param {String} columnName Column name\n * @param {String} format Format string\n */\n static makeColumnFormattingRule(columnType, columnName, format) {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param {Array} columnFormattingRules Optional array of column formatting rules\n * @param {Object} dateTimeOptions Optional object with DateTime configuration\n * @param {string} dateTimeOptions.timeZone Time zone\n * @param {boolean} dateTimeOptions.showTimeZone Show time zone in DateTime values\n * @param {boolean} dateTimeOptions.showTSeparator Show 'T' separator in DateTime values\n * @param {string} dateTimeOptions.defaultDateTimeFormatString DateTime format to use if columnFormats for DateTime isn't set\n */\n constructor(columnFormattingRules = [], dateTimeOptions = {}) {\n // Formatting order:\n // - columnFormatMap[type][name]\n // - typeFormatterMap[type]\n // - defaultColumnFormatter\n\n this.defaultColumnFormatter = new DefaultColumnFormatter();\n\n // Default formatters by data type\n this.typeFormatterMap = new Map([\n [TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()],\n [TableUtils.dataType.CHAR, new CharColumnFormatter()],\n [\n TableUtils.dataType.DATETIME,\n new DateTimeColumnFormatter(dateTimeOptions),\n ],\n [TableUtils.dataType.DECIMAL, new DecimalColumnFormatter()],\n [TableUtils.dataType.INT, new IntegerColumnFormatter()],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n }\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param {String} columnType column type\n * @param {Boolean} createIfNecessary create new entry if true\n * @returns Map of format strings indexed by column name or undefined if it doesn't exist\n */\n getColumnFormatMapForType(columnType, createIfNecessary = false) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (createIfNecessary && !this.columnFormatMap.has(dataType)) {\n this.columnFormatMap.set(dataType, new Map());\n }\n return this.columnFormatMap.get(dataType);\n }\n\n /**\n * Gets a column format object for a given column type and name\n * @param {String} columnType column type\n * @param {String} columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(columnType, columnName) {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n if (columnFormatMap && columnFormatMap.has(columnName)) {\n return columnFormatMap.get(columnName);\n }\n return null;\n }\n\n getColumnTypeFormatter(columnType) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType && this.typeFormatterMap.has(dataType)) {\n return this.typeFormatterMap.get(dataType);\n }\n return this.defaultColumnFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param {Any} value Value to format\n * @param {String} columnType Column type used to determine the formatting settings\n * @param {String} columnName Column name used to determine the formatting settings\n * @param {String} formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value,\n columnType,\n columnName = '',\n formatOverride = null\n ) {\n if (value == null) {\n return '';\n }\n\n const formatter = this.getColumnTypeFormatter(columnType);\n const format =\n formatOverride || this.getColumnFormat(columnType, columnName);\n\n return formatter.format(value, format);\n }\n\n /**\n * Gets the timeZone name\n * @returns {string} The time zone name E.g. America/New_York\n */\n get timeZone() {\n return this.typeFormatterMap.get(TableUtils.dataType.DATETIME)?.dhTimeZone\n ?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
1
+ {"version":3,"sources":["../src/Formatter.js"],"names":["TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","decimalFormatOptions","integerFormatOptions","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","columnFormatMap","getColumnFormatMapForType","createIfNecessary","getColumnFormat","getColumnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":"OAAOA,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB;;AAGF,MAAMC,SAAN,CAAgB;AACd;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB,CAACC,qBAAD,EAAwB;AAChD,QAAIA,qBAAqB,IAAI,IAA7B,EAAmC;AACjC,aAAO,IAAIC,GAAJ,EAAP;AACD;;AACD,WAAOD,qBAAqB,CAACE,MAAtB,CAA6B,CAACC,GAAD,EAAMC,IAAN,KAAe;AACjD,UAAMC,QAAQ,GAAGd,UAAU,CAACe,iBAAX,CAA6BF,IAAI,CAACG,UAAlC,CAAjB;;AACA,UAAI,CAACJ,GAAG,CAACK,GAAJ,CAAQH,QAAR,CAAL,EAAwB;AACtB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;;;AACEY,EAAAA,kBAAkB,CAChBC,KADgB,EAEhBzB,UAFgB,EAKhB;AAAA,QAFAK,UAEA,uEAFa,EAEb;AAAA,QADAqB,cACA,uEADiB,IACjB;;AACA,QAAID,KAAK,IAAI,IAAb,EAAmB;AACjB,aAAO,EAAP;AACD;;AAED,QAAME,SAAS,GAAG,KAAKJ,sBAAL,CAA4BvB,UAA5B,CAAlB;AACA,QAAMM,MAAM,GACVoB,cAAc,IAAI,KAAKJ,eAAL,CAAqBtB,UAArB,EAAiCK,UAAjC,CADpB;AAGA,WAAOsB,SAAS,CAACrB,MAAV,CAAiBmB,KAAjB,EAAwBnB,MAAxB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARsB,QAAQ,GAAG;AAAA;;AACb,oCAAO,KAAKf,gBAAL,CAAsBT,GAAtB,CAA0BpB,UAAU,CAACc,QAAX,CAAoBkB,QAA9C,CAAP,oFAAO,sBAAyDa,UAAhE,2DAAO,uBACHC,EADJ;AAED;;AA/Ia;;AAkJhB,eAAevC,SAAf","sourcesContent":["import TableUtils from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n} from './formatters';\n\nclass Formatter {\n /**\n * Converts [{columnType, columnName, format}] to Map { dataType, Map { columnName, format }}\n * @param {Array} columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(columnFormattingRules) {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (!map.has(dataType)) {\n map.set(dataType, new Map());\n }\n const formatMap = map.get(dataType);\n formatMap.set(next.columnName, next.format);\n return map;\n }, new Map());\n }\n\n /**\n * Creates a column formatting rule\n * @param {String} columnType Normalized data type\n * @param {String} columnName Column name\n * @param {String} format Format string\n */\n static makeColumnFormattingRule(columnType, columnName, format) {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param {Array} columnFormattingRules Optional array of column formatting rules\n * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration\n * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration\n * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration\n */\n constructor(\n columnFormattingRules = [],\n dateTimeOptions = {},\n decimalFormatOptions = {},\n integerFormatOptions = {}\n ) {\n // Formatting order:\n // - columnFormatMap[type][name]\n // - typeFormatterMap[type]\n // - defaultColumnFormatter\n\n this.defaultColumnFormatter = new DefaultColumnFormatter();\n\n // Default formatters by data type\n this.typeFormatterMap = new Map([\n [TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()],\n [TableUtils.dataType.CHAR, new CharColumnFormatter()],\n [\n TableUtils.dataType.DATETIME,\n new DateTimeColumnFormatter(dateTimeOptions),\n ],\n [\n TableUtils.dataType.DECIMAL,\n new DecimalColumnFormatter(decimalFormatOptions),\n ],\n [\n TableUtils.dataType.INT,\n new IntegerColumnFormatter(integerFormatOptions),\n ],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n }\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param {String} columnType column type\n * @param {Boolean} createIfNecessary create new entry if true\n * @returns Map of format strings indexed by column name or undefined if it doesn't exist\n */\n getColumnFormatMapForType(columnType, createIfNecessary = false) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (createIfNecessary && !this.columnFormatMap.has(dataType)) {\n this.columnFormatMap.set(dataType, new Map());\n }\n return this.columnFormatMap.get(dataType);\n }\n\n /**\n * Gets a column format object for a given column type and name\n * @param {String} columnType column type\n * @param {String} columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(columnType, columnName) {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n if (columnFormatMap && columnFormatMap.has(columnName)) {\n return columnFormatMap.get(columnName);\n }\n return null;\n }\n\n getColumnTypeFormatter(columnType) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType && this.typeFormatterMap.has(dataType)) {\n return this.typeFormatterMap.get(dataType);\n }\n return this.defaultColumnFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param {Any} value Value to format\n * @param {String} columnType Column type used to determine the formatting settings\n * @param {String} columnName Column name used to determine the formatting settings\n * @param {String} formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value,\n columnType,\n columnName = '',\n formatOverride = null\n ) {\n if (value == null) {\n return '';\n }\n\n const formatter = this.getColumnTypeFormatter(columnType);\n const format =\n formatOverride || this.getColumnFormat(columnType, columnName);\n\n return formatter.format(value, format);\n }\n\n /**\n * Gets the timeZone name\n * @returns {string} The time zone name E.g. America/New_York\n */\n get timeZone() {\n return this.typeFormatterMap.get(TableUtils.dataType.DATETIME)?.dhTimeZone\n ?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
@@ -7,5 +7,13 @@ declare class FormatterUtils {
7
7
  showTimeZone: any;
8
8
  showTSeparator: any;
9
9
  };
10
+ /**
11
+ * Check if the formatter has a custom format defined for the column name and type
12
+ * @param formatter Formatter to check
13
+ * @param columnName Column name
14
+ * @param columnType Column type
15
+ * @returns True, if a custom format is defined
16
+ */
17
+ static isCustomColumnFormatDefined(formatter: any, columnName: any, columnType: any): boolean;
10
18
  }
11
19
  //# sourceMappingURL=FormatterUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.js"],"names":[],"mappings":";AAAA;IACE,4CAGC;IAED;;;;;MAaC;CACF"}
1
+ {"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.js"],"names":[],"mappings":";AAEA;IACE,4CAGC;IAED;;;;;MAaC;IAED;;;;;;OAMG;IACH,8FAOC;CACF"}
@@ -1,3 +1,5 @@
1
+ import { TableColumnFormatter } from "./formatters/index.js";
2
+
1
3
  class FormatterUtils {
2
4
  static getColumnFormats(settings) {
3
5
  var {
@@ -20,6 +22,19 @@ class FormatterUtils {
20
22
  showTSeparator
21
23
  };
22
24
  }
25
+ /**
26
+ * Check if the formatter has a custom format defined for the column name and type
27
+ * @param formatter Formatter to check
28
+ * @param columnName Column name
29
+ * @param columnType Column type
30
+ * @returns True, if a custom format is defined
31
+ */
32
+
33
+
34
+ static isCustomColumnFormatDefined(formatter, columnName, columnType) {
35
+ var columnFormat = formatter.getColumnFormat(columnType, columnName);
36
+ return columnFormat != null && (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET || columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM);
37
+ }
23
38
 
24
39
  }
25
40
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/FormatterUtils.js"],"names":["FormatterUtils","getColumnFormats","settings","formatter","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormat","showTimeZone","showTSeparator","defaultDateTimeFormatString"],"mappings":"AAAA,MAAMA,cAAN,CAAqB;AACI,SAAhBC,gBAAgB,CAACC,QAAD,EAAW;AAChC,QAAM;AAAEC,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AAEiC,SAA3BC,2BAA2B,CAACF,QAAD,EAAW;AAC3C,QAAM;AACJG,MAAAA,QADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA;AAJI,QAKFN,QALJ;AAMA,WAAO;AACLG,MAAAA,QADK;AAELI,MAAAA,2BAA2B,EAAEH,qBAFxB;AAGLC,MAAAA,YAHK;AAILC,MAAAA;AAJK,KAAP;AAMD;;AAnBkB;;AAsBrB,eAAeR,cAAf","sourcesContent":["class FormatterUtils {\n static getColumnFormats(settings) {\n const { formatter } = settings;\n return formatter;\n }\n\n static getDateTimeFormatterOptions(settings) {\n const {\n timeZone,\n defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n } = settings;\n return {\n timeZone,\n defaultDateTimeFormatString: defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n };\n }\n}\n\nexport default FormatterUtils;\n"],"file":"FormatterUtils.js"}
1
+ {"version":3,"sources":["../src/FormatterUtils.js"],"names":["TableColumnFormatter","FormatterUtils","getColumnFormats","settings","formatter","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormat","showTimeZone","showTSeparator","defaultDateTimeFormatString","isCustomColumnFormatDefined","columnName","columnType","columnFormat","getColumnFormat","type","TYPE_CONTEXT_PRESET","TYPE_CONTEXT_CUSTOM"],"mappings":"SAASA,oB;;AAET,MAAMC,cAAN,CAAqB;AACI,SAAhBC,gBAAgB,CAACC,QAAD,EAAW;AAChC,QAAM;AAAEC,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AAEiC,SAA3BC,2BAA2B,CAACF,QAAD,EAAW;AAC3C,QAAM;AACJG,MAAAA,QADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA;AAJI,QAKFN,QALJ;AAMA,WAAO;AACLG,MAAAA,QADK;AAELI,MAAAA,2BAA2B,EAAEH,qBAFxB;AAGLC,MAAAA,YAHK;AAILC,MAAAA;AAJK,KAAP;AAMD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACoC,SAA3BE,2BAA2B,CAACP,SAAD,EAAYQ,UAAZ,EAAwBC,UAAxB,EAAoC;AACpE,QAAMC,YAAY,GAAGV,SAAS,CAACW,eAAV,CAA0BF,UAA1B,EAAsCD,UAAtC,CAArB;AACA,WACEE,YAAY,IAAI,IAAhB,KACCA,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACiB,mBAA3C,IACCH,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACkB,mBAF7C,CADF;AAKD;;AAnCkB;;AAsCrB,eAAejB,cAAf","sourcesContent":["import { TableColumnFormatter } from './formatters';\n\nclass FormatterUtils {\n static getColumnFormats(settings) {\n const { formatter } = settings;\n return formatter;\n }\n\n static getDateTimeFormatterOptions(settings) {\n const {\n timeZone,\n defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n } = settings;\n return {\n timeZone,\n defaultDateTimeFormatString: defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n };\n }\n\n /**\n * Check if the formatter has a custom format defined for the column name and type\n * @param formatter Formatter to check\n * @param columnName Column name\n * @param columnType Column type\n * @returns True, if a custom format is defined\n */\n static isCustomColumnFormatDefined(formatter, columnName, columnType) {\n const columnFormat = formatter.getColumnFormat(columnType, columnName);\n return (\n columnFormat != null &&\n (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET ||\n columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM)\n );\n }\n}\n\nexport default FormatterUtils;\n"],"file":"FormatterUtils.js"}
@@ -79,6 +79,8 @@ export class IrisGrid extends React.Component<any, any, any> {
79
79
  pending: Pending;
80
80
  globalColumnFormats: any[];
81
81
  dateTimeFormatterOptions: {};
82
+ decimalFormatOptions: {};
83
+ integerFormatOptions: {};
82
84
  loadingScrimStartTime: number | null;
83
85
  loadingScrimFinishTime: number | null;
84
86
  loadingTimer: NodeJS.Timeout | null;
@@ -688,6 +690,12 @@ export namespace IrisGrid {
688
690
  const showTimeZone: boolean;
689
691
  const showTSeparator: boolean;
690
692
  const formatter: never[];
693
+ const decimalFormatOptions: PropTypes.Requireable<PropTypes.InferProps<{
694
+ defaultFormatString: PropTypes.Requireable<string>;
695
+ }>>;
696
+ const integerFormatOptions: PropTypes.Requireable<PropTypes.InferProps<{
697
+ defaultFormatString: PropTypes.Requireable<string>;
698
+ }>>;
691
699
  }
692
700
  export { settings_1 as settings };
693
701
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IrisGrid.d.ts","sourceRoot":"","sources":["../src/IrisGrid.jsx"],"names":[],"mappings":"AAiHA;IACE,2BAAyB;I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AKC;IAED,oEA0CC;IAED,yQA8BE;IAEF,kEAwBC;IAED,sBAGC;IAED,kBAsCC;IAED,yDAkCC;IAED,4DASC;IAED,oEAKC;IAED;;;;;;OAMG;IACH,mBALW,SAAS,EAAE,mBACX,OAAO,iBACP,OAAO,UACP,MAAM,GAAC,IAAI,QA0BrB;IAED,4DA6BC;IAED,oBAaC;IAED;;OAEG;IACH,iBA8BC;IAED;;;OAGG;IACH,eAFa,OAAO,CAInB;IAED,iCAcC;IAED,gCAcC;IAED,kCA0BC;IAED,wDAQC;IAmGD,uCASC;IAED,uBAWC;IAED,uDAeC;IAED,6FAYC;IAED,gCAIC;IAED,oBAGC;IAED,wCA2BC;IAED,wBAeC;IAED,+BAgCC;IAED,gCAYC;IAED;;;OAGG;IACH,gCAGC;IAED;;OAEG;IACH,kDAcC;IAogBD;;;OAGG;IACH,qBAFW,SAAS,EAAE,QASrB;IAED,6BAYC;IAED,gDAUC;IAED,wBASC;CAqtBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6GgB,wCAAQ;;QACL,2CAAQ;;QACV,yCAAQ;;QACf,kCAAQ;;QACF,wCAAQ;;QACJ,4CAAQ;;QACD,mDAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;QAYd,6CAAQ;;;;;;;;;;;;;;;;;;;;;;;;QAYb,2CAAQ"}
package/dist/IrisGrid.js CHANGED
@@ -2,7 +2,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
2
2
 
3
3
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
4
 
5
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
6
6
 
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
8
8
 
@@ -23,7 +23,6 @@ import dh, { PropTypes as APIPropTypes } from '@deephaven/jsapi-shim';
23
23
  import { Pending, PromiseUtils, ValidationError } from '@deephaven/utils';
24
24
  import throttle from 'lodash.throttle';
25
25
  import debounce from 'lodash.debounce';
26
- import clamp from 'lodash.clamp';
27
26
  import PendingDataBottomBar from "./PendingDataBottomBar.js";
28
27
  import IrisGridCopyHandler from "./IrisGridCopyHandler.js";
29
28
  import FilterInputField from "./FilterInputField.js";
@@ -172,7 +171,7 @@ export class IrisGrid extends Component {
172
171
 
173
172
  _defineProperty(this, "getCachedHiddenColumns", memoize(hiddenColumns => hiddenColumns, {
174
173
  max: 1,
175
- normalizer: _ref2 => {
174
+ normalizer: (_ref2) => {
176
175
  var [hiddenColumns] = _ref2;
177
176
  return hiddenColumns.join();
178
177
  }
@@ -180,7 +179,7 @@ export class IrisGrid extends Component {
180
179
 
181
180
  _defineProperty(this, "getAggregationMap", memoize((columns, aggregations) => {
182
181
  var aggregationMap = {};
183
- aggregations.forEach(_ref3 => {
182
+ aggregations.forEach((_ref3) => {
184
183
  var {
185
184
  operation,
186
185
  selected,
@@ -193,7 +192,7 @@ export class IrisGrid extends Component {
193
192
 
194
193
  _defineProperty(this, "getOperationMap", memoize((columns, aggregations) => {
195
194
  var operationMap = {};
196
- aggregations.filter(a => !AggregationUtils.isRollupOperation(a.operation)).forEach(_ref4 => {
195
+ aggregations.filter(a => !AggregationUtils.isRollupOperation(a.operation)).forEach((_ref4) => {
197
196
  var {
198
197
  operation,
199
198
  selected,
@@ -331,7 +330,9 @@ export class IrisGrid extends Component {
331
330
  this.tooltip = null;
332
331
  this.pending = new Pending();
333
332
  this.globalColumnFormats = [];
334
- this.dateTimeFormatterOptions = {}; // When the loading scrim started/when it should extend to the end of the screen.
333
+ this.dateTimeFormatterOptions = {};
334
+ this.decimalFormatOptions = {};
335
+ this.integerFormatOptions = {}; // When the loading scrim started/when it should extend to the end of the screen.
335
336
 
336
337
  this.loadingScrimStartTime = null;
337
338
  this.loadingScrimFinishTime = null;
@@ -657,13 +658,13 @@ export class IrisGrid extends Component {
657
658
  var newAdvancedFilters = replaceExisting ? new Map() : new Map(advancedFilters);
658
659
  var newQuickFilters = replaceExisting ? new Map() : new Map(quickFilters);
659
660
  var isChanged = replaceExisting && advancedFilters.size > 0;
660
- inputFilters.forEach(_ref5 => {
661
+ inputFilters.forEach((_ref5) => {
661
662
  var {
662
663
  name,
663
664
  type,
664
665
  value
665
666
  } = _ref5;
666
- var modelIndex = model.columns.findIndex(_ref6 => {
667
+ var modelIndex = model.columns.findIndex((_ref6) => {
667
668
  var {
668
669
  name: columnName,
669
670
  type: columnType
@@ -744,7 +745,7 @@ export class IrisGrid extends Component {
744
745
 
745
746
  log.debug('Setting advanced filter', modelIndex, filter);
746
747
  this.startLoading('Filtering...', true);
747
- this.setState(_ref7 => {
748
+ this.setState((_ref7) => {
748
749
  var {
749
750
  advancedFilters
750
751
  } = _ref7;
@@ -775,7 +776,7 @@ export class IrisGrid extends Component {
775
776
  setQuickFilter(modelIndex, filter, text) {
776
777
  log.debug('Setting quick filter', modelIndex, filter, text);
777
778
  this.startLoading('Filtering...', true);
778
- this.setState(_ref8 => {
779
+ this.setState((_ref8) => {
779
780
  var {
780
781
  quickFilters
781
782
  } = _ref8;
@@ -836,7 +837,7 @@ export class IrisGrid extends Component {
836
837
 
837
838
  removeColumnFilter(modelColumn) {
838
839
  this.startLoading('Filtering...', true);
839
- this.setState(_ref10 => {
840
+ this.setState((_ref10) => {
840
841
  var {
841
842
  advancedFilters,
842
843
  quickFilters
@@ -952,12 +953,20 @@ export class IrisGrid extends Component {
952
953
  var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
953
954
  var globalColumnFormats = FormatterUtils.getColumnFormats(settings);
954
955
  var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);
956
+ var {
957
+ defaultDecimalFormatOptions = {},
958
+ defaultIntegerFormatOptions = {}
959
+ } = settings;
955
960
  var isColumnFormatChanged = !deepEqual(this.globalColumnFormats, globalColumnFormats);
956
961
  var isDateFormattingChanged = !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions);
962
+ var isDecimalFormattingChanged = !deepEqual(this.decimalFormatOptions, defaultDecimalFormatOptions);
963
+ var isIntegerFormattingChanged = !deepEqual(this.integerFormatOptions, defaultIntegerFormatOptions);
957
964
 
958
- if (isColumnFormatChanged || isDateFormattingChanged) {
965
+ if (isColumnFormatChanged || isDateFormattingChanged || isDecimalFormattingChanged || isIntegerFormattingChanged) {
959
966
  this.globalColumnFormats = globalColumnFormats;
960
967
  this.dateTimeFormatterOptions = dateTimeFormatterOptions;
968
+ this.decimalFormatOptions = defaultDecimalFormatOptions;
969
+ this.integerFormatOptions = defaultIntegerFormatOptions;
961
970
  this.updateFormatter({}, forceUpdate);
962
971
 
963
972
  if (isDateFormattingChanged && forceUpdate) {
@@ -977,7 +986,7 @@ export class IrisGrid extends Component {
977
986
  }, updatedFormats);
978
987
 
979
988
  var mergedColumnFormats = [...this.globalColumnFormats, ...update.customColumnFormatMap.values()];
980
- var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions);
989
+ var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);
981
990
  log.debug('updateFormatter', this.globalColumnFormats, mergedColumnFormats);
982
991
  this.setState(_objectSpread(_objectSpread({}, update), {}, {
983
992
  formatter
@@ -1723,7 +1732,7 @@ export class IrisGrid extends Component {
1723
1732
 
1724
1733
  handleFilterBarChange(value) {
1725
1734
  this.startLoading('Filtering...', true);
1726
- this.setState(_ref12 => {
1735
+ this.setState((_ref12) => {
1727
1736
  var {
1728
1737
  focusedFilterBarColumn,
1729
1738
  quickFilters
@@ -1801,7 +1810,7 @@ export class IrisGrid extends Component {
1801
1810
  }
1802
1811
 
1803
1812
  handleMenuBack() {
1804
- this.setState(_ref13 => {
1813
+ this.setState((_ref13) => {
1805
1814
  var {
1806
1815
  openOptions
1807
1816
  } = _ref13;
@@ -1814,7 +1823,7 @@ export class IrisGrid extends Component {
1814
1823
  }
1815
1824
 
1816
1825
  handleMenuSelect(option) {
1817
- this.setState(_ref14 => {
1826
+ this.setState((_ref14) => {
1818
1827
  var {
1819
1828
  openOptions
1820
1829
  } = _ref14;
@@ -2064,7 +2073,7 @@ export class IrisGrid extends Component {
2064
2073
  handleAggregationChange(aggregation) {
2065
2074
  log.debug('handleAggregationChange', aggregation);
2066
2075
  this.startLoading("Aggregating ".concat(aggregation.operation, "..."));
2067
- this.setState(_ref15 => {
2076
+ this.setState((_ref15) => {
2068
2077
  var {
2069
2078
  aggregationSettings
2070
2079
  } = _ref15;
@@ -2451,72 +2460,25 @@ export class IrisGrid extends Component {
2451
2460
 
2452
2461
  var columnTooltip = null;
2453
2462
 
2454
- if (shownColumnTooltip != null && metrics && this.gridWrapper) {
2463
+ if (shownColumnTooltip != null && metrics) {
2455
2464
  var {
2456
2465
  columnHeaderHeight,
2457
2466
  visibleColumnXs: _visibleColumnXs,
2458
- visibleColumnWidths: _visibleColumnWidths,
2459
- width
2467
+ visibleColumnWidths: _visibleColumnWidths
2460
2468
  } = metrics;
2461
2469
 
2462
2470
  var _columnX = _visibleColumnXs.get(shownColumnTooltip);
2463
2471
 
2464
2472
  var _columnWidth = _visibleColumnWidths.get(shownColumnTooltip);
2465
- /**
2466
- * Create a wrapper dom element, the size of the column header.
2467
- * The wrapper acts as tooltip parent, the tooltip component
2468
- * will trigger hide on mouseleave of wrapper or tooltip.
2469
- * The wrapper should be bound to within the grid dimensions,
2470
- * so popper only remains triggered while mouse is inside the panel.
2471
- */
2472
-
2473
-
2474
- var boundedLeft = Math.max(0, _columnX);
2475
- var boundedWidth = _columnWidth;
2476
-
2477
- if (_columnX + _columnWidth > width) {
2478
- // column is extending past right edge
2479
- boundedWidth = width - _columnX;
2480
- } else if (_columnX < 0) {
2481
- // column is extending past left edge
2482
- boundedWidth = _columnWidth - Math.abs(_columnX);
2483
- }
2484
2473
 
2485
2474
  var wrapperStyle = {
2486
2475
  position: 'absolute',
2487
2476
  top: 0,
2488
- left: boundedLeft,
2489
- width: boundedWidth,
2477
+ left: _columnX,
2478
+ width: _columnWidth,
2490
2479
  height: columnHeaderHeight,
2491
2480
  pointerEvents: 'none'
2492
2481
  };
2493
- /**
2494
- * Because the popper parent wrapper center is no longer the same as
2495
- * the column label center, we create a popper virtual ref, to handle
2496
- * positioning and keep the popper centered on the label. Creates a
2497
- * 1px x headerHeight virtual object, placed centered on the column
2498
- * label, clamped to 0 + margin to width - margin. We add a margin,
2499
- * otherwise the arrow wants to escape the boundary.
2500
- */
2501
-
2502
- var gridRect = this.gridWrapper.getBoundingClientRect();
2503
- var popperMargin = 20;
2504
- var virtualReference = {
2505
- clientWidth: 1,
2506
- clientHeight: columnHeaderHeight,
2507
-
2508
- getBoundingClientRect() {
2509
- return {
2510
- top: gridRect.top,
2511
- left: gridRect.left + clamp(_columnX + _columnWidth / 2, popperMargin, width - popperMargin),
2512
- bottom: gridRect.top + columnHeaderHeight,
2513
- right: gridRect.left + clamp(_columnX + _columnWidth / 2, popperMargin, width - popperMargin) + 1,
2514
- width: 1,
2515
- height: columnHeaderHeight
2516
- };
2517
- }
2518
-
2519
- };
2520
2482
  var popperOptions = {
2521
2483
  placement: 'bottom',
2522
2484
  modifiers: {
@@ -2538,8 +2500,7 @@ export class IrisGrid extends Component {
2538
2500
  timeout: 400,
2539
2501
  interactive: true,
2540
2502
  options: popperOptions,
2541
- ref: this.handleTooltipRef,
2542
- referenceObject: virtualReference
2503
+ ref: this.handleTooltipRef
2543
2504
  }, /*#__PURE__*/React.createElement(ColumnStatistics, {
2544
2505
  model: model,
2545
2506
  column: column,
@@ -2893,6 +2854,7 @@ export class IrisGrid extends Component {
2893
2854
  })
2894
2855
  }, /*#__PURE__*/React.createElement("button", {
2895
2856
  type: "button",
2857
+ "data-testid": "btn-iris-grid-settings-button-".concat(name),
2896
2858
  className: "btn btn-link btn-link-icon",
2897
2859
  onClick: this.handleMenu
2898
2860
  }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
@@ -3097,7 +3059,13 @@ IrisGrid.defaultProps = {
3097
3059
  defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,
3098
3060
  showTimeZone: false,
3099
3061
  showTSeparator: true,
3100
- formatter: []
3062
+ formatter: [],
3063
+ decimalFormatOptions: PropTypes.shape({
3064
+ defaultFormatString: PropTypes.string
3065
+ }),
3066
+ integerFormatOptions: PropTypes.shape({
3067
+ defaultFormatString: PropTypes.string
3068
+ })
3101
3069
  }
3102
3070
  };
3103
3071
  export default IrisGrid;