@nswds/app 1.83.6 → 1.85.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/dist/index.cjs +26 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
|
18
18
|
import { Command as Command$1 } from 'cmdk';
|
|
19
19
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
20
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
21
|
-
import { Table as Table$1, ColumnDef, Column } from '@tanstack/react-table';
|
|
21
|
+
import { Table as Table$1, ColumnDef, SortingState, Column } from '@tanstack/react-table';
|
|
22
22
|
import { Drawer as Drawer$1 } from 'vaul';
|
|
23
23
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
24
24
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -964,14 +964,16 @@ interface DataTableProps<TData, TValue> {
|
|
|
964
964
|
search?: {
|
|
965
965
|
placeholder?: string;
|
|
966
966
|
};
|
|
967
|
+
initialSorting?: SortingState;
|
|
967
968
|
}
|
|
968
|
-
declare function DataTable<TData, TValue>({ search, toolbar, columns, data, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
969
|
+
declare function DataTable<TData, TValue>({ search, toolbar, columns, data, initialSorting, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
969
970
|
|
|
970
971
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {
|
|
971
972
|
column: Column<TData, TValue>;
|
|
972
973
|
title: string;
|
|
974
|
+
sortType?: 'string' | 'number' | 'date';
|
|
973
975
|
}
|
|
974
|
-
declare function DataTableColumnHeader<TData, TValue>({ column, title, className, }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
976
|
+
declare function DataTableColumnHeader<TData, TValue>({ column, title, className, sortType, }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
975
977
|
|
|
976
978
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
977
979
|
column?: Column<TData, TValue>;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
|
18
18
|
import { Command as Command$1 } from 'cmdk';
|
|
19
19
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
20
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
21
|
-
import { Table as Table$1, ColumnDef, Column } from '@tanstack/react-table';
|
|
21
|
+
import { Table as Table$1, ColumnDef, SortingState, Column } from '@tanstack/react-table';
|
|
22
22
|
import { Drawer as Drawer$1 } from 'vaul';
|
|
23
23
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
24
24
|
import * as react_hook_form from 'react-hook-form';
|
|
@@ -964,14 +964,16 @@ interface DataTableProps<TData, TValue> {
|
|
|
964
964
|
search?: {
|
|
965
965
|
placeholder?: string;
|
|
966
966
|
};
|
|
967
|
+
initialSorting?: SortingState;
|
|
967
968
|
}
|
|
968
|
-
declare function DataTable<TData, TValue>({ search, toolbar, columns, data, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
969
|
+
declare function DataTable<TData, TValue>({ search, toolbar, columns, data, initialSorting, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
969
970
|
|
|
970
971
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {
|
|
971
972
|
column: Column<TData, TValue>;
|
|
972
973
|
title: string;
|
|
974
|
+
sortType?: 'string' | 'number' | 'date';
|
|
973
975
|
}
|
|
974
|
-
declare function DataTableColumnHeader<TData, TValue>({ column, title, className, }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
976
|
+
declare function DataTableColumnHeader<TData, TValue>({ column, title, className, sortType, }: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
975
977
|
|
|
976
978
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
977
979
|
column?: Column<TData, TValue>;
|
package/dist/index.js
CHANGED
|
@@ -16541,12 +16541,13 @@ function DataTable({
|
|
|
16541
16541
|
search,
|
|
16542
16542
|
toolbar,
|
|
16543
16543
|
columns,
|
|
16544
|
-
data
|
|
16544
|
+
data,
|
|
16545
|
+
initialSorting = []
|
|
16545
16546
|
}) {
|
|
16546
16547
|
const [rowSelection, setRowSelection] = React5.useState({});
|
|
16547
16548
|
const [columnVisibility, setColumnVisibility] = React5.useState({});
|
|
16548
16549
|
const [columnFilters, setColumnFilters] = React5.useState([]);
|
|
16549
|
-
const [sorting, setSorting] = React5.useState(
|
|
16550
|
+
const [sorting, setSorting] = React5.useState(initialSorting);
|
|
16550
16551
|
const [globalFilter, setGlobalFilter] = React5.useState("");
|
|
16551
16552
|
const table = useReactTable({
|
|
16552
16553
|
data,
|
|
@@ -16594,11 +16595,23 @@ function DataTable({
|
|
|
16594
16595
|
function DataTableColumnHeader({
|
|
16595
16596
|
column,
|
|
16596
16597
|
title,
|
|
16597
|
-
className
|
|
16598
|
+
className,
|
|
16599
|
+
sortType = "string"
|
|
16598
16600
|
}) {
|
|
16599
16601
|
if (!column.getCanSort()) {
|
|
16600
16602
|
return /* @__PURE__ */ jsx("div", { className: cn(className), children: title });
|
|
16601
16603
|
}
|
|
16604
|
+
const getSortLabels = () => {
|
|
16605
|
+
switch (sortType) {
|
|
16606
|
+
case "date":
|
|
16607
|
+
return { asc: "Oldest First", desc: "Newest First" };
|
|
16608
|
+
case "number":
|
|
16609
|
+
return { asc: "Lowest First", desc: "Highest First" };
|
|
16610
|
+
default:
|
|
16611
|
+
return { asc: "Asc", desc: "Desc" };
|
|
16612
|
+
}
|
|
16613
|
+
};
|
|
16614
|
+
const labels = getSortLabels();
|
|
16602
16615
|
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center space-x-2", className), children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
16603
16616
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button2, { variant: "ghost", size: "sm", className: "-ml-3 data-[state=open]:bg-accent", children: [
|
|
16604
16617
|
/* @__PURE__ */ jsx("span", { children: title }),
|
|
@@ -16606,12 +16619,17 @@ function DataTableColumnHeader({
|
|
|
16606
16619
|
] }) }),
|
|
16607
16620
|
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", children: [
|
|
16608
16621
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
|
|
16609
|
-
/* @__PURE__ */ jsx(Icons.
|
|
16610
|
-
|
|
16622
|
+
/* @__PURE__ */ jsx(Icons.north, { className: "h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
16623
|
+
labels.asc
|
|
16611
16624
|
] }),
|
|
16612
16625
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
|
|
16613
|
-
/* @__PURE__ */ jsx(Icons.
|
|
16614
|
-
|
|
16626
|
+
/* @__PURE__ */ jsx(Icons.south, { className: "h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
16627
|
+
labels.desc
|
|
16628
|
+
] }),
|
|
16629
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
16630
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.clearSorting(), children: [
|
|
16631
|
+
/* @__PURE__ */ jsx(Icons.unfold_more, { className: "h-3.5 w-3.5 text-muted-foreground/70" }),
|
|
16632
|
+
"Clear Sort"
|
|
16615
16633
|
] }),
|
|
16616
16634
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
16617
16635
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
|
|
@@ -17475,7 +17493,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17475
17493
|
|
|
17476
17494
|
// package.json
|
|
17477
17495
|
var package_default = {
|
|
17478
|
-
version: "1.83.
|
|
17496
|
+
version: "1.83.6"};
|
|
17479
17497
|
var SluggerContext = React5__default.createContext(null);
|
|
17480
17498
|
function flattenText(nodes) {
|
|
17481
17499
|
if (nodes == null || typeof nodes === "boolean") return "";
|