@sito/dashboard 0.0.28 → 0.0.30
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 +132 -15
- package/dist/components/Chip/Chip.d.ts +7 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/Chip/types.d.ts +12 -0
- package/dist/components/Form/AutocompleteInput/AutocompleteInput.d.ts +7 -0
- package/dist/components/Form/AutocompleteInput/index.d.ts +2 -0
- package/dist/components/Form/AutocompleteInput/types.d.ts +6 -0
- package/dist/components/Form/CheckInput/CheckInput.d.ts +7 -0
- package/dist/components/Form/CheckInput/index.d.ts +2 -0
- package/dist/components/Form/CheckInput/types.d.ts +4 -0
- package/dist/components/Form/SelectInput/SelectInput.d.ts +1 -2
- package/dist/components/Form/SelectInput/index.d.ts +2 -0
- package/dist/components/Form/SelectInput/types.d.ts +2 -14
- package/dist/components/Form/TextInput/TextInput.d.ts +7 -0
- package/dist/components/Form/TextInput/index.d.ts +2 -0
- package/dist/components/Form/TextInput/types.d.ts +5 -0
- package/dist/components/Form/index.d.ts +6 -4
- package/dist/components/Form/types.d.ts +15 -0
- package/dist/components/Form/utils.d.ts +3 -3
- package/dist/components/Loading/Loading.d.ts +1 -7
- package/dist/components/Loading/index.d.ts +1 -1
- package/dist/components/Loading/types.d.ts +6 -0
- package/dist/components/SvgIcons/ChevronDown.d.ts +2 -0
- package/dist/components/SvgIcons/ChevronLeft.d.ts +2 -0
- package/dist/components/SvgIcons/ChevronRight.d.ts +2 -0
- package/dist/components/SvgIcons/ChevronUp.d.ts +2 -0
- package/dist/components/SvgIcons/Close.d.ts +2 -0
- package/dist/components/SvgIcons/Filters.d.ts +2 -0
- package/dist/components/SvgIcons/index.d.ts +7 -0
- package/dist/components/{Chevron → SvgIcons}/types.d.ts +1 -1
- package/dist/components/Table/components/Columns.d.ts +2 -2
- package/dist/components/Table/components/FilterPopup/FilterPopup.d.ts +2 -0
- package/dist/components/Table/components/FilterPopup/index.d.ts +3 -0
- package/dist/components/Table/components/FilterPopup/types.d.ts +7 -0
- package/dist/components/Table/components/FilterPopup/utils.d.ts +3 -0
- package/dist/components/Table/components/Footer/CountOfTotal.d.ts +1 -0
- package/dist/components/Table/components/Footer/Footer.d.ts +4 -0
- package/dist/components/Table/components/Footer/JumpToPage.d.ts +5 -0
- package/dist/components/Table/components/Footer/Navigation.d.ts +1 -0
- package/dist/components/Table/components/Footer/index.d.ts +4 -0
- package/dist/components/Table/components/Rows.d.ts +3 -0
- package/dist/components/Table/components/Widgets/AutocompleteWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/CheckWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/DateWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/NumberWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/SelectWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/TextWidget.d.ts +2 -0
- package/dist/components/Table/components/Widgets/index.d.ts +7 -0
- package/dist/components/Table/components/Widgets/types.d.ts +14 -0
- package/dist/components/Table/components/index.d.ts +6 -0
- package/dist/components/Table/components/types.d.ts +37 -0
- package/dist/components/Table/index.d.ts +3 -4
- package/dist/components/Table/types.d.ts +6 -26
- package/dist/components/Tooltip/Tooltip.d.ts +1 -6
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/types.d.ts +5 -0
- package/dist/components/index.d.ts +6 -6
- package/dist/dashboard.cjs +1 -1
- package/dist/dashboard.js +886 -301
- package/dist/lib/filters.d.ts +45 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/main.css +1 -1
- package/dist/providers/FiltersProvider/FiltersProvider.d.ts +8 -0
- package/dist/providers/FiltersProvider/index.d.ts +3 -0
- package/dist/providers/FiltersProvider/types.d.ts +18 -0
- package/dist/providers/FiltersProvider/utils.d.ts +5 -0
- package/dist/{components/Table/hooks → providers/TableOptions}/TableOptionsProvider.d.ts +1 -1
- package/dist/providers/TableOptions/index.d.ts +2 -0
- package/dist/{components/Table/hooks → providers/TableOptions}/types.d.ts +9 -3
- package/dist/providers/Translation/index.d.ts +2 -0
- package/dist/providers/index.d.ts +3 -2
- package/package.json +4 -2
- package/dist/components/Chevron/ChevronDown.d.ts +0 -3
- package/dist/components/Chevron/ChevronUp.d.ts +0 -3
- package/dist/components/Chevron/index.d.ts +0 -3
- package/dist/components/Table/components/Navigation.d.ts +0 -5
- /package/dist/components/Table/components/{PageSize.d.ts → Footer/PageSize.d.ts} +0 -0
- /package/dist/lib/{models/query.d.ts → query.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -35,12 +35,6 @@ const App = () => {
|
|
|
35
35
|
{ id: 2, name: "Jane Smith", age: 25 },
|
|
36
36
|
];
|
|
37
37
|
|
|
38
|
-
const parseRows = (row) => ({
|
|
39
|
-
id: row.id,
|
|
40
|
-
name: row.name,
|
|
41
|
-
age: row.age,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
38
|
const columns = [
|
|
45
39
|
{ key: "name", label: "Name" },
|
|
46
40
|
{ key: "age", label: "Age" },
|
|
@@ -49,8 +43,7 @@ const App = () => {
|
|
|
49
43
|
return (
|
|
50
44
|
<Table
|
|
51
45
|
title="User Table"
|
|
52
|
-
|
|
53
|
-
parseRows={parseRows}
|
|
46
|
+
data={rows}
|
|
54
47
|
columns={columns}
|
|
55
48
|
/>
|
|
56
49
|
);
|
|
@@ -92,13 +85,19 @@ export default App;
|
|
|
92
85
|
The Table component is a flexible and feature-rich table for displaying data.
|
|
93
86
|
|
|
94
87
|
#### Props
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
| Propiedad | Tipo | Valor por defecto | Descripción |
|
|
89
|
+
|-----------------------|--------------|-------------------------|---------------------------------------------------------------------|
|
|
90
|
+
| `title` | `string` | `""` | El título de la tabla. |
|
|
91
|
+
| `data` | `array` | — | Los datos a mostrar en la tabla. |
|
|
92
|
+
| `columns` | `array` | `[]` | Definiciones de columnas, incluyendo claves (`key`) y etiquetas. |
|
|
93
|
+
| `isLoading` | `boolean` | `false` | Indica si la tabla está en estado de carga. |
|
|
94
|
+
| `actions` | `Action[]` | — | Función para renderizar acciones por fila. |
|
|
95
|
+
| `className` | `string` | `""` | Clase personalizada para el contenedor de la tabla. |
|
|
96
|
+
| `contentClassName` | `string` | `""` | Clase personalizada para el contenido de la tabla. |
|
|
97
|
+
| `softDeleteProperty` | `string` | `"deleted"` | Propiedad usada para lógica de borrado suave. |
|
|
98
|
+
| `toolbar` | `ReactNode` | `<></>` | Componente personalizado para la barra de herramientas. |
|
|
99
|
+
| `onSort` | `function` | — | Callback que se llama cuando se cambia el orden de la tabla. |
|
|
100
|
+
|
|
102
101
|
|
|
103
102
|
### TranslationProvider
|
|
104
103
|
|
|
@@ -107,6 +106,124 @@ Provides translation support for your application.
|
|
|
107
106
|
#### Props
|
|
108
107
|
- `t` (function): A translation function that takes a key and returns the translated string.
|
|
109
108
|
|
|
109
|
+
### Examples
|
|
110
|
+
|
|
111
|
+
#### Columns definition
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
key: string;
|
|
115
|
+
label: string;
|
|
116
|
+
sortable?: boolean;
|
|
117
|
+
sortOptions: {
|
|
118
|
+
icons: {
|
|
119
|
+
className: string;
|
|
120
|
+
asc: string;
|
|
121
|
+
desc: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
className?: string;
|
|
125
|
+
display?: "visible" | "none";
|
|
126
|
+
pos?: number;
|
|
127
|
+
renderBody?: (value: any, row: any) => ReactNode;
|
|
128
|
+
renderHead?: () => void;
|
|
129
|
+
filterOptions?: ColumnFilterOptions;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
ColumnFilterOptions
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
{
|
|
136
|
+
type: FilterTypes;
|
|
137
|
+
defaultValue: any;
|
|
138
|
+
label?: string;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
FilterTypes enum
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
text,
|
|
146
|
+
number,
|
|
147
|
+
select,
|
|
148
|
+
autocomplete,
|
|
149
|
+
date,
|
|
150
|
+
check,
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
import { Table } from "@sito/dashboard";
|
|
155
|
+
|
|
156
|
+
const columns = [
|
|
157
|
+
{
|
|
158
|
+
key: "tagIds",
|
|
159
|
+
label: t("_entities:news.tags.label"),
|
|
160
|
+
filterOptions: {
|
|
161
|
+
type: FilterTypes.autocomplete,
|
|
162
|
+
options: tagsList,
|
|
163
|
+
defaultValue: [],
|
|
164
|
+
},
|
|
165
|
+
sortable: false,
|
|
166
|
+
renderBody: (_, news) =>
|
|
167
|
+
(
|
|
168
|
+
<div className="flex flex-wrap gap-3">
|
|
169
|
+
{news.tags?.map(({ name, id }) => (
|
|
170
|
+
<Chip key={id} label={name} spanClassName="text-xs" />
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
) ?? " - ",
|
|
174
|
+
},
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
<Table data={...} columns={columns} />
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Actions definition
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
{
|
|
184
|
+
id: string;
|
|
185
|
+
onClick: (entity: object) => void;
|
|
186
|
+
icon: any;
|
|
187
|
+
tooltip: string;
|
|
188
|
+
hidden: (entity: object) => boolean;
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
import { Table } from "@sito/dashboard";
|
|
194
|
+
|
|
195
|
+
const addAction = {
|
|
196
|
+
id: "add",
|
|
197
|
+
hidden: false,
|
|
198
|
+
onClick: async () => {
|
|
199
|
+
// do some stuff here
|
|
200
|
+
},
|
|
201
|
+
icon: (
|
|
202
|
+
<FontAwesomeIcon
|
|
203
|
+
icon={isLoading ? faSpinner : faAdd}
|
|
204
|
+
className={`text-success ${isLoading ? "rotate" : ""}`}
|
|
205
|
+
/>
|
|
206
|
+
),
|
|
207
|
+
tooltip: t("_accessibility:buttons.add"),
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
<Table data={...} columns={...} actions={[addAction]} />
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Your custom toolbar
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
import { Table } from "@sito/dashboard";
|
|
217
|
+
|
|
218
|
+
const Toolbar = () => {
|
|
219
|
+
return <div>
|
|
220
|
+
<h1>My custom toolbar</h1>
|
|
221
|
+
</div>
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
<Table data={...} columns={...} toolbar={<Toolbar />} />
|
|
225
|
+
```
|
|
226
|
+
|
|
110
227
|
## Development
|
|
111
228
|
|
|
112
229
|
Running Locally
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum ChipVariant {
|
|
2
|
+
empty = "empty",
|
|
3
|
+
outlined = "outlined",
|
|
4
|
+
default = "default"
|
|
5
|
+
}
|
|
6
|
+
export type ChipPropsType = {
|
|
7
|
+
variant?: ChipVariant;
|
|
8
|
+
label?: string;
|
|
9
|
+
onDelete?: () => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
spanClassName?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AutocompleteInputPropsType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {object} props
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare const AutocompleteInput: import('react').ForwardRefExoticComponent<Omit<AutocompleteInputPropsType, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckInputPropsType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* CheckInput
|
|
4
|
+
* @param {object} props
|
|
5
|
+
* @returns CheckInput component
|
|
6
|
+
*/
|
|
7
|
+
export declare const CheckInput: import('react').ForwardRefExoticComponent<Omit<CheckInputPropsType, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -4,5 +4,4 @@ import { SelectInputPropsType } from './types';
|
|
|
4
4
|
* @param {object} props
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
|
-
declare const SelectInput: import('react').ForwardRefExoticComponent<Omit<SelectInputPropsType, "ref"> & import('react').RefAttributes<HTMLSelectElement>>;
|
|
8
|
-
export default SelectInput;
|
|
7
|
+
export declare const SelectInput: import('react').ForwardRefExoticComponent<Omit<SelectInputPropsType, "ref"> & import('react').RefAttributes<HTMLSelectElement>>;
|
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { HTMLProps } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BaseInputPropsType } from '../types';
|
|
3
3
|
export type Option = {
|
|
4
4
|
id: number | string;
|
|
5
5
|
value: number | string;
|
|
6
6
|
};
|
|
7
|
-
export interface SelectInputPropsType extends HTMLProps<HTMLSelectElement
|
|
8
|
-
state?: State;
|
|
9
|
-
value: any;
|
|
10
|
-
onChange: (e: any) => void;
|
|
7
|
+
export interface SelectInputPropsType extends Omit<HTMLProps<HTMLSelectElement>, "value" | "onChange">, BaseInputPropsType {
|
|
11
8
|
options: Option[];
|
|
12
|
-
name?: string;
|
|
13
|
-
id?: string;
|
|
14
|
-
label?: string;
|
|
15
|
-
containerClassName?: string;
|
|
16
|
-
inputClassName?: string;
|
|
17
|
-
labelClassName?: string;
|
|
18
|
-
helperText?: string;
|
|
19
|
-
helperTextClassName?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
9
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextInputPropsType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* TextInput
|
|
4
|
+
* @param {object} props
|
|
5
|
+
* @returns TextInput Component
|
|
6
|
+
*/
|
|
7
|
+
export declare const TextInput: import('react').ForwardRefExoticComponent<Omit<TextInputPropsType, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './SelectInput';
|
|
2
|
+
export * from './TextInput';
|
|
3
|
+
export * from './CheckInput';
|
|
4
|
+
export * from './AutocompleteInput';
|
|
5
|
+
export * from './utils';
|
|
6
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { State } from './utils';
|
|
2
|
+
export type BaseInputPropsType = {
|
|
3
|
+
state?: State;
|
|
4
|
+
value: any;
|
|
5
|
+
onChange: (e: any) => void;
|
|
6
|
+
name?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
containerClassName?: string;
|
|
10
|
+
inputClassName?: string;
|
|
11
|
+
labelClassName?: string;
|
|
12
|
+
helperText?: string;
|
|
13
|
+
helperTextClassName?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
};
|
|
@@ -8,16 +8,16 @@ export declare enum State {
|
|
|
8
8
|
* @param {string} state - input state
|
|
9
9
|
* @returns input class name by
|
|
10
10
|
*/
|
|
11
|
-
export declare const inputStateClassName: (state: State) => "
|
|
11
|
+
export declare const inputStateClassName: (state: State) => "input-error" | "input-good" | "input-normal";
|
|
12
12
|
/**
|
|
13
13
|
* Label State Class Name
|
|
14
14
|
* @param {string} state - input state
|
|
15
15
|
* @returns input class name by
|
|
16
16
|
*/
|
|
17
|
-
export declare const labelStateClassName: (state: State) => "
|
|
17
|
+
export declare const labelStateClassName: (state: State) => "input-label-error" | "input-label-good" | "input-label-normal";
|
|
18
18
|
/**
|
|
19
19
|
* Helper Text State Class Name
|
|
20
20
|
* @param {string} state - input state
|
|
21
21
|
* @returns input class name by
|
|
22
22
|
*/
|
|
23
|
-
export declare const helperTextStateClassName: (state: State) => "text-
|
|
23
|
+
export declare const helperTextStateClassName: (state: State) => "input-helper-text-error" | "input-helper-text-good" | "input-helper-text-normal";
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface LoadingPropsType extends HTMLProps<HTMLDivElement> {
|
|
3
|
-
color?: string;
|
|
4
|
-
loaderClass?: string;
|
|
5
|
-
strokeWidth?: string;
|
|
6
|
-
}
|
|
1
|
+
import { LoadingPropsType } from './types';
|
|
7
2
|
/**
|
|
8
3
|
* Loading
|
|
9
4
|
* @param {object} props - Props
|
|
10
5
|
* @returns Loading component
|
|
11
6
|
*/
|
|
12
7
|
export declare function Loading(props: LoadingPropsType): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './Loading';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnPropsType } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Columns component
|
|
4
4
|
* @param {object} props properties for the columns
|
|
5
5
|
* @returns Row of columns
|
|
6
6
|
*/
|
|
7
|
-
export declare function Columns(props:
|
|
7
|
+
export declare function Columns(props: ColumnPropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CountOfTotal: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Navigation: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutocompleteFilterType, CheckFilterType, DateFilterType, NumberFilterType, SelectFilterType, TextFilterType } from '../../../../lib';
|
|
2
|
+
export interface SelectWidgetPropsType extends SelectFilterType {
|
|
3
|
+
}
|
|
4
|
+
export interface DateWidgetPropsType extends DateFilterType {
|
|
5
|
+
}
|
|
6
|
+
export interface AutocompleteWidgetPropsType extends AutocompleteFilterType {
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CheckWidgetPropsType extends CheckFilterType {
|
|
10
|
+
}
|
|
11
|
+
export interface TextWidgetPropsType extends TextFilterType {
|
|
12
|
+
}
|
|
13
|
+
export interface NumberWidgetPropsType extends NumberFilterType {
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FilterTypes, SortOrder } from '../../../lib';
|
|
2
|
+
import { Action } from '../types';
|
|
3
|
+
export type ColumnType = {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
sortable?: boolean;
|
|
7
|
+
sortOptions: {
|
|
8
|
+
icons: {
|
|
9
|
+
className: string;
|
|
10
|
+
asc: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
className?: string;
|
|
15
|
+
display?: "visible" | "none";
|
|
16
|
+
pos?: number;
|
|
17
|
+
renderBody?: (value: any, row: any) => React.ReactNode;
|
|
18
|
+
renderHead?: () => void;
|
|
19
|
+
filterOptions?: ColumnFilterOptions;
|
|
20
|
+
};
|
|
21
|
+
export type ColumnPropsType = {
|
|
22
|
+
entity: string;
|
|
23
|
+
columns: ColumnType[];
|
|
24
|
+
hasAction: boolean;
|
|
25
|
+
onSortCallback: (prop: string, sortOrder: SortOrder) => void;
|
|
26
|
+
};
|
|
27
|
+
export type ColumnFilterOptions = {
|
|
28
|
+
type: FilterTypes;
|
|
29
|
+
defaultValue: any;
|
|
30
|
+
label?: string;
|
|
31
|
+
};
|
|
32
|
+
export type RowsPropsType = {
|
|
33
|
+
data: any[];
|
|
34
|
+
columns: ColumnType[];
|
|
35
|
+
softDeleteProperty: string;
|
|
36
|
+
actions: ((row: any) => Action[]) | undefined;
|
|
37
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export type { TableOptionsContextType, TableOptionsProviderPropsType, } from './hooks/types';
|
|
1
|
+
export * from './Table';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './types';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { SortOrder } from '../../lib';
|
|
2
|
+
import { ColumnType } from './components';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
1
4
|
export type Action = {
|
|
2
5
|
id: string;
|
|
3
6
|
onClick: (entity: object) => void;
|
|
@@ -5,40 +8,17 @@ export type Action = {
|
|
|
5
8
|
tooltip: string;
|
|
6
9
|
hidden: (entity: object) => boolean;
|
|
7
10
|
};
|
|
8
|
-
export type ColumnsOptionsType = {
|
|
9
|
-
noSortableColumns: {
|
|
10
|
-
[key: string]: boolean;
|
|
11
|
-
};
|
|
12
|
-
columnClassNames: {
|
|
13
|
-
[key: string]: string;
|
|
14
|
-
};
|
|
15
|
-
icons: {
|
|
16
|
-
className: string;
|
|
17
|
-
asc: string;
|
|
18
|
-
desc: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export type ColumnType = {
|
|
22
|
-
key: string;
|
|
23
|
-
label: string;
|
|
24
|
-
};
|
|
25
|
-
export type ColumnPropTypes = {
|
|
26
|
-
entity: string;
|
|
27
|
-
columns: ColumnType[];
|
|
28
|
-
columnsOptions?: ColumnsOptionsType;
|
|
29
|
-
hasAction: boolean;
|
|
30
|
-
};
|
|
31
11
|
export type TablePropsType = {
|
|
32
12
|
entity: string;
|
|
33
13
|
title?: string;
|
|
34
14
|
subtitle?: string;
|
|
35
|
-
|
|
36
|
-
parseRows?: any;
|
|
15
|
+
data: object[];
|
|
37
16
|
isLoading?: boolean;
|
|
38
17
|
actions?: (row: object) => Action[];
|
|
39
18
|
columns?: ColumnType[];
|
|
40
|
-
columnsOptions?: ColumnsOptionsType;
|
|
41
19
|
contentClassName?: string;
|
|
42
20
|
className?: string;
|
|
43
21
|
softDeleteProperty?: string;
|
|
22
|
+
toolbar?: ReactNode;
|
|
23
|
+
onSort: (prop: string, sortOrder: SortOrder) => void;
|
|
44
24
|
};
|