@deephaven/iris-grid 0.11.3-beta.5 → 0.11.3-beta.7

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.
@@ -25,11 +25,13 @@ declare class Formatter {
25
25
  * @param dateTimeOptions Optional object with DateTime configuration
26
26
  * @param decimalFormatOptions Optional object with Decimal configuration
27
27
  * @param integerFormatOptions Optional object with Integer configuration
28
+ * @param truncateNumbersWithPound Determine if numbers should be truncated w/ repeating # instead of ellipsis at the end
28
29
  */
29
- constructor(columnFormattingRules?: FormattingRule[], dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0], decimalFormatOptions?: ConstructorParameters<typeof DecimalColumnFormatter>[0], integerFormatOptions?: ConstructorParameters<typeof IntegerColumnFormatter>[0]);
30
+ constructor(columnFormattingRules?: FormattingRule[], dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0], decimalFormatOptions?: ConstructorParameters<typeof DecimalColumnFormatter>[0], integerFormatOptions?: ConstructorParameters<typeof IntegerColumnFormatter>[0], truncateNumbersWithPound?: boolean);
30
31
  defaultColumnFormatter: TableColumnFormatter;
31
32
  typeFormatterMap: Map<DataType, TableColumnFormatter>;
32
33
  columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;
34
+ truncateNumbersWithPound: boolean;
33
35
  /**
34
36
  * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary
35
37
  * @param columnType column type
@@ -1 +1 @@
1
- {"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAGL,uBAAuB,EACvB,sBAAsB,EAEtB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAKtB,aAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM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,EAAE,oBAAoB,CAAC,CAAC;IAEtD,eAAe,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/D,wBAAwB,EAAE,OAAO,CAAC;IAElC;;;;;OAKG;IACH,yBAAyB,CACvB,UAAU,EAAE,MAAM,EAClB,iBAAiB,UAAQ,GACxB,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS;IAa7C;;;;;OAKG;IACH,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,iBAAiB,GAAG,IAAI;IAK3B,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB;IAUhE;;;;;;OAMG;IACH,kBAAkB,CAChB,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,SAAK,EACf,cAAc,CAAC,EAAE,iBAAiB,GACjC,MAAM;IAYT;;;OAGG;IACH,IAAI,QAAQ,IAAI,MAAM,CAKrB;CACF;AAED,eAAe,SAAS,CAAC"}
package/dist/Formatter.js CHANGED
@@ -53,6 +53,7 @@ class Formatter {
53
53
  * @param dateTimeOptions Optional object with DateTime configuration
54
54
  * @param decimalFormatOptions Optional object with Decimal configuration
55
55
  * @param integerFormatOptions Optional object with Integer configuration
56
+ * @param truncateNumbersWithPound Determine if numbers should be truncated w/ repeating # instead of ellipsis at the end
56
57
  */
57
58
 
58
59
 
@@ -61,6 +62,7 @@ class Formatter {
61
62
  var dateTimeOptions = arguments.length > 1 ? arguments[1] : undefined;
62
63
  var decimalFormatOptions = arguments.length > 2 ? arguments[2] : undefined;
63
64
  var integerFormatOptions = arguments.length > 3 ? arguments[3] : undefined;
65
+ var truncateNumbersWithPound = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
64
66
 
65
67
  _defineProperty(this, "defaultColumnFormatter", void 0);
66
68
 
@@ -68,6 +70,8 @@ class Formatter {
68
70
 
69
71
  _defineProperty(this, "columnFormatMap", void 0);
70
72
 
73
+ _defineProperty(this, "truncateNumbersWithPound", void 0);
74
+
71
75
  // Formatting order:
72
76
  // - columnFormatMap[type][name]
73
77
  // - typeFormatterMap[type]
@@ -77,6 +81,7 @@ class Formatter {
77
81
  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)], [TableUtils.dataType.STRING, new StringColumnFormatter()]]); // Formats indexed by data type and column name
78
82
 
79
83
  this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);
84
+ this.truncateNumbersWithPound = truncateNumbersWithPound;
80
85
  }
81
86
 
82
87
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Formatter.ts"],"names":["Log","TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","StringColumnFormatter","log","module","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","STRING","columnFormatMap","getColumnFormatMapForType","createIfNecessary","warn","undefined","getColumnFormat","getColumnTypeFormatter","columnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":";;AAAA,SAASA,GAAT,QAAoB,gBAApB;OACOC,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB;OAIKC,qB;AAEP,IAAMC,GAAG,GAAGT,GAAG,CAACU,MAAJ,CAAW,WAAX,CA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AAL,CAAsBT,GAAtB,CAChBvB,UAAU,CAACiB,QAAX,CAAoBkB,QADJ,CAAlB;AAGA,WAAOe,SAAP,aAAOA,SAAP,gDAAOA,SAAS,CAAEE,UAAlB,0DAAO,sBAAuBC,EAA9B;AACD;;AAhLa;;AAmLhB,eAAe3C,SAAf","sourcesContent":["import { Log } from '@deephaven/log';\nimport TableUtils, { DataType } from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n TableColumnFormat,\n TableColumnFormatter,\n} from './formatters';\nimport StringColumnFormatter from './formatters/StringColumnFormatter';\n\nconst log = Log.module('Formatter');\n\ntype ColumnName = string;\n\nexport interface FormattingRule {\n columnType: string;\n columnName: string;\n format: TableColumnFormat;\n}\n\nclass Formatter {\n /**\n * Converts FormattingRule[] to Map\n * @param columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(\n columnFormattingRules: FormattingRule[]\n ): Map<DataType, Map<ColumnName, TableColumnFormat>> {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (dataType === null) {\n return map;\n }\n\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<DataType, Map<ColumnName, TableColumnFormat>>());\n }\n\n /**\n * Creates a column formatting rule\n * @param columnType Normalized data type\n * @param columnName Column name\n * @param format Format object\n */\n static makeColumnFormattingRule(\n columnType: DataType,\n columnName: string,\n format: TableColumnFormat\n ): FormattingRule {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param columnFormattingRules Optional array of column formatting rules\n * @param dateTimeOptions Optional object with DateTime configuration\n * @param decimalFormatOptions Optional object with Decimal configuration\n * @param integerFormatOptions Optional object with Integer configuration\n */\n constructor(\n columnFormattingRules: FormattingRule[] = [],\n dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0],\n decimalFormatOptions?: ConstructorParameters<\n typeof DecimalColumnFormatter\n >[0],\n integerFormatOptions?: ConstructorParameters<\n typeof IntegerColumnFormatter\n >[0]\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<DataType, TableColumnFormatter>([\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 [TableUtils.dataType.STRING, new StringColumnFormatter()],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n }\n\n defaultColumnFormatter: TableColumnFormatter;\n\n typeFormatterMap: Map<DataType, TableColumnFormatter>;\n\n columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param columnType column type\n * @param 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(\n columnType: string,\n createIfNecessary = false\n ): Map<string, TableColumnFormat> | undefined {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType === null) {\n log.warn(`Unknown columnType ${columnType}`);\n return undefined;\n }\n\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 columnType column type\n * @param columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(\n columnType: string,\n columnName: string\n ): TableColumnFormat | null {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n return columnFormatMap?.get(columnName) ?? null;\n }\n\n getColumnTypeFormatter(columnType: string): TableColumnFormatter {\n const dataType = TableUtils.getNormalizedType(columnType);\n let columnTypeFormatter = this.defaultColumnFormatter;\n if (dataType) {\n columnTypeFormatter =\n this.typeFormatterMap.get(dataType) ?? columnTypeFormatter;\n }\n return columnTypeFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param value Value to format\n * @param columnType Column type used to determine the formatting settings\n * @param columnName Column name used to determine the formatting settings\n * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value: unknown,\n columnType: string,\n columnName = '',\n formatOverride?: TableColumnFormat\n ): string {\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 ?? undefined);\n }\n\n /**\n * Gets the timeZone name\n * @returns The time zone name E.g. America/New_York\n */\n get timeZone(): string {\n const formatter = this.typeFormatterMap.get(\n TableUtils.dataType.DATETIME\n ) as DateTimeColumnFormatter;\n return formatter?.dhTimeZone?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
1
+ {"version":3,"sources":["../src/Formatter.ts"],"names":["Log","TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","StringColumnFormatter","log","module","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","decimalFormatOptions","integerFormatOptions","truncateNumbersWithPound","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","STRING","columnFormatMap","getColumnFormatMapForType","createIfNecessary","warn","undefined","getColumnFormat","getColumnTypeFormatter","columnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":";;AAAA,SAASA,GAAT,QAAoB,gBAApB;OACOC,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB;OAIKC,qB;AAEP,IAAMC,GAAG,GAAGT,GAAG,CAACU,MAAJ,CAAW,WAAX,CAAZ;;AAUA,MAAMC,SAAN,CAAgB;AACd;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB,CACxBC,qBADwB,EAE2B;AACnD,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,GAAGjB,UAAU,CAACkB,iBAAX,CAA6BF,IAAI,CAACG,UAAlC,CAAjB;;AACA,UAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACrB,eAAOF,GAAP;AACD;;AAED,UAAI,CAACA,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,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAED,GAAX,CAAeL,IAAI,CAACQ,UAApB,EAAgCR,IAAI,CAACS,MAArC;AACA,aAAOV,GAAP;AACD,KAZM,EAYJ,IAAIF,GAAJ,EAZI,CAAP;AAaD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACiC,SAAxBa,wBAAwB,CAC7BP,UAD6B,EAE7BK,UAF6B,EAG7BC,MAH6B,EAIb;AAChB,WAAO;AACLN,MAA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EAAP;AACD;;AAED,QAAME,SAAS,GAAG,KAAKL,sBAAL,CAA4B3B,UAA5B,CAAlB;AACA,QAAMM,MAAM,GACVyB,cAAc,IAAI,KAAKL,eAAL,CAAqB1B,UAArB,EAAiCK,UAAjC,CADpB;AAGA,WAAO2B,SAAS,CAAC1B,MAAV,CAAiBwB,KAAjB,EAAwBxB,MAAxB,aAAwBA,MAAxB,cAAwBA,MAAxB,GAAkCmB,SAAlC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARQ,QAAQ,GAAW;AAAA;;AACrB,QAAMD,SAAS,GAAG,KAAKlB,gBAAL,CAAsBV,GAAtB,CAChBvB,UAAU,CAACiB,QAAX,CAAoBmB,QADJ,CAAlB;AAGA,WAAOe,SAAP,aAAOA,SAAP,gDAAOA,SAAS,CAAEE,UAAlB,0DAAO,sBAAuBC,EAA9B;AACD;;AArLa;;AAwLhB,eAAe5C,SAAf","sourcesContent":["import { Log } from '@deephaven/log';\nimport TableUtils, { DataType } from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n TableColumnFormat,\n TableColumnFormatter,\n} from './formatters';\nimport StringColumnFormatter from './formatters/StringColumnFormatter';\n\nconst log = Log.module('Formatter');\n\ntype ColumnName = string;\n\nexport interface FormattingRule {\n columnType: string;\n columnName: string;\n format: TableColumnFormat;\n}\n\nclass Formatter {\n /**\n * Converts FormattingRule[] to Map\n * @param columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(\n columnFormattingRules: FormattingRule[]\n ): Map<DataType, Map<ColumnName, TableColumnFormat>> {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (dataType === null) {\n return map;\n }\n\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<DataType, Map<ColumnName, TableColumnFormat>>());\n }\n\n /**\n * Creates a column formatting rule\n * @param columnType Normalized data type\n * @param columnName Column name\n * @param format Format object\n */\n static makeColumnFormattingRule(\n columnType: DataType,\n columnName: string,\n format: TableColumnFormat\n ): FormattingRule {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param columnFormattingRules Optional array of column formatting rules\n * @param dateTimeOptions Optional object with DateTime configuration\n * @param decimalFormatOptions Optional object with Decimal configuration\n * @param integerFormatOptions Optional object with Integer configuration\n * @param truncateNumbersWithPound Determine if numbers should be truncated w/ repeating # instead of ellipsis at the end\n */\n constructor(\n columnFormattingRules: FormattingRule[] = [],\n dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0],\n decimalFormatOptions?: ConstructorParameters<\n typeof DecimalColumnFormatter\n >[0],\n integerFormatOptions?: ConstructorParameters<\n typeof IntegerColumnFormatter\n >[0],\n truncateNumbersWithPound = false\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<DataType, TableColumnFormatter>([\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 [TableUtils.dataType.STRING, new StringColumnFormatter()],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n this.truncateNumbersWithPound = truncateNumbersWithPound;\n }\n\n defaultColumnFormatter: TableColumnFormatter;\n\n typeFormatterMap: Map<DataType, TableColumnFormatter>;\n\n columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;\n\n truncateNumbersWithPound: boolean;\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param columnType column type\n * @param 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(\n columnType: string,\n createIfNecessary = false\n ): Map<string, TableColumnFormat> | undefined {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType === null) {\n log.warn(`Unknown columnType ${columnType}`);\n return undefined;\n }\n\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 columnType column type\n * @param columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(\n columnType: string,\n columnName: string\n ): TableColumnFormat | null {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n return columnFormatMap?.get(columnName) ?? null;\n }\n\n getColumnTypeFormatter(columnType: string): TableColumnFormatter {\n const dataType = TableUtils.getNormalizedType(columnType);\n let columnTypeFormatter = this.defaultColumnFormatter;\n if (dataType) {\n columnTypeFormatter =\n this.typeFormatterMap.get(dataType) ?? columnTypeFormatter;\n }\n return columnTypeFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param value Value to format\n * @param columnType Column type used to determine the formatting settings\n * @param columnName Column name used to determine the formatting settings\n * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value: unknown,\n columnType: string,\n columnName = '',\n formatOverride?: TableColumnFormat\n ): string {\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 ?? undefined);\n }\n\n /**\n * Gets the timeZone name\n * @returns The time zone name E.g. America/New_York\n */\n get timeZone(): string {\n const formatter = this.typeFormatterMap.get(\n TableUtils.dataType.DATETIME\n ) as DateTimeColumnFormatter;\n return formatter?.dhTimeZone?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
@@ -89,6 +89,7 @@ export class IrisGrid extends React.Component<any, any, any> {
89
89
  dateTimeFormatterOptions: {};
90
90
  decimalFormatOptions: {};
91
91
  integerFormatOptions: {};
92
+ truncateNumbersWithPound: boolean;
92
93
  loadingScrimStartTime: number | null;
93
94
  loadingScrimFinishTime: number | null;
94
95
  loadingTimer: NodeJS.Timeout | null;
@@ -355,6 +356,7 @@ export namespace IrisGrid {
355
356
  defaultDateTimeFormat: PropTypes.Validator<string>;
356
357
  showTimeZone: PropTypes.Validator<boolean>;
357
358
  showTSeparator: PropTypes.Validator<boolean>;
359
+ truncateNumbersWithPound: PropTypes.Validator<boolean>;
358
360
  formatter: PropTypes.Validator<(PropTypes.InferProps<{}> | null | undefined)[]>;
359
361
  }>>;
360
362
  const userColumnWidths: PropTypes.Requireable<Map<unknown, unknown>>;
@@ -499,6 +501,7 @@ export namespace IrisGrid {
499
501
  const defaultDateTimeFormat: string;
500
502
  const showTimeZone: boolean;
501
503
  const showTSeparator: boolean;
504
+ const truncateNumbersWithPound: boolean;
502
505
  const formatter: never[];
503
506
  const decimalFormatOptions: PropTypes.Requireable<PropTypes.InferProps<{
504
507
  defaultFormatString: PropTypes.Requireable<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"IrisGrid.d.ts","sourceRoot":"","sources":["../src/IrisGrid.jsx"],"names":[],"mappings":"AAyHA;IACE,2BAAyB;IAEzB,2BAAyB;IAEzB,mCAAiC;IAEjC,sHAOC;IAED,wBAsSC;IA64CD,yEAOC;IAED,2FA0BC;IAED,iCAEC;IAED,4CAEC;IAED,iDAeC;IAkYD;;;OAGG;IACH,wDAaC;IAhCD;;;OAGG;IACH,yEASC;IAqBD;;;OAGG;IACH,sDAeC;IAnuBD,4BAOC;IAED,6BAMC;IAED,2B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0BC;IAED,wDAQC;IAED,gDAiBC;IAED,kDAmBC;IAmGD,uCASC;IAED,uBAWC;IAED,uDAaC;IAED,8BAIC;IAED,6FAYC;IAED,gCAIC;IAED,oBAGC;IAED,wCA2BC;IAED,8BAYC;IAED,wBAmBC;IAED,+BAgCC;IAED,gCAYC;IAED;;;OAGG;IACH,sCAGC;IAED;;OAEG;IACH,kDAcC;IA0lBD;;;OAGG;IACH,qBAFW,SAAS,EAAE,QASrB;IAED,6BAYC;IAED,gDAUC;IAED,wBASC;IAQD,gKA+BG;CAs0BJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4HmB,2CAAQ;;QACV,yCAAQ;;QACf,kCAAQ;;QACF,wCAAQ;;QACJ,4CAAQ;;QACD,mDAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;QAYd,6CAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAcb,2CAAQ"}
package/dist/IrisGrid.js CHANGED
@@ -411,7 +411,8 @@ export class IrisGrid extends Component {
411
411
  this.globalColumnFormats = [];
412
412
  this.dateTimeFormatterOptions = {};
413
413
  this.decimalFormatOptions = {};
414
- this.integerFormatOptions = {}; // When the loading scrim started/when it should extend to the end of the screen.
414
+ this.integerFormatOptions = {};
415
+ this.truncateNumbersWithPound = false; // When the loading scrim started/when it should extend to the end of the screen.
415
416
 
416
417
  this.loadingScrimStartTime = null;
417
418
  this.loadingScrimFinishTime = null;
@@ -1047,18 +1048,21 @@ export class IrisGrid extends Component {
1047
1048
  var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);
1048
1049
  var {
1049
1050
  defaultDecimalFormatOptions = {},
1050
- defaultIntegerFormatOptions = {}
1051
+ defaultIntegerFormatOptions = {},
1052
+ truncateNumbersWithPound = false
1051
1053
  } = settings;
1052
1054
  var isColumnFormatChanged = !deepEqual(this.globalColumnFormats, globalColumnFormats);
1053
1055
  var isDateFormattingChanged = !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions);
1054
1056
  var isDecimalFormattingChanged = !deepEqual(this.decimalFormatOptions, defaultDecimalFormatOptions);
1055
1057
  var isIntegerFormattingChanged = !deepEqual(this.integerFormatOptions, defaultIntegerFormatOptions);
1058
+ var isTruncateNumbersChanged = this.truncateNumbersWithPound !== truncateNumbersWithPound;
1056
1059
 
1057
- if (isColumnFormatChanged || isDateFormattingChanged || isDecimalFormattingChanged || isIntegerFormattingChanged) {
1060
+ if (isColumnFormatChanged || isDateFormattingChanged || isDecimalFormattingChanged || isIntegerFormattingChanged || isTruncateNumbersChanged) {
1058
1061
  this.globalColumnFormats = globalColumnFormats;
1059
1062
  this.dateTimeFormatterOptions = dateTimeFormatterOptions;
1060
1063
  this.decimalFormatOptions = defaultDecimalFormatOptions;
1061
1064
  this.integerFormatOptions = defaultIntegerFormatOptions;
1065
+ this.truncateNumbersWithPound = truncateNumbersWithPound;
1062
1066
  this.updateFormatter({}, forceUpdate);
1063
1067
 
1064
1068
  if (isDateFormattingChanged && forceUpdate) {
@@ -1078,7 +1082,7 @@ export class IrisGrid extends Component {
1078
1082
  }, updatedFormats);
1079
1083
 
1080
1084
  var mergedColumnFormats = [...this.globalColumnFormats, ...update.customColumnFormatMap.values()];
1081
- var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);
1085
+ var formatter = new Formatter(mergedColumnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions, this.truncateNumbersWithPound);
1082
1086
  log.debug('updateFormatter', this.globalColumnFormats, mergedColumnFormats);
1083
1087
  this.setState(_objectSpread(_objectSpread({}, update), {}, {
1084
1088
  formatter
@@ -3341,6 +3345,7 @@ IrisGrid.propTypes = {
3341
3345
  defaultDateTimeFormat: PropTypes.string.isRequired,
3342
3346
  showTimeZone: PropTypes.bool.isRequired,
3343
3347
  showTSeparator: PropTypes.bool.isRequired,
3348
+ truncateNumbersWithPound: PropTypes.bool.isRequired,
3344
3349
  formatter: PropTypes.arrayOf(PropTypes.shape({})).isRequired
3345
3350
  }),
3346
3351
  userColumnWidths: PropTypes.instanceOf(Map),
@@ -3442,6 +3447,7 @@ IrisGrid.defaultProps = {
3442
3447
  defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,
3443
3448
  showTimeZone: false,
3444
3449
  showTSeparator: true,
3450
+ truncateNumbersWithPound: false,
3445
3451
  formatter: [],
3446
3452
  decimalFormatOptions: PropTypes.shape({
3447
3453
  defaultFormatString: PropTypes.string