@economic/taco 2.47.0-server-1 → 2.47.0-server-2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +1 -0
- package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -1
- package/dist/esm/packages/taco/src/charts/components/Legend.js +1 -0
- package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -0
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +249 -0
- package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/primitives/Table/useTableDataLoader2.d.ts +0 -1
- package/dist/taco.cjs.development.js +244 -0
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +1 -1
@@ -84,6 +84,7 @@ import '../../../components/Header/Header.js';
|
|
84
84
|
import '../../../components/Layout/Layout.js';
|
85
85
|
import '../../../components/Navigation2/components/Link.js';
|
86
86
|
import '../../../components/Navigation2/Navigation2.js';
|
87
|
+
import '../../../primitives/Table/useTableDataLoader2.js';
|
87
88
|
import '../../../hooks/useBoundaryOverflowDetection.js';
|
88
89
|
import '../../../utils/hooks/useOnClickOutside.js';
|
89
90
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Legend.js","sources":["../../../../../../../../src/charts/components/Donut/Legend.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Button, Icon, OverflowGroup } from '../../../index';\n\nimport { getThemeColor } from '../../utils/color';\nimport { DonutChartProps, DonutChartSegmentProps, SegmentIds } from './DonutChart';\n\ntype LegendProps = Pick<DonutChartProps, 'formatter' | 'label' | 'legendPosition'> & {\n data: DonutChartSegmentProps[];\n hoveredItem: SegmentIds;\n onClick: (entry: DonutChartSegmentProps | DonutChartSegmentProps[]) => void;\n selectedItem: SegmentIds;\n setHoveredItem: React.Dispatch<React.SetStateAction<SegmentIds>>;\n total: number;\n visibleItems: Record<string, boolean>;\n};\n\nexport const Legend = ({\n legendPosition,\n hoveredItem,\n selectedItem,\n data,\n onClick,\n setHoveredItem,\n formatter,\n total,\n visibleItems,\n label,\n}: LegendProps) => {\n const isTotalLegendSelected = selectedItem.length === data.length;\n const isTotalLegendHovered = hoveredItem.length === data.length;\n\n const handleMouseLeave = () => setHoveredItem([]);\n\n const renderLegendItem = (entry: DonutChartSegmentProps | null, index?: number) => {\n const isTotal = entry === null;\n // We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.\n const itemData = entry === null ? { id: 'total', label, value: total, color: 'grey-300' } : entry;\n const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);\n const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);\n\n return (\n <li\n key={isTotal ? 'total' : `${itemData.label}-${index}`}\n className={cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {\n 'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),\n 'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right'),\n })}\n onClick={() => onClick(isTotal ? data : itemData)}\n onMouseEnter={() => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id])}\n onMouseLeave={handleMouseLeave}>\n {legendPosition === 'bottom' ? (\n <div className=\"flex items-center gap-1\">\n <span\n className={cn('ml-1 h-3 w-3 rounded-sm', {\n 'border-grey-300 border !bg-white': !visibleItems[itemData.id],\n })}\n style={{ backgroundColor: getThemeColor(itemData.color) }}>\n {visibleItems[itemData.id] && isHovered && (\n <Icon name=\"tick-bold\" className=\"mb-2.5 !h-full !w-full text-white\" />\n )}\n </span>\n <div>{itemData.label}</div>\n </div>\n ) : (\n <>\n <span\n className=\"ml-1 mt-1 h-9 w-2 rounded-[1px]\"\n style={{ backgroundColor: getThemeColor(itemData.color) }}\n />\n <div>\n {itemData.label}\n <span className=\"-mt-1 flex w-full text-lg font-bold\">\n {formatter ? formatter(itemData.value) : itemData.value}\n </span>\n </div>\n </>\n )}\n </li>\n );\n };\n\n const moreButton = moreButtonText => (\n <Button appearance=\"transparent\" className=\"text-grey-700\">\n {moreButtonText}\n </Button>\n );\n\n const className = cn('flex-grow pl-4', {\n 'w-full': legendPosition === 'bottom',\n });\n return (\n <div className={className}>\n <ul\n className={cn(\n 'mb-0 ml-0 mt-4 flex justify-center space-y-1',\n legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row'\n )}>\n {legendPosition === 'right' ? (\n <>\n {renderLegendItem(null)}\n {data.map(renderLegendItem)}\n </>\n ) : (\n <OverflowGroup className=\"w-full items-center py-1\" moreButton={moreButton}>\n {data.map(renderLegendItem)}\n </OverflowGroup>\n )}\n </ul>\n </div>\n );\n};\n"],"names":["Legend","legendPosition","hoveredItem","selectedItem","data","onClick","setHoveredItem","formatter","total","visibleItems","label","isTotalLegendSelected","length","isTotalLegendHovered","handleMouseLeave","renderLegendItem","entry","index","isTotal","itemData","id","value","color","isSelected","includes","isHovered","React","key","className","cn","onMouseEnter","map","item","onMouseLeave","style","backgroundColor","getThemeColor","Icon","name","moreButton","moreButtonText","Button","appearance","OverflowGroup"],"mappings":"
|
1
|
+
{"version":3,"file":"Legend.js","sources":["../../../../../../../../src/charts/components/Donut/Legend.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Button, Icon, OverflowGroup } from '../../../index';\n\nimport { getThemeColor } from '../../utils/color';\nimport { DonutChartProps, DonutChartSegmentProps, SegmentIds } from './DonutChart';\n\ntype LegendProps = Pick<DonutChartProps, 'formatter' | 'label' | 'legendPosition'> & {\n data: DonutChartSegmentProps[];\n hoveredItem: SegmentIds;\n onClick: (entry: DonutChartSegmentProps | DonutChartSegmentProps[]) => void;\n selectedItem: SegmentIds;\n setHoveredItem: React.Dispatch<React.SetStateAction<SegmentIds>>;\n total: number;\n visibleItems: Record<string, boolean>;\n};\n\nexport const Legend = ({\n legendPosition,\n hoveredItem,\n selectedItem,\n data,\n onClick,\n setHoveredItem,\n formatter,\n total,\n visibleItems,\n label,\n}: LegendProps) => {\n const isTotalLegendSelected = selectedItem.length === data.length;\n const isTotalLegendHovered = hoveredItem.length === data.length;\n\n const handleMouseLeave = () => setHoveredItem([]);\n\n const renderLegendItem = (entry: DonutChartSegmentProps | null, index?: number) => {\n const isTotal = entry === null;\n // We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.\n const itemData = entry === null ? { id: 'total', label, value: total, color: 'grey-300' } : entry;\n const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);\n const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);\n\n return (\n <li\n key={isTotal ? 'total' : `${itemData.label}-${index}`}\n className={cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {\n 'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),\n 'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right'),\n })}\n onClick={() => onClick(isTotal ? data : itemData)}\n onMouseEnter={() => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id])}\n onMouseLeave={handleMouseLeave}>\n {legendPosition === 'bottom' ? (\n <div className=\"flex items-center gap-1\">\n <span\n className={cn('ml-1 h-3 w-3 rounded-sm', {\n 'border-grey-300 border !bg-white': !visibleItems[itemData.id],\n })}\n style={{ backgroundColor: getThemeColor(itemData.color) }}>\n {visibleItems[itemData.id] && isHovered && (\n <Icon name=\"tick-bold\" className=\"mb-2.5 !h-full !w-full text-white\" />\n )}\n </span>\n <div>{itemData.label}</div>\n </div>\n ) : (\n <>\n <span\n className=\"ml-1 mt-1 h-9 w-2 rounded-[1px]\"\n style={{ backgroundColor: getThemeColor(itemData.color) }}\n />\n <div>\n {itemData.label}\n <span className=\"-mt-1 flex w-full text-lg font-bold\">\n {formatter ? formatter(itemData.value) : itemData.value}\n </span>\n </div>\n </>\n )}\n </li>\n );\n };\n\n const moreButton = moreButtonText => (\n <Button appearance=\"transparent\" className=\"text-grey-700\">\n {moreButtonText}\n </Button>\n );\n\n const className = cn('flex-grow pl-4', {\n 'w-full': legendPosition === 'bottom',\n });\n return (\n <div className={className}>\n <ul\n className={cn(\n 'mb-0 ml-0 mt-4 flex justify-center space-y-1',\n legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row'\n )}>\n {legendPosition === 'right' ? (\n <>\n {renderLegendItem(null)}\n {data.map(renderLegendItem)}\n </>\n ) : (\n <OverflowGroup className=\"w-full items-center py-1\" moreButton={moreButton}>\n {data.map(renderLegendItem)}\n </OverflowGroup>\n )}\n </ul>\n </div>\n );\n};\n"],"names":["Legend","legendPosition","hoveredItem","selectedItem","data","onClick","setHoveredItem","formatter","total","visibleItems","label","isTotalLegendSelected","length","isTotalLegendHovered","handleMouseLeave","renderLegendItem","entry","index","isTotal","itemData","id","value","color","isSelected","includes","isHovered","React","key","className","cn","onMouseEnter","map","item","onMouseLeave","style","backgroundColor","getThemeColor","Icon","name","moreButton","moreButtonText","Button","appearance","OverflowGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiBaA,MAAM,GAAGA,CAAC;EACnBC,cAAc;EACdC,WAAW;EACXC,YAAY;EACZC,IAAI;EACJC,OAAO;EACPC,cAAc;EACdC,SAAS;EACTC,KAAK;EACLC,YAAY;EACZC;CACU;EACV,MAAMC,qBAAqB,GAAGR,YAAY,CAACS,MAAM,KAAKR,IAAI,CAACQ,MAAM;EACjE,MAAMC,oBAAoB,GAAGX,WAAW,CAACU,MAAM,KAAKR,IAAI,CAACQ,MAAM;EAE/D,MAAME,gBAAgB,GAAGA,MAAMR,cAAc,CAAC,EAAE,CAAC;EAEjD,MAAMS,gBAAgB,GAAGA,CAACC,KAAoC,EAAEC,KAAc;IAC1E,MAAMC,OAAO,GAAGF,KAAK,KA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ACC,EAAE,CAAC,IAAIK,SAAS,kBACnCC,6BAACW,IAAI;MAACC,IAAI,EAAC,WAAW;MAACV,SAAS,EAAC;MAAsC,CAC1E,CACE,eACPF,0CAAMP,QAAQ,CAACT,KAAK,CAAO,CACzB,kBAENgB,yEACIA;MACIE,SAAS,EAAC,iCAAiC;MAC3CM,KAAK,EAAE;QAAEC,eAAe,EAAEC,aAAa,CAACjB,QAAQ,CAACG,KAAK;;MACxD,eACFI,0CACKP,QAAQ,CAACT,KAAK,eACfgB;MAAME,SAAS,EAAC;OACXrB,SAAS,GAAGA,SAAS,CAACY,QAAQ,CAACE,KAAK,CAAC,GAAGF,QAAQ,CAACE,KAAK,CACpD,CACL,CACP,CACN,CACA;GAEZ;EAED,MAAMkB,UAAU,GAAGC,cAAc,kBAC7Bd,6BAACe,MAAM;IAACC,UAAU,EAAC,aAAa;IAACd,SAAS,EAAC;KACtCY,cAAc,CACV,CACZ;EAED,MAAMZ,SAAS,GAAGC,EAAE,CAAC,gBAAgB,EAAE;IACnC,QAAQ,EAAE5B,cAAc,KAAK;GAChC,CAAC;EACF,oBACIyB;IAAKE,SAAS,EAAEA;kBACZF;IACIE,SAAS,EAAEC,EAAE,CACT,8CAA8C,EAC9C5B,cAAc,KAAK,OAAO,GAAG,gBAAgB,GAAG,UAAU;KAE7DA,cAAc,KAAK,OAAO,iBACvByB,4DACKX,gBAAgB,CAAC,IAAI,CAAC,EACtBX,IAAI,CAAC2B,GAAG,CAAChB,gBAAgB,CAAC,CAC5B,kBAEHW,6BAACiB,aAAa;IAACf,SAAS,EAAC,0BAA0B;IAACW,UAAU,EAAEA;KAC3DnC,IAAI,CAAC2B,GAAG,CAAChB,gBAAgB,CAAC,CACf,CACnB,CACA,CACH;AAEd;;;;"}
|
@@ -83,6 +83,7 @@ import '../../components/Header/Header.js';
|
|
83
83
|
import '../../components/Layout/Layout.js';
|
84
84
|
import '../../components/Navigation2/components/Link.js';
|
85
85
|
import '../../components/Navigation2/Navigation2.js';
|
86
|
+
import '../../primitives/Table/useTableDataLoader2.js';
|
86
87
|
import '../../hooks/useBoundaryOverflowDetection.js';
|
87
88
|
import '../../utils/hooks/useOnClickOutside.js';
|
88
89
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Legend.js","sources":["../../../../../../../src/charts/components/Legend.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport cn from 'clsx';\nimport { Icon, OverflowGroup, Button } from '../../index';\n\nimport { ActiveChartItems, PayloadType } from './types';\n\ntype InternalProps<TType> = {\n payload: PayloadType<TType>[];\n layout: string;\n activeIndex: number | undefined;\n};\n\nexport type LegendProps<TType> = {\n activeItems: ActiveChartItems<TType>;\n onMouseEnter: (entry: PayloadType<TType>, index: number) => void;\n onMouseLeave: () => void;\n onClick: (entry: PayloadType<TType>) => void;\n};\n\nexport type Props<TType> = LegendProps<TType> & InternalProps<TType>;\n\nexport function Legend<TType>(props: LegendProps<TType>) {\n const { activeIndex, onMouseEnter, onMouseLeave, onClick, payload, layout, activeItems } = props as Props<TType>;\n const [hoverIndex, setHoverIndex] = useState<number | null>(null);\n\n const handleMouseEnter = (entry: PayloadType<TType>, index: number) => {\n setHoverIndex(index);\n if (activeItems[entry.dataKey]) onMouseEnter(entry, index);\n };\n\n const handleMouseLeave = () => {\n onMouseLeave();\n setHoverIndex(null);\n };\n\n const moreButton = moreButtonText => (\n <Button appearance=\"transparent\" className=\"text-grey-700\">\n {moreButtonText}\n </Button>\n );\n\n return (\n <div className=\"mx-auto w-auto max-w-full overflow-hidden\">\n <div className={cn('mb-0 ml-0 flex justify-center', { 'flex-col': layout === 'vertical' })}>\n {/** py-1 is need to make sure the more button focus outline doesn't get cropped */}\n <OverflowGroup className=\"w-full items-center py-1\" moreButton={moreButton}>\n {payload.map((entry, index) => (\n <span\n key={`${entry.dataKey}-${index}`}\n className={cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {\n 'bg-grey-100 rounded': activeIndex === index,\n })}\n onMouseEnter={() => handleMouseEnter(entry, index)}\n onMouseLeave={handleMouseLeave}\n onClick={onClick ? () => onClick(entry) : undefined}>\n <span className=\"text-grey-700 flex items-center gap-[4px]\">\n <span\n className={cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {\n 'border-grey-300 border !bg-white': !activeItems[entry.dataKey],\n })}\n style={{ backgroundColor: entry.color }}>\n {hoverIndex === index && activeItems[entry.dataKey] && (\n <Icon name=\"tick-bold\" className=\"!h-full !w-full text-white\" />\n )}\n </span>\n {entry.value}\n </span>\n </span>\n ))}\n </OverflowGroup>\n </div>\n </div>\n );\n}\n"],"names":["Legend","props","activeIndex","onMouseEnter","onMouseLeave","onClick","payload","layout","activeItems","hoverIndex","setHoverIndex","useState","handleMouseEnter","entry","index","dataKey","handleMouseLeave","moreButton","moreButtonText","React","Button","appearance","className","cn","OverflowGroup","map","key","undefined","style","backgroundColor","color","Icon","name","value"],"mappings":"
|
1
|
+
{"version":3,"file":"Legend.js","sources":["../../../../../../../src/charts/components/Legend.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport cn from 'clsx';\nimport { Icon, OverflowGroup, Button } from '../../index';\n\nimport { ActiveChartItems, PayloadType } from './types';\n\ntype InternalProps<TType> = {\n payload: PayloadType<TType>[];\n layout: string;\n activeIndex: number | undefined;\n};\n\nexport type LegendProps<TType> = {\n activeItems: ActiveChartItems<TType>;\n onMouseEnter: (entry: PayloadType<TType>, index: number) => void;\n onMouseLeave: () => void;\n onClick: (entry: PayloadType<TType>) => void;\n};\n\nexport type Props<TType> = LegendProps<TType> & InternalProps<TType>;\n\nexport function Legend<TType>(props: LegendProps<TType>) {\n const { activeIndex, onMouseEnter, onMouseLeave, onClick, payload, layout, activeItems } = props as Props<TType>;\n const [hoverIndex, setHoverIndex] = useState<number | null>(null);\n\n const handleMouseEnter = (entry: PayloadType<TType>, index: number) => {\n setHoverIndex(index);\n if (activeItems[entry.dataKey]) onMouseEnter(entry, index);\n };\n\n const handleMouseLeave = () => {\n onMouseLeave();\n setHoverIndex(null);\n };\n\n const moreButton = moreButtonText => (\n <Button appearance=\"transparent\" className=\"text-grey-700\">\n {moreButtonText}\n </Button>\n );\n\n return (\n <div className=\"mx-auto w-auto max-w-full overflow-hidden\">\n <div className={cn('mb-0 ml-0 flex justify-center', { 'flex-col': layout === 'vertical' })}>\n {/** py-1 is need to make sure the more button focus outline doesn't get cropped */}\n <OverflowGroup className=\"w-full items-center py-1\" moreButton={moreButton}>\n {payload.map((entry, index) => (\n <span\n key={`${entry.dataKey}-${index}`}\n className={cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {\n 'bg-grey-100 rounded': activeIndex === index,\n })}\n onMouseEnter={() => handleMouseEnter(entry, index)}\n onMouseLeave={handleMouseLeave}\n onClick={onClick ? () => onClick(entry) : undefined}>\n <span className=\"text-grey-700 flex items-center gap-[4px]\">\n <span\n className={cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {\n 'border-grey-300 border !bg-white': !activeItems[entry.dataKey],\n })}\n style={{ backgroundColor: entry.color }}>\n {hoverIndex === index && activeItems[entry.dataKey] && (\n <Icon name=\"tick-bold\" className=\"!h-full !w-full text-white\" />\n )}\n </span>\n {entry.value}\n </span>\n </span>\n ))}\n </OverflowGroup>\n </div>\n </div>\n );\n}\n"],"names":["Legend","props","activeIndex","onMouseEnter","onMouseLeave","onClick","payload","layout","activeItems","hoverIndex","setHoverIndex","useState","handleMouseEnter","entry","index","dataKey","handleMouseLeave","moreButton","moreButtonText","React","Button","appearance","className","cn","OverflowGroup","map","key","undefined","style","backgroundColor","color","Icon","name","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqBgBA,MAAMA,CAAQC,KAAyB;EACnD,MAAM;IAAEC,WAAW;IAAEC,YAAY;IAAEC,YAAY;IAAEC,OAAO;IAAEC,OAAO;IAAEC,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;KACjE,CAAC;IACFa,KAAK,EAAE;MAAEC,eAAe,EAAEhB,KAAK,CAACiB;;KAC/BrB,UAAU,KAAKK,KAAK,IAAIN,WAAW,CAACK,KAAK,CAACE,OAAO,CAAC,kBAC/CI,6BAACY,IAAI;IAACC,IAAI,EAAC,WAAW;IAACV,SAAS,EAAC;IAA+B,CACnE,CACE,EACNT,KAAK,CAACoB,KAAK,CACT,CACJ,CACV,CAAC,CACU,CACd,CACJ;AAEd;;;;"}
|
@@ -82,6 +82,7 @@ export { Header } from './components/Header/Header.js';
|
|
82
82
|
export { Layout } from './components/Layout/Layout.js';
|
83
83
|
export { getNavigationLinkClasses } from './components/Navigation2/components/Link.js';
|
84
84
|
export { Navigation2 } from './components/Navigation2/Navigation2.js';
|
85
|
+
export { useTableDataLoader2 } from './primitives/Table/useTableDataLoader2.js';
|
85
86
|
export { useBoundaryOverflowDetection } from './hooks/useBoundaryOverflowDetection.js';
|
86
87
|
export { useOnClickOutside } from './utils/hooks/useOnClickOutside.js';
|
87
88
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -0,0 +1,249 @@
|
|
1
|
+
import React__default from 'react';
|
2
|
+
import { _finallyRethrows, _catch } from '../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
|
3
|
+
import { DEFAULT_PAGE_SIZE } from './useTableDataLoader.js';
|
4
|
+
|
5
|
+
const DATASET_SIZE_MULTIPLIER = 15;
|
6
|
+
function useTableDataLoader2(fetchPage, fetchAll, options = {
|
7
|
+
pageSize: DEFAULT_PAGE_SIZE
|
8
|
+
}) {
|
9
|
+
const loadPage = function (pageIndex, sorting, filters, search, hiddenColumns, reset = false) {
|
10
|
+
try {
|
11
|
+
if (_hasFetchedAll.current) {
|
12
|
+
return Promise.resolve();
|
13
|
+
}
|
14
|
+
// if page is already loading, abort, otherwise mark it as loading
|
15
|
+
if (_pendingPageRequests.current[pageIndex]) {
|
16
|
+
return Promise.resolve();
|
17
|
+
} else {
|
18
|
+
_pendingPageRequests.current[pageIndex] = true;
|
19
|
+
}
|
20
|
+
// if the page is already loaded and has actual rows, abort
|
21
|
+
if (data.pages.includes(pageIndex)) {
|
22
|
+
const position = data.pages.indexOf(pageIndex);
|
23
|
+
if (data.rows[position * pageSize] !== undefined) {
|
24
|
+
return Promise.resolve();
|
25
|
+
}
|
26
|
+
}
|
27
|
+
// set the sorting so we can track if it changed between loads
|
28
|
+
_lastUsedSorting.current = sorting;
|
29
|
+
// set the filters so we can track if it changed between loads
|
30
|
+
_lastUsedFilters.current = filters;
|
31
|
+
const direction = getDirection2(pageIndex, _lastFetchedPage.current);
|
32
|
+
const _temp2 = _finallyRethrows(function () {
|
33
|
+
return _catch(function () {
|
34
|
+
return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, search, hiddenColumns)).then(function (response) {
|
35
|
+
length.current = response.length;
|
36
|
+
// update state, here we do some "magic" to support "load in place"
|
37
|
+
setData(currentData => {
|
38
|
+
const nextPages = getPages(pageIndex, _lastFetchedPage.current, reset ? [] : currentData.pages, direction);
|
39
|
+
let nextRows = currentData.rows;
|
40
|
+
if (reset || !direction) {
|
41
|
+
const index = nextPages.indexOf(pageIndex);
|
42
|
+
const startIndex = (index > -1 ? index : 0) * pageSize;
|
43
|
+
if (reset) {
|
44
|
+
nextRows = [].concat(response.data);
|
45
|
+
} else if (startIndex > 0 || pageIndex === 0) {
|
46
|
+
nextRows = Array(startIndex).fill(undefined).concat(response.data);
|
47
|
+
} else if (startIndex === 0) {
|
48
|
+
nextRows = response.data.concat(currentData.rows.slice(pageSize));
|
49
|
+
}
|
50
|
+
} else if (direction === 'forward') {
|
51
|
+
// if the new data will exceed the dataset size, then chop off the start or end
|
52
|
+
// this keeps the stored dataset to our preferred size
|
53
|
+
if (currentData.rows.length >= DATASET_SIZE) {
|
54
|
+
nextRows = currentData.rows.slice(DEFAULT_PAGE_SIZE).concat(response.data);
|
55
|
+
} else {
|
56
|
+
nextRows = currentData.rows.concat(response.data);
|
57
|
+
}
|
58
|
+
} else if (direction === 'backward') {
|
59
|
+
if (currentData.rows.length >= DATASET_SIZE) {
|
60
|
+
nextRows = response.data.concat(currentData.rows.slice(0, -1 * pageSize));
|
61
|
+
} else {
|
62
|
+
nextRows = currentData.rows.concat(response.data);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
return {
|
66
|
+
rows: nextRows,
|
67
|
+
pages: nextPages
|
68
|
+
};
|
69
|
+
});
|
70
|
+
});
|
71
|
+
}, function () {});
|
72
|
+
}, function (_wasThrown2, _result2) {
|
73
|
+
_hasFetchedAll.current = false;
|
74
|
+
// reset pending requests
|
75
|
+
delete _pendingPageRequests.current[pageIndex];
|
76
|
+
// update the last loaded page
|
77
|
+
_lastFetchedPage.current = {
|
78
|
+
index: pageIndex,
|
79
|
+
direction
|
80
|
+
};
|
81
|
+
if (_wasThrown2) throw _result2;
|
82
|
+
return _result2;
|
83
|
+
});
|
84
|
+
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
85
|
+
} catch (e) {
|
86
|
+
return Promise.reject(e);
|
87
|
+
}
|
88
|
+
};
|
89
|
+
const {
|
90
|
+
pageSize
|
91
|
+
} = options;
|
92
|
+
const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
|
93
|
+
// track the data length, we don't know it until the first request
|
94
|
+
const length = React__default.useRef(0);
|
95
|
+
// data will be filled after the first request
|
96
|
+
const [data, setData] = React__default.useState({
|
97
|
+
rows: [],
|
98
|
+
pages: []
|
99
|
+
});
|
100
|
+
// track which pages have been loaded to dedupe requests
|
101
|
+
const _pendingPageRequests = React__default.useRef({});
|
102
|
+
const _lastUsedSorting = React__default.useRef([]);
|
103
|
+
const _lastUsedFilters = React__default.useRef([]);
|
104
|
+
const _lastUsedSearch = React__default.useRef();
|
105
|
+
const _lastUsedHiddenColumns = React__default.useRef([]);
|
106
|
+
const _lastFetchedPage = React__default.useRef({
|
107
|
+
index: undefined,
|
108
|
+
direction: undefined
|
109
|
+
});
|
110
|
+
const _hasFetchedAll = React__default.useRef(false);
|
111
|
+
const loadAll = function (sorting, filters, search, hiddenColumns) {
|
112
|
+
try {
|
113
|
+
_hasFetchedAll.current = true;
|
114
|
+
// set the sorting so we can track if it changed between loads
|
115
|
+
_lastUsedSorting.current = sorting;
|
116
|
+
// set the filters so we can track if it changed between loads
|
117
|
+
_lastUsedFilters.current = filters;
|
118
|
+
const _temp = _finallyRethrows(function () {
|
119
|
+
return _catch(function () {
|
120
|
+
return Promise.resolve(fetchAll(sorting, filters, search, hiddenColumns)).then(function (response) {
|
121
|
+
length.current = response.length;
|
122
|
+
setData({
|
123
|
+
rows: response.data,
|
124
|
+
pages: Array.from(Array(response.length / pageSize).keys())
|
125
|
+
});
|
126
|
+
});
|
127
|
+
}, function () {});
|
128
|
+
}, function (_wasThrown, _result) {
|
129
|
+
// reset pending requests
|
130
|
+
_pendingPageRequests.current = {};
|
131
|
+
if (_wasThrown) throw _result;
|
132
|
+
return _result;
|
133
|
+
});
|
134
|
+
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
135
|
+
} catch (e) {
|
136
|
+
return Promise.reject(e);
|
137
|
+
}
|
138
|
+
};
|
139
|
+
const invalidate = function () {
|
140
|
+
try {
|
141
|
+
// reset stuff
|
142
|
+
_pendingPageRequests.current = {};
|
143
|
+
_hasFetchedAll.current = false;
|
144
|
+
// load the last page that we scrolled to
|
145
|
+
return loadPage(getCurrentPage(data.pages, _lastFetchedPage.current), _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current, _lastUsedHiddenColumns.current, true);
|
146
|
+
} catch (e) {
|
147
|
+
return Promise.reject(e);
|
148
|
+
}
|
149
|
+
};
|
150
|
+
// search works client side - it fetches all then works client side - so these handlers are a little "weird"
|
151
|
+
// if a search is currently "active", we need to re load all because
|
152
|
+
const handleSort = function (sorting) {
|
153
|
+
try {
|
154
|
+
_lastUsedSorting.current = sorting;
|
155
|
+
// reset stuff
|
156
|
+
_pendingPageRequests.current = {};
|
157
|
+
_hasFetchedAll.current = false;
|
158
|
+
return loadPage(getCurrentPage(data.pages, _lastFetchedPage.current), sorting, _lastUsedFilters.current, _lastUsedSearch.current, _lastUsedHiddenColumns.current, true);
|
159
|
+
} catch (e) {
|
160
|
+
return Promise.reject(e);
|
161
|
+
}
|
162
|
+
};
|
163
|
+
const handleFilter = function (filters, hiddenColumns) {
|
164
|
+
try {
|
165
|
+
_lastUsedFilters.current = filters;
|
166
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
167
|
+
// reset stuff
|
168
|
+
_pendingPageRequests.current = {};
|
169
|
+
_hasFetchedAll.current = false;
|
170
|
+
return loadPage(getCurrentPage(data.pages, _lastFetchedPage.current), _lastUsedSorting.current, filters, _lastUsedSearch.current, hiddenColumns, true);
|
171
|
+
} catch (e) {
|
172
|
+
return Promise.reject(e);
|
173
|
+
}
|
174
|
+
};
|
175
|
+
const handleSearch = function (search, hiddenColumns) {
|
176
|
+
try {
|
177
|
+
_lastUsedSearch.current = search;
|
178
|
+
_lastUsedHiddenColumns.current = hiddenColumns;
|
179
|
+
// reset stuff
|
180
|
+
_pendingPageRequests.current = {};
|
181
|
+
_hasFetchedAll.current = false;
|
182
|
+
return loadPage(getCurrentPage(data.pages, _lastFetchedPage.current), _lastUsedSorting.current, _lastUsedFilters.current, search, hiddenColumns, true);
|
183
|
+
} catch (e) {
|
184
|
+
return Promise.reject(e);
|
185
|
+
}
|
186
|
+
};
|
187
|
+
return [{
|
188
|
+
data: data.rows,
|
189
|
+
pages: data.pages,
|
190
|
+
length: length.current,
|
191
|
+
loadAll,
|
192
|
+
loadPage,
|
193
|
+
onChangeFilter: handleFilter,
|
194
|
+
onChangeSearch: handleSearch,
|
195
|
+
onChangeSort: handleSort,
|
196
|
+
pageSize,
|
197
|
+
_experimentalDataLoader2: true
|
198
|
+
}, invalidate];
|
199
|
+
}
|
200
|
+
function getCurrentPage(currentPages, lastFetchedPage) {
|
201
|
+
if (currentPages.length <= 2) {
|
202
|
+
var _currentPages$;
|
203
|
+
return (_currentPages$ = currentPages[0]) !== null && _currentPages$ !== void 0 ? _currentPages$ : 0;
|
204
|
+
}
|
205
|
+
const middle = Math.floor(DATASET_SIZE_MULTIPLIER / 2);
|
206
|
+
if (lastFetchedPage.index) {
|
207
|
+
if (!lastFetchedPage.direction) {
|
208
|
+
return lastFetchedPage.index;
|
209
|
+
}
|
210
|
+
return lastFetchedPage.direction === 'forward' ? lastFetchedPage.index + middle : lastFetchedPage.index - middle;
|
211
|
+
}
|
212
|
+
return 0;
|
213
|
+
}
|
214
|
+
function getDirection2(pageIndex, lastUsedPage) {
|
215
|
+
if (lastUsedPage.index === undefined) {
|
216
|
+
return undefined;
|
217
|
+
}
|
218
|
+
if (pageIndex > lastUsedPage.index) {
|
219
|
+
if (lastUsedPage.index + 1 === pageIndex || lastUsedPage.index + DATASET_SIZE_MULTIPLIER === pageIndex) {
|
220
|
+
return 'forward';
|
221
|
+
}
|
222
|
+
} else if (pageIndex < lastUsedPage.index) {
|
223
|
+
if (lastUsedPage.index - 1 === pageIndex || lastUsedPage.index - DATASET_SIZE_MULTIPLIER === pageIndex) {
|
224
|
+
return 'backward';
|
225
|
+
}
|
226
|
+
}
|
227
|
+
return undefined;
|
228
|
+
}
|
229
|
+
function getPages(pageIndex, lastUsedPage, currentPages, direction) {
|
230
|
+
if (currentPages.length && (pageIndex === lastUsedPage.index || currentPages.includes(pageIndex))) {
|
231
|
+
return currentPages;
|
232
|
+
}
|
233
|
+
if (direction === 'forward') {
|
234
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;
|
235
|
+
return nextPages.concat(pageIndex);
|
236
|
+
}
|
237
|
+
if (direction === 'backward') {
|
238
|
+
const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;
|
239
|
+
return [pageIndex].concat(nextPages);
|
240
|
+
}
|
241
|
+
if (pageIndex === 0) {
|
242
|
+
return [0];
|
243
|
+
}
|
244
|
+
// don't go forward, the current page will trigger load of the next page
|
245
|
+
return [pageIndex - 1, pageIndex];
|
246
|
+
}
|
247
|
+
|
248
|
+
export { useTableDataLoader2 };
|
249
|
+
//# sourceMappingURL=useTableDataLoader2.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useTableDataLoader2.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader2.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n TableSearchHandler,\n} from './types';\nimport { DEFAULT_PAGE_SIZE, useTableDataLoaderOptions } from './useTableDataLoader';\n\nconst DATASET_SIZE_MULTIPLIER = 15;\n\nexport type useTableDataPageFetcher2<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined,\n hiddenColumns: string[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher2<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined,\n hiddenColumns: string[]\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderValues2<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSearch: TableSearchHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n pages: number[];\n _experimentalDataLoader2: boolean;\n};\n\ntype Data<TType = unknown> = {\n rows: TType[];\n pages: number[];\n};\ntype Direction = 'forward' | 'backward' | undefined;\ntype LastFetchedPage = {\n index: number | undefined;\n direction: Direction;\n};\n\nexport function useTableDataLoader2<TType = unknown>(\n fetchPage: useTableDataPageFetcher2<TType>,\n fetchAll: useTableDataAllFetcher2<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues2<TType>, () => void] {\n const { pageSize } = options;\n const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number>(0);\n // data will be filled after the first request\n const [data, setData] = React.useState<Data<TType>>({ rows: [], pages: [] });\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string | undefined>();\n const _lastUsedHiddenColumns = React.useRef<string[]>([]);\n const _lastFetchedPage = React.useRef<LastFetchedPage>({\n index: undefined,\n direction: undefined,\n });\n const _hasFetchedAll = React.useRef<boolean>(false);\n\n async function loadPage(\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined,\n hiddenColumns: string[],\n reset = false\n ) {\n if (_hasFetchedAll.current) {\n return;\n }\n\n // if page is already loading, abort, otherwise mark it as loading\n if (_pendingPageRequests.current[pageIndex]) {\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n // if the page is already loaded and has actual rows, abort\n if (data.pages.includes(pageIndex)) {\n const position = data.pages.indexOf(pageIndex);\n\n if (data.rows[position * pageSize] !== undefined) {\n return;\n }\n }\n\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n const direction = getDirection2(pageIndex, _lastFetchedPage.current);\n\n try {\n const response = await fetchPage(pageIndex, pageSize, sorting, filters, search, hiddenColumns);\n length.current = response.length;\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n const nextPages = getPages(pageIndex, _lastFetchedPage.current, reset ? [] : currentData.pages, direction);\n let nextRows = currentData.rows;\n\n if (reset || !direction) {\n const index = nextPages.indexOf(pageIndex);\n const startIndex = (index > -1 ? index : 0) * pageSize;\n\n if (reset) {\n nextRows = ([] as TType[]).concat(response.data);\n } else if (startIndex > 0 || pageIndex === 0) {\n nextRows = Array(startIndex).fill(undefined).concat(response.data);\n } else if (startIndex === 0) {\n nextRows = response.data.concat(currentData.rows.slice(pageSize));\n }\n } else if (direction === 'forward') {\n // if the new data will exceed the dataset size, then chop off the start or end\n // this keeps the stored dataset to our preferred size\n if (currentData.rows.length >= DATASET_SIZE) {\n nextRows = currentData.rows.slice(DEFAULT_PAGE_SIZE).concat(response.data);\n } else {\n nextRows = currentData.rows.concat(response.data);\n }\n } else if (direction === 'backward') {\n if (currentData.rows.length >= DATASET_SIZE) {\n nextRows = response.data.concat(currentData.rows.slice(0, -1 * pageSize));\n } else {\n nextRows = currentData.rows.concat(response.data);\n }\n }\n\n return {\n rows: nextRows,\n pages: nextPages,\n };\n });\n } catch {\n //\n } finally {\n _hasFetchedAll.current = false;\n // reset pending requests\n delete _pendingPageRequests.current[pageIndex];\n // update the last loaded page\n _lastFetchedPage.current = {\n index: pageIndex,\n direction,\n };\n }\n }\n\n const loadAll = async (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined,\n hiddenColumns: string[]\n ) => {\n _hasFetchedAll.current = true;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n\n try {\n const response = await fetchAll(sorting, filters, search, hiddenColumns);\n length.current = response.length;\n\n setData({\n rows: response.data,\n pages: Array.from(Array(response.length / pageSize).keys()),\n });\n } catch {\n //\n } finally {\n // reset pending requests\n _pendingPageRequests.current = {};\n }\n };\n\n const invalidate = async () => {\n // reset stuff\n _pendingPageRequests.current = {};\n _hasFetchedAll.current = false;\n\n // load the last page that we scrolled to\n return loadPage(\n getCurrentPage(data.pages, _lastFetchedPage.current),\n _lastUsedSorting.current,\n _lastUsedFilters.current,\n _lastUsedSearch.current,\n _lastUsedHiddenColumns.current,\n true\n );\n };\n\n // search works client side - it fetches all then works client side - so these handlers are a little \"weird\"\n // if a search is currently \"active\", we need to re load all because\n const handleSort = async (sorting: TableColumnSort[]) => {\n _lastUsedSorting.current = sorting;\n // reset stuff\n _pendingPageRequests.current = {};\n _hasFetchedAll.current = false;\n\n return loadPage(\n getCurrentPage(data.pages, _lastFetchedPage.current),\n sorting,\n _lastUsedFilters.current,\n _lastUsedSearch.current,\n _lastUsedHiddenColumns.current,\n true\n );\n };\n const handleFilter = async (filters: TableColumnFilter[], hiddenColumns: string[]) => {\n _lastUsedFilters.current = filters;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n // reset stuff\n _pendingPageRequests.current = {};\n _hasFetchedAll.current = false;\n\n return loadPage(\n getCurrentPage(data.pages, _lastFetchedPage.current),\n _lastUsedSorting.current,\n filters,\n _lastUsedSearch.current,\n hiddenColumns,\n true\n );\n };\n const handleSearch = async (search: string | undefined, hiddenColumns: string[]) => {\n _lastUsedSearch.current = search;\n _lastUsedHiddenColumns.current = hiddenColumns;\n\n // reset stuff\n _pendingPageRequests.current = {};\n _hasFetchedAll.current = false;\n\n return loadPage(\n getCurrentPage(data.pages, _lastFetchedPage.current),\n _lastUsedSorting.current,\n _lastUsedFilters.current,\n search,\n hiddenColumns,\n true\n );\n };\n\n return [\n {\n data: data.rows,\n pages: data.pages,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSearch: handleSearch,\n onChangeSort: handleSort,\n pageSize,\n _experimentalDataLoader2: true,\n },\n invalidate,\n ];\n}\n\nfunction getCurrentPage(currentPages: number[], lastFetchedPage: LastFetchedPage): number {\n if (currentPages.length <= 2) {\n return currentPages[0] ?? 0;\n }\n\n const middle = Math.floor(DATASET_SIZE_MULTIPLIER / 2);\n\n if (lastFetchedPage.index) {\n if (!lastFetchedPage.direction) {\n return lastFetchedPage.index;\n }\n\n return lastFetchedPage.direction === 'forward' ? lastFetchedPage.index + middle : lastFetchedPage.index - middle;\n }\n\n return 0;\n}\n\nfunction getDirection2(pageIndex: number, lastUsedPage: LastFetchedPage): Direction {\n if (lastUsedPage.index === undefined) {\n return undefined;\n }\n\n if (pageIndex > lastUsedPage.index) {\n if (lastUsedPage.index + 1 === pageIndex || lastUsedPage.index + DATASET_SIZE_MULTIPLIER === pageIndex) {\n return 'forward';\n }\n } else if (pageIndex < lastUsedPage.index) {\n if (lastUsedPage.index - 1 === pageIndex || lastUsedPage.index - DATASET_SIZE_MULTIPLIER === pageIndex) {\n return 'backward';\n }\n }\n\n return undefined;\n}\n\nfunction getPages(pageIndex: number, lastUsedPage: LastFetchedPage, currentPages: number[], direction: Direction) {\n if (currentPages.length && (pageIndex === lastUsedPage.index || currentPages.includes(pageIndex))) {\n return currentPages;\n }\n\n if (direction === 'forward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;\n return nextPages.concat(pageIndex);\n }\n\n if (direction === 'backward') {\n const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;\n return [pageIndex].concat(nextPages);\n }\n\n if (pageIndex === 0) {\n return [0];\n }\n\n // don't go forward, the current page will trigger load of the next page\n return [pageIndex - 1, pageIndex];\n}\n"],"names":["DATASET_SIZE_MULTIPLIER","useTableDataLoader2","fetchPage","fetchAll","options","pageSize","DEFAULT_PAGE_SIZE","loadPage","pageIndex","sorting","filters","search","hiddenColumns","reset","_hasFetchedAll","current","Promise","resolve","_pendingPageRequests","data","pages","includes","position","indexOf","rows","undefined","_lastUsedSorting","_lastUsedFilters","direction","getDirection2","_lastFetchedPage","_temp2","_finallyRethrows","_catch","then","response","length","setData","currentData","nextPages","getPages","nextRows","index","startIndex","concat","Array","fill","slice","DATASET_SIZE","_wasThrown2","_result2","e","reject","React","useRef","useState","_lastUsedSearch","_lastUsedHiddenColumns","loadAll","_temp","from","keys","_wasThrown","_result","invalidate","getCurrentPage","handleSort","handleFilter","handleSearch","onChangeFilter","onChangeSearch","onChangeSort","_experimentalDataLoader2","currentPages","lastFetchedPage","_currentPages$","middle","Math","floor","lastUsedPage"],"mappings":";;;;AAYA,MAAMA,uBAAuB,GAAG,EAAE;SAyClBC,mBAAmBA,CAC/BC,SAA0C,EAC1CC,QAAwC,EACxCC,UAAqC;EAAEC,QAAQ,EAAEC;CAAmB;QAqBrDC,QAAQ,aACnBC,SAAiB,EACjBC,OAA0B,EAC1BC,OAA4B,EAC5BC,MAA0B,EAC1BC,aAAuB,EACvBC,KAAK,GAAG,KAAK;IAAA;MAEb,IAAIC,cAAc,CAACC,OAAO,EAAE;QACxB,OAAAC,OAAA,CAAAC,OAAA;;;MAIJ,IAAIC,oBAAoB,CAACH,OAAO,CAACP,SAAS,CAAC,EAAE;QACzC,OAAAQ,OAAA,CAAAC,OAAA;OACH,MAAM;QACHC,oBAAoB,CAACH,OAAO,CAACP,SAAS,CAAC,GAAG,IAAI;;;MAIlD,IAAIW,IAAI,CAACC,KAAK,CAACC,QAAQ,CAACb,SAAS,CAAC,EAAE;QAChC,MAAMc,QAAQ,GAAGH,IAAI,CAACC,KAAK,CAACG,OAAO,CAACf,SAAS,CAAC;QAE9C,IAAIW,IAAI,CAACK,IAAI,CAACF,QAAQ,GAAGjB,QAAQ,CAAC,KAAKoB,SAAS,EAAE;UAC9C,OAAAT,OAAA,CAAAC,OAAA;;;;MAKRS,gBAAgB,CAACX,OAAO,GAAGN,OAAO;;MAElCkB,gBAAgB,CAACZ,OAAO,GAAGL,OAAO;MAElC,MAAMkB,SAAS,GAAGC,aAAa,CAACrB,SAAS,EAAEsB,gBAAgB,CAACf,OAAO,CAAC;MAAC,MAAAgB,MAAA,GAAAC,gBAAA;QAAA,OAAAC,M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AChC,SAAiB,EAAEuE,YAA6B,EAAEN,YAAsB,EAAE7C,SAAoB;EAC5G,IAAI6C,YAAY,CAACrC,MAAM,KAAK5B,SAAS,KAAKuE,YAAY,CAACrC,KAAK,IAAI+B,YAAY,CAACpD,QAAQ,CAACb,SAAS,CAAC,CAAC,EAAE;IAC/F,OAAOiE,YAAY;;EAGvB,IAAI7C,SAAS,KAAK,SAAS,EAAE;IACzB,MAAMW,SAAS,GAAGkC,YAAY,CAACrC,MAAM,KAAKpC,uBAAuB,GAAGyE,YAAY,CAAC1B,KAAK,CAAC,CAAC,CAAC,GAAG0B,YAAY;IACxG,OAAOlC,SAAS,CAACK,MAAM,CAACpC,SAAS,CAAC;;EAGtC,IAAIoB,SAAS,KAAK,UAAU,EAAE;IAC1B,MAAMW,SAAS,GAAGkC,YAAY,CAACrC,MAAM,KAAKpC,uBAAuB,GAAGyE,YAAY,CAAC1B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG0B,YAAY;IAC5G,OAAO,CAACjE,SAAS,CAAC,CAACoC,MAAM,CAACL,SAAS,CAAC;;EAGxC,IAAI/B,SAAS,KAAK,CAAC,EAAE;IACjB,OAAO,CAAC,CAAC,CAAC;;;EAId,OAAO,CAACA,SAAS,GAAG,CAAC,EAAEA,SAAS,CAAC;AACrC;;;;"}
|
package/dist/index.d.ts
CHANGED
@@ -63,6 +63,7 @@ export * from './components/Navigation2/Navigation2';
|
|
63
63
|
export * as CollectionPrimitive from './primitives/Collection/Collection';
|
64
64
|
export * from './primitives/Table/types';
|
65
65
|
export * from './primitives/Table/useTableDataLoader';
|
66
|
+
export * from './primitives/Table/useTableDataLoader2';
|
66
67
|
export * from './utils/date';
|
67
68
|
export * from './utils/keyboard';
|
68
69
|
export * from './utils/mergeRefs';
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { TableColumnFilter, TableColumnSort, TableFilterHandler, TableServerLoadPageHandler, TableServerLoadAllHandler, TableSortHandler, TableSearchHandler } from './types';
|
2
2
|
import { useTableDataLoaderOptions } from './useTableDataLoader';
|
3
|
-
export declare const DEFAULT_PAGE_SIZE = 100;
|
4
3
|
export declare type useTableDataPageFetcher2<TType = unknown> = (pageIndex: number, pageSize: number, sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined, hiddenColumns: string[]) => Promise<{
|
5
4
|
data: TType[];
|
6
5
|
length: number;
|