next-data-kit 8.3.0 → 9.0.0
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/README.md +11 -1
- package/dist/client/components/data-kit-table.d.ts.map +1 -1
- package/dist/client/components/data-kit-table.js +6 -5
- package/dist/client/components/data-kit-table.js.map +1 -1
- package/dist/client/components/ui/table.js +1 -1
- package/dist/client/components/ui/table.js.map +1 -1
- package/dist/index.cjs +24 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/types/client/component.d.ts +4 -0
- package/dist/types/client/component.d.ts.map +1 -1
- package/dist/types/index.d.cts +4 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -422,7 +422,11 @@ type TDataKitFilterItem = TDataKitFilterItemText | TDataKitFilterItemSelect | TD
|
|
|
422
422
|
* Bulk action definition for selectable tables
|
|
423
423
|
*/
|
|
424
424
|
type TDataKitBulkAction<TItem> = {
|
|
425
|
+
type: 'SEPARATOR';
|
|
426
|
+
} | {
|
|
427
|
+
type?: 'MENU';
|
|
425
428
|
name: string;
|
|
429
|
+
icon?: React.ReactNode;
|
|
426
430
|
function: (selectedItems: TItem[]) => Promise<[boolean, {
|
|
427
431
|
deselectAll?: boolean;
|
|
428
432
|
updatedItems?: TItem[];
|
package/dist/index.d.ts
CHANGED
|
@@ -422,7 +422,11 @@ type TDataKitFilterItem = TDataKitFilterItemText | TDataKitFilterItemSelect | TD
|
|
|
422
422
|
* Bulk action definition for selectable tables
|
|
423
423
|
*/
|
|
424
424
|
type TDataKitBulkAction<TItem> = {
|
|
425
|
+
type: 'SEPARATOR';
|
|
426
|
+
} | {
|
|
427
|
+
type?: 'MENU';
|
|
425
428
|
name: string;
|
|
429
|
+
icon?: React.ReactNode;
|
|
426
430
|
function: (selectedItems: TItem[]) => Promise<[boolean, {
|
|
427
431
|
deselectAll?: boolean;
|
|
428
432
|
updatedItems?: TItem[];
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as React2 from 'react';
|
|
3
3
|
import React2__default, { createContext, useRef, useState, useCallback, useEffect, useContext, useMemo } from 'react';
|
|
4
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { Filter, Loader2, MoreHorizontal, ArrowUp, ArrowDown, ChevronLeft, ChevronRight, ChevronDownIcon, CheckIcon, ChevronUpIcon } from 'lucide-react';
|
|
6
6
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
7
7
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
@@ -784,7 +784,7 @@ function TableRow({ className, ...props }) {
|
|
|
784
784
|
{
|
|
785
785
|
"data-slot": "table-row",
|
|
786
786
|
className: cn(
|
|
787
|
-
"hover:bg-gray-50 dark:hover:bg-gray-900/50 data-[state=selected]:bg-gray-50 dark:data-[state=selected]:bg-gray-900/50 border-b border-gray-100 dark:border-gray-900 transition-colors",
|
|
787
|
+
"hover:bg-gray-50 dark:hover:bg-gray-900/50 hover:border-gray-200 dark:hover:border-gray-800 data-[state=selected]:bg-gray-50 dark:data-[state=selected]:bg-gray-900/50 border-b border-gray-100 dark:border-gray-900 transition-colors",
|
|
788
788
|
className
|
|
789
789
|
),
|
|
790
790
|
...props
|
|
@@ -923,6 +923,19 @@ function DropdownMenuItem({
|
|
|
923
923
|
}
|
|
924
924
|
);
|
|
925
925
|
}
|
|
926
|
+
function DropdownMenuSeparator({
|
|
927
|
+
className,
|
|
928
|
+
...props
|
|
929
|
+
}) {
|
|
930
|
+
return /* @__PURE__ */ jsx(
|
|
931
|
+
DropdownMenuPrimitive.Separator,
|
|
932
|
+
{
|
|
933
|
+
"data-slot": "dropdown-menu-separator",
|
|
934
|
+
className: cn("bg-gray-100 dark:bg-gray-900 -mx-1 my-1 h-px", className),
|
|
935
|
+
...props
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
}
|
|
926
939
|
function Switch({
|
|
927
940
|
className,
|
|
928
941
|
...props
|
|
@@ -1313,12 +1326,13 @@ var DataKitRoot = (props) => {
|
|
|
1313
1326
|
dataKit.actions.setSort(path, nextValue);
|
|
1314
1327
|
}, [dataKit.sorts, dataKit.actions]);
|
|
1315
1328
|
const handleSelectionAction = useCallback(async (actionKey) => {
|
|
1316
|
-
|
|
1329
|
+
const action2 = selectable?.actions?.[actionKey];
|
|
1330
|
+
if (!action2 || action2.type === "SEPARATOR" || actionLoading) return;
|
|
1317
1331
|
setActionLoading(actionKey);
|
|
1318
1332
|
setActionsMenuOpen(false);
|
|
1319
1333
|
try {
|
|
1320
1334
|
const selectedItems = dataKit.items.filter((item) => selection.isSelected(item.id));
|
|
1321
|
-
const result = await
|
|
1335
|
+
const result = await action2.function(selectedItems);
|
|
1322
1336
|
if (result[0]) {
|
|
1323
1337
|
const data = result[1];
|
|
1324
1338
|
if (data.deselectAll) selection.deselectAll();
|
|
@@ -1476,7 +1490,12 @@ var DataKitRoot = (props) => {
|
|
|
1476
1490
|
children: actionLoading ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-4" })
|
|
1477
1491
|
}
|
|
1478
1492
|
) }),
|
|
1479
|
-
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", container: overlayContainer, children: Object.entries(selectable.actions).map(
|
|
1493
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "start", container: overlayContainer, children: Object.entries(selectable.actions).map(
|
|
1494
|
+
([key, action2]) => action2.type === "SEPARATOR" ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}, key) : /* @__PURE__ */ jsx(DropdownMenuItem, { disabled: !!actionLoading, onSelect: () => handleSelectionAction(key), children: actionLoading === key ? "Working\u2026" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1495
|
+
action2.icon,
|
|
1496
|
+
action2.name
|
|
1497
|
+
] }) }, key)
|
|
1498
|
+
) })
|
|
1480
1499
|
] })
|
|
1481
1500
|
] }) }),
|
|
1482
1501
|
columns.map((col, idx) => /* @__PURE__ */ jsx(React2__default.Fragment, { children: col.sortable ? /* @__PURE__ */ jsx(TableHead, { ...React2__default.isValidElement(col.head) ? col.head.props : {}, children: /* @__PURE__ */ jsxs(
|
|
@@ -1484,7 +1503,7 @@ var DataKitRoot = (props) => {
|
|
|
1484
1503
|
{
|
|
1485
1504
|
variant: "ghost",
|
|
1486
1505
|
size: "sm",
|
|
1487
|
-
className: "-ml-
|
|
1506
|
+
className: "-ml-4 h-auto py-0",
|
|
1488
1507
|
onClick: () => handleSort(col.sortable.path),
|
|
1489
1508
|
children: [
|
|
1490
1509
|
React2__default.isValidElement(col.head) ? col.head.props.children : col.head,
|