next-data-kit 7.7.0 → 7.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/components/data-kit-infinity.d.ts +2 -7
- package/dist/client/components/data-kit-infinity.d.ts.map +1 -1
- package/dist/client/components/data-kit-infinity.js +17 -91
- package/dist/client/components/data-kit-infinity.js.map +1 -1
- package/dist/index.cjs +1 -213
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -215
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { TDataKitInput, TDataKitResult, TDataKitFilterItem, TDataKitSelectableItem, TDataKitStateMode, TExtractDataKitItemType, TFilterConfig, TUseDataKitReturn
|
|
2
|
+
import type { TDataKitInput, TDataKitResult, TDataKitFilterItem, TDataKitSelectableItem, TDataKitStateMode, TExtractDataKitItemType, TFilterConfig, TUseDataKitReturn } from '../../types';
|
|
3
3
|
export declare const DataKitInfinity: <TAction extends (input: TDataKitInput<unknown>) => Promise<TDataKitResult<TDataKitSelectableItem>>>(props: Readonly<{
|
|
4
4
|
action: TAction;
|
|
5
5
|
query?: Record<string, unknown>;
|
|
@@ -16,13 +16,8 @@ export declare const DataKitInfinity: <TAction extends (input: TDataKitInput<unk
|
|
|
16
16
|
autoFetch?: boolean;
|
|
17
17
|
debounce?: number;
|
|
18
18
|
state?: TDataKitStateMode;
|
|
19
|
-
inverse?: boolean;
|
|
20
19
|
manual?: boolean;
|
|
21
|
-
|
|
22
|
-
isActive: boolean;
|
|
23
|
-
threshold?: number;
|
|
24
|
-
};
|
|
20
|
+
fullHeight?: boolean;
|
|
25
21
|
children: (dataKit: TUseDataKitReturn<unknown, TExtractDataKitItemType<TAction>>) => React.ReactNode;
|
|
26
|
-
ref?: React.Ref<TDataKitRef<unknown, TExtractDataKitItemType<TAction>>>;
|
|
27
22
|
}>) => React.ReactElement;
|
|
28
23
|
//# sourceMappingURL=data-kit-infinity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-kit-infinity.d.ts","sourceRoot":"","sources":["../../../src/client/components/data-kit-infinity.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAgBxE,OAAO,KAAK,EACP,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,
|
|
1
|
+
{"version":3,"file":"data-kit-infinity.d.ts","sourceRoot":"","sources":["../../../src/client/components/data-kit-infinity.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAgBxE,OAAO,KAAK,EACP,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACrB,MAAM,aAAa,CAAC;AAgNrB,eAAO,MAAM,eAAe,EAAsC,CAC7D,OAAO,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,EAElG,KAAK,EAAE,QAAQ,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;KAAE,EAAE,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,EAAE,uBAAuB,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACzG,CAAC,KACF,KAAK,CAAC,YAAY,CAAC"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
4
|
import { useInView } from 'react-intersection-observer';
|
|
5
|
-
import { Filter, Loader2
|
|
5
|
+
import { Filter, Loader2 } from 'lucide-react';
|
|
6
6
|
import { useDataKit } from '../hooks/useDataKit';
|
|
7
7
|
import { Button, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch, } from './ui';
|
|
8
|
-
const DataKitInfinityInner = (props
|
|
8
|
+
const DataKitInfinityInner = (props) => {
|
|
9
9
|
// ** Deconstruct Props
|
|
10
|
-
const { action, query, filterConfig, filters = [], limit: limitConfig, defaultSort = [], className, autoFetch = true, debounce = 300, state: stateMode = 'memory',
|
|
10
|
+
const { action, query, filterConfig, filters = [], limit: limitConfig, defaultSort = [], className, autoFetch = true, debounce = 300, state: stateMode = 'memory', manual = false, fullHeight = true, children, } = props;
|
|
11
11
|
// ** Ref
|
|
12
12
|
const containerRef = useRef(null);
|
|
13
13
|
const scrollContainerRef = useRef(null);
|
|
14
14
|
const [allItems, setAllItems] = useState([]);
|
|
15
15
|
// ** State
|
|
16
16
|
const [isFilterOpen, setIsFilterOpen] = useState(false);
|
|
17
|
-
const [isPullRefreshing, setIsPullRefreshing] = useState(false);
|
|
18
|
-
const [pullStartY, setPullStartY] = useState(0);
|
|
19
|
-
const [pullDistance, setPullDistance] = useState(0);
|
|
20
17
|
// ** Variable
|
|
21
18
|
const overlayContainer = containerRef.current;
|
|
22
|
-
const pullThreshold = pullDownToRefresh?.threshold ?? 50;
|
|
23
19
|
// ** Hooks
|
|
24
20
|
const dataKit = useDataKit({
|
|
25
21
|
action: action,
|
|
@@ -43,118 +39,48 @@ const DataKitInfinityInner = (props, ref) => {
|
|
|
43
39
|
threshold: 0,
|
|
44
40
|
rootMargin: '100px',
|
|
45
41
|
});
|
|
46
|
-
const { ref: loadMoreTopRef, inView: inViewTop } = useInView({
|
|
47
|
-
threshold: 0,
|
|
48
|
-
rootMargin: '100px',
|
|
49
|
-
});
|
|
50
|
-
// ** Imperative Handle
|
|
51
|
-
React.useImperativeHandle(ref, () => dataKit, [dataKit]);
|
|
52
42
|
// ** Handlers
|
|
53
43
|
const handleResetFilters = useCallback(() => {
|
|
54
44
|
filters.forEach((f) => {
|
|
55
45
|
dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === 'BOOLEAN' ? false : ''));
|
|
56
46
|
});
|
|
57
47
|
}, [filters, dataKit.actions]);
|
|
58
|
-
const loadMore = useCallback(
|
|
48
|
+
const loadMore = useCallback(() => {
|
|
59
49
|
if (dataKit.state.isLoading || !dataKit.state.hasNextPage)
|
|
60
50
|
return;
|
|
61
51
|
dataKit.actions.setPage(dataKit.page + 1);
|
|
62
|
-
}, [dataKit]);
|
|
63
|
-
const resetAndFetch = useCallback(async () => {
|
|
64
|
-
setAllItems([]);
|
|
65
|
-
dataKit.actions.setPage(1);
|
|
66
|
-
await dataKit.actions.refresh();
|
|
67
|
-
}, [dataKit.actions]);
|
|
68
|
-
// ** Pull to refresh handlers
|
|
69
|
-
const handleTouchStart = useCallback((e) => {
|
|
70
|
-
if (!pullDownToRefresh?.isActive)
|
|
71
|
-
return;
|
|
72
|
-
const scrollTop = scrollContainerRef.current?.scrollTop ?? 0;
|
|
73
|
-
if (scrollTop === 0 && e.touches && e.touches[0]) {
|
|
74
|
-
setPullStartY(e.touches[0].clientY);
|
|
75
|
-
}
|
|
76
|
-
}, [pullDownToRefresh?.isActive]);
|
|
77
|
-
const handleTouchMove = useCallback((e) => {
|
|
78
|
-
if (!pullDownToRefresh?.isActive || pullStartY === 0)
|
|
79
|
-
return;
|
|
80
|
-
if (!e.touches || !e.touches[0])
|
|
81
|
-
return;
|
|
82
|
-
const scrollTop = scrollContainerRef.current?.scrollTop ?? 0;
|
|
83
|
-
if (scrollTop === 0) {
|
|
84
|
-
const distance = e.touches[0].clientY - pullStartY;
|
|
85
|
-
if (distance > 0) {
|
|
86
|
-
setPullDistance(Math.min(distance, pullThreshold * 2));
|
|
87
|
-
if (distance > pullThreshold * 2) {
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}, [pullDownToRefresh?.isActive, pullStartY, pullThreshold]);
|
|
93
|
-
const handleTouchEnd = useCallback(async () => {
|
|
94
|
-
if (!pullDownToRefresh?.isActive)
|
|
95
|
-
return;
|
|
96
|
-
if (pullDistance > pullThreshold) {
|
|
97
|
-
setIsPullRefreshing(true);
|
|
98
|
-
await resetAndFetch();
|
|
99
|
-
setIsPullRefreshing(false);
|
|
100
|
-
}
|
|
101
|
-
setPullStartY(0);
|
|
102
|
-
setPullDistance(0);
|
|
103
|
-
}, [pullDownToRefresh?.isActive, pullDistance, pullThreshold, resetAndFetch]);
|
|
104
|
-
// ** Effects
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (!pullDownToRefresh?.isActive)
|
|
107
|
-
return;
|
|
108
|
-
const container = scrollContainerRef.current;
|
|
109
|
-
if (!container)
|
|
110
|
-
return;
|
|
111
|
-
container.addEventListener('touchstart', handleTouchStart);
|
|
112
|
-
container.addEventListener('touchmove', handleTouchMove, { passive: false });
|
|
113
|
-
container.addEventListener('touchend', handleTouchEnd);
|
|
114
|
-
return () => {
|
|
115
|
-
container.removeEventListener('touchstart', handleTouchStart);
|
|
116
|
-
container.removeEventListener('touchmove', handleTouchMove);
|
|
117
|
-
container.removeEventListener('touchend', handleTouchEnd);
|
|
118
|
-
};
|
|
119
|
-
}, [pullDownToRefresh?.isActive, handleTouchStart, handleTouchMove, handleTouchEnd]);
|
|
52
|
+
}, [dataKit.state.isLoading, dataKit.state.hasNextPage, dataKit.page, dataKit.actions]);
|
|
120
53
|
// ** Initial fetch
|
|
121
54
|
useEffect(() => {
|
|
122
|
-
if (autoFetch
|
|
55
|
+
if (autoFetch)
|
|
123
56
|
dataKit.actions.refresh();
|
|
124
|
-
}
|
|
125
57
|
}, [autoFetch]);
|
|
126
58
|
// ** Append new items when dataKit items change
|
|
127
59
|
useEffect(() => {
|
|
128
60
|
if (dataKit.items.length > 0) {
|
|
129
61
|
setAllItems((prev) => {
|
|
130
|
-
if (dataKit.page === 1)
|
|
62
|
+
if (dataKit.page === 1)
|
|
131
63
|
return dataKit.items;
|
|
132
|
-
|
|
133
|
-
// Check if items are already in the list to avoid duplicates
|
|
134
|
-
const newItems = dataKit.items.filter((newItem) => !prev.some((existingItem) => existingItem.id === newItem.id));
|
|
135
|
-
return inverse ? [...newItems, ...prev] : [...prev, ...newItems];
|
|
64
|
+
return [...prev, ...dataKit.items];
|
|
136
65
|
});
|
|
137
66
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
useEffect(() => {
|
|
141
|
-
if (inViewBottom && !inverse) {
|
|
142
|
-
loadMore();
|
|
67
|
+
else if (dataKit.page === 1) {
|
|
68
|
+
setAllItems([]);
|
|
143
69
|
}
|
|
144
|
-
}, [
|
|
145
|
-
// **
|
|
70
|
+
}, [dataKit.items, dataKit.page]);
|
|
71
|
+
// ** Infinite scroll trigger
|
|
146
72
|
useEffect(() => {
|
|
147
|
-
if (
|
|
73
|
+
if (inViewBottom && !dataKit.state.isLoading && dataKit.state.hasNextPage) {
|
|
148
74
|
loadMore();
|
|
149
75
|
}
|
|
150
|
-
}, [
|
|
76
|
+
}, [inViewBottom, dataKit.state.isLoading, dataKit.state.hasNextPage]);
|
|
151
77
|
// ** Create enhanced dataKit with all accumulated items
|
|
152
78
|
const enhancedDataKit = {
|
|
153
79
|
...dataKit,
|
|
154
80
|
items: allItems,
|
|
155
81
|
};
|
|
156
82
|
// ** Render
|
|
157
|
-
return (_jsxs("div", { ref: containerRef, className: `flex flex-col ${
|
|
83
|
+
return (_jsxs("div", { ref: containerRef, className: `flex flex-col ${fullHeight ? 'h-full' : ''}`, children: [filters.length > 0 && (_jsx("div", { className: "shrink-0 px-4 pt-4 pb-3", children: _jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Filter, { className: "mr-1.5 size-4" }), "Filters"] }) }), _jsxs(PopoverContent, { align: "start", className: "w-80", container: overlayContainer, children: [_jsx("div", { className: "grid gap-3", children: filters.map((f) => (_jsxs("div", { className: "grid gap-1.5", children: [_jsx("label", { className: "text-sm font-medium", children: f.label }), f.type === 'TEXT' && (_jsx("input", { type: "text", className: "h-9 w-full rounded-md border bg-transparent px-3 text-sm outline-none focus:ring-2 focus:ring-ring", placeholder: f.placeholder, value: dataKit.filter[f.id] ?? '', onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value) })), f.type === 'SELECT' && (_jsxs(Select, { value: String(dataKit.filter[f.id] || '__all__'), onValueChange: (v) => dataKit.actions.setFilter(f.id, v === '__all__' ? '' : v), children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { container: overlayContainer, children: [_jsx(SelectItem, { value: "__all__", children: "All" }), f.dataset?.map((d) => (_jsx(SelectItem, { value: d.id, children: d.label }, d.id)))] })] })), f.type === 'BOOLEAN' && (_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-sm text-muted-foreground", children: f.placeholder ?? 'Enable' }), _jsx(Switch, { checked: Boolean(dataKit.filter[f.id]), onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c) })] }))] }, f.id))) }), _jsxs("div", { className: "mt-4 flex justify-between border-t pt-3", children: [_jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }), _jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })] })] })] }) })), _jsxs("div", { ref: scrollContainerRef, className: `relative flex-1 ${fullHeight ? 'min-h-0' : ''} overflow-y-auto overflow-x-hidden ${className ?? ''}`, children: [children(enhancedDataKit), _jsx("div", { ref: loadMoreBottomRef, className: manual ? '' : 'flex items-center justify-center py-4', children: !manual && (_jsxs(_Fragment, { children: [dataKit.state.isLoading && _jsx(Loader2, { className: "size-6 animate-spin text-muted-foreground" }), !dataKit.state.isLoading && !dataKit.state.hasNextPage && allItems.length > 0 && (_jsx("p", { className: "text-sm text-muted-foreground", children: "You're all set" }))] })) })] })] }));
|
|
158
84
|
};
|
|
159
|
-
export const DataKitInfinity =
|
|
85
|
+
export const DataKitInfinity = DataKitInfinityInner;
|
|
160
86
|
//# sourceMappingURL=data-kit-infinity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-kit-infinity.js","sourceRoot":"","sources":["../../../src/client/components/data-kit-infinity.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,
|
|
1
|
+
{"version":3,"file":"data-kit-infinity.js","sourceRoot":"","sources":["../../../src/client/components/data-kit-infinity.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACF,MAAM,EACN,OAAO,EACP,cAAc,EACd,cAAc,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AC,CAAC,EAAE,CAAC,CAAC,CAAC,uCAAuC,YACvF,CAAC,MAAM,IAAI,CACP,8BACM,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,KAAC,OAAO,IAAC,SAAS,EAAC,2CAA2C,GAAG,EAC5F,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAC7E,YAAG,SAAS,EAAC,+BAA+B,+BAAmB,CACnE,IACH,CACP,GACA,IACL,IACJ,CACX,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,oBAkBR,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
|
11
11
|
var reactSlot = require('@radix-ui/react-slot');
|
|
12
12
|
var classVarianceAuthority = require('class-variance-authority');
|
|
13
13
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
14
|
-
|
|
14
|
+
require('react-intersection-observer');
|
|
15
15
|
|
|
16
16
|
function _interopNamespace(e) {
|
|
17
17
|
if (e && e.__esModule) return e;
|
|
@@ -1801,218 +1801,6 @@ var DataKitInner = (props, ref) => {
|
|
|
1801
1801
|
] });
|
|
1802
1802
|
};
|
|
1803
1803
|
var DataKit = React2__namespace.default.forwardRef(DataKitInner);
|
|
1804
|
-
var DataKitInfinityInner = (props, ref) => {
|
|
1805
|
-
const {
|
|
1806
|
-
action,
|
|
1807
|
-
query,
|
|
1808
|
-
filterConfig,
|
|
1809
|
-
filters = [],
|
|
1810
|
-
limit: limitConfig,
|
|
1811
|
-
defaultSort = [],
|
|
1812
|
-
className,
|
|
1813
|
-
autoFetch = true,
|
|
1814
|
-
debounce: debounce2 = 300,
|
|
1815
|
-
state: stateMode = "memory",
|
|
1816
|
-
inverse = false,
|
|
1817
|
-
manual = false,
|
|
1818
|
-
pullDownToRefresh,
|
|
1819
|
-
children
|
|
1820
|
-
} = props;
|
|
1821
|
-
const containerRef = React2.useRef(null);
|
|
1822
|
-
const scrollContainerRef = React2.useRef(null);
|
|
1823
|
-
const [allItems, setAllItems] = React2.useState([]);
|
|
1824
|
-
const [isFilterOpen, setIsFilterOpen] = React2.useState(false);
|
|
1825
|
-
const [isPullRefreshing, setIsPullRefreshing] = React2.useState(false);
|
|
1826
|
-
const [pullStartY, setPullStartY] = React2.useState(0);
|
|
1827
|
-
const [pullDistance, setPullDistance] = React2.useState(0);
|
|
1828
|
-
const overlayContainer = containerRef.current;
|
|
1829
|
-
const pullThreshold = pullDownToRefresh?.threshold ?? 50;
|
|
1830
|
-
const dataKit = useDataKit({
|
|
1831
|
-
action,
|
|
1832
|
-
filterConfig,
|
|
1833
|
-
autoFetch: false,
|
|
1834
|
-
// We'll control fetching manually
|
|
1835
|
-
debounce: debounce2,
|
|
1836
|
-
state: stateMode,
|
|
1837
|
-
initial: {
|
|
1838
|
-
limit: limitConfig?.default ?? 10,
|
|
1839
|
-
query: query ?? {},
|
|
1840
|
-
sorts: defaultSort,
|
|
1841
|
-
filter: filters.reduce((acc, f) => {
|
|
1842
|
-
if (f.defaultValue !== void 0) acc[f.id] = f.defaultValue;
|
|
1843
|
-
return acc;
|
|
1844
|
-
}, {})
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1847
|
-
const { ref: loadMoreBottomRef, inView: inViewBottom } = reactIntersectionObserver.useInView({
|
|
1848
|
-
threshold: 0,
|
|
1849
|
-
rootMargin: "100px"
|
|
1850
|
-
});
|
|
1851
|
-
const { ref: loadMoreTopRef, inView: inViewTop } = reactIntersectionObserver.useInView({
|
|
1852
|
-
threshold: 0,
|
|
1853
|
-
rootMargin: "100px"
|
|
1854
|
-
});
|
|
1855
|
-
React2__namespace.default.useImperativeHandle(ref, () => dataKit, [dataKit]);
|
|
1856
|
-
const handleResetFilters = React2.useCallback(() => {
|
|
1857
|
-
filters.forEach((f) => {
|
|
1858
|
-
dataKit.actions.setFilter(f.id, f.defaultValue ?? (f.type === "BOOLEAN" ? false : ""));
|
|
1859
|
-
});
|
|
1860
|
-
}, [filters, dataKit.actions]);
|
|
1861
|
-
const loadMore = React2.useCallback(async () => {
|
|
1862
|
-
if (dataKit.state.isLoading || !dataKit.state.hasNextPage) return;
|
|
1863
|
-
dataKit.actions.setPage(dataKit.page + 1);
|
|
1864
|
-
}, [dataKit]);
|
|
1865
|
-
const resetAndFetch = React2.useCallback(async () => {
|
|
1866
|
-
setAllItems([]);
|
|
1867
|
-
dataKit.actions.setPage(1);
|
|
1868
|
-
await dataKit.actions.refresh();
|
|
1869
|
-
}, [dataKit.actions]);
|
|
1870
|
-
const handleTouchStart = React2.useCallback((e) => {
|
|
1871
|
-
if (!pullDownToRefresh?.isActive) return;
|
|
1872
|
-
const scrollTop = scrollContainerRef.current?.scrollTop ?? 0;
|
|
1873
|
-
if (scrollTop === 0 && e.touches && e.touches[0]) {
|
|
1874
|
-
setPullStartY(e.touches[0].clientY);
|
|
1875
|
-
}
|
|
1876
|
-
}, [pullDownToRefresh?.isActive]);
|
|
1877
|
-
const handleTouchMove = React2.useCallback((e) => {
|
|
1878
|
-
if (!pullDownToRefresh?.isActive || pullStartY === 0) return;
|
|
1879
|
-
if (!e.touches || !e.touches[0]) return;
|
|
1880
|
-
const scrollTop = scrollContainerRef.current?.scrollTop ?? 0;
|
|
1881
|
-
if (scrollTop === 0) {
|
|
1882
|
-
const distance = e.touches[0].clientY - pullStartY;
|
|
1883
|
-
if (distance > 0) {
|
|
1884
|
-
setPullDistance(Math.min(distance, pullThreshold * 2));
|
|
1885
|
-
if (distance > pullThreshold * 2) {
|
|
1886
|
-
e.preventDefault();
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
}, [pullDownToRefresh?.isActive, pullStartY, pullThreshold]);
|
|
1891
|
-
const handleTouchEnd = React2.useCallback(async () => {
|
|
1892
|
-
if (!pullDownToRefresh?.isActive) return;
|
|
1893
|
-
if (pullDistance > pullThreshold) {
|
|
1894
|
-
setIsPullRefreshing(true);
|
|
1895
|
-
await resetAndFetch();
|
|
1896
|
-
setIsPullRefreshing(false);
|
|
1897
|
-
}
|
|
1898
|
-
setPullStartY(0);
|
|
1899
|
-
setPullDistance(0);
|
|
1900
|
-
}, [pullDownToRefresh?.isActive, pullDistance, pullThreshold, resetAndFetch]);
|
|
1901
|
-
React2.useEffect(() => {
|
|
1902
|
-
if (!pullDownToRefresh?.isActive) return;
|
|
1903
|
-
const container = scrollContainerRef.current;
|
|
1904
|
-
if (!container) return;
|
|
1905
|
-
container.addEventListener("touchstart", handleTouchStart);
|
|
1906
|
-
container.addEventListener("touchmove", handleTouchMove, { passive: false });
|
|
1907
|
-
container.addEventListener("touchend", handleTouchEnd);
|
|
1908
|
-
return () => {
|
|
1909
|
-
container.removeEventListener("touchstart", handleTouchStart);
|
|
1910
|
-
container.removeEventListener("touchmove", handleTouchMove);
|
|
1911
|
-
container.removeEventListener("touchend", handleTouchEnd);
|
|
1912
|
-
};
|
|
1913
|
-
}, [pullDownToRefresh?.isActive, handleTouchStart, handleTouchMove, handleTouchEnd]);
|
|
1914
|
-
React2.useEffect(() => {
|
|
1915
|
-
if (autoFetch && dataKit.page === 1 && allItems.length === 0) {
|
|
1916
|
-
dataKit.actions.refresh();
|
|
1917
|
-
}
|
|
1918
|
-
}, [autoFetch]);
|
|
1919
|
-
React2.useEffect(() => {
|
|
1920
|
-
if (dataKit.items.length > 0) {
|
|
1921
|
-
setAllItems((prev) => {
|
|
1922
|
-
if (dataKit.page === 1) {
|
|
1923
|
-
return dataKit.items;
|
|
1924
|
-
}
|
|
1925
|
-
const newItems = dataKit.items.filter(
|
|
1926
|
-
(newItem) => !prev.some((existingItem) => existingItem.id === newItem.id)
|
|
1927
|
-
);
|
|
1928
|
-
return inverse ? [...newItems, ...prev] : [...prev, ...newItems];
|
|
1929
|
-
});
|
|
1930
|
-
}
|
|
1931
|
-
}, [dataKit.items, dataKit.page, inverse]);
|
|
1932
|
-
React2.useEffect(() => {
|
|
1933
|
-
if (inViewBottom && !inverse) {
|
|
1934
|
-
loadMore();
|
|
1935
|
-
}
|
|
1936
|
-
}, [inViewBottom, inverse, loadMore]);
|
|
1937
|
-
React2.useEffect(() => {
|
|
1938
|
-
if (inViewTop && inverse) {
|
|
1939
|
-
loadMore();
|
|
1940
|
-
}
|
|
1941
|
-
}, [inViewTop, inverse, loadMore]);
|
|
1942
|
-
const enhancedDataKit = {
|
|
1943
|
-
...dataKit,
|
|
1944
|
-
items: allItems
|
|
1945
|
-
};
|
|
1946
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: `flex flex-col ${className ?? ""}`, children: [
|
|
1947
|
-
filters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-3", children: /* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: isFilterOpen, onOpenChange: setIsFilterOpen, children: [
|
|
1948
|
-
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", children: [
|
|
1949
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Filter, { className: "mr-1.5 size-4" }),
|
|
1950
|
-
"Filters"
|
|
1951
|
-
] }) }),
|
|
1952
|
-
/* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { align: "start", className: "w-80", container: overlayContainer, children: [
|
|
1953
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-3", children: filters.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1.5", children: [
|
|
1954
|
-
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "text-sm font-medium", children: f.label }),
|
|
1955
|
-
f.type === "TEXT" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1956
|
-
"input",
|
|
1957
|
-
{
|
|
1958
|
-
type: "text",
|
|
1959
|
-
className: "h-9 w-full rounded-md border bg-transparent px-3 text-sm outline-none focus:ring-2 focus:ring-ring",
|
|
1960
|
-
placeholder: f.placeholder,
|
|
1961
|
-
value: dataKit.filter[f.id] ?? "",
|
|
1962
|
-
onChange: (e) => dataKit.actions.setFilter(f.id, e.target.value)
|
|
1963
|
-
}
|
|
1964
|
-
),
|
|
1965
|
-
f.type === "SELECT" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1966
|
-
Select,
|
|
1967
|
-
{
|
|
1968
|
-
value: String(dataKit.filter[f.id] || "__all__"),
|
|
1969
|
-
onValueChange: (v) => dataKit.actions.setFilter(f.id, v === "__all__" ? "" : v),
|
|
1970
|
-
children: [
|
|
1971
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
1972
|
-
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { container: overlayContainer, children: [
|
|
1973
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: "__all__", children: "All" }),
|
|
1974
|
-
f.dataset?.map((d) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: d.id, children: d.label }, d.id))
|
|
1975
|
-
] })
|
|
1976
|
-
]
|
|
1977
|
-
}
|
|
1978
|
-
),
|
|
1979
|
-
f.type === "BOOLEAN" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1980
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: f.placeholder ?? "Enable" }),
|
|
1981
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1982
|
-
Switch,
|
|
1983
|
-
{
|
|
1984
|
-
checked: Boolean(dataKit.filter[f.id]),
|
|
1985
|
-
onCheckedChange: (c) => dataKit.actions.setFilter(f.id, c)
|
|
1986
|
-
}
|
|
1987
|
-
)
|
|
1988
|
-
] })
|
|
1989
|
-
] }, f.id)) }),
|
|
1990
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4 flex justify-between border-t pt-3", children: [
|
|
1991
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: handleResetFilters, children: "Reset" }),
|
|
1992
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", onClick: () => setIsFilterOpen(false), children: "Done" })
|
|
1993
|
-
] })
|
|
1994
|
-
] })
|
|
1995
|
-
] }) }),
|
|
1996
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: scrollContainerRef, className: "relative flex-1 overflow-auto", children: [
|
|
1997
|
-
pullDownToRefresh?.isActive && pullDistance > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
-
"div",
|
|
1999
|
-
{
|
|
2000
|
-
className: "absolute left-0 right-0 top-0 flex items-center justify-center bg-background/80 backdrop-blur-sm transition-all",
|
|
2001
|
-
style: { height: `${pullDistance}px` },
|
|
2002
|
-
children: pullDistance > pullThreshold ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "size-5 text-primary" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "Pull to refresh" })
|
|
2003
|
-
}
|
|
2004
|
-
),
|
|
2005
|
-
!manual && isPullRefreshing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-6 animate-spin text-muted-foreground" }) }),
|
|
2006
|
-
inverse && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: loadMoreTopRef, className: manual ? "" : "flex items-center justify-center py-4", children: !manual && dataKit.state.hasNextPage && dataKit.state.isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-6 animate-spin text-muted-foreground" }) }),
|
|
2007
|
-
children(enhancedDataKit),
|
|
2008
|
-
!inverse && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: loadMoreBottomRef, className: manual ? "" : "flex items-center justify-center py-4", children: !manual && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2009
|
-
dataKit.state.isLoading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-6 animate-spin text-muted-foreground" }),
|
|
2010
|
-
!dataKit.state.isLoading && !dataKit.state.hasNextPage && allItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "You're all set" })
|
|
2011
|
-
] }) })
|
|
2012
|
-
] })
|
|
2013
|
-
] });
|
|
2014
|
-
};
|
|
2015
|
-
React2__namespace.default.forwardRef(DataKitInfinityInner);
|
|
2016
1804
|
|
|
2017
1805
|
exports.DataKit = DataKit;
|
|
2018
1806
|
exports.DataKitContext = DefaultDataKitContext;
|