greenole-design-system 1.1.78 → 1.1.80
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/components/Drawer/Drawer.types.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/Table.stories.d.ts +4 -0
- package/dist/components/Table/Table.styles.d.ts +2 -0
- package/dist/components/Table/Table.types.d.ts +38 -13
- package/dist/components/Table/index.d.ts +1 -0
- package/dist/greenole-design-system.cjs.js +192 -178
- package/dist/greenole-design-system.js +3823 -3801
- package/dist/greenole.css +20 -0
- package/dist/index.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { TableProps } from './Table.types';
|
|
3
|
-
declare const Table: <T extends Record<string, any>>({ columns, data, currentPage, totalItems, headerExtra, filterContent, actions, isMobile, itemsPerPage, loading, striped, showSearch, showManageColumns, tableKey, fetchData, onPageChange, onItemsPerPageChange, filterConfig, onFilterChange, rowActions, rowActionsLabel, t: tProp, }: Readonly<TableProps<T>>) => React.JSX.Element;
|
|
3
|
+
declare const Table: <T extends Record<string, any>>({ columns, data, currentPage, totalItems, headerExtra, filterContent, actions, isMobile, itemsPerPage, loading, striped, showSearch, showManageColumns, tableKey, fetchData, queryResult, onPageChange, onItemsPerPageChange, onSearchChange, title, filterConfig, onFilterChange, rowActions, rowActionsLabel, t: tProp, }: Readonly<TableProps<T>>) => React.JSX.Element;
|
|
4
4
|
export default Table;
|
|
@@ -4,9 +4,13 @@ declare const meta: Meta<typeof Table>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Table>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const WithTitle: Story;
|
|
8
|
+
export declare const WithTitleAndSearch: Story;
|
|
9
|
+
export declare const WithTitleSearchAndActions: Story;
|
|
7
10
|
export declare const ManageColumns: Story;
|
|
8
11
|
export declare const SortableWithRenderContent: Story;
|
|
9
12
|
export declare const FetchData: Story;
|
|
13
|
+
export declare const WithReactQuery: Story;
|
|
10
14
|
export declare const WithActions: Story;
|
|
11
15
|
export declare const WithHeaderExtra: Story;
|
|
12
16
|
export declare const WithActionsAndHeaderExtra: Story;
|
|
@@ -5,12 +5,14 @@ export declare const TableHeader: import('styled-components/dist/types').IStyled
|
|
|
5
5
|
export declare const TableHeaderSearch: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
6
|
$isMobile?: boolean;
|
|
7
7
|
}>> & string;
|
|
8
|
+
export declare const TableHeaderTitle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
8
9
|
export declare const TableHeaderSearchInputWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
9
10
|
$visible: boolean;
|
|
10
11
|
$isMobile: boolean;
|
|
11
12
|
}>> & string;
|
|
12
13
|
export declare const TableHeaderButtons: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
14
|
$isMobile?: boolean;
|
|
15
|
+
$hasTitle?: boolean;
|
|
14
16
|
}>> & string;
|
|
15
17
|
export declare const TableHeaderManageColumns: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
16
18
|
export declare const TableHead: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { THookTypes } from '../../utils/i18n/types';
|
|
3
3
|
import { FilterItem, FilterSelectedValues, FilterOutput } from '../Filter';
|
|
4
|
+
export interface TableQueryResult<T = any> {
|
|
5
|
+
data: T[] | undefined;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
isFetching?: boolean;
|
|
8
|
+
isError?: boolean;
|
|
9
|
+
error?: Error | null;
|
|
10
|
+
refetch?: () => void;
|
|
11
|
+
}
|
|
4
12
|
export interface TableColumn<T = any> {
|
|
5
13
|
label: string;
|
|
6
14
|
key: keyof T | string;
|
|
@@ -23,20 +31,14 @@ export interface TableRowAction<T = any> {
|
|
|
23
31
|
interface BaseTableProps<T = any> {
|
|
24
32
|
columns: TableColumn[];
|
|
25
33
|
data?: T[];
|
|
26
|
-
fetchData?: (params: {
|
|
27
|
-
page: number;
|
|
28
|
-
itemsPerPage: number;
|
|
29
|
-
search?: string;
|
|
30
|
-
filters?: Record<string, string[]>;
|
|
31
|
-
}) => Promise<{
|
|
32
|
-
data: T[];
|
|
33
|
-
count: number;
|
|
34
|
-
}>;
|
|
35
34
|
totalItems?: number;
|
|
36
35
|
currentPage: number;
|
|
37
36
|
itemsPerPage: number;
|
|
38
37
|
onPageChange: (page: number) => void;
|
|
39
38
|
onItemsPerPageChange: (items: number) => void;
|
|
39
|
+
onSearchChange?: (value: string) => void;
|
|
40
|
+
title?: string;
|
|
41
|
+
searchIconColor?: string;
|
|
40
42
|
showSearch?: boolean;
|
|
41
43
|
isMobile?: boolean;
|
|
42
44
|
loading?: boolean;
|
|
@@ -62,14 +64,37 @@ interface BaseTableProps<T = any> {
|
|
|
62
64
|
rowActions?: TableRowAction<T>[];
|
|
63
65
|
rowActionsLabel?: string;
|
|
64
66
|
}
|
|
65
|
-
interface
|
|
67
|
+
interface TableWithFetchData<T = any> extends BaseTableProps<T> {
|
|
68
|
+
fetchData: (params: {
|
|
69
|
+
page: number;
|
|
70
|
+
itemsPerPage: number;
|
|
71
|
+
search?: string;
|
|
72
|
+
filters?: Record<string, string[]>;
|
|
73
|
+
}) => Promise<{
|
|
74
|
+
data: T[];
|
|
75
|
+
count: number;
|
|
76
|
+
}>;
|
|
77
|
+
queryResult?: never;
|
|
78
|
+
}
|
|
79
|
+
interface TableWithQueryResult<T = any> extends Omit<BaseTableProps<T>, 'totalItems'> {
|
|
80
|
+
queryResult: TableQueryResult<T>;
|
|
81
|
+
totalItems: number;
|
|
82
|
+
fetchData?: never;
|
|
83
|
+
}
|
|
84
|
+
interface TableWithStaticData<T = any> extends BaseTableProps<T> {
|
|
85
|
+
fetchData?: never;
|
|
86
|
+
queryResult?: never;
|
|
87
|
+
data?: T[];
|
|
88
|
+
}
|
|
89
|
+
type TableDataProps<T = any> = TableWithFetchData<T> | TableWithQueryResult<T> | TableWithStaticData<T>;
|
|
90
|
+
type TableWithoutColumnManagement<T = any> = TableDataProps<T> & {
|
|
66
91
|
showManageColumns?: false;
|
|
67
92
|
tableKey?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
93
|
+
};
|
|
94
|
+
type TableWithColumnManagement<T = any> = TableDataProps<T> & {
|
|
70
95
|
showManageColumns: true;
|
|
71
96
|
tableKey: string;
|
|
72
|
-
}
|
|
97
|
+
};
|
|
73
98
|
export type TableProps<T = any> = TableWithoutColumnManagement<T> | TableWithColumnManagement<T>;
|
|
74
99
|
export interface TableColumnManagerProps {
|
|
75
100
|
allColumns: TableColumn[];
|