forked from gridsuite/gridexplore-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decs.d.ts
171 lines (145 loc) · 5.36 KB
/
decs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
declare module '@gridsuite/commons-ui' {
import { FunctionComponent, ReactElement } from 'react';
import { InferProps } from 'prop-types';
import { AutocompleteProps } from '@mui/material/Autocomplete/Autocomplete';
import {
ButtonProps,
RadioGroupProps,
TextFieldProps,
} from '@mui/material';
import {TopBar as RawTopBar} from '@gridsuite/commons-ui';
export const DARK_THEME: String, LIGHT_THEME: String;
export const TopBar: FunctionComponent<InferProps<typeof RawTopBar.propTypes>>;
function logout(dispatch: any, userManagerInstance: any): Promise<any | undefined>;
interface SnackInputs {
messageTxt?: string;
messageId?: string;
messageValues?: string[];
headerTxt?: string;
headerId?: string;
headerValues?: Record<string, string>;
}
interface UseSnackMessageReturn {
snackError: (snackInputs: SnackInputs) => void;
snackWarning: (snackInputs: SnackInputs) => void;
snackInfo: (snackInputs: SnackInputs) => void;
}
export type Parameter = {
type: string;
name: string;
description: string;
possibleValues: string[];
defaultValue: string;
};
interface FlatParametersProps extends Pick<TextFieldProps, 'variant'> {
paramsAsArray: Parameter[];
initValues: Record<string, any>;
onChange: (paramName: string, value: any, isEdit: boolean) => void;
showSeparator?: boolean;
selectionWithDialog?: (parameter: Parameter) => boolean;
}
export function useSnackMessage(): UseSnackMessageReturn;
type Input = string | number;
type Options = Array<{
id: string;
label: string;
}>;
interface AutocompleteInputProps
extends Omit<
AutocompleteProps<
string,
boolean | undefined,
boolean | undefined,
boolean | undefined
>,
// we already defined them in our custom Autocomplete
'value' | 'onChange' | 'renderInput'
> {
name: string;
label?: string;
outputTransform?: (value: string) => string;
inputTransform?: (value: string) => string;
readOnly?: boolean;
previousValue?: string;
allowNewValue?: boolean;
onChangeCallback?: () => void;
formProps?: Omit<
TextFieldProps,
'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'
>;
}
export const AutocompleteInput: FunctionComponent<AutocompleteInputProps>;
interface FieldErrorAlertProps {
name: string;
}
export const FieldErrorAlert: FunctionComponent<FieldErrorAlertProps>;
interface ErrorInputProps {
name: string;
InputField?: FunctionComponent<FieldErrorAlertProps>;
InputField?: FunctionComponent;
}
export const ErrorInput: FunctionComponent<ErrorInputProps>;
export const SelectInput: FunctionComponent<
Omit<
AutocompleteInputProps,
'outputTransform' | 'inputTransform' | 'readOnly' | 'getOptionLabel' // already defined in SelectInput
>
>;
interface TextFieldWithAdornmentProps extends TextFieldProps {
// variant already included in TextFieldProps
value: Input; // we override the default type of TextFieldProps which is unknown
adornmentPosition: string;
adornmentText: string;
handleClearValue?: () => void;
}
interface TextInputProps {
name: string;
label?: string;
labelValues?: any; // it's for values from https://formatjs.io/docs/react-intl/components/#formattedmessage
id?: string;
adornment?: {
position: string;
text: string;
};
customAdornment?: ReactElement | null;
outputTransform?: (value: string) => Input;
inputTransform?: (value: Input) => string;
acceptValue?: (value: string) => boolean;
previousValue?: Input;
clearable?: boolean;
formProps?: Omit<
TextFieldWithAdornmentProps | TextFieldProps,
'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'
>;
}
export const TextInput: FunctionComponent<TextInputProps>;
export const FloatInput: FunctionComponent<
Omit<
TextInputProps,
'outputTransform' | 'inputTransform' | 'acceptValue' // already defined in FloatInput
>
>;
interface RadioInputProps {
name: string;
label?: string;
id?: string;
options: Options;
formProps?: Omit<RadioGroupProps, 'value'>;
}
export const RadioInput: FunctionComponent<RadioInputProps>;
export const SubmitButton: FunctionComponent<ButtonProps>;
interface CancelButtonProps extends ButtonProps {
color?: string;
}
export const CancelButton: FunctionComponent<CancelButtonProps>;
export const FieldLabel: FunctionComponent<{
label: string;
optional?: boolean;
values?: any; // it's for values from https://formatjs.io/docs/react-intl/components/#formattedmessage
}>;
export const FlatParameters: FunctionComponent<FlatParametersProps>;
export function useDebounce(
debouncedFunction: (...args: any[]) => void,
debounceDelay: number
): (...args: any[]) => void;
}