@syook/react-tabulous 4.0.5 → 4.1.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.
@@ -1,3 +1,4 @@
1
+ import { GridColDef } from '../reactTabulous';
1
2
  export declare const dataSet1: {
2
3
  name: string;
3
4
  email: string;
@@ -35,60 +36,4 @@ export declare const dataSet2: {
35
36
  };
36
37
  }[];
37
38
  export declare const dataSet2Columns1: never[];
38
- export declare const dataSet2Columns: ({
39
- field: string;
40
- headerName: string;
41
- type: string;
42
- isFilterable: boolean;
43
- isSortable: boolean;
44
- isSearchable: boolean;
45
- renderCell?: undefined;
46
- valueGetter?: undefined;
47
- options?: undefined;
48
- } | {
49
- field: string;
50
- headerName: string;
51
- type: string;
52
- renderCell: (row: any) => import("react/jsx-runtime").JSX.Element;
53
- isFilterable?: undefined;
54
- isSortable?: undefined;
55
- isSearchable?: undefined;
56
- valueGetter?: undefined;
57
- options?: undefined;
58
- } | {
59
- field: string;
60
- headerName: string;
61
- type: string;
62
- valueGetter: (row: any) => any;
63
- renderCell: (row: any) => import("react/jsx-runtime").JSX.Element;
64
- options: ({
65
- label: string;
66
- value: string;
67
- } | {
68
- label: string;
69
- value: number;
70
- })[];
71
- isFilterable: boolean;
72
- isSortable: boolean;
73
- isSearchable: boolean;
74
- } | {
75
- field: string;
76
- headerName: string;
77
- type: string;
78
- isFilterable: boolean;
79
- isSearchable: boolean;
80
- isSortable?: undefined;
81
- renderCell?: undefined;
82
- valueGetter?: undefined;
83
- options?: undefined;
84
- } | {
85
- field: string;
86
- valueGetter: (row: any) => string;
87
- headerName: string;
88
- isFilterable: boolean;
89
- isSortable: boolean;
90
- isSearchable: boolean;
91
- type?: undefined;
92
- renderCell?: undefined;
93
- options?: undefined;
94
- })[];
39
+ export declare const dataSet2Columns: GridColDef[];
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { type GridPinnedPosition } from '../../models';
3
+ import { ColumnAlignment } from '../../models/columnDef/columnAlign';
3
4
  type ColumnCellProps = React.HTMLAttributes<HTMLDivElement> & {
4
5
  width?: number | string;
5
6
  pinned?: GridPinnedPosition | null;
@@ -7,6 +8,7 @@ type ColumnCellProps = React.HTMLAttributes<HTMLDivElement> & {
7
8
  column?: any;
8
9
  emptyPlaceholder: string;
9
10
  rowIndex: number;
11
+ align: ColumnAlignment;
10
12
  };
11
13
  declare const ColumnCell: React.FC<ColumnCellProps>;
12
14
  export default ColumnCell;
@@ -1,8 +1,13 @@
1
1
  import React from 'react';
2
2
  import { type onDragUpdateType } from '../../hooks/useDragHandler';
3
3
  import { type GridPinnedPosition, type GridSortDirection } from '../../models';
4
+ import { ColumnAlignment } from '../../models/columnDef/columnAlign';
5
+ interface ColumnObject {
6
+ field: string;
7
+ type: string;
8
+ }
4
9
  type ColumnHeaderItemProps = React.HTMLAttributes<HTMLDivElement> & {
5
- columnObj: any;
10
+ columnObj: ColumnObject;
6
11
  type: string;
7
12
  disabledMoveLeft?: boolean;
8
13
  disabledMoveRight?: boolean;
@@ -18,10 +23,12 @@ type ColumnHeaderItemProps = React.HTMLAttributes<HTMLDivElement> & {
18
23
  sortBy: GridSortDirection;
19
24
  iconButtonSize?: number;
20
25
  pinned?: GridPinnedPosition;
26
+ fieldWidth?: number | string;
27
+ align: ColumnAlignment;
21
28
  onDragUpdate: onDragUpdateType;
22
- handleSort: (field: string, type: string, value?: any) => void;
23
- handlePin: (field: string, value?: any) => void;
24
- handleMove: (field: string, value?: any) => void;
29
+ handleSort: (field: string, type: string, value: GridSortDirection | null) => void;
30
+ handlePin: (field: string, value: GridPinnedPosition | null) => void;
31
+ handleMove: (field: string, direction: 'left' | 'right') => void;
25
32
  handleWidth: (field: string, value: number) => void;
26
33
  onHideColumns: (field: string) => void;
27
34
  onToggleColumnToolbar: () => void;
@@ -1,3 +1,4 @@
1
+ import { ColumnAlignment } from '../models/columnDef/columnAlign';
1
2
  export declare const densityMapping: {
2
3
  compact: number;
3
4
  standard: number;
@@ -8,3 +9,4 @@ export declare const iconDensityMapping: {
8
9
  standard: number;
9
10
  comfortable: number;
10
11
  };
12
+ export declare const alignMapping: Record<ColumnAlignment, string>;
@@ -0,0 +1 @@
1
+ export type ColumnAlignment = 'left' | 'center' | 'right';
@@ -4,6 +4,7 @@ import { type GridValidRowModel } from '../gridRows';
4
4
  import { type GridPinnedPosition } from './columnPin';
5
5
  import { type GridActionsCellItemProps } from '../../components/cell/gridActionsCellItem';
6
6
  import { OptionInterface } from '../../helpers/select';
7
+ import { ColumnAlignment } from './columnAlign';
7
8
  export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> {
8
9
  /**
9
10
  * The column identifier. It's used to map with [[GridRowModel]] values.
@@ -60,6 +61,10 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
60
61
  * The column to show options in filter.
61
62
  */
62
63
  options?: OptionInterface[];
64
+ /**
65
+ * Align the column.
66
+ */
67
+ align?: ColumnAlignment;
63
68
  }
64
69
  export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridBaseColDef<R, V, F> {
65
70
  /**
@@ -1,3 +1,4 @@
1
+ import { OptionInterface } from '../helpers/select';
1
2
  export interface FilterFieldProps {
2
3
  condition: string;
3
4
  column: string;
@@ -5,5 +6,5 @@ export interface FilterFieldProps {
5
6
  operator: string;
6
7
  value: any;
7
8
  field: string;
8
- options?: string[];
9
+ options?: string[] | OptionInterface[];
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syook/react-tabulous",
3
- "version": "4.0.5",
3
+ "version": "4.1.0",
4
4
  "description": "Terrifically fabulous React Table",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",