@deephaven/jsapi-components 0.47.1-beta.0 → 0.47.1-dynamic-import.4
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/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/useCheckIfExistsValue.d.ts +24 -0
- package/dist/useCheckIfExistsValue.d.ts.map +1 -0
- package/dist/useCheckIfExistsValue.js +34 -0
- package/dist/useCheckIfExistsValue.js.map +1 -0
- package/dist/useDebouncedViewportSearch.d.ts +2 -1
- package/dist/useDebouncedViewportSearch.d.ts.map +1 -1
- package/dist/useDebouncedViewportSearch.js +4 -5
- package/dist/useDebouncedViewportSearch.js.map +1 -1
- package/dist/useDebouncedViewportSelectionFilter.d.ts +19 -0
- package/dist/useDebouncedViewportSelectionFilter.d.ts.map +1 -0
- package/dist/useDebouncedViewportSelectionFilter.js +36 -0
- package/dist/useDebouncedViewportSelectionFilter.js.map +1 -0
- package/dist/useFilterConditionFactories.d.ts +5 -0
- package/dist/useFilterConditionFactories.d.ts.map +1 -0
- package/dist/useFilterConditionFactories.js +14 -0
- package/dist/useFilterConditionFactories.js.map +1 -0
- package/dist/useFilteredItemsWithDefaultValue.d.ts +14 -0
- package/dist/useFilteredItemsWithDefaultValue.d.ts.map +1 -0
- package/dist/useFilteredItemsWithDefaultValue.js +33 -0
- package/dist/useFilteredItemsWithDefaultValue.js.map +1 -0
- package/dist/useGetItemPosition.d.ts +22 -0
- package/dist/useGetItemPosition.d.ts.map +1 -0
- package/dist/useGetItemPosition.js +36 -0
- package/dist/useGetItemPosition.js.map +1 -0
- package/dist/useInitializeViewportData.d.ts +5 -5
- package/dist/useInitializeViewportData.d.ts.map +1 -1
- package/dist/useInitializeViewportData.js +18 -35
- package/dist/useInitializeViewportData.js.map +1 -1
- package/dist/useNotNullOrEmptyFilter.d.ts +3 -0
- package/dist/useNotNullOrEmptyFilter.d.ts.map +1 -0
- package/dist/useNotNullOrEmptyFilter.js +11 -0
- package/dist/useNotNullOrEmptyFilter.js.map +1 -0
- package/dist/usePickerWithSelectedValues.d.ts +33 -0
- package/dist/usePickerWithSelectedValues.d.ts.map +1 -0
- package/dist/usePickerWithSelectedValues.js +139 -0
- package/dist/usePickerWithSelectedValues.js.map +1 -0
- package/dist/useSearchableViewportData.d.ts +16 -0
- package/dist/useSearchableViewportData.d.ts.map +1 -0
- package/dist/useSearchableViewportData.js +37 -0
- package/dist/useSearchableViewportData.js.map +1 -0
- package/dist/useSetPaddedViewportCallback.d.ts +2 -1
- package/dist/useSetPaddedViewportCallback.d.ts.map +1 -1
- package/dist/useSetPaddedViewportCallback.js +2 -1
- package/dist/useSetPaddedViewportCallback.js.map +1 -1
- package/dist/useShowOnlyEmptyFilter.d.ts +11 -0
- package/dist/useShowOnlyEmptyFilter.d.ts.map +1 -0
- package/dist/useShowOnlyEmptyFilter.js +17 -0
- package/dist/useShowOnlyEmptyFilter.js.map +1 -0
- package/dist/useTableSize.d.ts +2 -1
- package/dist/useTableSize.d.ts.map +1 -1
- package/dist/useTableSize.js +2 -1
- package/dist/useTableSize.js.map +1 -1
- package/dist/useTableUtils.d.ts +2 -1
- package/dist/useTableUtils.d.ts.map +1 -1
- package/dist/useTableUtils.js +2 -1
- package/dist/useTableUtils.js.map +1 -1
- package/dist/useValueFilter.d.ts +10 -0
- package/dist/useValueFilter.d.ts.map +1 -0
- package/dist/useValueFilter.js +15 -0
- package/dist/useValueFilter.js.map +1 -0
- package/dist/useViewportData.d.ts +12 -8
- package/dist/useViewportData.d.ts.map +1 -1
- package/dist/useViewportData.js +37 -20
- package/dist/useViewportData.js.map +1 -1
- package/dist/useViewportFilter.d.ts +10 -0
- package/dist/useViewportFilter.d.ts.map +1 -0
- package/dist/useViewportFilter.js +16 -0
- package/dist/useViewportFilter.js.map +1 -0
- package/package.json +10 -11
package/dist/index.d.ts
CHANGED
|
@@ -4,17 +4,28 @@ export * from './RefreshTokenBootstrap';
|
|
|
4
4
|
export * from './RefreshTokenUtils';
|
|
5
5
|
export { default as useBroadcastChannel } from './useBroadcastChannel';
|
|
6
6
|
export { default as useBroadcastLoginListener } from './useBroadcastLoginListener';
|
|
7
|
+
export * from './useCheckIfExistsValue';
|
|
7
8
|
export { default as useDebouncedViewportSearch } from './useDebouncedViewportSearch';
|
|
9
|
+
export * from './useDebouncedViewportSelectionFilter';
|
|
10
|
+
export * from './useFilterConditionFactories';
|
|
11
|
+
export * from './useFilteredItemsWithDefaultValue';
|
|
12
|
+
export * from './useGetItemPosition';
|
|
8
13
|
export { default as useInitializeViewportData } from './useInitializeViewportData';
|
|
14
|
+
export * from './useSearchableViewportData';
|
|
15
|
+
export * from './useNotNullOrEmptyFilter';
|
|
16
|
+
export * from './usePickerWithSelectedValues';
|
|
17
|
+
export { default as useSelectDistinctTable } from './useSelectDistinctTable';
|
|
18
|
+
export { default as useSetPaddedViewportCallback } from './useSetPaddedViewportCallback';
|
|
19
|
+
export * from './useShowOnlyEmptyFilter';
|
|
9
20
|
export { default as useTable } from './useTable';
|
|
10
21
|
export { default as useTableColumn } from './useTableColumn';
|
|
11
22
|
export { default as useTableListener } from './useTableListener';
|
|
12
|
-
export { default as useSelectDistinctTable } from './useSelectDistinctTable';
|
|
13
|
-
export { default as useSetPaddedViewportCallback } from './useSetPaddedViewportCallback';
|
|
14
23
|
export { default as useTableClose } from './useTableClose';
|
|
15
24
|
export { default as useTableSize } from './useTableSize';
|
|
16
25
|
export { default as useTableUtils } from './useTableUtils';
|
|
26
|
+
export * from './useValueFilter';
|
|
17
27
|
export { default as useViewportData } from './useViewportData';
|
|
18
28
|
export type { UseSelectDistinctTableResult } from './useSelectDistinctTable';
|
|
19
29
|
export type { UseViewportDataResult } from './useViewportData';
|
|
30
|
+
export * from './useViewportFilter';
|
|
20
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACnF,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AACzF,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,15 +4,26 @@ export * from "./RefreshTokenBootstrap.js";
|
|
|
4
4
|
export * from "./RefreshTokenUtils.js";
|
|
5
5
|
export { default as useBroadcastChannel } from "./useBroadcastChannel.js";
|
|
6
6
|
export { default as useBroadcastLoginListener } from "./useBroadcastLoginListener.js";
|
|
7
|
+
export * from "./useCheckIfExistsValue.js";
|
|
7
8
|
export { default as useDebouncedViewportSearch } from "./useDebouncedViewportSearch.js";
|
|
9
|
+
export * from "./useDebouncedViewportSelectionFilter.js";
|
|
10
|
+
export * from "./useFilterConditionFactories.js";
|
|
11
|
+
export * from "./useFilteredItemsWithDefaultValue.js";
|
|
12
|
+
export * from "./useGetItemPosition.js";
|
|
8
13
|
export { default as useInitializeViewportData } from "./useInitializeViewportData.js";
|
|
14
|
+
export * from "./useSearchableViewportData.js";
|
|
15
|
+
export * from "./useNotNullOrEmptyFilter.js";
|
|
16
|
+
export * from "./usePickerWithSelectedValues.js";
|
|
17
|
+
export { default as useSelectDistinctTable } from "./useSelectDistinctTable.js";
|
|
18
|
+
export { default as useSetPaddedViewportCallback } from "./useSetPaddedViewportCallback.js";
|
|
19
|
+
export * from "./useShowOnlyEmptyFilter.js";
|
|
9
20
|
export { default as useTable } from "./useTable.js";
|
|
10
21
|
export { default as useTableColumn } from "./useTableColumn.js";
|
|
11
22
|
export { default as useTableListener } from "./useTableListener.js";
|
|
12
|
-
export { default as useSelectDistinctTable } from "./useSelectDistinctTable.js";
|
|
13
|
-
export { default as useSetPaddedViewportCallback } from "./useSetPaddedViewportCallback.js";
|
|
14
23
|
export { default as useTableClose } from "./useTableClose.js";
|
|
15
24
|
export { default as useTableSize } from "./useTableSize.js";
|
|
16
25
|
export { default as useTableUtils } from "./useTableUtils.js";
|
|
26
|
+
export * from "./useValueFilter.js";
|
|
17
27
|
export { default as useViewportData } from "./useViewportData.js";
|
|
28
|
+
export * from "./useViewportFilter.js";
|
|
18
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","TableInput","useBroadcastChannel","useBroadcastLoginListener","useDebouncedViewportSearch","useInitializeViewportData","
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","TableInput","useBroadcastChannel","useBroadcastLoginListener","useDebouncedViewportSearch","useInitializeViewportData","useSelectDistinctTable","useSetPaddedViewportCallback","useTable","useTableColumn","useTableListener","useTableClose","useTableSize","useTableUtils","useViewportData"],"sources":["../src/index.ts"],"sourcesContent":["export * from './HookTestUtils';\nexport { default as TableInput } from './TableInput';\nexport * from './RefreshTokenBootstrap';\nexport * from './RefreshTokenUtils';\nexport { default as useBroadcastChannel } from './useBroadcastChannel';\nexport { default as useBroadcastLoginListener } from './useBroadcastLoginListener';\nexport * from './useCheckIfExistsValue';\nexport { default as useDebouncedViewportSearch } from './useDebouncedViewportSearch';\nexport * from './useDebouncedViewportSelectionFilter';\nexport * from './useFilterConditionFactories';\nexport * from './useFilteredItemsWithDefaultValue';\nexport * from './useGetItemPosition';\nexport { default as useInitializeViewportData } from './useInitializeViewportData';\nexport * from './useSearchableViewportData';\nexport * from './useNotNullOrEmptyFilter';\nexport * from './usePickerWithSelectedValues';\nexport { default as useSelectDistinctTable } from './useSelectDistinctTable';\nexport { default as useSetPaddedViewportCallback } from './useSetPaddedViewportCallback';\nexport * from './useShowOnlyEmptyFilter';\nexport { default as useTable } from './useTable';\nexport { default as useTableColumn } from './useTableColumn';\nexport { default as useTableListener } from './useTableListener';\nexport { default as useTableClose } from './useTableClose';\nexport { default as useTableSize } from './useTableSize';\nexport { default as useTableUtils } from './useTableUtils';\nexport * from './useValueFilter';\nexport { default as useViewportData } from './useViewportData';\nexport type { UseSelectDistinctTableResult } from './useSelectDistinctTable';\nexport type { UseViewportDataResult } from './useViewportData';\nexport * from './useViewportFilter';\n"],"mappings":";SACSA,OAAO,IAAIC,UAAU;AAAA;AAAA;AAAA,SAGrBD,OAAO,IAAIE,mBAAmB;AAAA,SAC9BF,OAAO,IAAIG,yBAAyB;AAAA;AAAA,SAEpCH,OAAO,IAAII,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,SAKrCJ,OAAO,IAAIK,yBAAyB;AAAA;AAAA;AAAA;AAAA,SAIpCL,OAAO,IAAIM,sBAAsB;AAAA,SACjCN,OAAO,IAAIO,4BAA4B;AAAA;AAAA,SAEvCP,OAAO,IAAIQ,QAAQ;AAAA,SACnBR,OAAO,IAAIS,cAAc;AAAA,SACzBT,OAAO,IAAIU,gBAAgB;AAAA,SAC3BV,OAAO,IAAIW,aAAa;AAAA,SACxBX,OAAO,IAAIY,YAAY;AAAA,SACvBZ,OAAO,IAAIa,aAAa;AAAA;AAAA,SAExBb,OAAO,IAAIc,eAAe;AAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Table } from '@deephaven/jsapi-types';
|
|
2
|
+
export interface CheckIfExistsValue {
|
|
3
|
+
/** Current trimmed value */
|
|
4
|
+
valueTrimmed: string;
|
|
5
|
+
/** Debounced trimmed value */
|
|
6
|
+
valueTrimmedDebounced: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the value exists in the given table columns. Will be null whenever
|
|
9
|
+
* the value changes until the next check is complete.
|
|
10
|
+
*/
|
|
11
|
+
valueExists: boolean | null;
|
|
12
|
+
/** Trims and updates the value */
|
|
13
|
+
trimAndUpdateValue: (value: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Manage a trimmed text value and check if it exists in a list of table columns.
|
|
17
|
+
* @param table The table to check for the value
|
|
18
|
+
* @param columnNames The column names to check
|
|
19
|
+
* @param debounceMs Debounce timer for re-checking the value
|
|
20
|
+
* @param isCaseSensitive Whether the value check is case sensitive
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCheckIfExistsValue(table: Table | null | undefined, columnNames: string | string[], debounceMs: number, isCaseSensitive: boolean): CheckIfExistsValue;
|
|
23
|
+
export default useCheckIfExistsValue;
|
|
24
|
+
//# sourceMappingURL=useCheckIfExistsValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCheckIfExistsValue.d.ts","sourceRoot":"","sources":["../src/useCheckIfExistsValue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IAErB,8BAA8B;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAE5B,kCAAkC;IAClC,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC/B,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,EAC9B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,OAAO,GACvB,kBAAkB,CA+BpB;AAED,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
import { useDebouncedValue, usePromiseFactory } from '@deephaven/react-hooks';
|
|
3
|
+
import useTableUtils from "./useTableUtils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Manage a trimmed text value and check if it exists in a list of table columns.
|
|
6
|
+
* @param table The table to check for the value
|
|
7
|
+
* @param columnNames The column names to check
|
|
8
|
+
* @param debounceMs Debounce timer for re-checking the value
|
|
9
|
+
* @param isCaseSensitive Whether the value check is case sensitive
|
|
10
|
+
*/
|
|
11
|
+
export function useCheckIfExistsValue(table, columnNames, debounceMs, isCaseSensitive) {
|
|
12
|
+
var tableUtils = useTableUtils();
|
|
13
|
+
var [valueTrimmed, setValueTrimmed] = useState('');
|
|
14
|
+
var valueTrimmedDebounced = useDebouncedValue(valueTrimmed, debounceMs);
|
|
15
|
+
var trimAndUpdateValue = useCallback(text => {
|
|
16
|
+
setValueTrimmed(text.trim());
|
|
17
|
+
}, []);
|
|
18
|
+
var {
|
|
19
|
+
data: valueExistsData,
|
|
20
|
+
isLoading: valueExistsIsLoading
|
|
21
|
+
} = usePromiseFactory(tableUtils.doesColumnValueExist, [table, columnNames, valueTrimmedDebounced, isCaseSensitive]);
|
|
22
|
+
|
|
23
|
+
// If value check is loading or if debounce hasn't settled, set
|
|
24
|
+
// `matchesExistingValue` to null since it is indeterminate
|
|
25
|
+
var valueExists = valueExistsIsLoading || valueTrimmed !== valueTrimmedDebounced ? null : valueExistsData;
|
|
26
|
+
return {
|
|
27
|
+
valueTrimmed,
|
|
28
|
+
valueTrimmedDebounced,
|
|
29
|
+
valueExists,
|
|
30
|
+
trimAndUpdateValue
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export default useCheckIfExistsValue;
|
|
34
|
+
//# sourceMappingURL=useCheckIfExistsValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCheckIfExistsValue.js","names":["useCallback","useState","useDebouncedValue","usePromiseFactory","useTableUtils","useCheckIfExistsValue","table","columnNames","debounceMs","isCaseSensitive","tableUtils","valueTrimmed","setValueTrimmed","valueTrimmedDebounced","trimAndUpdateValue","text","trim","data","valueExistsData","isLoading","valueExistsIsLoading","doesColumnValueExist","valueExists"],"sources":["../src/useCheckIfExistsValue.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\nimport type { Table } from '@deephaven/jsapi-types';\nimport { useDebouncedValue, usePromiseFactory } from '@deephaven/react-hooks';\nimport useTableUtils from './useTableUtils';\n\nexport interface CheckIfExistsValue {\n /** Current trimmed value */\n valueTrimmed: string;\n\n /** Debounced trimmed value */\n valueTrimmedDebounced: string;\n\n /**\n * Whether the value exists in the given table columns. Will be null whenever\n * the value changes until the next check is complete.\n */\n valueExists: boolean | null;\n\n /** Trims and updates the value */\n trimAndUpdateValue: (value: string) => void;\n}\n\n/**\n * Manage a trimmed text value and check if it exists in a list of table columns.\n * @param table The table to check for the value\n * @param columnNames The column names to check\n * @param debounceMs Debounce timer for re-checking the value\n * @param isCaseSensitive Whether the value check is case sensitive\n */\nexport function useCheckIfExistsValue(\n table: Table | null | undefined,\n columnNames: string | string[],\n debounceMs: number,\n isCaseSensitive: boolean\n): CheckIfExistsValue {\n const tableUtils = useTableUtils();\n\n const [valueTrimmed, setValueTrimmed] = useState('');\n const valueTrimmedDebounced = useDebouncedValue(valueTrimmed, debounceMs);\n\n const trimAndUpdateValue = useCallback((text: string) => {\n setValueTrimmed(text.trim());\n }, []);\n\n const { data: valueExistsData, isLoading: valueExistsIsLoading } =\n usePromiseFactory(tableUtils.doesColumnValueExist, [\n table,\n columnNames,\n valueTrimmedDebounced,\n isCaseSensitive,\n ]);\n\n // If value check is loading or if debounce hasn't settled, set\n // `matchesExistingValue` to null since it is indeterminate\n const valueExists =\n valueExistsIsLoading || valueTrimmed !== valueTrimmedDebounced\n ? null\n : valueExistsData;\n\n return {\n valueTrimmed,\n valueTrimmedDebounced,\n valueExists,\n trimAndUpdateValue,\n };\n}\n\nexport default useCheckIfExistsValue;\n"],"mappings":"AAAA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AAE7C,SAASC,iBAAiB,EAAEC,iBAAiB,QAAQ,wBAAwB;AAAC,OACvEC,aAAa;AAmBpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqB,CACnCC,KAA+B,EAC/BC,WAA8B,EAC9BC,UAAkB,EAClBC,eAAwB,EACJ;EACpB,IAAMC,UAAU,GAAGN,aAAa,EAAE;EAElC,IAAM,CAACO,YAAY,EAAEC,eAAe,CAAC,GAAGX,QAAQ,CAAC,EAAE,CAAC;EACpD,IAAMY,qBAAqB,GAAGX,iBAAiB,CAACS,YAAY,EAAEH,UAAU,CAAC;EAEzE,IAAMM,kBAAkB,GAAGd,WAAW,CAAEe,IAAY,IAAK;IACvDH,eAAe,CAACG,IAAI,CAACC,IAAI,EAAE,CAAC;EAC9B,CAAC,EAAE,EAAE,CAAC;EAEN,IAAM;IAAEC,IAAI,EAAEC,eAAe;IAAEC,SAAS,EAAEC;EAAqB,CAAC,GAC9DjB,iBAAiB,CAACO,UAAU,CAACW,oBAAoB,EAAE,CACjDf,KAAK,EACLC,WAAW,EACXM,qBAAqB,EACrBJ,eAAe,CAChB,CAAC;;EAEJ;EACA;EACA,IAAMa,WAAW,GACfF,oBAAoB,IAAIT,YAAY,KAAKE,qBAAqB,GAC1D,IAAI,GACJK,eAAe;EAErB,OAAO;IACLP,YAAY;IACZE,qBAAqB;IACrBS,WAAW;IACXR;EACF,CAAC;AACH;AAEA,eAAeT,qBAAqB"}
|
|
@@ -9,5 +9,6 @@ export declare const DEBOUNCE_VIEWPORT_SEARCH_MS = 200;
|
|
|
9
9
|
* @param debounceMs Millisecond value to debounce
|
|
10
10
|
* @returns A debounced search function
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export declare function useDebouncedViewportSearch<I, T extends Table | TreeTable>(viewportData: UseViewportDataResult<I, T>, columnName: string, debounceMs?: number): (searchText: string) => void;
|
|
13
|
+
export default useDebouncedViewportSearch;
|
|
13
14
|
//# sourceMappingURL=useDebouncedViewportSearch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedViewportSearch.d.ts","sourceRoot":"","sources":["../src/useDebouncedViewportSearch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useDebouncedViewportSearch.d.ts","sourceRoot":"","sources":["../src/useDebouncedViewportSearch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAK1D,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,GAAG,SAAS,EACvE,YAAY,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,EACzC,UAAU,EAAE,MAAM,EAClB,UAAU,SAA8B,GACvC,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAyC9B;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import debounce from 'lodash.debounce';
|
|
2
|
-
import { TableUtils } from '@deephaven/jsapi-utils';
|
|
3
|
-
import { useApi } from '@deephaven/jsapi-bootstrap';
|
|
4
2
|
import Log from '@deephaven/log';
|
|
5
3
|
import { useEffect, useMemo } from 'react';
|
|
4
|
+
import useTableUtils from "./useTableUtils.js";
|
|
6
5
|
var log = Log.module('useDebouncedViewportSearch');
|
|
7
6
|
export var DEBOUNCE_VIEWPORT_SEARCH_MS = 200;
|
|
8
7
|
|
|
@@ -14,10 +13,9 @@ export var DEBOUNCE_VIEWPORT_SEARCH_MS = 200;
|
|
|
14
13
|
* @param debounceMs Millisecond value to debounce
|
|
15
14
|
* @returns A debounced search function
|
|
16
15
|
*/
|
|
17
|
-
export
|
|
16
|
+
export function useDebouncedViewportSearch(viewportData, columnName) {
|
|
18
17
|
var debounceMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEBOUNCE_VIEWPORT_SEARCH_MS;
|
|
19
|
-
var
|
|
20
|
-
var tableUtils = useMemo(() => new TableUtils(dh), [dh]);
|
|
18
|
+
var tableUtils = useTableUtils();
|
|
21
19
|
var {
|
|
22
20
|
table,
|
|
23
21
|
applyFiltersAndRefresh
|
|
@@ -43,4 +41,5 @@ export default function useDebouncedViewportSearch(viewportData, columnName) {
|
|
|
43
41
|
}, [debouncedSearch]);
|
|
44
42
|
return debouncedSearch;
|
|
45
43
|
}
|
|
44
|
+
export default useDebouncedViewportSearch;
|
|
46
45
|
//# sourceMappingURL=useDebouncedViewportSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedViewportSearch.js","names":["debounce","
|
|
1
|
+
{"version":3,"file":"useDebouncedViewportSearch.js","names":["debounce","Log","useEffect","useMemo","useTableUtils","log","module","DEBOUNCE_VIEWPORT_SEARCH_MS","useDebouncedViewportSearch","viewportData","columnName","debounceMs","tableUtils","table","applyFiltersAndRefresh","debouncedSearch","searchText","debug","searchTextTrimmed","trim","column","findColumn","value","makeFilterValue","type","filter","contains","cancel"],"sources":["../src/useDebouncedViewportSearch.ts"],"sourcesContent":["import debounce from 'lodash.debounce';\nimport type { Table, TreeTable } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { useEffect, useMemo } from 'react';\nimport { UseViewportDataResult } from './useViewportData';\nimport useTableUtils from './useTableUtils';\n\nconst log = Log.module('useDebouncedViewportSearch');\n\nexport const DEBOUNCE_VIEWPORT_SEARCH_MS = 200;\n\n/**\n * React hook that returns a debounced search callback for filtering a table\n * viewport.\n * @param viewportData Table viewport to filter\n * @param columnName Column name to filter by\n * @param debounceMs Millisecond value to debounce\n * @returns A debounced search function\n */\nexport function useDebouncedViewportSearch<I, T extends Table | TreeTable>(\n viewportData: UseViewportDataResult<I, T>,\n columnName: string,\n debounceMs = DEBOUNCE_VIEWPORT_SEARCH_MS\n): (searchText: string) => void {\n const tableUtils = useTableUtils();\n const { table, applyFiltersAndRefresh } = viewportData;\n\n const debouncedSearch = useMemo(\n () =>\n debounce((searchText: string) => {\n log.debug(`Applying debounced searchText '${searchText}'`);\n\n if (table == null) {\n return;\n }\n\n const searchTextTrimmed = searchText.trim();\n\n if (searchTextTrimmed === '') {\n applyFiltersAndRefresh([]);\n return;\n }\n\n const column = table.findColumn(columnName);\n const value = tableUtils.makeFilterValue(\n column.type,\n searchTextTrimmed\n );\n const filter = [column.filter().contains(value)];\n\n applyFiltersAndRefresh(filter);\n }, debounceMs),\n [applyFiltersAndRefresh, columnName, debounceMs, table, tableUtils]\n );\n\n useEffect(\n () => () => {\n log.debug('Cancelling debounced search function');\n debouncedSearch.cancel();\n },\n [debouncedSearch]\n );\n\n return debouncedSearch;\n}\n\nexport default useDebouncedViewportSearch;\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,iBAAiB;AAEtC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAAC,OAEpCC,aAAa;AAEpB,IAAMC,GAAG,GAAGJ,GAAG,CAACK,MAAM,CAAC,4BAA4B,CAAC;AAEpD,OAAO,IAAMC,2BAA2B,GAAG,GAAG;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0B,CACxCC,YAAyC,EACzCC,UAAkB,EAEY;EAAA,IAD9BC,UAAU,uEAAGJ,2BAA2B;EAExC,IAAMK,UAAU,GAAGR,aAAa,EAAE;EAClC,IAAM;IAAES,KAAK;IAAEC;EAAuB,CAAC,GAAGL,YAAY;EAEtD,IAAMM,eAAe,GAAGZ,OAAO,CAC7B,MACEH,QAAQ,CAAEgB,UAAkB,IAAK;IAC/BX,GAAG,CAACY,KAAK,0CAAmCD,UAAU,OAAI;IAE1D,IAAIH,KAAK,IAAI,IAAI,EAAE;MACjB;IACF;IAEA,IAAMK,iBAAiB,GAAGF,UAAU,CAACG,IAAI,EAAE;IAE3C,IAAID,iBAAiB,KAAK,EAAE,EAAE;MAC5BJ,sBAAsB,CAAC,EAAE,CAAC;MAC1B;IACF;IAEA,IAAMM,MAAM,GAAGP,KAAK,CAACQ,UAAU,CAACX,UAAU,CAAC;IAC3C,IAAMY,KAAK,GAAGV,UAAU,CAACW,eAAe,CACtCH,MAAM,CAACI,IAAI,EACXN,iBAAiB,CAClB;IACD,IAAMO,MAAM,GAAG,CAACL,MAAM,CAACK,MAAM,EAAE,CAACC,QAAQ,CAACJ,KAAK,CAAC,CAAC;IAEhDR,sBAAsB,CAACW,MAAM,CAAC;EAChC,CAAC,EAAEd,UAAU,CAAC,EAChB,CAACG,sBAAsB,EAAEJ,UAAU,EAAEC,UAAU,EAAEE,KAAK,EAAED,UAAU,CAAC,CACpE;EAEDV,SAAS,CACP,MAAM,MAAM;IACVG,GAAG,CAACY,KAAK,CAAC,sCAAsC,CAAC;IACjDF,eAAe,CAACY,MAAM,EAAE;EAC1B,CAAC,EACD,CAACZ,eAAe,CAAC,CAClB;EAED,OAAOA,eAAe;AACxB;AAEA,eAAeP,0BAA0B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FilterConditionFactory } from '@deephaven/jsapi-utils';
|
|
2
|
+
import { WindowedListData } from '@deephaven/react-hooks';
|
|
3
|
+
import { KeyedItem } from '@deephaven/utils';
|
|
4
|
+
export declare const DEBOUNCE_MS = 300;
|
|
5
|
+
export interface UseDebouncedViewportSelectionFilterOptions<TItem, TValue> {
|
|
6
|
+
viewportData: WindowedListData<KeyedItem<TItem>>;
|
|
7
|
+
columnName: string;
|
|
8
|
+
shouldSelectAllOnNoSelection: boolean;
|
|
9
|
+
mapItemToValue: (item: KeyedItem<TItem>) => TValue;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a filter factory for the current selected keys of a viewport. The
|
|
13
|
+
* selected keys will be mapped to values to match in a given column name. The
|
|
14
|
+
* resulting filter factory is debounced to allow some cushion for cases where
|
|
15
|
+
* a user rapidly changes selections, e.g. in a checkbox list.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useDebouncedViewportSelectionFilter<TItem, TValue>({ viewportData, columnName, shouldSelectAllOnNoSelection, mapItemToValue, }: UseDebouncedViewportSelectionFilterOptions<TItem, TValue>): FilterConditionFactory;
|
|
18
|
+
export default useDebouncedViewportSelectionFilter;
|
|
19
|
+
//# sourceMappingURL=useDebouncedViewportSelectionFilter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedViewportSelectionFilter.d.ts","sourceRoot":"","sources":["../src/useDebouncedViewportSelectionFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAKL,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,MAAM,WAAW,0CAA0C,CAAC,KAAK,EAAE,MAAM;IACvE,YAAY,EAAE,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B,EAAE,OAAO,CAAC;IACtC,cAAc,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC;CACpD;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,MAAM,EAAE,EACjE,YAAY,EACZ,UAAU,EACV,4BAA4B,EAC5B,cAAc,GACf,EAAE,0CAA0C,CAC3C,KAAK,EACL,MAAM,CACP,GAAG,sBAAsB,CAiCzB;AAED,eAAe,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createSelectedValuesFilter } from '@deephaven/jsapi-utils';
|
|
2
|
+
import { isSelectionMaybeInvertedEqual, useDebouncedValue, useIsEqualMemo, useMappedSelection } from '@deephaven/react-hooks';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import useTableUtils from "./useTableUtils.js";
|
|
5
|
+
export var DEBOUNCE_MS = 300;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a filter factory for the current selected keys of a viewport. The
|
|
8
|
+
* selected keys will be mapped to values to match in a given column name. The
|
|
9
|
+
* resulting filter factory is debounced to allow some cushion for cases where
|
|
10
|
+
* a user rapidly changes selections, e.g. in a checkbox list.
|
|
11
|
+
*/
|
|
12
|
+
export function useDebouncedViewportSelectionFilter(_ref) {
|
|
13
|
+
var {
|
|
14
|
+
viewportData,
|
|
15
|
+
columnName,
|
|
16
|
+
shouldSelectAllOnNoSelection,
|
|
17
|
+
mapItemToValue
|
|
18
|
+
} = _ref;
|
|
19
|
+
var tableUtils = useTableUtils();
|
|
20
|
+
|
|
21
|
+
// Map selection to values contained in the column to filter
|
|
22
|
+
var valuesSelection = useMappedSelection(viewportData, mapItemToValue);
|
|
23
|
+
|
|
24
|
+
// Debounce so user can rapidly select multiple items in a row without the
|
|
25
|
+
// cost of updating the table on each change
|
|
26
|
+
var debouncedValuesSelection = useDebouncedValue(valuesSelection, DEBOUNCE_MS);
|
|
27
|
+
|
|
28
|
+
// In cases where a user rapidly selects then deselects the selection
|
|
29
|
+
// reference will change, but the state it represents will remain unchanged.
|
|
30
|
+
// Memoize based on the selection value to avoid unnecessarily re-applying
|
|
31
|
+
// table filters.
|
|
32
|
+
var memoValuesSelection = useIsEqualMemo(debouncedValuesSelection, isSelectionMaybeInvertedEqual);
|
|
33
|
+
return useMemo(() => createSelectedValuesFilter(tableUtils, columnName, memoValuesSelection.selection, shouldSelectAllOnNoSelection, memoValuesSelection.isInverted), [columnName, memoValuesSelection, shouldSelectAllOnNoSelection, tableUtils]);
|
|
34
|
+
}
|
|
35
|
+
export default useDebouncedViewportSelectionFilter;
|
|
36
|
+
//# sourceMappingURL=useDebouncedViewportSelectionFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDebouncedViewportSelectionFilter.js","names":["createSelectedValuesFilter","isSelectionMaybeInvertedEqual","useDebouncedValue","useIsEqualMemo","useMappedSelection","useMemo","useTableUtils","DEBOUNCE_MS","useDebouncedViewportSelectionFilter","viewportData","columnName","shouldSelectAllOnNoSelection","mapItemToValue","tableUtils","valuesSelection","debouncedValuesSelection","memoValuesSelection","selection","isInverted"],"sources":["../src/useDebouncedViewportSelectionFilter.ts"],"sourcesContent":["import {\n createSelectedValuesFilter,\n FilterConditionFactory,\n} from '@deephaven/jsapi-utils';\nimport {\n isSelectionMaybeInvertedEqual,\n useDebouncedValue,\n useIsEqualMemo,\n useMappedSelection,\n WindowedListData,\n} from '@deephaven/react-hooks';\nimport { KeyedItem } from '@deephaven/utils';\nimport { useMemo } from 'react';\nimport useTableUtils from './useTableUtils';\n\nexport const DEBOUNCE_MS = 300;\n\nexport interface UseDebouncedViewportSelectionFilterOptions<TItem, TValue> {\n viewportData: WindowedListData<KeyedItem<TItem>>;\n columnName: string;\n shouldSelectAllOnNoSelection: boolean;\n mapItemToValue: (item: KeyedItem<TItem>) => TValue;\n}\n\n/**\n * Creates a filter factory for the current selected keys of a viewport. The\n * selected keys will be mapped to values to match in a given column name. The\n * resulting filter factory is debounced to allow some cushion for cases where\n * a user rapidly changes selections, e.g. in a checkbox list.\n */\nexport function useDebouncedViewportSelectionFilter<TItem, TValue>({\n viewportData,\n columnName,\n shouldSelectAllOnNoSelection,\n mapItemToValue,\n}: UseDebouncedViewportSelectionFilterOptions<\n TItem,\n TValue\n>): FilterConditionFactory {\n const tableUtils = useTableUtils();\n\n // Map selection to values contained in the column to filter\n const valuesSelection = useMappedSelection(viewportData, mapItemToValue);\n\n // Debounce so user can rapidly select multiple items in a row without the\n // cost of updating the table on each change\n const debouncedValuesSelection = useDebouncedValue(\n valuesSelection,\n DEBOUNCE_MS\n );\n\n // In cases where a user rapidly selects then deselects the selection\n // reference will change, but the state it represents will remain unchanged.\n // Memoize based on the selection value to avoid unnecessarily re-applying\n // table filters.\n const memoValuesSelection = useIsEqualMemo(\n debouncedValuesSelection,\n isSelectionMaybeInvertedEqual\n );\n\n return useMemo(\n () =>\n createSelectedValuesFilter(\n tableUtils,\n columnName,\n memoValuesSelection.selection,\n shouldSelectAllOnNoSelection,\n memoValuesSelection.isInverted\n ),\n [columnName, memoValuesSelection, shouldSelectAllOnNoSelection, tableUtils]\n );\n}\n\nexport default useDebouncedViewportSelectionFilter;\n"],"mappings":"AAAA,SACEA,0BAA0B,QAErB,wBAAwB;AAC/B,SACEC,6BAA6B,EAC7BC,iBAAiB,EACjBC,cAAc,EACdC,kBAAkB,QAEb,wBAAwB;AAE/B,SAASC,OAAO,QAAQ,OAAO;AAAC,OACzBC,aAAa;AAEpB,OAAO,IAAMC,WAAW,GAAG,GAAG;AAS9B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mCAAmC,OAQxB;EAAA,IARwC;IACjEC,YAAY;IACZC,UAAU;IACVC,4BAA4B;IAC5BC;EAIF,CAAC;EACC,IAAMC,UAAU,GAAGP,aAAa,EAAE;;EAElC;EACA,IAAMQ,eAAe,GAAGV,kBAAkB,CAACK,YAAY,EAAEG,cAAc,CAAC;;EAExE;EACA;EACA,IAAMG,wBAAwB,GAAGb,iBAAiB,CAChDY,eAAe,EACfP,WAAW,CACZ;;EAED;EACA;EACA;EACA;EACA,IAAMS,mBAAmB,GAAGb,cAAc,CACxCY,wBAAwB,EACxBd,6BAA6B,CAC9B;EAED,OAAOI,OAAO,CACZ,MACEL,0BAA0B,CACxBa,UAAU,EACVH,UAAU,EACVM,mBAAmB,CAACC,SAAS,EAC7BN,4BAA4B,EAC5BK,mBAAmB,CAACE,UAAU,CAC/B,EACH,CAACR,UAAU,EAAEM,mBAAmB,EAAEL,4BAA4B,EAAEE,UAAU,CAAC,CAC5E;AACH;AAEA,eAAeL,mCAAmC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FilterCondition, Table, TreeTable } from '@deephaven/jsapi-types';
|
|
2
|
+
import type { FilterConditionFactory } from '@deephaven/jsapi-utils';
|
|
3
|
+
export declare function useFilterConditionFactories(maybeTable: Table | TreeTable | null | undefined, ...filterConditionFactories: FilterConditionFactory[]): FilterCondition[];
|
|
4
|
+
export default useFilterConditionFactories;
|
|
5
|
+
//# sourceMappingURL=useFilterConditionFactories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterConditionFactories.d.ts","sourceRoot":"","sources":["../src/useFilterConditionFactories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGrE,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,EAChD,GAAG,wBAAwB,EAAE,sBAAsB,EAAE,GACpD,eAAe,EAAE,CAWnB;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { removeNullAndUndefined } from '@deephaven/utils';
|
|
3
|
+
export function useFilterConditionFactories(maybeTable) {
|
|
4
|
+
for (var _len = arguments.length, filterConditionFactories = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5
|
+
filterConditionFactories[_key - 1] = arguments[_key];
|
|
6
|
+
}
|
|
7
|
+
return useMemo(() => removeNullAndUndefined(...filterConditionFactories.map(f => f(maybeTable))),
|
|
8
|
+
// Intentionally disabling hooks check so we can spread
|
|
9
|
+
// the array items as dependencies.
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11
|
+
[maybeTable, ...filterConditionFactories]);
|
|
12
|
+
}
|
|
13
|
+
export default useFilterConditionFactories;
|
|
14
|
+
//# sourceMappingURL=useFilterConditionFactories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilterConditionFactories.js","names":["useMemo","removeNullAndUndefined","useFilterConditionFactories","maybeTable","filterConditionFactories","map","f"],"sources":["../src/useFilterConditionFactories.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { FilterCondition, Table, TreeTable } from '@deephaven/jsapi-types';\nimport type { FilterConditionFactory } from '@deephaven/jsapi-utils';\nimport { removeNullAndUndefined } from '@deephaven/utils';\n\nexport function useFilterConditionFactories(\n maybeTable: Table | TreeTable | null | undefined,\n ...filterConditionFactories: FilterConditionFactory[]\n): FilterCondition[] {\n return useMemo(\n () =>\n removeNullAndUndefined(\n ...filterConditionFactories.map(f => f(maybeTable))\n ),\n // Intentionally disabling hooks check so we can spread\n // the array items as dependencies.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [maybeTable, ...filterConditionFactories]\n );\n}\n\nexport default useFilterConditionFactories;\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAG/B,SAASC,sBAAsB,QAAQ,kBAAkB;AAEzD,OAAO,SAASC,2BAA2B,CACzCC,UAAgD,EAE7B;EAAA,kCADhBC,wBAAwB;IAAxBA,wBAAwB;EAAA;EAE3B,OAAOJ,OAAO,CACZ,MACEC,sBAAsB,CACpB,GAAGG,wBAAwB,CAACC,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACH,UAAU,CAAC,CAAC,CACpD;EACH;EACA;EACA;EACA,CAACA,UAAU,EAAE,GAAGC,wBAAwB,CAAC,CAC1C;AACH;AAEA,eAAeF,2BAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KeyedItem } from '@deephaven/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Takes an array of items and adds a default item to the top of the list if:
|
|
4
|
+
* 1. defaultDisplayValue is provided
|
|
5
|
+
* 2. The `searchText` is empty or
|
|
6
|
+
* The `searchText` is contained (case insensitive) in the default item display text.
|
|
7
|
+
* @param items List of items filtered on `searchText`
|
|
8
|
+
* @param displayProp The item prop containing display text
|
|
9
|
+
* @param searchText The current search text that is filtering the items
|
|
10
|
+
* @param defaultDisplayValue The display text to set as the default item `displayProp` value
|
|
11
|
+
*/
|
|
12
|
+
export declare function useFilteredItemsWithDefaultValue<TItem, TProp extends keyof TItem>(items: KeyedItem<TItem>[], displayProp: TProp, searchText: string, defaultDisplayValue?: string | null): KeyedItem<TItem>[];
|
|
13
|
+
export default useFilteredItemsWithDefaultValue;
|
|
14
|
+
//# sourceMappingURL=useFilteredItemsWithDefaultValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilteredItemsWithDefaultValue.d.ts","sourceRoot":"","sources":["../src/useFilteredItemsWithDefaultValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EACL,KAAK,SAAS,MAAM,KAAK,EAEzB,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,EACzB,WAAW,EAAE,KAAK,EAClB,UAAU,EAAE,MAAM,EAClB,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAClC,SAAS,CAAC,KAAK,CAAC,EAAE,CA8BpB;AAED,eAAe,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Takes an array of items and adds a default item to the top of the list if:
|
|
4
|
+
* 1. defaultDisplayValue is provided
|
|
5
|
+
* 2. The `searchText` is empty or
|
|
6
|
+
* The `searchText` is contained (case insensitive) in the default item display text.
|
|
7
|
+
* @param items List of items filtered on `searchText`
|
|
8
|
+
* @param displayProp The item prop containing display text
|
|
9
|
+
* @param searchText The current search text that is filtering the items
|
|
10
|
+
* @param defaultDisplayValue The display text to set as the default item `displayProp` value
|
|
11
|
+
*/
|
|
12
|
+
export function useFilteredItemsWithDefaultValue(items, displayProp, searchText, defaultDisplayValue) {
|
|
13
|
+
// Exclude search text from updating the memo. This ensures that adding /
|
|
14
|
+
// removing of the default item stays in sync with data loading. Otherwise,
|
|
15
|
+
// the item can move while data is still loading.
|
|
16
|
+
var searchTextRef = useRef('');
|
|
17
|
+
searchTextRef.current = searchText;
|
|
18
|
+
return useMemo(() => {
|
|
19
|
+
// If the list is still loading, items will exist, but their item prop will be undefined
|
|
20
|
+
var isLoading = items.length > 0 && items[0].item == null;
|
|
21
|
+
if (!isLoading && defaultDisplayValue != null && (searchTextRef.current === '' || defaultDisplayValue.toLowerCase().includes(searchTextRef.current.toLowerCase()))) {
|
|
22
|
+
return [{
|
|
23
|
+
key: defaultDisplayValue,
|
|
24
|
+
item: {
|
|
25
|
+
[displayProp]: defaultDisplayValue
|
|
26
|
+
}
|
|
27
|
+
}, ...items];
|
|
28
|
+
}
|
|
29
|
+
return items;
|
|
30
|
+
}, [defaultDisplayValue, displayProp, items]);
|
|
31
|
+
}
|
|
32
|
+
export default useFilteredItemsWithDefaultValue;
|
|
33
|
+
//# sourceMappingURL=useFilteredItemsWithDefaultValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilteredItemsWithDefaultValue.js","names":["useMemo","useRef","useFilteredItemsWithDefaultValue","items","displayProp","searchText","defaultDisplayValue","searchTextRef","current","isLoading","length","item","toLowerCase","includes","key"],"sources":["../src/useFilteredItemsWithDefaultValue.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { KeyedItem } from '@deephaven/utils';\n\n/**\n * Takes an array of items and adds a default item to the top of the list if:\n * 1. defaultDisplayValue is provided\n * 2. The `searchText` is empty or\n * The `searchText` is contained (case insensitive) in the default item display text.\n * @param items List of items filtered on `searchText`\n * @param displayProp The item prop containing display text\n * @param searchText The current search text that is filtering the items\n * @param defaultDisplayValue The display text to set as the default item `displayProp` value\n */\nexport function useFilteredItemsWithDefaultValue<\n TItem,\n TProp extends keyof TItem,\n>(\n items: KeyedItem<TItem>[],\n displayProp: TProp,\n searchText: string,\n defaultDisplayValue?: string | null\n): KeyedItem<TItem>[] {\n // Exclude search text from updating the memo. This ensures that adding /\n // removing of the default item stays in sync with data loading. Otherwise,\n // the item can move while data is still loading.\n const searchTextRef = useRef('');\n searchTextRef.current = searchText;\n\n return useMemo(() => {\n // If the list is still loading, items will exist, but their item prop will be undefined\n const isLoading = items.length > 0 && items[0].item == null;\n\n if (\n !isLoading &&\n defaultDisplayValue != null &&\n (searchTextRef.current === '' ||\n defaultDisplayValue\n .toLowerCase()\n .includes(searchTextRef.current.toLowerCase()))\n ) {\n return [\n {\n key: defaultDisplayValue,\n item: { [displayProp]: defaultDisplayValue } as TItem,\n },\n ...items,\n ];\n }\n\n return items;\n }, [defaultDisplayValue, displayProp, items]);\n}\n\nexport default useFilteredItemsWithDefaultValue;\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAGvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gCAAgC,CAI9CC,KAAyB,EACzBC,WAAkB,EAClBC,UAAkB,EAClBC,mBAAmC,EACf;EACpB;EACA;EACA;EACA,IAAMC,aAAa,GAAGN,MAAM,CAAC,EAAE,CAAC;EAChCM,aAAa,CAACC,OAAO,GAAGH,UAAU;EAElC,OAAOL,OAAO,CAAC,MAAM;IACnB;IACA,IAAMS,SAAS,GAAGN,KAAK,CAACO,MAAM,GAAG,CAAC,IAAIP,KAAK,CAAC,CAAC,CAAC,CAACQ,IAAI,IAAI,IAAI;IAE3D,IACE,CAACF,SAAS,IACVH,mBAAmB,IAAI,IAAI,KAC1BC,aAAa,CAACC,OAAO,KAAK,EAAE,IAC3BF,mBAAmB,CAChBM,WAAW,EAAE,CACbC,QAAQ,CAACN,aAAa,CAACC,OAAO,CAACI,WAAW,EAAE,CAAC,CAAC,EACnD;MACA,OAAO,CACL;QACEE,GAAG,EAAER,mBAAmB;QACxBK,IAAI,EAAE;UAAE,CAACP,WAAW,GAAGE;QAAoB;MAC7C,CAAC,EACD,GAAGH,KAAK,CACT;IACH;IAEA,OAAOA,KAAK;EACd,CAAC,EAAE,CAACG,mBAAmB,EAAEF,WAAW,EAAED,KAAK,CAAC,CAAC;AAC/C;AAEA,eAAeD,gCAAgC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Table } from '@deephaven/jsapi-types';
|
|
2
|
+
export interface UseGetItemPositionOptions {
|
|
3
|
+
table?: Table | null;
|
|
4
|
+
columnName: string;
|
|
5
|
+
defaultValue?: string | null;
|
|
6
|
+
itemHeight: number;
|
|
7
|
+
topOffset?: number;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Gets an item's position in a list of items based on its row index in a table.
|
|
12
|
+
* @param table Table to search for the item in
|
|
13
|
+
* @param columnName Column name to search for the item in
|
|
14
|
+
* @param defaultValue Optional default value. This would be the first item in
|
|
15
|
+
* the list and not expected to be in the Table.
|
|
16
|
+
* @param itemHeight Height of each item in the list
|
|
17
|
+
* @param topOffset Optional pixel offset from the top of the list
|
|
18
|
+
* @param value Value to search for in the column
|
|
19
|
+
*/
|
|
20
|
+
export declare function useGetItemPosition({ table, columnName, defaultValue, itemHeight, topOffset, value, }: UseGetItemPositionOptions): () => Promise<number>;
|
|
21
|
+
export default useGetItemPosition;
|
|
22
|
+
//# sourceMappingURL=useGetItemPosition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetItemPosition.d.ts","sourceRoot":"","sources":["../src/useGetItemPosition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EACV,SAAa,EACb,KAAK,GACN,EAAE,yBAAyB,yBAc3B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Gets an item's position in a list of items based on its row index in a table.
|
|
6
|
+
* @param table Table to search for the item in
|
|
7
|
+
* @param columnName Column name to search for the item in
|
|
8
|
+
* @param defaultValue Optional default value. This would be the first item in
|
|
9
|
+
* the list and not expected to be in the Table.
|
|
10
|
+
* @param itemHeight Height of each item in the list
|
|
11
|
+
* @param topOffset Optional pixel offset from the top of the list
|
|
12
|
+
* @param value Value to search for in the column
|
|
13
|
+
*/
|
|
14
|
+
export function useGetItemPosition(_ref) {
|
|
15
|
+
var {
|
|
16
|
+
table,
|
|
17
|
+
columnName,
|
|
18
|
+
defaultValue,
|
|
19
|
+
itemHeight,
|
|
20
|
+
topOffset = 0,
|
|
21
|
+
value
|
|
22
|
+
} = _ref;
|
|
23
|
+
return useCallback( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
24
|
+
if (table == null || value === '' || value === defaultValue) {
|
|
25
|
+
return topOffset;
|
|
26
|
+
}
|
|
27
|
+
var column = table.findColumn(columnName);
|
|
28
|
+
var rowIndex = yield table.seekRow(0, column, 'String', value);
|
|
29
|
+
|
|
30
|
+
// If a default item exists at the top of the list, offset the item index by 1
|
|
31
|
+
var defaultItemOffset = defaultValue == null ? 0 : 1;
|
|
32
|
+
return (rowIndex + defaultItemOffset) * itemHeight + topOffset;
|
|
33
|
+
}), [columnName, defaultValue, itemHeight, table, topOffset, value]);
|
|
34
|
+
}
|
|
35
|
+
export default useGetItemPosition;
|
|
36
|
+
//# sourceMappingURL=useGetItemPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetItemPosition.js","names":["useCallback","useGetItemPosition","table","columnName","defaultValue","itemHeight","topOffset","value","column","findColumn","rowIndex","seekRow","defaultItemOffset"],"sources":["../src/useGetItemPosition.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport type { Table } from '@deephaven/jsapi-types';\n\nexport interface UseGetItemPositionOptions {\n table?: Table | null;\n columnName: string;\n defaultValue?: string | null;\n itemHeight: number;\n topOffset?: number;\n value: string;\n}\n\n/**\n * Gets an item's position in a list of items based on its row index in a table.\n * @param table Table to search for the item in\n * @param columnName Column name to search for the item in\n * @param defaultValue Optional default value. This would be the first item in\n * the list and not expected to be in the Table.\n * @param itemHeight Height of each item in the list\n * @param topOffset Optional pixel offset from the top of the list\n * @param value Value to search for in the column\n */\nexport function useGetItemPosition({\n table,\n columnName,\n defaultValue,\n itemHeight,\n topOffset = 0,\n value,\n}: UseGetItemPositionOptions) {\n return useCallback(async () => {\n if (table == null || value === '' || value === defaultValue) {\n return topOffset;\n }\n\n const column = table.findColumn(columnName);\n const rowIndex = await table.seekRow(0, column, 'String', value);\n\n // If a default item exists at the top of the list, offset the item index by 1\n const defaultItemOffset = defaultValue == null ? 0 : 1;\n\n return (rowIndex + defaultItemOffset) * itemHeight + topOffset;\n }, [columnName, defaultValue, itemHeight, table, topOffset, value]);\n}\n\nexport default useGetItemPosition;\n"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,OAAO;AAYnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkB,OAOJ;EAAA,IAPK;IACjCC,KAAK;IACLC,UAAU;IACVC,YAAY;IACZC,UAAU;IACVC,SAAS,GAAG,CAAC;IACbC;EACyB,CAAC;EAC1B,OAAOP,WAAW,iCAAC,aAAY;IAC7B,IAAIE,KAAK,IAAI,IAAI,IAAIK,KAAK,KAAK,EAAE,IAAIA,KAAK,KAAKH,YAAY,EAAE;MAC3D,OAAOE,SAAS;IAClB;IAEA,IAAME,MAAM,GAAGN,KAAK,CAACO,UAAU,CAACN,UAAU,CAAC;IAC3C,IAAMO,QAAQ,SAASR,KAAK,CAACS,OAAO,CAAC,CAAC,EAAEH,MAAM,EAAE,QAAQ,EAAED,KAAK,CAAC;;IAEhE;IACA,IAAMK,iBAAiB,GAAGR,YAAY,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC;IAEtD,OAAO,CAACM,QAAQ,GAAGE,iBAAiB,IAAIP,UAAU,GAAGC,SAAS;EAChE,CAAC,GAAE,CAACH,UAAU,EAAEC,YAAY,EAAEC,UAAU,EAAEH,KAAK,EAAEI,SAAS,EAAEC,KAAK,CAAC,CAAC;AACrE;AAEA,eAAeN,kBAAkB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ListData } from '@react-stately/data';
|
|
2
1
|
import type { Table, TreeTable } from '@deephaven/jsapi-types';
|
|
3
|
-
import {
|
|
2
|
+
import { WindowedListData } from '@deephaven/react-hooks';
|
|
3
|
+
import { KeyedItem } from '@deephaven/utils';
|
|
4
4
|
/**
|
|
5
5
|
* Initializes a ListData instance that can be used for windowed views of a
|
|
6
6
|
* Table. The list must always contain a KeyedItem for every record in the table,
|
|
@@ -11,8 +11,8 @@ import { KeyedItem } from '@deephaven/jsapi-utils';
|
|
|
11
11
|
* source table. This is intended for "human" sized tables such as those used in
|
|
12
12
|
* admin panels. This is not suitable for "machine" scale with millions+ rows.
|
|
13
13
|
* @param table The table that will be used to determine the list size.
|
|
14
|
-
* @returns a
|
|
15
|
-
* by React Stately on every render.
|
|
14
|
+
* @returns a WindowedListData object.
|
|
16
15
|
*/
|
|
17
|
-
export
|
|
16
|
+
export declare function useInitializeViewportData<T>(table: Table | TreeTable | null): WindowedListData<KeyedItem<T>>;
|
|
17
|
+
export default useInitializeViewportData;
|
|
18
18
|
//# sourceMappingURL=useInitializeViewportData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitializeViewportData.d.ts","sourceRoot":"","sources":["../src/useInitializeViewportData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useInitializeViewportData.d.ts","sourceRoot":"","sources":["../src/useInitializeViewportData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,EAAuB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAM7C;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,IAAI,GAC9B,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAwBhC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { useListData } from '@react-stately/data';
|
|
3
2
|
import { generateEmptyKeyedItems } from '@deephaven/jsapi-utils';
|
|
4
|
-
import {
|
|
3
|
+
import { useWindowedListData } from '@deephaven/react-hooks';
|
|
4
|
+
import Log from '@deephaven/log';
|
|
5
5
|
import useTableSize from "./useTableSize.js";
|
|
6
|
+
var log = Log.module('useInitializeViewportData');
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* Initializes a ListData instance that can be used for windowed views of a
|
|
8
10
|
* Table. The list must always contain a KeyedItem for every record in the table,
|
|
@@ -13,50 +15,31 @@ import useTableSize from "./useTableSize.js";
|
|
|
13
15
|
* source table. This is intended for "human" sized tables such as those used in
|
|
14
16
|
* admin panels. This is not suitable for "machine" scale with millions+ rows.
|
|
15
17
|
* @param table The table that will be used to determine the list size.
|
|
16
|
-
* @returns a
|
|
17
|
-
* by React Stately on every render.
|
|
18
|
+
* @returns a WindowedListData object.
|
|
18
19
|
*/
|
|
19
|
-
export
|
|
20
|
-
var viewportData =
|
|
21
|
-
var prevTable = usePrevious(table);
|
|
20
|
+
export function useInitializeViewportData(table) {
|
|
21
|
+
var viewportData = useWindowedListData({});
|
|
22
22
|
|
|
23
23
|
// If the table changes size, we need to re-initialize it.
|
|
24
|
-
var
|
|
24
|
+
var targetSize = Math.max(0, useTableSize(table));
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
26
|
+
// Whenever the table reference or size changes, replace the list with empty
|
|
27
|
+
// items. This is preferred over updating items in place to avoid the user
|
|
28
|
+
// seeing items shift around multiple times.
|
|
29
29
|
useEffect(() => {
|
|
30
30
|
var currentSize = viewportData.items.length;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var {
|
|
36
|
-
key
|
|
37
|
-
} = _ref;
|
|
38
|
-
return key;
|
|
39
|
-
}));
|
|
40
|
-
currentSize = 0;
|
|
41
|
-
}
|
|
42
|
-
if (!table) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (size > currentSize) {
|
|
46
|
-
viewportData.insert(currentSize, ...generateEmptyKeyedItems(currentSize, size - 1));
|
|
47
|
-
} else if (size < currentSize) {
|
|
48
|
-
var keys = viewportData.items.slice(size).map(_ref2 => {
|
|
49
|
-
var {
|
|
50
|
-
key
|
|
51
|
-
} = _ref2;
|
|
52
|
-
return key;
|
|
31
|
+
if (targetSize !== currentSize) {
|
|
32
|
+
log.debug('size changed:', {
|
|
33
|
+
currentSize,
|
|
34
|
+
targetSize
|
|
53
35
|
});
|
|
54
|
-
viewportData.
|
|
36
|
+
viewportData.setItems(Array.from(generateEmptyKeyedItems(0, targetSize - 1)));
|
|
55
37
|
}
|
|
56
38
|
|
|
57
39
|
// Intentionally excluding viewportData since it changes on every render.
|
|
58
40
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
-
}, [
|
|
41
|
+
}, [targetSize, table]);
|
|
60
42
|
return viewportData;
|
|
61
43
|
}
|
|
44
|
+
export default useInitializeViewportData;
|
|
62
45
|
//# sourceMappingURL=useInitializeViewportData.js.map
|