@deephaven/storage 0.42.1-beta.0 → 0.42.1-beta.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.
package/dist/Storage.d.ts
CHANGED
package/dist/Storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../src/Storage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../src/Storage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAElC,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,WAAW;IAC5C,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,WAAW;IACjD,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,WAAW,CAAC,YAAY,EAAE,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AE7E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
package/dist/Storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","names":["SortDirection"],"sources":["../src/Storage.ts"],"sourcesContent":["export type FilterValue = number | string;\n\nexport type FilterConfigItem = {\n columnName: string;\n type: string;\n value: FilterValue;\n};\n\nexport type FilterConfig = {\n filterItems: FilterConfigItem[];\n filterOperators: string[];\n};\n\nexport enum SortDirection {\n ASC = 'asc',\n DESC = 'desc',\n}\n\nexport type SortConfig = {\n column: string;\n direction: SortDirection;\n};\n\nexport type IndexRange = number[];\n\nexport interface Storage<T extends StorageItem> {\n getTable(): Promise<StorageTable<T>>;\n close(): void;\n}\n\nexport interface StorageTable<T extends StorageItem> {\n getViewportData(): Promise<ViewportData<T>>;\n getSnapshot(sortedRanges: IndexRange[]): Promise<StorageSnapshot<T>>;\n setViewport(viewport: StorageTableViewport): void;\n setFilters(config: FilterConfig[] | null): void;\n setSorts(config: SortConfig[] | null): void;\n setReversed(isReversed: boolean): void;\n close(): void;\n onUpdate(callback: ViewportUpdateCallback<T>): StorageListenerRemover;\n size: number;\n}\n\nexport interface StorageItem {\n id: string;\n}\n\nexport interface UnsavedStorageItem {\n id: undefined;\n}\n\nexport type StorageTableViewport = {\n top: number;\n bottom: number;\n columns?: string[];\n};\n\nexport type StorageSnapshot<T extends StorageItem> = Map<number, T>;\n\nexport type ViewportData<T extends StorageItem> = {\n items: T[];\n offset: number;\n};\n\nexport type ViewportUpdateCallback<T extends StorageItem> = (\n viewportUpdate: ViewportData<T>\n) => void;\n\nexport type StorageListenerRemover = () => void;\n\nexport type StorageItemListener<T extends StorageItem> = (update: T) => void;\n\nexport type StorageErrorListener = (error: string) => void;\n"],"mappings":"AAaA,WAAYA,aAAa;AAGxB,WAHWA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa"}
|
|
1
|
+
{"version":3,"file":"Storage.js","names":["SortDirection"],"sources":["../src/Storage.ts"],"sourcesContent":["export type FilterValue = number | string | string[];\n\nexport type FilterConfigItem = {\n columnName: string;\n type: string;\n value: FilterValue;\n};\n\nexport type FilterConfig = {\n filterItems: FilterConfigItem[];\n filterOperators: string[];\n};\n\nexport enum SortDirection {\n ASC = 'asc',\n DESC = 'desc',\n}\n\nexport type SortConfig = {\n column: string;\n direction: SortDirection;\n};\n\nexport type IndexRange = number[];\n\nexport interface Storage<T extends StorageItem> {\n getTable(): Promise<StorageTable<T>>;\n close(): void;\n}\n\nexport interface StorageTable<T extends StorageItem> {\n getViewportData(): Promise<ViewportData<T>>;\n getSnapshot(sortedRanges: IndexRange[]): Promise<StorageSnapshot<T>>;\n setViewport(viewport: StorageTableViewport): void;\n setFilters(config: FilterConfig[] | null): void;\n setSorts(config: SortConfig[] | null): void;\n setReversed(isReversed: boolean): void;\n close(): void;\n onUpdate(callback: ViewportUpdateCallback<T>): StorageListenerRemover;\n size: number;\n}\n\nexport interface StorageItem {\n id: string;\n}\n\nexport interface UnsavedStorageItem {\n id: undefined;\n}\n\nexport type StorageTableViewport = {\n top: number;\n bottom: number;\n columns?: string[];\n};\n\nexport type StorageSnapshot<T extends StorageItem> = Map<number, T>;\n\nexport type ViewportData<T extends StorageItem> = {\n items: T[];\n offset: number;\n};\n\nexport type ViewportUpdateCallback<T extends StorageItem> = (\n viewportUpdate: ViewportData<T>\n) => void;\n\nexport type StorageListenerRemover = () => void;\n\nexport type StorageItemListener<T extends StorageItem> = (update: T) => void;\n\nexport type StorageErrorListener = (error: string) => void;\n"],"mappings":"AAaA,WAAYA,aAAa;AAGxB,WAHWA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,KAAbA,aAAa"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FilterConfig, SortConfig, StorageItem, StorageTable, ViewportUpdateCallback } from './Storage';
|
|
2
|
-
export type StorageTableViewportUpdaterProps = {
|
|
3
|
-
table: StorageTable<
|
|
2
|
+
export type StorageTableViewportUpdaterProps<T extends StorageItem> = {
|
|
3
|
+
table: StorageTable<T>;
|
|
4
4
|
columns?: string[];
|
|
5
5
|
top?: number;
|
|
6
6
|
bottom?: number;
|
|
7
7
|
filters?: FilterConfig[];
|
|
8
8
|
sorts?: SortConfig[];
|
|
9
9
|
isReversed?: boolean;
|
|
10
|
-
onUpdate: ViewportUpdateCallback<
|
|
10
|
+
onUpdate: ViewportUpdateCallback<T>;
|
|
11
11
|
};
|
|
12
|
-
export declare function StorageTableViewportUpdater({ table, columns, top, bottom, filters, sorts, isReversed, onUpdate, }: StorageTableViewportUpdaterProps): null;
|
|
12
|
+
export declare function StorageTableViewportUpdater<T extends StorageItem = StorageItem>({ table, columns, top, bottom, filters, sorts, isReversed, onUpdate, }: StorageTableViewportUpdaterProps<T>): null;
|
|
13
13
|
export default StorageTableViewportUpdater;
|
|
14
14
|
//# sourceMappingURL=StorageTableViewportUpdater.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageTableViewportUpdater.d.ts","sourceRoot":"","sources":["../src/StorageTableViewportUpdater.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EAGZ,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"StorageTableViewportUpdater.d.ts","sourceRoot":"","sources":["../src/StorageTableViewportUpdater.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EAGZ,sBAAsB,EACvB,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,gCAAgC,CAAC,CAAC,SAAS,WAAW,IAAI;IACpE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC;AAQF,wBAAgB,2BAA2B,CACzC,CAAC,SAAS,WAAW,GAAG,WAAW,EACnC,EACA,KAAK,EACL,OAAO,EACP,GAAO,EACP,MAAU,EACV,OAAO,EACP,KAAK,EACL,UAAkB,EAClB,QAAQ,GACT,EAAE,gCAAgC,CAAC,CAAC,CAAC,GAAG,IAAI,CAyE5C;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageTableViewportUpdater.js","names":["useEffect","useMemo","Log","throttle","UPDATE_DELAY","ROW_BUFFER_PAGES","log","module","StorageTableViewportUpdater","table","columns","top","bottom","filters","sorts","isReversed","onUpdate","throttledUpdateViewport","viewport","viewHeight","bufferedTop","Math","max","bufferedBottom","setViewport","updateViewportAndReturnCleanup","cleanup","viewportData","items","offset","debug","updateFilters","setFilters","updateSorts","setSorts","updateViewport","cleanupUpdateViewport","debug2","cancel"],"sources":["../src/StorageTableViewportUpdater.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport Log from '@deephaven/log';\nimport throttle from 'lodash.throttle';\nimport {\n FilterConfig,\n SortConfig,\n StorageItem,\n StorageTable,\n StorageTableViewport,\n ViewportData,\n ViewportUpdateCallback,\n} from './Storage';\n\nexport type StorageTableViewportUpdaterProps = {\n table: StorageTable<
|
|
1
|
+
{"version":3,"file":"StorageTableViewportUpdater.js","names":["useEffect","useMemo","Log","throttle","UPDATE_DELAY","ROW_BUFFER_PAGES","log","module","StorageTableViewportUpdater","table","columns","top","bottom","filters","sorts","isReversed","onUpdate","throttledUpdateViewport","viewport","viewHeight","bufferedTop","Math","max","bufferedBottom","setViewport","updateViewportAndReturnCleanup","cleanup","viewportData","items","offset","debug","updateFilters","setFilters","updateSorts","setSorts","updateViewport","cleanupUpdateViewport","debug2","cancel"],"sources":["../src/StorageTableViewportUpdater.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport Log from '@deephaven/log';\nimport throttle from 'lodash.throttle';\nimport {\n FilterConfig,\n SortConfig,\n StorageItem,\n StorageTable,\n StorageTableViewport,\n ViewportData,\n ViewportUpdateCallback,\n} from './Storage';\n\nexport type StorageTableViewportUpdaterProps<T extends StorageItem> = {\n table: StorageTable<T>;\n columns?: string[];\n top?: number;\n bottom?: number;\n filters?: FilterConfig[];\n sorts?: SortConfig[];\n isReversed?: boolean;\n onUpdate: ViewportUpdateCallback<T>;\n};\n\nconst UPDATE_DELAY = 150;\n\nconst ROW_BUFFER_PAGES = 3;\n\nconst log = Log.module('StorageTableViewportUpdater');\n\nexport function StorageTableViewportUpdater<\n T extends StorageItem = StorageItem\n>({\n table,\n columns,\n top = 0,\n bottom = 0,\n filters,\n sorts,\n isReversed = false,\n onUpdate,\n}: StorageTableViewportUpdaterProps<T>): null {\n const throttledUpdateViewport = useMemo(\n () =>\n throttle((viewport: StorageTableViewport) => {\n const viewHeight = viewport.bottom - viewport.top;\n const bufferedTop = Math.max(\n 0,\n viewport.top - viewHeight * ROW_BUFFER_PAGES\n );\n const bufferedBottom = viewport.bottom + viewHeight * ROW_BUFFER_PAGES;\n\n table.setViewport({\n top: bufferedTop,\n bottom: bufferedBottom,\n columns: viewport.columns,\n });\n }, UPDATE_DELAY),\n [table]\n );\n\n useEffect(\n function updateViewportAndReturnCleanup() {\n const cleanup = table.onUpdate((viewportData: ViewportData<T>) => {\n onUpdate({\n items: viewportData.items ?? [],\n offset: viewportData.offset ?? 0,\n });\n });\n\n return () => {\n log.debug('onUpdate cleanup');\n cleanup();\n };\n },\n [table, onUpdate]\n );\n\n useEffect(\n function updateFilters() {\n table.setFilters(filters ?? null);\n },\n [table, filters]\n );\n\n useEffect(\n function updateSorts() {\n table.setSorts(sorts ?? null);\n },\n [table, sorts]\n );\n\n useEffect(\n function updateViewport() {\n throttledUpdateViewport({\n top,\n bottom,\n columns,\n });\n },\n [throttledUpdateViewport, top, bottom, columns, filters, sorts, isReversed]\n );\n\n useEffect(\n function cleanupUpdateViewport() {\n return () => {\n log.debug2('Cancel throttledUpdateViewport');\n throttledUpdateViewport.cancel();\n };\n },\n [throttledUpdateViewport]\n );\n\n return null;\n}\n\nexport default StorageTableViewportUpdater;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAC1C,OAAOC,GAAG,MAAM,gBAAgB;AAChC,OAAOC,QAAQ,MAAM,iBAAiB;AAsBtC,IAAMC,YAAY,GAAG,GAAG;AAExB,IAAMC,gBAAgB,GAAG,CAAC;AAE1B,IAAMC,GAAG,GAAGJ,GAAG,CAACK,MAAM,CAAC,6BAA6B,CAAC;AAErD,OAAO,SAASC,2BAA2B,OAWG;EAAA,IAT5C;IACAC,KAAK;IACLC,OAAO;IACPC,GAAG,GAAG,CAAC;IACPC,MAAM,GAAG,CAAC;IACVC,OAAO;IACPC,KAAK;IACLC,UAAU,GAAG,KAAK;IAClBC;EACmC,CAAC;EACpC,IAAMC,uBAAuB,GAAGhB,OAAO,CACrC,MACEE,QAAQ,CAAEe,QAA8B,IAAK;IAC3C,IAAMC,UAAU,GAAGD,QAAQ,CAACN,MAAM,GAAGM,QAAQ,CAACP,GAAG;IACjD,IAAMS,WAAW,GAAGC,IAAI,CAACC,GAAG,CAC1B,CAAC,EACDJ,QAAQ,CAACP,GAAG,GAAGQ,UAAU,GAAGd,gBAAgB,CAC7C;IACD,IAAMkB,cAAc,GAAGL,QAAQ,CAACN,MAAM,GAAGO,UAAU,GAAGd,gBAAgB;IAEtEI,KAAK,CAACe,WAAW,CAAC;MAChBb,GAAG,EAAES,WAAW;MAChBR,MAAM,EAAEW,cAAc;MACtBb,OAAO,E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,CAACqB,MAAM,EAAE;IAClC,CAAC;EACH,CAAC,EACD,CAACrB,uBAAuB,CAAC,CAC1B;EAED,OAAO,IAAI;AACb;AAEA,eAAeT,2BAA2B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/storage",
|
|
3
|
-
"version": "0.42.1-beta.
|
|
3
|
+
"version": "0.42.1-beta.1+7cb073f8",
|
|
4
4
|
"description": "Deephaven Storage abstract classes for storing app data",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,8 +21,8 @@
|
|
|
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": "^0.42.1-beta.
|
|
25
|
-
"@deephaven/log": "^0.42.1-beta.
|
|
24
|
+
"@deephaven/filters": "^0.42.1-beta.1+7cb073f8",
|
|
25
|
+
"@deephaven/log": "^0.42.1-beta.1+7cb073f8",
|
|
26
26
|
"lodash.throttle": "^4.1.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "7cb073f8897a0a03e2f86c65f94faccc46fded35"
|
|
39
39
|
}
|