@deephaven/iris-grid 0.22.3-beta.10 → 0.22.3-beta.15

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":"TableSaver.js","names":["PureComponent","WritableStream","ponyfillWritableStream","dh","Log","memoizeClear","FormatterUtils","PromiseUtils","assertNotNull","IrisGridUtils","log","module","isUpdateEventData","data","added","undefined","assertIsUpdateEventData","Error","TableSaver","csvEscapeString","str","replace","constructor","props","window","isCustomColumnFormatDefined","max","handlePortMessage","bind","handleSnapshotResolved","handleDownloadTimeout","state","gridRanges","gridRangeCounter","rangedSnapshotsTotal","rangedSnapshotCounter","snapshotsTotal","snapshotCounter","snapshotsBuffer","Map","currentSnapshotIndex","snapshotPending","cancelableSnapshots","iframes","useBlobFallback","componentDidMount","getDownloadWorker","then","sw","info","postMessage","catch","error","warn","componentWillUnmount","length","forEach","iframe","remove","streamTimeout","clearTimeout","snapshotHandlerTimeout","createWriterStream","port","useBlob","chunks","encode","TextEncoder","prototype","fileName","streamConfig","write","chunk","header","push","rows","close","blob","Blob","type","link","document","createElement","href","URL","createObjectURL","download","click","abort","cancel","end","startDownload","frozenTable","tableSubscription","snapshotRanges","modelRanges","isDownloading","downloadStartTime","Date","now","table","columns","columnsFromRanges","encodedFileName","encodeURIComponent","escape","messageChannel","MessageChannel","port1","fileWriter","getWriter","writeCsvTable","port2","onmessage","finishDownload","onDownloadCompleted","resetTableSaver","cancelDownload","cancelable","onDownloadCanceled","chunkRows","writeTableHeader","headerString","i","name","startWriteTableBody","Math","floor","DOWNLOAD_CELL_CHUNK","map","range","endRow","startRow","ceil","reduce","total","snapshotCount","makeSnapshot","min","SNAPSHOT_BUFFER_SIZE","writeSnapshot","snapshotIndex","snapshotStartRow","snapshotEndRow","has","n","get","convertSnapshotIntoCsv","delete","updateDownloadProgress","debug2","size","onDownloadProgressUpdate","downloadProgress","estimateTime","snapshot","csvString","snapshotIterator","iterator","formatter","hasNext","next","value","rowIdx","j","hasCustomColumnFormat","getCachedCustomColumnFormatFlag","formatOverride","cellFormat","getFormat","formatString","cellData","getFormattedString","getData","currentGridRange","makeCancelable","RangeSet","ofRange","err","val","readableStreamPulling","makeIframe","setTimeout","STREAM_TIMEOUT","set","SNAPSHOT_HANDLER_TIMEOUT","src","hidden","body","appendChild","render","Promise","reject"],"sources":["../../src/sidebar/TableSaver.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport { WritableStream as ponyfillWritableStream } from 'web-streams-polyfill/ponyfill';\nimport dh, {\n Column,\n Table,\n TableData,\n TableViewportSubscription,\n UpdateEventData,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { GridRange, GridRangeIndex, memoizeClear } from '@deephaven/grid';\n\nimport { Formatter, FormatterUtils } from '@deephaven/jsapi-utils';\nimport {\n CancelablePromise,\n PromiseUtils,\n assertNotNull,\n} from '@deephaven/utils';\nimport IrisGridUtils from '../IrisGridUtils';\n\nconst log = Log.module('TableSaver');\n\ninterface TableSaverProps {\n getDownloadWorker: () => Promise<ServiceWorker>;\n isDownloading: boolean;\n onDownloadCompleted: () => void;\n onDownloadCanceled: () => void;\n onDownloadProgressUpdate: (\n progress: number,\n estimatedTime: number | null\n ) => void;\n formatter: Formatter;\n}\n\nfunction isUpdateEventData(data: TableData): data is UpdateEventData {\n return (data as UpdateEventData).added !== undefined;\n}\n\nfunction assertIsUpdateEventData(\n data: TableData\n): asserts data is UpdateEventData {\n if (!isUpdateEventData(data)) {\n throw new Error('event is not UpdateEventData');\n }\n}\n\nexport default class TableSaver extends PureComponent<\n TableSaverProps,\n Record<string, never>\n> {\n static DOWNLOAD_CELL_CHUNK = 6000;\n\n static SNAPSHOT_BUFFER_SIZE = 5;\n\n static STREAM_TIMEOUT = 8000;\n\n static SNAPSHOT_HANDLER_TIMEOUT = 5;\n\n static defaultProps = {\n getDownloadWorker: (): Promise<never> =>\n Promise.reject(new Error('Download worker not provided')),\n isDownloading: false,\n onDownloadCompleted: (): void => undefined,\n onDownloadCanceled: (): void => undefined,\n onDownloadProgressUpdate: (): void => undefined,\n };\n\n static csvEscapeString(str: string): string {\n return `\"${str.replace(/\"/g, '\"\"')}\"`;\n }\n\n constructor(props: TableSaverProps) {\n super(props);\n\n this.handlePortMessage = this.handlePortMessage.bind(this);\n this.handleSnapshotResolved = this.handleSnapshotResolved.bind(this);\n this.handleDownloadTimeout = this.handleDownloadTimeout.bind(this);\n\n this.state = {};\n\n this.gridRanges = [];\n this.gridRangeCounter = 0;\n this.rangedSnapshotsTotal = [];\n this.rangedSnapshotCounter = 0;\n\n this.snapshotsTotal = 0;\n this.snapshotCounter = 0;\n this.snapshotsBuffer = new Map();\n\n this.currentSnapshotIndex = 0;\n this.snapshotPending = 0;\n this.cancelableSnapshots = [];\n\n // WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead\n this.WritableStream = window.WritableStream ?? ponyfillWritableStream;\n\n // Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.\n // Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.\n // If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.\n // Issue ticket on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=638494\n\n this.iframes = [];\n\n this.useBlobFallback = false;\n }\n\n componentDidMount(): void {\n const { getDownloadWorker } = this.props;\n getDownloadWorker()\n .then(sw => {\n log.info('found active service worker');\n this.sw = sw;\n this.sw.postMessage('ping'); // just to activate the service worker\n })\n .catch(error => {\n // if service worker is not available, use blob as fallback to download table csv\n log.warn('Download csv is not optimized.', error);\n this.useBlobFallback = true;\n });\n }\n\n componentWillUnmount(): void {\n if (this.iframes.length > 0) {\n this.iframes.forEach(iframe => {\n iframe.remove();\n });\n }\n if (this.streamTimeout) clearTimeout(this.streamTimeout);\n if (this.snapshotHandlerTimeout) clearTimeout(this.snapshotHandlerTimeout);\n }\n\n sw?: ServiceWorker;\n\n port?: MessagePort;\n\n fileWriter?: WritableStreamDefaultWriter<unknown>;\n\n table?: Table;\n\n tableSubscription?: TableViewportSubscription;\n\n columns?: Column[];\n\n fileName?: string;\n\n chunkRows?: number;\n\n gridRanges: GridRange[];\n\n gridRangeCounter?: number;\n\n rangedSnapshotsTotal: number[];\n\n rangedSnapshotCounter?: number;\n\n snapshotsTotal: number;\n\n snapshotCounter: number;\n\n snapshotsBuffer: Map<number, UpdateEventData>;\n\n currentSnapshotIndex: number;\n\n snapshotPending: number;\n\n cancelableSnapshots: (CancelablePromise<unknown> | null)[];\n\n // WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead\n\n // TODO: Fix type error\n WritableStream = window.WritableStream ?? ponyfillWritableStream;\n // WritableStream: typeof window.WritableStream | typeof ponyfillWritableStream;\n\n // Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.\n // Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.\n // If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.\n // Issue ticket on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=638494\n streamTimeout?: ReturnType<typeof setTimeout>;\n\n snapshotHandlerTimeout?: ReturnType<typeof setTimeout>;\n\n downloadStartTime?: number;\n\n iframes: HTMLIFrameElement[];\n\n useBlobFallback: boolean;\n\n getCachedCustomColumnFormatFlag = memoizeClear(\n FormatterUtils.isCustomColumnFormatDefined,\n { max: 10000 }\n );\n\n createWriterStream(\n port: MessagePort\n ): WritableStream<{\n rows?: string | undefined;\n header?: string | undefined;\n }> {\n // use blob fall back if it's safari\n const useBlob = this.useBlobFallback;\n const chunks = [] as BlobPart[];\n let encode: ((input?: string) => Uint8Array) | null = null;\n if (useBlob) {\n encode = TextEncoder.prototype.encode.bind(new TextEncoder());\n }\n const { fileName } = this;\n\n const streamConfig = {} as UnderlyingSink<{\n rows?: string | undefined;\n header?: string | undefined;\n }>;\n if (useBlob) {\n streamConfig.write = (chunk: { rows?: string; header?: string }) => {\n assertNotNull(encode);\n if (chunk.header !== undefined) {\n chunks.push(encode(chunk.header));\n }\n if (chunk.rows !== undefined) {\n chunks.push(encode(chunk.rows));\n }\n };\n streamConfig.close = () => {\n assertNotNull(fileName);\n const blob = new Blob(chunks, {\n type: 'application/octet-stream; charset=utf-8',\n });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = fileName;\n link.click();\n };\n streamConfig.abort = () => {\n port.postMessage({ cancel: true });\n port.close();\n };\n } else {\n streamConfig.write = (chunk: unknown) => {\n port.postMessage(chunk);\n };\n streamConfig.close = () => {\n port.postMessage({ end: true });\n port.close();\n };\n streamConfig.abort = () => {\n port.postMessage({ cancel: true });\n port.close();\n };\n }\n\n return new this.WritableStream(streamConfig);\n }\n\n startDownload(\n fileName: string,\n frozenTable: Table,\n tableSubscription: TableViewportSubscription,\n snapshotRanges: GridRange[],\n modelRanges: GridRange[]\n ): void {\n // don't trigger another download when a download is ongoing\n const { isDownloading } = this.props;\n if (isDownloading) {\n return;\n }\n\n this.downloadStartTime = Date.now();\n log.info(`start downloading ${fileName}`);\n\n this.table = frozenTable;\n this.columns = IrisGridUtils.columnsFromRanges(\n modelRanges,\n frozenTable.columns\n );\n this.tableSubscription = tableSubscription;\n this.gridRanges = snapshotRanges;\n\n // Make filename RFC5987 compatible\n const encodedFileName = encodeURIComponent(fileName.replace(/\\//g, ':'))\n .replace(/['()]/g, escape)\n .replace(/\\*/g, '%2A');\n\n const messageChannel = new MessageChannel();\n this.port = messageChannel.port1;\n this.fileName = fileName;\n this.fileWriter = this.createWriterStream(this.port).getWriter();\n\n // if the browser doesn't support stream or there's no active service worker, use blobs for table download\n if (this.useBlobFallback) {\n this.writeCsvTable();\n return;\n }\n\n if (this.sw) {\n // send file name and port to service worker\n this.sw.postMessage({ encodedFileName }, [messageChannel.port2]);\n }\n this.port.onmessage = this.handlePortMessage;\n }\n\n finishDownload(): void {\n if (this.table) {\n this.table.close();\n }\n if (this.tableSubscription) {\n this.tableSubscription.close();\n }\n if (this.fileWriter) {\n this.fileWriter.close();\n }\n\n const { onDownloadCompleted } = this.props;\n onDownloadCompleted();\n this.resetTableSaver();\n\n if (this.downloadStartTime !== undefined) {\n log.info(\n `download finished, total elapsed time ${\n (Date.now() - this.downloadStartTime) / 1000\n } seconds`\n );\n }\n }\n\n cancelDownload(): void {\n if (this.table) {\n this.table.close();\n }\n if (this.tableSubscription) {\n this.tableSubscription.close();\n }\n if (this.fileWriter) {\n this.fileWriter.abort();\n }\n\n this.cancelableSnapshots.forEach(cancelable => {\n if (cancelable) {\n cancelable.catch(() => null);\n cancelable.cancel();\n }\n });\n const { onDownloadCanceled } = this.props;\n onDownloadCanceled();\n this.resetTableSaver();\n }\n\n resetTableSaver(): void {\n this.table = undefined;\n this.tableSubscription = undefined;\n this.columns = undefined;\n this.chunkRows = undefined;\n\n this.gridRanges = [];\n this.gridRangeCounter = 0;\n this.rangedSnapshotsTotal = [];\n this.rangedSnapshotCounter = 0;\n\n this.snapshotsTotal = 0;\n this.snapshotCounter = 0;\n this.snapshotsBuffer = new Map();\n\n this.currentSnapshotIndex = 0;\n this.snapshotPending = 0;\n this.cancelableSnapshots = [];\n\n if (this.streamTimeout != null) {\n clearTimeout(this.streamTimeout);\n }\n\n if (this.snapshotHandlerTimeout != null) {\n clearTimeout(this.snapshotHandlerTimeout);\n }\n this.streamTimeout = undefined;\n this.snapshotHandlerTimeout = undefined;\n }\n\n handleDownloadTimeout(): void {\n log.info('download canceled');\n this.cancelDownload();\n }\n\n writeTableHeader(): void {\n let headerString = '';\n if (this.columns) {\n for (let i = 0; i < this.columns.length; i += 1) {\n headerString += this.columns[i].name;\n headerString += i === this.columns.length - 1 ? '\\n' : ',';\n }\n }\n this.fileWriter?.write({ header: headerString }).then(() => null);\n }\n\n startWriteTableBody(): void {\n if (this.columns && this.gridRanges != null) {\n this.chunkRows = Math.floor(\n TableSaver.DOWNLOAD_CELL_CHUNK / this.columns.length\n );\n\n this.rangedSnapshotsTotal = this.gridRanges.map((range: GridRange) => {\n assertNotNull(range.endRow);\n assertNotNull(range.startRow);\n assertNotNull(this.chunkRows);\n\n return Math.ceil((range.endRow - range.startRow + 1) / this.chunkRows);\n });\n this.snapshotsTotal = this.rangedSnapshotsTotal.reduce(\n (total: number, snapshotCount: number) => total + snapshotCount\n );\n\n log.info(`start writing table, total snapshots: `, this.snapshotsTotal);\n\n this.makeSnapshot(\n Math.min(TableSaver.SNAPSHOT_BUFFER_SIZE, this.snapshotsTotal)\n );\n }\n }\n\n writeCsvTable(): void {\n this.writeTableHeader();\n this.startWriteTableBody();\n }\n\n writeSnapshot(\n snapshotIndex: number,\n snapshotStartRow: GridRangeIndex,\n snapshotEndRow: GridRangeIndex\n ): void {\n if (this.currentSnapshotIndex === snapshotIndex && this.fileWriter) {\n while (this.snapshotsBuffer.has(this.currentSnapshotIndex)) {\n const n = this.snapshotsBuffer.get(this.currentSnapshotIndex);\n assertNotNull(n);\n this.fileWriter.write({\n rows: this.convertSnapshotIntoCsv(n),\n });\n this.snapshotsBuffer.delete(this.currentSnapshotIndex);\n this.currentSnapshotIndex += 1;\n\n this.updateDownloadProgress(snapshotIndex);\n }\n if (\n this.snapshotsTotal &&\n this.currentSnapshotIndex >= this.snapshotsTotal\n ) {\n this.finishDownload();\n return;\n }\n }\n\n if (\n this.snapshotCounter &&\n this.snapshotsTotal &&\n this.snapshotCounter < this.snapshotsTotal\n ) {\n log.debug2(\n `\n current range index: ${this.gridRangeCounter}, \n snapshotIndexCounter: ${this.snapshotCounter}, \n currentRangedSnapshotIndex : ${this.rangedSnapshotCounter}, \n snapshotpending: ${this.snapshotPending}, \n buffered ${this.snapshotsBuffer.size}\n making ${Math.min(\n TableSaver.SNAPSHOT_BUFFER_SIZE -\n this.snapshotsBuffer.size -\n this.snapshotPending,\n this.snapshotsTotal - this.snapshotCounter\n )} more snapshots\n `\n );\n this.makeSnapshot(\n Math.min(\n TableSaver.SNAPSHOT_BUFFER_SIZE -\n this.snapshotsBuffer.size -\n this.snapshotPending,\n this.snapshotsTotal - this.snapshotCounter\n )\n );\n }\n }\n\n updateDownloadProgress(snapshotIndex: GridRangeIndex): void {\n if (\n snapshotIndex != null &&\n this.snapshotsTotal != null &&\n this.downloadStartTime != null\n ) {\n const { onDownloadProgressUpdate } = this.props;\n const downloadProgress = Math.floor(\n (snapshotIndex * 100) / this.snapshotsTotal\n );\n const estimateTime =\n snapshotIndex > 1\n ? Math.floor(\n ((Date.now() - this.downloadStartTime) *\n (this.snapshotsTotal - snapshotIndex)) /\n snapshotIndex /\n 1000\n )\n : null;\n\n onDownloadProgressUpdate(downloadProgress, estimateTime);\n }\n }\n\n convertSnapshotIntoCsv(snapshot: UpdateEventData): string {\n let csvString = '';\n const snapshotIterator = snapshot.added.iterator();\n const { formatter } = this.props;\n\n const rows = [];\n while (snapshotIterator.hasNext()) {\n rows.push(snapshotIterator.next().value);\n }\n\n assertNotNull(this.columns);\n\n for (let i = 0; i < rows.length; i += 1) {\n const rowIdx = rows[i];\n for (let j = 0; j < this.columns.length; j += 1) {\n const { type, name } = this.columns[j];\n const hasCustomColumnFormat = this.getCachedCustomColumnFormatFlag(\n formatter,\n name,\n type\n );\n let formatOverride = null;\n if (!hasCustomColumnFormat) {\n const cellFormat = snapshot.getFormat(rowIdx, this.columns[j]);\n formatOverride = cellFormat?.formatString != null ? cellFormat : null;\n }\n let cellData = null;\n if (formatOverride) {\n cellData = formatter.getFormattedString(\n snapshot.getData(rowIdx, this.columns[j]),\n type,\n name,\n formatOverride\n );\n } else {\n cellData = formatter.getFormattedString(\n snapshot.getData(rowIdx, this.columns[j]),\n type,\n name\n );\n }\n csvString += TableSaver.csvEscapeString(cellData);\n csvString += j === this.columns?.length - 1 ? '\\n' : ',';\n }\n }\n\n return csvString;\n }\n\n makeSnapshot(n: number): void {\n if (n <= 0) {\n return;\n }\n assertNotNull(this.gridRangeCounter);\n let i = 0;\n let currentGridRange = this.gridRanges[this.gridRangeCounter];\n\n assertNotNull(this.tableSubscription);\n assertNotNull(this.columns);\n while (i < n) {\n assertNotNull(currentGridRange);\n assertNotNull(currentGridRange.startRow);\n assertNotNull(currentGridRange.endRow);\n assertNotNull(this.rangedSnapshotCounter);\n assertNotNull(this.chunkRows);\n const snapshotStartRow =\n currentGridRange.startRow + this.rangedSnapshotCounter * this.chunkRows;\n const snapshotEndRow = Math.min(\n snapshotStartRow + this.chunkRows - 1,\n currentGridRange.endRow\n );\n\n const snapshotIndex = this.snapshotCounter;\n this.cancelableSnapshots.push(\n PromiseUtils.makeCancelable(\n this.tableSubscription\n .snapshot(\n dh.RangeSet.ofRange(snapshotStartRow, snapshotEndRow),\n this.columns\n )\n .then(snapshot => {\n assertIsUpdateEventData(snapshot);\n this.handleSnapshotResolved(\n snapshot,\n snapshotIndex,\n snapshotStartRow,\n snapshotEndRow\n );\n\n return snapshotIndex;\n })\n .catch(err => {\n log.error(err);\n }),\n val => {\n log.info(`snapshot ${val} has been canceled`);\n }\n )\n );\n\n this.rangedSnapshotCounter += 1;\n this.snapshotCounter += 1;\n this.snapshotPending += 1;\n\n if (\n this.rangedSnapshotCounter >=\n this.rangedSnapshotsTotal[this.gridRangeCounter]\n ) {\n this.gridRangeCounter += 1;\n this.rangedSnapshotCounter = 0;\n currentGridRange = this.gridRanges[this.gridRangeCounter];\n }\n i += 1;\n }\n }\n\n handlePortMessage({\n data,\n }: MessageEvent<{\n download: unknown;\n readableStreamPulling: unknown;\n }>): void {\n const { download, readableStreamPulling } = data;\n if (this.useBlobFallback) {\n return;\n }\n if (download != null) {\n this.makeIframe(`${download}`);\n this.writeCsvTable();\n }\n if (readableStreamPulling != null) {\n if (!this.useBlobFallback) {\n if (this.streamTimeout != null) {\n clearTimeout(this.streamTimeout);\n }\n this.streamTimeout = setTimeout(\n this.handleDownloadTimeout,\n TableSaver.STREAM_TIMEOUT\n );\n }\n }\n }\n\n handleSnapshotResolved(\n snapshot: UpdateEventData,\n snapshotIndex: number,\n snapshotStartRow: GridRangeIndex,\n snapshotEndRow: GridRangeIndex\n ): void {\n // use time out to break writeSnapshot into an individual task in browser with timeout, so there's window for the browser to update table in needed.\n this.snapshotHandlerTimeout = setTimeout(() => {\n this.snapshotsBuffer.set(snapshotIndex, snapshot);\n this.snapshotPending -= 1;\n this.writeSnapshot(snapshotIndex, snapshotStartRow, snapshotEndRow);\n this.cancelableSnapshots[snapshotIndex] = null;\n }, TableSaver.SNAPSHOT_HANDLER_TIMEOUT);\n }\n\n makeIframe(src: string): void {\n // make a return value and make it static method\n const iframe = document.createElement('iframe');\n iframe.hidden = true;\n iframe.src = `download/${src}`;\n iframe.name = 'iframe';\n document.body.appendChild(iframe);\n this.iframes.push(iframe);\n }\n\n render(): null {\n return null;\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,OAA9B;AACA,SAASC,cAAc,IAAIC,sBAA3B,QAAyD,+BAAzD;AACA,OAAOC,EAAP,MAMO,uBANP;AAOA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAAoCC,YAApC,QAAwD,iBAAxD;AAEA,SAAoBC,cAApB,QAA0C,wBAA1C;AACA,SAEEC,YAFF,EAGEC,aAHF,QAIO,kBAJP;OAKOC,a;AAEP,IAAMC,GAAG,GAAGN,GAAG,CAACO,MAAJ,CAAW,YAAX,CAAZ;;AAcA,SAASC,iBAAT,CAA2BC,IAA3B,EAAqE;EACnE,OAAQA,IAAD,CAA0BC,KAA1B,KAAoCC,SAA3C;AACD;;AAED,SAASC,uBAAT,CACEH,IADF,EAEmC;EACjC,IAAI,CAACD,iBAAiB,CAACC,IAAD,CAAtB,EAA8B;IAC5B,MAAM,IAAII,KAAJ,CAAU,8BAAV,CAAN;EACD;AACF;;AAED,eAAe,MAAMC,UAAN,SAAyBlB,aAAzB,CAGb;EAkBsB,OAAfmB,eAAe,CAACC,GAAD,EAAsB;IAC1C,mBAAWA,GAAG,CAACC,OAAJ,CAAY,IAAZ,EAAkB,IAAlB,CAAX;EACD;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CAACkI,MAAP,GAAgB,IAAhB;IACAlI,MAAM,CAACiI,GAAP,sBAAyBA,GAAzB;IACAjI,MAAM,CAACmE,IAAP,GAAc,QAAd;IACA3C,QAAQ,CAAC2G,IAAT,CAAcC,WAAd,CAA0BpI,MAA1B;IACA,KAAKd,OAAL,CAAa+B,IAAb,CAAkBjB,MAAlB;EACD;;EAEDqI,MAAM,GAAS;IACb,OAAO,IAAP;EACD;;AA/mBD;;gBAHmB5K,U,yBAIU,I;;gBAJVA,U,0BAMW,C;;gBANXA,U,oBAQK,I;;gBARLA,U,8BAUe,C;;gBAVfA,U,kBAYG;EACpB4B,iBAAiB,EAAE,MACjBiJ,OAAO,CAACC,MAAR,CAAe,IAAI/K,KAAJ,CAAU,8BAAV,CAAf,CAFkB;EAGpB+E,aAAa,EAAE,KAHK;EAIpBmB,mBAAmB,EAAE,MAAYpG,SAJb;EAKpBwG,kBAAkB,EAAE,MAAYxG,SALZ;EAMpByI,wBAAwB,EAAE,MAAYzI;AANlB,C"}
1
+ {"version":3,"file":"TableSaver.js","names":["PureComponent","WritableStream","ponyfillWritableStream","dh","Log","memoizeClear","FormatterUtils","TableUtils","PromiseUtils","assertNotNull","IrisGridUtils","log","module","UNFORMATTED_DATE_PATTERN","isUpdateEventData","data","added","undefined","assertIsUpdateEventData","Error","TableSaver","csvEscapeString","str","replace","constructor","props","window","isCustomColumnFormatDefined","max","handlePortMessage","bind","handleSnapshotResolved","handleDownloadTimeout","state","gridRanges","gridRangeCounter","rangedSnapshotsTotal","rangedSnapshotCounter","includeColumnHeaders","useUnformattedValues","snapshotsTotal","snapshotCounter","snapshotsBuffer","Map","currentSnapshotIndex","snapshotPending","cancelableSnapshots","iframes","useBlobFallback","componentDidMount","getDownloadWorker","then","sw","info","postMessage","catch","error","warn","componentWillUnmount","length","forEach","iframe","remove","streamTimeout","clearTimeout","snapshotHandlerTimeout","createWriterStream","port","useBlob","chunks","encode","TextEncoder","prototype","fileName","streamConfig","write","chunk","header","push","rows","close","blob","Blob","type","link","document","createElement","href","URL","createObjectURL","download","click","abort","cancel","end","startDownload","frozenTable","tableSubscription","snapshotRanges","modelRanges","isDownloading","downloadStartTime","Date","now","table","columns","columnsFromRanges","encodedFileName","encodeURIComponent","escape","messageChannel","MessageChannel","port1","fileWriter","getWriter","writeCsvTable","port2","onmessage","finishDownload","onDownloadCompleted","resetTableSaver","cancelDownload","cancelable","onDownloadCanceled","chunkRows","writeTableHeader","headerString","i","name","startWriteTableBody","Math","floor","DOWNLOAD_CELL_CHUNK","map","range","endRow","startRow","ceil","reduce","total","snapshotCount","makeSnapshot","min","SNAPSHOT_BUFFER_SIZE","writeSnapshot","snapshotIndex","snapshotStartRow","snapshotEndRow","has","n","get","convertSnapshotIntoCsv","delete","updateDownloadProgress","debug2","size","onDownloadProgressUpdate","downloadProgress","estimateTime","snapshot","csvString","snapshotIterator","iterator","formatter","hasNext","next","value","rowIdx","j","cellData","getData","isDateType","i18n","DateTimeFormat","format","TimeZone","getTimeZone","timeZone","toString","hasCustomColumnFormat","getCachedCustomColumnFormatFlag","formatOverride","cellFormat","getFormat","formatString","getFormattedString","currentGridRange","makeCancelable","RangeSet","ofRange","err","val","readableStreamPulling","makeIframe","setTimeout","STREAM_TIMEOUT","set","SNAPSHOT_HANDLER_TIMEOUT","src","hidden","body","appendChild","render","Promise","reject"],"sources":["../../src/sidebar/TableSaver.tsx"],"sourcesContent":["import { PureComponent } from 'react';\nimport { WritableStream as ponyfillWritableStream } from 'web-streams-polyfill/ponyfill';\nimport dh, {\n Column,\n DateWrapper,\n Table,\n TableData,\n TableViewportSubscription,\n UpdateEventData,\n} from '@deephaven/jsapi-shim';\nimport Log from '@deephaven/log';\nimport { GridRange, GridRangeIndex, memoizeClear } from '@deephaven/grid';\n\nimport { Formatter, FormatterUtils, TableUtils } from '@deephaven/jsapi-utils';\nimport {\n CancelablePromise,\n PromiseUtils,\n assertNotNull,\n} from '@deephaven/utils';\nimport IrisGridUtils from '../IrisGridUtils';\n\nconst log = Log.module('TableSaver');\n\nconst UNFORMATTED_DATE_PATTERN = `yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z`;\n\ninterface TableSaverProps {\n getDownloadWorker: () => Promise<ServiceWorker>;\n isDownloading: boolean;\n onDownloadCompleted: () => void;\n onDownloadCanceled: () => void;\n onDownloadProgressUpdate: (\n progress: number,\n estimatedTime: number | null\n ) => void;\n formatter: Formatter;\n}\n\nfunction isUpdateEventData(data: TableData): data is UpdateEventData {\n return (data as UpdateEventData).added !== undefined;\n}\n\nfunction assertIsUpdateEventData(\n data: TableData\n): asserts data is UpdateEventData {\n if (!isUpdateEventData(data)) {\n throw new Error('event is not UpdateEventData');\n }\n}\n\nexport default class TableSaver extends PureComponent<\n TableSaverProps,\n Record<string, never>\n> {\n static DOWNLOAD_CELL_CHUNK = 6000;\n\n static SNAPSHOT_BUFFER_SIZE = 5;\n\n static STREAM_TIMEOUT = 8000;\n\n static SNAPSHOT_HANDLER_TIMEOUT = 5;\n\n static defaultProps = {\n getDownloadWorker: (): Promise<never> =>\n Promise.reject(new Error('Download worker not provided')),\n isDownloading: false,\n onDownloadCompleted: (): void => undefined,\n onDownloadCanceled: (): void => undefined,\n onDownloadProgressUpdate: (): void => undefined,\n };\n\n static csvEscapeString(str: string): string {\n return `\"${str.replace(/\"/g, '\"\"')}\"`;\n }\n\n constructor(props: TableSaverProps) {\n super(props);\n\n this.handlePortMessage = this.handlePortMessage.bind(this);\n this.handleSnapshotResolved = this.handleSnapshotResolved.bind(this);\n this.handleDownloadTimeout = this.handleDownloadTimeout.bind(this);\n\n this.state = {};\n\n this.gridRanges = [];\n this.gridRangeCounter = 0;\n this.rangedSnapshotsTotal = [];\n this.rangedSnapshotCounter = 0;\n\n this.includeColumnHeaders = true;\n this.useUnformattedValues = false;\n\n this.snapshotsTotal = 0;\n this.snapshotCounter = 0;\n this.snapshotsBuffer = new Map();\n\n this.currentSnapshotIndex = 0;\n this.snapshotPending = 0;\n this.cancelableSnapshots = [];\n\n // WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead\n this.WritableStream = window.WritableStream ?? ponyfillWritableStream;\n\n // Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.\n // Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.\n // If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.\n // Issue ticket on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=638494\n\n this.iframes = [];\n\n this.useBlobFallback = false;\n }\n\n componentDidMount(): void {\n const { getDownloadWorker } = this.props;\n getDownloadWorker()\n .then(sw => {\n log.info('found active service worker');\n this.sw = sw;\n this.sw.postMessage('ping'); // just to activate the service worker\n })\n .catch(error => {\n // if service worker is not available, use blob as fallback to download table csv\n log.warn('Download csv is not optimized.', error);\n this.useBlobFallback = true;\n });\n }\n\n componentWillUnmount(): void {\n if (this.iframes.length > 0) {\n this.iframes.forEach(iframe => {\n iframe.remove();\n });\n }\n if (this.streamTimeout) clearTimeout(this.streamTimeout);\n if (this.snapshotHandlerTimeout) clearTimeout(this.snapshotHandlerTimeout);\n }\n\n sw?: ServiceWorker;\n\n port?: MessagePort;\n\n fileWriter?: WritableStreamDefaultWriter<unknown>;\n\n table?: Table;\n\n tableSubscription?: TableViewportSubscription;\n\n columns?: Column[];\n\n fileName?: string;\n\n includeColumnHeaders: boolean;\n\n useUnformattedValues: boolean;\n\n chunkRows?: number;\n\n gridRanges: GridRange[];\n\n gridRangeCounter?: number;\n\n rangedSnapshotsTotal: number[];\n\n rangedSnapshotCounter?: number;\n\n snapshotsTotal: number;\n\n snapshotCounter: number;\n\n snapshotsBuffer: Map<number, UpdateEventData>;\n\n currentSnapshotIndex: number;\n\n snapshotPending: number;\n\n cancelableSnapshots: (CancelablePromise<unknown> | null)[];\n\n // WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead\n\n // TODO: Fix type error\n WritableStream = window.WritableStream ?? ponyfillWritableStream;\n // WritableStream: typeof window.WritableStream | typeof ponyfillWritableStream;\n\n // Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.\n // Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.\n // If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.\n // Issue ticket on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=638494\n streamTimeout?: ReturnType<typeof setTimeout>;\n\n snapshotHandlerTimeout?: ReturnType<typeof setTimeout>;\n\n downloadStartTime?: number;\n\n iframes: HTMLIFrameElement[];\n\n useBlobFallback: boolean;\n\n getCachedCustomColumnFormatFlag = memoizeClear(\n FormatterUtils.isCustomColumnFormatDefined,\n { max: 10000 }\n );\n\n createWriterStream(\n port: MessagePort\n ): WritableStream<{\n rows?: string | undefined;\n header?: string | undefined;\n }> {\n // use blob fall back if it's safari\n const useBlob = this.useBlobFallback;\n const chunks = [] as BlobPart[];\n let encode: ((input?: string) => Uint8Array) | null = null;\n if (useBlob) {\n encode = TextEncoder.prototype.encode.bind(new TextEncoder());\n }\n const { fileName } = this;\n\n const streamConfig = {} as UnderlyingSink<{\n rows?: string | undefined;\n header?: string | undefined;\n }>;\n if (useBlob) {\n streamConfig.write = (chunk: { rows?: string; header?: string }) => {\n assertNotNull(encode);\n if (chunk.header !== undefined) {\n chunks.push(encode(chunk.header));\n }\n if (chunk.rows !== undefined) {\n chunks.push(encode(chunk.rows));\n }\n };\n streamConfig.close = () => {\n assertNotNull(fileName);\n const blob = new Blob(chunks, {\n type: 'application/octet-stream; charset=utf-8',\n });\n const link = document.createElement('a');\n link.href = URL.createObjectURL(blob);\n link.download = fileName;\n link.click();\n };\n streamConfig.abort = () => {\n port.postMessage({ cancel: true });\n port.close();\n };\n } else {\n streamConfig.write = (chunk: unknown) => {\n port.postMessage(chunk);\n };\n streamConfig.close = () => {\n port.postMessage({ end: true });\n port.close();\n };\n streamConfig.abort = () => {\n port.postMessage({ cancel: true });\n port.close();\n };\n }\n\n return new this.WritableStream(streamConfig);\n }\n\n startDownload(\n fileName: string,\n frozenTable: Table,\n tableSubscription: TableViewportSubscription,\n snapshotRanges: GridRange[],\n modelRanges: GridRange[],\n includeColumnHeaders: boolean,\n useUnformattedValues: boolean\n ): void {\n // don't trigger another download when a download is ongoing\n const { isDownloading } = this.props;\n if (isDownloading) {\n return;\n }\n\n this.downloadStartTime = Date.now();\n log.info(`start downloading ${fileName}`);\n\n this.table = frozenTable;\n this.columns = IrisGridUtils.columnsFromRanges(\n modelRanges,\n frozenTable.columns\n );\n this.tableSubscription = tableSubscription;\n this.gridRanges = snapshotRanges;\n this.includeColumnHeaders = includeColumnHeaders;\n this.useUnformattedValues = useUnformattedValues;\n\n // Make filename RFC5987 compatible\n const encodedFileName = encodeURIComponent(fileName.replace(/\\//g, ':'))\n .replace(/['()]/g, escape)\n .replace(/\\*/g, '%2A');\n\n const messageChannel = new MessageChannel();\n this.port = messageChannel.port1;\n this.fileName = fileName;\n this.fileWriter = this.createWriterStream(this.port).getWriter();\n\n // if the browser doesn't support stream or there's no active service worker, use blobs for table download\n if (this.useBlobFallback) {\n this.writeCsvTable(includeColumnHeaders);\n return;\n }\n\n if (this.sw) {\n // send file name and port to service worker\n this.sw.postMessage({ encodedFileName }, [messageChannel.port2]);\n }\n this.port.onmessage = this.handlePortMessage;\n }\n\n finishDownload(): void {\n if (this.table) {\n this.table.close();\n }\n if (this.tableSubscription) {\n this.tableSubscription.close();\n }\n if (this.fileWriter) {\n this.fileWriter.close();\n }\n\n const { onDownloadCompleted } = this.props;\n onDownloadCompleted();\n this.resetTableSaver();\n\n if (this.downloadStartTime !== undefined) {\n log.info(\n `download finished, total elapsed time ${\n (Date.now() - this.downloadStartTime) / 1000\n } seconds`\n );\n }\n }\n\n cancelDownload(): void {\n if (this.table) {\n this.table.close();\n }\n if (this.tableSubscription) {\n this.tableSubscription.close();\n }\n if (this.fileWriter) {\n this.fileWriter.abort();\n }\n\n this.cancelableSnapshots.forEach(cancelable => {\n if (cancelable) {\n cancelable.catch(() => null);\n cancelable.cancel();\n }\n });\n const { onDownloadCanceled } = this.props;\n onDownloadCanceled();\n this.resetTableSaver();\n }\n\n resetTableSaver(): void {\n this.table = undefined;\n this.tableSubscription = undefined;\n this.columns = undefined;\n this.chunkRows = undefined;\n\n this.gridRanges = [];\n this.gridRangeCounter = 0;\n this.rangedSnapshotsTotal = [];\n this.rangedSnapshotCounter = 0;\n\n this.includeColumnHeaders = true;\n this.useUnformattedValues = false;\n\n this.snapshotsTotal = 0;\n this.snapshotCounter = 0;\n this.snapshotsBuffer = new Map();\n\n this.currentSnapshotIndex = 0;\n this.snapshotPending = 0;\n this.cancelableSnapshots = [];\n\n if (this.streamTimeout != null) {\n clearTimeout(this.streamTimeout);\n }\n\n if (this.snapshotHandlerTimeout != null) {\n clearTimeout(this.snapshotHandlerTimeout);\n }\n this.streamTimeout = undefined;\n this.snapshotHandlerTimeout = undefined;\n }\n\n handleDownloadTimeout(): void {\n log.info('download canceled');\n this.cancelDownload();\n }\n\n writeTableHeader(): void {\n let headerString = '';\n if (this.columns) {\n for (let i = 0; i < this.columns.length; i += 1) {\n headerString += this.columns[i].name;\n headerString += i === this.columns.length - 1 ? '\\n' : ',';\n }\n }\n this.fileWriter?.write({ header: headerString }).then(() => null);\n }\n\n startWriteTableBody(): void {\n if (this.columns && this.gridRanges != null) {\n this.chunkRows = Math.floor(\n TableSaver.DOWNLOAD_CELL_CHUNK / this.columns.length\n );\n\n this.rangedSnapshotsTotal = this.gridRanges.map((range: GridRange) => {\n assertNotNull(range.endRow);\n assertNotNull(range.startRow);\n assertNotNull(this.chunkRows);\n\n return Math.ceil((range.endRow - range.startRow + 1) / this.chunkRows);\n });\n this.snapshotsTotal = this.rangedSnapshotsTotal.reduce(\n (total: number, snapshotCount: number) => total + snapshotCount\n );\n\n log.info(`start writing table, total snapshots: `, this.snapshotsTotal);\n\n this.makeSnapshot(\n Math.min(TableSaver.SNAPSHOT_BUFFER_SIZE, this.snapshotsTotal)\n );\n }\n }\n\n writeCsvTable(includeColumnHeaders: boolean): void {\n if (includeColumnHeaders) {\n this.writeTableHeader();\n }\n this.startWriteTableBody();\n }\n\n writeSnapshot(\n snapshotIndex: number,\n snapshotStartRow: GridRangeIndex,\n snapshotEndRow: GridRangeIndex\n ): void {\n if (this.currentSnapshotIndex === snapshotIndex && this.fileWriter) {\n while (this.snapshotsBuffer.has(this.currentSnapshotIndex)) {\n const n = this.snapshotsBuffer.get(this.currentSnapshotIndex);\n assertNotNull(n);\n this.fileWriter.write({\n rows: this.convertSnapshotIntoCsv(n),\n });\n this.snapshotsBuffer.delete(this.currentSnapshotIndex);\n this.currentSnapshotIndex += 1;\n\n this.updateDownloadProgress(snapshotIndex);\n }\n if (\n this.snapshotsTotal &&\n this.currentSnapshotIndex >= this.snapshotsTotal\n ) {\n this.finishDownload();\n return;\n }\n }\n\n if (\n this.snapshotCounter &&\n this.snapshotsTotal &&\n this.snapshotCounter < this.snapshotsTotal\n ) {\n log.debug2(\n `\n current range index: ${this.gridRangeCounter}, \n snapshotIndexCounter: ${this.snapshotCounter}, \n currentRangedSnapshotIndex : ${this.rangedSnapshotCounter}, \n snapshotpending: ${this.snapshotPending}, \n buffered ${this.snapshotsBuffer.size}\n making ${Math.min(\n TableSaver.SNAPSHOT_BUFFER_SIZE -\n this.snapshotsBuffer.size -\n this.snapshotPending,\n this.snapshotsTotal - this.snapshotCounter\n )} more snapshots\n `\n );\n this.makeSnapshot(\n Math.min(\n TableSaver.SNAPSHOT_BUFFER_SIZE -\n this.snapshotsBuffer.size -\n this.snapshotPending,\n this.snapshotsTotal - this.snapshotCounter\n )\n );\n }\n }\n\n updateDownloadProgress(snapshotIndex: GridRangeIndex): void {\n if (\n snapshotIndex != null &&\n this.snapshotsTotal != null &&\n this.downloadStartTime != null\n ) {\n const { onDownloadProgressUpdate } = this.props;\n const downloadProgress = Math.floor(\n (snapshotIndex * 100) / this.snapshotsTotal\n );\n const estimateTime =\n snapshotIndex > 1\n ? Math.floor(\n ((Date.now() - this.downloadStartTime) *\n (this.snapshotsTotal - snapshotIndex)) /\n snapshotIndex /\n 1000\n )\n : null;\n\n onDownloadProgressUpdate(downloadProgress, estimateTime);\n }\n }\n\n convertSnapshotIntoCsv(snapshot: UpdateEventData): string {\n let csvString = '';\n const snapshotIterator = snapshot.added.iterator();\n const { formatter } = this.props;\n\n const rows = [];\n while (snapshotIterator.hasNext()) {\n rows.push(snapshotIterator.next().value);\n }\n\n assertNotNull(this.columns);\n\n const { useUnformattedValues } = this;\n for (let i = 0; i < rows.length; i += 1) {\n const rowIdx = rows[i];\n for (let j = 0; j < this.columns.length; j += 1) {\n const { type, name } = this.columns[j];\n let cellData = null;\n if (useUnformattedValues) {\n let value = snapshot.getData(rowIdx, this.columns[j]) ?? '';\n if (value !== '' && TableUtils.isDateType(type)) {\n // value is just a long value, we should return the value formatted as a full date string\n value = dh.i18n.DateTimeFormat.format(\n UNFORMATTED_DATE_PATTERN,\n value as number | Date | DateWrapper,\n dh.i18n.TimeZone.getTimeZone(formatter.timeZone)\n );\n }\n cellData = value.toString();\n } else {\n const hasCustomColumnFormat = this.getCachedCustomColumnFormatFlag(\n formatter,\n name,\n type\n );\n let formatOverride = null;\n if (!hasCustomColumnFormat) {\n const cellFormat = snapshot.getFormat(rowIdx, this.columns[j]);\n formatOverride =\n cellFormat?.formatString != null ? cellFormat : null;\n }\n if (formatOverride) {\n cellData = formatter.getFormattedString(\n snapshot.getData(rowIdx, this.columns[j]),\n type,\n name,\n formatOverride\n );\n } else {\n cellData = formatter.getFormattedString(\n snapshot.getData(rowIdx, this.columns[j]),\n type,\n name\n );\n }\n }\n csvString += TableSaver.csvEscapeString(cellData);\n csvString += j === this.columns?.length - 1 ? '\\n' : ',';\n }\n }\n\n return csvString;\n }\n\n makeSnapshot(n: number): void {\n if (n <= 0) {\n return;\n }\n assertNotNull(this.gridRangeCounter);\n let i = 0;\n let currentGridRange = this.gridRanges[this.gridRangeCounter];\n\n assertNotNull(this.tableSubscription);\n assertNotNull(this.columns);\n while (i < n) {\n assertNotNull(currentGridRange);\n assertNotNull(currentGridRange.startRow);\n assertNotNull(currentGridRange.endRow);\n assertNotNull(this.rangedSnapshotCounter);\n assertNotNull(this.chunkRows);\n const snapshotStartRow =\n currentGridRange.startRow + this.rangedSnapshotCounter * this.chunkRows;\n const snapshotEndRow = Math.min(\n snapshotStartRow + this.chunkRows - 1,\n currentGridRange.endRow\n );\n\n const snapshotIndex = this.snapshotCounter;\n this.cancelableSnapshots.push(\n PromiseUtils.makeCancelable(\n this.tableSubscription\n .snapshot(\n dh.RangeSet.ofRange(snapshotStartRow, snapshotEndRow),\n this.columns\n )\n .then(snapshot => {\n assertIsUpdateEventData(snapshot);\n this.handleSnapshotResolved(\n snapshot,\n snapshotIndex,\n snapshotStartRow,\n snapshotEndRow\n );\n\n return snapshotIndex;\n })\n .catch(err => {\n log.error(err);\n }),\n val => {\n log.info(`snapshot ${val} has been canceled`);\n }\n )\n );\n\n this.rangedSnapshotCounter += 1;\n this.snapshotCounter += 1;\n this.snapshotPending += 1;\n\n if (\n this.rangedSnapshotCounter >=\n this.rangedSnapshotsTotal[this.gridRangeCounter]\n ) {\n this.gridRangeCounter += 1;\n this.rangedSnapshotCounter = 0;\n currentGridRange = this.gridRanges[this.gridRangeCounter];\n }\n i += 1;\n }\n }\n\n handlePortMessage({\n data,\n }: MessageEvent<{\n download: unknown;\n readableStreamPulling: unknown;\n }>): void {\n const { download, readableStreamPulling } = data;\n if (this.useBlobFallback) {\n return;\n }\n if (download != null) {\n const { includeColumnHeaders } = this;\n this.makeIframe(`${download}`);\n this.writeCsvTable(includeColumnHeaders);\n }\n if (readableStreamPulling != null) {\n if (!this.useBlobFallback) {\n if (this.streamTimeout != null) {\n clearTimeout(this.streamTimeout);\n }\n this.streamTimeout = setTimeout(\n this.handleDownloadTimeout,\n TableSaver.STREAM_TIMEOUT\n );\n }\n }\n }\n\n handleSnapshotResolved(\n snapshot: UpdateEventData,\n snapshotIndex: number,\n snapshotStartRow: GridRangeIndex,\n snapshotEndRow: GridRangeIndex\n ): void {\n // use time out to break writeSnapshot into an individual task in browser with timeout, so there's window for the browser to update table in needed.\n this.snapshotHandlerTimeout = setTimeout(() => {\n this.snapshotsBuffer.set(snapshotIndex, snapshot);\n this.snapshotPending -= 1;\n this.writeSnapshot(snapshotIndex, snapshotStartRow, snapshotEndRow);\n this.cancelableSnapshots[snapshotIndex] = null;\n }, TableSaver.SNAPSHOT_HANDLER_TIMEOUT);\n }\n\n makeIframe(src: string): void {\n // make a return value and make it static method\n const iframe = document.createElement('iframe');\n iframe.hidden = true;\n iframe.src = `download/${src}`;\n iframe.name = 'iframe';\n document.body.appendChild(iframe);\n this.iframes.push(iframe);\n }\n\n render(): null {\n return null;\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,OAA9B;AACA,SAASC,cAAc,IAAIC,sBAA3B,QAAyD,+BAAzD;AACA,OAAOC,EAAP,MAOO,uBAPP;AAQA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAAoCC,YAApC,QAAwD,iBAAxD;AAEA,SAAoBC,cAApB,EAAoCC,UAApC,QAAsD,wBAAtD;AACA,SAEEC,YAFF,EAGEC,aAHF,QAIO,kBAJP;OAKOC,a;AAEP,IAAMC,GAAG,GAAGP,GAAG,CAACQ,MAAJ,CAAW,YAAX,CAAZ;AAEA,IAAMC,wBAAwB,sCAA9B;;AAcA,SAASC,iBAAT,CAA2BC,IAA3B,EAAqE;EACnE,OAAQA,IAAD,CAA0BC,KAA1B,KAAoCC,SAA3C;AACD;;AAED,SAASC,uBAAT,CACEH,IADF,EAEmC;EACjC,IAAI,CAACD,iBAAiB,CAACC,IAAD,CAAtB,EAA8B;IAC5B,MAAM,IAAII,KAAJ,CAAU,8BAAV,CAAN;EACD;AACF;;AAED,eAAe,MAAMC,UAAN,SAAyBpB,aAAzB,CAGb;EAkBsB,OAAfqB,eAAe,CAACC,GAAD,EAAsB;IAC1C,mBA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AAkBjB,MAAlB;EACD;;EAED6I,MAAM,GAAS;IACb,OAAO,IAAP;EACD;;AA/oBD;;gBAHmBtL,U,yBAIU,I;;gBAJVA,U,0BAMW,C;;gBANXA,U,oBAQK,I;;gBARLA,U,8BAUe,C;;gBAVfA,U,kBAYG;EACpB8B,iBAAiB,EAAE,MACjByJ,OAAO,CAACC,MAAR,CAAe,IAAIzL,KAAJ,CAAU,8BAAV,CAAf,CAFkB;EAGpBiF,aAAa,EAAE,KAHK;EAIpBmB,mBAAmB,EAAE,MAAYtG,SAJb;EAKpB0G,kBAAkB,EAAE,MAAY1G,SALZ;EAMpB2I,wBAAwB,EAAE,MAAY3I;AANlB,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/iris-grid",
3
- "version": "0.22.3-beta.10+de31cf0",
3
+ "version": "0.22.3-beta.15+d3ecd9d",
4
4
  "description": "Deephaven Iris Grid",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -23,17 +23,17 @@
23
23
  "build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
24
24
  },
25
25
  "dependencies": {
26
- "@deephaven/components": "^0.22.3-beta.10+de31cf0",
27
- "@deephaven/console": "^0.22.3-beta.10+de31cf0",
28
- "@deephaven/filters": "^0.22.3-beta.10+de31cf0",
29
- "@deephaven/grid": "^0.22.3-beta.10+de31cf0",
30
- "@deephaven/icons": "^0.22.3-beta.10+de31cf0",
31
- "@deephaven/jsapi-shim": "^0.22.3-beta.10+de31cf0",
32
- "@deephaven/jsapi-utils": "^0.22.3-beta.10+de31cf0",
33
- "@deephaven/log": "^0.22.3-beta.10+de31cf0",
34
- "@deephaven/react-hooks": "^0.22.3-beta.10+de31cf0",
35
- "@deephaven/storage": "^0.22.3-beta.10+de31cf0",
36
- "@deephaven/utils": "^0.22.3-beta.10+de31cf0",
26
+ "@deephaven/components": "^0.22.3-beta.15+d3ecd9d",
27
+ "@deephaven/console": "^0.22.3-beta.15+d3ecd9d",
28
+ "@deephaven/filters": "^0.22.3-beta.15+d3ecd9d",
29
+ "@deephaven/grid": "^0.22.3-beta.15+d3ecd9d",
30
+ "@deephaven/icons": "^0.22.3-beta.15+d3ecd9d",
31
+ "@deephaven/jsapi-shim": "^0.22.3-beta.15+d3ecd9d",
32
+ "@deephaven/jsapi-utils": "^0.22.3-beta.15+d3ecd9d",
33
+ "@deephaven/log": "^0.22.3-beta.15+d3ecd9d",
34
+ "@deephaven/react-hooks": "^0.22.3-beta.15+d3ecd9d",
35
+ "@deephaven/storage": "^0.22.3-beta.15+d3ecd9d",
36
+ "@deephaven/utils": "^0.22.3-beta.15+d3ecd9d",
37
37
  "@fortawesome/react-fontawesome": "^0.1.18",
38
38
  "classnames": "^2.3.1",
39
39
  "deep-equal": "^2.0.5",
@@ -53,8 +53,8 @@
53
53
  "react": "^17.x"
54
54
  },
55
55
  "devDependencies": {
56
- "@deephaven/mocks": "^0.22.3-beta.10+de31cf0",
57
- "@deephaven/tsconfig": "^0.22.3-beta.10+de31cf0"
56
+ "@deephaven/mocks": "^0.22.3-beta.15+d3ecd9d",
57
+ "@deephaven/tsconfig": "^0.22.3-beta.15+d3ecd9d"
58
58
  },
59
59
  "files": [
60
60
  "dist"
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "de31cf065f4cefc9f772a23ead6943bf84894235"
68
+ "gitHead": "d3ecd9db8abcd25c5e233aba5ea7861eb758c3f6"
69
69
  }