@deephaven/iris-grid 0.8.2-beta.6 → 0.9.1-beta.5

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 (125) hide show
  1. package/dist/AdvancedFilterCreator.d.ts +2 -2
  2. package/dist/AdvancedFilterCreator.d.ts.map +1 -1
  3. package/dist/AdvancedFilterCreatorFilterItem.d.ts +30 -31
  4. package/dist/AdvancedFilterCreatorFilterItem.d.ts.map +1 -1
  5. package/dist/AdvancedFilterCreatorFilterItem.js +21 -28
  6. package/dist/AdvancedFilterCreatorFilterItem.js.map +1 -1
  7. package/dist/AdvancedFilterCreatorSelectValueList.d.ts +1 -1
  8. package/dist/CrossColumnSearch.d.ts +1 -1
  9. package/dist/CrossColumnSearch.d.ts.map +1 -1
  10. package/dist/DateUtils.d.ts +46 -44
  11. package/dist/DateUtils.d.ts.map +1 -1
  12. package/dist/DateUtils.js +37 -32
  13. package/dist/DateUtils.js.map +1 -1
  14. package/dist/Formatter.d.ts +37 -35
  15. package/dist/Formatter.d.ts.map +1 -1
  16. package/dist/Formatter.js +57 -37
  17. package/dist/Formatter.js.map +1 -1
  18. package/dist/FormatterUtils.d.ts +12 -8
  19. package/dist/FormatterUtils.d.ts.map +1 -1
  20. package/dist/FormatterUtils.js.map +1 -1
  21. package/dist/IrisGrid.d.ts +15 -12
  22. package/dist/IrisGrid.d.ts.map +1 -1
  23. package/dist/IrisGrid.js +24 -13
  24. package/dist/IrisGrid.js.map +1 -1
  25. package/dist/IrisGridMetricCalculator.d.ts +16 -2
  26. package/dist/IrisGridMetricCalculator.d.ts.map +1 -1
  27. package/dist/IrisGridMetricCalculator.js +4 -3
  28. package/dist/IrisGridMetricCalculator.js.map +1 -1
  29. package/dist/IrisGridModel.d.ts +23 -23
  30. package/dist/IrisGridModel.d.ts.map +1 -1
  31. package/dist/IrisGridModelFactory.d.ts +1 -1
  32. package/dist/IrisGridModelFactory.d.ts.map +1 -1
  33. package/dist/IrisGridProxyModel.d.ts +2 -2
  34. package/dist/IrisGridProxyModel.d.ts.map +1 -1
  35. package/dist/IrisGridTableModel.d.ts +5 -5
  36. package/dist/IrisGridTableModel.d.ts.map +1 -1
  37. package/dist/IrisGridTestUtils.d.ts +1 -1
  38. package/dist/IrisGridTestUtils.d.ts.map +1 -1
  39. package/dist/IrisGridTheme.d.ts +5 -75
  40. package/dist/IrisGridTheme.d.ts.map +1 -1
  41. package/dist/IrisGridTheme.js +2 -1
  42. package/dist/IrisGridTheme.js.map +1 -1
  43. package/dist/IrisGridUtils.d.ts +28 -28
  44. package/dist/IrisGridUtils.d.ts.map +1 -1
  45. package/dist/TableUtils.d.ts +127 -114
  46. package/dist/TableUtils.d.ts.map +1 -1
  47. package/dist/TableUtils.js +76 -69
  48. package/dist/TableUtils.js.map +1 -1
  49. package/dist/declaration.d.js +2 -0
  50. package/dist/declaration.d.js.map +1 -0
  51. package/dist/filters/FilterOperator.d.ts +5 -5
  52. package/dist/filters/FilterOperator.d.ts.map +1 -1
  53. package/dist/filters/FilterOperator.js +1 -3
  54. package/dist/filters/FilterOperator.js.map +1 -1
  55. package/dist/filters/FilterType.d.ts +23 -23
  56. package/dist/filters/FilterType.d.ts.map +1 -1
  57. package/dist/filters/FilterType.js +1 -3
  58. package/dist/filters/FilterType.js.map +1 -1
  59. package/dist/filters/index.d.ts +2 -2
  60. package/dist/filters/index.d.ts.map +1 -1
  61. package/dist/filters/index.js +2 -2
  62. package/dist/filters/index.js.map +1 -1
  63. package/dist/format-context-menus/CustomFormatAction.d.ts +27 -39
  64. package/dist/format-context-menus/CustomFormatAction.d.ts.map +1 -1
  65. package/dist/format-context-menus/CustomFormatAction.js +24 -23
  66. package/dist/format-context-menus/CustomFormatAction.js.map +1 -1
  67. package/dist/format-context-menus/DateTimeFormatContextMenu.d.ts +8 -5
  68. package/dist/format-context-menus/DateTimeFormatContextMenu.d.ts.map +1 -1
  69. package/dist/format-context-menus/DateTimeFormatContextMenu.js +3 -3
  70. package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +1 -1
  71. package/dist/format-context-menus/DecimalFormatContextMenu.d.ts +7 -5
  72. package/dist/format-context-menus/DecimalFormatContextMenu.d.ts.map +1 -1
  73. package/dist/format-context-menus/DecimalFormatContextMenu.js +3 -3
  74. package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -1
  75. package/dist/format-context-menus/FormatContextMenuUtils.d.ts +28 -27
  76. package/dist/format-context-menus/FormatContextMenuUtils.d.ts.map +1 -1
  77. package/dist/format-context-menus/FormatContextMenuUtils.js +12 -10
  78. package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -1
  79. package/dist/format-context-menus/IntegerFormatContextMenu.d.ts +7 -5
  80. package/dist/format-context-menus/IntegerFormatContextMenu.d.ts.map +1 -1
  81. package/dist/format-context-menus/IntegerFormatContextMenu.js +3 -3
  82. package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -1
  83. package/dist/format-context-menus/index.d.ts +3 -3
  84. package/dist/format-context-menus/index.d.ts.map +1 -1
  85. package/dist/format-context-menus/index.js.map +1 -1
  86. package/dist/formatters/BooleanColumnFormatter.d.ts +4 -4
  87. package/dist/formatters/BooleanColumnFormatter.d.ts.map +1 -1
  88. package/dist/formatters/BooleanColumnFormatter.js.map +1 -1
  89. package/dist/formatters/CharColumnFormatter.d.ts +4 -4
  90. package/dist/formatters/CharColumnFormatter.d.ts.map +1 -1
  91. package/dist/formatters/CharColumnFormatter.js.map +1 -1
  92. package/dist/formatters/DateTimeColumnFormatter.d.ts +6 -5
  93. package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
  94. package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
  95. package/dist/formatters/DecimalColumnFormatter.d.ts +2 -2
  96. package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
  97. package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
  98. package/dist/formatters/DefaultColumnFormatter.d.ts +4 -4
  99. package/dist/formatters/DefaultColumnFormatter.d.ts.map +1 -1
  100. package/dist/formatters/DefaultColumnFormatter.js.map +1 -1
  101. package/dist/formatters/IntegerColumnFormatter.d.ts +2 -2
  102. package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
  103. package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
  104. package/dist/formatters/index.d.ts +1 -0
  105. package/dist/formatters/index.d.ts.map +1 -1
  106. package/dist/formatters/index.js +1 -0
  107. package/dist/formatters/index.js.map +1 -1
  108. package/dist/index.d.ts +1 -0
  109. package/dist/index.js +1 -0
  110. package/dist/index.js.map +1 -1
  111. package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts +17 -8
  112. package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts.map +1 -1
  113. package/dist/sidebar/ChartBuilder.d.ts +1 -1
  114. package/dist/sidebar/ChartBuilder.d.ts.map +1 -1
  115. package/dist/sidebar/TableCsvExporter.d.ts +1 -1
  116. package/dist/sidebar/TableCsvExporter.d.ts.map +1 -1
  117. package/dist/sidebar/VisibilityOrderingBuilder.d.ts +1 -1
  118. package/dist/sidebar/VisibilityOrderingBuilder.d.ts.map +1 -1
  119. package/dist/sidebar/aggregations/AggregationEdit.d.ts +2 -4
  120. package/dist/sidebar/aggregations/AggregationEdit.d.ts.map +1 -1
  121. package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -1
  122. package/dist/sidebar/aggregations/AggregationUtils.d.ts +1 -4
  123. package/dist/sidebar/aggregations/AggregationUtils.d.ts.map +1 -1
  124. package/dist/sidebar/aggregations/AggregationUtils.js.map +1 -1
  125. package/package.json +12 -13
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/DateUtils.js"],"names":["dh","DateUtils","makeDateWrapper","timeZone","year","month","day","hour","minute","second","ns","yearString","padStart","monthString","dayString","hourString","minuteString","secondString","nanoString","dateString","i18n","DateTimeFormat","parse","FULL_DATE_FORMAT","TimeZone","getTimeZone","getNextNanos","sigNanos","parseInt","zeros","repeat","length","nextNanoString","getNextDate","components","values","date","hours","minutes","seconds","nanos","jsDate","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","parseMonth","Number","isNaN","NaN","cleanMonthString","trim","toLowerCase","i","months","startsWith","parseDateValues","padEnd","parseDateTimeString","dateTimeString","regex","result","exec","Error","overflow","parseDateRange","text","cleanText","now","startDate","endDate","DateWrapper","ofJsDate","getJsDate","dateWrapper","asDate"],"mappings":";;AAAA,OAAOA,EAAP,MAAe,uBAAf;;AAEA,MAAMC,SAAN,CAAgB;AAkBd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACwB,SAAfC,eAAe,CACpBC,QADoB,EAEpBC,IAFoB,EASpB;AAAA,QANAC,KAMA,uEANQ,CAMR;AAAA,QALAC,GAKA,uEALM,CAKN;AAAA,QAJAC,IAIA,uEAJO,CAIP;AAAA,QAHAC,MAGA,uEAHS,CAGT;AAAA,QAFAC,MAEA,uEAFS,CAET;AAAA,QADAC,EACA,uEADK,CACL;AACA,QAAMC,UAAU,GAAG,UAAGP,IAAH,EAAUQ,QAAV,CAAmB,CAAnB,EAAsB,GAAtB,CAAnB;AACA,QAAMC,WAAW,GAAG,UAAGR,KAAK,GAAG,CAAX,EAAeO,QAAf,CAAwB,CAAxB,EAA2B,GAA3B,CAApB;AACA,QAAME,SAAS,GAAG,UAAGR,GAAH,EAASM,QAAT,CAAkB,CAAlB,EAAqB,GAArB,CAAlB;AACA,QAAMG,UAAU,GAAG,UAAGR,IAAH,EAAUK,QAAV,CAAmB,CAAnB,EAAsB,GAAtB,CAAnB;AACA,QAAMI,YAAY,GAAG,UAAGR,MAAH,EAAYI,QAAZ,CAAqB,CAArB,EAAwB,GAAxB,CAArB;AACA,QAAMK,YAAY,GAAG,UAAGR,MAAH,EAAYG,QAAZ,CAAqB,CAArB,EAAwB,GAAxB,CAArB;AACA,QAAMM,UAAU,GAAG,UAAGR,EAAH,EAAQE,QAAR,CAAiB,CAAjB,EAAoB,GAApB,CAAnB;AAEA,QAAMO,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,CAACC,eAAV,CAChBC,QADgB,EAEhBgC,MAAM,CAAC/B,IAFS,EAGhB+B,MAAM,CAAC9B,KAHS,EAIhB8B,MAAM,CAACC,IAJS,EAKhBD,MAAM,CAACE,KALS,EAMhBF,MAAM,CAACG,OANS,EAOhBH,MAAM,CAACI,OAPS,EAQhBJ,MAAM,CAACK,KARS,CAAlB;AAWA,QAAMiC,OAAO,GAAGxE,SAAS,CAACgC,WAAV,CAAsBC,UAAtB,EAAkCC,MAAlC,EAA0ChC,QAA1C,CAAhB;AACA,WAAO,CAACqE,SAAD,EAAYC,OAAZ,CAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACkB,SAATG,SAAS,CAACC,WAAD,EAAc;AAC5B,QAAIA,WAAW,CAACC,MAAhB,EAAwB;AACtB,aAAOD,WAAW,CAACC,MAAZ,EAAP;AACD;;AACD,WAAO,IAAIpC,IAAJ,CAASmC,WAAT,CAAP;AACD;;AAzUa;;gBAAV5E,S,sBACsB,+B;;gBADtBA,S,YAGY,CACd,SADc,EAEd,UAFc,EAGd,OAHc,EAId,OAJc,EAKd,KALc,EAMd,MANc,EAOd,MAPc,EAQd,QARc,EASd,WATc,EAUd,SAVc,EAWd,UAXc,EAYd,UAZc,C;;AAyUlB,eAAeA,SAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\n\nclass DateUtils {\n static FULL_DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS';\n\n static months = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december',\n ];\n\n /**\n *\n * @param {string} timeZone The time zone to parse this time in. E.g. America/New_York\n * @param {Number} year The year for the date\n * @param {Number} month The month, starting at 0\n * @param {Number} day The day, starting at 1\n * @param {Number} hour The hours\n * @param {Number} minute The minutes\n * @param {Number} second The seconds\n * @param {Number} ns The nanoseconds\n */\n static makeDateWrapper(\n timeZone,\n year,\n month = 0,\n day = 1,\n hour = 0,\n minute = 0,\n second = 0,\n ns = 0\n ) {\n const yearString = `${year}`.padStart(4, '0');\n const monthString = `${month + 1}`.padStart(2, '0');\n const dayString = `${day}`.padStart(2, '0');\n const hourString = `${hour}`.padStart(2, '0');\n const minuteString = `${minute}`.padStart(2, '0');\n const secondString = `${second}`.padStart(2, '0');\n const nanoString = `${ns}`.padStart(9, '0');\n\n const dateString = `${yearString}-${monthString}-${dayString} ${hourString}:${minuteString}:${secondString}.${nanoString}`;\n return dh.i18n.DateTimeFormat.parse(\n DateUtils.FULL_DATE_FORMAT,\n dateString,\n dh.i18n.TimeZone.getTimeZone(timeZone)\n );\n }\n\n /**\n * Takes the string the user entered and returns the next nanos value\n * @param {String} nanoString The nano string to get the next one of\n * @returns {Number} The value of the next nanos\n */\n static getNextNanos(nanoString) {\n const sigNanos = parseInt(nanoString, 10);\n // Get the zeroes needed for padding before adding one so we handle overflow properly.\n const zeros = '0'.repeat(9 - nanoString.length);\n const nextNanoString = `${sigNanos + 1}${zeros}`;\n return parseInt(nextNanoString, 10);\n }\n\n /**\n * @param {Object} components The string components that were parsed from the original string\n * @param {Object} values The values that were parsed from the components\n * @param {string} timeZone The time zone to parse the date in. E.g. America/New_York\n * @returns {dh.DateWrapper} Returns the DateWrapper for the next date, or null if a full date was passed in\n */\n static getNextDate(components, values, timeZone) {\n let { year, month, date, hours, minutes, seconds, nanos } = values;\n\n if (components.nanos != null) {\n if (components.nanos.length === 9) {\n // They want an exact match\n return null;\n }\n nanos = DateUtils.getNextNanos(components.nanos);\n if (nanos > 999999999) {\n // There's an overflow, add it to the seconds manually\n seconds += 1;\n nanos = 0;\n }\n } else if (components.seconds != null) {\n seconds += 1;\n } else if (components.minutes != null) {\n minutes += 1;\n } else if (components.hours != null) {\n hours += 1;\n } else if (components.date != null) {\n date += 1;\n } else if (components.month != null) {\n month += 1;\n } else {\n year += 1;\n }\n\n // Use the JS date to handle overflow rather than doing our own logic\n // Because handling leap years and stuff is a pain\n // Still need to add nanos after, and the overflow from that is already added to seconds above\n const jsDate = new Date(year, month, date, hours, minutes, seconds);\n return DateUtils.makeDateWrapper(\n timeZone,\n jsDate.getFullYear(),\n jsDate.getMonth(),\n jsDate.getDate(),\n jsDate.getHours(),\n jsDate.getMinutes(),\n jsDate.getSeconds(),\n nanos\n );\n }\n\n /**\n * Get the JS month value for the provided string.\n * Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)\n * @param {string} monthString The string to parse to a JS month value\n * @returns number THe JS month value, which starts at 0 for january, or null if nothing could be parsed\n */\n static parseMonth(monthString) {\n const month = parseInt(monthString, 10);\n if (!Number.isNaN(month)) {\n if (month >= 1 && month <= 12) {\n return month - 1;\n }\n return NaN;\n }\n\n const cleanMonthString = monthString.trim().toLowerCase();\n if (cleanMonthString.length >= 3) {\n for (let i = 0; i < DateUtils.months.length; i += 1) {\n if (DateUtils.months[i].startsWith(cleanMonthString)) {\n return i;\n }\n }\n }\n\n return NaN;\n }\n\n /**\n * Parse a date object out of the provided string segments.\n * Also using `parseMonth` to get month names like Aug/August rather than\n * simply doing `parseInt`.\n * @param {string} yearString The year part of the string\n * @param {string} monthString The month part of the string\n * @param {string} dayString The day part of the string\n * @param {string} hourString The hour part of the string\n * @param {string} minuteString The minute part of the string\n * @param {string} secondString The second part of the string\n * @param {string} nanoString The milli part of the string\n */\n static parseDateValues(\n yearString,\n monthString,\n dayString,\n hourString,\n minuteString,\n secondString,\n nanoString\n ) {\n const year = parseInt(yearString, 10);\n const month = monthString != null ? this.parseMonth(monthString) : 0;\n const date = dayString != null ? parseInt(dayString, 10) : 1;\n const hours = hourString != null ? parseInt(hourString, 10) : 0;\n const minutes = minuteString != null ? parseInt(minuteString, 10) : 0;\n const seconds = secondString != null ? parseInt(secondString, 10) : 0;\n const nanos =\n nanoString != null ? parseInt(nanoString.padEnd(9, '0'), 10) : 0;\n if (\n Number.isNaN(year) ||\n Number.isNaN(month) ||\n Number.isNaN(date) ||\n Number.isNaN(hours) ||\n Number.isNaN(minutes) ||\n Number.isNaN(seconds) ||\n Number.isNaN(nanos)\n ) {\n return null;\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parse out a date time string into it's string components.\n * Anything that is not captured in the string will be undefined.\n *\n * @param {string} dateTimeString The date time string to parse\n * @returns {object} Containing the date time components\n */\n static parseDateTimeString(dateTimeString) {\n const regex = /\\s*(\\d{4})([-./]([\\da-z]+))?([-./](\\d{1,2}))?([tT\\s](\\d{2})([:](\\d{2}))?([:](\\d{2}))?([.](\\d{1,9}))?)?(.*)/;\n const result = regex.exec(dateTimeString);\n if (result == null) {\n throw new Error(`Unexpected date string: ${dateTimeString}`);\n }\n\n const [\n ,\n year,\n ,\n month,\n ,\n date,\n ,\n hours,\n ,\n minutes,\n ,\n seconds,\n ,\n nanos,\n overflow,\n ] = result;\n if (overflow != null && overflow.length > 0) {\n throw new Error(\n `Unexpected characters after date string '${dateTimeString}': ${overflow}`\n );\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parses the date range provided from a string of text.\n * @param {string} text The string to parse the date from. Can be a keyword like \"today\", or in the format \"2018-08-04\"\n * @param {string} timeZone The time zone to parse this range in. E.g. America/New_York\n * @returns {[DateWrapper, DateWrapper]} A tuple with the start/end values for that date range\n */\n static parseDateRange(text, timeZone) {\n const cleanText = text.trim().toLowerCase();\n if (cleanText.length === 0) {\n throw new Error('Cannot parse date range from empty string');\n }\n\n if (cleanText === 'null') {\n return [null, null];\n }\n\n if (cleanText === 'today') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() + 1\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'yesterday') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - 1\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'now') {\n const now = new Date(Date.now());\n const date = dh.DateWrapper.ofJsDate(now);\n return [date, null];\n }\n\n const components = DateUtils.parseDateTimeString(cleanText);\n if (\n components.year == null &&\n components.month == null &&\n components.date == null\n ) {\n throw new Error(`Unable to extract year, month, or day ${cleanText}`);\n }\n\n const values = DateUtils.parseDateValues(\n components.year,\n components.month,\n components.date,\n components.hours,\n components.minutes,\n components.seconds,\n components.nanos\n );\n\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n values.year,\n values.month,\n values.date,\n values.hours,\n values.minutes,\n values.seconds,\n values.nanos\n );\n\n const endDate = DateUtils.getNextDate(components, values, timeZone);\n return [startDate, endDate];\n }\n\n /**\n * Gets the Js Date object from the provided DateWrapper.\n * In unit test, DateWrapper is just a number provided in millis, so handles that case.\n * @param {DateWrapper|number} dateWrapper The DateWrapper object, or time in millis\n */\n static getJsDate(dateWrapper) {\n if (dateWrapper.asDate) {\n return dateWrapper.asDate();\n }\n return new Date(dateWrapper);\n }\n}\n\nexport default DateUtils;\n"],"file":"DateUtils.js"}
1
+ {"version":3,"sources":["../src/DateUtils.ts"],"names":["dh","DateUtils","makeDateWrapper","timeZone","year","month","day","hour","minute","second","ns","yearString","padStart","monthString","dayString","hourString","minuteString","secondString","nanoString","dateString","i18n","DateTimeFormat","parse","FULL_DATE_FORMAT","TimeZone","getTimeZone","getNextNanos","sigNanos","parseInt","zeros","repeat","length","nextNanoString","getNextDate","components","values","date","hours","minutes","seconds","nanos","jsDate","Date","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","parseMonth","Number","isNaN","NaN","cleanMonthString","trim","toLowerCase","i","months","startsWith","parseDateValues","padEnd","parseDateTimeString","dateTimeString","regex","result","exec","Error","overflow","parseDateRange","text","cleanText","now","startDate","endDate","DateWrapper","ofJsDate","getJsDate","dateWrap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CAACE,KALS,EAMhBF,MAAM,CAACG,OANS,EAOhBH,MAAM,CAACI,OAPS,EAQhBJ,MAAM,CAACK,KARS,CAAlB;AAWA,QAAMiC,OAAO,GAAGxE,SAAS,CAACgC,WAAV,CAAsBC,UAAtB,EAAkCC,MAAlC,EAA0ChC,QAA1C,CAAhB;AACA,WAAO,CAACqE,SAAD,EAAYC,OAAZ,CAAP;AACD;AAED;AACF;AACA;AACA;AACA;;;AACkB,SAATG,SAAS,CAACC,WAAD,EAA0C;AACxD,QAAI,OAAOA,WAAP,KAAuB,QAA3B,EAAqC;AACnC,aAAO,IAAInC,IAAJ,CAASmC,WAAT,CAAP;AACD;;AACD,WAAOA,WAAW,CAACC,MAAZ,EAAP;AACD;;AApVa;;gBAAV7E,S,sBACsB,+B;;gBADtBA,S,YAGY,CACd,SADc,EAEd,UAFc,EAGd,OAHc,EAId,OAJc,EAKd,KALc,EAMd,MANc,EAOd,MAPc,EAQd,QARc,EASd,WATc,EAUd,SAVc,EAWd,UAXc,EAYd,UAZc,C;;AAoVlB,eAAeA,SAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\nimport type { DateWrapper } from '@deephaven/jsapi-shim';\n\ninterface DateParts<T> {\n year: T;\n month: T;\n date: T;\n hours: T;\n minutes: T;\n seconds: T;\n nanos: T;\n}\n\nclass DateUtils {\n static FULL_DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS';\n\n static months = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december',\n ];\n\n /**\n *\n * @param timeZone The time zone to parse this time in. E.g. America/New_York\n * @param year The year for the date\n * @param month The month, starting at 0\n * @param day The day, starting at 1\n * @param hour The hours\n * @param minute The minutes\n * @param second The seconds\n * @param ns The nanoseconds\n */\n static makeDateWrapper(\n timeZone: string,\n year: number,\n month = 0,\n day = 1,\n hour = 0,\n minute = 0,\n second = 0,\n ns = 0\n ): DateWrapper {\n const yearString = `${year}`.padStart(4, '0');\n const monthString = `${month + 1}`.padStart(2, '0');\n const dayString = `${day}`.padStart(2, '0');\n const hourString = `${hour}`.padStart(2, '0');\n const minuteString = `${minute}`.padStart(2, '0');\n const secondString = `${second}`.padStart(2, '0');\n const nanoString = `${ns}`.padStart(9, '0');\n\n const dateString = `${yearString}-${monthString}-${dayString} ${hourString}:${minuteString}:${secondString}.${nanoString}`;\n return dh.i18n.DateTimeFormat.parse(\n DateUtils.FULL_DATE_FORMAT,\n dateString,\n dh.i18n.TimeZone.getTimeZone(timeZone)\n );\n }\n\n /**\n * Takes the string the user entered and returns the next nanos value\n * @param nanoString The nano string to get the next one of\n * @returns The value of the next nanos\n */\n static getNextNanos(nanoString: string): number {\n const sigNanos = parseInt(nanoString, 10);\n // Get the zeroes needed for padding before adding one so we handle overflow properly.\n const zeros = '0'.repeat(9 - nanoString.length);\n const nextNanoString = `${sigNanos + 1}${zeros}`;\n return parseInt(nextNanoString, 10);\n }\n\n /**\n * @param components The string components that were parsed from the original string\n * @param values The values that were parsed from the components\n * @param timeZone The time zone to parse the date in. E.g. America/New_York\n * @returns Returns the DateWrapper for the next date, or null if a full date was passed in\n */\n static getNextDate(\n components: DateParts<string>,\n values: DateParts<number>,\n timeZone: string\n ): DateWrapper | null {\n let { year, month, date, hours, minutes, seconds, nanos } = values;\n\n if (components.nanos != null) {\n if (components.nanos.length === 9) {\n // They want an exact match\n return null;\n }\n nanos = DateUtils.getNextNanos(components.nanos);\n if (nanos > 999999999) {\n // There's an overflow, add it to the seconds manually\n seconds += 1;\n nanos = 0;\n }\n } else if (components.seconds != null) {\n seconds += 1;\n } else if (components.minutes != null) {\n minutes += 1;\n } else if (components.hours != null) {\n hours += 1;\n } else if (components.date != null) {\n date += 1;\n } else if (components.month != null) {\n month += 1;\n } else {\n year += 1;\n }\n\n // Use the JS date to handle overflow rather than doing our own logic\n // Because handling leap years and stuff is a pain\n // Still need to add nanos after, and the overflow from that is already added to seconds above\n const jsDate = new Date(year, month, date, hours, minutes, seconds);\n return DateUtils.makeDateWrapper(\n timeZone,\n jsDate.getFullYear(),\n jsDate.getMonth(),\n jsDate.getDate(),\n jsDate.getHours(),\n jsDate.getMinutes(),\n jsDate.getSeconds(),\n nanos\n );\n }\n\n /**\n * Get the JS month value for the provided string.\n * Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)\n * @param monthString The string to parse to a JS month value\n * @returns number The JS month value, which starts at 0 for january, or NaN if nothing could be parsed\n */\n static parseMonth(monthString: string): number {\n const month = parseInt(monthString, 10);\n if (!Number.isNaN(month)) {\n if (month >= 1 && month <= 12) {\n return month - 1;\n }\n return NaN;\n }\n\n const cleanMonthString = monthString.trim().toLowerCase();\n if (cleanMonthString.length >= 3) {\n for (let i = 0; i < DateUtils.months.length; i += 1) {\n if (DateUtils.months[i].startsWith(cleanMonthString)) {\n return i;\n }\n }\n }\n\n return NaN;\n }\n\n /**\n * Parse a date object out of the provided string segments.\n * Also using `parseMonth` to get month names like Aug/August rather than\n * simply doing `parseInt`.\n * @param yearString The year part of the string\n * @param monthString The month part of the string\n * @param dayString The day part of the string\n * @param hourString The hour part of the string\n * @param minuteString The minute part of the string\n * @param secondString The second part of the string\n * @param nanoString The milli part of the string\n */\n static parseDateValues(\n yearString: string,\n monthString: string,\n dayString: string,\n hourString: string,\n minuteString: string,\n secondString: string,\n nanoString: string\n ): DateParts<number> | null {\n const year = parseInt(yearString, 10);\n const month = monthString != null ? this.parseMonth(monthString) : 0;\n const date = dayString != null ? parseInt(dayString, 10) : 1;\n const hours = hourString != null ? parseInt(hourString, 10) : 0;\n const minutes = minuteString != null ? parseInt(minuteString, 10) : 0;\n const seconds = secondString != null ? parseInt(secondString, 10) : 0;\n const nanos =\n nanoString != null ? parseInt(nanoString.padEnd(9, '0'), 10) : 0;\n if (\n Number.isNaN(year) ||\n Number.isNaN(month) ||\n Number.isNaN(date) ||\n Number.isNaN(hours) ||\n Number.isNaN(minutes) ||\n Number.isNaN(seconds) ||\n Number.isNaN(nanos)\n ) {\n return null;\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parse out a date time string into it's string components.\n * Anything that is not captured in the string will be undefined.\n *\n * @param dateTimeString The date time string to parse\n * @returns Containing the date time components\n */\n static parseDateTimeString(dateTimeString: string): DateParts<string> {\n const regex = /\\s*(\\d{4})([-./]([\\da-z]+))?([-./](\\d{1,2}))?([tT\\s](\\d{2})([:](\\d{2}))?([:](\\d{2}))?([.](\\d{1,9}))?)?(.*)/;\n const result = regex.exec(dateTimeString);\n if (result == null) {\n throw new Error(`Unexpected date string: ${dateTimeString}`);\n }\n\n const [\n ,\n year,\n ,\n month,\n ,\n date,\n ,\n hours,\n ,\n minutes,\n ,\n seconds,\n ,\n nanos,\n overflow,\n ] = result;\n if (overflow != null && overflow.length > 0) {\n throw new Error(\n `Unexpected characters after date string '${dateTimeString}': ${overflow}`\n );\n }\n\n return { year, month, date, hours, minutes, seconds, nanos };\n }\n\n /**\n * Parses the date range provided from a string of text.\n * @param text The string to parse the date from. Can be a keyword like \"today\", or in the format \"2018-08-04\"\n * @param timeZone The time zone to parse this range in. E.g. America/New_York\n * @returns A tuple with the start and end value/null for that date range, or both null\n */\n static parseDateRange(\n text: string,\n timeZone: string\n ): [DateWrapper, DateWrapper | null] | [null, null] {\n const cleanText = text.trim().toLowerCase();\n if (cleanText.length === 0) {\n throw new Error('Cannot parse date range from empty string');\n }\n\n if (cleanText === 'null') {\n return [null, null];\n }\n\n if (cleanText === 'today') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() + 1\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'yesterday') {\n const now = new Date(Date.now());\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate() - 1\n );\n const endDate = DateUtils.makeDateWrapper(\n timeZone,\n now.getFullYear(),\n now.getMonth(),\n now.getDate()\n );\n return [startDate, endDate];\n }\n\n if (cleanText === 'now') {\n const now = new Date(Date.now());\n const date = dh.DateWrapper.ofJsDate(now);\n return [date, null];\n }\n\n const components = DateUtils.parseDateTimeString(cleanText);\n if (\n components.year == null &&\n components.month == null &&\n components.date == null\n ) {\n throw new Error(`Unable to extract year, month, or day ${cleanText}`);\n }\n\n const values = DateUtils.parseDateValues(\n components.year,\n components.month,\n components.date,\n components.hours,\n components.minutes,\n components.seconds,\n components.nanos\n );\n\n if (values == null) {\n throw new Error(`Unable to extract date values from ${components}`);\n }\n\n const startDate = DateUtils.makeDateWrapper(\n timeZone,\n values.year,\n values.month,\n values.date,\n values.hours,\n values.minutes,\n values.seconds,\n values.nanos\n );\n\n const endDate = DateUtils.getNextDate(components, values, timeZone);\n return [startDate, endDate];\n }\n\n /**\n * Gets the Js Date object from the provided DateWrapper.\n * In unit test, DateWrapper is just a number provided in millis, so handles that case.\n * @param dateWrapper The DateWrapper object, or time in millis\n */\n static getJsDate(dateWrapper: DateWrapper | number): Date {\n if (typeof dateWrapper === 'number') {\n return new Date(dateWrapper);\n }\n return dateWrapper.asDate();\n }\n}\n\nexport default DateUtils;\n"],"file":"DateUtils.js"}
@@ -1,61 +1,63 @@
1
- export default Formatter;
1
+ import { DataType } from './TableUtils';
2
+ import { DateTimeColumnFormatter, DecimalColumnFormatter, IntegerColumnFormatter, TableColumnFormat, TableColumnFormatter } from './formatters';
3
+ declare type ColumnName = string;
4
+ export interface FormattingRule {
5
+ columnType: string;
6
+ columnName: string;
7
+ format: TableColumnFormat;
8
+ }
2
9
  declare class Formatter {
3
10
  /**
4
- * Converts [{columnType, columnName, format}] to Map { dataType, Map { columnName, format }}
5
- * @param {Array} columnFormattingRules Array or column formatting rules
11
+ * Converts FormattingRule[] to Map
12
+ * @param columnFormattingRules Array or column formatting rules
6
13
  * @returns Map of columnName-to-format Maps indexed by normalized dataType
7
14
  */
8
- static makeColumnFormatMap(columnFormattingRules: any[]): any;
15
+ static makeColumnFormatMap(columnFormattingRules: FormattingRule[]): Map<DataType, Map<ColumnName, TableColumnFormat>>;
9
16
  /**
10
17
  * Creates a column formatting rule
11
- * @param {String} columnType Normalized data type
12
- * @param {String} columnName Column name
13
- * @param {String} format Format string
18
+ * @param columnType Normalized data type
19
+ * @param columnName Column name
20
+ * @param format Format object
14
21
  */
15
- static makeColumnFormattingRule(columnType: string, columnName: string, format: string): {
16
- columnType: string;
17
- columnName: string;
18
- format: string;
19
- };
22
+ static makeColumnFormattingRule(columnType: DataType, columnName: string, format: TableColumnFormat): FormattingRule;
20
23
  /**
21
- * @param {Array} columnFormattingRules Optional array of column formatting rules
22
- * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration
23
- * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration
24
- * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration
24
+ * @param columnFormattingRules Optional array of column formatting rules
25
+ * @param dateTimeOptions Optional object with DateTime configuration
26
+ * @param decimalFormatOptions Optional object with Decimal configuration
27
+ * @param integerFormatOptions Optional object with Integer configuration
25
28
  */
26
- constructor(columnFormattingRules?: any[], dateTimeOptions?: any, decimalFormatOptions?: any, integerFormatOptions?: any);
27
- defaultColumnFormatter: DefaultColumnFormatter;
28
- typeFormatterMap: Map<string, CharColumnFormatter>;
29
- columnFormatMap: any;
29
+ constructor(columnFormattingRules?: FormattingRule[], dateTimeOptions?: ConstructorParameters<typeof DateTimeColumnFormatter>[0], decimalFormatOptions?: ConstructorParameters<typeof DecimalColumnFormatter>[0], integerFormatOptions?: ConstructorParameters<typeof IntegerColumnFormatter>[0]);
30
+ defaultColumnFormatter: TableColumnFormatter;
31
+ typeFormatterMap: Map<DataType, TableColumnFormatter>;
32
+ columnFormatMap: Map<DataType, Map<string, TableColumnFormat>>;
30
33
  /**
31
34
  * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary
32
- * @param {String} columnType column type
33
- * @param {Boolean} createIfNecessary create new entry if true
35
+ * @param columnType column type
36
+ * @param createIfNecessary create new entry if true
34
37
  * @returns Map of format strings indexed by column name or undefined if it doesn't exist
35
38
  */
36
- getColumnFormatMapForType(columnType: string, createIfNecessary?: boolean): any;
39
+ getColumnFormatMapForType(columnType: string, createIfNecessary?: boolean): Map<string, TableColumnFormat> | undefined;
37
40
  /**
38
41
  * Gets a column format object for a given column type and name
39
- * @param {String} columnType column type
40
- * @param {String} columnName column name
42
+ * @param columnType column type
43
+ * @param columnName column name
41
44
  * @returns format object or null for Default
42
45
  */
43
- getColumnFormat(columnType: string, columnName: string): any;
44
- getColumnTypeFormatter(columnType: any): CharColumnFormatter | DefaultColumnFormatter | undefined;
46
+ getColumnFormat(columnType: string, columnName: string): TableColumnFormat | null;
47
+ getColumnTypeFormatter(columnType: string): TableColumnFormatter;
45
48
  /**
46
49
  * Gets formatted string for a given value, column type and name
47
- * @param {Any} value Value to format
48
- * @param {String} columnType Column type used to determine the formatting settings
49
- * @param {String} columnName Column name used to determine the formatting settings
50
- * @param {String} formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap
50
+ * @param value Value to format
51
+ * @param columnType Column type used to determine the formatting settings
52
+ * @param columnName Column name used to determine the formatting settings
53
+ * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap
51
54
  */
52
- getFormattedString(value: any, columnType: string, columnName?: string, formatOverride?: string): string;
55
+ getFormattedString(value: unknown, columnType: string, columnName?: string, formatOverride?: TableColumnFormat): string;
53
56
  /**
54
57
  * Gets the timeZone name
55
- * @returns {string} The time zone name E.g. America/New_York
58
+ * @returns The time zone name E.g. America/New_York
56
59
  */
57
60
  get timeZone(): string;
58
61
  }
59
- import { DefaultColumnFormatter } from "./formatters";
60
- import { CharColumnFormatter } from "./formatters";
62
+ export default Formatter;
61
63
  //# sourceMappingURL=Formatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Formatter.d.ts","sourceRoot":"","sources":["../src/Formatter.js"],"names":[],"mappings":";AAUA;IACE;;;;OAIG;IACH,8DAaC;IAED;;;;;OAKG;IACH;;;;MAMC;IAED;;;;;OAKG;IACH,0HAiCC;IAtBC,+CAA0D;IAG1D,mDAeE;IAGF,qBAA2E;IAG7E;;;;;OAKG;IACH,gFAMC;IAED;;;;;OAKG;IACH,6DAMC;IAED,kGAMC;IAED;;;;;;OAMG;IACH,yGAeC;IAED;;;OAGG;IACH,uBAGC;CACF"}
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;AAItB,aAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,cAAM,SAAS;IACb;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CACxB,qBAAqB,EAAE,cAAc,EAAE,GACtC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAmBpD;;;;;OAKG;IACH,MAAM,CAAC,wBAAwB,CAC7B,UAAU,EAAE,QAAQ,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,iBAAiB,GACxB,cAAc;IAQjB;;;;;OAKG;gBAED,qBAAqB,GAAE,cAAc,EAAO,EAC5C,eAAe,CAAC,EAAE,qBAAqB,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,EAC1E,oBAAoB,CAAC,EAAE,qBAAqB,CAC1C,OAAO,sBAAsB,CAC9B,CAAC,CAAC,CAAC,EACJ,oBAAoB,CAAC,EAAE,qBAAqB,CAC1C,OAAO,sBAAsB,CAC9B,CAAC,CAAC,CAAC;IA+BN,sBAAsB,EAAE,oBAAoB,CAAC;IAE7C,gBAAgB,EAAE,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAEtD,eAAe,EAAE,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE/D;;;;;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
@@ -1,10 +1,14 @@
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
+ import { Log } from '@deephaven/log';
1
4
  import TableUtils from "./TableUtils.js";
2
5
  import { BooleanColumnFormatter, CharColumnFormatter, DateTimeColumnFormatter, DecimalColumnFormatter, DefaultColumnFormatter, IntegerColumnFormatter } from "./formatters/index.js";
6
+ var log = Log.module('Formatter');
3
7
 
4
8
  class Formatter {
5
9
  /**
6
- * Converts [{columnType, columnName, format}] to Map { dataType, Map { columnName, format }}
7
- * @param {Array} columnFormattingRules Array or column formatting rules
10
+ * Converts FormattingRule[] to Map
11
+ * @param columnFormattingRules Array or column formatting rules
8
12
  * @returns Map of columnName-to-format Maps indexed by normalized dataType
9
13
  */
10
14
  static makeColumnFormatMap(columnFormattingRules) {
@@ -15,20 +19,24 @@ class Formatter {
15
19
  return columnFormattingRules.reduce((map, next) => {
16
20
  var dataType = TableUtils.getNormalizedType(next.columnType);
17
21
 
22
+ if (dataType === null) {
23
+ return map;
24
+ }
25
+
18
26
  if (!map.has(dataType)) {
19
27
  map.set(dataType, new Map());
20
28
  }
21
29
 
22
30
  var formatMap = map.get(dataType);
23
- formatMap.set(next.columnName, next.format);
31
+ formatMap === null || formatMap === void 0 ? void 0 : formatMap.set(next.columnName, next.format);
24
32
  return map;
25
33
  }, new Map());
26
34
  }
27
35
  /**
28
36
  * Creates a column formatting rule
29
- * @param {String} columnType Normalized data type
30
- * @param {String} columnName Column name
31
- * @param {String} format Format string
37
+ * @param columnType Normalized data type
38
+ * @param columnName Column name
39
+ * @param format Format object
32
40
  */
33
41
 
34
42
 
@@ -40,18 +48,25 @@ class Formatter {
40
48
  };
41
49
  }
42
50
  /**
43
- * @param {Array} columnFormattingRules Optional array of column formatting rules
44
- * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration
45
- * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration
46
- * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration
51
+ * @param columnFormattingRules Optional array of column formatting rules
52
+ * @param dateTimeOptions Optional object with DateTime configuration
53
+ * @param decimalFormatOptions Optional object with Decimal configuration
54
+ * @param integerFormatOptions Optional object with Integer configuration
47
55
  */
48
56
 
49
57
 
50
58
  constructor() {
51
59
  var columnFormattingRules = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
52
- var dateTimeOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
53
- var decimalFormatOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
54
- var integerFormatOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
60
+ var dateTimeOptions = arguments.length > 1 ? arguments[1] : undefined;
61
+ var decimalFormatOptions = arguments.length > 2 ? arguments[2] : undefined;
62
+ var integerFormatOptions = arguments.length > 3 ? arguments[3] : undefined;
63
+
64
+ _defineProperty(this, "defaultColumnFormatter", void 0);
65
+
66
+ _defineProperty(this, "typeFormatterMap", void 0);
67
+
68
+ _defineProperty(this, "columnFormatMap", void 0);
69
+
55
70
  // Formatting order:
56
71
  // - columnFormatMap[type][name]
57
72
  // - typeFormatterMap[type]
@@ -62,18 +77,22 @@ class Formatter {
62
77
 
63
78
  this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);
64
79
  }
80
+
65
81
  /**
66
82
  * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary
67
- * @param {String} columnType column type
68
- * @param {Boolean} createIfNecessary create new entry if true
83
+ * @param columnType column type
84
+ * @param createIfNecessary create new entry if true
69
85
  * @returns Map of format strings indexed by column name or undefined if it doesn't exist
70
86
  */
71
-
72
-
73
87
  getColumnFormatMapForType(columnType) {
74
88
  var createIfNecessary = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
75
89
  var dataType = TableUtils.getNormalizedType(columnType);
76
90
 
91
+ if (dataType === null) {
92
+ log.warn("Unknown columnType ".concat(columnType));
93
+ return undefined;
94
+ }
95
+
77
96
  if (createIfNecessary && !this.columnFormatMap.has(dataType)) {
78
97
  this.columnFormatMap.set(dataType, new Map());
79
98
  }
@@ -82,43 +101,43 @@ class Formatter {
82
101
  }
83
102
  /**
84
103
  * Gets a column format object for a given column type and name
85
- * @param {String} columnType column type
86
- * @param {String} columnName column name
104
+ * @param columnType column type
105
+ * @param columnName column name
87
106
  * @returns format object or null for Default
88
107
  */
89
108
 
90
109
 
91
110
  getColumnFormat(columnType, columnName) {
92
- var columnFormatMap = this.getColumnFormatMapForType(columnType);
111
+ var _columnFormatMap$get;
93
112
 
94
- if (columnFormatMap && columnFormatMap.has(columnName)) {
95
- return columnFormatMap.get(columnName);
96
- }
97
-
98
- return null;
113
+ var columnFormatMap = this.getColumnFormatMapForType(columnType);
114
+ return (_columnFormatMap$get = columnFormatMap === null || columnFormatMap === void 0 ? void 0 : columnFormatMap.get(columnName)) !== null && _columnFormatMap$get !== void 0 ? _columnFormatMap$get : null;
99
115
  }
100
116
 
101
117
  getColumnTypeFormatter(columnType) {
102
118
  var dataType = TableUtils.getNormalizedType(columnType);
119
+ var columnTypeFormatter = this.defaultColumnFormatter;
120
+
121
+ if (dataType) {
122
+ var _this$typeFormatterMa;
103
123
 
104
- if (dataType && this.typeFormatterMap.has(dataType)) {
105
- return this.typeFormatterMap.get(dataType);
124
+ columnTypeFormatter = (_this$typeFormatterMa = this.typeFormatterMap.get(dataType)) !== null && _this$typeFormatterMa !== void 0 ? _this$typeFormatterMa : columnTypeFormatter;
106
125
  }
107
126
 
108
- return this.defaultColumnFormatter;
127
+ return columnTypeFormatter;
109
128
  }
110
129
  /**
111
130
  * Gets formatted string for a given value, column type and name
112
- * @param {Any} value Value to format
113
- * @param {String} columnType Column type used to determine the formatting settings
114
- * @param {String} columnName Column name used to determine the formatting settings
115
- * @param {String} formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap
131
+ * @param value Value to format
132
+ * @param columnType Column type used to determine the formatting settings
133
+ * @param columnName Column name used to determine the formatting settings
134
+ * @param formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap
116
135
  */
117
136
 
118
137
 
119
138
  getFormattedString(value, columnType) {
120
139
  var columnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
121
- var formatOverride = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
140
+ var formatOverride = arguments.length > 3 ? arguments[3] : undefined;
122
141
 
123
142
  if (value == null) {
124
143
  return '';
@@ -126,18 +145,19 @@ class Formatter {
126
145
 
127
146
  var formatter = this.getColumnTypeFormatter(columnType);
128
147
  var format = formatOverride || this.getColumnFormat(columnType, columnName);
129
- return formatter.format(value, format);
148
+ return formatter.format(value, format !== null && format !== void 0 ? format : undefined);
130
149
  }
131
150
  /**
132
151
  * Gets the timeZone name
133
- * @returns {string} The time zone name E.g. America/New_York
152
+ * @returns The time zone name E.g. America/New_York
134
153
  */
135
154
 
136
155
 
137
156
  get timeZone() {
138
- var _this$typeFormatterMa, _this$typeFormatterMa2;
157
+ var _formatter$dhTimeZone;
139
158
 
140
- return (_this$typeFormatterMa = this.typeFormatterMap.get(TableUtils.dataType.DATETIME)) === null || _this$typeFormatterMa === void 0 ? void 0 : (_this$typeFormatterMa2 = _this$typeFormatterMa.dhTimeZone) === null || _this$typeFormatterMa2 === void 0 ? void 0 : _this$typeFormatterMa2.id;
159
+ var formatter = this.typeFormatterMap.get(TableUtils.dataType.DATETIME);
160
+ return formatter === null || formatter === void 0 ? void 0 : (_formatter$dhTimeZone = formatter.dhTimeZone) === null || _formatter$dhTimeZone === void 0 ? void 0 : _formatter$dhTimeZone.id;
141
161
  }
142
162
 
143
163
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Formatter.js"],"names":["TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","Formatter","makeColumnFormatMap","columnFormattingRules","Map","reduce","map","next","dataType","getNormalizedType","columnType","has","set","formatMap","get","columnName","format","makeColumnFormattingRule","constructor","dateTimeOptions","decimalFormatOptions","integerFormatOptions","defaultColumnFormatter","typeFormatterMap","BOOLEAN","CHAR","DATETIME","DECIMAL","INT","columnFormatMap","getColumnFormatMapForType","createIfNecessary","getColumnFormat","getColumnTypeFormatter","getFormattedString","value","formatOverride","formatter","timeZone","dhTimeZone","id"],"mappings":"OAAOA,U;SAELC,sB,EACAC,mB,EACAC,uB,EACAC,sB,EACAC,sB,EACAC,sB;;AAGF,MAAMC,SAAN,CAAgB;AACd;AACF;AACA;AACA;AACA;AAC4B,SAAnBC,mBAAmB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EAAAA,sBAAsB,CAACvB,UAAD,EAAa;AACjC,QAAMF,QAAQ,GAAGd,UAAU,CAACe,iBAAX,CAA6BC,UAA7B,CAAjB;;AACA,QAAIF,QAAQ,IAAI,KAAKe,gBAAL,CAAsBZ,GAAtB,CAA0BH,QAA1B,CAAhB,EAAqD;AACnD,aAAO,KAAKe,gBAAL,CAAsBT,GAAtB,CAA0BN,QAA1B,CAAP;AACD;;AACD,WAAO,KAAKc,sBAAZ;AACD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;;;AACEY,EAAAA,kBAAkB,CAChBC,KADgB,EAEhBzB,UAFgB,EAKhB;AAAA,QAFAK,UAEA,uEAFa,EAEb;AAAA,QADAqB,cACA,uEADiB,IACjB;;AACA,QAAID,KAAK,IAAI,IAAb,EAAmB;AACjB,aAAO,EAAP;AACD;;AAED,QAAME,SAAS,GAAG,KAAKJ,sBAAL,CAA4BvB,UAA5B,CAAlB;AACA,QAAMM,MAAM,GACVoB,cAAc,IAAI,KAAKJ,eAAL,CAAqBtB,UAArB,EAAiCK,UAAjC,CADpB;AAGA,WAAOsB,SAAS,CAACrB,MAAV,CAAiBmB,KAAjB,EAAwBnB,MAAxB,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARsB,QAAQ,GAAG;AAAA;;AACb,oCAAO,KAAKf,gBAAL,CAAsBT,GAAtB,CAA0BpB,UAAU,CAACc,QAAX,CAAoBkB,QAA9C,CAAP,oFAAO,sBAAyDa,UAAhE,2DAAO,uBACHC,EADJ;AAED;;AA/Ia;;AAkJhB,eAAevC,SAAf","sourcesContent":["import TableUtils from './TableUtils';\nimport {\n BooleanColumnFormatter,\n CharColumnFormatter,\n DateTimeColumnFormatter,\n DecimalColumnFormatter,\n DefaultColumnFormatter,\n IntegerColumnFormatter,\n} from './formatters';\n\nclass Formatter {\n /**\n * Converts [{columnType, columnName, format}] to Map { dataType, Map { columnName, format }}\n * @param {Array} columnFormattingRules Array or column formatting rules\n * @returns Map of columnName-to-format Maps indexed by normalized dataType\n */\n static makeColumnFormatMap(columnFormattingRules) {\n if (columnFormattingRules == null) {\n return new Map();\n }\n return columnFormattingRules.reduce((map, next) => {\n const dataType = TableUtils.getNormalizedType(next.columnType);\n if (!map.has(dataType)) {\n map.set(dataType, new Map());\n }\n const formatMap = map.get(dataType);\n formatMap.set(next.columnName, next.format);\n return map;\n }, new Map());\n }\n\n /**\n * Creates a column formatting rule\n * @param {String} columnType Normalized data type\n * @param {String} columnName Column name\n * @param {String} format Format string\n */\n static makeColumnFormattingRule(columnType, columnName, format) {\n return {\n columnType,\n columnName,\n format,\n };\n }\n\n /**\n * @param {Array} columnFormattingRules Optional array of column formatting rules\n * @param {DateTimeColumnFormatterOptions} dateTimeOptions Optional object with DateTime configuration\n * @param {DecimalColumnFormatterOptions} decimalFormatOptions Optional object with Decimal format configuration\n * @param {IntegerColumnFormatterOptions} integerFormatOptions Optional object with Integer format configuration\n */\n constructor(\n columnFormattingRules = [],\n dateTimeOptions = {},\n decimalFormatOptions = {},\n integerFormatOptions = {}\n ) {\n // Formatting order:\n // - columnFormatMap[type][name]\n // - typeFormatterMap[type]\n // - defaultColumnFormatter\n\n this.defaultColumnFormatter = new DefaultColumnFormatter();\n\n // Default formatters by data type\n this.typeFormatterMap = new Map([\n [TableUtils.dataType.BOOLEAN, new BooleanColumnFormatter()],\n [TableUtils.dataType.CHAR, new CharColumnFormatter()],\n [\n TableUtils.dataType.DATETIME,\n new DateTimeColumnFormatter(dateTimeOptions),\n ],\n [\n TableUtils.dataType.DECIMAL,\n new DecimalColumnFormatter(decimalFormatOptions),\n ],\n [\n TableUtils.dataType.INT,\n new IntegerColumnFormatter(integerFormatOptions),\n ],\n ]);\n\n // Formats indexed by data type and column name\n this.columnFormatMap = Formatter.makeColumnFormatMap(columnFormattingRules);\n }\n\n /**\n * Gets columnFormatMap indexed by name for a given column type, creates new Map entry if necessary\n * @param {String} columnType column type\n * @param {Boolean} createIfNecessary create new entry if true\n * @returns Map of format strings indexed by column name or undefined if it doesn't exist\n */\n getColumnFormatMapForType(columnType, createIfNecessary = false) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (createIfNecessary && !this.columnFormatMap.has(dataType)) {\n this.columnFormatMap.set(dataType, new Map());\n }\n return this.columnFormatMap.get(dataType);\n }\n\n /**\n * Gets a column format object for a given column type and name\n * @param {String} columnType column type\n * @param {String} columnName column name\n * @returns format object or null for Default\n */\n getColumnFormat(columnType, columnName) {\n const columnFormatMap = this.getColumnFormatMapForType(columnType);\n if (columnFormatMap && columnFormatMap.has(columnName)) {\n return columnFormatMap.get(columnName);\n }\n return null;\n }\n\n getColumnTypeFormatter(columnType) {\n const dataType = TableUtils.getNormalizedType(columnType);\n if (dataType && this.typeFormatterMap.has(dataType)) {\n return this.typeFormatterMap.get(dataType);\n }\n return this.defaultColumnFormatter;\n }\n\n /**\n * Gets formatted string for a given value, column type and name\n * @param {Any} value Value to format\n * @param {String} columnType Column type used to determine the formatting settings\n * @param {String} columnName Column name used to determine the formatting settings\n * @param {String} formatOverride Format object passed to the formatter in place of the format defined in columnFormatMap\n */\n getFormattedString(\n value,\n columnType,\n columnName = '',\n formatOverride = null\n ) {\n if (value == null) {\n return '';\n }\n\n const formatter = this.getColumnTypeFormatter(columnType);\n const format =\n formatOverride || this.getColumnFormat(columnType, columnName);\n\n return formatter.format(value, format);\n }\n\n /**\n * Gets the timeZone name\n * @returns {string} The time zone name E.g. America/New_York\n */\n get timeZone() {\n return this.typeFormatterMap.get(TableUtils.dataType.DATETIME)?.dhTimeZone\n ?.id;\n }\n}\n\nexport default Formatter;\n"],"file":"Formatter.js"}
1
+ {"version":3,"sources":["../src/Formatter.ts"],"names":["Log","TableUtils","BooleanColumnFormatter","CharColumnFormatter","DateTimeColumnFormatter","DecimalColumnFormatter","DefaultColumnFormatter","IntegerColumnFormatter","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","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;AAKF,IAAMC,GAAG,GAAGR,GAAG,CAACS,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,GAAGhB,UAAU,CAACiB,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,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,MAAM,GACVuB,cAAc,IAAI,KAAKL,eAAL,CAAqBxB,UAArB,EAAiCK,UAAjC,CADpB;AAGA,WAAOyB,SAAS,CAACxB,MAAV,CAAiBsB,KAAjB,EAAwBtB,MAAxB,aAAwBA,MAAxB,cAAwBA,MAAxB,GAAkCiB,SAAlC,CAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,MAARQ,QAAQ,GAAW;AAAA;;AACrB,QAAMD,SAAS,GAAG,KAAKjB,gBAAL,CAAsBT,GAAtB,CAChBtB,UAAU,CAACgB,QAAX,CAAoBkB,QADJ,CAAlB;AAGA,WAAOc,SAAP,aAAOA,SAAP,gDAAOA,SAAS,CAAEE,UAAlB,0DAAO,sBAAuBC,EAA9B;AACD;;AA/Ka;;AAkLhB,eAAe1C,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';\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 ]);\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,11 +1,15 @@
1
- export default FormatterUtils;
1
+ import type { FormattingRule } from './Formatter';
2
+ import { DateTimeColumnFormatter } from './formatters';
2
3
  declare class FormatterUtils {
3
- static getColumnFormats(settings: any): any;
4
- static getDateTimeFormatterOptions(settings: any): {
5
- timeZone: any;
6
- defaultDateTimeFormatString: any;
7
- showTimeZone: any;
8
- showTSeparator: any;
9
- };
4
+ static getColumnFormats(settings: {
5
+ formatter: FormattingRule[];
6
+ }): FormattingRule[];
7
+ static getDateTimeFormatterOptions(settings: {
8
+ timeZone: string;
9
+ defaultDateTimeFormat: string;
10
+ showTimeZone: boolean;
11
+ showTSeparator: boolean;
12
+ }): Required<ConstructorParameters<typeof DateTimeColumnFormatter>[0]>;
10
13
  }
14
+ export default FormatterUtils;
11
15
  //# sourceMappingURL=FormatterUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.js"],"names":[],"mappings":";AAAA;IACE,4CAGC;IAED;;;;;MAaC;CACF"}
1
+ {"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,cAAM,cAAc;IAClB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE;QAChC,SAAS,EAAE,cAAc,EAAE,CAAC;KAC7B,GAAG,cAAc,EAAE;IAKpB,MAAM,CAAC,2BAA2B,CAAC,QAAQ,EAAE;QAC3C,QAAQ,EAAE,MAAM,CAAC;QACjB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;KACzB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC;CAcvE;AAED,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/FormatterUtils.js"],"names":["FormatterUtils","getColumnFormats","settings","formatter","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormat","showTimeZone","showTSeparator","defaultDateTimeFormatString"],"mappings":"AAAA,MAAMA,cAAN,CAAqB;AACI,SAAhBC,gBAAgB,CAACC,QAAD,EAAW;AAChC,QAAM;AAAEC,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AAEiC,SAA3BC,2BAA2B,CAACF,QAAD,EAAW;AAC3C,QAAM;AACJG,MAAAA,QADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA;AAJI,QAKFN,QALJ;AAMA,WAAO;AACLG,MAAAA,QADK;AAELI,MAAAA,2BAA2B,EAAEH,qBAFxB;AAGLC,MAAAA,YAHK;AAILC,MAAAA;AAJK,KAAP;AAMD;;AAnBkB;;AAsBrB,eAAeR,cAAf","sourcesContent":["class FormatterUtils {\n static getColumnFormats(settings) {\n const { formatter } = settings;\n return formatter;\n }\n\n static getDateTimeFormatterOptions(settings) {\n const {\n timeZone,\n defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n } = settings;\n return {\n timeZone,\n defaultDateTimeFormatString: defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n };\n }\n}\n\nexport default FormatterUtils;\n"],"file":"FormatterUtils.js"}
1
+ {"version":3,"sources":["../src/FormatterUtils.ts"],"names":["FormatterUtils","getColumnFormats","settings","formatter","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormat","showTimeZone","showTSeparator","defaultDateTimeFormatString"],"mappings":"AAGA,MAAMA,cAAN,CAAqB;AACI,SAAhBC,gBAAgB,CAACC,QAAD,EAEF;AACnB,QAAM;AAAEC,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AAEiC,SAA3BC,2BAA2B,CAACF,QAAD,EAKqC;AACrE,QAAM;AACJG,MAAAA,QADI;AAEJC,MAAAA,qBAFI;AAGJC,MAAAA,YAHI;AAIJC,MAAAA;AAJI,QAKFN,QALJ;AAMA,WAAO;AACLG,MAAAA,QADK;AAELI,MAAAA,2BAA2B,EAAEH,qBAFxB;AAGLC,MAAAA,YAHK;AAILC,MAAAA;AAJK,KAAP;AAMD;;AA1BkB;;AA6BrB,eAAeR,cAAf","sourcesContent":["import type { FormattingRule } from './Formatter';\nimport { DateTimeColumnFormatter } from './formatters';\n\nclass FormatterUtils {\n static getColumnFormats(settings: {\n formatter: FormattingRule[];\n }): FormattingRule[] {\n const { formatter } = settings;\n return formatter;\n }\n\n static getDateTimeFormatterOptions(settings: {\n timeZone: string;\n defaultDateTimeFormat: string;\n showTimeZone: boolean;\n showTSeparator: boolean;\n }): Required<ConstructorParameters<typeof DateTimeColumnFormatter>[0]> {\n const {\n timeZone,\n defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n } = settings;\n return {\n timeZone,\n defaultDateTimeFormatString: defaultDateTimeFormat,\n showTimeZone,\n showTSeparator,\n };\n }\n}\n\nexport default FormatterUtils;\n"],"file":"FormatterUtils.js"}
@@ -2,7 +2,7 @@ export class IrisGrid extends React.Component<any, any, any> {
2
2
  static minDebounce: number;
3
3
  static maxDebounce: number;
4
4
  static loadingSpinnerDelay: number;
5
- static makeQuickFilter(column: any, text: any, timeZone: any): any;
5
+ static makeQuickFilter(column: any, text: any, timeZone: any): import("@deephaven/jsapi-shim").FilterCondition | null;
6
6
  constructor(props: any);
7
7
  handleAdvancedFilterChange(column: any, filter: any, options: any): void;
8
8
  handleAdvancedFilterSortChange(column: any, direction: any, addToExisting?: boolean): void;
@@ -13,17 +13,17 @@ export class IrisGrid extends React.Component<any, any, any> {
13
13
  * A specific aggregation has been modified
14
14
  * @param {Aggregation} aggregation The new aggregation
15
15
  */
16
- handleAggregationChange(aggregation: any): void;
16
+ handleAggregationChange(aggregation: Aggregation): void;
17
17
  /**
18
18
  * User added, removed, or changed the order of aggregations, or position
19
19
  * @param {AggregationSettings} aggregationSettings The new aggregation settings
20
20
  */
21
- handleAggregationsChange(aggregationSettings: any): void;
21
+ handleAggregationsChange(aggregationSettings: AggregationSettings): void;
22
22
  /**
23
23
  * An aggregations has been selected for editing
24
24
  * @param {Aggregation} aggregation The aggregation to edit
25
25
  */
26
- handleAggregationEdit(aggregation: any): void;
26
+ handleAggregationEdit(aggregation: Aggregation): void;
27
27
  handleAnimationLoop(): void;
28
28
  handleAnimationStart(): void;
29
29
  handleAnimationEnd(): void;
@@ -71,9 +71,9 @@ export class IrisGrid extends React.Component<any, any, any> {
71
71
  lastLoadedConfig: {
72
72
  advancedFilters: Map<any, any>;
73
73
  customColumns: never[];
74
- reverseType: string;
74
+ reverseType: "none";
75
75
  quickFilters: Map<any, any>;
76
- searchFilter: any;
76
+ searchFilter: import("@deephaven/jsapi-shim").FilterCondition | null;
77
77
  sorts: never[];
78
78
  } | null;
79
79
  tooltip: any;
@@ -113,7 +113,7 @@ export class IrisGrid extends React.Component<any, any, any> {
113
113
  }[];
114
114
  getAdvancedMenuOpenedHandler: ((column: any) => () => void) & memoize.Memoized<(column: any) => () => void>;
115
115
  getCachedAdvancedFilterMenuActions: ((model: any, column: any, advancedFilterOptions: any, sortDirection: any, formatter: any) => JSX.Element) & memoize.Memoized<(model: any, column: any, advancedFilterOptions: any, sortDirection: any, formatter: any) => JSX.Element>;
116
- getCachedOptionItems: ((isChartBuilderAvailable: any, isCustomColumnsAvailable: any, isRollupAvailable: any, isTotalsAvailable: any, isSelectDistinctAvailable: any, isExportAvailable: any, toggleFilterBarAction: any, toggleSearchBarAction: any, isFilterBarShown: any, showSearchBar: any, canDownloadCsv: any) => ({
116
+ getCachedOptionItems: ((isChartBuilderAvailable: any, isCustomColumnsAvailable: any, isRollupAvailable: any, isTotalsAvailable: any, isSelectDistinctAvailable: any, isExportAvailable: any, toggleFilterBarAction: any, toggleSearchBarAction: any, isFilterBarShown: any, showSearchBar: any, canDownloadCsv: any, canToggleSearch: any) => ({
117
117
  type: OptionType;
118
118
  title: string;
119
119
  icon: import("@fortawesome/fontawesome-common-types").IconDefinition;
@@ -127,7 +127,7 @@ export class IrisGrid extends React.Component<any, any, any> {
127
127
  icon: import("@fortawesome/fontawesome-common-types").IconDefinition;
128
128
  isOn: any;
129
129
  onChange: any;
130
- })[]) & memoize.Memoized<(isChartBuilderAvailable: any, isCustomColumnsAvailable: any, isRollupAvailable: any, isTotalsAvailable: any, isSelectDistinctAvailable: any, isExportAvailable: any, toggleFilterBarAction: any, toggleSearchBarAction: any, isFilterBarShown: any, showSearchBar: any, canDownloadCsv: any) => ({
130
+ })[]) & memoize.Memoized<(isChartBuilderAvailable: any, isCustomColumnsAvailable: any, isRollupAvailable: any, isTotalsAvailable: any, isSelectDistinctAvailable: any, isExportAvailable: any, toggleFilterBarAction: any, toggleSearchBarAction: any, isFilterBarShown: any, showSearchBar: any, canDownloadCsv: any, canToggleSearch: any) => ({
131
131
  type: OptionType;
132
132
  title: string;
133
133
  icon: import("@fortawesome/fontawesome-common-types").IconDefinition;
@@ -190,7 +190,7 @@ export class IrisGrid extends React.Component<any, any, any> {
190
190
  * @param {inputFilter[]} inputFilters Array of input filters to apply
191
191
  * @param {boolean} replaceExisting If true, new filters will replace the existing ones, instead of merging
192
192
  */
193
- applyInputFilters(inputFilters: any[], replaceExisting?: boolean): void;
193
+ applyInputFilters(inputFilters: inputFilter[], replaceExisting?: boolean): void;
194
194
  /**
195
195
  * Applies a quick filter
196
196
  * @param {number} modelIndex The index in the model of the column to set
@@ -206,7 +206,7 @@ export class IrisGrid extends React.Component<any, any, any> {
206
206
  * @param {dh.FilterCondition} filter A filter to apply to the column, or null if there was an error
207
207
  * @param {String} text The original text the filter was created with
208
208
  */
209
- setQuickFilter(modelIndex: number, filter: any, text: string): void;
209
+ setQuickFilter(modelIndex: number, filter: dh.FilterCondition, text: string): void;
210
210
  /**
211
211
  * Set grid filters based on the filter map
212
212
  * @param {Map<string, Object>} filterMap Filter map
@@ -271,7 +271,7 @@ export class IrisGrid extends React.Component<any, any, any> {
271
271
  * Select the passed in column and notify listener
272
272
  * @param {dh.Column} column The column in this table to link
273
273
  */
274
- selectColumn(column: any): void;
274
+ selectColumn(column: dh.Column): void;
275
275
  /**
276
276
  * Select all the data for a given row and notify listener
277
277
  */
@@ -370,6 +370,7 @@ export namespace IrisGrid {
370
370
  const canDownloadCsv: PropTypes.Requireable<boolean>;
371
371
  const frozenColumns: PropTypes.Requireable<(string | null | undefined)[]>;
372
372
  const theme: PropTypes.Requireable<PropTypes.InferProps<{}>>;
373
+ const canToggleSearch: PropTypes.Requireable<boolean>;
373
374
  }
374
375
  namespace defaultProps {
375
376
  const children_1: null;
@@ -418,7 +419,7 @@ export namespace IrisGrid {
418
419
  export { selectDistinctColumns_1 as selectDistinctColumns };
419
420
  const sorts_1: never[];
420
421
  export { sorts_1 as sorts };
421
- const reverseType_1: string;
422
+ const reverseType_1: "none";
422
423
  export { reverseType_1 as reverseType };
423
424
  const customColumns_1: never[];
424
425
  export { customColumns_1 as customColumns };
@@ -485,6 +486,8 @@ export namespace IrisGrid {
485
486
  export { frozenColumns_1 as frozenColumns };
486
487
  const theme_1: {};
487
488
  export { theme_1 as theme };
489
+ const canToggleSearch_1: boolean;
490
+ export { canToggleSearch_1 as canToggleSearch };
488
491
  }
489
492
  }
490
493
  export default IrisGrid;
@@ -1 +1 @@
1
- {"version":3,"file":"IrisGrid.d.ts","sourceRoot":"","sources":["../src/IrisGrid.jsx"],"names":[],"mappings":"AAiHA;IACE,2BAAyB;IAEzB,2BAAyB;IAEzB,mCAAiC;IAEjC,mEAOC;IAED,wBA0QC;IAq0CD,yEAOC;IAED,2FA0BC;IAED,iCAEC;IAED,4CAEC;IAED,iDAeC;IA6TD;;;OAGG;IACH,gDAaC;IAhCD;;;OAGG;IACH,yDASC;IAqBD;;;OAGG;IACH,8CAeC;IAxoBD,4BAOC;IAED,6BAMC;IAED,2BAIC;IAuRD,0BAEC;IAED,uCAGC;IAED,kCAKC;IAED,wCASC;IAED,0EAOC;IAED,wCAOC;IAhDD,qBAEC;IAsED,mBAEC;IAED,wBAEC;IAUD,oCAIC;IAZD,uBAMC;IAQD,sCAWC;IA8DD,kDAQC;IAED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