@bluemarble/bm-components 0.2.0 → 0.2.2
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/index.d.mts +52 -57
- package/dist/index.d.ts +52 -57
- package/dist/index.js +493 -453
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +525 -485
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode, FC } from 'react';
|
|
2
2
|
import * as _mui_material from '@mui/material';
|
|
3
|
-
import { TableCellProps,
|
|
3
|
+
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteRenderInputParams, AutocompleteProps as AutocompleteProps$1, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps as ModalProps$1, DialogProps, AlertColor } from '@mui/material';
|
|
4
|
+
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
4
5
|
import IMask$1 from 'imask';
|
|
5
6
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
6
7
|
import { ZodTypeDef, ZodSchema } from 'zod';
|
|
@@ -17,7 +18,7 @@ interface FilterProps$1 {
|
|
|
17
18
|
value: string;
|
|
18
19
|
transformer?: (value: string | number | Date) => string;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
type IFilter = FilterProps$1;
|
|
21
22
|
interface GridProps$1<T> {
|
|
22
23
|
columnTitles: ColumnTitleProps[];
|
|
23
24
|
defaultData: T[];
|
|
@@ -35,12 +36,16 @@ interface GridProps$1<T> {
|
|
|
35
36
|
noFilters?: boolean;
|
|
36
37
|
primaryKey?: string;
|
|
37
38
|
}
|
|
38
|
-
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps$1<ObjectType>>) => JSX.Element;
|
|
39
|
+
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps$1<ObjectType>>) => React.JSX.Element;
|
|
39
40
|
|
|
40
41
|
declare function filterData<T>(filters: FilterProps$1[], defaultData: {
|
|
41
42
|
current: T[];
|
|
42
43
|
}): T[];
|
|
43
44
|
|
|
45
|
+
declare const Tr: _mui_material_OverridableComponent.OverridableComponent<_mui_material.TableRowTypeMap<{}, "tr">>;
|
|
46
|
+
|
|
47
|
+
declare const Td: typeof TableCell;
|
|
48
|
+
|
|
44
49
|
interface EditableTableCellProps extends TableCellProps {
|
|
45
50
|
name: string;
|
|
46
51
|
TextFieldProps?: TextFieldProps;
|
|
@@ -61,19 +66,7 @@ interface OnSaveProps {
|
|
|
61
66
|
value: string;
|
|
62
67
|
data: Record<string, any>;
|
|
63
68
|
}
|
|
64
|
-
declare const EditableTableCell: (allProps: EditableTableCellProps) => JSX.Element;
|
|
65
|
-
|
|
66
|
-
interface CustomTableRowProps extends TableRowProps {
|
|
67
|
-
striped?: boolean;
|
|
68
|
-
bordered?: boolean;
|
|
69
|
-
index?: number;
|
|
70
|
-
rowData?: Record<string, any>;
|
|
71
|
-
onSave?: (props: OnSaveProps) => void;
|
|
72
|
-
children: React.ReactNode;
|
|
73
|
-
}
|
|
74
|
-
declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
75
|
-
|
|
76
|
-
declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
|
|
69
|
+
declare const EditableTableCell: (allProps: EditableTableCellProps) => React.JSX.Element;
|
|
77
70
|
|
|
78
71
|
interface InputProps extends StandardTextFieldProps {
|
|
79
72
|
name: string;
|
|
@@ -91,23 +84,24 @@ interface InputMaskProps extends Partial<StandardTextFieldProps> {
|
|
|
91
84
|
mask: IMask$1.AnyMaskedOptions;
|
|
92
85
|
onChangeValue?: (value: string, unmaskedValue: string) => void;
|
|
93
86
|
}
|
|
94
|
-
declare function InputMask({ withFormik, ...rest }: InputMaskProps): JSX.Element;
|
|
87
|
+
declare function InputMask({ withFormik, ...rest }: InputMaskProps): React.JSX.Element;
|
|
95
88
|
|
|
96
89
|
interface CustomInputLabelProps extends InputLabelProps {
|
|
97
90
|
size?: 'small';
|
|
98
91
|
}
|
|
99
|
-
|
|
92
|
+
type MuiSelectPropsWithouVariant<T> = Omit<SelectProps$1<T>, 'variant'>;
|
|
93
|
+
type SelectProps<T> = MuiSelectPropsWithouVariant<T> & {
|
|
100
94
|
name: string;
|
|
101
95
|
label: string;
|
|
102
|
-
defaultValue?: string;
|
|
103
96
|
withFormik?: boolean;
|
|
97
|
+
variant?: SelectProps$1<T>['variant'];
|
|
104
98
|
FormControlProps?: Partial<FormControlProps>;
|
|
105
99
|
InputLabelProps?: Partial<CustomInputLabelProps>;
|
|
106
100
|
helperText?: string;
|
|
107
|
-
}
|
|
108
|
-
declare
|
|
101
|
+
};
|
|
102
|
+
declare function Select<T>({ withFormik, ...rest }: SelectProps<T>): React.JSX.Element;
|
|
109
103
|
|
|
110
|
-
|
|
104
|
+
type MuiAutocompleteBaseProps<T> = Omit<AutocompleteProps$1<T, boolean, undefined, boolean>, 'renderInput' | 'getOptionLabel'>;
|
|
111
105
|
interface AutocompleteWithoutProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
112
106
|
name?: never;
|
|
113
107
|
withFormik: false;
|
|
@@ -129,10 +123,10 @@ interface AutocompleteWithFormikProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
|
129
123
|
getOptionLabel?: (option: T) => string;
|
|
130
124
|
getOptionValue?: (option: T) => string | number;
|
|
131
125
|
}
|
|
132
|
-
|
|
133
|
-
declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): JSX.Element;
|
|
126
|
+
type AutocompleteProps<T> = AutocompleteWithoutProps<T> | AutocompleteWithFormikProps<T>;
|
|
127
|
+
declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): React.JSX.Element;
|
|
134
128
|
|
|
135
|
-
|
|
129
|
+
type CheckboxProps = CheckboxWithFormik | CheckboxWithoutFormik;
|
|
136
130
|
interface CheckboxWithFormik extends CheckboxProps$1 {
|
|
137
131
|
name: string;
|
|
138
132
|
label?: string;
|
|
@@ -145,9 +139,9 @@ interface CheckboxWithoutFormik extends CheckboxProps$1 {
|
|
|
145
139
|
withFormik: false;
|
|
146
140
|
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
147
141
|
}
|
|
148
|
-
declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => JSX.Element;
|
|
142
|
+
declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => React.JSX.Element;
|
|
149
143
|
|
|
150
|
-
|
|
144
|
+
type SwitchProps = SwitchWithFormik | SwitchWithoutFormik;
|
|
151
145
|
interface SwitchWithFormik extends SwitchProps$1 {
|
|
152
146
|
name: string;
|
|
153
147
|
label?: string;
|
|
@@ -160,13 +154,13 @@ interface SwitchWithoutFormik extends SwitchProps$1 {
|
|
|
160
154
|
withFormik: false;
|
|
161
155
|
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
162
156
|
}
|
|
163
|
-
declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => JSX.Element;
|
|
157
|
+
declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => React.JSX.Element;
|
|
164
158
|
|
|
165
|
-
|
|
159
|
+
type RadioOptionProps = {
|
|
166
160
|
value: string | number | boolean;
|
|
167
161
|
label: string;
|
|
168
162
|
};
|
|
169
|
-
|
|
163
|
+
type RadioOptionsProps = RadioWithFormik | RadioWithoutFormik;
|
|
170
164
|
interface RadioWithFormik extends RadioGroupProps {
|
|
171
165
|
name: string;
|
|
172
166
|
label?: string;
|
|
@@ -179,14 +173,14 @@ interface RadioWithoutFormik extends RadioGroupProps {
|
|
|
179
173
|
options: RadioOptionProps[];
|
|
180
174
|
withFormik: false;
|
|
181
175
|
}
|
|
182
|
-
declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => JSX.Element;
|
|
176
|
+
declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => React.JSX.Element;
|
|
183
177
|
|
|
184
178
|
interface LargeButtonProps extends ButtonProps {
|
|
185
179
|
loading?: boolean;
|
|
186
180
|
children: ReactNode;
|
|
187
181
|
CircularProgressProps?: CircularProgressProps;
|
|
188
182
|
}
|
|
189
|
-
declare const LargeButton: ({ loading, children, CircularProgressProps, sx, ...rest }: LargeButtonProps) => JSX.Element;
|
|
183
|
+
declare const LargeButton: ({ loading, children, CircularProgressProps, sx, ...rest }: LargeButtonProps) => React.JSX.Element;
|
|
190
184
|
|
|
191
185
|
declare function getTabProps(index: string): {
|
|
192
186
|
id: string;
|
|
@@ -197,13 +191,13 @@ interface TabPanelProps {
|
|
|
197
191
|
value: number;
|
|
198
192
|
index: number;
|
|
199
193
|
}
|
|
200
|
-
declare const TabPanel: (props: TabPanelProps) => JSX.Element;
|
|
194
|
+
declare const TabPanel: (props: TabPanelProps) => React.JSX.Element;
|
|
201
195
|
|
|
202
|
-
interface ColumnsProps {
|
|
196
|
+
interface ColumnsProps<T extends object = Theme> {
|
|
203
197
|
label: string;
|
|
204
198
|
name?: string;
|
|
205
199
|
width?: number;
|
|
206
|
-
sx?: SxProps
|
|
200
|
+
sx?: SxProps<T>;
|
|
207
201
|
canSort?: boolean;
|
|
208
202
|
children?: ReactNode;
|
|
209
203
|
}
|
|
@@ -232,13 +226,14 @@ interface GridProps {
|
|
|
232
226
|
isLoading?: boolean;
|
|
233
227
|
hideFooter?: boolean;
|
|
234
228
|
}
|
|
235
|
-
declare function BaseGrid({ columns, children, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, hideFooter, prependColumn, appendColumn, isLoading }: GridProps): JSX.Element;
|
|
229
|
+
declare function BaseGrid({ columns, children, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, hideFooter, prependColumn, appendColumn, isLoading }: GridProps): React.JSX.Element;
|
|
236
230
|
|
|
237
|
-
|
|
231
|
+
type ModalProps = {
|
|
238
232
|
open: boolean;
|
|
239
233
|
onClose: () => void;
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
children: React.ReactNode;
|
|
235
|
+
} & Omit<ModalProps$1, 'children'>;
|
|
236
|
+
declare const Modal: ({ open, onClose, ...rest }: ModalProps) => React.JSX.Element;
|
|
242
237
|
|
|
243
238
|
declare function GetInputLabel<T extends Array<Record<string, any>>, K extends T[number]['name']>(columns: T): (columnName: K) => {
|
|
244
239
|
label: any;
|
|
@@ -257,20 +252,20 @@ interface DialogCustomProps extends DialogProps {
|
|
|
257
252
|
options: DialogOptionsProps[];
|
|
258
253
|
loading: boolean;
|
|
259
254
|
}
|
|
260
|
-
declare const Dialog: ({ open, title, loading, body, options, ...rest }: DialogCustomProps) => JSX.Element;
|
|
255
|
+
declare const Dialog: ({ open, title, loading, body, options, ...rest }: DialogCustomProps) => React.JSX.Element;
|
|
261
256
|
|
|
262
257
|
declare class HttpError extends Error {
|
|
263
258
|
status: number;
|
|
264
259
|
constructor(status: number, message: any);
|
|
265
260
|
}
|
|
266
261
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
user?:
|
|
262
|
+
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
263
|
+
type HandlerProps<UserKeyType = number | string> = (req: NextApiRequest & {
|
|
264
|
+
user?: UserKeyType;
|
|
270
265
|
}, res: NextApiResponse) => Promise<any>;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
type MethodProps = Partial<Record<PossibleMethods, HandlerProps>>;
|
|
267
|
+
type MiddlewaresProps = ((handler: HandlerProps) => HandlerProps)[];
|
|
268
|
+
type ConstructorProps = {
|
|
274
269
|
middlewares?: MiddlewaresProps;
|
|
275
270
|
onFinally: (req: NextApiRequest) => Promise<void>;
|
|
276
271
|
};
|
|
@@ -287,8 +282,8 @@ declare class ApiHelper {
|
|
|
287
282
|
}): ApiHelper;
|
|
288
283
|
}
|
|
289
284
|
|
|
290
|
-
|
|
291
|
-
|
|
285
|
+
type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|
|
286
|
+
type HandleProps = {
|
|
292
287
|
name: `${Methods}:${string}`;
|
|
293
288
|
};
|
|
294
289
|
declare function useFormHelper(): {
|
|
@@ -299,8 +294,8 @@ declare function useFormHelper(): {
|
|
|
299
294
|
createAlert(message: string, type: _mui_material.AlertColor): void;
|
|
300
295
|
};
|
|
301
296
|
|
|
302
|
-
|
|
303
|
-
|
|
297
|
+
type FilterCompareType = 'gte' | 'lte' | 'lt' | 'gt' | 'equal' | 'in' | 'notEqual' | 'notIn';
|
|
298
|
+
type FilterProps = {
|
|
304
299
|
id?: string;
|
|
305
300
|
prop: string;
|
|
306
301
|
value: unknown;
|
|
@@ -335,7 +330,7 @@ declare function useGrid<T extends Record<string, any>>({ columns, filters, sear
|
|
|
335
330
|
sortedBy: string;
|
|
336
331
|
defaultData: T[];
|
|
337
332
|
sortedDirection: "desc" | "asc";
|
|
338
|
-
columns: ColumnsProps[];
|
|
333
|
+
columns: ColumnsProps<_mui_material.Theme>[];
|
|
339
334
|
currentPage: number;
|
|
340
335
|
totalNumberOfPages: number;
|
|
341
336
|
onPageChange: (pageNumber: number) => void;
|
|
@@ -356,25 +351,25 @@ declare const useAlert: () => {
|
|
|
356
351
|
createAlert(message: string, type: _mui_material.AlertColor): void;
|
|
357
352
|
};
|
|
358
353
|
|
|
359
|
-
|
|
354
|
+
type FormHelperContextProps = {
|
|
360
355
|
formatErrorMessage: (message: any) => string;
|
|
361
356
|
api: AxiosInstance;
|
|
362
357
|
};
|
|
363
358
|
declare const FormHelperContext: React.Context<FormHelperContextProps>;
|
|
364
|
-
|
|
359
|
+
type FormHelperProviderProps = {
|
|
365
360
|
formatErrorMessage: (message: any) => string;
|
|
366
361
|
children: ReactNode;
|
|
367
362
|
api: AxiosInstance;
|
|
368
363
|
};
|
|
369
|
-
declare const FormHelperProvider: ({ formatErrorMessage, api, children }: FormHelperProviderProps) => JSX.Element;
|
|
364
|
+
declare const FormHelperProvider: ({ formatErrorMessage, api, children }: FormHelperProviderProps) => React.JSX.Element;
|
|
370
365
|
|
|
371
|
-
|
|
366
|
+
type AlertContextProps = {
|
|
372
367
|
createAlert(message: string, type: AlertColor): void;
|
|
373
368
|
};
|
|
374
369
|
declare const AlertContext: React.Context<AlertContextProps>;
|
|
375
|
-
|
|
370
|
+
type AlertProviderProps = {
|
|
376
371
|
children: ReactNode;
|
|
377
372
|
};
|
|
378
|
-
declare const AlertProvider: ({ children }: AlertProviderProps) => JSX.Element;
|
|
373
|
+
declare const AlertProvider: ({ children }: AlertProviderProps) => React.JSX.Element;
|
|
379
374
|
|
|
380
375
|
export { AlertContext, AlertProvider, ApiHelper, Autocomplete, BaseGrid, Checkbox, type ColumnTitleProps, type ColumnsProps, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createFilter, filterData, getTabProps, useAlert, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode, FC } from 'react';
|
|
2
2
|
import * as _mui_material from '@mui/material';
|
|
3
|
-
import { TableCellProps,
|
|
3
|
+
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteRenderInputParams, AutocompleteProps as AutocompleteProps$1, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps as ModalProps$1, DialogProps, AlertColor } from '@mui/material';
|
|
4
|
+
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
4
5
|
import IMask$1 from 'imask';
|
|
5
6
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
6
7
|
import { ZodTypeDef, ZodSchema } from 'zod';
|
|
@@ -17,7 +18,7 @@ interface FilterProps$1 {
|
|
|
17
18
|
value: string;
|
|
18
19
|
transformer?: (value: string | number | Date) => string;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
type IFilter = FilterProps$1;
|
|
21
22
|
interface GridProps$1<T> {
|
|
22
23
|
columnTitles: ColumnTitleProps[];
|
|
23
24
|
defaultData: T[];
|
|
@@ -35,12 +36,16 @@ interface GridProps$1<T> {
|
|
|
35
36
|
noFilters?: boolean;
|
|
36
37
|
primaryKey?: string;
|
|
37
38
|
}
|
|
38
|
-
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps$1<ObjectType>>) => JSX.Element;
|
|
39
|
+
declare const Grid: <ObjectType>(props: React.PropsWithChildren<GridProps$1<ObjectType>>) => React.JSX.Element;
|
|
39
40
|
|
|
40
41
|
declare function filterData<T>(filters: FilterProps$1[], defaultData: {
|
|
41
42
|
current: T[];
|
|
42
43
|
}): T[];
|
|
43
44
|
|
|
45
|
+
declare const Tr: _mui_material_OverridableComponent.OverridableComponent<_mui_material.TableRowTypeMap<{}, "tr">>;
|
|
46
|
+
|
|
47
|
+
declare const Td: typeof TableCell;
|
|
48
|
+
|
|
44
49
|
interface EditableTableCellProps extends TableCellProps {
|
|
45
50
|
name: string;
|
|
46
51
|
TextFieldProps?: TextFieldProps;
|
|
@@ -61,19 +66,7 @@ interface OnSaveProps {
|
|
|
61
66
|
value: string;
|
|
62
67
|
data: Record<string, any>;
|
|
63
68
|
}
|
|
64
|
-
declare const EditableTableCell: (allProps: EditableTableCellProps) => JSX.Element;
|
|
65
|
-
|
|
66
|
-
interface CustomTableRowProps extends TableRowProps {
|
|
67
|
-
striped?: boolean;
|
|
68
|
-
bordered?: boolean;
|
|
69
|
-
index?: number;
|
|
70
|
-
rowData?: Record<string, any>;
|
|
71
|
-
onSave?: (props: OnSaveProps) => void;
|
|
72
|
-
children: React.ReactNode;
|
|
73
|
-
}
|
|
74
|
-
declare const Tr: React.MemoExoticComponent<(props: CustomTableRowProps) => JSX.Element>;
|
|
75
|
-
|
|
76
|
-
declare const Td: React.MemoExoticComponent<({ children, ...props }: TableCellProps) => JSX.Element>;
|
|
69
|
+
declare const EditableTableCell: (allProps: EditableTableCellProps) => React.JSX.Element;
|
|
77
70
|
|
|
78
71
|
interface InputProps extends StandardTextFieldProps {
|
|
79
72
|
name: string;
|
|
@@ -91,23 +84,24 @@ interface InputMaskProps extends Partial<StandardTextFieldProps> {
|
|
|
91
84
|
mask: IMask$1.AnyMaskedOptions;
|
|
92
85
|
onChangeValue?: (value: string, unmaskedValue: string) => void;
|
|
93
86
|
}
|
|
94
|
-
declare function InputMask({ withFormik, ...rest }: InputMaskProps): JSX.Element;
|
|
87
|
+
declare function InputMask({ withFormik, ...rest }: InputMaskProps): React.JSX.Element;
|
|
95
88
|
|
|
96
89
|
interface CustomInputLabelProps extends InputLabelProps {
|
|
97
90
|
size?: 'small';
|
|
98
91
|
}
|
|
99
|
-
|
|
92
|
+
type MuiSelectPropsWithouVariant<T> = Omit<SelectProps$1<T>, 'variant'>;
|
|
93
|
+
type SelectProps<T> = MuiSelectPropsWithouVariant<T> & {
|
|
100
94
|
name: string;
|
|
101
95
|
label: string;
|
|
102
|
-
defaultValue?: string;
|
|
103
96
|
withFormik?: boolean;
|
|
97
|
+
variant?: SelectProps$1<T>['variant'];
|
|
104
98
|
FormControlProps?: Partial<FormControlProps>;
|
|
105
99
|
InputLabelProps?: Partial<CustomInputLabelProps>;
|
|
106
100
|
helperText?: string;
|
|
107
|
-
}
|
|
108
|
-
declare
|
|
101
|
+
};
|
|
102
|
+
declare function Select<T>({ withFormik, ...rest }: SelectProps<T>): React.JSX.Element;
|
|
109
103
|
|
|
110
|
-
|
|
104
|
+
type MuiAutocompleteBaseProps<T> = Omit<AutocompleteProps$1<T, boolean, undefined, boolean>, 'renderInput' | 'getOptionLabel'>;
|
|
111
105
|
interface AutocompleteWithoutProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
112
106
|
name?: never;
|
|
113
107
|
withFormik: false;
|
|
@@ -129,10 +123,10 @@ interface AutocompleteWithFormikProps<T> extends MuiAutocompleteBaseProps<T> {
|
|
|
129
123
|
getOptionLabel?: (option: T) => string;
|
|
130
124
|
getOptionValue?: (option: T) => string | number;
|
|
131
125
|
}
|
|
132
|
-
|
|
133
|
-
declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): JSX.Element;
|
|
126
|
+
type AutocompleteProps<T> = AutocompleteWithoutProps<T> | AutocompleteWithFormikProps<T>;
|
|
127
|
+
declare function Autocomplete<T>({ withFormik, name, getOptionValue, ...rest }: AutocompleteProps<T>): React.JSX.Element;
|
|
134
128
|
|
|
135
|
-
|
|
129
|
+
type CheckboxProps = CheckboxWithFormik | CheckboxWithoutFormik;
|
|
136
130
|
interface CheckboxWithFormik extends CheckboxProps$1 {
|
|
137
131
|
name: string;
|
|
138
132
|
label?: string;
|
|
@@ -145,9 +139,9 @@ interface CheckboxWithoutFormik extends CheckboxProps$1 {
|
|
|
145
139
|
withFormik: false;
|
|
146
140
|
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
147
141
|
}
|
|
148
|
-
declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => JSX.Element;
|
|
142
|
+
declare const Checkbox: ({ withFormik, name, ...props }: CheckboxProps) => React.JSX.Element;
|
|
149
143
|
|
|
150
|
-
|
|
144
|
+
type SwitchProps = SwitchWithFormik | SwitchWithoutFormik;
|
|
151
145
|
interface SwitchWithFormik extends SwitchProps$1 {
|
|
152
146
|
name: string;
|
|
153
147
|
label?: string;
|
|
@@ -160,13 +154,13 @@ interface SwitchWithoutFormik extends SwitchProps$1 {
|
|
|
160
154
|
withFormik: false;
|
|
161
155
|
FormControlLabelProps?: Partial<FormControlLabelProps>;
|
|
162
156
|
}
|
|
163
|
-
declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => JSX.Element;
|
|
157
|
+
declare const Switch: ({ withFormik, name, ...props }: SwitchProps) => React.JSX.Element;
|
|
164
158
|
|
|
165
|
-
|
|
159
|
+
type RadioOptionProps = {
|
|
166
160
|
value: string | number | boolean;
|
|
167
161
|
label: string;
|
|
168
162
|
};
|
|
169
|
-
|
|
163
|
+
type RadioOptionsProps = RadioWithFormik | RadioWithoutFormik;
|
|
170
164
|
interface RadioWithFormik extends RadioGroupProps {
|
|
171
165
|
name: string;
|
|
172
166
|
label?: string;
|
|
@@ -179,14 +173,14 @@ interface RadioWithoutFormik extends RadioGroupProps {
|
|
|
179
173
|
options: RadioOptionProps[];
|
|
180
174
|
withFormik: false;
|
|
181
175
|
}
|
|
182
|
-
declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => JSX.Element;
|
|
176
|
+
declare const Radio: ({ name, withFormik, ...rest }: RadioOptionsProps) => React.JSX.Element;
|
|
183
177
|
|
|
184
178
|
interface LargeButtonProps extends ButtonProps {
|
|
185
179
|
loading?: boolean;
|
|
186
180
|
children: ReactNode;
|
|
187
181
|
CircularProgressProps?: CircularProgressProps;
|
|
188
182
|
}
|
|
189
|
-
declare const LargeButton: ({ loading, children, CircularProgressProps, sx, ...rest }: LargeButtonProps) => JSX.Element;
|
|
183
|
+
declare const LargeButton: ({ loading, children, CircularProgressProps, sx, ...rest }: LargeButtonProps) => React.JSX.Element;
|
|
190
184
|
|
|
191
185
|
declare function getTabProps(index: string): {
|
|
192
186
|
id: string;
|
|
@@ -197,13 +191,13 @@ interface TabPanelProps {
|
|
|
197
191
|
value: number;
|
|
198
192
|
index: number;
|
|
199
193
|
}
|
|
200
|
-
declare const TabPanel: (props: TabPanelProps) => JSX.Element;
|
|
194
|
+
declare const TabPanel: (props: TabPanelProps) => React.JSX.Element;
|
|
201
195
|
|
|
202
|
-
interface ColumnsProps {
|
|
196
|
+
interface ColumnsProps<T extends object = Theme> {
|
|
203
197
|
label: string;
|
|
204
198
|
name?: string;
|
|
205
199
|
width?: number;
|
|
206
|
-
sx?: SxProps
|
|
200
|
+
sx?: SxProps<T>;
|
|
207
201
|
canSort?: boolean;
|
|
208
202
|
children?: ReactNode;
|
|
209
203
|
}
|
|
@@ -232,13 +226,14 @@ interface GridProps {
|
|
|
232
226
|
isLoading?: boolean;
|
|
233
227
|
hideFooter?: boolean;
|
|
234
228
|
}
|
|
235
|
-
declare function BaseGrid({ columns, children, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, hideFooter, prependColumn, appendColumn, isLoading }: GridProps): JSX.Element;
|
|
229
|
+
declare function BaseGrid({ columns, children, paperProps, tableBodyProps, tableHeadProps, tableProps, sortedDirection, sortedBy, onSortBy, dense, striped, bordered, currentPage, totalNumberOfPages, onPageChange, rowsPerPage, setRowsPerPage, rowsPerPageOptions, hideFooter, prependColumn, appendColumn, isLoading }: GridProps): React.JSX.Element;
|
|
236
230
|
|
|
237
|
-
|
|
231
|
+
type ModalProps = {
|
|
238
232
|
open: boolean;
|
|
239
233
|
onClose: () => void;
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
children: React.ReactNode;
|
|
235
|
+
} & Omit<ModalProps$1, 'children'>;
|
|
236
|
+
declare const Modal: ({ open, onClose, ...rest }: ModalProps) => React.JSX.Element;
|
|
242
237
|
|
|
243
238
|
declare function GetInputLabel<T extends Array<Record<string, any>>, K extends T[number]['name']>(columns: T): (columnName: K) => {
|
|
244
239
|
label: any;
|
|
@@ -257,20 +252,20 @@ interface DialogCustomProps extends DialogProps {
|
|
|
257
252
|
options: DialogOptionsProps[];
|
|
258
253
|
loading: boolean;
|
|
259
254
|
}
|
|
260
|
-
declare const Dialog: ({ open, title, loading, body, options, ...rest }: DialogCustomProps) => JSX.Element;
|
|
255
|
+
declare const Dialog: ({ open, title, loading, body, options, ...rest }: DialogCustomProps) => React.JSX.Element;
|
|
261
256
|
|
|
262
257
|
declare class HttpError extends Error {
|
|
263
258
|
status: number;
|
|
264
259
|
constructor(status: number, message: any);
|
|
265
260
|
}
|
|
266
261
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
user?:
|
|
262
|
+
type PossibleMethods = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
263
|
+
type HandlerProps<UserKeyType = number | string> = (req: NextApiRequest & {
|
|
264
|
+
user?: UserKeyType;
|
|
270
265
|
}, res: NextApiResponse) => Promise<any>;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
type MethodProps = Partial<Record<PossibleMethods, HandlerProps>>;
|
|
267
|
+
type MiddlewaresProps = ((handler: HandlerProps) => HandlerProps)[];
|
|
268
|
+
type ConstructorProps = {
|
|
274
269
|
middlewares?: MiddlewaresProps;
|
|
275
270
|
onFinally: (req: NextApiRequest) => Promise<void>;
|
|
276
271
|
};
|
|
@@ -287,8 +282,8 @@ declare class ApiHelper {
|
|
|
287
282
|
}): ApiHelper;
|
|
288
283
|
}
|
|
289
284
|
|
|
290
|
-
|
|
291
|
-
|
|
285
|
+
type Methods = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options';
|
|
286
|
+
type HandleProps = {
|
|
292
287
|
name: `${Methods}:${string}`;
|
|
293
288
|
};
|
|
294
289
|
declare function useFormHelper(): {
|
|
@@ -299,8 +294,8 @@ declare function useFormHelper(): {
|
|
|
299
294
|
createAlert(message: string, type: _mui_material.AlertColor): void;
|
|
300
295
|
};
|
|
301
296
|
|
|
302
|
-
|
|
303
|
-
|
|
297
|
+
type FilterCompareType = 'gte' | 'lte' | 'lt' | 'gt' | 'equal' | 'in' | 'notEqual' | 'notIn';
|
|
298
|
+
type FilterProps = {
|
|
304
299
|
id?: string;
|
|
305
300
|
prop: string;
|
|
306
301
|
value: unknown;
|
|
@@ -335,7 +330,7 @@ declare function useGrid<T extends Record<string, any>>({ columns, filters, sear
|
|
|
335
330
|
sortedBy: string;
|
|
336
331
|
defaultData: T[];
|
|
337
332
|
sortedDirection: "desc" | "asc";
|
|
338
|
-
columns: ColumnsProps[];
|
|
333
|
+
columns: ColumnsProps<_mui_material.Theme>[];
|
|
339
334
|
currentPage: number;
|
|
340
335
|
totalNumberOfPages: number;
|
|
341
336
|
onPageChange: (pageNumber: number) => void;
|
|
@@ -356,25 +351,25 @@ declare const useAlert: () => {
|
|
|
356
351
|
createAlert(message: string, type: _mui_material.AlertColor): void;
|
|
357
352
|
};
|
|
358
353
|
|
|
359
|
-
|
|
354
|
+
type FormHelperContextProps = {
|
|
360
355
|
formatErrorMessage: (message: any) => string;
|
|
361
356
|
api: AxiosInstance;
|
|
362
357
|
};
|
|
363
358
|
declare const FormHelperContext: React.Context<FormHelperContextProps>;
|
|
364
|
-
|
|
359
|
+
type FormHelperProviderProps = {
|
|
365
360
|
formatErrorMessage: (message: any) => string;
|
|
366
361
|
children: ReactNode;
|
|
367
362
|
api: AxiosInstance;
|
|
368
363
|
};
|
|
369
|
-
declare const FormHelperProvider: ({ formatErrorMessage, api, children }: FormHelperProviderProps) => JSX.Element;
|
|
364
|
+
declare const FormHelperProvider: ({ formatErrorMessage, api, children }: FormHelperProviderProps) => React.JSX.Element;
|
|
370
365
|
|
|
371
|
-
|
|
366
|
+
type AlertContextProps = {
|
|
372
367
|
createAlert(message: string, type: AlertColor): void;
|
|
373
368
|
};
|
|
374
369
|
declare const AlertContext: React.Context<AlertContextProps>;
|
|
375
|
-
|
|
370
|
+
type AlertProviderProps = {
|
|
376
371
|
children: ReactNode;
|
|
377
372
|
};
|
|
378
|
-
declare const AlertProvider: ({ children }: AlertProviderProps) => JSX.Element;
|
|
373
|
+
declare const AlertProvider: ({ children }: AlertProviderProps) => React.JSX.Element;
|
|
379
374
|
|
|
380
375
|
export { AlertContext, AlertProvider, ApiHelper, Autocomplete, BaseGrid, Checkbox, type ColumnTitleProps, type ColumnsProps, Dialog, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, Switch, TabPanel, type TabPanelProps, Td, Tr, createFilter, filterData, getTabProps, useAlert, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|