@deephaven/jsapi-utils 0.22.3-beta.15 → 0.22.3-beta.21

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 (36) hide show
  1. package/dist/ConnectionUtils.js +3 -7
  2. package/dist/ConnectionUtils.js.map +1 -1
  3. package/dist/DateUtils.js +12 -58
  4. package/dist/DateUtils.js.map +1 -1
  5. package/dist/Formatter.d.ts +1 -1
  6. package/dist/Formatter.d.ts.map +1 -1
  7. package/dist/Formatter.js +10 -35
  8. package/dist/Formatter.js.map +1 -1
  9. package/dist/FormatterUtils.js +1 -2
  10. package/dist/FormatterUtils.js.map +1 -1
  11. package/dist/TableUtils.d.ts +4 -2
  12. package/dist/TableUtils.d.ts.map +1 -1
  13. package/dist/TableUtils.js +26 -291
  14. package/dist/TableUtils.js.map +1 -1
  15. package/dist/formatters/BooleanColumnFormatter.js +0 -6
  16. package/dist/formatters/BooleanColumnFormatter.js.map +1 -1
  17. package/dist/formatters/CharColumnFormatter.js +0 -4
  18. package/dist/formatters/CharColumnFormatter.js.map +1 -1
  19. package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
  20. package/dist/formatters/DateTimeColumnFormatter.js +4 -28
  21. package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
  22. package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
  23. package/dist/formatters/DecimalColumnFormatter.js +8 -28
  24. package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
  25. package/dist/formatters/DefaultColumnFormatter.js +0 -4
  26. package/dist/formatters/DefaultColumnFormatter.js.map +1 -1
  27. package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
  28. package/dist/formatters/IntegerColumnFormatter.js +9 -25
  29. package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
  30. package/dist/formatters/StringColumnFormatter.js +0 -2
  31. package/dist/formatters/StringColumnFormatter.js.map +1 -1
  32. package/dist/formatters/TableColumnFormatter.js +4 -13
  33. package/dist/formatters/TableColumnFormatter.js.map +1 -1
  34. package/dist/formatters/index.js.map +1 -1
  35. package/dist/index.js.map +1 -1
  36. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","DateTimeColumnFormatter","isValid","format","i18n","DateTimeFormat","formatString","Date","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","isSameFormat","formatA","formatB","makeGlobalFormatStringMap","showTimeZone","showTSeparator","separator","tz","Map","getGlobalFormats","formatStringMap","keys","makeFormatStringMap","undefined","getFormats","constructor","timeZone","timeZoneParam","defaultDateTimeFormatString","DEFAULT_DATETIME_FORMAT_STRING","DEFAULT_TIME_ZONE_ID","dhTimeZone","TimeZone","getTimeZone","error","getEffectiveFormatString","baseFormatString","get","value"],"sources":["../../src/formatters/DateTimeColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh, { DateWrapper, TimeZone } from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('DateTimeColumnFormatter');\n\nexport type DateTimeColumnFormatterOptions = {\n // Time zone\n timeZone?: string;\n\n // Show time zone in DateTime values\n showTimeZone?: boolean;\n\n // Show 'T' separator in DateTime values\n showTSeparator?: boolean;\n\n // DateTime format to use if columnFormats for DateTime isn't set\n defaultDateTimeFormatString?: string;\n};\n\nexport class DateTimeColumnFormatter extends TableColumnFormatter<\n Date | DateWrapper | number\n> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.DateTimeFormat.format(format.formatString, new Date());\n return true;\n } catch (e) {\n return false;\n }\n }\n\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET\n ): TableColumnFormat {\n return {\n label,\n formatString,\n type,\n };\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: TableColumnFormat | null,\n formatB: TableColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA !== null &&\n formatB !== null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString)\n );\n }\n\n static DEFAULT_DATETIME_FORMAT_STRING = 'yyyy-MM-dd HH:mm:ss.SSS';\n\n static DEFAULT_TIME_ZONE_ID = 'America/New_York';\n\n static makeGlobalFormatStringMap(\n showTimeZone: boolean,\n showTSeparator: boolean\n ): Map<string, string> {\n const separator = showTSeparator ? `'T'` : ' ';\n const tz = showTimeZone ? ' z' : '';\n return new Map([\n ['yyyy-MM-dd HH:mm:ss', `yyyy-MM-dd${separator}HH:mm:ss${tz}`],\n ['yyyy-MM-dd HH:mm:ss.SSS', `yyyy-MM-dd${separator}HH:mm:ss.SSS${tz}`],\n [\n 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS',\n `yyyy-MM-dd${separator}HH:mm:ss.SSSSSSSSS${tz}`,\n ],\n ]);\n }\n\n static getGlobalFormats(\n showTimeZone: boolean,\n showTSeparator: boolean\n ): string[] {\n const formatStringMap = DateTimeColumnFormatter.makeGlobalFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n return [...formatStringMap.keys()];\n }\n\n static makeFormatStringMap(\n showTimeZone?: boolean,\n showTSeparator?: boolean\n ): Map<string, string> {\n const separator =\n showTSeparator !== undefined && showTSeparator ? `'T'` : ' ';\n const tz = showTimeZone !== undefined && showTimeZone ? ' z' : '';\n return new Map([\n ['yyyy-MM-dd', `yyyy-MM-dd${tz}`],\n ['MM-dd-yyyy', `MM-dd-yyyy${tz}`],\n ['HH:mm:ss', `HH:mm:ss${tz}`],\n ['HH:mm:ss.SSS', `HH:mm:ss.SSS${tz}`],\n ['HH:mm:ss.SSSSSSSSS', `HH:mm:ss.SSSSSSSSS${tz}`],\n ['yyyy-MM-dd HH:mm:ss', `yyyy-MM-dd${separator}HH:mm:ss${tz}`],\n ['yyyy-MM-dd HH:mm:ss.SSS', `yyyy-MM-dd${separator}HH:mm:ss.SSS${tz}`],\n [\n 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS',\n `yyyy-MM-dd${separator}HH:mm:ss.SSSSSSSSS${tz}`,\n ],\n ]);\n }\n\n static getFormats(\n showTimeZone?: boolean,\n showTSeparator?: boolean\n ): string[] {\n const formatStringMap = DateTimeColumnFormatter.makeFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n return [...formatStringMap.keys()];\n }\n\n dhTimeZone: TimeZone;\n\n defaultDateTimeFormatString: string;\n\n showTimeZone: boolean;\n\n showTSeparator: boolean;\n\n formatStringMap: Map<string, string>;\n\n constructor({\n timeZone: timeZoneParam = '',\n showTimeZone = true,\n showTSeparator = false,\n defaultDateTimeFormatString = DateTimeColumnFormatter.DEFAULT_DATETIME_FORMAT_STRING,\n }: DateTimeColumnFormatterOptions = {}) {\n super();\n\n const timeZone =\n timeZoneParam || DateTimeColumnFormatter.DEFAULT_TIME_ZONE_ID;\n\n try {\n this.dhTimeZone = dh.i18n.TimeZone.getTimeZone(timeZone);\n } catch (e) {\n log.error('Unsupported time zone id', timeZone);\n this.dhTimeZone = dh.i18n.TimeZone.getTimeZone(\n DateTimeColumnFormatter.DEFAULT_TIME_ZONE_ID\n );\n }\n\n this.defaultDateTimeFormatString = defaultDateTimeFormatString;\n this.showTimeZone = showTimeZone;\n this.showTSeparator = showTSeparator;\n this.formatStringMap = DateTimeColumnFormatter.makeFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n }\n\n getEffectiveFormatString(baseFormatString: string): string {\n return this.formatStringMap.get(baseFormatString) ?? baseFormatString;\n }\n\n format(\n value: Date | DateWrapper | number,\n format?: Partial<TableColumnFormat>\n ): string {\n const baseFormatString =\n (format && format.formatString) || this.defaultDateTimeFormatString;\n const formatString = this.getEffectiveFormatString(baseFormatString);\n try {\n return dh.i18n.DateTimeFormat.format(\n formatString,\n value,\n this.dhTimeZone\n );\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default DateTimeColumnFormatter;\n"],"mappings":";;AAAA;AACA,OAAOA,EAAP,MAA0C,uBAA1C;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,oB;AAIP,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAJ,CAAW,yBAAX,CAAZ;AAgBA,OAAO,MAAMC,uBAAN,SAAsCH,oBAAtC,CAEL;EACA;AACF;AACA;AACA;AACA;EACgB,OAAPI,OAAO,CAACC,MAAD,EAA2D;IACvE,IAAI;MACFP,EAAE,CAACQ,IAAH,CAAQC,cAAR,CAAuBF,MAAvB,CAA8BA,MAAM,CAACG,YAArC,EAAmD,IAAIC,IAAJ,EAAnD;MACA,OAAO,IAAP;IACD,CAHD,CAGE,OAAOC,CAAP,EAAU;MACV,OAAO,KAAP;IACD;EACF;;EAEgB,OAAVC,UAAU,CACfC,KADe,EAEfJ,YAFe,EAII;IAAA,IADnBK,IACmB,uEADZb,oBAAoB,CAACc,mBACT;IACnB,OAAO;MACLF,KADK;MAELJ,YAFK;MAGLK;IAHK,CAAP;EAKD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACqB,OAAZE,YAAY,CACjBC,OADiB,EAEjBC,OAFiB,EAGR;IACT,OACED,OAAO,KAAKC,OAAZ,IACCD,OAAO,KAAK,IAAZ,IACCC,OAAO,KAAK,IADb,IAECD,OAAO,CAACH,IAAR,KAAiBI,OAAO,CAACJ,IAF1B,IAGCG,OAAO,CAACR,YAAR,KAAyBS,OAAO,CAACT,YALrC;EAOD;;EAM+B,OAAzBU,yBAAyB,CAC9BC,YAD8B,EAE9BC,cAF8B,EAGT;IACrB,IAAMC,SAAS,GAAGD,cAAc,WAAW,GAA3C;IACA,IAAME,EAAE,GAAGH,YAAY,GAAG,IAAH,GAAU,EAAjC;IACA,OAAO,IAAII,GAAJ,CAAQ,CACb,CAAC,qBAAD,sB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,EAELmC,KAFK,EAGL,KAAKP,UAHA,CAAP;IAKD,CAND,CAME,OAAO1B,CAAP,EAAU;MACVT,GAAG,CAACsC,KAAJ,CAAU,0BAAV;IACD;;IACD,OAAO,EAAP;EACD;;AA1KD;;gBAFWpC,uB,oCAgD6B,yB;;gBAhD7BA,uB,0BAkDmB,kB;;AA6HhC,eAAeA,uBAAf"}
1
+ {"version":3,"file":"DateTimeColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","DateTimeColumnFormatter","isValid","format","i18n","DateTimeFormat","formatString","Date","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","isSameFormat","formatA","formatB","makeGlobalFormatStringMap","showTimeZone","showTSeparator","separator","tz","Map","getGlobalFormats","formatStringMap","keys","makeFormatStringMap","undefined","getFormats","constructor","timeZone","timeZoneParam","defaultDateTimeFormatString","DEFAULT_DATETIME_FORMAT_STRING","DEFAULT_TIME_ZONE_ID","dhTimeZone","TimeZone","getTimeZone","error","getEffectiveFormatString","baseFormatString","get","value"],"sources":["../../src/formatters/DateTimeColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh, { DateWrapper, TimeZone } from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('DateTimeColumnFormatter');\n\nexport type DateTimeColumnFormatterOptions = {\n // Time zone\n timeZone?: string;\n\n // Show time zone in DateTime values\n showTimeZone?: boolean;\n\n // Show 'T' separator in DateTime values\n showTSeparator?: boolean;\n\n // DateTime format to use if columnFormats for DateTime isn't set\n defaultDateTimeFormatString?: string;\n};\n\nexport class DateTimeColumnFormatter extends TableColumnFormatter<\n Date | DateWrapper | number\n> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.DateTimeFormat.format(format.formatString, new Date());\n return true;\n } catch (e) {\n return false;\n }\n }\n\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET\n ): TableColumnFormat {\n return {\n label,\n formatString,\n type,\n };\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: TableColumnFormat | null,\n formatB: TableColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA !== null &&\n formatB !== null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString)\n );\n }\n\n static DEFAULT_DATETIME_FORMAT_STRING = 'yyyy-MM-dd HH:mm:ss.SSS';\n\n static DEFAULT_TIME_ZONE_ID = 'America/New_York';\n\n static makeGlobalFormatStringMap(\n showTimeZone: boolean,\n showTSeparator: boolean\n ): Map<string, string> {\n const separator = showTSeparator ? `'T'` : ' ';\n const tz = showTimeZone ? ' z' : '';\n return new Map([\n ['yyyy-MM-dd HH:mm:ss', `yyyy-MM-dd${separator}HH:mm:ss${tz}`],\n ['yyyy-MM-dd HH:mm:ss.SSS', `yyyy-MM-dd${separator}HH:mm:ss.SSS${tz}`],\n [\n 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS',\n `yyyy-MM-dd${separator}HH:mm:ss.SSSSSSSSS${tz}`,\n ],\n ]);\n }\n\n static getGlobalFormats(\n showTimeZone: boolean,\n showTSeparator: boolean\n ): string[] {\n const formatStringMap = DateTimeColumnFormatter.makeGlobalFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n return [...formatStringMap.keys()];\n }\n\n static makeFormatStringMap(\n showTimeZone?: boolean,\n showTSeparator?: boolean\n ): Map<string, string> {\n const separator =\n showTSeparator !== undefined && showTSeparator ? `'T'` : ' ';\n const tz = showTimeZone !== undefined && showTimeZone ? ' z' : '';\n return new Map([\n ['yyyy-MM-dd', `yyyy-MM-dd${tz}`],\n ['MM-dd-yyyy', `MM-dd-yyyy${tz}`],\n ['HH:mm:ss', `HH:mm:ss${tz}`],\n ['HH:mm:ss.SSS', `HH:mm:ss.SSS${tz}`],\n ['HH:mm:ss.SSSSSSSSS', `HH:mm:ss.SSSSSSSSS${tz}`],\n ['yyyy-MM-dd HH:mm:ss', `yyyy-MM-dd${separator}HH:mm:ss${tz}`],\n ['yyyy-MM-dd HH:mm:ss.SSS', `yyyy-MM-dd${separator}HH:mm:ss.SSS${tz}`],\n [\n 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS',\n `yyyy-MM-dd${separator}HH:mm:ss.SSSSSSSSS${tz}`,\n ],\n ]);\n }\n\n static getFormats(\n showTimeZone?: boolean,\n showTSeparator?: boolean\n ): string[] {\n const formatStringMap = DateTimeColumnFormatter.makeFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n return [...formatStringMap.keys()];\n }\n\n dhTimeZone: TimeZone;\n\n defaultDateTimeFormatString: string;\n\n showTimeZone: boolean;\n\n showTSeparator: boolean;\n\n formatStringMap: Map<string, string>;\n\n constructor({\n timeZone: timeZoneParam = '',\n showTimeZone = true,\n showTSeparator = false,\n defaultDateTimeFormatString = DateTimeColumnFormatter.DEFAULT_DATETIME_FORMAT_STRING,\n }: DateTimeColumnFormatterOptions = {}) {\n super();\n\n const timeZone =\n timeZoneParam || DateTimeColumnFormatter.DEFAULT_TIME_ZONE_ID;\n\n try {\n this.dhTimeZone = dh.i18n.TimeZone.getTimeZone(timeZone);\n } catch (e) {\n log.error('Unsupported time zone id', timeZone);\n this.dhTimeZone = dh.i18n.TimeZone.getTimeZone(\n DateTimeColumnFormatter.DEFAULT_TIME_ZONE_ID\n );\n }\n\n this.defaultDateTimeFormatString = defaultDateTimeFormatString;\n this.showTimeZone = showTimeZone;\n this.showTSeparator = showTSeparator;\n this.formatStringMap = DateTimeColumnFormatter.makeFormatStringMap(\n showTimeZone,\n showTSeparator\n );\n }\n\n getEffectiveFormatString(baseFormatString: string): string {\n return this.formatStringMap.get(baseFormatString) ?? baseFormatString;\n }\n\n format(\n value: Date | DateWrapper | number,\n format: Partial<TableColumnFormat> = {}\n ): string {\n const baseFormatString =\n format.formatString != null && format.formatString !== ''\n ? format.formatString\n : this.defaultDateTimeFormatString;\n const formatString = this.getEffectiveFormatString(baseFormatString);\n try {\n return dh.i18n.DateTimeFormat.format(\n formatString,\n value,\n this.dhTimeZone\n );\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default DateTimeColumnFormatter;\n"],"mappings":";AAAA;AACA,OAAOA,EAAE,MAAiC,uBAAuB;AACjE,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,oBAAoB;AAI3B,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAM,CAAC,yBAAyB,CAAC;AAgBjD,OAAO,MAAMC,uBAAuB,SAASH,oBAAoB,CAE/D;EACA;AACF;AACA;AACA;AACA;EACE,OAAOI,OAAO,CAACC,MAA+C,EAAW;IACvE,IAAI;MACFP,EAAE,CAACQ,IAAI,CAACC,cAAc,CAACF,MAAM,CAACA,MAAM,CAACG,YAAY,EAAE,IAAIC,IAAI,EAAE,CAAC;MAC9D,OAAO,IAAI;IACb,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAO,KAAK;IACd;EACF;EAEA,OAAOC,UAAU,CACfC,KAAa,EACbJ,YAAoB,EAED;IAAA,IADnBK,IAAI,uEAAGb,oBAAoB,CAACc,mBAAmB;IAE/C,OAAO;MACLF,KAAK;MACLJ,YAAY;MACZK;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOE,YAAY,CACjBC,OAAiC,EACjCC,OAAiC,EACxB;IACT,OACED,OAAO,KAAKC,OAAO,IAClBD,OAAO,KAAK,IAAI,IACfC,OAAO,KAAK,IAAI,IAChBD,OAAO,CAACH,IAAI,KAAKI,OAAO,CAACJ,IAAI,IAC7BG,OAAO,CAACR,YAAY,KAAKS,OAAO,CAACT,YAAa;EAEpD;EAMA,OAAOU,yBAAyB,CAC9BC,YAAqB,EACrBC,cAAuB,EACF;IACrB,I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KAAK,EAAE,GACrDH,MAAM,CAACG,YAAY,GACnB,IAAI,CAACyB,2BAA2B;IACtC,IAAMzB,YAAY,GAAG,IAAI,CAACgC,wBAAwB,CAACC,gBAAgB,CAAC;IACpE,IAAI;MACF,OAAO3C,EAAE,CAACQ,IAAI,CAACC,cAAc,CAACF,MAAM,CAClCG,YAAY,EACZmC,KAAK,EACL,IAAI,CAACP,UAAU,CAChB;IACH,CAAC,CAAC,OAAO1B,CAAC,EAAE;MACVT,GAAG,CAACsC,KAAK,CAAC,0BAA0B,CAAC;IACvC;IACA,OAAO,EAAE;EACX;AACF;AAAC,gBA/KYpC,uBAAuB,oCAgDM,yBAAyB;AAAA,gBAhDtDA,uBAAuB,0BAkDJ,kBAAkB;AA+HlD,eAAeA,uBAAuB"}
@@ -1 +1 @@
1
- {"version":3,"file":"DecimalColumnFormatter.d.ts","sourceRoot":"","sources":["../../src/formatters/DecimalColumnFormatter.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,EAAE,EAC3B,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAIhC,oBAAY,mBAAmB,GAAG,iBAAiB,GAAG;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,6BAA6B,GAAG;IAE1C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,oBAAoB,CAAC,MAAM,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,GAAG,OAAO;IASxE;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CACf,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,IAAI,yDAA2C,EAC/C,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB;IAStB;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CACrB,KAAK,EAAE,MAAM,EACb,YAAY,SAA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AAC,iBAAiB,EAAE,cAAc,CAAC,GAAG,OAAO;IASxE;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CACf,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,EACpB,IAAI,yDAA2C,EAC/C,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB;IAStB;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CACrB,KAAK,EAAE,MAAM,EACb,YAAY,SAAK,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB;IAStB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CACrB,YAAY,SAAK,EACjB,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB;IAStB,MAAM,CAAC,qBAAqB,SAAkB;IAE9C,MAAM,CAAC,cAAc,sBAGnB;IAEF,MAAM,CAAC,mBAAmB,sBAIxB;IAEF,MAAM,CAAC,eAAe,sBAIpB;IAEF,MAAM,CAAC,0BAA0B,sBAG/B;IAEF,MAAM,CAAC,YAAY,sBAGjB;IAEF,MAAM,CAAC,yBAAyB,sBAG9B;IAEF,MAAM,CAAC,0BAA0B,sBAG/B;IAEF;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CACjB,OAAO,EAAE,mBAAmB,GAAG,IAAI,EACnC,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAClC,OAAO;IAWV,mBAAmB,EAAE,MAAM,CAAC;gBAEhB,EACV,mBAAkE,GACnE,GAAE,6BAAkC;IAMrC;;;;;OAKG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,OAAO,CAAC,mBAAmB,CAAM,GACxC,MAAM;CAgBV;AAED,eAAe,sBAAsB,CAAC"}
@@ -1,5 +1,4 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
2
  /* eslint class-methods-use-this: "off" */
4
3
  import dh from '@deephaven/jsapi-shim';
5
4
  import Log from '@deephaven/log';
@@ -19,6 +18,7 @@ export class DecimalColumnFormatter extends TableColumnFormatter {
19
18
  return false;
20
19
  }
21
20
  }
21
+
22
22
  /**
23
23
  * Create a DecimalColumnFormat object with the parameters specified
24
24
  * @param label Label for the format
@@ -27,8 +27,6 @@ export class DecimalColumnFormatter extends TableColumnFormatter {
27
27
  * @param type Type of format created
28
28
  * @returns DecimalColumnFormat object
29
29
  */
30
-
31
-
32
30
  static makeFormat(label, formatString) {
33
31
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TableColumnFormatter.TYPE_CONTEXT_PRESET;
34
32
  var multiplier = arguments.length > 3 ? arguments[3] : undefined;
@@ -39,6 +37,7 @@ export class DecimalColumnFormatter extends TableColumnFormatter {
39
37
  multiplier
40
38
  };
41
39
  }
40
+
42
41
  /**
43
42
  * Convenient function to create a DecimalFormatObject with Preset type set
44
43
  * @param label Label for this format object
@@ -46,27 +45,23 @@ export class DecimalColumnFormatter extends TableColumnFormatter {
46
45
  * @param multiplier Multiplier to use
47
46
  * @returns DecimalColumnFormat object
48
47
  */
49
-
50
-
51
48
  static makePresetFormat(label) {
52
49
  var formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
53
50
  var multiplier = arguments.length > 2 ? arguments[2] : undefined;
54
51
  return DecimalColumnFormatter.makeFormat(label, formatString, TableColumnFormatter.TYPE_CONTEXT_PRESET, multiplier);
55
52
  }
53
+
56
54
  /**
57
55
  * Convenient function to create a DecimalFormatObject with a default 'Custom Format' label and Custom type
58
56
  * @param formatString Format string to use
59
57
  * @param multiplier Multiplier to use
60
58
  * @returns DecimalColumnFormat object
61
59
  */
62
-
63
-
64
60
  static makeCustomFormat() {
65
61
  var formatString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
66
62
  var multiplier = arguments.length > 1 ? arguments[1] : undefined;
67
63
  return DecimalColumnFormatter.makeFormat('Custom Format', formatString, TableColumnFormatter.TYPE_CONTEXT_CUSTOM, multiplier);
68
64
  }
69
-
70
65
  /**
71
66
  * Check if the given formats match
72
67
  * @param formatA format object to check
@@ -76,55 +71,40 @@ export class DecimalColumnFormatter extends TableColumnFormatter {
76
71
  static isSameFormat(formatA, formatB) {
77
72
  return formatA === formatB || formatA != null && formatB != null && formatA.type === formatB.type && formatA.formatString === formatB.formatString && formatA.multiplier === formatB.multiplier;
78
73
  }
79
-
80
74
  constructor() {
81
75
  var {
82
76
  defaultFormatString = DecimalColumnFormatter.DEFAULT_FORMAT_STRING
83
77
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
84
78
  super();
85
-
86
79
  _defineProperty(this, "defaultFormatString", void 0);
87
-
88
80
  this.defaultFormatString = defaultFormatString;
89
81
  }
82
+
90
83
  /**
91
84
  * Format a value with the provided format object
92
85
  * @param valueParam Value to format
93
86
  * @param format Format object
94
87
  * @returns Formatted string
95
88
  */
96
-
97
-
98
- format(valueParam, format) {
99
- var formatString = format && format.formatString || this.defaultFormatString;
100
- var value = format && format.multiplier !== undefined && format.multiplier !== 0 ? valueParam * format.multiplier : valueParam;
101
-
89
+ format(valueParam) {
90
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
91
+ var formatString = format.formatString != null && format.formatString !== '' ? format.formatString : this.defaultFormatString;
92
+ var value = format.multiplier !== undefined && format.multiplier !== 0 ? valueParam * format.multiplier : valueParam;
102
93
  try {
103
94
  return dh.i18n.NumberFormat.format(formatString, value);
104
95
  } catch (e) {
105
96
  log.error('Invalid format arguments');
106
97
  }
107
-
108
98
  return '';
109
99
  }
110
-
111
100
  }
112
-
113
101
  _defineProperty(DecimalColumnFormatter, "DEFAULT_FORMAT_STRING", '###,##0.0000');
114
-
115
102
  _defineProperty(DecimalColumnFormatter, "FORMAT_PERCENT", DecimalColumnFormatter.makePresetFormat('Percent', '##0.00%'));
116
-
117
103
  _defineProperty(DecimalColumnFormatter, "FORMAT_BASIS_POINTS", DecimalColumnFormatter.makePresetFormat('Basis Points', '###,##0 bp', 10000));
118
-
119
104
  _defineProperty(DecimalColumnFormatter, "FORMAT_MILLIONS", DecimalColumnFormatter.makePresetFormat('Millions', '###,##0.000 mm', 0.000001));
120
-
121
105
  _defineProperty(DecimalColumnFormatter, "FORMAT_SCIENTIFIC_NOTATION", DecimalColumnFormatter.makePresetFormat('Scientific Notation', '0.0000E0'));
122
-
123
106
  _defineProperty(DecimalColumnFormatter, "FORMAT_ROUND", DecimalColumnFormatter.makePresetFormat('Round', '###,##0'));
124
-
125
107
  _defineProperty(DecimalColumnFormatter, "FORMAT_ROUND_TWO_DECIMALS", DecimalColumnFormatter.makePresetFormat('0.00', '###,##0.00'));
126
-
127
108
  _defineProperty(DecimalColumnFormatter, "FORMAT_ROUND_FOUR_DECIMALS", DecimalColumnFormatter.makePresetFormat('0.0000', '###,##0.0000'));
128
-
129
109
  export default DecimalColumnFormatter;
130
110
  //# sourceMappingURL=DecimalColumnFormatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecimalColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","DecimalColumnFormatter","isValid","format","i18n","NumberFormat","formatString","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","multiplier","makePresetFormat","makeCustomFormat","TYPE_CONTEXT_CUSTOM","isSameFormat","formatA","formatB","constructor","defaultFormatString","DEFAULT_FORMAT_STRING","valueParam","value","undefined","error"],"sources":["../../src/formatters/DecimalColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('DecimalColumnFormatter');\n\nexport type DecimalColumnFormat = TableColumnFormat & {\n multiplier?: number;\n};\n\nexport type DecimalColumnFormatterOptions = {\n // Default format string to use. Defaults to DecimalColumnFormatter.DEFAULT_FORMAT_STRING\n defaultFormatString?: string;\n};\n\nexport class DecimalColumnFormatter extends TableColumnFormatter<number> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.NumberFormat.format(format.formatString, 0);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Create a DecimalColumnFormat object with the parameters specified\n * @param label Label for the format\n * @param formatString Format string for the format\n * @param multiplier Optional multiplier for the formatter\n * @param type Type of format created\n * @returns DecimalColumnFormat object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier?: number\n ): DecimalColumnFormat {\n return {\n label,\n type,\n formatString,\n multiplier,\n };\n }\n\n /**\n * Convenient function to create a DecimalFormatObject with Preset type set\n * @param label Label for this format object\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns DecimalColumnFormat object\n */\n static makePresetFormat(\n label: string,\n formatString = '',\n multiplier?: number\n ): DecimalColumnFormat {\n return DecimalColumnFormatter.makeFormat(\n label,\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier\n );\n }\n\n /**\n * Convenient function to create a DecimalFormatObject with a default 'Custom Format' label and Custom type\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns DecimalColumnFormat object\n */\n static makeCustomFormat(\n formatString = '',\n multiplier?: number\n ): DecimalColumnFormat {\n return DecimalColumnFormatter.makeFormat(\n 'Custom Format',\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n multiplier\n );\n }\n\n static DEFAULT_FORMAT_STRING = '###,##0.0000';\n\n static FORMAT_PERCENT = DecimalColumnFormatter.makePresetFormat(\n 'Percent',\n '##0.00%'\n );\n\n static FORMAT_BASIS_POINTS = DecimalColumnFormatter.makePresetFormat(\n 'Basis Points',\n '###,##0 bp',\n 10000\n );\n\n static FORMAT_MILLIONS = DecimalColumnFormatter.makePresetFormat(\n 'Millions',\n '###,##0.000 mm',\n 0.000001\n );\n\n static FORMAT_SCIENTIFIC_NOTATION = DecimalColumnFormatter.makePresetFormat(\n 'Scientific Notation',\n '0.0000E0'\n );\n\n static FORMAT_ROUND = DecimalColumnFormatter.makePresetFormat(\n 'Round',\n '###,##0'\n );\n\n static FORMAT_ROUND_TWO_DECIMALS = DecimalColumnFormatter.makePresetFormat(\n '0.00',\n '###,##0.00'\n );\n\n static FORMAT_ROUND_FOUR_DECIMALS = DecimalColumnFormatter.makePresetFormat(\n '0.0000',\n '###,##0.0000'\n );\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: DecimalColumnFormat | null,\n formatB: DecimalColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA != null &&\n formatB != null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString &&\n formatA.multiplier === formatB.multiplier)\n );\n }\n\n defaultFormatString: string;\n\n constructor({\n defaultFormatString = DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n }: DecimalColumnFormatterOptions = {}) {\n super();\n\n this.defaultFormatString = defaultFormatString;\n }\n\n /**\n * Format a value with the provided format object\n * @param valueParam Value to format\n * @param format Format object\n * @returns Formatted string\n */\n format(valueParam: number, format?: Partial<DecimalColumnFormat>): string {\n const formatString =\n (format && format.formatString) || this.defaultFormatString;\n const value =\n format && format.multiplier !== undefined && format.multiplier !== 0\n ? valueParam * format.multiplier\n : valueParam;\n try {\n return dh.i18n.NumberFormat.format(formatString, value);\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default DecimalColumnFormatter;\n"],"mappings":";;AAAA;AACA,OAAOA,EAAP,MAAe,uBAAf;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,oB;AAIP,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAJ,CAAW,wBAAX,CAAZ;AAWA,OAAO,MAAMC,sBAAN,SAAqCH,oBAArC,CAAkE;EACvE;AACF;AACA;AACA;AACA;EACgB,OAAPI,OAAO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ADiC,EAEjC,YAFiC,C;;gBAxGxBZ,sB,gCA6GyBA,sBAAsB,CAACY,gBAAvB,CAClC,QADkC,EAElC,cAFkC,C;;AAyDtC,eAAeZ,sBAAf"}
1
+ {"version":3,"file":"DecimalColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","DecimalColumnFormatter","isValid","format","i18n","NumberFormat","formatString","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","multiplier","makePresetFormat","makeCustomFormat","TYPE_CONTEXT_CUSTOM","isSameFormat","formatA","formatB","constructor","defaultFormatString","DEFAULT_FORMAT_STRING","valueParam","value","undefined","error"],"sources":["../../src/formatters/DecimalColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('DecimalColumnFormatter');\n\nexport type DecimalColumnFormat = TableColumnFormat & {\n multiplier?: number;\n};\n\nexport type DecimalColumnFormatterOptions = {\n // Default format string to use. Defaults to DecimalColumnFormatter.DEFAULT_FORMAT_STRING\n defaultFormatString?: string;\n};\n\nexport class DecimalColumnFormatter extends TableColumnFormatter<number> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.NumberFormat.format(format.formatString, 0);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Create a DecimalColumnFormat object with the parameters specified\n * @param label Label for the format\n * @param formatString Format string for the format\n * @param multiplier Optional multiplier for the formatter\n * @param type Type of format created\n * @returns DecimalColumnFormat object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier?: number\n ): DecimalColumnFormat {\n return {\n label,\n type,\n formatString,\n multiplier,\n };\n }\n\n /**\n * Convenient function to create a DecimalFormatObject with Preset type set\n * @param label Label for this format object\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns DecimalColumnFormat object\n */\n static makePresetFormat(\n label: string,\n formatString = '',\n multiplier?: number\n ): DecimalColumnFormat {\n return DecimalColumnFormatter.makeFormat(\n label,\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier\n );\n }\n\n /**\n * Convenient function to create a DecimalFormatObject with a default 'Custom Format' label and Custom type\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns DecimalColumnFormat object\n */\n static makeCustomFormat(\n formatString = '',\n multiplier?: number\n ): DecimalColumnFormat {\n return DecimalColumnFormatter.makeFormat(\n 'Custom Format',\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n multiplier\n );\n }\n\n static DEFAULT_FORMAT_STRING = '###,##0.0000';\n\n static FORMAT_PERCENT = DecimalColumnFormatter.makePresetFormat(\n 'Percent',\n '##0.00%'\n );\n\n static FORMAT_BASIS_POINTS = DecimalColumnFormatter.makePresetFormat(\n 'Basis Points',\n '###,##0 bp',\n 10000\n );\n\n static FORMAT_MILLIONS = DecimalColumnFormatter.makePresetFormat(\n 'Millions',\n '###,##0.000 mm',\n 0.000001\n );\n\n static FORMAT_SCIENTIFIC_NOTATION = DecimalColumnFormatter.makePresetFormat(\n 'Scientific Notation',\n '0.0000E0'\n );\n\n static FORMAT_ROUND = DecimalColumnFormatter.makePresetFormat(\n 'Round',\n '###,##0'\n );\n\n static FORMAT_ROUND_TWO_DECIMALS = DecimalColumnFormatter.makePresetFormat(\n '0.00',\n '###,##0.00'\n );\n\n static FORMAT_ROUND_FOUR_DECIMALS = DecimalColumnFormatter.makePresetFormat(\n '0.0000',\n '###,##0.0000'\n );\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: DecimalColumnFormat | null,\n formatB: DecimalColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA != null &&\n formatB != null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString &&\n formatA.multiplier === formatB.multiplier)\n );\n }\n\n defaultFormatString: string;\n\n constructor({\n defaultFormatString = DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n }: DecimalColumnFormatterOptions = {}) {\n super();\n\n this.defaultFormatString = defaultFormatString;\n }\n\n /**\n * Format a value with the provided format object\n * @param valueParam Value to format\n * @param format Format object\n * @returns Formatted string\n */\n format(\n valueParam: number,\n format: Partial<DecimalColumnFormat> = {}\n ): string {\n const formatString =\n format.formatString != null && format.formatString !== ''\n ? format.formatString\n : this.defaultFormatString;\n const value =\n format.multiplier !== undefined && format.multiplier !== 0\n ? valueParam * format.multiplier\n : valueParam;\n try {\n return dh.i18n.NumberFormat.format(formatString, value);\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default DecimalColumnFormatter;\n"],"mappings":";AAAA;AACA,OAAOA,EAAE,MAAM,uBAAuB;AACtC,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,oBAAoB;AAI3B,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAM,CAAC,wBAAwB,CAAC;AAWhD,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAS;EACvE;AACF;AACA;AACA;AACA;EACE,OAAOI,OAAO,CAACC,MAA+C,EAAW;IACvE,IAAI;MACFP,EAAE,CAACQ,IAAI,CAACC,YAAY,CAACF,MAAM,CAACA,MAAM,CAACG,YAAY,EAAE,CAAC,CAAC;MACnD,OAAO,IAAI;IACb,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAO,KAAK;IACd;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,KAAa,EACbH,YAAoB,EAGC;IAAA,IAFrBI,IAAI,uEAAGZ,oBAAoB,CAACa,mBAAmB;IAAA,IAC/CC,UAAmB;IAEnB,OAAO;MACLH,KAAK;MACLC,IAAI;MACJJ,YAAY;MACZM;I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B;IAC9B,IAAMG,KAAK,GACTpB,MAAM,CAACS,UAAU,KAAKY,SAAS,IAAIrB,MAAM,CAACS,UAAU,KAAK,CAAC,GACtDU,UAAU,GAAGnB,MAAM,CAACS,UAAU,GAC9BU,UAAU;IAChB,IAAI;MACF,OAAO1B,EAAE,CAACQ,IAAI,CAACC,YAAY,CAACF,MAAM,CAACG,YAAY,EAAEiB,KAAK,CAAC;IACzD,CAAC,CAAC,OAAOhB,CAAC,EAAE;MACVR,GAAG,CAAC0B,KAAK,CAAC,0BAA0B,CAAC;IACvC;IACA,OAAO,EAAE;EACX;AACF;AAAC,gBAzKYxB,sBAAsB,2BA2EF,cAAc;AAAA,gBA3ElCA,sBAAsB,oBA6ETA,sBAAsB,CAACY,gBAAgB,CAC7D,SAAS,EACT,SAAS,CACV;AAAA,gBAhFUZ,sBAAsB,yBAkFJA,sBAAsB,CAACY,gBAAgB,CAClE,cAAc,EACd,YAAY,EACZ,KAAK,CACN;AAAA,gBAtFUZ,sBAAsB,qBAwFRA,sBAAsB,CAACY,gBAAgB,CAC9D,UAAU,EACV,gBAAgB,EAChB,QAAQ,CACT;AAAA,gBA5FUZ,sBAAsB,gCA8FGA,sBAAsB,CAACY,gBAAgB,CACzE,qBAAqB,EACrB,UAAU,CACX;AAAA,gBAjGUZ,sBAAsB,kBAmGXA,sBAAsB,CAACY,gBAAgB,CAC3D,OAAO,EACP,SAAS,CACV;AAAA,gBAtGUZ,sBAAsB,+BAwGEA,sBAAsB,CAACY,gBAAgB,CACxE,MAAM,EACN,YAAY,CACb;AAAA,gBA3GUZ,sBAAsB,gCA6GGA,sBAAsB,CAACY,gBAAgB,CACzE,QAAQ,EACR,cAAc,CACf;AA2DH,eAAeZ,sBAAsB"}
@@ -1,14 +1,10 @@
1
1
  /* eslint class-methods-use-this: "off" */
2
-
3
2
  /* eslint no-unused-vars: "off" */
4
3
  import TableColumnFormatter from "./TableColumnFormatter.js";
5
-
6
4
  class DefaultColumnFormatter extends TableColumnFormatter {
7
5
  format(value) {
8
6
  return "".concat(value);
9
7
  }
10
-
11
8
  }
12
-
13
9
  export default DefaultColumnFormatter;
14
10
  //# sourceMappingURL=DefaultColumnFormatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultColumnFormatter.js","names":["TableColumnFormatter","DefaultColumnFormatter","format","value"],"sources":["../../src/formatters/DefaultColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport TableColumnFormatter from './TableColumnFormatter';\n\nclass DefaultColumnFormatter extends TableColumnFormatter {\n format(value: unknown): string {\n return `${value}`;\n }\n}\n\nexport default DefaultColumnFormatter;\n"],"mappings":"AAAA;;AACA;OACOA,oB;;AAEP,MAAMC,sBAAN,SAAqCD,oBAArC,CAA0D;EACxDE,MAAM,CAACC,KAAD,EAAyB;IAC7B,iBAAUA,KAAV;EACD;;AAHuD;;AAM1D,eAAeF,sBAAf"}
1
+ {"version":3,"file":"DefaultColumnFormatter.js","names":["TableColumnFormatter","DefaultColumnFormatter","format","value"],"sources":["../../src/formatters/DefaultColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport TableColumnFormatter from './TableColumnFormatter';\n\nclass DefaultColumnFormatter extends TableColumnFormatter {\n format(value: unknown): string {\n return `${value}`;\n }\n}\n\nexport default DefaultColumnFormatter;\n"],"mappings":"AAAA;AACA;AAAA,OACOA,oBAAoB;AAE3B,MAAMC,sBAAsB,SAASD,oBAAoB,CAAC;EACxDE,MAAM,CAACC,KAAc,EAAU;IAC7B,iBAAUA,KAAK;EACjB;AACF;AAEA,eAAeF,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"IntegerColumnFormatter.d.ts","sourceRoot":"","sources":["../../src/formatters/IntegerColumnFormatter.ts"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,EAAE,EAC3B,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAIhC,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,CAAC,mBAAmB,CAAM,GACxC,MAAM;CAgBV;AAED,eAAe,sBAAsB,CAAC"}
@@ -1,11 +1,9 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
2
  /* eslint class-methods-use-this: "off" */
4
3
  import dh from '@deephaven/jsapi-shim';
5
4
  import Log from '@deephaven/log';
6
5
  import TableColumnFormatter from "./TableColumnFormatter.js";
7
6
  var log = Log.module('IntegerColumnFormatter');
8
-
9
7
  /** Column formatter for integers/whole numbers */
10
8
  export class IntegerColumnFormatter extends TableColumnFormatter {
11
9
  /**
@@ -21,6 +19,7 @@ export class IntegerColumnFormatter extends TableColumnFormatter {
21
19
  return false;
22
20
  }
23
21
  }
22
+
24
23
  /**
25
24
  * Create an IntegerColumnFormat object with the parameters specified
26
25
  * @param label Label for the format
@@ -29,8 +28,6 @@ export class IntegerColumnFormatter extends TableColumnFormatter {
29
28
  * @param type Type of format created
30
29
  * @returns IntegerColumnFormat object
31
30
  */
32
-
33
-
34
31
  static makeFormat(label, formatString) {
35
32
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TableColumnFormatter.TYPE_CONTEXT_PRESET;
36
33
  var multiplier = arguments.length > 3 ? arguments[3] : undefined;
@@ -41,6 +38,7 @@ export class IntegerColumnFormatter extends TableColumnFormatter {
41
38
  multiplier
42
39
  };
43
40
  }
41
+
44
42
  /**
45
43
  * Convenient function to create a IntegerFormatObject with Preset type set
46
44
  * @param label Label for this format object
@@ -48,76 +46,62 @@ export class IntegerColumnFormatter extends TableColumnFormatter {
48
46
  * @param multiplier Multiplier to use
49
47
  * @returns IntegerColumnFormat object
50
48
  */
51
-
52
-
53
49
  static makePresetFormat(label) {
54
50
  var formatString = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
55
51
  var multiplier = arguments.length > 2 ? arguments[2] : undefined;
56
52
  return IntegerColumnFormatter.makeFormat(label, formatString, TableColumnFormatter.TYPE_CONTEXT_PRESET, multiplier);
57
53
  }
54
+
58
55
  /**
59
56
  * Convenient function to create a IntegerFormatObject with a default 'Custom Format' label and Custom type
60
57
  * @param formatString Format string to use
61
58
  * @param multiplier Multiplier to use
62
59
  * @returns IntegerColumnFormat object
63
60
  */
64
-
65
-
66
61
  static makeCustomFormat() {
67
62
  var formatString = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
68
63
  var multiplier = arguments.length > 1 ? arguments[1] : undefined;
69
64
  return IntegerColumnFormatter.makeFormat('Custom Format', formatString, TableColumnFormatter.TYPE_CONTEXT_CUSTOM, multiplier);
70
65
  }
66
+
71
67
  /**
72
68
  * Check if the given formats match
73
69
  * @param formatA format object to check
74
70
  * @param formatB format object to check
75
71
  * @returns True if the formats match
76
72
  */
77
-
78
-
79
73
  static isSameFormat(formatA, formatB) {
80
74
  return formatA === formatB || formatA != null && formatB != null && formatA.type === formatB.type && formatA.formatString === formatB.formatString && formatA.multiplier === formatB.multiplier;
81
75
  }
82
-
83
76
  constructor() {
84
77
  var {
85
78
  defaultFormatString = IntegerColumnFormatter.DEFAULT_FORMAT_STRING
86
79
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
87
80
  super();
88
-
89
81
  _defineProperty(this, "defaultFormatString", void 0);
90
-
91
82
  this.defaultFormatString = defaultFormatString;
92
83
  }
84
+
93
85
  /**
94
86
  * Format a value with the provided format object
95
87
  * @param valueParam Value to format
96
88
  * @param format Format object
97
89
  * @returns Formatted string
98
90
  */
99
-
100
-
101
- format(valueParam, format) {
102
- var formatString = format && format.formatString || this.defaultFormatString;
103
- var value = format && format.multiplier !== undefined && format.multiplier !== 0 ? valueParam * format.multiplier : valueParam;
104
-
91
+ format(valueParam) {
92
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
93
+ var formatString = format.formatString != null && format.formatString !== '' ? format.formatString : this.defaultFormatString;
94
+ var value = format.multiplier !== undefined && format.multiplier !== 0 ? valueParam * format.multiplier : valueParam;
105
95
  try {
106
96
  return dh.i18n.NumberFormat.format(formatString, value);
107
97
  } catch (e) {
108
98
  log.error('Invalid format arguments');
109
99
  }
110
-
111
100
  return '';
112
101
  }
113
-
114
102
  }
115
-
116
103
  _defineProperty(IntegerColumnFormatter, "DEFAULT_FORMAT_STRING", '###,##0');
117
-
118
104
  _defineProperty(IntegerColumnFormatter, "FORMAT_MILLIONS", IntegerColumnFormatter.makePresetFormat('Millions', '###,##0.000 mm', 0.000001));
119
-
120
105
  _defineProperty(IntegerColumnFormatter, "FORMAT_SCIENTIFIC_NOTATION", IntegerColumnFormatter.makePresetFormat('Scientific Notation', '0.0000E0'));
121
-
122
106
  export default IntegerColumnFormatter;
123
107
  //# sourceMappingURL=IntegerColumnFormatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntegerColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","IntegerColumnFormatter","isValid","format","i18n","NumberFormat","formatString","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","multiplier","makePresetFormat","makeCustomFormat","TYPE_CONTEXT_CUSTOM","isSameFormat","formatA","formatB","constructor","defaultFormatString","DEFAULT_FORMAT_STRING","valueParam","value","undefined","error"],"sources":["../../src/formatters/IntegerColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('IntegerColumnFormatter');\n\nexport type IntegerColumnFormat = TableColumnFormat & {\n multiplier?: number;\n};\n\nexport type IntegerColumnFormatterOptions = {\n // Default format string to use. Defaults to IntegerColumnFormatter.DEFAULT_FORMAT_STRING\n defaultFormatString?: string;\n};\n\n/** Column formatter for integers/whole numbers */\nexport class IntegerColumnFormatter extends TableColumnFormatter<number> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.NumberFormat.format(format.formatString, 0);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Create an IntegerColumnFormat object with the parameters specified\n * @param label Label for the format\n * @param formatString Format string for the format\n * @param multiplier Optional multiplier for the formatter\n * @param type Type of format created\n * @returns IntegerColumnFormat object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier?: number\n ): IntegerColumnFormat {\n return {\n label,\n type,\n formatString,\n multiplier,\n };\n }\n\n /**\n * Convenient function to create a IntegerFormatObject with Preset type set\n * @param label Label for this format object\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns IntegerColumnFormat object\n */\n static makePresetFormat(\n label: string,\n formatString = '',\n multiplier?: number\n ): IntegerColumnFormat {\n return IntegerColumnFormatter.makeFormat(\n label,\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier\n );\n }\n\n /**\n * Convenient function to create a IntegerFormatObject with a default 'Custom Format' label and Custom type\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns IntegerColumnFormat object\n */\n static makeCustomFormat(\n formatString = '',\n multiplier?: number\n ): IntegerColumnFormat {\n return IntegerColumnFormatter.makeFormat(\n 'Custom Format',\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n multiplier\n );\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: IntegerColumnFormat | null,\n formatB: IntegerColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA != null &&\n formatB != null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString &&\n formatA.multiplier === formatB.multiplier)\n );\n }\n\n static DEFAULT_FORMAT_STRING = '###,##0';\n\n static FORMAT_MILLIONS = IntegerColumnFormatter.makePresetFormat(\n 'Millions',\n '###,##0.000 mm',\n 0.000001\n );\n\n static FORMAT_SCIENTIFIC_NOTATION = IntegerColumnFormatter.makePresetFormat(\n 'Scientific Notation',\n '0.0000E0'\n );\n\n defaultFormatString: string;\n\n constructor({\n defaultFormatString = IntegerColumnFormatter.DEFAULT_FORMAT_STRING,\n }: IntegerColumnFormatterOptions = {}) {\n super();\n\n this.defaultFormatString = defaultFormatString;\n }\n\n /**\n * Format a value with the provided format object\n * @param valueParam Value to format\n * @param format Format object\n * @returns Formatted string\n */\n format(valueParam: number, format?: Partial<IntegerColumnFormat>): string {\n const formatString =\n (format && format.formatString) || this.defaultFormatString;\n const value =\n format && format.multiplier !== undefined && format.multiplier !== 0\n ? valueParam * format.multiplier\n : valueParam;\n try {\n return dh.i18n.NumberFormat.format(formatString, value);\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default IntegerColumnFormatter;\n"],"mappings":";;AAAA;AACA,OAAOA,EAAP,MAAe,uBAAf;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,oB;AAIP,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAJ,CAAW,wBAAX,CAAZ;;AAWA;AACA,OAAO,MAAMC,sBAAN,SAAqCH,oBAArC,CAAkE;EACvE;AACF;AACA;AACA;AACA;EACgB,OAAPI,OAAO,CAACC,MAAD,EAA2D;IACvE,IAAI;MACFP,EAAE,CAACQ,IAAH,CAAQC,YAAR,CAAqBF,MAArB,CAA4BA,MAAM,CAACG,YAAnC,EAAiD,CAAjD;MACA,OAAO,IAAP;IACD,CAHD,CAGE,OAAOC,CAAP,EAAU;MACV,OAAO,KAAP;IACD;EACF;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;;;EACmB,OAAVC,UAAU,CACfC,KADe,EAEfH,YAFe,EAKM;IAAA,IAFrBI,IAEqB,uEAFdZ,oBAAoB,CAACa,mBAEP;IAAA,IADrBC,UACqB;IACrB,OAAO;MACLH,KADK;MAELC,IAFK;MAGLJ,YAHK;MAILM;IAJK,CAAP;EAMD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AnE,GACIU,UAAU,GAAGnB,MAAM,CAACS,UADxB,GAEIU,UAHN;;IAIA,IAAI;MACF,OAAO1B,EAAE,CAACQ,IAAH,CAAQC,YAAR,CAAqBF,MAArB,CAA4BG,YAA5B,EAA0CiB,KAA1C,CAAP;IACD,CAFD,CAEE,OAAOhB,CAAP,EAAU;MACVR,GAAG,CAAC0B,KAAJ,CAAU,0BAAV;IACD;;IACD,OAAO,EAAP;EACD;;AAzIsE;;gBAA5DxB,sB,2BA+FoB,S;;gBA/FpBA,sB,qBAiGcA,sBAAsB,CAACY,gBAAvB,CACvB,UADuB,EAEvB,gBAFuB,EAGvB,QAHuB,C;;gBAjGdZ,sB,gCAuGyBA,sBAAsB,CAACY,gBAAvB,CAClC,qBADkC,EAElC,UAFkC,C;;AAqCtC,eAAeZ,sBAAf"}
1
+ {"version":3,"file":"IntegerColumnFormatter.js","names":["dh","Log","TableColumnFormatter","log","module","IntegerColumnFormatter","isValid","format","i18n","NumberFormat","formatString","e","makeFormat","label","type","TYPE_CONTEXT_PRESET","multiplier","makePresetFormat","makeCustomFormat","TYPE_CONTEXT_CUSTOM","isSameFormat","formatA","formatB","constructor","defaultFormatString","DEFAULT_FORMAT_STRING","valueParam","value","undefined","error"],"sources":["../../src/formatters/IntegerColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport dh from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport TableColumnFormatter, {\n TableColumnFormat,\n} from './TableColumnFormatter';\n\nconst log = Log.module('IntegerColumnFormatter');\n\nexport type IntegerColumnFormat = TableColumnFormat & {\n multiplier?: number;\n};\n\nexport type IntegerColumnFormatterOptions = {\n // Default format string to use. Defaults to IntegerColumnFormatter.DEFAULT_FORMAT_STRING\n defaultFormatString?: string;\n};\n\n/** Column formatter for integers/whole numbers */\nexport class IntegerColumnFormatter extends TableColumnFormatter<number> {\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: Pick<TableColumnFormat, 'formatString'>): boolean {\n try {\n dh.i18n.NumberFormat.format(format.formatString, 0);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Create an IntegerColumnFormat object with the parameters specified\n * @param label Label for the format\n * @param formatString Format string for the format\n * @param multiplier Optional multiplier for the formatter\n * @param type Type of format created\n * @returns IntegerColumnFormat object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type = TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier?: number\n ): IntegerColumnFormat {\n return {\n label,\n type,\n formatString,\n multiplier,\n };\n }\n\n /**\n * Convenient function to create a IntegerFormatObject with Preset type set\n * @param label Label for this format object\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns IntegerColumnFormat object\n */\n static makePresetFormat(\n label: string,\n formatString = '',\n multiplier?: number\n ): IntegerColumnFormat {\n return IntegerColumnFormatter.makeFormat(\n label,\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_PRESET,\n multiplier\n );\n }\n\n /**\n * Convenient function to create a IntegerFormatObject with a default 'Custom Format' label and Custom type\n * @param formatString Format string to use\n * @param multiplier Multiplier to use\n * @returns IntegerColumnFormat object\n */\n static makeCustomFormat(\n formatString = '',\n multiplier?: number\n ): IntegerColumnFormat {\n return IntegerColumnFormatter.makeFormat(\n 'Custom Format',\n formatString,\n TableColumnFormatter.TYPE_CONTEXT_CUSTOM,\n multiplier\n );\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: IntegerColumnFormat | null,\n formatB: IntegerColumnFormat | null\n ): boolean {\n return (\n formatA === formatB ||\n (formatA != null &&\n formatB != null &&\n formatA.type === formatB.type &&\n formatA.formatString === formatB.formatString &&\n formatA.multiplier === formatB.multiplier)\n );\n }\n\n static DEFAULT_FORMAT_STRING = '###,##0';\n\n static FORMAT_MILLIONS = IntegerColumnFormatter.makePresetFormat(\n 'Millions',\n '###,##0.000 mm',\n 0.000001\n );\n\n static FORMAT_SCIENTIFIC_NOTATION = IntegerColumnFormatter.makePresetFormat(\n 'Scientific Notation',\n '0.0000E0'\n );\n\n defaultFormatString: string;\n\n constructor({\n defaultFormatString = IntegerColumnFormatter.DEFAULT_FORMAT_STRING,\n }: IntegerColumnFormatterOptions = {}) {\n super();\n\n this.defaultFormatString = defaultFormatString;\n }\n\n /**\n * Format a value with the provided format object\n * @param valueParam Value to format\n * @param format Format object\n * @returns Formatted string\n */\n format(\n valueParam: number,\n format: Partial<IntegerColumnFormat> = {}\n ): string {\n const formatString =\n format.formatString != null && format.formatString !== ''\n ? format.formatString\n : this.defaultFormatString;\n const value =\n format.multiplier !== undefined && format.multiplier !== 0\n ? valueParam * format.multiplier\n : valueParam;\n try {\n return dh.i18n.NumberFormat.format(formatString, value);\n } catch (e) {\n log.error('Invalid format arguments');\n }\n return '';\n }\n}\n\nexport default IntegerColumnFormatter;\n"],"mappings":";AAAA;AACA,OAAOA,EAAE,MAAM,uBAAuB;AACtC,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,oBAAoB;AAI3B,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAM,CAAC,wBAAwB,CAAC;AAWhD;AACA,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAS;EACvE;AACF;AACA;AACA;AACA;EACE,OAAOI,OAAO,CAACC,MAA+C,EAAW;IACvE,IAAI;MACFP,EAAE,CAACQ,IAAI,CAACC,YAAY,CAACF,MAAM,CAACA,MAAM,CAACG,YAAY,EAAE,CAAC,CAAC;MACnD,OAAO,IAAI;IACb,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,OAAO,KAAK;IACd;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,KAAa,EACbH,YAAoB,EAGC;IAAA,IAFrBI,IAAI,uEAAGZ,oBAAoB,CAACa,mBAAmB;IAAA,IAC/CC,UAAmB;IAEnB,OAAO;MACLH,KAAK;MACLC,IA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,GACnB,IAAI,CAACc,mBAAmB;IAC9B,IAAMG,KAAK,GACTpB,MAAM,CAACS,UAAU,KAAKY,SAAS,IAAIrB,MAAM,CAACS,UAAU,KAAK,CAAC,GACtDU,UAAU,GAAGnB,MAAM,CAACS,UAAU,GAC9BU,UAAU;IAChB,IAAI;MACF,OAAO1B,EAAE,CAACQ,IAAI,CAACC,YAAY,CAACF,MAAM,CAACG,YAAY,EAAEiB,KAAK,CAAC;IACzD,CAAC,CAAC,OAAOhB,CAAC,EAAE;MACVR,GAAG,CAAC0B,KAAK,CAAC,0BAA0B,CAAC;IACvC;IACA,OAAO,EAAE;EACX;AACF;AAAC,gBA/IYxB,sBAAsB,2BA+FF,SAAS;AAAA,gBA/F7BA,sBAAsB,qBAiGRA,sBAAsB,CAACY,gBAAgB,CAC9D,UAAU,EACV,gBAAgB,EAChB,QAAQ,CACT;AAAA,gBArGUZ,sBAAsB,gCAuGGA,sBAAsB,CAACY,gBAAgB,CACzE,qBAAqB,EACrB,UAAU,CACX;AAuCH,eAAeZ,sBAAsB"}
@@ -1,12 +1,10 @@
1
1
  /* eslint class-methods-use-this: "off" */
2
2
  import TableColumnFormatter from "./TableColumnFormatter.js";
3
3
  /** Column formatter for strings */
4
-
5
4
  export class StringColumnFormatter extends TableColumnFormatter {
6
5
  format(value) {
7
6
  return value;
8
7
  }
9
-
10
8
  }
11
9
  export default StringColumnFormatter;
12
10
  //# sourceMappingURL=StringColumnFormatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StringColumnFormatter.js","names":["TableColumnFormatter","StringColumnFormatter","format","value"],"sources":["../../src/formatters/StringColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport TableColumnFormatter from './TableColumnFormatter';\n\n/** Column formatter for strings */\nexport class StringColumnFormatter extends TableColumnFormatter<string> {\n format(value: string): string {\n return value;\n }\n}\n\nexport default StringColumnFormatter;\n"],"mappings":"AAAA;OACOA,oB;AAEP;;AACA,OAAO,MAAMC,qBAAN,SAAoCD,oBAApC,CAAiE;EACtEE,MAAM,CAACC,KAAD,EAAwB;IAC5B,OAAOA,KAAP;EACD;;AAHqE;AAMxE,eAAeF,qBAAf"}
1
+ {"version":3,"file":"StringColumnFormatter.js","names":["TableColumnFormatter","StringColumnFormatter","format","value"],"sources":["../../src/formatters/StringColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\nimport TableColumnFormatter from './TableColumnFormatter';\n\n/** Column formatter for strings */\nexport class StringColumnFormatter extends TableColumnFormatter<string> {\n format(value: string): string {\n return value;\n }\n}\n\nexport default StringColumnFormatter;\n"],"mappings":"AAAA;AAAA,OACOA,oBAAoB;AAE3B;AACA,OAAO,MAAMC,qBAAqB,SAASD,oBAAoB,CAAS;EACtEE,MAAM,CAACC,KAAa,EAAU;IAC5B,OAAOA,KAAK;EACd;AACF;AAEA,eAAeF,qBAAqB"}
@@ -1,11 +1,10 @@
1
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
2
  /* eslint class-methods-use-this: "off" */
4
-
5
3
  /**
6
4
  * Default column data formatter. Just interpolates the value as a string and returns.
7
5
  * Extend this class and register with TableUtils to make use of it.
8
6
  */
7
+
9
8
  export class TableColumnFormatter {
10
9
  /**
11
10
  * Validates format object
@@ -15,17 +14,17 @@ export class TableColumnFormatter {
15
14
  static isValid(format) {
16
15
  return true;
17
16
  }
17
+
18
18
  /**
19
19
  * Check if the given formats match
20
20
  * @param formatA format object to check
21
21
  * @param formatB format object to check
22
22
  * @returns True if the formats match
23
23
  */
24
-
25
-
26
24
  static isSameFormat(formatA, formatB) {
27
25
  throw new Error('isSameFormat not implemented');
28
26
  }
27
+
29
28
  /**
30
29
  * Create and return a Format object
31
30
  * @param label The label of the format object
@@ -33,8 +32,6 @@ export class TableColumnFormatter {
33
32
  * @param type The type of column to use for this format
34
33
  * @returns A format object
35
34
  */
36
-
37
-
38
35
  static makeFormat(label, formatString, type) {
39
36
  return {
40
37
  label,
@@ -42,24 +39,18 @@ export class TableColumnFormatter {
42
39
  type
43
40
  };
44
41
  }
42
+
45
43
  /**
46
44
  * @param value The value to format
47
45
  * @param format Optional format object with value transformation options
48
46
  * @returns String the formatted text string of the value passed in.
49
47
  */
50
-
51
-
52
48
  format(value, format) {
53
49
  return '';
54
50
  }
55
-
56
51
  }
57
-
58
52
  _defineProperty(TableColumnFormatter, "TYPE_GLOBAL", 'type-global');
59
-
60
53
  _defineProperty(TableColumnFormatter, "TYPE_CONTEXT_PRESET", 'type-context-preset');
61
-
62
54
  _defineProperty(TableColumnFormatter, "TYPE_CONTEXT_CUSTOM", 'type-context-custom');
63
-
64
55
  export default TableColumnFormatter;
65
56
  //# sourceMappingURL=TableColumnFormatter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableColumnFormatter.js","names":["TableColumnFormatter","isValid","format","isSameFormat","formatA","formatB","Error","makeFormat","label","formatString","type","value"],"sources":["../../src/formatters/TableColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/**\n * Default column data formatter. Just interpolates the value as a string and returns.\n * Extend this class and register with TableUtils to make use of it.\n */\n\nexport type TableColumnFormatType =\n | 'type-global'\n | 'type-context-preset'\n | 'type-context-custom';\n\nexport type TableColumnFormat = {\n label: string;\n formatString: string;\n type: TableColumnFormatType;\n};\n\nexport class TableColumnFormatter<T = unknown> {\n static TYPE_GLOBAL: TableColumnFormatType = 'type-global';\n\n static TYPE_CONTEXT_PRESET: TableColumnFormatType = 'type-context-preset';\n\n static TYPE_CONTEXT_CUSTOM: TableColumnFormatType = 'type-context-custom';\n\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: TableColumnFormat): boolean {\n return true;\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: TableColumnFormat | null,\n formatB: TableColumnFormat | null\n ): boolean {\n throw new Error('isSameFormat not implemented');\n }\n\n /**\n * Create and return a Format object\n * @param label The label of the format object\n * @param formatString Format string to use for the format\n * @param type The type of column to use for this format\n * @returns A format object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type: TableColumnFormatType\n ): TableColumnFormat {\n return { label, formatString, type };\n }\n\n /**\n * @param value The value to format\n * @param format Optional format object with value transformation options\n * @returns String the formatted text string of the value passed in.\n */\n format(value: T, format?: Partial<TableColumnFormat>): string {\n return '';\n }\n}\n\nexport default TableColumnFormatter;\n"],"mappings":";;AAAA;;AACA;AACA;AACA;AACA;AAaA,OAAO,MAAMA,oBAAN,CAAwC;EAO7C;AACF;AACA;AACA;AACA;EACgB,OAAPC,OAAO,CAACC,MAAD,EAAqC;IACjD,OAAO,IAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EACqB,OAAZC,YAAY,CACjBC,OADiB,EAEjBC,OAFiB,EAGR;IACT,MAAM,IAAIC,KAAJ,CAAU,8BAAV,CAAN;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;;;EACmB,OAAVC,UAAU,CACfC,KADe,EAEfC,YAFe,EAGfC,IAHe,EAII;IACnB,OAAO;MAAEF,KAAF;MAASC,YAAT;MAAuBC;IAAvB,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACER,MAAM,CAACS,KAAD,EAAWT,MAAX,EAAwD;IAC5D,OAAO,EAAP;EACD;;AAnD4C;;gBAAlCF,oB,iBACiC,a;;gBADjCA,oB,yBAGyC,qB;;gBAHzCA,oB,yBAKyC,qB;;AAiDtD,eAAeA,oBAAf"}
1
+ {"version":3,"file":"TableColumnFormatter.js","names":["TableColumnFormatter","isValid","format","isSameFormat","formatA","formatB","Error","makeFormat","label","formatString","type","value"],"sources":["../../src/formatters/TableColumnFormatter.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/**\n * Default column data formatter. Just interpolates the value as a string and returns.\n * Extend this class and register with TableUtils to make use of it.\n */\n\nexport type TableColumnFormatType =\n | 'type-global'\n | 'type-context-preset'\n | 'type-context-custom';\n\nexport type TableColumnFormat = {\n label: string;\n formatString: string;\n type: TableColumnFormatType;\n};\n\nexport class TableColumnFormatter<T = unknown> {\n static TYPE_GLOBAL: TableColumnFormatType = 'type-global';\n\n static TYPE_CONTEXT_PRESET: TableColumnFormatType = 'type-context-preset';\n\n static TYPE_CONTEXT_CUSTOM: TableColumnFormatType = 'type-context-custom';\n\n /**\n * Validates format object\n * @param format Format object\n * @returns true for valid object\n */\n static isValid(format: TableColumnFormat): boolean {\n return true;\n }\n\n /**\n * Check if the given formats match\n * @param formatA format object to check\n * @param formatB format object to check\n * @returns True if the formats match\n */\n static isSameFormat(\n formatA: TableColumnFormat | null,\n formatB: TableColumnFormat | null\n ): boolean {\n throw new Error('isSameFormat not implemented');\n }\n\n /**\n * Create and return a Format object\n * @param label The label of the format object\n * @param formatString Format string to use for the format\n * @param type The type of column to use for this format\n * @returns A format object\n */\n static makeFormat(\n label: string,\n formatString: string,\n type: TableColumnFormatType\n ): TableColumnFormat {\n return { label, formatString, type };\n }\n\n /**\n * @param value The value to format\n * @param format Optional format object with value transformation options\n * @returns String the formatted text string of the value passed in.\n */\n format(value: T, format?: Partial<TableColumnFormat>): string {\n return '';\n }\n}\n\nexport default TableColumnFormatter;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMA,oBAAoB,CAAc;EAO7C;AACF;AACA;AACA;AACA;EACE,OAAOC,OAAO,CAACC,MAAyB,EAAW;IACjD,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAY,CACjBC,OAAiC,EACjCC,OAAiC,EACxB;IACT,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;EACjD;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,KAAa,EACbC,YAAoB,EACpBC,IAA2B,EACR;IACnB,OAAO;MAAEF,KAAK;MAAEC,YAAY;MAAEC;IAAK,CAAC;EACtC;;EAEA;AACF;AACA;AACA;AACA;EACER,MAAM,CAACS,KAAQ,EAAET,MAAmC,EAAU;IAC5D,OAAO,EAAE;EACX;AACF;AAAC,gBApDYF,oBAAoB,iBACa,aAAa;AAAA,gBAD9CA,oBAAoB,yBAGqB,qBAAqB;AAAA,gBAH9DA,oBAAoB,yBAKqB,qBAAqB;AAiD3E,eAAeA,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","BooleanColumnFormatter","CharColumnFormatter","DefaultColumnFormatter","TableColumnFormatter"],"sources":["../../src/formatters/index.ts"],"sourcesContent":["export { default as BooleanColumnFormatter } from './BooleanColumnFormatter';\nexport { default as CharColumnFormatter } from './CharColumnFormatter';\nexport * from './DateTimeColumnFormatter';\nexport * from './DecimalColumnFormatter';\nexport { default as DefaultColumnFormatter } from './DefaultColumnFormatter';\nexport * from './IntegerColumnFormatter';\nexport { default as TableColumnFormatter } from './TableColumnFormatter';\nexport * from './TableColumnFormatter';\nexport * from './StringColumnFormatter';\n"],"mappings":"SAASA,OAAO,IAAIC,sB;SACXD,OAAO,IAAIE,mB;;;SAGXF,OAAO,IAAIG,sB;;SAEXH,OAAO,IAAII,oB"}
1
+ {"version":3,"file":"index.js","names":["default","BooleanColumnFormatter","CharColumnFormatter","DefaultColumnFormatter","TableColumnFormatter"],"sources":["../../src/formatters/index.ts"],"sourcesContent":["export { default as BooleanColumnFormatter } from './BooleanColumnFormatter';\nexport { default as CharColumnFormatter } from './CharColumnFormatter';\nexport * from './DateTimeColumnFormatter';\nexport * from './DecimalColumnFormatter';\nexport { default as DefaultColumnFormatter } from './DefaultColumnFormatter';\nexport * from './IntegerColumnFormatter';\nexport { default as TableColumnFormatter } from './TableColumnFormatter';\nexport * from './TableColumnFormatter';\nexport * from './StringColumnFormatter';\n"],"mappings":"SAASA,OAAO,IAAIC,sBAAsB;AAAA,SACjCD,OAAO,IAAIE,mBAAmB;AAAA;AAAA;AAAA,SAG9BF,OAAO,IAAIG,sBAAsB;AAAA;AAAA,SAEjCH,OAAO,IAAII,oBAAoB;AAAA;AAAA"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","FormatterUtils"],"sources":["../src/index.ts"],"sourcesContent":["export * from './ConnectionUtils';\nexport * from './formatters';\nexport * from './DateUtils';\nexport * from './Formatter';\nexport { default as FormatterUtils } from './FormatterUtils';\nexport * from './FormatterUtils';\nexport * from './Settings';\nexport * from './TableUtils';\n"],"mappings":";;;;SAISA,OAAO,IAAIC,c"}
1
+ {"version":3,"file":"index.js","names":["default","FormatterUtils"],"sources":["../src/index.ts"],"sourcesContent":["export * from './ConnectionUtils';\nexport * from './formatters';\nexport * from './DateUtils';\nexport * from './Formatter';\nexport { default as FormatterUtils } from './FormatterUtils';\nexport * from './FormatterUtils';\nexport * from './Settings';\nexport * from './TableUtils';\n"],"mappings":";;;;SAISA,OAAO,IAAIC,cAAc;AAAA;AAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/jsapi-utils",
3
- "version": "0.22.3-beta.15+d3ecd9d",
3
+ "version": "0.22.3-beta.21+6d63afd",
4
4
  "description": "Deephaven JSAPI Utils",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -21,13 +21,13 @@
21
21
  "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
22
22
  },
23
23
  "dependencies": {
24
- "@deephaven/filters": "^0.22.3-beta.15+d3ecd9d",
25
- "@deephaven/jsapi-shim": "^0.22.3-beta.15+d3ecd9d",
26
- "@deephaven/log": "^0.22.3-beta.15+d3ecd9d",
27
- "@deephaven/utils": "^0.22.3-beta.15+d3ecd9d"
24
+ "@deephaven/filters": "^0.22.3-beta.21+6d63afd",
25
+ "@deephaven/jsapi-shim": "^0.22.3-beta.21+6d63afd",
26
+ "@deephaven/log": "^0.22.3-beta.21+6d63afd",
27
+ "@deephaven/utils": "^0.22.3-beta.21+6d63afd"
28
28
  },
29
29
  "devDependencies": {
30
- "@deephaven/tsconfig": "^0.22.3-beta.15+d3ecd9d"
30
+ "@deephaven/tsconfig": "^0.22.3-beta.21+6d63afd"
31
31
  },
32
32
  "files": [
33
33
  "dist"
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "d3ecd9db8abcd25c5e233aba5ea7861eb758c3f6"
38
+ "gitHead": "6d63afd124485605d545e0104d0cb437eb8993ab"
39
39
  }