@mistersee/global-table 0.1.4 → 0.1.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/README.md +1 -1
- package/dist/Pagination.d.ts +4 -2
- package/dist/SeeTable.d.ts +1 -1
- package/dist/global-table.js +506 -422
- package/dist/icons/SortIcon.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +31 -1
- package/package.json +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { MisterSeeGlobalTable, INDEX_COLUMN_KEY, DEFAULT_COL_MIN_WIDTH, DEFAULT_COL_MAX_WIDTH, } from './SeeTable';
|
|
2
|
-
export type { ColumnDef, MisterSeeGlobalTableClassNames, MisterSeeGlobalTableProps, StickySide, } from './types';
|
|
2
|
+
export type { ColumnDef, MisterSeeGlobalTableClassNames, MisterSeeGlobalTableProps, ColumnTogglePosition, SortDirection, SortState, StickySide, } from './types';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
export type StickySide = 'left' | 'right';
|
|
3
|
+
export type ColumnTogglePosition = 'after-skip' | 'before-limit' | 'end' | 'start';
|
|
4
|
+
export type SortDirection = 'asc' | 'desc';
|
|
5
|
+
export interface SortState {
|
|
6
|
+
key: string;
|
|
7
|
+
direction: SortDirection;
|
|
8
|
+
}
|
|
3
9
|
export interface ColumnDef<T> {
|
|
4
10
|
key: string;
|
|
5
11
|
header: ReactNode;
|
|
@@ -14,6 +20,13 @@ export interface ColumnDef<T> {
|
|
|
14
20
|
defaultVisible?: boolean;
|
|
15
21
|
cell?: (row: T, rowIndex: number) => ReactNode;
|
|
16
22
|
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether this column can be sorted.
|
|
25
|
+
* Default: `true` for standard data columns; `false` for index and actions.
|
|
26
|
+
*/
|
|
27
|
+
sortable?: boolean;
|
|
28
|
+
/** Optional custom sort comparison function for client-side sorting */
|
|
29
|
+
sortFn?: (a: T, b: T) => number;
|
|
17
30
|
}
|
|
18
31
|
export interface MisterSeeGlobalTableClassNames {
|
|
19
32
|
root?: string;
|
|
@@ -81,11 +94,28 @@ export interface MisterSeeGlobalTableProps<T extends Record<string, unknown>> {
|
|
|
81
94
|
* Pass `false` to force-disable even if `onColumnOrderChange` is set.
|
|
82
95
|
*/
|
|
83
96
|
enableColumnReorder?: boolean;
|
|
97
|
+
/** Controlled sort state from parent */
|
|
98
|
+
sortState?: SortState | null;
|
|
99
|
+
/** Default sort state in uncontrolled mode */
|
|
100
|
+
defaultSort?: SortState | null;
|
|
101
|
+
/** Callback triggered when sorting changes */
|
|
102
|
+
onSortChange?: (sort: SortState | null) => void;
|
|
84
103
|
/**
|
|
85
|
-
*
|
|
104
|
+
* Enable column sorting on header click.
|
|
105
|
+
* Default: `false`. Must be passed from outside (or provide `onSortChange` / `sortState`) to enable sorting.
|
|
106
|
+
*/
|
|
107
|
+
enableSorting?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Show the column visibility toggle button.
|
|
86
110
|
* Default: `true`. Pass `false` to hide it.
|
|
87
111
|
*/
|
|
88
112
|
showColumnToggle?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Placement of the column visibility toggle button relative to pagination controls.
|
|
115
|
+
* - `'after-skip'` / `'end'` (default): placed at the end after the pagination skip buttons
|
|
116
|
+
* - `'before-limit'` / `'start'`: placed before the limit select dropdown
|
|
117
|
+
*/
|
|
118
|
+
columnTogglePosition?: ColumnTogglePosition;
|
|
89
119
|
/** Label for the column visibility toggle button. Default: `"Columns"` */
|
|
90
120
|
columnsLabel?: ReactNode;
|
|
91
121
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistersee/global-table",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/global-table.js",
|
|
6
6
|
"module": "./dist/global-table.js",
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
"import": "./dist/global-table.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"files": [
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"media"
|
|
17
|
+
],
|
|
15
18
|
"sideEffects": false,
|
|
16
19
|
"peerDependencies": {
|
|
17
20
|
"framer-motion": ">=11",
|
|
@@ -50,4 +53,4 @@
|
|
|
50
53
|
"vite": "^8.3.0",
|
|
51
54
|
"vite-plugin-dts": "^5.1.0"
|
|
52
55
|
}
|
|
53
|
-
}
|
|
56
|
+
}
|