@deephaven/grid 0.106.1-beta.0 → 0.106.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"GridModel.d.ts","sourceRoot":"","sources":["../src/GridModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAErB,OAAkB,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAMrD;;;;GAIG;AACH,uBAAe,SAAS,CACtB,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CACtD,MAAM,EACN,KAAK,CAAC,MAAM,CAAC,CACd,EACD,KAAK,SAAS,UAAU,GAAG,QAAQ,GAAG,UAAU,CAChD,SAAQ,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC;IACrC,gCAAgC;IAChC,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC;IAEhC,mCAAmC;IACnC,QAAQ,KAAK,WAAW,IAAI,MAAM,CAAC;IAEnC,+DAA+D;IAC/D,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED,kDAAkD;IAClD,IAAI,sBAAsB,IAAI,MAAM,CAEnC;IAED,mEAAmE;IACnE,IAAI,uBAAuB,IAAI,MAAM,CAEpC;IAED,oEAAoE;IACpE,IAAI,wBAAwB,IAAI,MAAM,CAErC;IAED;;;;;;OAMG;IACH,IAAI,oBAAoB,IAAI,MAAM,CA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AU,EACtB,KAAK,EAAE,MAAM,GACZ,kBAAkB,GAAG,SAAS;IAIjC,0BAA0B,CACxB,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,GACZ,kBAAkB,GAAG,SAAS;IAIjC;;;;;;OAMG;IACH,aAAa,CACX,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,UAAU,EACf,aAAa,GAAE,MAA+B,GAC7C,KAAK,EAAE;IAKV,qBAAqB,UACZ,MAAM,iBAAiB,MAAM,KAAG,KAAK,EAAE,8CAAvC,MAAM,iBAAiB,MAAM,KAAG,KAAK,EAAE,EAqB9C;IAEF,iBAAiB,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,cAAc;CAGvE;AAED,eAAe,SAAS,CAAC"}
package/dist/GridModel.js CHANGED
@@ -32,6 +32,8 @@ class GridModel extends EventTarget {
32
32
  }
33
33
  var contentToCheckForLinks = text.substring(0, lengthOfContent);
34
34
  return GridUtils.findTokensWithProtocolInText(contentToCheckForLinks);
35
+ }, {
36
+ max: 10000
35
37
  }));
36
38
  }
37
39
  /** Count of rows in the grid */
@@ -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","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 );\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;M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AAa,CAAC;EACxD;EAyBAqC,iBAAiBA,CAACpB,MAAkB,EAAEC,GAAe,EAAkB;IACrE,OAAO,MAAM;EACf;AACF;AAEA,eAAevB,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":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/grid",
3
- "version": "0.106.1-beta.0+b1787c8c",
3
+ "version": "0.106.1",
4
4
  "description": "Deephaven React grid component",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "*.css"
32
32
  ],
33
33
  "dependencies": {
34
- "@deephaven/utils": "^0.106.1-beta.0+b1787c8c",
34
+ "@deephaven/utils": "^0.106.0",
35
35
  "classnames": "^2.3.1",
36
36
  "color-convert": "^2.0.1",
37
37
  "event-target-shim": "^6.0.2",
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "b1787c8c249bead877fd6795802f098ab44573a8"
47
+ "gitHead": "652212e32b5bd2bbeed6ac9bed774b083c89feb5"
48
48
  }