@deephaven/grid 1.1.2-beta.0 → 1.1.2-grid-render-loop.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/CellInputField.js.map +1 -1
  2. package/dist/CellRenderer.js.map +1 -1
  3. package/dist/ColumnHeaderGroup.js.map +1 -1
  4. package/dist/DataBarCellRenderer.js.map +1 -1
  5. package/dist/DataBarGridModel.js.map +1 -1
  6. package/dist/DeletableGridModel.js.map +1 -1
  7. package/dist/EditableGridModel.js.map +1 -1
  8. package/dist/EventHandlerResult.js.map +1 -1
  9. package/dist/ExpandableGridModel.js.map +1 -1
  10. package/dist/Grid.d.ts +3 -0
  11. package/dist/Grid.d.ts.map +1 -1
  12. package/dist/Grid.js +16 -5
  13. package/dist/Grid.js.map +1 -1
  14. package/dist/GridAxisRange.js.map +1 -1
  15. package/dist/GridColorUtils.js.map +1 -1
  16. package/dist/GridMetricCalculator.js.map +1 -1
  17. package/dist/GridMetrics.js.map +1 -1
  18. package/dist/GridModel.js.map +1 -1
  19. package/dist/GridMouseHandler.js.map +1 -1
  20. package/dist/GridRange.js.map +1 -1
  21. package/dist/GridRenderer.js.map +1 -1
  22. package/dist/GridRendererTypes.js.map +1 -1
  23. package/dist/GridTestUtils.js.map +1 -1
  24. package/dist/GridTheme.js.map +1 -1
  25. package/dist/GridUtils.js.map +1 -1
  26. package/dist/KeyHandler.js.map +1 -1
  27. package/dist/MockDataBarGridModel.js.map +1 -1
  28. package/dist/MockGridData.js.map +1 -1
  29. package/dist/MockGridModel.js.map +1 -1
  30. package/dist/MockTreeGridModel.js.map +1 -1
  31. package/dist/StaticDataGridModel.js.map +1 -1
  32. package/dist/TextCellRenderer.js.map +1 -1
  33. package/dist/ThemeContext.js.map +1 -1
  34. package/dist/TokenBoxCellRenderer.js.map +1 -1
  35. package/dist/ViewportDataGridModel.js.map +1 -1
  36. package/dist/errors/AssertionError.js.map +1 -1
  37. package/dist/errors/PasteError.js.map +1 -1
  38. package/dist/errors/assertIsDefined.js.map +1 -1
  39. package/dist/errors/index.js.map +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/key-handlers/EditKeyHandler.js.map +1 -1
  42. package/dist/key-handlers/PasteKeyHandler.js.map +1 -1
  43. package/dist/key-handlers/SelectionKeyHandler.js.map +1 -1
  44. package/dist/key-handlers/TreeKeyHandler.js.map +1 -1
  45. package/dist/key-handlers/index.js.map +1 -1
  46. package/dist/memoizeClear.js.map +1 -1
  47. package/dist/mouse-handlers/EditMouseHandler.js.map +1 -1
  48. package/dist/mouse-handlers/GridColumnMoveMouseHandler.js.map +1 -1
  49. package/dist/mouse-handlers/GridColumnSeparatorMouseHandler.js.map +1 -1
  50. package/dist/mouse-handlers/GridHorizontalScrollBarMouseHandler.js.map +1 -1
  51. package/dist/mouse-handlers/GridRowMoveMouseHandler.js.map +1 -1
  52. package/dist/mouse-handlers/GridRowSeparatorMouseHandler.js.map +1 -1
  53. package/dist/mouse-handlers/GridRowTreeMouseHandler.js.map +1 -1
  54. package/dist/mouse-handlers/GridScrollBarCornerMouseHandler.js.map +1 -1
  55. package/dist/mouse-handlers/GridSelectionMouseHandler.js.map +1 -1
  56. package/dist/mouse-handlers/GridSeparatorMouseHandler.js.map +1 -1
  57. package/dist/mouse-handlers/GridTokenMouseHandler.js.map +1 -1
  58. package/dist/mouse-handlers/GridVerticalScrollBarMouseHandler.js.map +1 -1
  59. package/dist/mouse-handlers/index.js.map +1 -1
  60. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"GridModel.js","names":["EventTarget","memoizeClear","GridUtils","LINK_TRUNCATION_LENGTH","GridModel","constructor","arguments","_defineProperty","text","visibleLength","length","findTokensWithProtocolInText","indexOfProceedingWhitespace","slice","search","lengthOfContent","Math","min","contentToCheckForLinks","substring","max","floatingTopRowCount","floatingBottomRowCount","floatingLeftColumnCount","floatingRightColumnCount","columnHeaderMaxDepth","truncationCharForCell","column","row","undefined","textAlignForCell","colorForCell","theme","textColor","backgroundColorForCell","colorForColumnHeader","depth","textForRowHeader","textForRowFooter","isColumnMovable","isRowMovable","getColumnHeaderGroup","modelIndex","getColumnHeaderParentGroup","tokensForCell","textForCell","getCachedTokensInText","renderTypeForCell"],"sources":["../src/GridModel.ts"],"sourcesContent":["import { EventTarget, type Event } from 'event-target-shim';\nimport type { IColumnHeaderGroup } from './ColumnHeaderGroup';\nimport { type ModelIndex } from './GridMetrics';\nimport {\n type GridColor,\n type GridTheme,\n type NullableGridColor,\n} from './GridTheme';\nimport memoizeClear from './memoizeClear';\nimport GridUtils, { type Token } from './GridUtils';\nimport { type CellRenderType } from './CellRenderer';\n\nconst LINK_TRUNCATION_LENGTH = 5000;\n\n/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n/**\n * Model for a Grid\n * All of these methods should return very quickly, as they will be called many times in the render cycle.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the table to refresh (Not yet implemented).\n */\nabstract class GridModel<\n TEventMap extends Record<string, Event<string>> = Record<\n string,\n Event<string>\n >,\n TMode extends 'standard' | 'strict' = 'standard',\n> extends EventTarget<TEventMap, TMode> {\n /** Count of rows in the grid */\n abstract get rowCount(): number;\n\n /** Count of columns in the grid */\n abstract get columnCount(): number;\n\n /** Count of rows that are frozen (or 'floating') at the top */\n get floatingTopRowCount(): number {\n return 0;\n }\n\n /** Count of rows that are frozen at the bottom */\n get floatingBottomRowCount(): number {\n return 0;\n }\n\n /** Count of columns that are frozen (or 'floating') at the left */\n get floatingLeftColumnCount(): number {\n return 0;\n }\n\n /** Count of columns that are frozen (or 'floating') at the right */\n get floatingRightColumnCount(): number {\n return 0;\n }\n\n /**\n * How many columns header levels are in the grid\n * Used for column grouping where columns at depth 0 are the base columns\n *\n * A grid with 1-level grouping would have a columnHeaderDepth of 2\n * and column headers at depths 0 and 1\n */\n get columnHeaderMaxDepth(): number {\n return 1;\n }\n\n /**\n * Get the text for the specified cell\n * @param column Column to get the text for\n * @param row Row to get the text for\n * @returns Text for the specified cell\n */\n abstract textForCell(column: ModelIndex, row: ModelIndex): string;\n\n /**\n * Get the character to replace text when truncated for a specific cell.\n * Leave undefined to show text truncated with ellipsis\n * @param column Column to get the truncation character for\n * @param row Row to get the truncation character for\n * @returns Truncation character for the specified cell\n */\n truncationCharForCell(\n column: ModelIndex,\n row: ModelIndex\n ): string | undefined {\n return undefined;\n }\n\n /**\n * Get the text alignment for the specified cell\n * @param column Column to get the alignment for\n * @param row Row to get the alignment for\n * @returns Text alignment for the specified cell\n */\n textAlignForCell(column: ModelIndex, row: ModelIndex): CanvasTextAlign {\n return 'left';\n }\n\n /**\n * Get the color for the text in the specified cell\n * @param column Column to get the color for\n * @param row Row to get the color for\n * @param theme Theme applied to the grid\n * @returns Color for the text in the cell\n */\n colorForCell(\n column: ModelIndex,\n row: ModelIndex,\n theme: GridTheme\n ): GridColor {\n return theme.textColor;\n }\n\n /**\n * Get the background color for the cell\n * @param column Column to get the background color for\n * @param row Row to get the background color for\n * @param theme Theme applied to the grid\n * @returns Background color for the cell\n */\n backgroundColorForCell(\n column: ModelIndex,\n row: ModelIndex,\n theme: GridTheme\n ): NullableGridColor {\n return null;\n }\n\n /**\n * Text for the column header\n * @param column Column to get the header for\n * @param depth Depth to get the header text for. 0 is base columns\n * @returns Text to put in the column header\n */\n abstract textForColumnHeader(\n column: ModelIndex,\n depth?: number\n ): string | undefined;\n\n /** Color for column header\n * @param column Column to get the color for\n * @param depth Header depth to get the color for\n * @returns Color for the header at the depth or null\n */\n colorForColumnHeader(column: ModelIndex, depth = 0): string | null {\n return null;\n }\n\n /**\n * Text for the row header\n * @param row Row to get the header for\n * @returns Text to put in the row header\n */\n textForRowHeader(row: ModelIndex): string {\n return '';\n }\n\n /**\n * Text for the row footer\n * @param row Row to get the footer for\n * @returns Text to put in the row footer\n */\n textForRowFooter(row: ModelIndex): string {\n return '';\n }\n\n /**\n * @param column Column to check\n * @returns True if the column is movable\n */\n isColumnMovable(column: ModelIndex, depth = 0): boolean {\n return true;\n }\n\n /**\n * @param row Row to check\n * @returns True if the row is movable\n */\n isRowMovable(row: ModelIndex): boolean {\n return true;\n }\n\n getColumnHeaderGroup(\n modelIndex: ModelIndex,\n depth: number\n ): IColumnHeaderGroup | undefined {\n return undefined;\n }\n\n getColumnHeaderParentGroup(\n modelIndex: ModelIndex,\n depth: number\n ): IColumnHeaderGroup | undefined {\n return undefined;\n }\n\n /**\n * Gets the tokens in the cell at column and row, based on the visible text\n * @param column The model column\n * @param row The model row\n * @param visibleLength The length of the visible text\n * @returns An array of Tokens in the cell\n */\n tokensForCell(\n column: ModelIndex,\n row: ModelIndex,\n visibleLength: number = LINK_TRUNCATION_LENGTH\n ): Token[] {\n const text = this.textForCell(column, row);\n return this.getCachedTokensInText(text, visibleLength);\n }\n\n getCachedTokensInText = memoizeClear(\n (text: string, visibleLength: number): Token[] => {\n // If no text is truncated, then directly search in text\n if (visibleLength >= text.length) {\n return GridUtils.findTokensWithProtocolInText(text);\n }\n\n // To check for links, we should check to the first space after the truncatedText length\n const indexOfProceedingWhitespace = text\n .slice(visibleLength - 1, LINK_TRUNCATION_LENGTH)\n .search(/\\s/); // index or -1 if not found\n\n let lengthOfContent = visibleLength + indexOfProceedingWhitespace;\n // If it doesn't exist, set lengthOfContent to the minimum between length of the original text and 5000\n if (indexOfProceedingWhitespace === -1) {\n lengthOfContent = Math.min(LINK_TRUNCATION_LENGTH, text.length);\n }\n const contentToCheckForLinks = text.substring(0, lengthOfContent);\n\n return GridUtils.findTokensWithProtocolInText(contentToCheckForLinks);\n },\n { max: 10000 }\n );\n\n renderTypeForCell(column: ModelIndex, row: ModelIndex): CellRenderType {\n return 'text';\n }\n}\n\nexport default GridModel;\n"],"mappings":";;;AAAA,SAASA,WAAW,QAAoB,mBAAmB;AAAC,OAQrDC,YAAY;AAAA,OACZC,SAAS;AAGhB,IAAMC,sBAAsB,GAAG,IAAI;;AAEnC;AACA;AACA;AACA;AACA;AACA;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ACA;AACA;AACA;EACEe,aAAaA,CACXjB,MAAkB,EAClBC,GAAe,EAEN;IAAA,IADTnB,aAAqB,GAAAH,SAAA,CAAAI,MAAA,QAAAJ,SAAA,QAAAuB,SAAA,GAAAvB,SAAA,MAAGH,sBAAsB;IAE9C,IAAMK,IAAI,GAAG,IAAI,CAACqC,WAAW,CAAClB,MAAM,EAAEC,GAAG,CAAC;IAC1C,OAAO,IAAI,CAACkB,qBAAqB,CAACtC,IAAI,EAAEC,aAAa,CAAC;EACxD;EA0BAsC,iBAAiBA,CAACpB,MAAkB,EAAEC,GAAe,EAAkB;IACrE,OAAO,MAAM;EACf;AACF;AAEA,eAAexB,SAAS"}
1
+ {"version":3,"file":"GridModel.js","names":["EventTarget","memoizeClear","GridUtils","LINK_TRUNCATION_LENGTH","GridModel","constructor","arguments","_defineProperty","text","visibleLength","length","findTokensWithProtocolInText","indexOfProceedingWhitespace","slice","search","lengthOfContent","Math","min","contentToCheckForLinks","substring","max","floatingTopRowCount","floatingBottomRowCount","floatingLeftColumnCount","floatingRightColumnCount","columnHeaderMaxDepth","truncationCharForCell","column","row","undefined","textAlignForCell","colorForCell","theme","textColor","backgroundColorForCell","colorForColumnHeader","depth","textForRowHeader","textForRowFooter","isColumnMovable","isRowMovable","getColumnHeaderGroup","modelIndex","getColumnHeaderParentGroup","tokensForCell","textForCell","getCachedTokensInText","renderTypeForCell"],"sources":["../src/GridModel.ts"],"sourcesContent":["import { EventTarget, type Event } from 'event-target-shim';\nimport type { IColumnHeaderGroup } from './ColumnHeaderGroup';\nimport { type ModelIndex } from './GridMetrics';\nimport {\n type GridColor,\n type GridTheme,\n type NullableGridColor,\n} from './GridTheme';\nimport memoizeClear from './memoizeClear';\nimport GridUtils, { type Token } from './GridUtils';\nimport { type CellRenderType } from './CellRenderer';\n\nconst LINK_TRUNCATION_LENGTH = 5000;\n\n/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n/**\n * Model for a Grid\n * All of these methods should return very quickly, as they will be called many times in the render cycle.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the table to refresh (Not yet implemented).\n */\nabstract class GridModel<\n TEventMap extends Record<string, Event<string>> = Record<\n string,\n Event<string>\n >,\n TMode extends 'standard' | 'strict' = 'standard',\n> extends EventTarget<TEventMap, TMode> {\n /** Count of rows in the grid */\n abstract get rowCount(): number;\n\n /** Count of columns in the grid */\n abstract get columnCount(): number;\n\n /** Count of rows that are frozen (or 'floating') at the top */\n get floatingTopRowCount(): number {\n return 0;\n }\n\n /** Count of rows that are frozen at the bottom */\n get floatingBottomRowCount(): number {\n return 0;\n }\n\n /** Count of columns that are frozen (or 'floating') at the left */\n get floatingLeftColumnCount(): number {\n return 0;\n }\n\n /** Count of columns that are frozen (or 'floating') at the right */\n get floatingRightColumnCount(): number {\n return 0;\n }\n\n /**\n * How many columns header levels are in the grid\n * Used for column grouping where columns at depth 0 are the base columns\n *\n * A grid with 1-level grouping would have a columnHeaderDepth of 2\n * and column headers at depths 0 and 1\n */\n get columnHeaderMaxDepth(): number {\n return 1;\n }\n\n /**\n * Get the text for the specified cell\n * @param column Column to get the text for\n * @param row Row to get the text for\n * @returns Text for the specified cell\n */\n abstract textForCell(column: ModelIndex, row: ModelIndex): string;\n\n /**\n * Get the character to replace text when truncated for a specific cell.\n * Leave undefined to show text truncated with ellipsis\n * @param column Column to get the truncation character for\n * @param row Row to get the truncation character for\n * @returns Truncation character for the specified cell\n */\n truncationCharForCell(\n column: ModelIndex,\n row: ModelIndex\n ): string | undefined {\n return undefined;\n }\n\n /**\n * Get the text alignment for the specified cell\n * @param column Column to get the alignment for\n * @param row Row to get the alignment for\n * @returns Text alignment for the specified cell\n */\n textAlignForCell(column: ModelIndex, row: ModelIndex): CanvasTextAlign {\n return 'left';\n }\n\n /**\n * Get the color for the text in the specified cell\n * @param column Column to get the color for\n * @param row Row to get the color for\n * @param theme Theme applied to the grid\n * @returns Color for the text in the cell\n */\n colorForCell(\n column: ModelIndex,\n row: ModelIndex,\n theme: GridTheme\n ): GridColor {\n return theme.textColor;\n }\n\n /**\n * Get the background color for the cell\n * @param column Column to get the background color for\n * @param row Row to get the background color for\n * @param theme Theme applied to the grid\n * @returns Background color for the cell\n */\n backgroundColorForCell(\n column: ModelIndex,\n row: ModelIndex,\n theme: GridTheme\n ): NullableGridColor {\n return null;\n }\n\n /**\n * Text for the column header\n * @param column Column to get the header for\n * @param depth Depth to get the header text for. 0 is base columns\n * @returns Text to put in the column header\n */\n abstract textForColumnHeader(\n column: ModelIndex,\n depth?: number\n ): string | undefined;\n\n /** Color for column header\n * @param column Column to get the color for\n * @param depth Header depth to get the color for\n * @returns Color for the header at the depth or null\n */\n colorForColumnHeader(column: ModelIndex, depth = 0): string | null {\n return null;\n }\n\n /**\n * Text for the row header\n * @param row Row to get the header for\n * @returns Text to put in the row header\n */\n textForRowHeader(row: ModelIndex): string {\n return '';\n }\n\n /**\n * Text for the row footer\n * @param row Row to get the footer for\n * @returns Text to put in the row footer\n */\n textForRowFooter(row: ModelIndex): string {\n return '';\n }\n\n /**\n * @param column Column to check\n * @returns True if the column is movable\n */\n isColumnMovable(column: ModelIndex, depth = 0): boolean {\n return true;\n }\n\n /**\n * @param row Row to check\n * @returns True if the row is movable\n */\n isRowMovable(row: ModelIndex): boolean {\n return true;\n }\n\n getColumnHeaderGroup(\n modelIndex: ModelIndex,\n depth: number\n ): IColumnHeaderGroup | undefined {\n return undefined;\n }\n\n getColumnHeaderParentGroup(\n modelIndex: ModelIndex,\n depth: number\n ): IColumnHeaderGroup | undefined {\n return undefined;\n }\n\n /**\n * Gets the tokens in the cell at column and row, based on the visible text\n * @param column The model column\n * @param row The model row\n * @param visibleLength The length of the visible text\n * @returns An array of Tokens in the cell\n */\n tokensForCell(\n column: ModelIndex,\n row: ModelIndex,\n visibleLength: number = LINK_TRUNCATION_LENGTH\n ): Token[] {\n const text = this.textForCell(column, row);\n return this.getCachedTokensInText(text, visibleLength);\n }\n\n getCachedTokensInText = memoizeClear(\n (text: string, visibleLength: number): Token[] => {\n // If no text is truncated, then directly search in text\n if (visibleLength >= text.length) {\n return GridUtils.findTokensWithProtocolInText(text);\n }\n\n // To check for links, we should check to the first space after the truncatedText length\n const indexOfProceedingWhitespace = text\n .slice(visibleLength - 1, LINK_TRUNCATION_LENGTH)\n .search(/\\s/); // index or -1 if not found\n\n let lengthOfContent = visibleLength + indexOfProceedingWhitespace;\n // If it doesn't exist, set lengthOfContent to the minimum between length of the original text and 5000\n if (indexOfProceedingWhitespace === -1) {\n lengthOfContent = Math.min(LINK_TRUNCATION_LENGTH, text.length);\n }\n const contentToCheckForLinks = text.substring(0, lengthOfContent);\n\n return GridUtils.findTokensWithProtocolInText(contentToCheckForLinks);\n },\n { max: 10000 }\n );\n\n renderTypeForCell(column: ModelIndex, row: ModelIndex): CellRenderType {\n return 'text';\n }\n}\n\nexport default GridModel;\n"],"mappings":";;;AAAA,SAASA,WAAW,QAAoB,mBAAmB;AAAC,OAQrDC,YAAY;AAAA,OACZC,SAAS;AAGhB,IAAMC,sBAAsB,GAAG,IAAI;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAeC,SAAS,SAMdJ,WAAW,CAAmB;EAAAK,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,gCAwLdN,YAAY,CAClC,CAACO,IAAY,EAAEC,aAAqB,KAAc;MAChD;MACA,IAAIA,aAAa,IAAID,IAAI,CAACE,MAAM,EAAE;QAChC,OAAOR,SAAS,CAACS,4BAA4B,CAACH,IAAI,CAAC;MACrD;;MAEA;MACA,IAAMI,2BAA2B,GAAGJ,IAAI,CACrCK,KAAK,CAACJ,aAAa,GAAG,CAAC,EAAEN,sBAAsB,CAAC,CAChDW,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;;MAEjB,IAAIC,eAAe,GAAGN,aAAa,GAAGG,2BAA2B;MACjE;MACA,IAAIA,2BAA2B,KAAK,CAAC,CAAC,EAAE;QACtCG,eAAe,GAAGC,IAAI,CAACC,GAA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AAAI,MAAA,QAAAJ,SAAA,QAAAuB,SAAA,GAAAvB,SAAA,MAAG,CAAC;IAChD,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;EACE+B,gBAAgBA,CAACT,GAAe,EAAU;IACxC,OAAO,EAAE;EACX;;EAEA;AACF;AACA;AACA;AACA;EACEU,gBAAgBA,CAACV,GAAe,EAAU;IACxC,OAAO,EAAE;EACX;;EAEA;AACF;AACA;AACA;EACEW,eAAeA,CAACZ,MAAkB,EAAsB;IAAA,IAApBS,KAAK,GAAA9B,SAAA,CAAAI,MAAA,QAAAJ,SAAA,QAAAuB,SAAA,GAAAvB,SAAA,MAAG,CAAC;IAC3C,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;EACEkC,YAAYA,CAACZ,GAAe,EAAW;IACrC,OAAO,IAAI;EACb;EAEAa,oBAAoBA,CAClBC,UAAsB,EACtBN,KAAa,EACmB;IAChC,OAAOP,SAAS;EAClB;EAEAc,0BAA0BA,CACxBD,UAAsB,EACtBN,KAAa,EACmB;IAChC,OAAOP,SAAS;EAClB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEe,aAAaA,CACXjB,MAAkB,EAClBC,GAAe,EAEN;IAAA,IADTnB,aAAqB,GAAAH,SAAA,CAAAI,MAAA,QAAAJ,SAAA,QAAAuB,SAAA,GAAAvB,SAAA,MAAGH,sBAAsB;IAE9C,IAAMK,IAAI,GAAG,IAAI,CAACqC,WAAW,CAAClB,MAAM,EAAEC,GAAG,CAAC;IAC1C,OAAO,IAAI,CAACkB,qBAAqB,CAACtC,IAAI,EAAEC,aAAa,CAAC;EACxD;EA0BAsC,iBAAiBA,CAACpB,MAAkB,EAAEC,GAAe,EAAkB;IACrE,OAAO,MAAM;EACf;AACF;AAEA,eAAexB,SAAS","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GridMouseHandler.js","names":["GridMouseHandler","constructor","order","arguments","length","undefined","_defineProperty","onDown","gridPoint","grid","event","onMove","onDrag","onLeave","onClick","onContextMenu","onDoubleClick","onUp","onWheel"],"sources":["../src/GridMouseHandler.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport { type EventHandlerResult } from './EventHandlerResult';\nimport type Grid from './Grid';\nimport { type GridPoint } from './GridUtils';\n\n/**\n * Some events we listen to are a native mouse event, and others are wrapped with React's SyntheticEvent.\n * The GridMouseHandler shouldn't care though - the properties it accesses should be common on both types of events.\n */\nexport type GridMouseEvent = MouseEvent | React.MouseEvent;\n\nexport type GridWheelEvent = WheelEvent | React.WheelEvent;\n\nexport type GridMouseHandlerFunctionName =\n | 'onDown'\n | 'onMove'\n | 'onDrag'\n | 'onLeave'\n | 'onClick'\n | 'onContextMenu'\n | 'onDoubleClick'\n | 'onUp'\n | 'onWheel';\n\n/**\n * Define a region in the grid that interacts with the mouse on a grid.\n * Return true from any of the events to indicate they're consumed, and stopPropagation/preventDefault will be called.\n */\nexport class GridMouseHandler {\n order: number;\n\n // What order this mouse handler should trigger in. Smaller numbers trigger first\n // Default to well below any of the GRID mouse handlers 100-1000+\n constructor(order = 5000) {\n this.order = order;\n }\n\n // Cursor to use if this returns any truthy value including { stopPropagation: false, preventDefault: false }\n cursor: string | null = null;\n\n onDown(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onMove(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onDrag(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onLeave(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onClick(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onContextMenu(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onDoubleClick(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onUp(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onWheel(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n}\n\nexport default GridMouseHandler;\n"],"mappings":";;;AAAA;AACA;;AAKA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EAG5B;EACA;EACAC,WAAWA,CAAA,EAAe;IAAA,IAAdC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAAG,eAAA;IAAAA,eAAA,iBAKA,IAAI;IAJ1B,IAAI,CAACJ,KAAK,GAAGA,KAAK;EACpB;;EAEA;;EAGAK,MAAMA,CACJC,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAC,MAAMA,CACJH,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAE,MAAMA,CACJJ,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAG,OAAOA,CACLL,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAI,OAAOA,CACLN,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAK,aAAaA,CACXP,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAM,aAAaA,CACXR,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAO,IAAIA,CACFT,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAQ,OAAOA,CACLV,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;AACF;AAEA,eAAeV,gBAAgB"}
1
+ {"version":3,"file":"GridMouseHandler.js","names":["GridMouseHandler","constructor","order","arguments","length","undefined","_defineProperty","onDown","gridPoint","grid","event","onMove","onDrag","onLeave","onClick","onContextMenu","onDoubleClick","onUp","onWheel"],"sources":["../src/GridMouseHandler.ts"],"sourcesContent":["/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\nimport { type EventHandlerResult } from './EventHandlerResult';\nimport type Grid from './Grid';\nimport { type GridPoint } from './GridUtils';\n\n/**\n * Some events we listen to are a native mouse event, and others are wrapped with React's SyntheticEvent.\n * The GridMouseHandler shouldn't care though - the properties it accesses should be common on both types of events.\n */\nexport type GridMouseEvent = MouseEvent | React.MouseEvent;\n\nexport type GridWheelEvent = WheelEvent | React.WheelEvent;\n\nexport type GridMouseHandlerFunctionName =\n | 'onDown'\n | 'onMove'\n | 'onDrag'\n | 'onLeave'\n | 'onClick'\n | 'onContextMenu'\n | 'onDoubleClick'\n | 'onUp'\n | 'onWheel';\n\n/**\n * Define a region in the grid that interacts with the mouse on a grid.\n * Return true from any of the events to indicate they're consumed, and stopPropagation/preventDefault will be called.\n */\nexport class GridMouseHandler {\n order: number;\n\n // What order this mouse handler should trigger in. Smaller numbers trigger first\n // Default to well below any of the GRID mouse handlers 100-1000+\n constructor(order = 5000) {\n this.order = order;\n }\n\n // Cursor to use if this returns any truthy value including { stopPropagation: false, preventDefault: false }\n cursor: string | null = null;\n\n onDown(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onMove(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onDrag(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onLeave(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onClick(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onContextMenu(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onDoubleClick(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onUp(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n\n onWheel(\n gridPoint: GridPoint,\n grid: Grid,\n event: GridMouseEvent\n ): EventHandlerResult {\n return false;\n }\n}\n\nexport default GridMouseHandler;\n"],"mappings":";;;AAAA;AACA;;AAKA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gBAAgB,CAAC;EAG5B;EACA;EACAC,WAAWA,CAAA,EAAe;IAAA,IAAdC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;IAAAG,eAAA;IAAAA,eAAA,iBAKA,IAAI;IAJ1B,IAAI,CAACJ,KAAK,GAAGA,KAAK;EACpB;;EAEA;;EAGAK,MAAMA,CACJC,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAC,MAAMA,CACJH,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAE,MAAMA,CACJJ,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAG,OAAOA,CACLL,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAI,OAAOA,CACLN,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAK,aAAaA,CACXP,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAM,aAAaA,CACXR,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAO,IAAIA,CACFT,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;EAEAQ,OAAOA,CACLV,SAAoB,EACpBC,IAAU,EACVC,KAAqB,EACD;IACpB,OAAO,KAAK;EACd;AACF;AAEA,eAAeV,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GridRange.js","names":["SELECTION_DIRECTION","GridRange","normalize","startColumn","startRow","endColumn","endRow","left","top","right","bottom","makeNormalized","makeCell","column","row","makeColumn","makeRow","minOrNull","index1","index2","Math","min","maxOrNull","max","consolidate","ranges","result","slice","wasModified","i","length","range","j","other","contains","splice","touches","isAxisRangeTouching","start1","end1","start2","end2","rangeArraysEqual","ranges1","ranges2","equals","intersection","otherRange","_startColumn2","_endColumn2","_startRow2","_endRow2","_endColumn3","_endRow3","subtractFromRange","subtractRange","subtract","push","subtractFromRanges","subtractRangesFromRanges","subtractRanges","isBounded","boundedRange","columnCount","rowCount","_range$startColumn","_range$startRow","_range$endColumn","_range$endRow","boundedRanges","map","r","offset","columnOffset","rowOffset","nextCell","arguments","undefined","direction","DOWN","rangeIndex","findIndex","containsCell","RIGHT","nextRangeIndex","nextRange","startCell","LEFT","UP","Error","concat","cellCount","reduce","_range$endRow2","_range$startRow2","_range$endColumn2","_range$startColumn2","NaN","_range$endRow3","_range$startRow3","_range$endColumn3","_range$startColumn3","forEachCell","callback","forEach","constructor","_defineProperty","c","_this$nextCell"],"sources":["../src/GridRange.ts"],"sourcesContent":["export type GridRangeIndex = number | null;\nexport type RequiredGridRangeIndex = number;\ntype LeftIndex = GridRangeIndex;\ntype RightIndex = GridRangeIndex;\ntype TopIndex = GridRangeIndex;\ntype BottomIndex = GridRangeIndex;\n\nexport type GridCell = {\n column: RequiredGridRangeIndex;\n row: RequiredGridRangeIndex;\n};\n\nexport interface BoundedGridRange extends GridRange {\n startColumn: RequiredGridRangeIndex;\n startRow: RequiredGridRangeIndex;\n endColumn: RequiredGridRangeIndex;\n endRow: RequiredGridRangeIndex;\n}\n\n// Also exported via GridRange.SELECTION_DIRECTION\nexport enum SELECTION_DIRECTION {\n DOWN = 'DOWN',\n UP = 'UP',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n}\n\nexport class GridRange {\n startColumn: GridRangeIndex;\n\n startRow: GridRangeIndex;\n\n endColumn: GridRangeIndex;\n\n endRow: GridRangeIndex;\n\n static SELECTION_DIRECTION = SELECTION_DIRECTION;\n\n /**\n * Returns a normalized array of indexes ensuring left <= right and top <= bottom\n * @param startColumn Start column index\n * @param startRow Start row index\n * @param endColumn End column index\n * @param endRow End row index\n * @returns Array containing normalized indexes [left, top, right, bottom]\n */\n static normalize(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ): [LeftIndex, TopIndex, RightIndex, BottomIndex] {\n let left = startColumn;\n let top = startRow;\n let right = endColumn;\n let bottom = endRow;\n\n if (left != null && right != null && right < left) {\n left = right;\n right = startColumn;\n }\n\n if (top != null && bottom != null && bottom < top) {\n top = bottom;\n bottom = startRow;\n }\n\n return [left, top, right, bottom];\n }\n\n /**\n * Makes a GridRange ensuring startColumn <= endColumn, startRow <= endRow\n * @param startColumn Start column index\n * @param startRow Start row index\n * @param endColumn End column index\n * @param endRow End row index\n * @returns Normalized GridRange\n */\n static makeNormalized(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ): GridRange {\n return new GridRange(\n ...GridRange.normalize(startColumn, startRow, endColumn, endRow)\n );\n }\n\n /**\n * Creates a GridRange representing a single cell\n * @param column Column index\n * @param row Row index\n * @returns GridRange representing the cell\n */\n static makeCell(column: GridRangeIndex, row: GridRangeIndex): GridRange {\n return new GridRange(column, row, column, row);\n }\n\n /**\n * Creates a GridRange representing an infinite length column\n * @param column Column index\n * @returns GridRange representing the column\n */\n static makeColumn(column: GridRangeIndex): GridRange {\n return new GridRange(column, null, column, null);\n }\n\n /**\n * Creates a GridRange representing an infinite length row\n * @param row Row index\n * @returns GridRange representing the row\n */\n static makeRow(row: GridRangeIndex): GridRange {\n return new GridRange(null, row, null, row);\n }\n\n /**\n * Returns the minimum value between 2 range indexes or null if at least 1 is null\n * @param index1 First grid range index\n * @param index2 Second grid range index\n * @returns Minimum index or null if either index is null\n */\n static minOrNull(\n index1: GridRangeIndex,\n index2: GridRangeIndex\n ): number | null {\n if (index1 == null || index2 == null) {\n return null;\n }\n\n return Math.min(index1, index2);\n }\n\n /**\n * Returns the maximum value between 2 range indexes or null if at least 1 is null\n * @param index1 First grid range index\n * @param index2 Second grid range index\n * @returns Maximum index or null if either index is null\n */\n static maxOrNull(\n index1: GridRangeIndex,\n index2: GridRangeIndex\n ): number | null {\n if (index1 == null || index2 == null) {\n return null;\n }\n\n return Math.max(index1, index2);\n }\n\n /**\n * Consolidate the passed in ranges to the minimum set, merging overlapping ranges.\n * @param ranges The ranges to consolidate\n * @returns Consolidated ranges\n */\n static consolidate(ranges: readonly GridRange[]): GridRange[] {\n const result = ranges.slice();\n\n let wasModified = true;\n while (wasModified) {\n wasModified = false;\n for (let i = 0; i < result.length && !wasModified; i += 1) {\n const range = result[i];\n for (let j = result.length - 1; j > i; j -= 1) {\n const other = result[j];\n\n // If one contains the other, we can just keep the bigger one\n if (range.contains(other)) {\n result.splice(j, 1);\n } else if (other.contains(range)) {\n wasModified = true;\n result[i] = other;\n result.splice(j, 1);\n break;\n } else if (\n range.startRow === other.startRow &&\n range.endRow === other.endRow\n ) {\n if (range.touches(other)) {\n // If the start/end rows match, and columns touch, consolidate\n const { startRow, endRow } = range;\n const startColumn = GridRange.minOrNull(\n range.startColumn,\n other.startColumn\n );\n const endColumn = GridRange.maxOrNull(\n range.endColumn,\n other.endColumn\n );\n\n wasModified = true;\n result[i] = new GridRange(\n startColumn,\n startRow,\n endColumn,\n endRow\n );\n result.splice(j, 1);\n break;\n }\n } else if (\n range.startColumn === other.startColumn &&\n range.endColumn === other.endColumn\n ) {\n if (range.touches(other)) {\n // If the start/end rows match, and columns touch, consolidate\n const { startColumn, endColumn } = range;\n const startRow = GridRange.minOrNull(\n range.startRow,\n other.startRow\n );\n const endRow = GridRange.maxOrNull(range.endRow, other.endRow);\n\n wasModified = true;\n result[i] = new GridRange(\n startColumn,\n startRow,\n endColumn,\n endRow\n );\n result.splice(j, 1);\n break;\n }\n }\n }\n }\n }\n\n return result;\n }\n\n /**\n * Checks if the 1-D ranges between 2 index pairs overlap or are continuous.\n * For example ranges [0, 1] and [2, 3] are continuous and will return true.\n * [0, 1] and [1, 3] overlap and return true.\n * [0, 1] and [3, 4] do not overlap and have a gap so this will return false.\n * @param start1 Start of 1st range\n * @param end1 End of 1st range\n * @param start2 Start of 2nd range\n * @param end2 End of 2nd range\n * @returns True if the ranges overlap or touch, else false\n */\n static isAxisRangeTouching(\n start1: GridRangeIndex,\n end1: GridRangeIndex,\n start2: GridRangeIndex,\n end2: GridRangeIndex\n ): boolean {\n if (start1 == null) {\n if (end1 == null) {\n return true;\n }\n\n if (start2 == null) {\n return true;\n }\n\n return start2 <= end1 + 1;\n }\n\n if (end1 == null) {\n if (end2 == null) {\n return true;\n }\n\n return end2 >= start1 - 1;\n }\n\n if (start2 == null) {\n if (end2 == null) {\n return true;\n }\n\n return start1 <= end2 + 1;\n }\n\n if (end2 == null) {\n return end1 >= start2 - 1;\n }\n\n if (start2 >= start1 - 1) {\n return start2 <= end1 + 1;\n }\n\n return end2 >= start1 - 1;\n }\n\n /**\n * Checks if 2 arrays of ranges are the same ranges\n * @param ranges1 First array of ranges\n * @param ranges2 Second array of ranges\n * @returns True if the arrays contain the same ranges in the same order\n */\n static rangeArraysEqual(\n ranges1: readonly GridRange[],\n ranges2: readonly GridRange[]\n ): boolean {\n if (ranges1 === ranges2) {\n return true;\n }\n\n if (\n ranges1 == null ||\n ranges2 == null ||\n ranges1.length !== ranges2.length\n ) {\n return false;\n }\n\n for (let i = 0; i < ranges1.length; i += 1) {\n if (!ranges1[i].equals(ranges2[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Get the intersection (overlapping area) of two ranges\n * @param range One range to check for the intersection\n * @param otherRange The other range to check for the intersection\n * @returns Intersection of the two ranges. If they do not intersect, returns `null`.\n */\n static intersection(\n range: GridRange,\n otherRange: GridRange\n ): GridRange | null {\n if (range.equals(otherRange)) {\n return range;\n }\n\n let { startColumn, startRow, endColumn, endRow } = range;\n startColumn =\n startColumn != null && otherRange.startColumn != null\n ? Math.max(startColumn, otherRange.startColumn)\n : startColumn ?? otherRange.startColumn;\n endColumn =\n endColumn != null && otherRange.endColumn != null\n ? Math.min(endColumn, otherRange.endColumn)\n : endColumn ?? otherRange.endColumn;\n startRow =\n startRow != null && otherRange.startRow != null\n ? Math.max(startRow, otherRange.startRow)\n : startRow ?? otherRange.startRow;\n endRow =\n endRow != null && otherRange.endRow != null\n ? Math.min(endRow, otherRange.endRow)\n : endRow ?? otherRange.endRow;\n\n if (\n (startColumn != null && startColumn > (endColumn ?? -1)) ||\n (startRow != null && startRow > (endRow ?? -1))\n ) {\n return null;\n }\n\n return new GridRange(startColumn, startRow, endColumn, endRow);\n }\n\n /**\n * Subtracts 1 range from another\n * @param range The range to be subtracted from\n * @param subtractRange The range to subtract from within this range\n * @returns The ranges needed to represent the remaining\n */\n static subtractFromRange(\n range: GridRange,\n subtractRange: GridRange\n ): GridRange[] {\n const result = [];\n\n // Make it a little easier by finding only the part the subtraction range intersects\n const subtract = GridRange.intersection(range, subtractRange);\n if (subtract == null) {\n return [range];\n }\n\n // Go through each of the quadrants for deselection, there can be up to 4\n // Top quadrant (above the subtracted area)\n if (\n subtract.startRow != null &&\n (range.startRow == null || range.startRow < subtract.startRow)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n range.startRow,\n range.endColumn,\n subtract.startRow - 1\n )\n );\n }\n\n // middle left\n if (\n subtract.startColumn != null &&\n (range.startColumn == null || range.startColumn < subtract.startColumn)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n subtract.startRow,\n subtract.startColumn - 1,\n subtract.endRow\n )\n );\n }\n\n // middle right\n if (\n subtract.endColumn != null &&\n (range.endColumn == null || range.endColumn > subtract.endColumn)\n ) {\n result.push(\n new GridRange(\n subtract.endColumn + 1,\n subtract.startRow,\n range.endColumn,\n subtract.endRow\n )\n );\n }\n\n // Bottom quadrant\n if (\n subtract.endRow != null &&\n (range.endRow == null || range.endRow > subtract.endRow)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n subtract.endRow + 1,\n range.endColumn,\n range.endRow\n )\n );\n }\n\n return result;\n }\n\n /**\n * Subtract a range from multiple ranges\n * @param ranges The ranges to be subtracted from\n * @param subtractRange The range to subtract from within these ranges\n * @returns The ranges needed to represent the remaining\n */\n static subtractFromRanges(\n ranges: readonly GridRange[],\n subtractRange: GridRange\n ): GridRange[] {\n const result: GridRange[] = [];\n for (let i = 0; i < ranges.length; i += 1) {\n result.push(...GridRange.subtractFromRange(ranges[i], subtractRange));\n }\n\n return result;\n }\n\n /**\n * Subtract multiple ranges from multiple ranges\n * @param ranges The ranges to be subtracted from\n * @param subtractRanges The ranges to subtract from within these ranges\n * @returns The ranges needed to represent the remaining\n */\n static subtractRangesFromRanges(\n ranges: readonly GridRange[],\n subtractRanges: readonly GridRange[]\n ): GridRange[] {\n let result = [...ranges];\n for (let i = 0; i < subtractRanges.length; i += 1) {\n result = GridRange.subtractFromRanges(result, subtractRanges[i]);\n }\n\n return result;\n }\n\n /**\n * Test if a given range is bounded (all values are non-null)\n * @param range The range to test\n * @returns True if this range is bounded, false otherwise\n */\n static isBounded(range: GridRange): range is BoundedGridRange {\n return (\n range.startRow != null &&\n range.startColumn != null &&\n range.endRow != null &&\n range.endColumn != null\n );\n }\n\n /**\n * Converts any GridRange passed in that is a full row or column selection to be bound\n * to the `columnCount` and `rowCount` passed in\n *\n * @param range The range to get the bounded range of\n * @param columnCount The number of columns\n * @param rowCount The number of rows\n * @returns The passed in GridRange with any null values filled in\n */\n static boundedRange(\n range: GridRange,\n columnCount: number,\n rowCount: number\n ): BoundedGridRange {\n if (GridRange.isBounded(range)) {\n return range;\n }\n\n return new GridRange(\n range.startColumn ?? 0,\n range.startRow ?? 0,\n range.endColumn ?? columnCount - 1,\n range.endRow ?? rowCount - 1\n ) as BoundedGridRange;\n }\n\n /**\n * Converts the GridRanges passed in to be bound to the `columnCount` and `rowCount` passed in\n *\n * @param ranges The ranges to get the bounded ranges of\n * @param columnCount The number of columns\n * @param rowCount The number of rows\n * @returns The passed in GridRange with any null values filled in\n */\n static boundedRanges(\n ranges: readonly GridRange[],\n columnCount: number,\n rowCount: number\n ): BoundedGridRange[] {\n return ranges.map(r => GridRange.boundedRange(r, columnCount, rowCount));\n }\n\n /**\n * Offsets a GridRange by the specified amount in the x and y directions\n *\n * @param range The range to offset\n * @param columnOffset The number of columns to offset\n * @param rowOffset The number of rows to offset\n * @returns The new grid range offset from the original\n */\n static offset(\n range: GridRange,\n columnOffset: number,\n rowOffset: number\n ): GridRange {\n return new GridRange(\n range.startColumn != null ? range.startColumn + columnOffset : null,\n range.startRow != null ? range.startRow + rowOffset : null,\n range.endColumn != null ? range.endColumn + columnOffset : null,\n range.endRow != null ? range.endRow + rowOffset : null\n );\n }\n\n /**\n * Get the next cell given the selected ranges and the current cell\n * @param ranges The selected bounded ranges within the grid\n * @param column The cursor column, or null if none focused\n * @param row The cursor row, or null if none focused\n * @param direction The direction in which to select next\n * @returns The next cell to focus, or null if there should be no more focus\n */\n static nextCell(\n ranges: readonly GridRange[],\n column: GridRangeIndex = null,\n row: GridRangeIndex = null,\n direction = GridRange.SELECTION_DIRECTION.DOWN\n ): GridCell | null {\n if (ranges.length === 0) {\n return null;\n }\n\n let rangeIndex = -1;\n if (column != null && row != null) {\n rangeIndex = ranges.findIndex(r => r.containsCell(column, row));\n\n if (rangeIndex >= 0) {\n const range = ranges[rangeIndex];\n const nextCell = range.nextCell(column, row, direction);\n if (nextCell != null) {\n return nextCell;\n }\n }\n }\n\n // Otherwise go to the start of the next range (could be same range if only one range)\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n case GridRange.SELECTION_DIRECTION.RIGHT: {\n const nextRangeIndex =\n rangeIndex < ranges.length - 1 ? rangeIndex + 1 : 0;\n const nextRange = ranges[nextRangeIndex];\n return nextRange.startCell(direction);\n }\n case GridRange.SELECTION_DIRECTION.LEFT:\n case GridRange.SELECTION_DIRECTION.UP: {\n const nextRangeIndex =\n rangeIndex > 0 ? rangeIndex - 1 : ranges.length - 1;\n const nextRange = ranges[nextRangeIndex];\n return nextRange.startCell(direction);\n }\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n }\n\n /**\n * Count the number of cells in the provided grid ranges\n * @param ranges The ranges to count the rows of\n * @returns The number of cells in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static cellCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (cellCount, range) =>\n cellCount +\n ((range.endRow ?? NaN) - (range.startRow ?? NaN) + 1) *\n ((range.endColumn ?? NaN) - (range.startColumn ?? NaN) + 1),\n 0\n );\n }\n\n /**\n * Count the number of rows in the provided grid ranges\n * @param ranges The ranges to count the rows of\n * @returns The number of rows in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static rowCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (rowCount, range) =>\n rowCount + (range.endRow ?? NaN) - (range.startRow ?? NaN) + 1,\n 0\n );\n }\n\n /**\n * Count the number of columns in the provided grid ranges\n * @param ranges The ranges to count the columns of\n * @returns The number of columns in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static columnCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (columnCount, range) =>\n columnCount + (range.endColumn ?? NaN) - (range.startColumn ?? NaN) + 1,\n 0\n );\n }\n\n /**\n * Check if the provided ranges contain the provided cell\n * @param ranges The ranges to check\n * @param column The column index\n * @param row The row index\n * @returns True if the cell is within the provided ranges, false otherwise.\n */\n static containsCell(\n ranges: readonly GridRange[],\n column: GridRangeIndex,\n row: GridRangeIndex\n ): boolean {\n for (let i = 0; i < ranges.length; i += 1) {\n const range = ranges[i];\n if (range.containsCell(column, row)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Iterate through each cell in the provided ranges\n * @param ranges The ranges to iterate through\n * @param callback The callback to execute. `index` is the index within that range\n * @param direction The direction to iterate in\n */\n static forEachCell(\n ranges: readonly GridRange[],\n callback: (column: number, row: number, index: number) => void,\n direction = GridRange.SELECTION_DIRECTION.RIGHT\n ): void {\n for (let i = 0; i < ranges.length; i += 1) {\n ranges[i].forEach(callback, direction);\n }\n }\n\n constructor(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ) {\n this.startColumn = startColumn;\n this.startRow = startRow;\n this.endColumn = endColumn;\n this.endRow = endRow;\n }\n\n /**\n * Checks if the provided range is equivalent to this range (same start and end column/row indexes)\n * @param other Grid range to check against\n * @returns True if the ranges cover the same area\n */\n equals(other: GridRange): boolean {\n return (\n this.startColumn === other.startColumn &&\n this.startRow === other.startRow &&\n this.endColumn === other.endColumn &&\n this.endRow === other.endRow\n );\n }\n\n /**\n * Checks if this GridRange contains another range\n * @param other The range to check\n * @returns True if this GridRange completely contains `other`\n * */\n contains(other: GridRange): boolean {\n return (\n (this.startColumn == null ||\n (other.startColumn != null && this.startColumn <= other.startColumn)) &&\n (this.startRow == null ||\n (other.startRow != null && this.startRow <= other.startRow)) &&\n (this.endColumn == null ||\n (other.endColumn != null && this.endColumn >= other.endColumn)) &&\n (this.endRow == null ||\n (other.endRow != null && this.endRow >= other.endRow))\n );\n }\n\n /**\n * Check if the provided cell is in this range\n * @param column The column to check\n * @param row The row to check\n * @returns True if this cell is within this range\n */\n containsCell(column: GridRangeIndex, row: GridRangeIndex): boolean {\n if (column == null || row == null) {\n return false;\n }\n\n return (\n (this.startColumn == null || this.startColumn <= column) &&\n (this.endColumn == null || this.endColumn >= column) &&\n (this.startRow == null || this.startRow <= row) &&\n (this.endRow == null || this.endRow >= row)\n );\n }\n\n /**\n * Check if the provided range touches (or overlaps) this GridRange\n * Effectively checks if the 2 ranges could be represented by 1 continuous range\n * @param other The range to check\n * @returns True if this GridRange touches `other`\n * */\n touches(other: GridRange): boolean {\n return (\n GridRange.isAxisRangeTouching(\n this.startRow,\n this.endRow,\n other.startRow,\n other.endRow\n ) &&\n GridRange.isAxisRangeTouching(\n this.startColumn,\n this.endColumn,\n other.startColumn,\n other.endColumn\n )\n );\n }\n\n /**\n * Subtracts a range from this range\n * @param other The range to deselect from within this range\n * @returns The ranges needed to represent the remaining\n */\n subtract(other: GridRange): GridRange[] {\n return GridRange.subtractFromRange(this, other);\n }\n\n /**\n * Get the first cell in this range. Throws if this range is unbounded.\n *\n * @param direction The direction to get the starting cell in. Defaults to DOWN\n * @returns The first cell in this range in the direction specified\n */\n startCell(direction = GridRange.SELECTION_DIRECTION.DOWN): GridCell {\n if (!GridRange.isBounded(this)) {\n throw new Error('Cannot get the startCell of an unbounded range');\n }\n\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n case GridRange.SELECTION_DIRECTION.RIGHT:\n return { column: this.startColumn, row: this.startRow };\n case GridRange.SELECTION_DIRECTION.LEFT:\n case GridRange.SELECTION_DIRECTION.UP: {\n return { column: this.endColumn, row: this.endRow };\n }\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n }\n\n /**\n * Get the next cell in the direction specified. Throws if this range is unbounded.\n * If already at the bounds of the range in that direction, wrap to the next column or row\n * If at the end of the entire range, return null\n * If outside of the range, returns the next cell closest within this range.\n *\n * @param column The cursor column\n * @param row The cursor row\n * @param direction The direction to go in\n * @returns The next cell in the direction specified, or `null` if at the end of the range\n */\n nextCell(\n column: GridRangeIndex,\n row: GridRangeIndex,\n direction: SELECTION_DIRECTION\n ): GridCell | null {\n if (!GridRange.isBounded(this)) {\n throw new Error('Bounded range required');\n }\n if (column == null || row == null) {\n throw new Error('Require a non-null cursor');\n }\n\n const { startColumn, endColumn, startRow, endRow } = this;\n\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n if (row < endRow) {\n return { column, row: Math.max(row + 1, startRow) };\n }\n\n if (column < endColumn) {\n return { column: Math.max(column + 1, startColumn), row: startRow };\n }\n break;\n case GridRange.SELECTION_DIRECTION.UP:\n if (row > startRow) {\n return { column, row: Math.min(row - 1, endRow) };\n }\n\n if (column > startColumn) {\n return { column: Math.min(column - 1, endColumn), row: endRow };\n }\n break;\n case GridRange.SELECTION_DIRECTION.RIGHT:\n if (column < endColumn) {\n return { column: Math.max(column + 1, startColumn), row };\n }\n\n if (row < endRow) {\n return { column: startColumn, row: Math.max(row + 1, startRow) };\n }\n break;\n case GridRange.SELECTION_DIRECTION.LEFT:\n if (column > startColumn) {\n return { column: Math.min(column - 1, endColumn), row };\n }\n\n if (row > startRow) {\n return { column: endColumn, row: Math.min(row - 1, endRow) };\n }\n break;\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n\n return null;\n }\n\n /**\n * Iterate through each cell in the range\n * @param callback Callback to execute. `index` is the index within this range\n * @param direction The direction to iterate in\n */\n forEach(\n callback: (column: number, row: number, index: number) => void,\n direction = GridRange.SELECTION_DIRECTION.RIGHT\n ): void {\n let i = 0;\n let { column: c, row: r }: { column?: number; row?: number } =\n this.startCell(direction);\n while (c != null && r != null) {\n callback(c, r, i);\n i += 1;\n\n ({ column: c, row: r } = this.nextCell(c, r, direction) ?? {});\n }\n }\n}\n\nexport default GridRange;\n"],"mappings":";;;AAmBA;AACA,WAAYA,mBAAmB;AAK9B,WALWA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBA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I,IAAI,EAAE;MAAA,IAAAqC,cAAA;MAC7BL,QAAQ,CAACI,CAAC,EAAEpC,CAAC,EAAE1C,CAAC,CAAC;MACjBA,CAAC,IAAI,CAAC;MAEN,CAAC;QAAEhB,MAAM,EAAE8F,CAAC;QAAE7F,GAAG,EAAEyD;MAAE,CAAC,IAAAqC,cAAA,GAAG,IAAI,CAACjC,QAAQ,CAACgC,CAAC,EAAEpC,CAAC,EAAEO,SAAS,CAAC,cAAA8B,cAAA,cAAAA,cAAA,GAAI,CAAC,CAAC;IAC/D;EACF;AACF;AAACF,eAAA,CAl2BYzG,SAAS,yBASSD,mBAAmB;AA21BlD,eAAeC,SAAS"}
1
+ {"version":3,"file":"GridRange.js","names":["SELECTION_DIRECTION","GridRange","normalize","startColumn","startRow","endColumn","endRow","left","top","right","bottom","makeNormalized","makeCell","column","row","makeColumn","makeRow","minOrNull","index1","index2","Math","min","maxOrNull","max","consolidate","ranges","result","slice","wasModified","i","length","range","j","other","contains","splice","touches","isAxisRangeTouching","start1","end1","start2","end2","rangeArraysEqual","ranges1","ranges2","equals","intersection","otherRange","_startColumn2","_endColumn2","_startRow2","_endRow2","_endColumn3","_endRow3","subtractFromRange","subtractRange","subtract","push","subtractFromRanges","subtractRangesFromRanges","subtractRanges","isBounded","boundedRange","columnCount","rowCount","_range$startColumn","_range$startRow","_range$endColumn","_range$endRow","boundedRanges","map","r","offset","columnOffset","rowOffset","nextCell","arguments","undefined","direction","DOWN","rangeIndex","findIndex","containsCell","RIGHT","nextRangeIndex","nextRange","startCell","LEFT","UP","Error","concat","cellCount","reduce","_range$endRow2","_range$startRow2","_range$endColumn2","_range$startColumn2","NaN","_range$endRow3","_range$startRow3","_range$endColumn3","_range$startColumn3","forEachCell","callback","forEach","constructor","_defineProperty","c","_this$nextCell"],"sources":["../src/GridRange.ts"],"sourcesContent":["export type GridRangeIndex = number | null;\nexport type RequiredGridRangeIndex = number;\ntype LeftIndex = GridRangeIndex;\ntype RightIndex = GridRangeIndex;\ntype TopIndex = GridRangeIndex;\ntype BottomIndex = GridRangeIndex;\n\nexport type GridCell = {\n column: RequiredGridRangeIndex;\n row: RequiredGridRangeIndex;\n};\n\nexport interface BoundedGridRange extends GridRange {\n startColumn: RequiredGridRangeIndex;\n startRow: RequiredGridRangeIndex;\n endColumn: RequiredGridRangeIndex;\n endRow: RequiredGridRangeIndex;\n}\n\n// Also exported via GridRange.SELECTION_DIRECTION\nexport enum SELECTION_DIRECTION {\n DOWN = 'DOWN',\n UP = 'UP',\n LEFT = 'LEFT',\n RIGHT = 'RIGHT',\n}\n\nexport class GridRange {\n startColumn: GridRangeIndex;\n\n startRow: GridRangeIndex;\n\n endColumn: GridRangeIndex;\n\n endRow: GridRangeIndex;\n\n static SELECTION_DIRECTION = SELECTION_DIRECTION;\n\n /**\n * Returns a normalized array of indexes ensuring left <= right and top <= bottom\n * @param startColumn Start column index\n * @param startRow Start row index\n * @param endColumn End column index\n * @param endRow End row index\n * @returns Array containing normalized indexes [left, top, right, bottom]\n */\n static normalize(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ): [LeftIndex, TopIndex, RightIndex, BottomIndex] {\n let left = startColumn;\n let top = startRow;\n let right = endColumn;\n let bottom = endRow;\n\n if (left != null && right != null && right < left) {\n left = right;\n right = startColumn;\n }\n\n if (top != null && bottom != null && bottom < top) {\n top = bottom;\n bottom = startRow;\n }\n\n return [left, top, right, bottom];\n }\n\n /**\n * Makes a GridRange ensuring startColumn <= endColumn, startRow <= endRow\n * @param startColumn Start column index\n * @param startRow Start row index\n * @param endColumn End column index\n * @param endRow End row index\n * @returns Normalized GridRange\n */\n static makeNormalized(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ): GridRange {\n return new GridRange(\n ...GridRange.normalize(startColumn, startRow, endColumn, endRow)\n );\n }\n\n /**\n * Creates a GridRange representing a single cell\n * @param column Column index\n * @param row Row index\n * @returns GridRange representing the cell\n */\n static makeCell(column: GridRangeIndex, row: GridRangeIndex): GridRange {\n return new GridRange(column, row, column, row);\n }\n\n /**\n * Creates a GridRange representing an infinite length column\n * @param column Column index\n * @returns GridRange representing the column\n */\n static makeColumn(column: GridRangeIndex): GridRange {\n return new GridRange(column, null, column, null);\n }\n\n /**\n * Creates a GridRange representing an infinite length row\n * @param row Row index\n * @returns GridRange representing the row\n */\n static makeRow(row: GridRangeIndex): GridRange {\n return new GridRange(null, row, null, row);\n }\n\n /**\n * Returns the minimum value between 2 range indexes or null if at least 1 is null\n * @param index1 First grid range index\n * @param index2 Second grid range index\n * @returns Minimum index or null if either index is null\n */\n static minOrNull(\n index1: GridRangeIndex,\n index2: GridRangeIndex\n ): number | null {\n if (index1 == null || index2 == null) {\n return null;\n }\n\n return Math.min(index1, index2);\n }\n\n /**\n * Returns the maximum value between 2 range indexes or null if at least 1 is null\n * @param index1 First grid range index\n * @param index2 Second grid range index\n * @returns Maximum index or null if either index is null\n */\n static maxOrNull(\n index1: GridRangeIndex,\n index2: GridRangeIndex\n ): number | null {\n if (index1 == null || index2 == null) {\n return null;\n }\n\n return Math.max(index1, index2);\n }\n\n /**\n * Consolidate the passed in ranges to the minimum set, merging overlapping ranges.\n * @param ranges The ranges to consolidate\n * @returns Consolidated ranges\n */\n static consolidate(ranges: readonly GridRange[]): GridRange[] {\n const result = ranges.slice();\n\n let wasModified = true;\n while (wasModified) {\n wasModified = false;\n for (let i = 0; i < result.length && !wasModified; i += 1) {\n const range = result[i];\n for (let j = result.length - 1; j > i; j -= 1) {\n const other = result[j];\n\n // If one contains the other, we can just keep the bigger one\n if (range.contains(other)) {\n result.splice(j, 1);\n } else if (other.contains(range)) {\n wasModified = true;\n result[i] = other;\n result.splice(j, 1);\n break;\n } else if (\n range.startRow === other.startRow &&\n range.endRow === other.endRow\n ) {\n if (range.touches(other)) {\n // If the start/end rows match, and columns touch, consolidate\n const { startRow, endRow } = range;\n const startColumn = GridRange.minOrNull(\n range.startColumn,\n other.startColumn\n );\n const endColumn = GridRange.maxOrNull(\n range.endColumn,\n other.endColumn\n );\n\n wasModified = true;\n result[i] = new GridRange(\n startColumn,\n startRow,\n endColumn,\n endRow\n );\n result.splice(j, 1);\n break;\n }\n } else if (\n range.startColumn === other.startColumn &&\n range.endColumn === other.endColumn\n ) {\n if (range.touches(other)) {\n // If the start/end rows match, and columns touch, consolidate\n const { startColumn, endColumn } = range;\n const startRow = GridRange.minOrNull(\n range.startRow,\n other.startRow\n );\n const endRow = GridRange.maxOrNull(range.endRow, other.endRow);\n\n wasModified = true;\n result[i] = new GridRange(\n startColumn,\n startRow,\n endColumn,\n endRow\n );\n result.splice(j, 1);\n break;\n }\n }\n }\n }\n }\n\n return result;\n }\n\n /**\n * Checks if the 1-D ranges between 2 index pairs overlap or are continuous.\n * For example ranges [0, 1] and [2, 3] are continuous and will return true.\n * [0, 1] and [1, 3] overlap and return true.\n * [0, 1] and [3, 4] do not overlap and have a gap so this will return false.\n * @param start1 Start of 1st range\n * @param end1 End of 1st range\n * @param start2 Start of 2nd range\n * @param end2 End of 2nd range\n * @returns True if the ranges overlap or touch, else false\n */\n static isAxisRangeTouching(\n start1: GridRangeIndex,\n end1: GridRangeIndex,\n start2: GridRangeIndex,\n end2: GridRangeIndex\n ): boolean {\n if (start1 == null) {\n if (end1 == null) {\n return true;\n }\n\n if (start2 == null) {\n return true;\n }\n\n return start2 <= end1 + 1;\n }\n\n if (end1 == null) {\n if (end2 == null) {\n return true;\n }\n\n return end2 >= start1 - 1;\n }\n\n if (start2 == null) {\n if (end2 == null) {\n return true;\n }\n\n return start1 <= end2 + 1;\n }\n\n if (end2 == null) {\n return end1 >= start2 - 1;\n }\n\n if (start2 >= start1 - 1) {\n return start2 <= end1 + 1;\n }\n\n return end2 >= start1 - 1;\n }\n\n /**\n * Checks if 2 arrays of ranges are the same ranges\n * @param ranges1 First array of ranges\n * @param ranges2 Second array of ranges\n * @returns True if the arrays contain the same ranges in the same order\n */\n static rangeArraysEqual(\n ranges1: readonly GridRange[],\n ranges2: readonly GridRange[]\n ): boolean {\n if (ranges1 === ranges2) {\n return true;\n }\n\n if (\n ranges1 == null ||\n ranges2 == null ||\n ranges1.length !== ranges2.length\n ) {\n return false;\n }\n\n for (let i = 0; i < ranges1.length; i += 1) {\n if (!ranges1[i].equals(ranges2[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Get the intersection (overlapping area) of two ranges\n * @param range One range to check for the intersection\n * @param otherRange The other range to check for the intersection\n * @returns Intersection of the two ranges. If they do not intersect, returns `null`.\n */\n static intersection(\n range: GridRange,\n otherRange: GridRange\n ): GridRange | null {\n if (range.equals(otherRange)) {\n return range;\n }\n\n let { startColumn, startRow, endColumn, endRow } = range;\n startColumn =\n startColumn != null && otherRange.startColumn != null\n ? Math.max(startColumn, otherRange.startColumn)\n : startColumn ?? otherRange.startColumn;\n endColumn =\n endColumn != null && otherRange.endColumn != null\n ? Math.min(endColumn, otherRange.endColumn)\n : endColumn ?? otherRange.endColumn;\n startRow =\n startRow != null && otherRange.startRow != null\n ? Math.max(startRow, otherRange.startRow)\n : startRow ?? otherRange.startRow;\n endRow =\n endRow != null && otherRange.endRow != null\n ? Math.min(endRow, otherRange.endRow)\n : endRow ?? otherRange.endRow;\n\n if (\n (startColumn != null && startColumn > (endColumn ?? -1)) ||\n (startRow != null && startRow > (endRow ?? -1))\n ) {\n return null;\n }\n\n return new GridRange(startColumn, startRow, endColumn, endRow);\n }\n\n /**\n * Subtracts 1 range from another\n * @param range The range to be subtracted from\n * @param subtractRange The range to subtract from within this range\n * @returns The ranges needed to represent the remaining\n */\n static subtractFromRange(\n range: GridRange,\n subtractRange: GridRange\n ): GridRange[] {\n const result = [];\n\n // Make it a little easier by finding only the part the subtraction range intersects\n const subtract = GridRange.intersection(range, subtractRange);\n if (subtract == null) {\n return [range];\n }\n\n // Go through each of the quadrants for deselection, there can be up to 4\n // Top quadrant (above the subtracted area)\n if (\n subtract.startRow != null &&\n (range.startRow == null || range.startRow < subtract.startRow)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n range.startRow,\n range.endColumn,\n subtract.startRow - 1\n )\n );\n }\n\n // middle left\n if (\n subtract.startColumn != null &&\n (range.startColumn == null || range.startColumn < subtract.startColumn)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n subtract.startRow,\n subtract.startColumn - 1,\n subtract.endRow\n )\n );\n }\n\n // middle right\n if (\n subtract.endColumn != null &&\n (range.endColumn == null || range.endColumn > subtract.endColumn)\n ) {\n result.push(\n new GridRange(\n subtract.endColumn + 1,\n subtract.startRow,\n range.endColumn,\n subtract.endRow\n )\n );\n }\n\n // Bottom quadrant\n if (\n subtract.endRow != null &&\n (range.endRow == null || range.endRow > subtract.endRow)\n ) {\n result.push(\n new GridRange(\n range.startColumn,\n subtract.endRow + 1,\n range.endColumn,\n range.endRow\n )\n );\n }\n\n return result;\n }\n\n /**\n * Subtract a range from multiple ranges\n * @param ranges The ranges to be subtracted from\n * @param subtractRange The range to subtract from within these ranges\n * @returns The ranges needed to represent the remaining\n */\n static subtractFromRanges(\n ranges: readonly GridRange[],\n subtractRange: GridRange\n ): GridRange[] {\n const result: GridRange[] = [];\n for (let i = 0; i < ranges.length; i += 1) {\n result.push(...GridRange.subtractFromRange(ranges[i], subtractRange));\n }\n\n return result;\n }\n\n /**\n * Subtract multiple ranges from multiple ranges\n * @param ranges The ranges to be subtracted from\n * @param subtractRanges The ranges to subtract from within these ranges\n * @returns The ranges needed to represent the remaining\n */\n static subtractRangesFromRanges(\n ranges: readonly GridRange[],\n subtractRanges: readonly GridRange[]\n ): GridRange[] {\n let result = [...ranges];\n for (let i = 0; i < subtractRanges.length; i += 1) {\n result = GridRange.subtractFromRanges(result, subtractRanges[i]);\n }\n\n return result;\n }\n\n /**\n * Test if a given range is bounded (all values are non-null)\n * @param range The range to test\n * @returns True if this range is bounded, false otherwise\n */\n static isBounded(range: GridRange): range is BoundedGridRange {\n return (\n range.startRow != null &&\n range.startColumn != null &&\n range.endRow != null &&\n range.endColumn != null\n );\n }\n\n /**\n * Converts any GridRange passed in that is a full row or column selection to be bound\n * to the `columnCount` and `rowCount` passed in\n *\n * @param range The range to get the bounded range of\n * @param columnCount The number of columns\n * @param rowCount The number of rows\n * @returns The passed in GridRange with any null values filled in\n */\n static boundedRange(\n range: GridRange,\n columnCount: number,\n rowCount: number\n ): BoundedGridRange {\n if (GridRange.isBounded(range)) {\n return range;\n }\n\n return new GridRange(\n range.startColumn ?? 0,\n range.startRow ?? 0,\n range.endColumn ?? columnCount - 1,\n range.endRow ?? rowCount - 1\n ) as BoundedGridRange;\n }\n\n /**\n * Converts the GridRanges passed in to be bound to the `columnCount` and `rowCount` passed in\n *\n * @param ranges The ranges to get the bounded ranges of\n * @param columnCount The number of columns\n * @param rowCount The number of rows\n * @returns The passed in GridRange with any null values filled in\n */\n static boundedRanges(\n ranges: readonly GridRange[],\n columnCount: number,\n rowCount: number\n ): BoundedGridRange[] {\n return ranges.map(r => GridRange.boundedRange(r, columnCount, rowCount));\n }\n\n /**\n * Offsets a GridRange by the specified amount in the x and y directions\n *\n * @param range The range to offset\n * @param columnOffset The number of columns to offset\n * @param rowOffset The number of rows to offset\n * @returns The new grid range offset from the original\n */\n static offset(\n range: GridRange,\n columnOffset: number,\n rowOffset: number\n ): GridRange {\n return new GridRange(\n range.startColumn != null ? range.startColumn + columnOffset : null,\n range.startRow != null ? range.startRow + rowOffset : null,\n range.endColumn != null ? range.endColumn + columnOffset : null,\n range.endRow != null ? range.endRow + rowOffset : null\n );\n }\n\n /**\n * Get the next cell given the selected ranges and the current cell\n * @param ranges The selected bounded ranges within the grid\n * @param column The cursor column, or null if none focused\n * @param row The cursor row, or null if none focused\n * @param direction The direction in which to select next\n * @returns The next cell to focus, or null if there should be no more focus\n */\n static nextCell(\n ranges: readonly GridRange[],\n column: GridRangeIndex = null,\n row: GridRangeIndex = null,\n direction = GridRange.SELECTION_DIRECTION.DOWN\n ): GridCell | null {\n if (ranges.length === 0) {\n return null;\n }\n\n let rangeIndex = -1;\n if (column != null && row != null) {\n rangeIndex = ranges.findIndex(r => r.containsCell(column, row));\n\n if (rangeIndex >= 0) {\n const range = ranges[rangeIndex];\n const nextCell = range.nextCell(column, row, direction);\n if (nextCell != null) {\n return nextCell;\n }\n }\n }\n\n // Otherwise go to the start of the next range (could be same range if only one range)\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n case GridRange.SELECTION_DIRECTION.RIGHT: {\n const nextRangeIndex =\n rangeIndex < ranges.length - 1 ? rangeIndex + 1 : 0;\n const nextRange = ranges[nextRangeIndex];\n return nextRange.startCell(direction);\n }\n case GridRange.SELECTION_DIRECTION.LEFT:\n case GridRange.SELECTION_DIRECTION.UP: {\n const nextRangeIndex =\n rangeIndex > 0 ? rangeIndex - 1 : ranges.length - 1;\n const nextRange = ranges[nextRangeIndex];\n return nextRange.startCell(direction);\n }\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n }\n\n /**\n * Count the number of cells in the provided grid ranges\n * @param ranges The ranges to count the rows of\n * @returns The number of cells in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static cellCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (cellCount, range) =>\n cellCount +\n ((range.endRow ?? NaN) - (range.startRow ?? NaN) + 1) *\n ((range.endColumn ?? NaN) - (range.startColumn ?? NaN) + 1),\n 0\n );\n }\n\n /**\n * Count the number of rows in the provided grid ranges\n * @param ranges The ranges to count the rows of\n * @returns The number of rows in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static rowCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (rowCount, range) =>\n rowCount + (range.endRow ?? NaN) - (range.startRow ?? NaN) + 1,\n 0\n );\n }\n\n /**\n * Count the number of columns in the provided grid ranges\n * @param ranges The ranges to count the columns of\n * @returns The number of columns in the ranges, or `NaN` if any of the ranges were unbounded\n */\n static columnCount(ranges: readonly GridRange[]): number {\n return ranges.reduce(\n (columnCount, range) =>\n columnCount + (range.endColumn ?? NaN) - (range.startColumn ?? NaN) + 1,\n 0\n );\n }\n\n /**\n * Check if the provided ranges contain the provided cell\n * @param ranges The ranges to check\n * @param column The column index\n * @param row The row index\n * @returns True if the cell is within the provided ranges, false otherwise.\n */\n static containsCell(\n ranges: readonly GridRange[],\n column: GridRangeIndex,\n row: GridRangeIndex\n ): boolean {\n for (let i = 0; i < ranges.length; i += 1) {\n const range = ranges[i];\n if (range.containsCell(column, row)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Iterate through each cell in the provided ranges\n * @param ranges The ranges to iterate through\n * @param callback The callback to execute. `index` is the index within that range\n * @param direction The direction to iterate in\n */\n static forEachCell(\n ranges: readonly GridRange[],\n callback: (column: number, row: number, index: number) => void,\n direction = GridRange.SELECTION_DIRECTION.RIGHT\n ): void {\n for (let i = 0; i < ranges.length; i += 1) {\n ranges[i].forEach(callback, direction);\n }\n }\n\n constructor(\n startColumn: GridRangeIndex,\n startRow: GridRangeIndex,\n endColumn: GridRangeIndex,\n endRow: GridRangeIndex\n ) {\n this.startColumn = startColumn;\n this.startRow = startRow;\n this.endColumn = endColumn;\n this.endRow = endRow;\n }\n\n /**\n * Checks if the provided range is equivalent to this range (same start and end column/row indexes)\n * @param other Grid range to check against\n * @returns True if the ranges cover the same area\n */\n equals(other: GridRange): boolean {\n return (\n this.startColumn === other.startColumn &&\n this.startRow === other.startRow &&\n this.endColumn === other.endColumn &&\n this.endRow === other.endRow\n );\n }\n\n /**\n * Checks if this GridRange contains another range\n * @param other The range to check\n * @returns True if this GridRange completely contains `other`\n * */\n contains(other: GridRange): boolean {\n return (\n (this.startColumn == null ||\n (other.startColumn != null && this.startColumn <= other.startColumn)) &&\n (this.startRow == null ||\n (other.startRow != null && this.startRow <= other.startRow)) &&\n (this.endColumn == null ||\n (other.endColumn != null && this.endColumn >= other.endColumn)) &&\n (this.endRow == null ||\n (other.endRow != null && this.endRow >= other.endRow))\n );\n }\n\n /**\n * Check if the provided cell is in this range\n * @param column The column to check\n * @param row The row to check\n * @returns True if this cell is within this range\n */\n containsCell(column: GridRangeIndex, row: GridRangeIndex): boolean {\n if (column == null || row == null) {\n return false;\n }\n\n return (\n (this.startColumn == null || this.startColumn <= column) &&\n (this.endColumn == null || this.endColumn >= column) &&\n (this.startRow == null || this.startRow <= row) &&\n (this.endRow == null || this.endRow >= row)\n );\n }\n\n /**\n * Check if the provided range touches (or overlaps) this GridRange\n * Effectively checks if the 2 ranges could be represented by 1 continuous range\n * @param other The range to check\n * @returns True if this GridRange touches `other`\n * */\n touches(other: GridRange): boolean {\n return (\n GridRange.isAxisRangeTouching(\n this.startRow,\n this.endRow,\n other.startRow,\n other.endRow\n ) &&\n GridRange.isAxisRangeTouching(\n this.startColumn,\n this.endColumn,\n other.startColumn,\n other.endColumn\n )\n );\n }\n\n /**\n * Subtracts a range from this range\n * @param other The range to deselect from within this range\n * @returns The ranges needed to represent the remaining\n */\n subtract(other: GridRange): GridRange[] {\n return GridRange.subtractFromRange(this, other);\n }\n\n /**\n * Get the first cell in this range. Throws if this range is unbounded.\n *\n * @param direction The direction to get the starting cell in. Defaults to DOWN\n * @returns The first cell in this range in the direction specified\n */\n startCell(direction = GridRange.SELECTION_DIRECTION.DOWN): GridCell {\n if (!GridRange.isBounded(this)) {\n throw new Error('Cannot get the startCell of an unbounded range');\n }\n\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n case GridRange.SELECTION_DIRECTION.RIGHT:\n return { column: this.startColumn, row: this.startRow };\n case GridRange.SELECTION_DIRECTION.LEFT:\n case GridRange.SELECTION_DIRECTION.UP: {\n return { column: this.endColumn, row: this.endRow };\n }\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n }\n\n /**\n * Get the next cell in the direction specified. Throws if this range is unbounded.\n * If already at the bounds of the range in that direction, wrap to the next column or row\n * If at the end of the entire range, return null\n * If outside of the range, returns the next cell closest within this range.\n *\n * @param column The cursor column\n * @param row The cursor row\n * @param direction The direction to go in\n * @returns The next cell in the direction specified, or `null` if at the end of the range\n */\n nextCell(\n column: GridRangeIndex,\n row: GridRangeIndex,\n direction: SELECTION_DIRECTION\n ): GridCell | null {\n if (!GridRange.isBounded(this)) {\n throw new Error('Bounded range required');\n }\n if (column == null || row == null) {\n throw new Error('Require a non-null cursor');\n }\n\n const { startColumn, endColumn, startRow, endRow } = this;\n\n switch (direction) {\n case GridRange.SELECTION_DIRECTION.DOWN:\n if (row < endRow) {\n return { column, row: Math.max(row + 1, startRow) };\n }\n\n if (column < endColumn) {\n return { column: Math.max(column + 1, startColumn), row: startRow };\n }\n break;\n case GridRange.SELECTION_DIRECTION.UP:\n if (row > startRow) {\n return { column, row: Math.min(row - 1, endRow) };\n }\n\n if (column > startColumn) {\n return { column: Math.min(column - 1, endColumn), row: endRow };\n }\n break;\n case GridRange.SELECTION_DIRECTION.RIGHT:\n if (column < endColumn) {\n return { column: Math.max(column + 1, startColumn), row };\n }\n\n if (row < endRow) {\n return { column: startColumn, row: Math.max(row + 1, startRow) };\n }\n break;\n case GridRange.SELECTION_DIRECTION.LEFT:\n if (column > startColumn) {\n return { column: Math.min(column - 1, endColumn), row };\n }\n\n if (row > startRow) {\n return { column: endColumn, row: Math.min(row - 1, endRow) };\n }\n break;\n default:\n throw new Error(`Invalid direction: ${direction}`);\n }\n\n return null;\n }\n\n /**\n * Iterate through each cell in the range\n * @param callback Callback to execute. `index` is the index within this range\n * @param direction The direction to iterate in\n */\n forEach(\n callback: (column: number, row: number, index: number) => void,\n direction = GridRange.SELECTION_DIRECTION.RIGHT\n ): void {\n let i = 0;\n let { column: c, row: r }: { column?: number; row?: number } =\n this.startCell(direction);\n while (c != null && r != null) {\n callback(c, r, i);\n i += 1;\n\n ({ column: c, row: r } = this.nextCell(c, r, direction) ?? {});\n }\n }\n}\n\nexport default GridRange;\n"],"mappings":";;;AAmBA;AACA,WAAYA,mBAAmB;AAK9B,WALWA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAA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