@deephaven/jsapi-utils 1.2.1-plotly-rc3.3 → 1.3.1-uri.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,11 +53,12 @@ export declare function generateEmptyKeyedItems<T>(start: number, end: number):
53
53
  */
54
54
  export declare function getSize(table?: dh.Table | dh.TreeTable | null): number;
55
55
  /**
56
- * Check if a given table is closed. Tree tables don't have an `isClosed` prop,
56
+ * Check if a given widget is closed based on `isClosed` prop.
57
+ * Tree tables and other widgets don't have an `isClosed` prop,
57
58
  * so will always return false.
58
- * @param table The table to check if it is closed.
59
+ * @param table The widget to check if it is closed.
59
60
  */
60
- export declare function isClosed(table: dh.Table | dh.TreeTable): boolean;
61
+ export declare function isClosed(widget: unknown): boolean;
61
62
  /**
62
63
  * Determine the first and last row index for a viewport + extra leading and
63
64
  * trailing padding. Values will be "clamped" to stay within the table size.
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportDataUtils.d.ts","sourceRoot":"","sources":["../src/ViewportDataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,kBAAkB,CAAC;AAEhE,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,MAAM,MAAM,mBAAmB,GAAG,EAAE,CAAC,KAAK,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC;IACrB,IAAI,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAI1E;;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AMG;AACH,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,GAAG,IAAI,GAAG,MAAM,CAEtE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAWjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,CAAC,MAAM,EAAE,MAAM,CAAC,CAQlB"}
@@ -94,13 +94,14 @@ export function getSize(table) {
94
94
  }
95
95
 
96
96
  /**
97
- * Check if a given table is closed. Tree tables don't have an `isClosed` prop,
97
+ * Check if a given widget is closed based on `isClosed` prop.
98
+ * Tree tables and other widgets don't have an `isClosed` prop,
98
99
  * so will always return false.
99
- * @param table The table to check if it is closed.
100
+ * @param table The widget to check if it is closed.
100
101
  */
101
- export function isClosed(table) {
102
- if ('isClosed' in table) {
103
- return table.isClosed;
102
+ export function isClosed(widget) {
103
+ if (widget != null && typeof widget === 'object' && 'isClosed' in widget && typeof widget.isClosed === 'boolean') {
104
+ return widget.isClosed;
104
105
  }
105
106
  return false;
106
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ViewportDataUtils.js","names":["clamp","Log","ITEM_KEY_PREFIX","log","module","createKeyedItemKey","index","concat","createOnTableUpdatedHandler","_ref","deserializeRow","bulkUpdate","onTableUpdated","event","columns","offset","rows","detail","debug","updateKeyMap","Map","forEach","row","offsetInSnapshot","item","key","set","defaultRowDeserializer","reduce","result","col","name","get","generateEmptyKeyedItems","start","end","i","getSize","table","isClosed","size","padFirstAndLastRow","firstRow","viewportSize","padding","tableSize","lastRow","min","max","first","last"],"sources":["../src/ViewportDataUtils.ts"],"sourcesContent":["import type { Key } from 'react';\nimport clamp from 'lodash.clamp';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { type KeyedItem, type ValueOf } from '@deephaven/utils';\n\nexport const ITEM_KEY_PREFIX = 'DH_ITEM_KEY';\n\nexport type OnTableUpdatedEvent = dh.Event<{\n offset: number;\n columns: dh.Column[];\n rows: dh.Row[];\n}>;\n\nexport type RowDeserializer<T> = (row: dh.Row, columns: dh.Column[]) => T;\n\nconst log = Log.module('ViewportDataUtils');\n\n/**\n * Create a `KeyedItem.key` for a given index. The prefix is necessary to avoid\n * collisions with property values in the `item` property that may be used as\n * keys once the item is loaded and rendered.\n * @param index Index to create a key for.\n * @returns A unique key for the given index.\n */\nexport function createKeyedItemKey(index: number): string {\n return `${ITEM_KEY_PREFIX}_${index}`;\n}\n\n/**\n * Creates a handler function for a `dh.Table.EVENT_UPDATED` event. Rows that\n * get passed to the handler will be bulk updated in the given `viewportData`\n * object based on their derived item keys.\n * @param viewportData State object for managing a list of KeyedItem data.\n * @param deserializeRow Converts a DH Row to an item object.\n * @returns Handler function for a `dh.Table.EVENT_UPDATED` event.\n */\nexport function createOnTableUpdatedHandler<T>(\n { bulkUpdate }: { bulkUpdate: (itemMap: Map<Key, KeyedItem<T>>) => void },\n deserializeRow: RowDeserializer<T>\n): (event: OnTableUpdatedEvent) => void {\n /**\n * Handler for a `dh.Table.EVENT_UPDATED` event.\n */\n return function onTableUpdated(event: OnTableUpdatedEvent) {\n const { columns, offset, rows } = event.detail;\n\n log.debug('table updated', event.detail);\n\n const updateKeyMap = new Map<Key, KeyedItem<T>>();\n\n rows.forEach((row, offsetInSnapshot) => {\n const item = deserializeRow(row, columns);\n const key = createKeyedItemKey(offset + offsetInSnapshot);\n updateKeyMap.set(key, { key, item });\n });\n\n log.debug('update keys', updateKeyMap);\n\n bulkUpdate(updateKeyMap);\n };\n}\n\n/**\n * Maps a Row to a key / value object. Keys are mapped ver batim from column\n * names.\n * @param row Row to map to an item.\n * @param columns Columns to map.\n * @returns A key / value object for the row.\n */\nexport function defaultRowDeserializer<T>(\n row: dh.Row,\n columns: dh.Column[]\n): T {\n return columns.reduce((result, col) => {\n // eslint-disable-next-line no-param-reassign\n result[col.name as keyof T] = row.get(col) as ValueOf<T>;\n return result;\n }, {} as T);\n}\n\n/**\n * For windowing to work, the underlying list needs to maintain a KeyedItem for\n * each row in the backing table (even if these rows haven't been loaded yet).\n * This is needed internally by react-spectrum so it can calculate the content\n * area size. This generator can create a range of empty `KeyedItem` objects.\n * @param start The starting index to generate\n * @param end The ending index to generate\n */\nexport function* generateEmptyKeyedItems<T>(\n start: number,\n end: number\n): Generator<KeyedItem<T>, void, unknown> {\n // eslint-disable-next-line no-plusplus\n for (let i = start; i <= end; ++i) {\n yield { key: createKeyedItemKey(i) };\n }\n}\n\n/**\n * Check a Table to see if it is closed before checking its size property. This\n * is important because calling Table.size on a closed table throws an error. If\n * the table is null or closed, return zero. Otherwise, return the current size.\n * @param table The table to check for its size.\n * @returns The size of the table or zero if the table is null or closed.\n */\nexport function getSize(table?: dh.Table | dh.TreeTable | null): number {\n return table == null || isClosed(table) ? 0 : table.size;\n}\n\n/**\n * Check if a given table is closed. Tree tables don't have an `isClosed` prop,\n * so will always return false.\n * @param table The table to check if it is closed.\n */\nexport function isClosed(table: dh.Table | dh.TreeTable): boolean {\n if ('isClosed' in table) {\n return table.isClosed;\n }\n\n return false;\n}\n\n/**\n * Determine the first and last row index for a viewport + extra leading and\n * trailing padding. Values will be \"clamped\" to stay within the table size.\n * @param firstRow Starting row index for the viewport.\n * @param viewportSize Size of the viewport.\n * @param padding Extra rows to add to the viewport. Will be used for leading\n * and trailing rows.\n * @param tableSize Total table size.\n * @returns Tuple containing indices for the first and last row.\n */\nexport function padFirstAndLastRow(\n firstRow: number,\n viewportSize: number,\n padding: number,\n tableSize: number\n): [number, number] {\n const lastRow = firstRow + viewportSize - 1;\n const [min, max] = [0, tableSize - 1];\n\n const first = clamp(firstRow - padding, min, max);\n const last = clamp(lastRow + padding, min, max);\n\n return [first, last];\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,c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AGlD,KAAK,CAAC8C,OAAO,GAAGF,OAAO,EAAEG,GAAG,EAAEC,GAAG,CAAC;EAE/C,OAAO,CAACC,KAAK,EAAEC,IAAI,CAAC;AACtB"}
1
+ {"version":3,"file":"ViewportDataUtils.js","names":["clamp","Log","ITEM_KEY_PREFIX","log","module","createKeyedItemKey","index","concat","createOnTableUpdatedHandler","_ref","deserializeRow","bulkUpdate","onTableUpdated","event","columns","offset","rows","detail","debug","updateKeyMap","Map","forEach","row","offsetInSnapshot","item","key","set","defaultRowDeserializer","reduce","result","col","name","get","generateEmptyKeyedItems","start","end","i","getSize","table","isClosed","size","widget","padFirstAndLastRow","firstRow","viewportSize","padding","tableSize","lastRow","min","max","first","last"],"sources":["../src/ViewportDataUtils.ts"],"sourcesContent":["import type { Key } from 'react';\nimport clamp from 'lodash.clamp';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { type KeyedItem, type ValueOf } from '@deephaven/utils';\n\nexport const ITEM_KEY_PREFIX = 'DH_ITEM_KEY';\n\nexport type OnTableUpdatedEvent = dh.Event<{\n offset: number;\n columns: dh.Column[];\n rows: dh.Row[];\n}>;\n\nexport type RowDeserializer<T> = (row: dh.Row, columns: dh.Column[]) => T;\n\nconst log = Log.module('ViewportDataUtils');\n\n/**\n * Create a `KeyedItem.key` for a given index. The prefix is necessary to avoid\n * collisions with property values in the `item` property that may be used as\n * keys once the item is loaded and rendered.\n * @param index Index to create a key for.\n * @returns A unique key for the given index.\n */\nexport function createKeyedItemKey(index: number): string {\n return `${ITEM_KEY_PREFIX}_${index}`;\n}\n\n/**\n * Creates a handler function for a `dh.Table.EVENT_UPDATED` event. Rows that\n * get passed to the handler will be bulk updated in the given `viewportData`\n * object based on their derived item keys.\n * @param viewportData State object for managing a list of KeyedItem data.\n * @param deserializeRow Converts a DH Row to an item object.\n * @returns Handler function for a `dh.Table.EVENT_UPDATED` event.\n */\nexport function createOnTableUpdatedHandler<T>(\n { bulkUpdate }: { bulkUpdate: (itemMap: Map<Key, KeyedItem<T>>) => void },\n deserializeRow: RowDeserializer<T>\n): (event: OnTableUpdatedEvent) => void {\n /**\n * Handler for a `dh.Table.EVENT_UPDATED` event.\n */\n return function onTableUpdated(event: OnTableUpdatedEvent) {\n const { columns, offset, rows } = event.detail;\n\n log.debug('table updated', event.detail);\n\n const updateKeyMap = new Map<Key, KeyedItem<T>>();\n\n rows.forEach((row, offsetInSnapshot) => {\n const item = deserializeRow(row, columns);\n const key = createKeyedItemKey(offset + offsetInSnapshot);\n updateKeyMap.set(key, { key, item });\n });\n\n log.debug('update keys', updateKeyMap);\n\n bulkUpdate(updateKeyMap);\n };\n}\n\n/**\n * Maps a Row to a key / value object. Keys are mapped ver batim from column\n * names.\n * @param row Row to map to an item.\n * @param columns Columns to map.\n * @returns A key / value object for the row.\n */\nexport function defaultRowDeserializer<T>(\n row: dh.Row,\n columns: dh.Column[]\n): T {\n return columns.reduce((result, col) => {\n // eslint-disable-next-line no-param-reassign\n result[col.name as keyof T] = row.get(col) as ValueOf<T>;\n return result;\n }, {} as T);\n}\n\n/**\n * For windowing to work, the underlying list needs to maintain a KeyedItem for\n * each row in the backing table (even if these rows haven't been loaded yet).\n * This is needed internally by react-spectrum so it can calculate the content\n * area size. This generator can create a range of empty `KeyedItem` objects.\n * @param start The starting index to generate\n * @param end The ending index to generate\n */\nexport function* generateEmptyKeyedItems<T>(\n start: number,\n end: number\n): Generator<KeyedItem<T>, void, unknown> {\n // eslint-disable-next-line no-plusplus\n for (let i = start; i <= end; ++i) {\n yield { key: createKeyedItemKey(i) };\n }\n}\n\n/**\n * Check a Table to see if it is closed before checking its size property. This\n * is important because calling Table.size on a closed table throws an error. If\n * the table is null or closed, return zero. Otherwise, return the current size.\n * @param table The table to check for its size.\n * @returns The size of the table or zero if the table is null or closed.\n */\nexport function getSize(table?: dh.Table | dh.TreeTable | null): number {\n return table == null || isClosed(table) ? 0 : table.size;\n}\n\n/**\n * Check if a given widget is closed based on `isClosed` prop.\n * Tree tables and other widgets don't have an `isClosed` prop,\n * so will always return false.\n * @param table The widget to check if it is closed.\n */\nexport function isClosed(widget: unknown): boolean {\n if (\n widget != null &&\n typeof widget === 'object' &&\n 'isClosed' in widget &&\n typeof widget.isClosed === 'boolean'\n ) {\n return widget.isClosed;\n }\n\n return false;\n}\n\n/**\n * Determine the first and last row index for a viewport + extra leading and\n * trailing padding. Values will be \"clamped\" to stay within the table size.\n * @param firstRow Starting row index for the viewport.\n * @param viewportSize Size of the viewport.\n * @param padding Extra rows to add to the viewport. Will be used for leading\n * and trailing rows.\n * @param tableSize Total table size.\n * @returns Tuple containing indices for the first and last row.\n */\nexport function padFirstAndLastRow(\n firstRow: number,\n viewportSize: number,\n padding: number,\n tableSize: number\n): [number, number] {\n const lastRow = firstRow + viewportSize - 1;\n const [min, max] = [0, tableSize - 1];\n\n const first = clamp(firstRow - padding, min, max);\n const last = clamp(lastRow + padding, min, max);\n\n return [first, last];\n}\n"],"mappings":"AACA,OAAOA,KAAK,MAAM,cAAc;AAEhC,OAAOC,GAAG,MAAM,gBAAgB;AAGhC,OAAO,IAAMC,eAAe,GAAG,aAAa;AAU5C,IAAMC,GAAG,GAAGF,GAAG,CAACG,MAAM,CAAC,mBAAmB,CAAC;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,KAAa,EAAU;EACxD,UAAAC,MAAA,CAAUL,eAAe,OAAAK,MAAA,CAAID,KAAK;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,2BAA2BA,CAAAC,IAAA,EAEzCC,cAAkC,EACI;EAAA,IAFtC;IAAEC;EAAsE,CAAC,GAAAF,IAAA;EAGzE;AACF;AACA;EACE,OAAO,SAASG,cAAcA,CAACC,KAA0B,EAAE;IACzD,IAAM;MAAEC,OAAO;MAAEC,MAAM;MAAEC;IAAK,CAAC,GAAGH,KAAK,CAACI,MAAM;IAE9Cd,GAAG,CAACe,KA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,CAAC,GAAG,CAAC,GAAGA,KAAK,CAACE,IAAI;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASD,QAAQA,CAACE,MAAe,EAAW;EACjD,IACEA,MAAM,IAAI,IAAI,IACd,OAAOA,MAAM,KAAK,QAAQ,IAC1B,UAAU,IAAIA,MAAM,IACpB,OAAOA,MAAM,CAACF,QAAQ,KAAK,SAAS,EACpC;IACA,OAAOE,MAAM,CAACF,QAAQ;EACxB;EAEA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,kBAAkBA,CAChCC,QAAgB,EAChBC,YAAoB,EACpBC,OAAe,EACfC,SAAiB,EACC;EAClB,IAAMC,OAAO,GAAGJ,QAAQ,GAAGC,YAAY,GAAG,CAAC;EAC3C,IAAM,CAACI,GAAG,EAAEC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAEH,SAAS,GAAG,CAAC,CAAC;EAErC,IAAMI,KAAK,GAAGlD,KAAK,CAAC2C,QAAQ,GAAGE,OAAO,EAAEG,GAAG,EAAEC,GAAG,CAAC;EACjD,IAAME,IAAI,GAAGnD,KAAK,CAAC+C,OAAO,GAAGF,OAAO,EAAEG,GAAG,EAAEC,GAAG,CAAC;EAE/C,OAAO,CAACC,KAAK,EAAEC,IAAI,CAAC;AACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/jsapi-utils",
3
- "version": "1.2.1-plotly-rc3.3+cfd3663b",
3
+ "version": "1.3.1-uri.5+18323c82",
4
4
  "description": "Deephaven JSAPI Utils",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -21,16 +21,16 @@
21
21
  "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
22
22
  },
23
23
  "dependencies": {
24
- "@deephaven/filters": "^1.2.1-plotly-rc3.3+cfd3663b",
24
+ "@deephaven/filters": "^1.3.1-uri.5+18323c82",
25
25
  "@deephaven/jsapi-types": "^1.0.0-dev0.39.4",
26
- "@deephaven/log": "^1.2.1-plotly-rc3.3+cfd3663b",
27
- "@deephaven/utils": "^1.2.1-plotly-rc3.3+cfd3663b",
26
+ "@deephaven/log": "^1.3.1-uri.5+18323c82",
27
+ "@deephaven/utils": "^1.3.1-uri.5+18323c82",
28
28
  "lodash.clamp": "^4.0.3",
29
29
  "nanoid": "^5.0.7"
30
30
  },
31
31
  "devDependencies": {
32
- "@deephaven/jsapi-shim": "^1.2.1-plotly-rc3.3+cfd3663b",
33
- "@deephaven/test-utils": "^1.2.1-plotly-rc3.3+cfd3663b"
32
+ "@deephaven/jsapi-shim": "^1.3.1-uri.5+18323c82",
33
+ "@deephaven/test-utils": "^1.3.1-uri.5+18323c82"
34
34
  },
35
35
  "files": [
36
36
  "dist"
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "cfd3663b28e622750b245ee27dd1a3413a737956"
42
+ "gitHead": "18323c82bf67c3fa247cef63e30253b8fe793f4e"
43
43
  }