munza-x-data-grid 3.0.0-beta.4 → 3.0.0-beta.6
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/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.d.ts +7 -0
- package/dist/main.d.ts +1 -0
- package/dist/munza-x-data-grid.cjs.js +5 -0
- package/dist/munza-x-data-grid.es.js +29 -0
- package/dist/style.css +3 -0
- package/package.json +51 -87
- package/dist/README.md +0 -77
- package/dist/components/ui/badge.d.ts +0 -9
- package/dist/components/ui/button.d.ts +0 -10
- package/dist/components/ui/checkbox.d.ts +0 -4
- package/dist/components/ui/input.d.ts +0 -3
- package/dist/components/ui/label.d.ts +0 -4
- package/dist/components/ui/popover.d.ts +0 -10
- package/dist/components/ui/skeleton.d.ts +0 -2
- package/dist/components/ui/spinner.d.ts +0 -2
- package/dist/components/ui/table.d.ts +0 -10
- package/dist/data/dummyVehicles.d.ts +0 -13
- package/dist/data-grid.cjs +0 -8
- package/dist/data-grid.js +0 -3273
- package/dist/hooks/use-mobile.d.ts +0 -1
- package/dist/lib/utils.d.ts +0 -2
- package/dist/package/contexts/GridContext.d.ts +0 -16
- package/dist/package/grid/index.d.ts +0 -3
- package/dist/package/index.d.ts +0 -3
- package/dist/package/lib/queryBuilder.d.ts +0 -76
- package/dist/package/table/TMain.d.ts +0 -2
- package/dist/package/types/index.d.ts +0 -8
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useIsMobile(): boolean;
|
package/dist/lib/utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ColumnDef, Table } from '@tanstack/react-table';
|
|
2
|
-
import { default as React } from 'react';
|
|
3
|
-
export interface GridContextProps<T> {
|
|
4
|
-
table: Table<T>;
|
|
5
|
-
}
|
|
6
|
-
interface GridContextProviderProps<T> {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
payload?: {
|
|
9
|
-
data: T[];
|
|
10
|
-
total: number;
|
|
11
|
-
};
|
|
12
|
-
columns: ColumnDef<T>[];
|
|
13
|
-
}
|
|
14
|
-
export declare const GridContextProvider: <T>({ children, payload, columns, }: GridContextProviderProps<T>) => React.JSX.Element;
|
|
15
|
-
export declare function useGrid(): GridContextProps<unknown>;
|
|
16
|
-
export {};
|
package/dist/package/index.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* queryBuilder.ts
|
|
3
|
-
*
|
|
4
|
-
* Converts TanStack Table's client-side state (column filters, global filter,
|
|
5
|
-
* sorting, pagination) into a Mongoose/MongoDB-friendly query descriptor.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* const query = buildMongooseQuery({
|
|
9
|
-
* columnFilters,
|
|
10
|
-
* globalFilter,
|
|
11
|
-
* sorting,
|
|
12
|
-
* pagination,
|
|
13
|
-
* searchableFields: ["name", "email"],
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* // On the server:
|
|
17
|
-
* const docs = await Model.find(query.filter)
|
|
18
|
-
* .sort(query.sort)
|
|
19
|
-
* .skip(query.skip)
|
|
20
|
-
* .limit(query.limit);
|
|
21
|
-
*
|
|
22
|
-
* const total = await Model.countDocuments(query.filter);
|
|
23
|
-
*/
|
|
24
|
-
export interface ColumnFilter {
|
|
25
|
-
id: string;
|
|
26
|
-
value: unknown;
|
|
27
|
-
}
|
|
28
|
-
export type ColumnFiltersState = ColumnFilter[];
|
|
29
|
-
export interface SortingRule {
|
|
30
|
-
id: string;
|
|
31
|
-
desc: boolean;
|
|
32
|
-
}
|
|
33
|
-
export type SortingState = SortingRule[];
|
|
34
|
-
export interface PaginationState {
|
|
35
|
-
pageIndex: number;
|
|
36
|
-
pageSize: number;
|
|
37
|
-
}
|
|
38
|
-
export type FilterVariant = 'text' | 'exact' | 'range' | 'dateRange' | 'select' | 'multiSelect' | 'boolean';
|
|
39
|
-
export interface ColumnFilterConfig {
|
|
40
|
-
/** How this column's filter value should be interpreted. Defaults to "text". */
|
|
41
|
-
variant?: FilterVariant;
|
|
42
|
-
/**
|
|
43
|
-
* Override the field name used in the Mongo query if it differs from the
|
|
44
|
-
* column id (e.g. column id "authorName" -> field "author.name").
|
|
45
|
-
*/
|
|
46
|
-
field?: string;
|
|
47
|
-
/** Case-insensitive regex for "text" variant. Defaults to true. */
|
|
48
|
-
caseInsensitive?: boolean;
|
|
49
|
-
}
|
|
50
|
-
export interface QueryBuilderOptions {
|
|
51
|
-
columnFilters?: ColumnFiltersState;
|
|
52
|
-
globalFilter?: string;
|
|
53
|
-
sorting?: SortingState;
|
|
54
|
-
pagination?: PaginationState;
|
|
55
|
-
/**
|
|
56
|
-
* Per-column-id configuration controlling how each filter value is
|
|
57
|
-
* translated into a Mongo operator. Columns not listed here default to
|
|
58
|
-
* variant: "text".
|
|
59
|
-
*/
|
|
60
|
-
columnConfig?: Record<string, ColumnFilterConfig>;
|
|
61
|
-
/**
|
|
62
|
-
* Fields to search when `globalFilter` is set. Produces an $or of
|
|
63
|
-
* case-insensitive regex matches across these fields.
|
|
64
|
-
*/
|
|
65
|
-
searchableFields?: string[];
|
|
66
|
-
/** Map a sort column id to a different Mongo field name if needed. */
|
|
67
|
-
sortFieldMap?: Record<string, string>;
|
|
68
|
-
}
|
|
69
|
-
export interface MongooseQuery {
|
|
70
|
-
filter: Record<string, any>;
|
|
71
|
-
sort: Record<string, 1 | -1>;
|
|
72
|
-
skip: number;
|
|
73
|
-
limit: number;
|
|
74
|
-
}
|
|
75
|
-
export declare function buildMongooseQuery(options: QueryBuilderOptions): MongooseQuery;
|
|
76
|
-
export default buildMongooseQuery;
|