@burdenoff/microfe-movethewheels 2026.703.6 → 2026.703.7
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/{AIAssistantPage-BmILdHgO.js → AIAssistantPage-B7FGmmKT.js} +5 -5
- package/dist/{AnalyticsPage-BSlsiSDE.js → AnalyticsPage-DXduj5KB.js} +9 -9
- package/dist/{CreateOrderPage-DaCgVaO3.js → CreateOrderPage-DuJJQ16b.js} +11 -11
- package/dist/{CustomerDetailsPage-DErpbafW.js → CustomerDetailsPage-C98SKw7Z.js} +16 -16
- package/dist/{CustomersPage-C1lRU6xs.js → CustomersPage-s8hK55JL.js} +24 -22
- package/dist/{DashboardPage-Q5-5EKAU.js → DashboardPage-BsEgcKEN.js} +17 -17
- package/dist/DataTable-Da7yHjM1.js +369 -0
- package/dist/{DocumentsCard-T9y6cv4-.js → DocumentsCard-CziaTJhP.js} +4 -4
- package/dist/{DriverDetailsPage-DnHGkDC7.js → DriverDetailsPage-CBzAmM6s.js} +14 -14
- package/dist/{DriversPage-C0ujWVOn.js → DriversPage-Duy_ITG6.js} +26 -24
- package/dist/{FinancePage-CA2XEgsQ.js → FinancePage-BZtPTpmT.js} +9 -9
- package/dist/{FleetPage-DrvXW7wK.js → FleetPage-DJfzoHbs.js} +10 -10
- package/dist/{FormError-CRsMP7TQ.js → FormError-CWjGwOW8.js} +1 -1
- package/dist/{ImportExportPage-Cac9HjFx.js → ImportExportPage-DJ77GK_7.js} +6 -6
- package/dist/{InventoryPage-Ezf4gqKI.js → InventoryPage-Dpnwk_N3.js} +10 -10
- package/dist/{LiveTrackingPage-CzbVwDqK.js → LiveTrackingPage-CLlvsP1B.js} +10 -10
- package/dist/{MarketplacePage-BHDmSQmo.js → MarketplacePage-d99r-v6p.js} +9 -9
- package/dist/{MetricCard-DQlDNqmK.js → MetricCard-DA5ZqAVl.js} +2 -2
- package/dist/{Notice-GmA7JDR3.js → Notice-kkjV2rLR.js} +2 -2
- package/dist/{OrderDetailsPage-CR0Wc1aN.js → OrderDetailsPage-BePtkyN0.js} +20 -20
- package/dist/OrdersListPage-Csy_KScx.js +388 -0
- package/dist/{PageLayout-DX1Ou6V6.js → PageLayout-h_q9l8af.js} +231 -224
- package/dist/{ProductDetailsPage-B_ns2MOe.js → ProductDetailsPage-BMlRoR9E.js} +9 -9
- package/dist/{ProductsPage-c92BsEoA.js → ProductsPage-B4jWJ5bv.js} +21 -19
- package/dist/{ReportsPage-CPLXtLT2.js → ReportsPage-ALRYfXtz.js} +9 -9
- package/dist/{RouteDetailsPage-DOfcRiFv.js → RouteDetailsPage-Btb1MSIS.js} +18 -18
- package/dist/{RoutesPage-BZGublby.js → RoutesPage-CQHCDInT.js} +19 -17
- package/dist/{SettingsPage-5cweX_xh.js → SettingsPage-BYBRrlGe.js} +4 -4
- package/dist/{Sparkline-zSXvG6vA.js → Sparkline-Q-6bJ24J.js} +1 -1
- package/dist/{StatusBadge-oZjownr1.js → StatusBadge-1W2p8fEi.js} +1 -1
- package/dist/{TrackingPage-Ln9qVflK.js → TrackingPage-CFndTIyk.js} +11 -11
- package/dist/{VehicleDetailsPage-CrkzE0dN.js → VehicleDetailsPage-DNLrMljV.js} +12 -12
- package/dist/{VehiclesPage-CTQWH7af.js → VehiclesPage-ClkfFZxL.js} +26 -24
- package/dist/{WarehouseDetailsPage-CwDLaG65.js → WarehouseDetailsPage-CAQFz7l_.js} +11 -11
- package/dist/{WarehousesPage-KW02DvZg.js → WarehousesPage-kNba6cr3.js} +19 -17
- package/dist/{arrow-left-DJDw_Yqv.js → arrow-left-XOzFvBFD.js} +1 -1
- package/dist/{arrow-right-Cb2fLTPJ.js → arrow-right-CRrwlvFe.js} +1 -1
- package/dist/{arrow-up-PxaOIyiT.js → arrow-up-ClFaLPly.js} +1 -1
- package/dist/{box-hSJVtvGf.js → box-BX4WyCLv.js} +1 -1
- package/dist/{boxes-DDnxEkT5.js → boxes-R3nq5f0_.js} +1 -1
- package/dist/{chart-column-xXgAZvRl.js → chart-column-BgF8J9bx.js} +1 -1
- package/dist/{charts-CfCwQg6o.js → charts-BS_OnWc6.js} +2 -2
- package/dist/{chevron-left-dhEGJYdh.js → chevron-left-D3hcLQ1g.js} +1 -1
- package/dist/{chevron-right-Cud2NDvm.js → chevron-right-BpfSrzQF.js} +1 -1
- package/dist/{circle-alert-Rx0p3D5w.js → circle-alert-CLqT8iCQ.js} +1 -1
- package/dist/{circle-check-BCxRFdFo.js → circle-check-CWLAr_8f.js} +1 -1
- package/dist/{circle-check-big-BcIJ8xjx.js → circle-check-big-Dsuz8dJ2.js} +1 -1
- package/dist/{clock-B2_YxJgB.js → clock-DrZOQD8h.js} +1 -1
- package/dist/{dollar-sign-CQmAICv4.js → dollar-sign-CJfKfYul.js} +1 -1
- package/dist/{download-CG4Tponq.js → download-C-yNvUiL.js} +1 -1
- package/dist/{file-text-CzH-zMub.js → file-text-m2SyQgBo.js} +1 -1
- package/dist/{filter-C0u2Lwfn.js → filter-uA6govE9.js} +1 -1
- package/dist/{fuel-C2KELcM-.js → fuel-BroSIBo1.js} +1 -1
- package/dist/index.js +33 -33
- package/dist/{map-FuPu5aTw.js → map-BzwQ__kD.js} +1 -1
- package/dist/{map-pin-czpLv9uy.js → map-pin-BGbmEGn3.js} +1 -1
- package/dist/{maps-D9m7PKrs.js → maps-DpIuSSmg.js} +1 -1
- package/dist/{navigation-D5_pdCSS.js → navigation-CjKGLL9T.js} +1 -1
- package/dist/{package-B0sdi6lU.js → package-D36cKFvu.js} +1 -1
- package/dist/{phone-V2nuzPu9.js → phone-mMZFHd1Z.js} +1 -1
- package/dist/{plus-BqQxkfoU.js → plus-DY5R-c1j.js} +1 -1
- package/dist/{refresh-cw-CEOAPEcV.js → refresh-cw-DyOLYuDU.js} +1 -1
- package/dist/{route-CZWcW-Dw.js → route-CuaZ1wU3.js} +1 -1
- package/dist/{save-DDFvrxWl.js → save-h9dzHwJE.js} +1 -1
- package/dist/{search-D7Ya6jxj.js → search-stTGSec-.js} +1 -1
- package/dist/{square-pen-DoZZS4Lw.js → square-pen-DT5srCPD.js} +1 -1
- package/dist/{star-B7PgVu5j.js → star-gp4yO3PF.js} +1 -1
- package/dist/{store-YVzcIG4A.js → store-DJZDAvCY.js} +1 -1
- package/dist/{trash-2-BegnBzwI.js → trash-2-DwcjTxYE.js} +1 -1
- package/dist/{trending-up-DBd3XNdb.js → trending-up-2q2sPVsb.js} +1 -1
- package/dist/{triangle-alert-Bxk3Kgs6.js → triangle-alert-CU60xaOi.js} +1 -1
- package/dist/{truck-Clrn0oHp.js → truck-ByZxqZhI.js} +1 -1
- package/dist/{upload-Df5JmMwH.js → upload-CWor1uj3.js} +1 -1
- package/dist/{useAssistant-Cb8nnIVC.js → useAssistant-uoc8wjr0.js} +1 -1
- package/dist/{useCustomers-Dq2IR2HQ.js → useCustomers-BPPhQXSH.js} +1 -1
- package/dist/{useFleet-CapnWBcA.js → useFleet-CT_iW2V9.js} +1 -1
- package/dist/{useImportExport-BoGzrlJy.js → useImportExport-BG0Cg_D9.js} +1 -1
- package/dist/{useInventory-Ci6M2d9f.js → useInventory-BtBGnOC2.js} +1 -1
- package/dist/{useOrders-BuQU1OHX.js → useOrders-BC-1mCc0.js} +1 -1
- package/dist/{useReports-DIx8W7CO.js → useReports-Cx8blThR.js} +1 -1
- package/dist/{useRoutes-D7EvI_pm.js → useRoutes-8fw8oO6y.js} +1 -1
- package/dist/{useSettings-BhX251UQ.js → useSettings-Do5WSUaI.js} +1 -1
- package/dist/{useTracking-C40jmZ6W.js → useTracking-Dogilo5C.js} +3 -3
- package/dist/{user-BlcJrbtE.js → user-Dr_JS2FF.js} +1 -1
- package/dist/{user-check-DtnQmimP.js → user-check-CBSiMH6I.js} +1 -1
- package/dist/{users-Cvwko-Dx.js → users-BRV9-2nV.js} +1 -1
- package/dist/{warehouse-LWLVTk6G.js → warehouse-CmIAl0_w.js} +1 -1
- package/dist/{wrench-Cme0RbyR.js → wrench-6U-BTSbg.js} +1 -1
- package/dist/{x-D8C9Pg5V.js → x-DX8sZrkd.js} +1 -1
- package/package.json +1 -1
- package/src/movethewheels/components/DataTable.tsx +40 -0
- package/src/movethewheels/pages/CustomersPage.tsx +3 -1
- package/src/movethewheels/pages/DriversPage.tsx +3 -1
- package/src/movethewheels/pages/OrdersListPage.tsx +3 -1
- package/src/movethewheels/pages/ProductsPage.tsx +3 -1
- package/src/movethewheels/pages/RoutesPage.tsx +3 -1
- package/src/movethewheels/pages/VehiclesPage.tsx +3 -1
- package/src/movethewheels/pages/WarehousesPage.tsx +3 -1
- package/src/movethewheels/utils/graphqlClient.ts +52 -7
- package/dist/DataTable-KjzbwnRL.js +0 -340
- package/dist/OrdersListPage-C8Bu6wXM.js +0 -386
|
@@ -55,7 +55,7 @@ export default function OrdersListPage() {
|
|
|
55
55
|
|
|
56
56
|
const filtersActive = statusFilter !== 'all' || typeFilter !== 'all' || unassignedOnly;
|
|
57
57
|
|
|
58
|
-
const { orders, hasMore, isLoading, refetch } = useOrders({
|
|
58
|
+
const { orders, hasMore, isLoading, error, refetch } = useOrders({
|
|
59
59
|
filters: {
|
|
60
60
|
status: statusFilter === 'all' ? undefined : statusFilter,
|
|
61
61
|
orderType: typeFilter === 'all' ? undefined : typeFilter,
|
|
@@ -346,6 +346,8 @@ export default function OrdersListPage() {
|
|
|
346
346
|
columns={columns}
|
|
347
347
|
data={orders}
|
|
348
348
|
isLoading={isLoading}
|
|
349
|
+
error={error}
|
|
350
|
+
onRetry={refetch}
|
|
349
351
|
searchable
|
|
350
352
|
searchPlaceholder={t('movethewheels.orders.searchPlaceholder', 'Search orders...')}
|
|
351
353
|
searchFields={['orderNumber', 'customerInfo'] as (keyof Order)[]}
|
|
@@ -19,7 +19,7 @@ export default function ProductsPage() {
|
|
|
19
19
|
const { basePath, navigate } = useMoveTheWheels();
|
|
20
20
|
const [page, setPage] = useState(0);
|
|
21
21
|
const [pageSize, setPageSize] = useState(25);
|
|
22
|
-
const { products, hasMore, isLoading, refetch } = useProducts({
|
|
22
|
+
const { products, hasMore, isLoading, error, refetch } = useProducts({
|
|
23
23
|
limit: pageSize,
|
|
24
24
|
offset: page * pageSize,
|
|
25
25
|
});
|
|
@@ -159,6 +159,8 @@ export default function ProductsPage() {
|
|
|
159
159
|
columns={columns}
|
|
160
160
|
data={products}
|
|
161
161
|
isLoading={isLoading}
|
|
162
|
+
error={error}
|
|
163
|
+
onRetry={refetch}
|
|
162
164
|
searchable
|
|
163
165
|
searchPlaceholder="Search products..."
|
|
164
166
|
searchFields={['name', 'sku', 'category'] as (keyof Product)[]}
|
|
@@ -20,7 +20,7 @@ export default function RoutesPage() {
|
|
|
20
20
|
const { basePath, navigate } = useMoveTheWheels();
|
|
21
21
|
const [page, setPage] = useState(0);
|
|
22
22
|
const [pageSize, setPageSize] = useState(25);
|
|
23
|
-
const { routes, hasMore, isLoading, refetch } = useRoutes({
|
|
23
|
+
const { routes, hasMore, isLoading, error, refetch } = useRoutes({
|
|
24
24
|
limit: pageSize,
|
|
25
25
|
offset: page * pageSize,
|
|
26
26
|
});
|
|
@@ -126,6 +126,8 @@ export default function RoutesPage() {
|
|
|
126
126
|
columns={columns}
|
|
127
127
|
data={routes}
|
|
128
128
|
isLoading={isLoading}
|
|
129
|
+
error={error}
|
|
130
|
+
onRetry={refetch}
|
|
129
131
|
searchable
|
|
130
132
|
searchPlaceholder="Search routes..."
|
|
131
133
|
searchFields={['name'] as (keyof Route)[]}
|
|
@@ -19,7 +19,7 @@ export default function VehiclesPage() {
|
|
|
19
19
|
const { basePath, navigate } = useMoveTheWheels();
|
|
20
20
|
const [page, setPage] = useState(0);
|
|
21
21
|
const [pageSize, setPageSize] = useState(25);
|
|
22
|
-
const { vehicles, isLoading, refetch } = useVehicles({
|
|
22
|
+
const { vehicles, isLoading, error, refetch } = useVehicles({
|
|
23
23
|
limit: pageSize,
|
|
24
24
|
offset: page * pageSize,
|
|
25
25
|
});
|
|
@@ -163,6 +163,8 @@ export default function VehiclesPage() {
|
|
|
163
163
|
columns={columns}
|
|
164
164
|
data={vehicles}
|
|
165
165
|
isLoading={isLoading}
|
|
166
|
+
error={error}
|
|
167
|
+
onRetry={refetch}
|
|
166
168
|
searchable
|
|
167
169
|
searchPlaceholder="Search vehicles..."
|
|
168
170
|
searchFields={['vehicleNumber', 'make', 'model'] as (keyof Vehicle)[]}
|
|
@@ -18,7 +18,7 @@ export default function WarehousesPage() {
|
|
|
18
18
|
const { basePath, navigate } = useMoveTheWheels();
|
|
19
19
|
const [page, setPage] = useState(0);
|
|
20
20
|
const [pageSize, setPageSize] = useState(25);
|
|
21
|
-
const { warehouses, hasMore, isLoading, refetch } = useWarehouses({
|
|
21
|
+
const { warehouses, hasMore, isLoading, error, refetch } = useWarehouses({
|
|
22
22
|
limit: pageSize,
|
|
23
23
|
offset: page * pageSize,
|
|
24
24
|
});
|
|
@@ -152,6 +152,8 @@ export default function WarehousesPage() {
|
|
|
152
152
|
columns={columns}
|
|
153
153
|
data={warehouses}
|
|
154
154
|
isLoading={isLoading}
|
|
155
|
+
error={error}
|
|
156
|
+
onRetry={refetch}
|
|
155
157
|
searchable
|
|
156
158
|
searchPlaceholder="Search warehouses..."
|
|
157
159
|
searchFields={['name', 'code'] as (keyof WarehouseType)[]}
|
|
@@ -21,12 +21,25 @@ export function resolveGraphqlUrl(apiGatewayUrl?: string): string {
|
|
|
21
21
|
|
|
22
22
|
const MAX_RETRIES = 3;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Per-attempt hard timeout. The workspace service runs a lean single-replica
|
|
26
|
+
* pool with no PgBouncer, so under a burst of concurrent queries a connection
|
|
27
|
+
* can be accepted by the gateway but never answered — the request then hangs
|
|
28
|
+
* indefinitely. `fetch` has no built-in timeout, so without this an in-flight
|
|
29
|
+
* request never settles and the caller's `isLoading` sticks true forever
|
|
30
|
+
* (perpetual skeletons). A bounded abort turns a hang into a transient error
|
|
31
|
+
* that the retry loop can recover from on a fresh connection. Real queries
|
|
32
|
+
* return in well under a second, so 12s is generous headroom.
|
|
33
|
+
*/
|
|
34
|
+
const REQUEST_TIMEOUT_MS = 12000;
|
|
35
|
+
|
|
24
36
|
/**
|
|
25
37
|
* A transient failure is a momentary gateway↔service connectivity blip (the
|
|
26
38
|
* workspace service runs a lean replica pool with no PgBouncer, so a burst of
|
|
27
39
|
* concurrent dashboard queries can briefly exhaust connections and the gateway
|
|
28
|
-
* returns an upstream-connect / 5xx / reset error
|
|
29
|
-
* genuine validation / auth /
|
|
40
|
+
* returns an upstream-connect / 5xx / reset error, or the request simply hangs
|
|
41
|
+
* until we abort it). These are safe to retry; genuine validation / auth /
|
|
42
|
+
* business errors are not.
|
|
30
43
|
*/
|
|
31
44
|
function isTransientMessage(message?: string): boolean {
|
|
32
45
|
if (!message) return false;
|
|
@@ -40,6 +53,20 @@ function isTransientStatus(status: number): boolean {
|
|
|
40
53
|
return status === 429 || status === 502 || status === 503 || status === 504;
|
|
41
54
|
}
|
|
42
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A fetch aborted by our timeout rejects with an `AbortError`. It arrives as a
|
|
58
|
+
* `DOMException`, which is not reliably an `instanceof Error` across engines, so
|
|
59
|
+
* we duck-type the `name` field rather than relying on the prototype chain.
|
|
60
|
+
*/
|
|
61
|
+
function isAbortError(error: unknown): boolean {
|
|
62
|
+
return (
|
|
63
|
+
typeof error === 'object' &&
|
|
64
|
+
error !== null &&
|
|
65
|
+
'name' in error &&
|
|
66
|
+
(error as { name?: unknown }).name === 'AbortError'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
43
70
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
44
71
|
|
|
45
72
|
export async function executeGraphQL<TData>(
|
|
@@ -68,8 +95,15 @@ export async function executeGraphQL<TData>(
|
|
|
68
95
|
// Exponential backoff with jitter before each retry (not the first attempt).
|
|
69
96
|
if (attempt > 0) await sleep(Math.min(250 * 2 ** (attempt - 1), 2000) + Math.floor(Math.random() * 150));
|
|
70
97
|
|
|
98
|
+
const controller = new AbortController();
|
|
99
|
+
const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
71
100
|
try {
|
|
72
|
-
const response = await fetch(url, {
|
|
101
|
+
const response = await fetch(url, {
|
|
102
|
+
method: 'POST',
|
|
103
|
+
headers,
|
|
104
|
+
body,
|
|
105
|
+
signal: controller.signal,
|
|
106
|
+
});
|
|
73
107
|
|
|
74
108
|
if (!response.ok) {
|
|
75
109
|
lastError = new Error(`GraphQL request failed with status ${response.status}`);
|
|
@@ -101,11 +135,22 @@ export async function executeGraphQL<TData>(
|
|
|
101
135
|
|
|
102
136
|
return payload.data;
|
|
103
137
|
} catch (error) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
138
|
+
const aborted = isAbortError(error);
|
|
139
|
+
// A thrown fetch is a network error (TypeError "Failed to fetch") or our
|
|
140
|
+
// own timeout abort — both transient and safe to retry on a fresh
|
|
141
|
+
// connection.
|
|
142
|
+
const message = aborted
|
|
143
|
+
? `GraphQL request timed out after ${REQUEST_TIMEOUT_MS}ms`
|
|
144
|
+
: error instanceof Error
|
|
145
|
+
? error.message
|
|
146
|
+
: String(error);
|
|
147
|
+
lastError = !aborted && error instanceof Error ? error : new Error(message);
|
|
148
|
+
if (canRetry && (aborted || isTransientMessage(message) || error instanceof TypeError)) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
108
151
|
throw lastError;
|
|
152
|
+
} finally {
|
|
153
|
+
clearTimeout(timeoutId);
|
|
109
154
|
}
|
|
110
155
|
}
|
|
111
156
|
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import { A as e, B as t, F as n, G as r, H as i, I as a, K as o, L as ee, P as te, R as ne, U as s, W as c, q as l, rt as u, u as d, ut as f } from "./PageLayout-DX1Ou6V6.js";
|
|
2
|
-
import { n as re, t as ie } from "./arrow-up-PxaOIyiT.js";
|
|
3
|
-
import { t as p } from "./chevron-left-dhEGJYdh.js";
|
|
4
|
-
import { t as m } from "./chevron-right-Cud2NDvm.js";
|
|
5
|
-
import { t as ae } from "./search-D7Ya6jxj.js";
|
|
6
|
-
import { useMemo as h, useState as g } from "react";
|
|
7
|
-
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
|
-
import { IllustratedEmptyState as y } from "@burdenoff/fe-libs/ui";
|
|
9
|
-
//#region node_modules/lucide-react/dist/esm/icons/arrow-up-down.js
|
|
10
|
-
var oe = f("ArrowUpDown", [
|
|
11
|
-
["path", {
|
|
12
|
-
d: "m21 16-4 4-4-4",
|
|
13
|
-
key: "f6ql7i"
|
|
14
|
-
}],
|
|
15
|
-
["path", {
|
|
16
|
-
d: "M17 20V4",
|
|
17
|
-
key: "1ejh1v"
|
|
18
|
-
}],
|
|
19
|
-
["path", {
|
|
20
|
-
d: "m3 8 4-4 4 4",
|
|
21
|
-
key: "11wl7u"
|
|
22
|
-
}],
|
|
23
|
-
["path", {
|
|
24
|
-
d: "M7 4v16",
|
|
25
|
-
key: "1glfcx"
|
|
26
|
-
}]
|
|
27
|
-
]), b = f("ChevronsLeft", [["path", {
|
|
28
|
-
d: "m11 17-5-5 5-5",
|
|
29
|
-
key: "13zhaf"
|
|
30
|
-
}], ["path", {
|
|
31
|
-
d: "m18 17-5-5 5-5",
|
|
32
|
-
key: "h8a8et"
|
|
33
|
-
}]]), se = f("ChevronsRight", [["path", {
|
|
34
|
-
d: "m6 17 5-5-5-5",
|
|
35
|
-
key: "xnjwq"
|
|
36
|
-
}], ["path", {
|
|
37
|
-
d: "m13 17 5-5-5-5",
|
|
38
|
-
key: "17xmmf"
|
|
39
|
-
}]]);
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/movethewheels/components/DataTable.tsx
|
|
42
|
-
function x({ columns: f, data: x, isLoading: ce = !1, searchable: S = !1, searchPlaceholder: le = "Search...", searchFields: C, pagination: w = !0, pageSize: T = 10, pageSizeOptions: ue = [
|
|
43
|
-
10,
|
|
44
|
-
25,
|
|
45
|
-
50,
|
|
46
|
-
100
|
|
47
|
-
], onRowClick: E, rowClassName: D, emptyMessage: O = "No data found", emptyIllustration: k, emptyTitle: de, emptyDescription: fe, emptyAction: pe, className: A, getRowId: j, pageIndex: me, onPageChange: M, onPageSizeChange: he, totalItems: N, hasNextPage: ge }) {
|
|
48
|
-
let P = typeof M == "function", F = me ?? 0, [I, _e] = g(""), [L, R] = g(null), [z, B] = g(null), [V, H] = g(1), [U, ve] = g(T), W = P ? T : U, G = h(() => {
|
|
49
|
-
if (!I || !C || C.length === 0) return x;
|
|
50
|
-
let e = I.toLowerCase();
|
|
51
|
-
return x.filter((t) => C.some((n) => {
|
|
52
|
-
let r = t[n];
|
|
53
|
-
return r != null && String(r).toLowerCase().includes(e);
|
|
54
|
-
}));
|
|
55
|
-
}, [
|
|
56
|
-
x,
|
|
57
|
-
I,
|
|
58
|
-
C
|
|
59
|
-
]), K = h(() => {
|
|
60
|
-
if (!L || !z) return G;
|
|
61
|
-
let e = f.find((e) => e.id === L);
|
|
62
|
-
return e?.accessorKey ? [...G].sort((t, n) => {
|
|
63
|
-
let r = t[e.accessorKey], i = n[e.accessorKey];
|
|
64
|
-
if (r == null) return 1;
|
|
65
|
-
if (i == null) return -1;
|
|
66
|
-
let a = 0;
|
|
67
|
-
return a = typeof r == "string" && typeof i == "string" ? r.localeCompare(i) : typeof r == "number" && typeof i == "number" ? r - i : r instanceof Date && i instanceof Date ? r.getTime() - i.getTime() : String(r).localeCompare(String(i)), z === "asc" ? a : -a;
|
|
68
|
-
}) : G;
|
|
69
|
-
}, [
|
|
70
|
-
G,
|
|
71
|
-
L,
|
|
72
|
-
z,
|
|
73
|
-
f
|
|
74
|
-
]), q = h(() => {
|
|
75
|
-
if (!w || P) return K;
|
|
76
|
-
let e = (V - 1) * U;
|
|
77
|
-
return K.slice(e, e + U);
|
|
78
|
-
}, [
|
|
79
|
-
K,
|
|
80
|
-
V,
|
|
81
|
-
U,
|
|
82
|
-
w,
|
|
83
|
-
P
|
|
84
|
-
]), J = Math.max(1, Math.ceil(K.length / U)), Y = typeof N == "number", X = Y ? Math.max(1, Math.ceil(N / W)) : void 0, ye = (e) => {
|
|
85
|
-
L === e ? z === "asc" ? B("desc") : z === "desc" && (R(null), B(null)) : (R(e), B("asc"));
|
|
86
|
-
}, be = (e) => L === e ? _(z === "asc" ? ie : re, { className: "w-4 h-4 text-primary" }) : /* @__PURE__ */ _(oe, { className: "w-4 h-4 text-text-secondary/50" }), Z = (e, t) => {
|
|
87
|
-
if (t.cell) return t.cell(e);
|
|
88
|
-
if (t.accessorKey) {
|
|
89
|
-
let n = e[t.accessorKey];
|
|
90
|
-
return n == null ? "-" : n instanceof Date ? n.toLocaleDateString() : String(n);
|
|
91
|
-
}
|
|
92
|
-
return "-";
|
|
93
|
-
};
|
|
94
|
-
if (ce) return /* @__PURE__ */ v("div", {
|
|
95
|
-
className: u("space-y-4", A),
|
|
96
|
-
children: [
|
|
97
|
-
S && /* @__PURE__ */ _("div", {
|
|
98
|
-
className: "flex items-center gap-4",
|
|
99
|
-
children: /* @__PURE__ */ _(t, { className: "h-10 w-64" })
|
|
100
|
-
}),
|
|
101
|
-
/* @__PURE__ */ _("div", {
|
|
102
|
-
className: "hidden md:block rounded-card border border-border-seam bg-bg-surface shadow-elevation-1",
|
|
103
|
-
children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(o, { children: /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(r, { children: /* @__PURE__ */ _(t, { className: "h-4 w-20 motion-safe:animate-vc-shimmer" }) }, e.id)) }) }), /* @__PURE__ */ _(s, { children: Array.from({ length: 5 }).map((e, n) => /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(c, { children: /* @__PURE__ */ _(t, { className: "h-4 w-full max-w-[100px] motion-safe:animate-vc-shimmer" }) }, e.id)) }, n)) })] })
|
|
104
|
-
}),
|
|
105
|
-
/* @__PURE__ */ _("div", {
|
|
106
|
-
className: "md:hidden space-y-3",
|
|
107
|
-
children: Array.from({ length: 4 }).map((e, n) => /* @__PURE__ */ v("div", {
|
|
108
|
-
className: "rounded-card border border-border-seam bg-bg-surface p-4 shadow-elevation-1",
|
|
109
|
-
children: [/* @__PURE__ */ _(t, { className: "h-4 w-2/3 mb-2 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ _(t, { className: "h-4 w-1/2 motion-safe:animate-vc-shimmer" })]
|
|
110
|
-
}, n))
|
|
111
|
-
})
|
|
112
|
-
]
|
|
113
|
-
});
|
|
114
|
-
let Q = q.length === 0, $ = () => k ? I ? /* @__PURE__ */ _(y, {
|
|
115
|
-
illustration: "empty-search",
|
|
116
|
-
title: "No matches",
|
|
117
|
-
description: `Nothing matches “${I}”. Try a different search.`
|
|
118
|
-
}) : /* @__PURE__ */ _(y, {
|
|
119
|
-
illustration: k,
|
|
120
|
-
title: de ?? O,
|
|
121
|
-
description: fe,
|
|
122
|
-
action: pe
|
|
123
|
-
}) : /* @__PURE__ */ _("p", {
|
|
124
|
-
className: "text-text-secondary",
|
|
125
|
-
children: O
|
|
126
|
-
}), xe = w && (P ? K.length > 0 || F > 0 : K.length > 0);
|
|
127
|
-
return /* @__PURE__ */ v("div", {
|
|
128
|
-
className: u("space-y-4", A),
|
|
129
|
-
children: [
|
|
130
|
-
S && /* @__PURE__ */ _("div", {
|
|
131
|
-
className: "flex items-center gap-4",
|
|
132
|
-
children: /* @__PURE__ */ v("div", {
|
|
133
|
-
className: "relative flex-1 max-w-sm",
|
|
134
|
-
children: [/* @__PURE__ */ _(ae, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-text-secondary" }), /* @__PURE__ */ _(e, {
|
|
135
|
-
placeholder: le,
|
|
136
|
-
value: I,
|
|
137
|
-
onChange: (e) => {
|
|
138
|
-
_e(e.target.value), H(1);
|
|
139
|
-
},
|
|
140
|
-
className: "pl-9"
|
|
141
|
-
})]
|
|
142
|
-
})
|
|
143
|
-
}),
|
|
144
|
-
/* @__PURE__ */ _("div", {
|
|
145
|
-
className: "hidden md:block overflow-x-auto rounded-card border border-border-seam bg-bg-surface shadow-elevation-1",
|
|
146
|
-
children: /* @__PURE__ */ v(i, { children: [/* @__PURE__ */ _(o, { children: /* @__PURE__ */ _(l, { children: f.map((e) => /* @__PURE__ */ _(r, {
|
|
147
|
-
className: u(e.sortable && "cursor-pointer select-none hover:bg-bg-sunken/50", e.headerClassName),
|
|
148
|
-
onClick: () => e.sortable && ye(e.id),
|
|
149
|
-
children: /* @__PURE__ */ v("div", {
|
|
150
|
-
className: "flex items-center gap-2",
|
|
151
|
-
children: [e.header, e.sortable && be(e.id)]
|
|
152
|
-
})
|
|
153
|
-
}, e.id)) }) }), /* @__PURE__ */ _(s, { children: Q ? /* @__PURE__ */ _(l, { children: /* @__PURE__ */ _(c, {
|
|
154
|
-
colSpan: f.length,
|
|
155
|
-
className: "py-8 text-center",
|
|
156
|
-
children: $()
|
|
157
|
-
}) }) : q.map((e, t) => {
|
|
158
|
-
let n = j ? j(e) : t, r = typeof D == "function" ? D(e) : D;
|
|
159
|
-
return /* @__PURE__ */ _(l, {
|
|
160
|
-
className: u(E && "cursor-pointer hover:bg-bg-sunken/50", r),
|
|
161
|
-
onClick: () => E?.(e),
|
|
162
|
-
children: f.map((t) => /* @__PURE__ */ _(c, {
|
|
163
|
-
className: t.className,
|
|
164
|
-
children: Z(e, t)
|
|
165
|
-
}, t.id))
|
|
166
|
-
}, n);
|
|
167
|
-
}) })] })
|
|
168
|
-
}),
|
|
169
|
-
/* @__PURE__ */ _("div", {
|
|
170
|
-
className: "md:hidden space-y-3",
|
|
171
|
-
children: Q ? /* @__PURE__ */ _("div", {
|
|
172
|
-
className: "rounded-card border border-border-seam bg-bg-surface p-6 text-center shadow-elevation-1",
|
|
173
|
-
children: $()
|
|
174
|
-
}) : q.map((e, t) => {
|
|
175
|
-
let n = j ? j(e) : t, r = typeof D == "function" ? D(e) : D;
|
|
176
|
-
return /* @__PURE__ */ _("div", {
|
|
177
|
-
role: E ? "button" : void 0,
|
|
178
|
-
tabIndex: E ? 0 : void 0,
|
|
179
|
-
className: u("rounded-card border border-border-seam bg-bg-surface p-4 shadow-elevation-1", E && "cursor-pointer hover:bg-bg-sunken/50", r),
|
|
180
|
-
onClick: () => E?.(e),
|
|
181
|
-
onKeyDown: (t) => {
|
|
182
|
-
E && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), E(e));
|
|
183
|
-
},
|
|
184
|
-
children: /* @__PURE__ */ _("dl", {
|
|
185
|
-
className: "space-y-2",
|
|
186
|
-
children: f.map((t) => /* @__PURE__ */ v("div", {
|
|
187
|
-
className: "flex items-start justify-between gap-3",
|
|
188
|
-
children: [/* @__PURE__ */ _("dt", {
|
|
189
|
-
className: "text-xs font-medium text-text-secondary shrink-0",
|
|
190
|
-
children: t.header
|
|
191
|
-
}), /* @__PURE__ */ _("dd", {
|
|
192
|
-
className: "text-sm text-right min-w-0",
|
|
193
|
-
children: Z(e, t)
|
|
194
|
-
})]
|
|
195
|
-
}, t.id))
|
|
196
|
-
})
|
|
197
|
-
}, n);
|
|
198
|
-
})
|
|
199
|
-
}),
|
|
200
|
-
xe && /* @__PURE__ */ v("div", {
|
|
201
|
-
className: "flex flex-wrap items-center justify-between gap-3",
|
|
202
|
-
children: [/* @__PURE__ */ v("div", {
|
|
203
|
-
className: "flex flex-wrap items-center gap-2 text-sm text-text-secondary",
|
|
204
|
-
children: [
|
|
205
|
-
P ? /* @__PURE__ */ v("span", { children: [
|
|
206
|
-
"Showing ",
|
|
207
|
-
K.length === 0 ? 0 : F * W + 1,
|
|
208
|
-
" to",
|
|
209
|
-
" ",
|
|
210
|
-
F * W + K.length,
|
|
211
|
-
Y ? ` of ${N}` : ""
|
|
212
|
-
] }) : /* @__PURE__ */ v("span", { children: [
|
|
213
|
-
"Showing ",
|
|
214
|
-
(V - 1) * U + 1,
|
|
215
|
-
" to",
|
|
216
|
-
" ",
|
|
217
|
-
Math.min(V * U, K.length),
|
|
218
|
-
" of ",
|
|
219
|
-
K.length
|
|
220
|
-
] }),
|
|
221
|
-
/* @__PURE__ */ v(te, {
|
|
222
|
-
value: String(W),
|
|
223
|
-
onValueChange: (e) => {
|
|
224
|
-
let t = Number(e);
|
|
225
|
-
P ? he?.(t) : (ve(t), H(1));
|
|
226
|
-
},
|
|
227
|
-
children: [/* @__PURE__ */ _(ee, {
|
|
228
|
-
className: "w-[70px] h-8",
|
|
229
|
-
children: /* @__PURE__ */ _(ne, {})
|
|
230
|
-
}), /* @__PURE__ */ _(n, { children: ue.map((e) => /* @__PURE__ */ _(a, {
|
|
231
|
-
value: String(e),
|
|
232
|
-
children: e
|
|
233
|
-
}, e)) })]
|
|
234
|
-
}),
|
|
235
|
-
/* @__PURE__ */ _("span", { children: "per page" })
|
|
236
|
-
]
|
|
237
|
-
}), P ? /* @__PURE__ */ v("div", {
|
|
238
|
-
className: "flex items-center gap-1",
|
|
239
|
-
children: [
|
|
240
|
-
/* @__PURE__ */ _(d, {
|
|
241
|
-
variant: "outline",
|
|
242
|
-
size: "icon",
|
|
243
|
-
className: "h-8 w-8",
|
|
244
|
-
"aria-label": "First page",
|
|
245
|
-
onClick: () => M?.(0),
|
|
246
|
-
disabled: F === 0,
|
|
247
|
-
children: /* @__PURE__ */ _(b, { className: "h-4 w-4" })
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ _(d, {
|
|
250
|
-
variant: "outline",
|
|
251
|
-
size: "icon",
|
|
252
|
-
className: "h-8 w-8",
|
|
253
|
-
"aria-label": "Previous page",
|
|
254
|
-
onClick: () => M?.(Math.max(0, F - 1)),
|
|
255
|
-
disabled: F === 0,
|
|
256
|
-
children: /* @__PURE__ */ _(p, { className: "h-4 w-4" })
|
|
257
|
-
}),
|
|
258
|
-
/* @__PURE__ */ v("span", {
|
|
259
|
-
className: "px-3 text-sm",
|
|
260
|
-
children: [
|
|
261
|
-
"Page ",
|
|
262
|
-
F + 1,
|
|
263
|
-
Y ? ` of ${X}` : ""
|
|
264
|
-
]
|
|
265
|
-
}),
|
|
266
|
-
/* @__PURE__ */ _(d, {
|
|
267
|
-
variant: "outline",
|
|
268
|
-
size: "icon",
|
|
269
|
-
className: "h-8 w-8",
|
|
270
|
-
"aria-label": "Next page",
|
|
271
|
-
onClick: () => M?.(F + 1),
|
|
272
|
-
disabled: Y ? F + 1 >= (X ?? 1) : !ge,
|
|
273
|
-
children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
|
|
274
|
-
}),
|
|
275
|
-
Y && /* @__PURE__ */ _(d, {
|
|
276
|
-
variant: "outline",
|
|
277
|
-
size: "icon",
|
|
278
|
-
className: "h-8 w-8",
|
|
279
|
-
"aria-label": "Last page",
|
|
280
|
-
onClick: () => M?.((X ?? 1) - 1),
|
|
281
|
-
disabled: F + 1 >= (X ?? 1),
|
|
282
|
-
children: /* @__PURE__ */ _(se, { className: "h-4 w-4" })
|
|
283
|
-
})
|
|
284
|
-
]
|
|
285
|
-
}) : /* @__PURE__ */ v("div", {
|
|
286
|
-
className: "flex items-center gap-1",
|
|
287
|
-
children: [
|
|
288
|
-
/* @__PURE__ */ _(d, {
|
|
289
|
-
variant: "outline",
|
|
290
|
-
size: "icon",
|
|
291
|
-
className: "h-8 w-8",
|
|
292
|
-
"aria-label": "First page",
|
|
293
|
-
onClick: () => H(1),
|
|
294
|
-
disabled: V === 1,
|
|
295
|
-
children: /* @__PURE__ */ _(b, { className: "h-4 w-4" })
|
|
296
|
-
}),
|
|
297
|
-
/* @__PURE__ */ _(d, {
|
|
298
|
-
variant: "outline",
|
|
299
|
-
size: "icon",
|
|
300
|
-
className: "h-8 w-8",
|
|
301
|
-
"aria-label": "Previous page",
|
|
302
|
-
onClick: () => H((e) => Math.max(1, e - 1)),
|
|
303
|
-
disabled: V === 1,
|
|
304
|
-
children: /* @__PURE__ */ _(p, { className: "h-4 w-4" })
|
|
305
|
-
}),
|
|
306
|
-
/* @__PURE__ */ v("span", {
|
|
307
|
-
className: "px-3 text-sm",
|
|
308
|
-
children: [
|
|
309
|
-
"Page ",
|
|
310
|
-
V,
|
|
311
|
-
" of ",
|
|
312
|
-
J
|
|
313
|
-
]
|
|
314
|
-
}),
|
|
315
|
-
/* @__PURE__ */ _(d, {
|
|
316
|
-
variant: "outline",
|
|
317
|
-
size: "icon",
|
|
318
|
-
className: "h-8 w-8",
|
|
319
|
-
"aria-label": "Next page",
|
|
320
|
-
onClick: () => H((e) => Math.min(J, e + 1)),
|
|
321
|
-
disabled: V === J,
|
|
322
|
-
children: /* @__PURE__ */ _(m, { className: "h-4 w-4" })
|
|
323
|
-
}),
|
|
324
|
-
/* @__PURE__ */ _(d, {
|
|
325
|
-
variant: "outline",
|
|
326
|
-
size: "icon",
|
|
327
|
-
className: "h-8 w-8",
|
|
328
|
-
"aria-label": "Last page",
|
|
329
|
-
onClick: () => H(J),
|
|
330
|
-
disabled: V === J,
|
|
331
|
-
children: /* @__PURE__ */ _(se, { className: "h-4 w-4" })
|
|
332
|
-
})
|
|
333
|
-
]
|
|
334
|
-
})]
|
|
335
|
-
})
|
|
336
|
-
]
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
//#endregion
|
|
340
|
-
export { x as t };
|