@deephaven/iris-grid 0.22.3-beta.18 → 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 (199) hide show
  1. package/dist/AdvancedFilterCreator.js +7 -65
  2. package/dist/AdvancedFilterCreator.js.map +1 -1
  3. package/dist/AdvancedFilterCreatorFilterItem.js +0 -23
  4. package/dist/AdvancedFilterCreatorFilterItem.js.map +1 -1
  5. package/dist/AdvancedFilterCreatorSelectValue.js +0 -52
  6. package/dist/AdvancedFilterCreatorSelectValue.js.map +1 -1
  7. package/dist/AdvancedFilterCreatorSelectValueList.js +2 -42
  8. package/dist/AdvancedFilterCreatorSelectValueList.js.map +1 -1
  9. package/dist/ColumnHeaderGroup.js +0 -11
  10. package/dist/ColumnHeaderGroup.js.map +1 -1
  11. package/dist/ColumnStatistics.js +1 -20
  12. package/dist/ColumnStatistics.js.map +1 -1
  13. package/dist/CrossColumnSearch.js +2 -23
  14. package/dist/CrossColumnSearch.js.map +1 -1
  15. package/dist/FilterInputField.js +2 -36
  16. package/dist/FilterInputField.js.map +1 -1
  17. package/dist/GotoRow.d.ts +1 -1
  18. package/dist/GotoRow.d.ts.map +1 -1
  19. package/dist/GotoRow.js +2 -7
  20. package/dist/GotoRow.js.map +1 -1
  21. package/dist/IrisGrid.d.ts +11 -5
  22. package/dist/IrisGrid.d.ts.map +1 -1
  23. package/dist/IrisGrid.js +77 -519
  24. package/dist/IrisGrid.js.map +1 -1
  25. package/dist/IrisGridBottomBar.d.ts +1 -1
  26. package/dist/IrisGridBottomBar.d.ts.map +1 -1
  27. package/dist/IrisGridBottomBar.js +2 -2
  28. package/dist/IrisGridBottomBar.js.map +1 -1
  29. package/dist/IrisGridCellOverflowModal.js +6 -21
  30. package/dist/IrisGridCellOverflowModal.js.map +1 -1
  31. package/dist/IrisGridCopyHandler.js +3 -50
  32. package/dist/IrisGridCopyHandler.js.map +1 -1
  33. package/dist/IrisGridMetricCalculator.js +2 -12
  34. package/dist/IrisGridMetricCalculator.js.map +1 -1
  35. package/dist/IrisGridModel.js +32 -58
  36. package/dist/IrisGridModel.js.map +1 -1
  37. package/dist/IrisGridModelFactory.js +0 -7
  38. package/dist/IrisGridModelFactory.js.map +1 -1
  39. package/dist/IrisGridModelUpdater.js +0 -4
  40. package/dist/IrisGridModelUpdater.js.map +1 -1
  41. package/dist/IrisGridPartitionSelector.js +0 -23
  42. package/dist/IrisGridPartitionSelector.js.map +1 -1
  43. package/dist/IrisGridProxyModel.js +9 -153
  44. package/dist/IrisGridProxyModel.js.map +1 -1
  45. package/dist/IrisGridRenderer.js +41 -183
  46. package/dist/IrisGridRenderer.js.map +1 -1
  47. package/dist/IrisGridShortcuts.js.map +1 -1
  48. package/dist/IrisGridTableModel.js +7 -86
  49. package/dist/IrisGridTableModel.js.map +1 -1
  50. package/dist/IrisGridTableModelTemplate.js +70 -461
  51. package/dist/IrisGridTableModelTemplate.js.map +1 -1
  52. package/dist/IrisGridTestUtils.js +0 -23
  53. package/dist/IrisGridTestUtils.js.map +1 -1
  54. package/dist/IrisGridTheme.js.map +1 -1
  55. package/dist/IrisGridTreeTableModel.js +3 -42
  56. package/dist/IrisGridTreeTableModel.js.map +1 -1
  57. package/dist/IrisGridUtils.d.ts +8 -2
  58. package/dist/IrisGridUtils.d.ts.map +1 -1
  59. package/dist/IrisGridUtils.js +97 -195
  60. package/dist/IrisGridUtils.js.map +1 -1
  61. package/dist/MissingKeyError.js +0 -7
  62. package/dist/MissingKeyError.js.map +1 -1
  63. package/dist/PartitionSelectorSearch.js +2 -48
  64. package/dist/PartitionSelectorSearch.js.map +1 -1
  65. package/dist/PendingDataBottomBar.d.ts +1 -1
  66. package/dist/PendingDataBottomBar.d.ts.map +1 -1
  67. package/dist/PendingDataBottomBar.js +2 -7
  68. package/dist/PendingDataBottomBar.js.map +1 -1
  69. package/dist/TableViewportUpdater.js +3 -29
  70. package/dist/TableViewportUpdater.js.map +1 -1
  71. package/dist/ToastBottomBar.d.ts +1 -1
  72. package/dist/ToastBottomBar.d.ts.map +1 -1
  73. package/dist/ToastBottomBar.js +2 -4
  74. package/dist/ToastBottomBar.js.map +1 -1
  75. package/dist/TreeTableViewportUpdater.js +0 -21
  76. package/dist/TreeTableViewportUpdater.js.map +1 -1
  77. package/dist/format-context-menus/CustomFormatAction.js +4 -25
  78. package/dist/format-context-menus/CustomFormatAction.js.map +1 -1
  79. package/dist/format-context-menus/DateTimeFormatContextMenu.js +0 -7
  80. package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +1 -1
  81. package/dist/format-context-menus/DecimalFormatContextMenu.js +0 -9
  82. package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -1
  83. package/dist/format-context-menus/FormatContextMenuUtils.js +3 -9
  84. package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -1
  85. package/dist/format-context-menus/IntegerFormatContextMenu.js +0 -8
  86. package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -1
  87. package/dist/format-context-menus/index.js.map +1 -1
  88. package/dist/index.d.ts +3 -3
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +3 -3
  91. package/dist/index.js.map +1 -1
  92. package/dist/key-handlers/ClearFilterKeyHandler.js +0 -8
  93. package/dist/key-handlers/ClearFilterKeyHandler.js.map +1 -1
  94. package/dist/key-handlers/CopyKeyHandler.js +1 -10
  95. package/dist/key-handlers/CopyKeyHandler.js.map +1 -1
  96. package/dist/key-handlers/ReverseKeyHandler.js +0 -11
  97. package/dist/key-handlers/ReverseKeyHandler.js.map +1 -1
  98. package/dist/key-handlers/index.js.map +1 -1
  99. package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js +2 -32
  100. package/dist/mousehandlers/IrisGridCellOverflowMouseHandler.js.map +1 -1
  101. package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js +4 -34
  102. package/dist/mousehandlers/IrisGridColumnSelectMouseHandler.js.map +1 -1
  103. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js +0 -20
  104. package/dist/mousehandlers/IrisGridColumnTooltipMouseHandler.js.map +1 -1
  105. package/dist/mousehandlers/IrisGridContextMenuHandler.js +15 -105
  106. package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
  107. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js +0 -9
  108. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js.map +1 -1
  109. package/dist/mousehandlers/IrisGridFilterMouseHandler.js +0 -17
  110. package/dist/mousehandlers/IrisGridFilterMouseHandler.js.map +1 -1
  111. package/dist/mousehandlers/IrisGridSortMouseHandler.js +2 -15
  112. package/dist/mousehandlers/IrisGridSortMouseHandler.js.map +1 -1
  113. package/dist/mousehandlers/PendingMouseHandler.js +0 -6
  114. package/dist/mousehandlers/PendingMouseHandler.js.map +1 -1
  115. package/dist/mousehandlers/index.js.map +1 -1
  116. package/dist/sidebar/AdvancedSettings.js.map +1 -1
  117. package/dist/sidebar/AdvancedSettingsMenu.d.ts +4 -4
  118. package/dist/sidebar/AdvancedSettingsMenu.d.ts.map +1 -1
  119. package/dist/sidebar/AdvancedSettingsMenu.js +2 -6
  120. package/dist/sidebar/AdvancedSettingsMenu.js.map +1 -1
  121. package/dist/sidebar/AdvancedSettingsType.js +0 -2
  122. package/dist/sidebar/AdvancedSettingsType.js.map +1 -1
  123. package/dist/sidebar/ChartBuilder.js +2 -46
  124. package/dist/sidebar/ChartBuilder.js.map +1 -1
  125. package/dist/sidebar/CustomColumnBuilder.js +6 -58
  126. package/dist/sidebar/CustomColumnBuilder.js.map +1 -1
  127. package/dist/sidebar/CustomColumnInput.js +4 -15
  128. package/dist/sidebar/CustomColumnInput.js.map +1 -1
  129. package/dist/sidebar/InputEditor.js +5 -36
  130. package/dist/sidebar/InputEditor.js.map +1 -1
  131. package/dist/sidebar/OptionType.js +0 -2
  132. package/dist/sidebar/OptionType.js.map +1 -1
  133. package/dist/sidebar/RollupRows.js +9 -65
  134. package/dist/sidebar/RollupRows.js.map +1 -1
  135. package/dist/sidebar/SelectDistinctBuilder.js +0 -13
  136. package/dist/sidebar/SelectDistinctBuilder.js.map +1 -1
  137. package/dist/sidebar/TableCsvExporter.js +0 -52
  138. package/dist/sidebar/TableCsvExporter.js.map +1 -1
  139. package/dist/sidebar/TableSaver.js +10 -123
  140. package/dist/sidebar/TableSaver.js.map +1 -1
  141. package/dist/sidebar/VisibilityOrderingBuilder.js +37 -116
  142. package/dist/sidebar/VisibilityOrderingBuilder.js.map +1 -1
  143. package/dist/sidebar/aggregations/AggregationEdit.d.ts +1 -1
  144. package/dist/sidebar/aggregations/AggregationEdit.d.ts.map +1 -1
  145. package/dist/sidebar/aggregations/AggregationEdit.js +2 -14
  146. package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -1
  147. package/dist/sidebar/aggregations/AggregationOperation.js +0 -2
  148. package/dist/sidebar/aggregations/AggregationOperation.js.map +1 -1
  149. package/dist/sidebar/aggregations/AggregationUtils.js +2 -5
  150. package/dist/sidebar/aggregations/AggregationUtils.js.map +1 -1
  151. package/dist/sidebar/aggregations/Aggregations.d.ts +1 -1
  152. package/dist/sidebar/aggregations/Aggregations.d.ts.map +1 -1
  153. package/dist/sidebar/aggregations/Aggregations.js +2 -12
  154. package/dist/sidebar/aggregations/Aggregations.js.map +1 -1
  155. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.d.ts +1 -1
  156. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.d.ts.map +1 -1
  157. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js +2 -16
  158. package/dist/sidebar/conditional-formatting/ColumnFormatEditor.js.map +1 -1
  159. package/dist/sidebar/conditional-formatting/ConditionEditor.d.ts +1 -1
  160. package/dist/sidebar/conditional-formatting/ConditionEditor.d.ts.map +1 -1
  161. package/dist/sidebar/conditional-formatting/ConditionEditor.js +2 -35
  162. package/dist/sidebar/conditional-formatting/ConditionEditor.js.map +1 -1
  163. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.d.ts +1 -1
  164. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.d.ts.map +1 -1
  165. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js +2 -12
  166. package/dist/sidebar/conditional-formatting/ConditionalFormatEditor.js.map +1 -1
  167. package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js +0 -3
  168. package/dist/sidebar/conditional-formatting/ConditionalFormattingAPIUtils.js.map +1 -1
  169. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.d.ts +1 -1
  170. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.d.ts.map +1 -1
  171. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js +16 -26
  172. package/dist/sidebar/conditional-formatting/ConditionalFormattingMenu.js.map +1 -1
  173. package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js +9 -172
  174. package/dist/sidebar/conditional-formatting/ConditionalFormattingUtils.js.map +1 -1
  175. package/dist/sidebar/conditional-formatting/RowFormatEditor.d.ts +1 -1
  176. package/dist/sidebar/conditional-formatting/RowFormatEditor.d.ts.map +1 -1
  177. package/dist/sidebar/conditional-formatting/RowFormatEditor.js +2 -16
  178. package/dist/sidebar/conditional-formatting/RowFormatEditor.js.map +1 -1
  179. package/dist/sidebar/conditional-formatting/StyleEditor.d.ts +1 -1
  180. package/dist/sidebar/conditional-formatting/StyleEditor.d.ts.map +1 -1
  181. package/dist/sidebar/conditional-formatting/StyleEditor.js +2 -12
  182. package/dist/sidebar/conditional-formatting/StyleEditor.js.map +1 -1
  183. package/dist/sidebar/icons/BarIcon.js +0 -3
  184. package/dist/sidebar/icons/BarIcon.js.map +1 -1
  185. package/dist/sidebar/icons/FormatColumnWhereIcon.js +2 -5
  186. package/dist/sidebar/icons/FormatColumnWhereIcon.js.map +1 -1
  187. package/dist/sidebar/icons/FormatRowWhereIcon.js +2 -5
  188. package/dist/sidebar/icons/FormatRowWhereIcon.js.map +1 -1
  189. package/dist/sidebar/icons/HistogramIcon.js +0 -3
  190. package/dist/sidebar/icons/HistogramIcon.js.map +1 -1
  191. package/dist/sidebar/icons/LineIcon.js +0 -3
  192. package/dist/sidebar/icons/LineIcon.js.map +1 -1
  193. package/dist/sidebar/icons/PieIcon.js +0 -3
  194. package/dist/sidebar/icons/PieIcon.js.map +1 -1
  195. package/dist/sidebar/icons/ScatterIcon.js +0 -3
  196. package/dist/sidebar/icons/ScatterIcon.js.map +1 -1
  197. package/dist/sidebar/icons/index.js.map +1 -1
  198. package/dist/sidebar/index.js.map +1 -1
  199. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"TableViewportUpdater.js","names":["PureComponent","memoize","throttle","GridUtils","Log","log","module","UPDATE_THROTTLE","TableViewportUpdater","table","top","bottom","viewHeight","viewportTop","Math","max","ROW_BUFFER_PAGES","viewportBottom","left","right","movedColumns","viewWidth","viewportLeft","COLUMN_BUFFER_PAGES","viewportRight","min","columns","length","i","modelIndex","getModelIndex","push","viewColumns","error","debug2","props","getViewportRowRange","getViewportColumns","subscription","setViewport","onSubscription","componentDidMount","filters","sorts","customColumns","applyFilter","applySort","applyCustomColumns","updateViewport","componentDidUpdate","prevProps","isFilterChanged","isSortChanged","isCustomColumnsChanged","isTableChanged","closeSubscription","debug","componentWillUnmount","close","undefined","cancel","render"],"sources":["../src/TableViewportUpdater.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport memoize from 'memoize-one';\nimport throttle from 'lodash.throttle';\nimport { GridUtils, MoveOperation } from '@deephaven/grid';\nimport {\n Column,\n FilterCondition,\n Sort,\n Table,\n TableViewportSubscription,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { ColumnName } from './CommonTypes';\n\nconst log = Log.module('TableViewportUpdater');\n\nconst UPDATE_THROTTLE = 150;\n\n/**\n * Updates the viewport for an Iris table, for use in a scroll pane.\n * Automatically throttles the viewport requests and buffers above and below.\n */\n\ninterface TableViewportUpdaterProps {\n table: Table;\n top: number;\n bottom: number;\n left: number;\n right: number;\n columns: Column[];\n filters: FilterCondition[];\n sorts: Sort[];\n customColumns: ColumnName[];\n movedColumns: MoveOperation[];\n onSubscription: (subscription?: TableViewportSubscription) => void;\n}\n\nclass TableViewportUpdater extends PureComponent<\n TableViewportUpdaterProps,\n Record<string, never>\n> {\n // Number of pages to buffer for rows/columns\n static ROW_BUFFER_PAGES = 3;\n\n static COLUMN_BUFFER_PAGES = 1;\n\n static defaultProps = {\n top: 0,\n bottom: 0,\n left: null,\n right: null,\n columns: null,\n onSubscription: (): void => undefined,\n filters: [],\n sorts: [],\n customColumns: [],\n movedColumns: [],\n };\n\n componentDidMount(): void {\n const {\n top,\n bottom,\n left,\n right,\n table,\n filters,\n sorts,\n columns,\n customColumns,\n } = this.props;\n table.applyFilter(filters);\n table.applySort(sorts);\n table.applyCustomColumns(customColumns);\n this.updateViewport(top, bottom, left, right, columns);\n }\n\n componentDidUpdate(prevProps: TableViewportUpdaterProps): void {\n const {\n top,\n bottom,\n left,\n right,\n table,\n filters,\n sorts,\n customColumns,\n columns,\n } = this.props;\n const isFilterChanged = filters !== prevProps.filters;\n const isSortChanged = sorts !== prevProps.sorts;\n const isCustomColumnsChanged = customColumns !== prevProps.customColumns;\n const isTableChanged = table !== prevProps.table;\n if (\n isFilterChanged ||\n isSortChanged ||\n isCustomColumnsChanged ||\n isTableChanged\n ) {\n this.closeSubscription();\n }\n\n if (isFilterChanged || isTableChanged) {\n log.debug('update table filter', filters);\n table.applyFilter(filters);\n }\n\n if (isSortChanged || isTableChanged) {\n log.debug('update table sort', sorts);\n table.applySort(sorts);\n }\n\n if (isCustomColumnsChanged || isTableChanged) {\n log.debug('update table custom columns', customColumns);\n table.applyCustomColumns(customColumns);\n }\n\n this.updateViewport(top, bottom, left, right, columns);\n }\n\n componentWillUnmount(): void {\n this.closeSubscription();\n }\n\n subscription?: TableViewportSubscription;\n\n // eslint-disable-next-line class-methods-use-this\n getViewportRowRange = memoize((table: Table, top: number, bottom: number) => {\n const viewHeight = bottom - top;\n const viewportTop = Math.max(\n 0,\n top - viewHeight * TableViewportUpdater.ROW_BUFFER_PAGES\n );\n const viewportBottom =\n bottom + viewHeight * TableViewportUpdater.ROW_BUFFER_PAGES;\n return [viewportTop, viewportBottom];\n });\n\n // eslint-disable-next-line class-methods-use-this\n getViewportColumns = memoize(\n (\n table: Table,\n left: number,\n right: number,\n movedColumns: MoveOperation[]\n ) => {\n if (left == null || right == null) {\n return null;\n }\n\n const viewWidth = right - left;\n const viewportLeft = Math.max(\n 0,\n left - viewWidth * TableViewportUpdater.COLUMN_BUFFER_PAGES\n );\n const viewportRight = Math.min(\n right + viewWidth * TableViewportUpdater.COLUMN_BUFFER_PAGES,\n table.columns.length - 1\n );\n\n // Need to get all the columns from the table model now\n const columns = [];\n for (let i = viewportLeft; i <= viewportRight; i += 1) {\n const modelIndex = GridUtils.getModelIndex(i, movedColumns);\n columns.push(table.columns[modelIndex]);\n }\n\n return columns;\n }\n );\n\n closeSubscription(): void {\n log.debug2('closeSubscription', this.subscription);\n if (this.subscription) {\n this.subscription.close();\n this.subscription = undefined;\n\n const { onSubscription } = this.props;\n onSubscription();\n }\n\n this.updateViewport.cancel();\n }\n\n updateViewport = throttle(\n (\n top: number,\n bottom: number,\n left: number,\n right: number,\n viewColumns: Column[]\n ): void => {\n if (bottom < top) {\n log.error('Invalid viewport', top, bottom);\n return;\n }\n\n if (top === 0 && bottom === 0) {\n log.debug2('Ignoring 0-0 viewport');\n return;\n }\n\n const { movedColumns, table } = this.props;\n const [viewportTop, viewportBottom] = this.getViewportRowRange(\n table,\n top,\n bottom\n );\n const columns =\n viewColumns ??\n this.getViewportColumns(table, left, right, movedColumns);\n log.debug2(\n 'Setting Viewport Top:',\n viewportTop,\n 'Bottom:',\n viewportBottom,\n 'Columns:',\n columns\n );\n if (this.subscription == null) {\n log.debug2('updateViewport creating new subscription');\n this.subscription = table.setViewport(\n viewportTop,\n viewportBottom,\n columns\n );\n\n const { onSubscription } = this.props;\n onSubscription(this.subscription);\n } else {\n log.debug2('updateViewport using existing subscription');\n this.subscription.setViewport(viewportTop, viewportBottom, columns);\n }\n },\n UPDATE_THROTTLE\n );\n\n render(): null {\n return null;\n }\n}\n\nexport default TableViewportUpdater;\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,OAA9B;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,SAASC,SAAT,QAAyC,iBAAzC;AAQA,OAAOC,GAAP,MAAgB,gBAAhB;AAGA,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAAJ,CAAW,sBAAX,CAAZ;AAEA,IAAMC,eAAe,GAAG,GAAxB;AAEA;AACA;AACA;AACA;;AAgBA,MAAMC,oBAAN,SAAmCR,aAAnC,CAGE;EAAA;IAAA;;IAAA;;IAAA,6CAuFsBC,OAAO,CAAC,CAACQ,KAAD,EAAeC,GAAf,EAA4BC,MAA5B,KAA+C;MAC3E,IAAMC,UAAU,GAAGD,MAAM,GAAGD,GAA5B;MACA,IAAMG,WAAW,GAAGC,IAAI,CAACC,GAAL,CAClB,CADkB,EAElBL,GAAG,GAAGE,UAAU,GAAGJ,oBAAoB,CAACQ,gBAFtB,CAApB;MAIA,IAAMC,cAAc,GAClBN,MAAM,GAAGC,UAAU,GAAGJ,oBAAoB,CAACQ,gBAD7C;MAEA,OAAO,CAACH,WAAD,EAAcI,cAAd,CAAP;IACD,CAT4B,CAvF7B;;IAAA,4CAmGqBhB,OAAO,CAC1B,CACEQ,KADF,EAEES,IAFF,EAGEC,KAHF,EAIEC,YAJF,KAKK;MACH,IAAIF,IAAI,IAAI,IAAR,IAAgBC,KAAK,IAAI,IAA7B,EAAmC;QACjC,OAAO,IAAP;MACD;;MAED,IAAME,SAAS,GAAGF,KAAK,GAAGD,IAA1B;MACA,IAAMI,YAAY,GAAGR,IAAI,CAACC,GAAL,CACnB,CADmB,EAEnBG,IAAI,GAAGG,SAAS,GAAGb,oBAAoB,CAACe,mBAFrB,CAArB;MAIA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AAM,EAAE,CAFY;EAGpBO,IAAI,EAAE,IAHc;EAIpBC,KAAK,EAAE,IAJa;EAKpBO,OAAO,EAAE,IALW;EAMpBc,cAAc,EAAE,MAAYmB,SANR;EAOpBjB,OAAO,EAAE,EAPW;EAQpBC,KAAK,EAAE,EARa;EASpBC,aAAa,EAAE,EATK;EAUpBxB,YAAY,EAAE;AAVM,C;;AAoMxB,eAAeZ,oBAAf"}
1
+ {"version":3,"file":"TableViewportUpdater.js","names":["PureComponent","memoize","throttle","GridUtils","Log","log","module","UPDATE_THROTTLE","TableViewportUpdater","table","top","bottom","viewHeight","viewportTop","Math","max","ROW_BUFFER_PAGES","viewportBottom","left","right","movedColumns","viewWidth","viewportLeft","COLUMN_BUFFER_PAGES","viewportRight","min","columns","length","i","modelIndex","getModelIndex","push","viewColumns","error","debug2","props","getViewportRowRange","getViewportColumns","subscription","setViewport","onSubscription","componentDidMount","filters","sorts","customColumns","applyFilter","applySort","applyCustomColumns","updateViewport","componentDidUpdate","prevProps","isFilterChanged","isSortChanged","isCustomColumnsChanged","isTableChanged","closeSubscription","debug","componentWillUnmount","close","undefined","cancel","render"],"sources":["../src/TableViewportUpdater.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport memoize from 'memoize-one';\nimport throttle from 'lodash.throttle';\nimport { GridUtils, MoveOperation } from '@deephaven/grid';\nimport {\n Column,\n FilterCondition,\n Sort,\n Table,\n TableViewportSubscription,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { ColumnName } from './CommonTypes';\n\nconst log = Log.module('TableViewportUpdater');\n\nconst UPDATE_THROTTLE = 150;\n\n/**\n * Updates the viewport for an Iris table, for use in a scroll pane.\n * Automatically throttles the viewport requests and buffers above and below.\n */\n\ninterface TableViewportUpdaterProps {\n table: Table;\n top: number;\n bottom: number;\n left: number;\n right: number;\n columns: Column[];\n filters: FilterCondition[];\n sorts: Sort[];\n customColumns: ColumnName[];\n movedColumns: MoveOperation[];\n onSubscription: (subscription?: TableViewportSubscription) => void;\n}\n\nclass TableViewportUpdater extends PureComponent<\n TableViewportUpdaterProps,\n Record<string, never>\n> {\n // Number of pages to buffer for rows/columns\n static ROW_BUFFER_PAGES = 3;\n\n static COLUMN_BUFFER_PAGES = 1;\n\n static defaultProps = {\n top: 0,\n bottom: 0,\n left: null,\n right: null,\n columns: null,\n onSubscription: (): void => undefined,\n filters: [],\n sorts: [],\n customColumns: [],\n movedColumns: [],\n };\n\n componentDidMount(): void {\n const {\n top,\n bottom,\n left,\n right,\n table,\n filters,\n sorts,\n columns,\n customColumns,\n } = this.props;\n table.applyFilter(filters);\n table.applySort(sorts);\n table.applyCustomColumns(customColumns);\n this.updateViewport(top, bottom, left, right, columns);\n }\n\n componentDidUpdate(prevProps: TableViewportUpdaterProps): void {\n const {\n top,\n bottom,\n left,\n right,\n table,\n filters,\n sorts,\n customColumns,\n columns,\n } = this.props;\n const isFilterChanged = filters !== prevProps.filters;\n const isSortChanged = sorts !== prevProps.sorts;\n const isCustomColumnsChanged = customColumns !== prevProps.customColumns;\n const isTableChanged = table !== prevProps.table;\n if (\n isFilterChanged ||\n isSortChanged ||\n isCustomColumnsChanged ||\n isTableChanged\n ) {\n this.closeSubscription();\n }\n\n if (isFilterChanged || isTableChanged) {\n log.debug('update table filter', filters);\n table.applyFilter(filters);\n }\n\n if (isSortChanged || isTableChanged) {\n log.debug('update table sort', sorts);\n table.applySort(sorts);\n }\n\n if (isCustomColumnsChanged || isTableChanged) {\n log.debug('update table custom columns', customColumns);\n table.applyCustomColumns(customColumns);\n }\n\n this.updateViewport(top, bottom, left, right, columns);\n }\n\n componentWillUnmount(): void {\n this.closeSubscription();\n }\n\n subscription?: TableViewportSubscription;\n\n // eslint-disable-next-line class-methods-use-this\n getViewportRowRange = memoize((table: Table, top: number, bottom: number) => {\n const viewHeight = bottom - top;\n const viewportTop = Math.max(\n 0,\n top - viewHeight * TableViewportUpdater.ROW_BUFFER_PAGES\n );\n const viewportBottom =\n bottom + viewHeight * TableViewportUpdater.ROW_BUFFER_PAGES;\n return [viewportTop, viewportBottom];\n });\n\n // eslint-disable-next-line class-methods-use-this\n getViewportColumns = memoize(\n (\n table: Table,\n left: number,\n right: number,\n movedColumns: MoveOperation[]\n ) => {\n if (left == null || right == null) {\n return null;\n }\n\n const viewWidth = right - left;\n const viewportLeft = Math.max(\n 0,\n left - viewWidth * TableViewportUpdater.COLUMN_BUFFER_PAGES\n );\n const viewportRight = Math.min(\n right + viewWidth * TableViewportUpdater.COLUMN_BUFFER_PAGES,\n table.columns.length - 1\n );\n\n // Need to get all the columns from the table model now\n const columns = [];\n for (let i = viewportLeft; i <= viewportRight; i += 1) {\n const modelIndex = GridUtils.getModelIndex(i, movedColumns);\n columns.push(table.columns[modelIndex]);\n }\n\n return columns;\n }\n );\n\n closeSubscription(): void {\n log.debug2('closeSubscription', this.subscription);\n if (this.subscription) {\n this.subscription.close();\n this.subscription = undefined;\n\n const { onSubscription } = this.props;\n onSubscription();\n }\n\n this.updateViewport.cancel();\n }\n\n updateViewport = throttle(\n (\n top: number,\n bottom: number,\n left: number,\n right: number,\n viewColumns: Column[]\n ): void => {\n if (bottom < top) {\n log.error('Invalid viewport', top, bottom);\n return;\n }\n\n if (top === 0 && bottom === 0) {\n log.debug2('Ignoring 0-0 viewport');\n return;\n }\n\n const { movedColumns, table } = this.props;\n const [viewportTop, viewportBottom] = this.getViewportRowRange(\n table,\n top,\n bottom\n );\n const columns =\n viewColumns ??\n this.getViewportColumns(table, left, right, movedColumns);\n log.debug2(\n 'Setting Viewport Top:',\n viewportTop,\n 'Bottom:',\n viewportBottom,\n 'Columns:',\n columns\n );\n if (this.subscription == null) {\n log.debug2('updateViewport creating new subscription');\n this.subscription = table.setViewport(\n viewportTop,\n viewportBottom,\n columns\n );\n\n const { onSubscription } = this.props;\n onSubscription(this.subscription);\n } else {\n log.debug2('updateViewport using existing subscription');\n this.subscription.setViewport(viewportTop, viewportBottom, columns);\n }\n },\n UPDATE_THROTTLE\n );\n\n render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AAAA,gBAP1BA,oBAAoB,kBASF;EACpBE,GAAG,EAAE,CAAC;EACNC,MAAM,EAAE,CAAC;EACTO,IAAI,EAAE,IAAI;EACVC,KAAK,EAAE,IAAI;EACXO,OAAO,EAAE,IAAI;EACbc,cAAc,EAAE,MAAYmB,SAAS;EACrCjB,OAAO,EAAE,EAAE;EACXC,KAAK,EAAE,EAAE;EACTC,aAAa,EAAE,EAAE;EACjBxB,YAAY,EAAE;AAChB,CAAC;AAyLH,eAAeZ,oBAAoB"}
@@ -7,6 +7,6 @@ export declare type ToastBottomBarProps = {
7
7
  onExiting?: () => void;
8
8
  onExited?: () => void;
9
9
  };
10
- export declare const ToastBottomBar: ({ children, onEntering, onEntered, onExiting, onExited, }: ToastBottomBarProps) => JSX.Element;
10
+ export declare function ToastBottomBar({ children, onEntering, onEntered, onExiting, onExited, }: ToastBottomBarProps): JSX.Element;
11
11
  export default ToastBottomBar;
12
12
  //# sourceMappingURL=ToastBottomBar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToastBottomBar.d.ts","sourceRoot":"","sources":["../src/ToastBottomBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,6BAA6B,CAAC;AAIrC,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,cAAc,8DAMxB,mBAAmB,KAAG,WAsCxB,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"ToastBottomBar.d.ts","sourceRoot":"","sources":["../src/ToastBottomBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAGxE,OAAO,6BAA6B,CAAC;AAIrC,oBAAY,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC7B,QAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,GACT,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAsCnC;AAED,eAAe,cAAc,CAAC"}
@@ -3,7 +3,7 @@ import { usePrevious } from '@deephaven/react-hooks';
3
3
  import IrisGridBottomBar from "./IrisGridBottomBar.js";
4
4
  import "./PendingDataBottomBar.css";
5
5
  var HIDE_TIMEOUT = 3000;
6
- export var ToastBottomBar = _ref => {
6
+ export function ToastBottomBar(_ref) {
7
7
  var {
8
8
  children = null,
9
9
  onEntering,
@@ -16,11 +16,9 @@ export var ToastBottomBar = _ref => {
16
16
  var prevChildren = usePrevious(children);
17
17
  var startTimer = useCallback(() => {
18
18
  setIsShown(true);
19
-
20
19
  if (timeout.current) {
21
20
  clearTimeout(timeout.current);
22
21
  }
23
-
24
22
  timeout.current = setTimeout(() => {
25
23
  setIsShown(false);
26
24
  }, HIDE_TIMEOUT);
@@ -39,6 +37,6 @@ export var ToastBottomBar = _ref => {
39
37
  onExiting: onExiting,
40
38
  onExited: onExited
41
39
  }, children);
42
- };
40
+ }
43
41
  export default ToastBottomBar;
44
42
  //# sourceMappingURL=ToastBottomBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToastBottomBar.js","names":["React","useCallback","useEffect","useRef","useState","usePrevious","IrisGridBottomBar","HIDE_TIMEOUT","ToastBottomBar","children","onEntering","onEntered","onExiting","onExited","isShown","setIsShown","timeout","prevChildren","startTimer","current","clearTimeout","setTimeout","undefined"],"sources":["../src/ToastBottomBar.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport IrisGridBottomBar from './IrisGridBottomBar';\nimport './PendingDataBottomBar.scss';\n\nconst HIDE_TIMEOUT = 3000;\n\nexport type ToastBottomBarProps = {\n children?: React.ReactNode;\n onEntering?: () => void;\n onEntered?: () => void;\n onExiting?: () => void;\n onExited?: () => void;\n};\n\nexport const ToastBottomBar = ({\n children = null,\n onEntering,\n onEntered,\n onExiting,\n onExited,\n}: ToastBottomBarProps): JSX.Element => {\n const [isShown, setIsShown] = useState(false);\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n const prevChildren = usePrevious(children);\n\n const startTimer = useCallback(() => {\n setIsShown(true);\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = setTimeout(() => {\n setIsShown(false);\n }, HIDE_TIMEOUT);\n }, [setIsShown, timeout]);\n\n useEffect(() => {\n if (prevChildren !== children && children != null) {\n startTimer();\n }\n }, [children, prevChildren, setIsShown, startTimer]);\n\n useEffect(\n () => () => (timeout.current ? clearTimeout(timeout.current) : undefined),\n []\n );\n\n return (\n <IrisGridBottomBar\n className=\"toast-bottom-bar\"\n isShown={isShown}\n onEntering={onEntering}\n onEntered={onEntered}\n onExiting={onExiting}\n onExited={onExited}\n >\n {children}\n </IrisGridBottomBar>\n );\n};\n\nexport default ToastBottomBar;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,SAA7B,EAAwCC,MAAxC,EAAgDC,QAAhD,QAAgE,OAAhE;AACA,SAASC,WAAT,QAA4B,wBAA5B;OACOC,iB;;AAGP,IAAMC,YAAY,GAAG,IAArB;AAUA,OAAO,IAAMC,cAAc,GAAG,QAMU;EAAA,IANT;IAC7BC,QAAQ,GAAG,IADkB;IAE7BC,UAF6B;IAG7BC,SAH6B;IAI7BC,SAJ6B;IAK7BC;EAL6B,CAMS;EACtC,IAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBX,QAAQ,CAAC,KAAD,CAAtC;EACA,IAAMY,OAAO,GAAGb,MAAM,EAAtB;EACA,IAAMc,YAAY,GAAGZ,WAAW,CAACI,QAAD,CAAhC;EAEA,IAAMS,UAAU,GAAGjB,WAAW,CAAC,MAAM;IACnCc,UAAU,CAAC,IAAD,CAAV;;IACA,IAAIC,OAAO,CAACG,OAAZ,EAAqB;MACnBC,YAAY,CAACJ,OAAO,CAACG,OAAT,CAAZ;IACD;;IACDH,OAAO,CAACG,OAAR,GAAkBE,UAAU,CAAC,MAAM;MACjCN,UAAU,CAAC,KAAD,CAAV;IACD,CAF2B,EAEzBR,YAFyB,CAA5B;EAGD,CAR6B,EAQ3B,CAACQ,UAAD,EAAaC,OAAb,CAR2B,CAA9B;EAUAd,SAAS,CAAC,MAAM;IACd,IAAIe,YAAY,KAAKR,QAAjB,IAA6BA,QAAQ,IAAI,IAA7C,EAAmD;MACjDS,UAAU;IACX;EACF,CAJQ,EAIN,CAACT,QAAD,EAAWQ,YAAX,EAAyBF,UAAzB,EAAqCG,UAArC,CAJM,CAAT;EAMAhB,SAAS,CACP,MAAM,MAAOc,OAAO,CAACG,OAAR,GAAkBC,YAAY,CAACJ,OAAO,CAACG,OAAT,CAA9B,GAAkDG,SADxD,EAEP,EAFO,CAAT;EAKA,oBACE,oBAAC,iBAAD;IACE,SAAS,EAAC,kBADZ;IAEE,OAAO,EAAER,OAFX;IAGE,UAAU,EAAEJ,UAHd;IAIE,SAAS,EAAEC,SAJb;IAKE,SAAS,EAAEC,SALb;IAME,QAAQ,EAAEC;EANZ,GAQGJ,QARH,CADF;AAYD,CA5CM;AA8CP,eAAeD,cAAf"}
1
+ {"version":3,"file":"ToastBottomBar.js","names":["React","useCallback","useEffect","useRef","useState","usePrevious","IrisGridBottomBar","HIDE_TIMEOUT","ToastBottomBar","children","onEntering","onEntered","onExiting","onExited","isShown","setIsShown","timeout","prevChildren","startTimer","current","clearTimeout","setTimeout","undefined"],"sources":["../src/ToastBottomBar.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { usePrevious } from '@deephaven/react-hooks';\nimport IrisGridBottomBar from './IrisGridBottomBar';\nimport './PendingDataBottomBar.scss';\n\nconst HIDE_TIMEOUT = 3000;\n\nexport type ToastBottomBarProps = {\n children?: React.ReactNode;\n onEntering?: () => void;\n onEntered?: () => void;\n onExiting?: () => void;\n onExited?: () => void;\n};\n\nexport function ToastBottomBar({\n children = null,\n onEntering,\n onEntered,\n onExiting,\n onExited,\n}: ToastBottomBarProps): JSX.Element {\n const [isShown, setIsShown] = useState(false);\n const timeout = useRef<ReturnType<typeof setTimeout>>();\n const prevChildren = usePrevious(children);\n\n const startTimer = useCallback(() => {\n setIsShown(true);\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = setTimeout(() => {\n setIsShown(false);\n }, HIDE_TIMEOUT);\n }, [setIsShown, timeout]);\n\n useEffect(() => {\n if (prevChildren !== children && children != null) {\n startTimer();\n }\n }, [children, prevChildren, setIsShown, startTimer]);\n\n useEffect(\n () => () => (timeout.current ? clearTimeout(timeout.current) : undefined),\n []\n );\n\n return (\n <IrisGridBottomBar\n className=\"toast-bottom-bar\"\n isShown={isShown}\n onEntering={onEntering}\n onEntered={onEntered}\n onExiting={onExiting}\n onExited={onExited}\n >\n {children}\n </IrisGridBottomBar>\n );\n}\n\nexport default ToastBottomBar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SAASC,WAAW,QAAQ,wBAAwB;AAAC,OAC9CC,iBAAiB;AAAA;AAGxB,IAAMC,YAAY,GAAG,IAAI;AAUzB,OAAO,SAASC,cAAc,OAMO;EAAA,IANN;IAC7BC,QAAQ,GAAG,IAAI;IACfC,UAAU;IACVC,SAAS;IACTC,SAAS;IACTC;EACmB,CAAC;EACpB,IAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGX,QAAQ,CAAC,KAAK,CAAC;EAC7C,IAAMY,OAAO,GAAGb,MAAM,EAAiC;EACvD,IAAMc,YAAY,GAAGZ,WAAW,CAACI,QAAQ,CAAC;EAE1C,IAAMS,UAAU,GAAGjB,WAAW,CAAC,MAAM;IACnCc,UAAU,CAAC,IAAI,CAAC;IAChB,IAAIC,OAAO,CAACG,OAAO,EAAE;MACnBC,YAAY,CAACJ,OAAO,CAACG,OAAO,CAAC;IAC/B;IACAH,OAAO,CAACG,OAAO,GAAGE,UAAU,CAAC,MAAM;MACjCN,UAAU,CAAC,KAAK,CAAC;IACnB,CAAC,EAAER,YAAY,CAAC;EAClB,CAAC,EAAE,CAACQ,UAAU,EAAEC,OAAO,CAAC,CAAC;EAEzBd,SAAS,CAAC,MAAM;IACd,IAAIe,YAAY,KAAKR,QAAQ,IAAIA,QAAQ,IAAI,IAAI,EAAE;MACjDS,UAAU,EAAE;IACd;EACF,CAAC,EAAE,CAACT,QAAQ,EAAEQ,YAAY,EAAEF,UAAU,EAAEG,UAAU,CAAC,CAAC;EAEpDhB,SAAS,CACP,MAAM,MAAOc,OAAO,CAACG,OAAO,GAAGC,YAAY,CAACJ,OAAO,CAACG,OAAO,CAAC,GAAGG,SAAU,EACzE,EAAE,CACH;EAED,oBACE,oBAAC,iBAAiB;IAChB,SAAS,EAAC,kBAAkB;IAC5B,OAAO,EAAER,OAAQ;IACjB,UAAU,EAAEJ,UAAW;IACvB,SAAS,EAAEC,SAAU;IACrB,SAAS,EAAEC,SAAU;IACrB,QAAQ,EAAEC;EAAS,GAElBJ,QAAQ,CACS;AAExB;AAEA,eAAeD,cAAc"}
@@ -1,12 +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
  import { PureComponent } from 'react';
4
3
  import throttle from 'lodash.throttle';
5
4
  import dh from '@deephaven/jsapi-shim';
6
5
  import Log from '@deephaven/log';
7
6
  var log = Log.module('TreeTableViewportUpdater');
8
7
  var UPDATE_THROTTLE = 150;
9
-
10
8
  /**
11
9
  * Updates the viewport of a TreeTable for use in a scroll pane.
12
10
  * Automatically throttles the viewport requests and buffers above and below.
@@ -14,20 +12,16 @@ var UPDATE_THROTTLE = 150;
14
12
  class TreeTableViewportUpdater extends PureComponent {
15
13
  constructor(props) {
16
14
  super(props);
17
-
18
15
  _defineProperty(this, "listenerCleanup", void 0);
19
-
20
16
  _defineProperty(this, "updateViewport", throttle((top, bottom) => {
21
17
  if (bottom < top) {
22
18
  log.error('Invalid viewport', top, bottom);
23
19
  return;
24
20
  }
25
-
26
21
  if (top === 0 && bottom === 0) {
27
22
  log.debug2('Ignoring 0-0 viewport');
28
23
  return;
29
24
  }
30
-
31
25
  var {
32
26
  table,
33
27
  updateInterval
@@ -36,20 +30,16 @@ class TreeTableViewportUpdater extends PureComponent {
36
30
  var viewportTop = Math.max(0, top - viewSize * 3);
37
31
  var viewportBottom = bottom + viewSize * 3 + 1;
38
32
  log.debug2('Setting Viewport Top:', viewportTop, 'Bottom:', viewportBottom, table);
39
-
40
33
  if (!this.listenerCleanup) {
41
34
  var {
42
35
  onViewportUpdate
43
36
  } = this.props;
44
37
  this.listenerCleanup = table.addEventListener(dh.TreeTable.EVENT_UPDATED, onViewportUpdate);
45
38
  }
46
-
47
39
  table.setViewport(viewportTop, viewportBottom, undefined, updateInterval);
48
40
  }, UPDATE_THROTTLE));
49
-
50
41
  this.listenerCleanup = null;
51
42
  }
52
-
53
43
  componentDidMount() {
54
44
  var {
55
45
  top,
@@ -63,7 +53,6 @@ class TreeTableViewportUpdater extends PureComponent {
63
53
  table.applySort(sorts);
64
54
  this.updateViewport(top, bottom);
65
55
  }
66
-
67
56
  componentDidUpdate(prevProps) {
68
57
  var {
69
58
  top,
@@ -72,36 +61,27 @@ class TreeTableViewportUpdater extends PureComponent {
72
61
  filters,
73
62
  sorts
74
63
  } = this.props;
75
-
76
64
  if (filters !== prevProps.filters) {
77
65
  log.debug('update table filter', filters);
78
66
  table.applyFilter(filters);
79
67
  }
80
-
81
68
  if (sorts !== prevProps.sorts) {
82
69
  log.debug('update table sort', sorts);
83
70
  table.applySort(sorts);
84
71
  }
85
-
86
72
  this.updateViewport(top, bottom);
87
73
  }
88
-
89
74
  componentWillUnmount() {
90
75
  this.updateViewport.cancel();
91
-
92
76
  if (this.listenerCleanup) {
93
77
  this.listenerCleanup();
94
78
  }
95
79
  }
96
-
97
80
  render() {
98
81
  return null;
99
82
  }
100
-
101
83
  }
102
-
103
84
  _defineProperty(TreeTableViewportUpdater, "UPDATE_INTERVAL", 1000);
104
-
105
85
  _defineProperty(TreeTableViewportUpdater, "defaultProps", {
106
86
  top: 0,
107
87
  bottom: 0,
@@ -110,6 +90,5 @@ _defineProperty(TreeTableViewportUpdater, "defaultProps", {
110
90
  sorts: [],
111
91
  updateInterval: TreeTableViewportUpdater.UPDATE_INTERVAL
112
92
  });
113
-
114
93
  export default TreeTableViewportUpdater;
115
94
  //# sourceMappingURL=TreeTableViewportUpdater.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeTableViewportUpdater.js","names":["PureComponent","throttle","dh","Log","log","module","UPDATE_THROTTLE","TreeTableViewportUpdater","constructor","props","top","bottom","error","debug2","table","updateInterval","viewSize","viewportTop","Math","max","viewportBottom","listenerCleanup","onViewportUpdate","addEventListener","TreeTable","EVENT_UPDATED","setViewport","undefined","componentDidMount","filters","sorts","debug","applyFilter","applySort","updateViewport","componentDidUpdate","prevProps","componentWillUnmount","cancel","render","UPDATE_INTERVAL"],"sources":["../src/TreeTableViewportUpdater.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport throttle from 'lodash.throttle';\nimport dh, {\n EventListener,\n FilterCondition,\n RemoverFn,\n Sort,\n Table,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('TreeTableViewportUpdater');\n\nconst UPDATE_THROTTLE = 150;\n\ninterface TreeTableViewportUpdaterProps {\n table: Table;\n top: number;\n bottom: number;\n filters: FilterCondition[];\n sorts: Sort[];\n updateInterval: number;\n onViewportUpdate: EventListener;\n}\n\n/**\n * Updates the viewport of a TreeTable for use in a scroll pane.\n * Automatically throttles the viewport requests and buffers above and below.\n */\nclass TreeTableViewportUpdater extends PureComponent<\n TreeTableViewportUpdaterProps,\n Record<string, never>\n> {\n static UPDATE_INTERVAL = 1000;\n\n static defaultProps = {\n top: 0,\n bottom: 0,\n onViewportUpdate: (): void => undefined,\n filters: [],\n sorts: [],\n updateInterval: TreeTableViewportUpdater.UPDATE_INTERVAL,\n };\n\n constructor(props: TreeTableViewportUpdaterProps) {\n super(props);\n\n this.listenerCleanup = null;\n }\n\n componentDidMount(): void {\n const { top, bottom, table, filters, sorts } = this.props;\n log.debug('componentDidMount', this.props);\n table.applyFilter(filters);\n table.applySort(sorts);\n this.updateViewport(top, bottom);\n }\n\n componentDidUpdate(prevProps: TreeTableViewportUpdaterProps): void {\n const { top, bottom, table, filters, sorts } = this.props;\n if (filters !== prevProps.filters) {\n log.debug('update table filter', filters);\n table.applyFilter(filters);\n }\n\n if (sorts !== prevProps.sorts) {\n log.debug('update table sort', sorts);\n table.applySort(sorts);\n }\n\n this.updateViewport(top, bottom);\n }\n\n componentWillUnmount(): void {\n this.updateViewport.cancel();\n if (this.listenerCleanup) {\n this.listenerCleanup();\n }\n }\n\n listenerCleanup: RemoverFn | null;\n\n updateViewport = throttle((top: number, bottom: number): void => {\n if (bottom < top) {\n log.error('Invalid viewport', top, bottom);\n return;\n }\n\n if (top === 0 && bottom === 0) {\n log.debug2('Ignoring 0-0 viewport');\n return;\n }\n\n const { table, updateInterval } = this.props;\n const viewSize = bottom - top;\n const viewportTop = Math.max(0, top - viewSize * 3);\n const viewportBottom = bottom + viewSize * 3 + 1;\n log.debug2(\n 'Setting Viewport Top:',\n viewportTop,\n 'Bottom:',\n viewportBottom,\n table\n );\n\n if (!this.listenerCleanup) {\n const { onViewportUpdate } = this.props;\n this.listenerCleanup = table.addEventListener(\n dh.TreeTable.EVENT_UPDATED,\n onViewportUpdate\n );\n }\n\n table.setViewport(viewportTop, viewportBottom, undefined, updateInterval);\n }, UPDATE_THROTTLE);\n\n render(): null {\n return null;\n }\n}\n\nexport default TreeTableViewportUpdater;\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,OAA9B;AACA,OAAOC,QAAP,MAAqB,iBAArB;AACA,OAAOC,EAAP,MAMO,uBANP;AAOA,OAAOC,GAAP,MAAgB,gBAAhB;AAEA,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAAJ,CAAW,0BAAX,CAAZ;AAEA,IAAMC,eAAe,GAAG,GAAxB;;AAYA;AACA;AACA;AACA;AACA,MAAMC,wBAAN,SAAuCP,aAAvC,CAGE;EAYAQ,WAAW,CAACC,KAAD,EAAuC;IAChD,MAAMA,KAAN;;IADgD;;IAAA,wCAsCjCR,QAAQ,CAAC,CAACS,GAAD,EAAcC,MAAd,KAAuC;MAC/D,IAAIA,MAAM,GAAGD,GAAb,EAAkB;QAChBN,GAAG,CAACQ,KAAJ,CAAU,kBAAV,EAA8BF,GAA9B,EAAmCC,MAAnC;QACA;MACD;;MAED,IAAID,GAAG,KAAK,CAAR,IAAaC,MAAM,KAAK,CAA5B,EAA+B;QAC7BP,GAAG,CAACS,MAAJ,CAAW,uBAAX;QACA;MACD;;MAED,IAAM;QAAEC,KAAF;QAASC;MAAT,IAA4B,KAAKN,KAAvC;MACA,IAAMO,QAAQ,GAAGL,MAAM,GAAGD,GAA1B;MACA,IAAMO,WAAW,GAAGC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAYT,GAAG,GAAGM,QAAQ,GAAG,CAA7B,CAApB;MACA,IAAMI,cAAc,GAAGT,MAAM,GAAGK,QAAQ,GAAG,CAApB,GAAwB,CAA/C;MACAZ,GAAG,CAACS,MAAJ,CACE,uBADF,EAEEI,WAFF,E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AAyBC,MAAzB;EACD;;EAED0B,oBAAoB,GAAS;IAC3B,KAAKH,cAAL,CAAoBI,MAApB;;IACA,IAAI,KAAKjB,eAAT,EAA0B;MACxB,KAAKA,eAAL;IACD;EACF;;EAsCDkB,MAAM,GAAS;IACb,OAAO,IAAP;EACD;;AAtFD;;gBAHIhC,wB,qBAIqB,I;;gBAJrBA,wB,kBAMkB;EACpBG,GAAG,EAAE,CADe;EAEpBC,MAAM,EAAE,CAFY;EAGpBW,gBAAgB,EAAE,MAAYK,SAHV;EAIpBE,OAAO,EAAE,EAJW;EAKpBC,KAAK,EAAE,EALa;EAMpBf,cAAc,EAAER,wBAAwB,CAACiC;AANrB,C;;AAsFxB,eAAejC,wBAAf"}
1
+ {"version":3,"file":"TreeTableViewportUpdater.js","names":["PureComponent","throttle","dh","Log","log","module","UPDATE_THROTTLE","TreeTableViewportUpdater","constructor","props","top","bottom","error","debug2","table","updateInterval","viewSize","viewportTop","Math","max","viewportBottom","listenerCleanup","onViewportUpdate","addEventListener","TreeTable","EVENT_UPDATED","setViewport","undefined","componentDidMount","filters","sorts","debug","applyFilter","applySort","updateViewport","componentDidUpdate","prevProps","componentWillUnmount","cancel","render","UPDATE_INTERVAL"],"sources":["../src/TreeTableViewportUpdater.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport throttle from 'lodash.throttle';\nimport dh, {\n EventListener,\n FilterCondition,\n RemoverFn,\n Sort,\n Table,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('TreeTableViewportUpdater');\n\nconst UPDATE_THROTTLE = 150;\n\ninterface TreeTableViewportUpdaterProps {\n table: Table;\n top: number;\n bottom: number;\n filters: FilterCondition[];\n sorts: Sort[];\n updateInterval: number;\n onViewportUpdate: EventListener;\n}\n\n/**\n * Updates the viewport of a TreeTable for use in a scroll pane.\n * Automatically throttles the viewport requests and buffers above and below.\n */\nclass TreeTableViewportUpdater extends PureComponent<\n TreeTableViewportUpdaterProps,\n Record<string, never>\n> {\n static UPDATE_INTERVAL = 1000;\n\n static defaultProps = {\n top: 0,\n bottom: 0,\n onViewportUpdate: (): void => undefined,\n filters: [],\n sorts: [],\n updateInterval: TreeTableViewportUpdater.UPDATE_INTERVAL,\n };\n\n constructor(props: TreeTableViewportUpdaterProps) {\n super(props);\n\n this.listenerCleanup = null;\n }\n\n componentDidMount(): void {\n const { top, bottom, table, filters, sorts } = this.props;\n log.debug('componentDidMount', this.props);\n table.applyFilter(filters);\n table.applySort(sorts);\n this.updateViewport(top, bottom);\n }\n\n componentDidUpdate(prevProps: TreeTableViewportUpdaterProps): void {\n const { top, bottom, table, filters, sorts } = this.props;\n if (filters !== prevProps.filters) {\n log.debug('update table filter', filters);\n table.applyFilter(filters);\n }\n\n if (sorts !== prevProps.sorts) {\n log.debug('update table sort', sorts);\n table.applySort(sorts);\n }\n\n this.updateViewport(top, bottom);\n }\n\n componentWillUnmount(): void {\n this.updateViewport.cancel();\n if (this.listenerCleanup) {\n this.listenerCleanup();\n }\n }\n\n listenerCleanup: RemoverFn | null;\n\n updateViewport = throttle((top: number, bottom: number): void => {\n if (bottom < top) {\n log.error('Invalid viewport', top, bottom);\n return;\n }\n\n if (top === 0 && bottom === 0) {\n log.debug2('Ignoring 0-0 viewport');\n return;\n }\n\n const { table, updateInterval } = this.props;\n const viewSize = bottom - top;\n const viewportTop = Math.max(0, top - viewSize * 3);\n const viewportBottom = bottom + viewSize * 3 + 1;\n log.debug2(\n 'Setting Viewport Top:',\n viewportTop,\n 'Bottom:',\n viewportBottom,\n table\n );\n\n if (!this.listenerCleanup) {\n const { onViewportUpdate } = this.props;\n this.listenerCleanup = table.addEventListener(\n dh.TreeTable.EVENT_UPDATED,\n onViewportUpdate\n );\n }\n\n table.setViewport(viewportTop, viewportBottom, undefined, updateInterval);\n }, UPDATE_THROTTLE);\n\n render(): null {\n return null;\n }\n}\n\nexport default TreeTableViewportUpdater;\n"],"mappings":";AAAA,SAASA,aAAa,QAAQ,OAAO;AACrC,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AAO,IAAI;EACb;AACF;AAAC,gBA1FKhC,wBAAwB,qBAIH,IAAI;AAAA,gBAJzBA,wBAAwB,kBAMN;EACpBG,GAAG,EAAE,CAAC;EACNC,MAAM,EAAE,CAAC;EACTW,gBAAgB,EAAE,MAAYK,SAAS;EACvCE,OAAO,EAAE,EAAE;EACXC,KAAK,EAAE,EAAE;EACTf,cAAc,EAAER,wBAAwB,CAACiC;AAC3C,CAAC;AA+EH,eAAejC,wBAAwB"}
@@ -1,10 +1,8 @@
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
  import React, { Component } from 'react';
4
3
  import { Tooltip } from '@deephaven/components';
5
4
  import { DOMUtils } from '@deephaven/utils';
6
5
  import "./CustomFormatAction.css";
7
-
8
6
  /**
9
7
  * Renders menuElement option with custom format input for use in formatting context menus
10
8
  *
@@ -16,24 +14,19 @@ class CustomFormatAction extends Component {
16
14
  constructor() {
17
15
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CustomFormatAction.defaultProps;
18
16
  super(props);
19
-
20
17
  _defineProperty(this, "inputRef", void 0);
21
-
22
18
  this.handleInputChange = this.handleInputChange.bind(this);
23
19
  this.handleKeyDown = this.handleKeyDown.bind(this);
24
20
  this.inputRef = /*#__PURE__*/React.createRef();
25
21
  }
26
-
27
22
  handleInputChange() {
28
23
  var {
29
24
  onChange
30
25
  } = this.props;
31
-
32
26
  if (this.inputRef.current) {
33
27
  onChange(this.inputRef.current.value);
34
28
  }
35
29
  }
36
-
37
30
  closeContextMenu() {
38
31
  var {
39
32
  forwardedProps
@@ -43,50 +36,41 @@ class CustomFormatAction extends Component {
43
36
  } = forwardedProps;
44
37
  closeMenu(true);
45
38
  }
46
-
47
39
  revertToDefault() {
48
40
  var {
49
41
  onChange
50
42
  } = this.props;
51
43
  onChange(null);
52
44
  }
53
-
54
45
  returnFocusToContextMenu() {
55
46
  var parentContextMenu = DOMUtils.getClosestByClassName(this.inputRef.current, 'context-menu-container');
56
-
57
47
  if (parentContextMenu instanceof HTMLElement) {
58
48
  parentContextMenu.focus();
59
49
  }
60
50
  }
61
-
62
51
  handleKeyDown(event) {
63
52
  switch (event.key) {
64
53
  case 'Enter':
65
54
  event.stopPropagation();
66
55
  this.closeContextMenu();
67
56
  break;
68
-
69
57
  case 'Escape':
70
58
  event.stopPropagation();
71
59
  this.revertToDefault();
72
60
  this.closeContextMenu();
73
61
  break;
74
-
75
62
  case 'ArrowRight':
76
63
  case 'ArrowLeft':
77
64
  event.stopPropagation();
78
65
  break;
79
-
80
66
  case 'ArrowUp':
81
67
  case 'ArrowDown':
82
68
  this.returnFocusToContextMenu();
83
69
  break;
84
-
85
70
  default:
86
71
  event.stopPropagation();
87
72
  }
88
73
  }
89
-
90
74
  render() {
91
75
  var {
92
76
  formatString,
@@ -126,26 +110,21 @@ class CustomFormatAction extends Component {
126
110
  spellCheck: "false"
127
111
  })));
128
112
  }
129
-
130
113
  }
131
-
132
114
  _defineProperty(CustomFormatAction, "defaultProps", {
133
115
  formatString: '',
134
116
  forwardedProps: {
135
117
  menuItem: {},
136
-
137
- closeMenu(focusInput) {// no-op
118
+ closeMenu(focusInput) {
119
+ // no-op
138
120
  },
139
-
140
121
  iconElement: null
141
122
  },
142
123
  placeholder: '',
143
124
  title: '',
144
-
145
- onChange(value) {// no-op
125
+ onChange(value) {
126
+ // no-op
146
127
  }
147
-
148
128
  });
149
-
150
129
  export default CustomFormatAction;
151
130
  //# sourceMappingURL=CustomFormatAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomFormatAction.js","names":["React","Component","Tooltip","DOMUtils","CustomFormatAction","constructor","props","defaultProps","handleInputChange","bind","handleKeyDown","inputRef","createRef","onChange","current","value","closeContextMenu","forwardedProps","closeMenu","revertToDefault","returnFocusToContextMenu","parentContextMenu","getClosestByClassName","HTMLElement","focus","event","key","stopPropagation","render","formatString","placeholder","title","menuItem","description","iconElement","focusInput"],"sources":["../../src/format-context-menus/CustomFormatAction.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { Tooltip } from '@deephaven/components';\nimport { DOMUtils } from '@deephaven/utils';\n\nimport './CustomFormatAction.scss';\n\ntype CustomFormatActionProps = typeof CustomFormatAction.defaultProps & {\n forwardedProps: {\n menuItem: {\n title?: string;\n description?: string;\n };\n };\n};\n\n/**\n * Renders menuElement option with custom format input for use in formatting context menus\n *\n * TODO:\n * - capture focus when this menu action is selected via ArrowUp/ArrowDown keys\n * - dynamically update selected menu item when clicking on the input box\n */\nclass CustomFormatAction extends Component<CustomFormatActionProps> {\n static defaultProps = {\n formatString: '',\n forwardedProps: {\n menuItem: {},\n closeMenu(focusInput: boolean): void {\n // no-op\n },\n iconElement: null,\n },\n placeholder: '',\n title: '',\n onChange(value: string | null): void {\n // no-op\n },\n };\n\n constructor(\n props: CustomFormatActionProps = CustomFormatAction.defaultProps\n ) {\n super(props);\n\n this.handleInputChange = this.handleInputChange.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.inputRef = React.createRef();\n }\n\n inputRef: React.RefObject<HTMLInputElement>;\n\n handleInputChange(): void {\n const { onChange } = this.props;\n if (this.inputRef.current) {\n onChange(this.inputRef.current.value);\n }\n }\n\n closeContextMenu(): void {\n const { forwardedProps } = this.props;\n const { closeMenu } = forwardedProps;\n closeMenu(true);\n }\n\n revertToDefault(): void {\n const { onChange } = this.props;\n onChange(null);\n }\n\n returnFocusToContextMenu(): void {\n const parentContextMenu = DOMUtils.getClosestByClassName(\n this.inputRef.current,\n 'context-menu-container'\n );\n if (parentContextMenu instanceof HTMLElement) {\n parentContextMenu.focus();\n }\n }\n\n handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n switch (event.key) {\n case 'Enter':\n event.stopPropagation();\n this.closeContextMenu();\n break;\n case 'Escape':\n event.stopPropagation();\n this.revertToDefault();\n this.closeContextMenu();\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n event.stopPropagation();\n break;\n case 'ArrowUp':\n case 'ArrowDown':\n this.returnFocusToContextMenu();\n break;\n default:\n event.stopPropagation();\n }\n }\n\n render(): JSX.Element {\n const { formatString, forwardedProps, placeholder, title } = this.props;\n const {\n menuItem: { description },\n iconElement,\n } = forwardedProps;\n return (\n <div className=\"form-group flex-grow mb-0\">\n <div className=\"custom-format-title\">\n <span className=\"icon\">{iconElement}</span>\n <label className=\"title mb-0\" htmlFor=\"custom-format-input\">\n {title}\n {description != null && <Tooltip>{description}</Tooltip>}\n </label>\n </div>\n <div className=\"pl-2 pr-2 pb-2\">\n <input\n id=\"custom-format-input\"\n className=\"form-control text-right mb-0\"\n type=\"text\"\n defaultValue={formatString}\n ref={this.inputRef}\n placeholder={placeholder}\n onKeyDown={this.handleKeyDown}\n onChange={this.handleInputChange}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck=\"false\"\n />\n </div>\n </div>\n );\n }\n}\n\nexport default CustomFormatAction;\n"],"mappings":";;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,QAAT,QAAyB,kBAAzB;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAN,SAAiCH,SAAjC,CAAoE;EAiBlEI,WAAW,GAET;IAAA,IADAC,KACA,uEADiCF,kBAAkB,CAACG,YACpD;IACA,MAAMD,KAAN;;IADA;;IAGA,KAAKE,iBAAL,GAAyB,KAAKA,iBAAL,CAAuBC,IAAvB,CAA4B,IAA5B,CAAzB;IACA,KAAKC,aAAL,GAAqB,KAAKA,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB,CAArB;IAEA,KAAKE,QAAL,gBAAgBX,KAAK,CAACY,SAAN,EAAhB;EACD;;EAIDJ,iBAAiB,GAAS;IACxB,IAAM;MAAEK;IAAF,IAAe,KAAKP,KAA1B;;IACA,IAAI,KAAKK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;IAAhB,GAAwBiB,WAAxB,CADF,eAEE;MAAO,SAAS,EAAC,YAAjB;MAA8B,OAAO,EAAC;IAAtC,GACGH,KADH,EAEGE,WAAW,IAAI,IAAf,iBAAuB,oBAAC,OAAD,QAAUA,WAAV,CAF1B,CAFF,CADF,eAQE;MAAK,SAAS,EAAC;IAAf,gBACE;MACE,EAAE,EAAC,qBADL;MAEE,SAAS,EAAC,8BAFZ;MAGE,IAAI,EAAC,MAHP;MAIE,YAAY,EAAEJ,YAJhB;MAKE,GAAG,EAAE,KAAKlB,QALZ;MAME,WAAW,EAAEmB,WANf;MAOE,SAAS,EAAE,KAAKpB,aAPlB;MAQE,QAAQ,EAAE,KAAKF,iBARjB;MASE,YAAY,EAAC,KATf;MAUE,WAAW,EAAC,KAVd;MAWE,cAAc,EAAC,KAXjB;MAYE,UAAU,EAAC;IAZb,EADF,CARF,CADF;EA2BD;;AAnHiE;;gBAA9DJ,kB,kBACkB;EACpByB,YAAY,EAAE,EADM;EAEpBZ,cAAc,EAAE;IACde,QAAQ,EAAE,EADI;;IAEdd,SAAS,CAACiB,UAAD,EAA4B,CACnC;IACD,CAJa;;IAKdD,WAAW,EAAE;EALC,CAFI;EASpBJ,WAAW,EAAE,EATO;EAUpBC,KAAK,EAAE,EAVa;;EAWpBlB,QAAQ,CAACE,KAAD,EAA6B,CACnC;EACD;;AAbmB,C;;AAqHxB,eAAeX,kBAAf"}
1
+ {"version":3,"file":"CustomFormatAction.js","names":["React","Component","Tooltip","DOMUtils","CustomFormatAction","constructor","props","defaultProps","handleInputChange","bind","handleKeyDown","inputRef","createRef","onChange","current","value","closeContextMenu","forwardedProps","closeMenu","revertToDefault","returnFocusToContextMenu","parentContextMenu","getClosestByClassName","HTMLElement","focus","event","key","stopPropagation","render","formatString","placeholder","title","menuItem","description","iconElement","focusInput"],"sources":["../../src/format-context-menus/CustomFormatAction.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { Tooltip } from '@deephaven/components';\nimport { DOMUtils } from '@deephaven/utils';\n\nimport './CustomFormatAction.scss';\n\ntype CustomFormatActionProps = typeof CustomFormatAction.defaultProps & {\n forwardedProps: {\n menuItem: {\n title?: string;\n description?: string;\n };\n };\n};\n\n/**\n * Renders menuElement option with custom format input for use in formatting context menus\n *\n * TODO:\n * - capture focus when this menu action is selected via ArrowUp/ArrowDown keys\n * - dynamically update selected menu item when clicking on the input box\n */\nclass CustomFormatAction extends Component<CustomFormatActionProps> {\n static defaultProps = {\n formatString: '',\n forwardedProps: {\n menuItem: {},\n closeMenu(focusInput: boolean): void {\n // no-op\n },\n iconElement: null,\n },\n placeholder: '',\n title: '',\n onChange(value: string | null): void {\n // no-op\n },\n };\n\n constructor(\n props: CustomFormatActionProps = CustomFormatAction.defaultProps\n ) {\n super(props);\n\n this.handleInputChange = this.handleInputChange.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.inputRef = React.createRef();\n }\n\n inputRef: React.RefObject<HTMLInputElement>;\n\n handleInputChange(): void {\n const { onChange } = this.props;\n if (this.inputRef.current) {\n onChange(this.inputRef.current.value);\n }\n }\n\n closeContextMenu(): void {\n const { forwardedProps } = this.props;\n const { closeMenu } = forwardedProps;\n closeMenu(true);\n }\n\n revertToDefault(): void {\n const { onChange } = this.props;\n onChange(null);\n }\n\n returnFocusToContextMenu(): void {\n const parentContextMenu = DOMUtils.getClosestByClassName(\n this.inputRef.current,\n 'context-menu-container'\n );\n if (parentContextMenu instanceof HTMLElement) {\n parentContextMenu.focus();\n }\n }\n\n handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void {\n switch (event.key) {\n case 'Enter':\n event.stopPropagation();\n this.closeContextMenu();\n break;\n case 'Escape':\n event.stopPropagation();\n this.revertToDefault();\n this.closeContextMenu();\n break;\n case 'ArrowRight':\n case 'ArrowLeft':\n event.stopPropagation();\n break;\n case 'ArrowUp':\n case 'ArrowDown':\n this.returnFocusToContextMenu();\n break;\n default:\n event.stopPropagation();\n }\n }\n\n render(): JSX.Element {\n const { formatString, forwardedProps, placeholder, title } = this.props;\n const {\n menuItem: { description },\n iconElement,\n } = forwardedProps;\n return (\n <div className=\"form-group flex-grow mb-0\">\n <div className=\"custom-format-title\">\n <span className=\"icon\">{iconElement}</span>\n <label className=\"title mb-0\" htmlFor=\"custom-format-input\">\n {title}\n {description != null && <Tooltip>{description}</Tooltip>}\n </label>\n </div>\n <div className=\"pl-2 pr-2 pb-2\">\n <input\n id=\"custom-format-input\"\n className=\"form-control text-right mb-0\"\n type=\"text\"\n defaultValue={formatString}\n ref={this.inputRef}\n placeholder={placeholder}\n onKeyDown={this.handleKeyDown}\n onChange={this.handleInputChange}\n autoComplete=\"off\"\n autoCorrect=\"off\"\n autoCapitalize=\"off\"\n spellCheck=\"false\"\n />\n </div>\n </div>\n );\n }\n}\n\nexport default CustomFormatAction;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,QAAQ,QAAQ,kBAAkB;AAAC;AAa5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,SAASH,SAAS,CAA0B;EAiBlEI,WAAW,GAET;IAAA,IADAC,KAA8B,uEAAGF,kBAAkB,CAACG,YAAY;IAEhE,KAAK,CAACD,KAAK,CAAC;IAAC;IAEb,IAAI,CAACE,iBAAiB,GAAG,IAAI,CAACA,iBAAiB,CAACC,IAAI,CAAC,IAAI,CAAC;IAC1D,IAAI,CAACC,aAAa,GAAG,IAAI,CAACA,aAAa,CAACD,IAAI,CAAC,IAAI,CAAC;IAElD,IAAI,CAACE,QAAQ,gBAAGX,KAAK,CAACY,SAAS,EAAE;EACnC;EAIAJ,iBAAiB,GAAS;IACxB,IAAM;MAAEK;IAAS,CAAC,GAAG,IAAI,CAACP,KAAK;IAC/B,IAAI,IAAI,CAACK,QAAQ,CAACG,OAAO,EAAE;MACzBD,QAAQ,CAAC,IAAI,CAACF,QAAQ,CAACG,OAA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AAK,SAAS,EAAC;IAAqB,gBAClC;MAAM,SAAS,EAAC;IAAM,GAAEiB,WAAW,CAAQ,eAC3C;MAAO,SAAS,EAAC,YAAY;MAAC,OAAO,EAAC;IAAqB,GACxDH,KAAK,EACLE,WAAW,IAAI,IAAI,iBAAI,oBAAC,OAAO,QAAEA,WAAW,CAAW,CAClD,CACJ,eACN;MAAK,SAAS,EAAC;IAAgB,gBAC7B;MACE,EAAE,EAAC,qBAAqB;MACxB,SAAS,EAAC,8BAA8B;MACxC,IAAI,EAAC,MAAM;MACX,YAAY,EAAEJ,YAAa;MAC3B,GAAG,EAAE,IAAI,CAAClB,QAAS;MACnB,WAAW,EAAEmB,WAAY;MACzB,SAAS,EAAE,IAAI,CAACpB,aAAc;MAC9B,QAAQ,EAAE,IAAI,CAACF,iBAAkB;MACjC,YAAY,EAAC,KAAK;MAClB,WAAW,EAAC,KAAK;MACjB,cAAc,EAAC,KAAK;MACpB,UAAU,EAAC;IAAO,EAClB,CACE,CACF;EAEV;AACF;AAAC,gBApHKJ,kBAAkB,kBACA;EACpByB,YAAY,EAAE,EAAE;EAChBZ,cAAc,EAAE;IACde,QAAQ,EAAE,CAAC,CAAC;IACZd,SAAS,CAACiB,UAAmB,EAAQ;MACnC;IAAA,CACD;IACDD,WAAW,EAAE;EACf,CAAC;EACDJ,WAAW,EAAE,EAAE;EACfC,KAAK,EAAE,EAAE;EACTlB,QAAQ,CAACE,KAAoB,EAAQ;IACnC;EAAA;AAEJ,CAAC;AAuGH,eAAeX,kBAAkB"}
@@ -1,8 +1,6 @@
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
  import { DateTimeColumnFormatter, TableUtils } from '@deephaven/jsapi-utils';
4
3
  import FormatContextMenuUtils from "./FormatContextMenuUtils.js";
5
-
6
4
  class DateTimeFormatContextMenu {
7
5
  /**
8
6
  * Creates list of formatting options for DateTime context menu
@@ -45,14 +43,9 @@ class DateTimeFormatContextMenu {
45
43
  var defaultOption = FormatContextMenuUtils.makeOption('Default', null, DateTimeFormatContextMenu.dateGroup, FormatContextMenuUtils.isDefaultSelected(selectedFormat));
46
44
  return [defaultOption, ...presetFormatOptions];
47
45
  }
48
-
49
46
  }
50
-
51
47
  _defineProperty(DateTimeFormatContextMenu, "dateGroup", 10);
52
-
53
48
  _defineProperty(DateTimeFormatContextMenu, "timeGroup", 20);
54
-
55
49
  _defineProperty(DateTimeFormatContextMenu, "dateTimeGroup", 30);
56
-
57
50
  export default DateTimeFormatContextMenu;
58
51
  //# sourceMappingURL=DateTimeFormatContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeFormatContextMenu.js","names":["DateTimeColumnFormatter","TableUtils","FormatContextMenuUtils","DateTimeFormatContextMenu","getOptions","formatter","selectedFormat","currentTime","Date","formatItems","group","dateGroup","formatString","timeGroup","dateTimeGroup","presetFormatOptions","map","item","format","makeFormat","TYPE_CONTEXT_PRESET","title","getFormattedString","dataType","DATETIME","makeOption","isSameFormat","defaultOption","isDefaultSelected"],"sources":["../../src/format-context-menus/DateTimeFormatContextMenu.ts"],"sourcesContent":["import {\n DateTimeColumnFormatter,\n Formatter,\n TableColumnFormat,\n TableUtils,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DateTimeFormatContextMenu {\n static dateGroup = 10;\n\n static timeGroup = 20;\n\n static dateTimeGroup = 30;\n\n /**\n * Creates list of formatting options for DateTime context menu\n * @param formatter Formatter instance\n * @param selectedFormat Selected format object, null for no selected format\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n formatter: Formatter,\n selectedFormat: TableColumnFormat | null\n ): FormatContextMenuOption[] {\n const currentTime = new Date();\n const formatItems = [\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'yyyy-MM-dd',\n },\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'MM-dd-yyyy',\n },\n\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSS',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSSSSSSSS',\n },\n\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSS`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSSSSSSSS`,\n },\n ];\n\n const presetFormatOptions = formatItems.map(item => {\n const format = DateTimeColumnFormatter.makeFormat(\n '',\n item.formatString,\n DateTimeColumnFormatter.TYPE_CONTEXT_PRESET\n );\n const title = formatter.getFormattedString(\n currentTime,\n TableUtils.dataType.DATETIME,\n '',\n format\n );\n\n return FormatContextMenuUtils.makeOption(\n title,\n format,\n item.group,\n DateTimeColumnFormatter.isSameFormat(format, selectedFormat)\n );\n });\n\n const defaultOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DateTimeFormatContextMenu.dateGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n return [defaultOption, ...presetFormatOptions];\n }\n}\n\nexport default DateTimeFormatContextMenu;\n"],"mappings":";;AAAA,SACEA,uBADF,EAIEC,UAJF,QAKO,wBALP;OAMOC,sB;;AAIP,MAAMC,yBAAN,CAAgC;EAO9B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,SADe,EAEfC,cAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,IAAIC,IAAJ,EAApB;IACA,IAAMC,WAAW,GAAG,CAClB;MACEC,KAAK,EAAEP,yBAAyB,CAACQ,SADnC;MAEEC,YAAY,EAAE;IAFhB,CADkB,EAKlB;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OA,OAAO,CAACqB,aAAD,EAAgB,GAAGZ,mBAAnB,CAAP;EACD;;AApF6B;;gBAA1BZ,yB,eACe,E;;gBADfA,yB,eAGe,E;;gBAHfA,yB,mBAKmB,E;;AAkFzB,eAAeA,yBAAf"}
1
+ {"version":3,"file":"DateTimeFormatContextMenu.js","names":["DateTimeColumnFormatter","TableUtils","FormatContextMenuUtils","DateTimeFormatContextMenu","getOptions","formatter","selectedFormat","currentTime","Date","formatItems","group","dateGroup","formatString","timeGroup","dateTimeGroup","presetFormatOptions","map","item","format","makeFormat","TYPE_CONTEXT_PRESET","title","getFormattedString","dataType","DATETIME","makeOption","isSameFormat","defaultOption","isDefaultSelected"],"sources":["../../src/format-context-menus/DateTimeFormatContextMenu.ts"],"sourcesContent":["import {\n DateTimeColumnFormatter,\n Formatter,\n TableColumnFormat,\n TableUtils,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DateTimeFormatContextMenu {\n static dateGroup = 10;\n\n static timeGroup = 20;\n\n static dateTimeGroup = 30;\n\n /**\n * Creates list of formatting options for DateTime context menu\n * @param formatter Formatter instance\n * @param selectedFormat Selected format object, null for no selected format\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n formatter: Formatter,\n selectedFormat: TableColumnFormat | null\n ): FormatContextMenuOption[] {\n const currentTime = new Date();\n const formatItems = [\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'yyyy-MM-dd',\n },\n {\n group: DateTimeFormatContextMenu.dateGroup,\n formatString: 'MM-dd-yyyy',\n },\n\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSS',\n },\n {\n group: DateTimeFormatContextMenu.timeGroup,\n formatString: 'HH:mm:ss.SSSSSSSSS',\n },\n\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSS`,\n },\n {\n group: DateTimeFormatContextMenu.dateTimeGroup,\n formatString: `yyyy-MM-dd HH:mm:ss.SSSSSSSSS`,\n },\n ];\n\n const presetFormatOptions = formatItems.map(item => {\n const format = DateTimeColumnFormatter.makeFormat(\n '',\n item.formatString,\n DateTimeColumnFormatter.TYPE_CONTEXT_PRESET\n );\n const title = formatter.getFormattedString(\n currentTime,\n TableUtils.dataType.DATETIME,\n '',\n format\n );\n\n return FormatContextMenuUtils.makeOption(\n title,\n format,\n item.group,\n DateTimeColumnFormatter.isSameFormat(format, selectedFormat)\n );\n });\n\n const defaultOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DateTimeFormatContextMenu.dateGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n return [defaultOption, ...presetFormatOptions];\n }\n}\n\nexport default DateTimeFormatContextMenu;\n"],"mappings":";AAAA,SACEA,uBAAuB,EAGvBC,UAAU,QACL,wBAAwB;AAAC,OACzBC,sBAAsB;AAI7B,MAAMC,yBAAyB,CAAC;EAO9B;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,UAAU,CACfC,SAAoB,EACpBC,cAAwC,EACb;IAC3B,IAAMC,WAAW,GAAG,IAAIC,IAAI,EAAE;IAC9B,IAAMC,WAAW,GAAG,CAClB;MACEC,KAAK,EAAEP,yBAAyB,CAACQ,SAAS;MAC1CC,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACQ,SAAS;MAC1CC,YAAY,EAAE;IAChB,CAAC,EAED;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACU,SAAS;MAC1CD,YAAY,EAAE;IAChB,CAAC,EAED;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,EACD;MACEF,KAAK,EAAEP,yBAAyB,CAACW,aAAa;MAC9CF,YAAY;IACd,CAAC,CACF;IAED,IAAMG,mBAAmB,GAAGN,WAAW,CAACO,GAAG,CAACC,IAAI,IAAI;MAClD,IAAMC,MAAM,GAAGlB,uBAAuB,CAACmB,UAAU,CAC/C,EAAE,EACFF,IAAI,CAACL,YAAY,EACjBZ,uBAAuB,CAACoB,mBAAmB,CAC5C;MACD,IAAMC,KAAK,GAAGhB,SAAS,CAACiB,kBAAkB,CACxCf,WAAW,EACXN,UAAU,CAACsB,QAAQ,CAACC,QAAQ,EAC5B,EAAE,EACFN,MAAM,CACP;MAED,OAAOhB,sBAAsB,CAACuB,UAAU,CACtCJ,KAAK,EACLH,MAAM,EACND,IAAI,CAACP,KAAK,EACVV,uBAAuB,CAAC0B,YAAY,CAACR,MAAM,EAAEZ,cAAc,CAAC,CAC7D;IACH,CAAC,CAAC;IAEF,IAAMqB,aAAa,GAAGzB,sBAAsB,CAACuB,UAAU,CACrD,SAAS,EACT,IAAI,EACJtB,yBAAyB,CAACQ,SAAS,EACnCT,sBAAsB,CAAC0B,iBAAiB,CAACtB,cAAc,CAAC,CACzD;IAED,OAAO,CAACqB,aAAa,EAAE,GAAGZ,mBAAmB,CAAC;EAChD;AACF;AAAC,gBArFKZ,yBAAyB,eACV,EAAE;AAAA,gBADjBA,yBAAyB,eAGV,EAAE;AAAA,gBAHjBA,yBAAyB,mBAKN,EAAE;AAkF3B,eAAeA,yBAAyB"}
@@ -1,8 +1,6 @@
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
  import { DecimalColumnFormatter } from '@deephaven/jsapi-utils';
4
3
  import FormatContextMenuUtils from "./FormatContextMenuUtils.js";
5
-
6
4
  class DecimalFormatContextMenu {
7
5
  /**
8
6
  * Creates list of formatting options for Decimal context menu
@@ -40,7 +38,6 @@ class DecimalFormatContextMenu {
40
38
  var customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(customFormat, DecimalFormatContextMenu.customGroup, DecimalColumnFormatter.DEFAULT_FORMAT_STRING, isCustomSelected, formatString => {
41
39
  if (formatString != null) {
42
40
  var newCustomFormat = DecimalColumnFormatter.makeCustomFormat(formatString);
43
-
44
41
  if (DecimalColumnFormatter.isValid(newCustomFormat)) {
45
42
  onCustomFormatChange(newCustomFormat);
46
43
  }
@@ -50,16 +47,10 @@ class DecimalFormatContextMenu {
50
47
  });
51
48
  return [defaultFormatOption, ...presetFormatOptions, customFormatOption];
52
49
  }
53
-
54
50
  }
55
-
56
51
  _defineProperty(DecimalFormatContextMenu, "defaultGroup", 10);
57
-
58
52
  _defineProperty(DecimalFormatContextMenu, "presetGroup", 20);
59
-
60
53
  _defineProperty(DecimalFormatContextMenu, "presetRoundGroup", 30);
61
-
62
54
  _defineProperty(DecimalFormatContextMenu, "customGroup", 40);
63
-
64
55
  export default DecimalFormatContextMenu;
65
56
  //# sourceMappingURL=DecimalFormatContextMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DecimalFormatContextMenu.js","names":["DecimalColumnFormatter","FormatContextMenuUtils","DecimalFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_PERCENT","group","presetGroup","FORMAT_BASIS_POINTS","FORMAT_MILLIONS","FORMAT_SCIENTIFIC_NOTATION","FORMAT_ROUND","presetRoundGroup","FORMAT_ROUND_TWO_DECIMALS","FORMAT_ROUND_FOUR_DECIMALS","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/DecimalFormatContextMenu.ts"],"sourcesContent":["import {\n DecimalColumnFormat,\n DecimalColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DecimalFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static presetRoundGroup = 30;\n\n static customGroup = 40;\n\n /**\n * Creates list of formatting options for Decimal context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: DecimalColumnFormat,\n onCustomFormatChange: (value: DecimalColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: DecimalColumnFormatter.FORMAT_PERCENT,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_MILLIONS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DecimalFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : DecimalColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n DecimalFormatContextMenu.customGroup,\n DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = DecimalColumnFormatter.makeCustomFormat(\n formatString\n );\n if (DecimalColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default DecimalFormatContextMenu;\n"],"mappings":";;AAAA,SAEEA,sBAFF,QAGO,wBAHP;OAIOC,sB;;AAIP,MAAMC,wBAAN,CAA+B;EAS7B;AACF;AACA;AACA;AACA;AACA;EACmB,OAAVC,UAAU,CACfC,cADe,EAEfC,oBAFe,EAGY;IAC3B,IAAMC,WAAW,GAAG,CAClB;MACEC,MAAM,EAAEP,sBAAsB,CAACQ,cADjC;MAEEC,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CADkB,EAKlB;MACEH,MAAM,EAAEP,sBAAsB,CAACW,mBADjC;MAEEF,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CALkB,EASlB;MACEH,MAAM,EAAEP,sBAAsB,CAACY,eADjC;MAEEH,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CATkB,EAalB;MACEH,MAAM,EAAEP,sBAAsB,CAACa,0BADjC;MAEEJ,KAAK,EAAEP,wBAAwB,CAACQ;IAFlC,CAbkB,EAiBlB;MACEH,MAAM,EAAEP,sBAAsB,CAACc,YADjC;MAEEL,KAAK,EAAEP,wBAAwB,CAACa;IAFlC,CAj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D;MACF,CAPD,MAOO;QACL9B,oBAAoB,CAAC,IAAD,CAApB;MACD;IACF,CAhBwB,CAA3B;IAmBA,OAAO,CAACa,mBAAD,EAAsB,GAAGI,mBAAzB,EAA8CQ,kBAA9C,CAAP;EACD;;AA9F4B;;gBAAzB5B,wB,kBACkB,E;;gBADlBA,wB,iBAGiB,E;;gBAHjBA,wB,sBAKsB,E;;gBALtBA,wB,iBAOiB,E;;AA0FvB,eAAeA,wBAAf"}
1
+ {"version":3,"file":"DecimalFormatContextMenu.js","names":["DecimalColumnFormatter","FormatContextMenuUtils","DecimalFormatContextMenu","getOptions","selectedFormat","onCustomFormatChange","formatItems","format","FORMAT_PERCENT","group","presetGroup","FORMAT_BASIS_POINTS","FORMAT_MILLIONS","FORMAT_SCIENTIFIC_NOTATION","FORMAT_ROUND","presetRoundGroup","FORMAT_ROUND_TWO_DECIMALS","FORMAT_ROUND_FOUR_DECIMALS","defaultFormatOption","makeOption","defaultGroup","isDefaultSelected","presetFormatOptions","map","item","label","isSameFormat","isCustomSelected","customFormat","makeCustomFormat","customFormatOption","makeCustomFormatOption","customGroup","DEFAULT_FORMAT_STRING","formatString","newCustomFormat","isValid"],"sources":["../../src/format-context-menus/DecimalFormatContextMenu.ts"],"sourcesContent":["import {\n DecimalColumnFormat,\n DecimalColumnFormatter,\n} from '@deephaven/jsapi-utils';\nimport FormatContextMenuUtils, {\n FormatContextMenuOption,\n} from './FormatContextMenuUtils';\n\nclass DecimalFormatContextMenu {\n static defaultGroup = 10;\n\n static presetGroup = 20;\n\n static presetRoundGroup = 30;\n\n static customGroup = 40;\n\n /**\n * Creates list of formatting options for Decimal context menu\n * @param selectedFormat Selected format object, null for no selected format\n * @param onCustomFormatChange Callback to call when the custom format is changed\n * @returns Array of formatting options for the context menu\n */\n static getOptions(\n selectedFormat: DecimalColumnFormat,\n onCustomFormatChange: (value: DecimalColumnFormat | null) => void\n ): FormatContextMenuOption[] {\n const formatItems = [\n {\n format: DecimalColumnFormatter.FORMAT_PERCENT,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_BASIS_POINTS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_MILLIONS,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_SCIENTIFIC_NOTATION,\n group: DecimalFormatContextMenu.presetGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_TWO_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n {\n format: DecimalColumnFormatter.FORMAT_ROUND_FOUR_DECIMALS,\n group: DecimalFormatContextMenu.presetRoundGroup,\n },\n ];\n\n const defaultFormatOption = FormatContextMenuUtils.makeOption(\n 'Default',\n null,\n DecimalFormatContextMenu.defaultGroup,\n FormatContextMenuUtils.isDefaultSelected(selectedFormat)\n );\n\n const presetFormatOptions = formatItems.map(item =>\n FormatContextMenuUtils.makeOption(\n item.format.label,\n item.format,\n item.group,\n DecimalColumnFormatter.isSameFormat(item.format, selectedFormat)\n )\n );\n\n const isCustomSelected = FormatContextMenuUtils.isCustomSelected(\n selectedFormat\n );\n\n const customFormat = isCustomSelected\n ? selectedFormat\n : DecimalColumnFormatter.makeCustomFormat();\n\n const customFormatOption = FormatContextMenuUtils.makeCustomFormatOption(\n customFormat,\n DecimalFormatContextMenu.customGroup,\n DecimalColumnFormatter.DEFAULT_FORMAT_STRING,\n isCustomSelected,\n formatString => {\n if (formatString != null) {\n const newCustomFormat = DecimalColumnFormatter.makeCustomFormat(\n formatString\n );\n if (DecimalColumnFormatter.isValid(newCustomFormat)) {\n onCustomFormatChange(newCustomFormat);\n }\n } else {\n onCustomFormatChange(null);\n }\n }\n );\n\n return [defaultFormatOption, ...presetFormatOptions, customFormatOption];\n }\n}\n\nexport default DecimalFormatContextMenu;\n"],"m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AC0B,YAAY,CAACF,IAAI,CAACjB,MAAM,EAAEH,cAAc,CAAC,CACjE,CACF;IAED,IAAMuB,gBAAgB,GAAG1B,sBAAsB,CAAC0B,gBAAgB,CAC9DvB,cAAc,CACf;IAED,IAAMwB,YAAY,GAAGD,gBAAgB,GACjCvB,cAAc,GACdJ,sBAAsB,CAAC6B,gBAAgB,EAAE;IAE7C,IAAMC,kBAAkB,GAAG7B,sBAAsB,CAAC8B,sBAAsB,CACtEH,YAAY,EACZ1B,wBAAwB,CAAC8B,WAAW,EACpChC,sBAAsB,CAACiC,qBAAqB,EAC5CN,gBAAgB,EAChBO,YAAY,IAAI;MACd,IAAIA,YAAY,IAAI,IAAI,EAAE;QACxB,IAAMC,eAAe,GAAGnC,sBAAsB,CAAC6B,gBAAgB,CAC7DK,YAAY,CACb;QACD,IAAIlC,sBAAsB,CAACoC,OAAO,CAACD,eAAe,CAAC,EAAE;UACnD9B,oBAAoB,CAAC8B,eAAe,CAAC;QACvC;MACF,CAAC,MAAM;QACL9B,oBAAoB,CAAC,IAAI,CAAC;MAC5B;IACF,CAAC,CACF;IAED,OAAO,CAACa,mBAAmB,EAAE,GAAGI,mBAAmB,EAAEQ,kBAAkB,CAAC;EAC1E;AACF;AAAC,gBA/FK5B,wBAAwB,kBACN,EAAE;AAAA,gBADpBA,wBAAwB,iBAGP,EAAE;AAAA,gBAHnBA,wBAAwB,sBAKF,EAAE;AAAA,gBALxBA,wBAAwB,iBAOP,EAAE;AA0FzB,eAAeA,wBAAwB"}
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TableColumnFormatter } from '@deephaven/jsapi-utils';
3
3
  import CustomFormatAction from "./CustomFormatAction.js";
4
-
5
4
  class FormatContextMenuUtils {
6
5
  /**
7
6
  * Returns true if default option should be active in the context menu
@@ -10,15 +9,15 @@ class FormatContextMenuUtils {
10
9
  static isDefaultSelected(selectedFormat) {
11
10
  return !selectedFormat || ![TableColumnFormatter.TYPE_CONTEXT_CUSTOM, TableColumnFormatter.TYPE_CONTEXT_PRESET].includes(selectedFormat.type);
12
11
  }
12
+
13
13
  /**
14
14
  * Returns true if custom format option should be active in the context menu
15
15
  * @param selectedFormat selected format object or null
16
16
  */
17
-
18
-
19
17
  static isCustomSelected(selectedFormat) {
20
18
  return selectedFormat != null && selectedFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM;
21
19
  }
20
+
22
21
  /**
23
22
  * Creates context menu option
24
23
  * @param title Context menu title
@@ -26,8 +25,6 @@ class FormatContextMenuUtils {
26
25
  * @param group Context menu group
27
26
  * @param isSelected Is current option selected
28
27
  */
29
-
30
-
31
28
  static makeOption(title, format, group, isSelected) {
32
29
  return {
33
30
  title,
@@ -37,6 +34,7 @@ class FormatContextMenuUtils {
37
34
  isSelected
38
35
  };
39
36
  }
37
+
40
38
  /**
41
39
  * Creates context menu option with an input element
42
40
  * @param format Format object
@@ -45,8 +43,6 @@ class FormatContextMenuUtils {
45
43
  * @param isSelected Is current option selected
46
44
  * @param onChange Input element onChange callback
47
45
  */
48
-
49
-
50
46
  static makeCustomFormatOption(format, group, placeholder, isSelected, onChange) {
51
47
  return {
52
48
  title: format.label,
@@ -62,8 +58,6 @@ class FormatContextMenuUtils {
62
58
  })
63
59
  };
64
60
  }
65
-
66
61
  }
67
-
68
62
  export default FormatContextMenuUtils;
69
63
  //# sourceMappingURL=FormatContextMenuUtils.js.map