@deephaven/jsapi-utils
Advanced tools
Comparing version 0.85.3 to 0.85.8
@@ -8,8 +8,5 @@ import type { Key } from 'react'; | ||
columns: dh.Column[]; | ||
rows: ViewportRow[]; | ||
rows: dh.Row[]; | ||
}>; | ||
export type RowDeserializer<T> = (row: ViewportRow, columns: dh.Column[]) => T; | ||
export type ViewportRow = dh.Row & { | ||
offsetInSnapshot: number; | ||
}; | ||
export type RowDeserializer<T> = (row: dh.Row, columns: dh.Column[]) => T; | ||
/** | ||
@@ -24,11 +21,2 @@ * Create a `KeyedItem.key` for a given index. The prefix is necessary to avoid | ||
/** | ||
* Create a unique string key for a row based on its ordinal position in its | ||
* source table. This is calculated based on it's offset in the viewport | ||
* (row.offsetInSnapshot) + the offset of the snapshot. | ||
* @param row Row from a Table update event. | ||
* @param offset Offset of the current viewport. | ||
* @returns Unique string key for the ordinal position of the given row. | ||
*/ | ||
export declare function createKeyFromOffsetRow(row: ViewportRow, offset: number): string; | ||
/** | ||
* Creates a handler function for a `dh.Table.EVENT_UPDATED` event. Rows that | ||
@@ -51,3 +39,3 @@ * get passed to the handler will be bulk updated in the given `viewportData` | ||
*/ | ||
export declare function defaultRowDeserializer<T>(row: ViewportRow, columns: dh.Column[]): T; | ||
export declare function defaultRowDeserializer<T>(row: dh.Row, columns: dh.Column[]): T; | ||
/** | ||
@@ -54,0 +42,0 @@ * For windowing to work, the underlying list needs to maintain a KeyedItem for |
@@ -18,14 +18,2 @@ import clamp from 'lodash.clamp'; | ||
/** | ||
* Create a unique string key for a row based on its ordinal position in its | ||
* source table. This is calculated based on it's offset in the viewport | ||
* (row.offsetInSnapshot) + the offset of the snapshot. | ||
* @param row Row from a Table update event. | ||
* @param offset Offset of the current viewport. | ||
* @returns Unique string key for the ordinal position of the given row. | ||
*/ | ||
export function createKeyFromOffsetRow(row, offset) { | ||
return createKeyedItemKey(row.offsetInSnapshot + offset); | ||
} | ||
/** | ||
* Creates a handler function for a `dh.Table.EVENT_UPDATED` event. Rows that | ||
@@ -53,5 +41,5 @@ * get passed to the handler will be bulk updated in the given `viewportData` | ||
var updateKeyMap = new Map(); | ||
rows.forEach(row => { | ||
rows.forEach((row, offsetInSnapshot) => { | ||
var item = deserializeRow(row, columns); | ||
var key = createKeyFromOffsetRow(row, offset); | ||
var key = createKeyedItemKey(offset + offsetInSnapshot); | ||
updateKeyMap.set(key, { | ||
@@ -58,0 +46,0 @@ key, |
{ | ||
"name": "@deephaven/jsapi-utils", | ||
"version": "0.85.3", | ||
"version": "0.85.8", | ||
"description": "Deephaven JSAPI Utils", | ||
@@ -41,3 +41,3 @@ "author": "Deephaven Data Labs LLC", | ||
}, | ||
"gitHead": "27c92bdcb64434d765bc2d0f694854d4e5395a2c" | ||
"gitHead": "b68c6d61dbdd5fb7157d647b537a7f2799230450" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
438115
3995