@deephaven/iris-grid 0.6.1-markdownnotebooks.7 → 0.6.3-bard.1

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 (60) hide show
  1. package/dist/ColumnStatistics.css +5 -0
  2. package/dist/ColumnStatistics.css.map +1 -1
  3. package/dist/ColumnStatistics.d.ts +1 -0
  4. package/dist/ColumnStatistics.d.ts.map +1 -1
  5. package/dist/ColumnStatistics.js +26 -9
  6. package/dist/ColumnStatistics.js.map +1 -1
  7. package/dist/Formatter.d.ts +7 -14
  8. package/dist/Formatter.d.ts.map +1 -1
  9. package/dist/Formatter.js +6 -6
  10. package/dist/Formatter.js.map +1 -1
  11. package/dist/IrisGrid.css +2 -0
  12. package/dist/IrisGrid.css.map +1 -1
  13. package/dist/IrisGrid.d.ts +9 -0
  14. package/dist/IrisGrid.d.ts.map +1 -1
  15. package/dist/IrisGrid.js +37 -5
  16. package/dist/IrisGrid.js.map +1 -1
  17. package/dist/IrisGridModel.d.ts +5 -0
  18. package/dist/IrisGridModel.d.ts.map +1 -1
  19. package/dist/IrisGridModel.js +9 -0
  20. package/dist/IrisGridModel.js.map +1 -1
  21. package/dist/IrisGridProxyModel.d.ts.map +1 -1
  22. package/dist/IrisGridProxyModel.js +4 -0
  23. package/dist/IrisGridProxyModel.js.map +1 -1
  24. package/dist/IrisGridTableModel.d.ts.map +1 -1
  25. package/dist/IrisGridTableModel.js +24 -6
  26. package/dist/IrisGridTableModel.js.map +1 -1
  27. package/dist/IrisGridTheme.module.css +2 -0
  28. package/dist/IrisGridTheme.module.css.map +1 -1
  29. package/dist/TableUtils.d.ts.map +1 -1
  30. package/dist/TableUtils.js +0 -2
  31. package/dist/TableUtils.js.map +1 -1
  32. package/dist/formatters/DateTimeColumnFormatter.d.ts +8 -7
  33. package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
  34. package/dist/formatters/DateTimeColumnFormatter.js +1 -2
  35. package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
  36. package/dist/formatters/DecimalColumnFormatter.d.ts +55 -59
  37. package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
  38. package/dist/formatters/DecimalColumnFormatter.js +66 -27
  39. package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
  40. package/dist/formatters/IntegerColumnFormatter.d.ts +50 -29
  41. package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
  42. package/dist/formatters/IntegerColumnFormatter.js +60 -19
  43. package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
  44. package/dist/formatters/index.d.ts +7 -7
  45. package/dist/formatters/index.d.ts.map +1 -1
  46. package/dist/formatters/index.js +3 -3
  47. package/dist/formatters/index.js.map +1 -1
  48. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.d.ts.map +1 -1
  49. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +6 -2
  50. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +1 -1
  51. package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts.map +1 -1
  52. package/dist/mousehandlers/IrisGridContextMenuHandler.js +7 -0
  53. package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
  54. package/dist/sidebar/InputEditor.d.ts +1 -1
  55. package/dist/sidebar/InputEditor.js +1 -1
  56. package/dist/sidebar/InputEditor.js.map +1 -1
  57. package/dist/sidebar/TableSaver.js +1 -1
  58. package/dist/sidebar/TableSaver.js.map +1 -1
  59. package/dist/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +11 -11
@@ -8,8 +8,13 @@
8
8
  }
9
9
 
10
10
  .column-statistics-title {
11
+ padding-top: 0.25rem;
11
12
  font-weight: 500;
12
13
  }
14
+ .column-statistics-title .column-statistics-copy {
15
+ margin-left: 2px;
16
+ margin-top: -2px;
17
+ }
13
18
 
14
19
  .column-statistics-type {
15
20
  font-style: italic;
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/ColumnStatistics.scss","../../components/scss/bootstrap_overrides.scss","../../components/scss/new_variables.scss","../../../node_modules/bootstrap/scss/_variables.scss"],"names":[],"mappings":"AAEA;EACE;EACA;EACA,OCQe;EDPf;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA,OCIS;EDHT;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA,SE9BS;EF+BT,aE/BS;;AFgCT;EACE;;AACA;EAEE;;AAIJ;EACE,aG6FK;;AH1FP;EACE;EACA,eGwFK;EHvFL;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAIJ;EACE;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA,OCpDS","file":"ColumnStatistics.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../src/ColumnStatistics.scss","../../components/scss/bootstrap_overrides.scss","../../components/scss/new_variables.scss","../../../node_modules/bootstrap/scss/_variables.scss"],"names":[],"mappings":"AAEA;EACE;EACA;EACA,OCQe;EDPf;EACA;EACA;;;AAGF;EACE,aEVS;EFWT;;AACA;EACE;EACA;;;AAIJ;EACE;EACA,OCDS;EDET;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA,SEnCS;EFoCT,aEpCS;;AFqCT;EACE;;AACA;EAEE;;AAIJ;EACE,aGwFK;;AHrFP;EACE;EACA,eGmFK;EHlFL;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAIJ;EACE;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EACA,OCzDS","file":"ColumnStatistics.css"}
@@ -7,6 +7,7 @@ declare class ColumnStatistics extends React.Component<any, any, any> {
7
7
  handleError(error: any): void;
8
8
  handleGenerateStatistics(): void;
9
9
  handleStatistics(stats: any): void;
10
+ handleCopyHeader(): void;
10
11
  cancelablePromise: import("@deephaven/utils").CancelablePromise<any> | null;
11
12
  maybeGenerateStatistics(): void;
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnStatistics.d.ts","sourceRoot":"","sources":["../src/ColumnStatistics.jsx"],"names":[],"mappings":";AAiBA;IACE,uFAAuF;IACvF,mCAAoC;IAEpC,0CAQC;IAED,wBAeC;IAoED,8BAYC;IAxDD,iCAUC;IAED,mCA8BC;IA1EC,4EAA6B;IAoB/B,gCAUC;CAuJF"}
1
+ {"version":3,"file":"ColumnStatistics.d.ts","sourceRoot":"","sources":["../src/ColumnStatistics.jsx"],"names":[],"mappings":";AA2BA;IACE,uFAAuF;IACvF,mCAAoC;IAEpC,0CAQC;IAED,wBAiBC;IAwED,8BAYC;IAxDD,iCAUC;IAED,mCA8BC;IA1DD,yBAEC;IAvBC,4EAA6B;IAyB/B,gCAUC;CAmKF"}
@@ -4,8 +4,8 @@ import React, { Component } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import classNames from 'classnames';
6
6
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
- import { LoadingSpinner } from '@deephaven/components';
8
- import { dhRefresh, vsLock } from '@deephaven/icons';
7
+ import { Button, ContextActionUtils, LoadingSpinner } from '@deephaven/components';
8
+ import { dhFreeze, dhRefresh, vsCopy, vsLock, vsPassFilled } from '@deephaven/icons';
9
9
  import { PropTypes as APIPropTypes } from '@deephaven/jsapi-shim';
10
10
  import Log from '@deephaven/log';
11
11
  import { PromiseUtils } from '@deephaven/utils';
@@ -29,12 +29,14 @@ class ColumnStatistics extends Component {
29
29
  this.handleError = this.handleError.bind(this);
30
30
  this.handleGenerateStatistics = this.handleGenerateStatistics.bind(this);
31
31
  this.handleStatistics = this.handleStatistics.bind(this);
32
+ this.handleCopyHeader = this.handleCopyHeader.bind(this);
32
33
  this.cancelablePromise = null;
33
34
  this.state = {
34
35
  error: null,
35
36
  loading: false,
36
37
  statistics: null,
37
- numRows: 0
38
+ numRows: 0,
39
+ copied: false
38
40
  };
39
41
  }
40
42
 
@@ -48,6 +50,12 @@ class ColumnStatistics extends Component {
48
50
  }
49
51
  }
50
52
 
53
+ handleCopyHeader() {
54
+ this.setState({
55
+ copied: true
56
+ });
57
+ }
58
+
51
59
  maybeGenerateStatistics() {
52
60
  var {
53
61
  model
@@ -131,7 +139,8 @@ class ColumnStatistics extends Component {
131
139
  error,
132
140
  loading,
133
141
  statistics,
134
- numRows
142
+ numRows,
143
+ copied
135
144
  } = this.state;
136
145
  var showGenerateStatistics = !loading && error == null && statistics == null && model.isColumnStatisticsAvailable;
137
146
  var statisticElements = [];
@@ -160,21 +169,29 @@ class ColumnStatistics extends Component {
160
169
 
161
170
  var rowCountLabel = model.hasExpandableRows ? 'Expanded Rows' : 'Number of Rows';
162
171
  var formattedRowCount = model.displayString(numRows, 'long');
163
- var columnIndex = model.columns.findIndex(col => col.name === column.name);
172
+ var columnIndex = model.getColumnIndexByName(column.name);
164
173
  return /*#__PURE__*/React.createElement("div", {
165
174
  className: "column-statistics"
166
175
  }, /*#__PURE__*/React.createElement("div", {
167
176
  className: "column-statistics-title"
168
- }, column.name, "\xA0", /*#__PURE__*/React.createElement("span", {
177
+ }, column.name, /*#__PURE__*/React.createElement("span", {
169
178
  className: "column-statistics-type"
170
- }, "(", columnType, ")")), description && /*#__PURE__*/React.createElement("div", {
179
+ }, "\xA0(", columnType, ")"), /*#__PURE__*/React.createElement(Button, {
180
+ kind: "ghost",
181
+ className: "column-statistics-copy",
182
+ icon: copied ? vsPassFilled : vsCopy,
183
+ onClick: () => {
184
+ ContextActionUtils.copyToClipboard(column.name).then(this.handleCopyHeader).catch(e => log.error('Unable to column name', e));
185
+ },
186
+ tooltip: copied ? 'Copied text' : 'Copy column name'
187
+ })), description && /*#__PURE__*/React.createElement("div", {
171
188
  className: "column-statistics-description"
172
189
  }, description), !model.isColumnMovable(columnIndex) && /*#__PURE__*/React.createElement("div", {
173
190
  className: "column-statistics-status"
174
191
  }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
175
- icon: vsLock,
192
+ icon: model.isColumnFrozen(columnIndex) ? dhFreeze : vsLock,
176
193
  className: "mr-1"
177
- }), "Not movable"), /*#__PURE__*/React.createElement("div", {
194
+ }), model.isColumnFrozen(columnIndex) ? 'Frozen' : 'Not movable'), /*#__PURE__*/React.createElement("div", {
178
195
  className: "column-statistics-grid"
179
196
  }, statistics == null && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
180
197
  className: "column-statistic-operation"
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ColumnStatistics.jsx"],"names":["React","Component","PropTypes","classNames","FontAwesomeIcon","LoadingSpinner","dhRefresh","vsLock","APIPropTypes","Log","PromiseUtils","IrisGridModel","log","module","STATS_LABEL_OVERRIDES","SIZE","ColumnStatistics","getStatsLabel","operation","split","map","w","toUpperCase","substr","toLowerCase","join","constructor","props","handleError","bind","handleGenerateStatistics","handleStatistics","cancelablePromise","state","error","loading","statistics","numRows","componentDidMount","maybeGenerateStatistics","componentWillUnmount","cancel","model","rowCount","setState","isColumnStatisticsAvailable","AUTO_GENERATE_LIMIT","column","makeCancelable","columnStatistics","then","catch","stats","debug","onStatistics","statisticsMap","forEach","value","push","type","getType","uniqueValues","className","isCanceled","render","showGenerateStatistics","statisticElements","columnType","substring","lastIndexOf","description","i","length","formattedValue","displayString","name","statisticElement","rowCountLabel","hasExpandableRows","formattedRowCount","columnIndex","columns","findIndex","col","isColumnMovable","propTypes","instanceOf","isRequired","Column","func"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,kBAAlC;AACA,SAASL,SAAS,IAAIM,YAAtB,QAA0C,uBAA1C;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAASC,YAAT,QAA6B,kBAA7B;OACOC,a;;AAGP,IAAMC,GAAG,GAAGH,GAAG,CAACI,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AAC3B3C,EAAAA,KAAK,EAAExC,SAAS,CAACoF,UAAV,CAAqB3E,aAArB,EAAoC4E,UADhB;AAE3BxC,EAAAA,MAAM,EAAEvC,YAAY,CAACgF,MAAb,CAAoBD,UAFD;AAG3BjC,EAAAA,YAAY,EAAEpD,SAAS,CAACuF,IAAV,CAAeF;AAHF,CAA7B;AAMA,eAAevE,gBAAf","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { LoadingSpinner } from '@deephaven/components';\nimport { dhRefresh, vsLock } from '@deephaven/icons';\nimport { PropTypes as APIPropTypes } from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { PromiseUtils } from '@deephaven/utils';\nimport IrisGridModel from './IrisGridModel';\nimport './ColumnStatistics.scss';\n\nconst log = Log.module('ColumnStatistics');\nconst STATS_LABEL_OVERRIDES = {\n SIZE: 'Number of Rows',\n};\n\nclass ColumnStatistics extends Component {\n /** Automatically generate the statistics when the row count is below this threshold */\n static AUTO_GENERATE_LIMIT = 100000;\n\n static getStatsLabel(operation) {\n return (\n STATS_LABEL_OVERRIDES[operation] ??\n operation\n .split(' ')\n .map(w => w[0].toUpperCase() + w.substr(1).toLowerCase())\n .join(' ')\n );\n }\n\n constructor(props) {\n super(props);\n\n this.handleError = this.handleError.bind(this);\n this.handleGenerateStatistics = this.handleGenerateStatistics.bind(this);\n this.handleStatistics = this.handleStatistics.bind(this);\n\n this.cancelablePromise = null;\n\n this.state = {\n error: null,\n loading: false,\n statistics: null,\n numRows: 0,\n };\n }\n\n componentDidMount() {\n this.maybeGenerateStatistics();\n }\n\n componentWillUnmount() {\n if (this.cancelablePromise) {\n this.cancelablePromise.cancel();\n }\n }\n\n maybeGenerateStatistics() {\n const { model } = this.props;\n\n const numRows = model.rowCount;\n this.setState({ numRows });\n if (!model.isColumnStatisticsAvailable) {\n this.setState({ loading: false });\n } else if (numRows < ColumnStatistics.AUTO_GENERATE_LIMIT) {\n this.handleGenerateStatistics();\n }\n }\n\n handleGenerateStatistics() {\n this.setState({ loading: true });\n\n const { column, model } = this.props;\n\n this.cancelablePromise = PromiseUtils.makeCancelable(\n model.columnStatistics(column)\n );\n\n this.cancelablePromise.then(this.handleStatistics).catch(this.handleError);\n }\n\n handleStatistics(stats) {\n log.debug('Received statistics', stats);\n\n const { model, onStatistics } = this.props;\n const statistics = [];\n\n stats.statisticsMap.forEach((value, operation) => {\n statistics.push({\n operation: ColumnStatistics.getStatsLabel(operation),\n value,\n type: stats.getType(operation),\n });\n });\n\n stats.uniqueValues.forEach((value, operation) => {\n statistics.push({\n operation,\n className: 'column-statistics-unique-value',\n value,\n type: 'long',\n });\n });\n\n this.setState({\n loading: false,\n statistics,\n numRows: model.rowCount,\n });\n\n onStatistics();\n }\n\n handleError(error) {\n if (error && error.isCanceled) {\n log.debug('Called handleError on a cancelled promise result');\n return;\n }\n\n log.error('Error generating statistics', error);\n this.setState({\n error,\n loading: false,\n statistics: null,\n });\n }\n\n render() {\n const { column, model } = this.props;\n const { error, loading, statistics, numRows } = this.state;\n const showGenerateStatistics =\n !loading &&\n error == null &&\n statistics == null &&\n model.isColumnStatisticsAvailable;\n const statisticElements = [];\n const columnType = column.type.substring(column.type.lastIndexOf('.') + 1);\n const description = column.description === null ? null : column.description;\n if (statistics != null) {\n for (let i = 0; i < statistics.length; i += 1) {\n const { operation, className, value, type } = statistics[i];\n const formattedValue = !type\n ? model.displayString(value, column.type, column.name)\n : model.displayString(value, type);\n const statisticElement = (\n <React.Fragment key={operation}>\n <div\n className={classNames('column-statistic-operation', className)}\n >\n {operation}\n </div>\n <div className=\"column-statistic-value\">{formattedValue}</div>\n </React.Fragment>\n );\n statisticElements.push(statisticElement);\n }\n }\n const rowCountLabel = model.hasExpandableRows\n ? 'Expanded Rows'\n : 'Number of Rows';\n const formattedRowCount = model.displayString(numRows, 'long');\n const columnIndex = model.columns.findIndex(\n col => col.name === column.name\n );\n return (\n <div className=\"column-statistics\">\n <div className=\"column-statistics-title\">\n {column.name}&nbsp;\n <span className=\"column-statistics-type\">({columnType})</span>\n </div>\n {description && (\n <div className=\"column-statistics-description\">{description}</div>\n )}\n {!model.isColumnMovable(columnIndex) && (\n <div className=\"column-statistics-status\">\n <FontAwesomeIcon icon={vsLock} className=\"mr-1\" />\n Not movable\n </div>\n )}\n <div className=\"column-statistics-grid\">\n {statistics == null && (\n <>\n <div className=\"column-statistic-operation\">{rowCountLabel}</div>\n <div className=\"column-statistic-value\">{formattedRowCount}</div>\n </>\n )}\n\n {statisticElements}\n </div>\n {showGenerateStatistics && (\n <button\n type=\"button\"\n className=\"btn btn-link px-0\"\n onClick={this.handleGenerateStatistics}\n >\n Generate Stats\n </button>\n )}\n {error && <div className=\"error-message\">{`${error}`}</div>}\n {statistics && !loading && (\n <button\n type=\"button\"\n className=\"btn btn-link px-0\"\n onClick={this.handleGenerateStatistics}\n >\n <FontAwesomeIcon icon={dhRefresh} className=\"mr-1\" />\n Refresh\n </button>\n )}\n {loading && (\n <div className=\"column-statistics-loading\">\n <LoadingSpinner className=\"mr-2\" />\n Calculating Stats...\n </div>\n )}\n </div>\n );\n }\n}\n\nColumnStatistics.propTypes = {\n model: PropTypes.instanceOf(IrisGridModel).isRequired,\n column: APIPropTypes.Column.isRequired,\n onStatistics: PropTypes.func.isRequired,\n};\n\nexport default ColumnStatistics;\n"],"file":"ColumnStatistics.js"}
1
+ {"version":3,"sources":["../src/ColumnStatistics.jsx"],"names":["React","Component","PropTypes","classNames","FontAwesomeIcon","Button","ContextActionUtils","LoadingSpinner","dhFreeze","dhRefresh","vsCopy","vsLock","vsPassFilled","APIPropTypes","Log","PromiseUtils","IrisGridModel","log","module","STATS_LABEL_OVERRIDES","SIZE","ColumnStatistics","getStatsLabel","operation","split","map","w","toUpperCase","substr","toLowerCase","join","constructor","props","handleError","bind","handleGenerateStatistics","handleStatistics","handleCopyHeader","cancelablePromise","state","error","loading","statistics","numRows","copied","componentDidMount","maybeGenerateStatistics","componentWillUnmount","cancel","setState","model","rowCount","isColumnStatisticsAvailable","AUTO_GENERATE_LIMIT","column","makeCancelable","columnStatistics","then","catch","stats","debug","onStatistics","statisticsMap","forEach","value","push","type","getType","uniqueValues","className","isCanceled","render","showGenerateStatistics","statisticElements","columnType","substring","lastIndexOf","description","i","length","formattedValue","displayString","name","statisticElement","rowCountLabel","hasExpandableRows","formattedRowCount","columnIndex","getColumnIndexByName","copyToClipboard","e","isColumnMovable","isColumnFrozen","propTypes","instanceOf","isRequired","Column","func"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SACEC,MADF,EAEEC,kBAFF,EAGEC,cAHF,QAIO,uBAJP;AAKA,SACEC,QADF,EAEEC,SAFF,EAGEC,MAHF,EAIEC,MAJF,EAKEC,YALF,QAMO,kBANP;AAOA,SAASV,SAAS,IAAIW,YAAtB,QAA0C,uBAA1C;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAASC,YAAT,QAA6B,kBAA7B;OACOC,a;;AAGP,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAJ,CAAW,kBAAX,CAAZ;AACA,IAAMC,qBAAqB,GAAG;AAC5BC,EAAAA,IAAI,EAAE;AADsB,CAA9B;;AAIA,MAAMC,gBAAN,SAA+BpB,SAA/B,CAAyC;AACvC;AAGoB,SAAbqB,aAAa,CAACC,SAAD,EAAY;AAAA;;AAC9B,oCACEJ,qBAAqB,CAACI,SAAD,CADvB,yEAEEA,SAAS,CACNC,KADH,CACS,GADT,EAEGC,GAFH,CAEOC,CAAC,IAAIA,CAAC,CAAC,CAAD,CAAD,CAAKC,WAAL,KAAqBD,CAAC,CAACE,MAAF,CAAS,CAAT,EAAYC,WAAZ,EAFjC,EAGGC,IAHH,CAGQ,GAHR,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MAAA,OAAO,EAAE,KAAKN;AAHhB,oBAKE,oBAAC,eAAD;AAAiB,MAAA,IAAI,EAAE1B,SAAvB;AAAkC,MAAA,SAAS,EAAC;AAA5C,MALF,YAjDJ,EA0DGgC,OAAO,iBACN;AAAK,MAAA,SAAS,EAAC;AAAf,oBACE,oBAAC,cAAD;AAAgB,MAAA,SAAS,EAAC;AAA1B,MADF,yBA3DJ,CADF;AAmED;;AA3NsC;;gBAAnCpB,gB,yBAEyB,M;;AA4N/BA,gBAAgB,CAACwE,SAAjB,GAA6B;AAC3B3C,EAAAA,KAAK,EAAEhD,SAAS,CAAC4F,UAAV,CAAqB9E,aAArB,EAAoC+E,UADhB;AAE3BzC,EAAAA,MAAM,EAAEzC,YAAY,CAACmF,MAAb,CAAoBD,UAFD;AAG3BlC,EAAAA,YAAY,EAAE3D,SAAS,CAAC+F,IAAV,CAAeF;AAHF,CAA7B;AAMA,eAAe1E,gBAAf","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport {\n Button,\n ContextActionUtils,\n LoadingSpinner,\n} from '@deephaven/components';\nimport {\n dhFreeze,\n dhRefresh,\n vsCopy,\n vsLock,\n vsPassFilled,\n} from '@deephaven/icons';\nimport { PropTypes as APIPropTypes } from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { PromiseUtils } from '@deephaven/utils';\nimport IrisGridModel from './IrisGridModel';\nimport './ColumnStatistics.scss';\n\nconst log = Log.module('ColumnStatistics');\nconst STATS_LABEL_OVERRIDES = {\n SIZE: 'Number of Rows',\n};\n\nclass ColumnStatistics extends Component {\n /** Automatically generate the statistics when the row count is below this threshold */\n static AUTO_GENERATE_LIMIT = 100000;\n\n static getStatsLabel(operation) {\n return (\n STATS_LABEL_OVERRIDES[operation] ??\n operation\n .split(' ')\n .map(w => w[0].toUpperCase() + w.substr(1).toLowerCase())\n .join(' ')\n );\n }\n\n constructor(props) {\n super(props);\n\n this.handleError = this.handleError.bind(this);\n this.handleGenerateStatistics = this.handleGenerateStatistics.bind(this);\n this.handleStatistics = this.handleStatistics.bind(this);\n this.handleCopyHeader = this.handleCopyHeader.bind(this);\n\n this.cancelablePromise = null;\n\n this.state = {\n error: null,\n loading: false,\n statistics: null,\n numRows: 0,\n copied: false,\n };\n }\n\n componentDidMount() {\n this.maybeGenerateStatistics();\n }\n\n componentWillUnmount() {\n if (this.cancelablePromise) {\n this.cancelablePromise.cancel();\n }\n }\n\n handleCopyHeader() {\n this.setState({ copied: true });\n }\n\n maybeGenerateStatistics() {\n const { model } = this.props;\n\n const numRows = model.rowCount;\n this.setState({ numRows });\n if (!model.isColumnStatisticsAvailable) {\n this.setState({ loading: false });\n } else if (numRows < ColumnStatistics.AUTO_GENERATE_LIMIT) {\n this.handleGenerateStatistics();\n }\n }\n\n handleGenerateStatistics() {\n this.setState({ loading: true });\n\n const { column, model } = this.props;\n\n this.cancelablePromise = PromiseUtils.makeCancelable(\n model.columnStatistics(column)\n );\n\n this.cancelablePromise.then(this.handleStatistics).catch(this.handleError);\n }\n\n handleStatistics(stats) {\n log.debug('Received statistics', stats);\n\n const { model, onStatistics } = this.props;\n const statistics = [];\n\n stats.statisticsMap.forEach((value, operation) => {\n statistics.push({\n operation: ColumnStatistics.getStatsLabel(operation),\n value,\n type: stats.getType(operation),\n });\n });\n\n stats.uniqueValues.forEach((value, operation) => {\n statistics.push({\n operation,\n className: 'column-statistics-unique-value',\n value,\n type: 'long',\n });\n });\n\n this.setState({\n loading: false,\n statistics,\n numRows: model.rowCount,\n });\n\n onStatistics();\n }\n\n handleError(error) {\n if (error && error.isCanceled) {\n log.debug('Called handleError on a cancelled promise result');\n return;\n }\n\n log.error('Error generating statistics', error);\n this.setState({\n error,\n loading: false,\n statistics: null,\n });\n }\n\n render() {\n const { column, model } = this.props;\n const { error, loading, statistics, numRows, copied } = this.state;\n const showGenerateStatistics =\n !loading &&\n error == null &&\n statistics == null &&\n model.isColumnStatisticsAvailable;\n const statisticElements = [];\n const columnType = column.type.substring(column.type.lastIndexOf('.') + 1);\n const description = column.description === null ? null : column.description;\n if (statistics != null) {\n for (let i = 0; i < statistics.length; i += 1) {\n const { operation, className, value, type } = statistics[i];\n const formattedValue = !type\n ? model.displayString(value, column.type, column.name)\n : model.displayString(value, type);\n const statisticElement = (\n <React.Fragment key={operation}>\n <div\n className={classNames('column-statistic-operation', className)}\n >\n {operation}\n </div>\n <div className=\"column-statistic-value\">{formattedValue}</div>\n </React.Fragment>\n );\n statisticElements.push(statisticElement);\n }\n }\n const rowCountLabel = model.hasExpandableRows\n ? 'Expanded Rows'\n : 'Number of Rows';\n const formattedRowCount = model.displayString(numRows, 'long');\n const columnIndex = model.getColumnIndexByName(column.name);\n return (\n <div className=\"column-statistics\">\n <div className=\"column-statistics-title\">\n {column.name}\n <span className=\"column-statistics-type\">&nbsp;({columnType})</span>\n <Button\n kind=\"ghost\"\n className=\"column-statistics-copy\"\n icon={copied ? vsPassFilled : vsCopy}\n onClick={() => {\n ContextActionUtils.copyToClipboard(column.name)\n .then(this.handleCopyHeader)\n .catch(e => log.error('Unable to column name', e));\n }}\n tooltip={copied ? 'Copied text' : 'Copy column name'}\n />\n </div>\n {description && (\n <div className=\"column-statistics-description\">{description}</div>\n )}\n {!model.isColumnMovable(columnIndex) && (\n <div className=\"column-statistics-status\">\n <FontAwesomeIcon\n icon={model.isColumnFrozen(columnIndex) ? dhFreeze : vsLock}\n className=\"mr-1\"\n />\n {model.isColumnFrozen(columnIndex) ? 'Frozen' : 'Not movable'}\n </div>\n )}\n <div className=\"column-statistics-grid\">\n {statistics == null && (\n <>\n <div className=\"column-statistic-operation\">{rowCountLabel}</div>\n <div className=\"column-statistic-value\">{formattedRowCount}</div>\n </>\n )}\n\n {statisticElements}\n </div>\n {showGenerateStatistics && (\n <button\n type=\"button\"\n className=\"btn btn-link px-0\"\n onClick={this.handleGenerateStatistics}\n >\n Generate Stats\n </button>\n )}\n {error && <div className=\"error-message\">{`${error}`}</div>}\n {statistics && !loading && (\n <button\n type=\"button\"\n className=\"btn btn-link px-0\"\n onClick={this.handleGenerateStatistics}\n >\n <FontAwesomeIcon icon={dhRefresh} className=\"mr-1\" />\n Refresh\n </button>\n )}\n {loading && (\n <div className=\"column-statistics-loading\">\n <LoadingSpinner className=\"mr-2\" />\n Calculating Stats...\n </div>\n )}\n </div>\n );\n }\n}\n\nColumnStatistics.propTypes = {\n model: PropTypes.instanceOf(IrisGridModel).isRequired,\n column: APIPropTypes.Column.isRequired,\n onStatistics: PropTypes.func.isRequired,\n};\n\nexport default ColumnStatistics;\n"],"file":"ColumnStatistics.js"}
@@ -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,EAAk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B;;AACA,QAAID,KAAK,IAAI,IAAb,EAAmB;AACjB,aAAO,EAAP;AACD;;AAED,QAAME,SAAS,GAAG,KAAKJ,sBAAL,CAA4BrB,UAA5B,CAAlB;AACA,QAAMM,MAAM,GACVkB,cAAc,IAAI,KAAKJ,eAAL,CAAqBpB,UAArB,EAAiCK,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,M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,KAAKe,gBAAL,CAAsBZ,GAAtB,CAA0BH,QAA1B,CAAhB,EAAqD;AACnD,aAAO,KAAKe,gBAAL,CAAsBT,GAAtB,CAA0BN,QAA1B,CAAP;AACD;;AACD,WAAO,KAAKc,sBAAZ;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;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"}
package/dist/IrisGrid.css CHANGED
@@ -29,6 +29,8 @@
29
29
  negative-number-color: #f95d84;
30
30
  zero-number-color: #fcd65b;
31
31
  date-color: #fcd65b;
32
+ pending-text-color: #fde38d;
33
+ error-text-color: #f95d84;
32
34
  filter-bar-active-bg: #425175;
33
35
  filter-bar-active-color: #4878ea;
34
36
  filter-bar-expanded-bg: #373438;
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/IrisGridTheme.module.scss","../../components/scss/bootstrap_overrides.scss","../src/IrisGrid.scss","../../../node_modules/bootstrap/scss/_variables.scss"],"names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ACA;EACA;EACA,ODlIS;ECmIT;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA,YDxCW;ECyCX;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;AACA;EACE;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AAKA;EACE;;AAEF;EACE;;AAGJ;EACE,OD9KK;;AC+KL;EACE,OD5LQ;;;ACkMhB;EACE,YDvLS;;ACyLP;EACE;EACA;EACA,YD5LK;EC6LL;EACA;;AAEF;EACE,cDjMK;;;ACsMX;EACE;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;;AAEF;EACE;EAEA,YApOuB;;AAsOzB;EACE,YAvOuB;;AAyOzB;EACE,YA1OuB;EA2OvB;;AAEF;EAEE;;AAGF;EACE;;AAEF;EACE;EAEA,WA5PsB;;AA8PxB;EACE,WA/PsB;;AAiQxB;EACE,WAlQsB;EAmQtB;;AAEF;EAEE;;;AAIJ;EACE,kBDzNa;;AC2Nb;EAEE,kBDzQY","file":"IrisGrid.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../src/IrisGridTheme.module.scss","../../components/scss/bootstrap_overrides.scss","../src/IrisGrid.scss","../../../node_modules/bootstrap/scss/_variables.scss"],"names":[],"mappings":"AAAA;AAOA;EACE,SCmBS;EDlBT;EACA,WCCc;EDAd,cCEe;EDDf,wBCeS;EDdT,8BCQS;EDPT,qCCFc;EDGd,uBCPO;EDQP,0BCoDW;EDnDX,yBCUS;EDTT;EACA;EACA,iBAjBgB;EAkBhB,yBCdK;EDeL,gCCKS;EDJT;EACA;EAEA;EACA,qBCFS;EDGT,yBCLS;EDMT,yBCHS;EDIT,kBCRS;EDST,wBCVS;EDWT,yBCZS;EDcT,YCrBe;EDsBf,uBC7BM;ED8BN,uBCjCI;EDkCJ,mBChCO;EDiCP,YCjCO;EDkCP;EACA,kBCrCI;EDwCJ;EAKA,yBCpCc;EDqCd,wBCxBS;EDyBT;EAKA;EAKA,4BCvCS;EDwCT,wBC1D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OuB;EA2OvB;;AAEF;EAEE;;AAGF;EACE;;AAEF;EACE;EAEA,WA5PsB;;AA8PxB;EACE,WA/PsB;;AAiQxB;EACE,WAlQsB;EAmQtB;;AAEF;EAEE;;;AAIJ;EACE,kBDzNa;;AC2Nb;EAEE,kBDzQY","file":"IrisGrid.css"}
@@ -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;
@@ -450,6 +452,7 @@ export class IrisGrid extends React.Component<any, any, any> {
450
452
  advancedFilters: any;
451
453
  }): void;
452
454
  updateFormatterSettings(settings: any, forceUpdate?: boolean): void;
455
+ getAlwaysFetchColumns: ((alwaysFetchColumns: any, columns: any, floatingLeftColumnCount: any, floatingRightColumnCount: any) => any[]) & memoize.Memoized<(alwaysFetchColumns: any, columns: any, floatingLeftColumnCount: any, floatingRightColumnCount: any) => any[]>;
453
456
  updateFormatter(updatedFormats: any, forceUpdate?: boolean): void;
454
457
  initFormatter(): void;
455
458
  initState(): void;
@@ -687,6 +690,12 @@ export namespace IrisGrid {
687
690
  const showTimeZone: boolean;
688
691
  const showTSeparator: boolean;
689
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
+ }>>;
690
699
  }
691
700
  export { settings_1 as settings };
692
701
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IrisGrid.d.ts","sourceRoot":"","sources":["../src/IrisGrid.jsx"],"names":[],"mappings":"AAgHA;IACE,2BAAyB;IAEzB,2BAAyB;IAEzB,mCAA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wBC;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;CAotBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA6GgB,wCAAQ;;QACL,2CAAQ;;QACV,yCAAQ;;QACf,kCAAQ;;QACF,wCAAQ;;QACJ,4CAAQ;;QACD,mDAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;QAYd,6CAAQ;;;;;;;;;;;;;;;;;;;;;;;;QAYb,2CAAQ"}
package/dist/IrisGrid.js CHANGED
@@ -258,6 +258,22 @@ export class IrisGrid extends Component {
258
258
  max: 1
259
259
  }));
260
260
 
261
+ _defineProperty(this, "getAlwaysFetchColumns", memoize((alwaysFetchColumns, columns, floatingLeftColumnCount, floatingRightColumnCount) => {
262
+ var floatingLeftColumns = [];
263
+ var floatingRightColumns = [];
264
+
265
+ if (floatingLeftColumnCount) {
266
+ floatingLeftColumns = columns.slice(0, floatingLeftColumnCount).map(col => col.name);
267
+ }
268
+
269
+ if (floatingRightColumnCount) {
270
+ floatingRightColumns = columns.slice(-floatingRightColumnCount).map(col => col.name);
271
+ }
272
+
273
+ var columnSet = new Set([...alwaysFetchColumns, ...floatingLeftColumns, ...floatingRightColumns]);
274
+ return [...columnSet];
275
+ }));
276
+
261
277
  this.handleAdvancedFilterChange = this.handleAdvancedFilterChange.bind(this);
262
278
  this.handleAdvancedFilterSortChange = this.handleAdvancedFilterSortChange.bind(this);
263
279
  this.handleAdvancedFilterDone = this.handleAdvancedFilterDone.bind(this);
@@ -314,7 +330,9 @@ export class IrisGrid extends Component {
314
330
  this.tooltip = null;
315
331
  this.pending = new Pending();
316
332
  this.globalColumnFormats = [];
317
- 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.
318
336
 
319
337
  this.loadingScrimStartTime = null;
320
338
  this.loadingScrimFinishTime = null;
@@ -935,12 +953,20 @@ export class IrisGrid extends Component {
935
953
  var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
936
954
  var globalColumnFormats = FormatterUtils.getColumnFormats(settings);
937
955
  var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);
956
+ var {
957
+ defaultDecimalFormatOptions = {},
958
+ defaultIntegerFormatOptions = {}
959
+ } = settings;
938
960
  var isColumnFormatChanged = !deepEqual(this.globalColumnFormats, globalColumnFormats);
939
961
  var isDateFormattingChanged = !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions);
962
+ var isDecimalFormattingChanged = !deepEqual(this.decimalFormatOptions, defaultDecimalFormatOptions);
963
+ var isIntegerFormattingChanged = !deepEqual(this.integerFormatOptions, defaultIntegerFormatOptions);
940
964
 
941
- if (isColumnFormatChanged || isDateFormattingChanged) {
965
+ if (isColumnFormatChanged || isDateFormattingChanged || isDecimalFormattingChanged || isIntegerFormattingChanged) {
942
966
  this.globalColumnFormats = globalColumnFormats;
943
967
  this.dateTimeFormatterOptions = dateTimeFormatterOptions;
968
+ this.decimalFormatOptions = defaultDecimalFormatOptions;
969
+ this.integerFormatOptions = defaultIntegerFormatOptions;
944
970
  this.updateFormatter({}, forceUpdate);
945
971
 
946
972
  if (isDateFormattingChanged && forceUpdate) {
@@ -960,7 +986,7 @@ export class IrisGrid extends Component {
960
986
  }, updatedFormats);
961
987
 
962
988
  var mergedColumnFormats = [...this.globalColumnFormats, ...update.customColumnFormatMap.values()];
963
- var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions);
989
+ var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);
964
990
  log.debug('updateFormatter', this.globalColumnFormats, mergedColumnFormats);
965
991
  this.setState(_objectSpread(_objectSpread({}, update), {}, {
966
992
  formatter
@@ -2816,7 +2842,7 @@ export class IrisGrid extends Component {
2816
2842
  movedColumns: movedColumns,
2817
2843
  customColumns: customColumns,
2818
2844
  hiddenColumns: hiddenColumns,
2819
- alwaysFetchColumns: alwaysFetchColumns,
2845
+ alwaysFetchColumns: this.getAlwaysFetchColumns(alwaysFetchColumns, model.columns, model.floatingLeftColumnCount, model.floatingRightColumnCount),
2820
2846
  rollupConfig: this.getModelRollupConfig(model.originalColumns, rollupConfig, aggregationSettings),
2821
2847
  totalsConfig: this.getModelTotalsConfig(model.columns, rollupConfig, aggregationSettings),
2822
2848
  selectDistinctColumns: selectDistinctColumns,
@@ -3032,7 +3058,13 @@ IrisGrid.defaultProps = {
3032
3058
  defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,
3033
3059
  showTimeZone: false,
3034
3060
  showTSeparator: true,
3035
- formatter: []
3061
+ formatter: [],
3062
+ decimalFormatOptions: PropTypes.shape({
3063
+ defaultFormatString: PropTypes.string
3064
+ }),
3065
+ integerFormatOptions: PropTypes.shape({
3066
+ defaultFormatString: PropTypes.string
3067
+ })
3036
3068
  }
3037
3069
  };
3038
3070
  export default IrisGrid;