Skip to content

Commit bdfe19b

Browse files
Updating types and cleaning
1 parent 3a52a96 commit bdfe19b

File tree

1 file changed

+56
-96
lines changed

1 file changed

+56
-96
lines changed

src/types/index.ts

Lines changed: 56 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/* eslint-disable no-unused-vars */
2-
import {
3-
// CSSProperties,
4-
PropType,
5-
// StyleValue,
6-
} from 'vue';
7-
// import { ThemeInstance } from 'vuetify';
82
import type {
3+
VBtn,
94
VCheckbox,
105
VSelect,
116
VSwitch,
@@ -14,7 +9,6 @@ import type {
149
} from 'vuetify/components';
1510
import {
1611
AxiosError,
17-
// AxiosResponse,
1812
} from 'axios';
1913

2014

@@ -25,102 +19,62 @@ export type Density = null | 'default' | 'comfortable' | 'compact';
2519
// -------------------------------------------------- Props //
2620
export interface SharedProps {
2721
apiRoute?: string;
28-
autofocus?: boolean; // ? AutoFocusProps
22+
autofocus?: boolean;
23+
cancelButtonColor?: VBtn['$props']['color'];
24+
cancelButtonSize?: VBtn['$props']['size'];
25+
cancelButtonTitle?: string | undefined;
26+
cancelButtonVariant?: VBtn['$props']['variant'];
2927
cancelIcon?: string;
28+
cancelIconColor?: string;
3029
closeSiblings?: boolean;
3130
color?: string;
32-
// density?: Density;
3331
disabled?: boolean;
3432
doNotSave?: boolean;
3533
emptyText?: string;
34+
falseValue?: boolean | string;
3635
fieldOnly?: boolean;
3736
hideDetails?: boolean;
37+
hideSaveIcon?: boolean;
38+
iconFalse?: string;
39+
iconFalseColor?: string;
40+
iconFalseTitle?: string | undefined;
41+
iconTrue?: string;
42+
iconTrueColor?: string;
43+
iconTrueTitle?: string | undefined;
44+
icons?: boolean;
3845
item: Record<string, unknown>;
3946
label?: string;
47+
loadingIcon?: string;
48+
loadingIconColor?: string;
4049
method?: string;
4150
name: string;
51+
saveButtonColor?: VBtn['$props']['color'];
52+
saveButtonSize?: VBtn['$props']['size'];
53+
saveButtonTitle?: string | undefined;
54+
saveButtonVariant?: VBtn['$props']['variant'];
55+
saveIcon?: string;
56+
saveIconColor?: string;
57+
trueValue?: boolean | string;
4258
underlineColor?: string;
4359
underlineStyle?: string;
4460
underlineWidth?: string;
4561
underlined?: boolean;
4662
valueColor?: string;
47-
48-
hideSaveIcon?: boolean; // ? SaveAndLoadingIconProps
49-
loadingIcon?: string; // ? SaveAndLoadingIconProps
50-
loadingIconColor?: string; // ? SaveAndLoadingIconProps
51-
saveIcon?: string; // ? SaveAndLoadingIconProps
52-
saveIconColor?: string; // ? SaveAndLoadingIconProps
53-
54-
falseValue?: boolean | string; // ? TrueFalseIconsProps
55-
iconFalse?: string; // ? TrueFalseIconsProps
56-
iconFalseColor?: string; // ? TrueFalseIconsProps
57-
iconTrue?: string; // ? TrueFalseIconsProps
58-
iconTrueColor?: string; // ? TrueFalseIconsProps
59-
icons?: boolean; // ? TrueFalseIconsProps && ValueIconsProps
60-
trueValue?: boolean | string; // ? TrueFalseIconsProps
6163
}
6264

63-
export interface AutoFocusProps {
64-
autofocus: {
65-
default: boolean,
66-
required: boolean,
67-
type: PropType<boolean>;
68-
};
69-
}
7065

71-
export interface SaveAndLoadingIconProps {
72-
hideSaveIcon: {
73-
default: boolean,
74-
required: boolean,
75-
type: PropType<boolean>;
76-
};
77-
loadingIcon: {
78-
default: string,
79-
required: boolean,
80-
type: PropType<string>;
81-
};
82-
loadingIconColor: {
83-
default: string,
84-
required: boolean,
85-
type: PropType<string>;
86-
};
87-
saveIcon: {
88-
default: string,
89-
required: boolean,
90-
type: PropType<string>;
91-
};
92-
saveIconColor: {
93-
default: string,
94-
required: boolean,
95-
type: PropType<string>;
96-
};
97-
}
98-
99-
export interface TrueFalseIconsProps {
100-
falseValue?: boolean | string;
101-
iconFalse?: string;
102-
iconFalseColor?: string;
103-
iconTrue?: string;
104-
iconTrueColor?: string;
105-
icons?: boolean; // ? ValueIconsProps
106-
trueValue?: boolean | string;
107-
}
108-
109-
export interface ValueIconsProps {
110-
icons?: boolean;
111-
}
11266

11367
// Component Props //
11468
export interface VInlineCheckboxProps extends Omit<SharedProps,
115-
'autofocus' | 'hideSaveIcon' | 'loadingIcon' | 'loadingIconColor' | 'saveIcon' | 'saveIconColor'
69+
'autofocus' | 'hideSaveIcon' | 'loadingIcon' | 'loadingIconColor' | 'saveButtonColor' | 'saveButtonSize' | 'saveIcon' | 'saveIconColor' | 'saveButtonTitle' | 'saveButtonVariant'
11670
> {
11771
density?: VCheckbox['$props']['density'];
11872
falseIcon?: VCheckbox['$props']['falseIcon'];
11973
trueIcon?: VCheckbox['$props']['trueIcon'];
12074
}
12175

12276
export interface VInlineSelectProps extends Omit<SharedProps,
123-
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconTrue' | 'iconTrueColor' | 'icons' | 'trueValue'
77+
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconFalseTitle' | 'iconTrue' | 'iconTrueColor' | 'iconTrueTitle' | 'icons' | 'trueValue'
12478
> {
12579
clearIcon?: VSelect['$props']['clearIcon'];
12680
clearable?: VSelect['$props']['clearable'];
@@ -133,32 +87,58 @@ export interface VInlineSelectProps extends Omit<SharedProps,
13387
}
13488

13589
export interface VInlineSwitchProps extends Omit<SharedProps,
136-
'autofocus' | 'hideSaveIcon' | 'loadingIcon' | 'loadingIconColor' | 'saveIcon' | 'saveIconColor'
90+
'autofocus' | 'hideSaveIcon' | 'loadingIcon' | 'loadingIconColor' | 'saveButtonColor' | 'saveButtonSize' | 'saveIcon' | 'saveIconColor' | 'saveButtonTitle' | 'saveButtonVariant'
13791
> {
13892
density?: VSwitch['$props']['density'];
13993
falseIcon?: VSwitch['$props']['falseIcon'];
14094
}
14195

14296
export interface VInlineTextareaProps extends Omit<SharedProps,
143-
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconTrue' | 'iconTrueColor' | 'icons' | 'trueValue'
97+
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconFalseTitle' | 'iconTrue' | 'iconTrueColor' | 'iconTrueTitle' | 'icons' | 'trueValue'
14498
> {
14599
autoGrow?: VTextarea['$props']['autoGrow'];
146100
density?: VTextarea['$props']['density'];
147101
variant?: VTextarea['$props']['variant'];
148102
}
149103

150104
export interface VInlineTextFieldProps extends Omit<SharedProps,
151-
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconTrue' | 'iconTrueColor' | 'icons' | 'trueValue'
105+
'falseValue' | 'iconFalse' | 'iconFalseColor' | 'iconFalseTitle' | 'iconTrue' | 'iconTrueColor' | 'iconTrueTitle' | 'icons' | 'trueValue'
152106
> {
153107
density?: VTextField['$props']['density'];
154108
variant?: VTextField['$props']['variant'];
155109
}
156110

111+
export type BooleanIcons = Required<Pick<SharedProps, 'iconFalse' | 'iconFalseColor' | 'iconFalseTitle' | 'iconTrue' | 'iconTrueColor' | 'iconTrueTitle'>>;
112+
113+
export interface SaveFieldButtons extends Required<Pick<SharedProps,
114+
'cancelButtonColor' |
115+
'cancelButtonSize' |
116+
'cancelButtonVariant' |
117+
'cancelButtonTitle' |
118+
'cancelIcon' |
119+
'cancelIconColor' |
120+
'fieldOnly' |
121+
'hideSaveIcon' |
122+
'loadingIcon' |
123+
'loadingIconColor' |
124+
'saveButtonColor' |
125+
'saveButtonSize' |
126+
'saveButtonTitle' |
127+
'saveButtonVariant' |
128+
'saveIconColor' |
129+
'saveButtonVariant' |
130+
'saveIcon'
131+
>> {
132+
loading: boolean;
133+
};
134+
157135

158136
// -------------------------------------------------- Methods //
159137
export type FieldValue = string | boolean | number | object | [] | null | { [key: string]: string | unknown; };
160138
export type TimeOpened = Date | null;
161139

140+
141+
// -------------------------------------------------- Composables //
162142
export interface UseToggleField {
163143
(
164144
itemId: number,
@@ -190,23 +170,3 @@ export interface UseSaveValue {
190170
value: FieldValue,
191171
): Promise<{ [key: string]: string | unknown; } | undefined>;
192172
}
193-
194-
195-
196-
// -------------------------------------------------- Classes //
197-
198-
199-
200-
// -------------------------------------------------- Styles //
201-
202-
203-
204-
// -------------------------------------------------- Events //
205-
206-
207-
208-
// -------------------------------------------------- Helpers //
209-
210-
211-
212-
// -------------------------------------------------- Emits //

0 commit comments

Comments
 (0)