@mythpe/quasar-ui-qui 0.0.26-dev → 0.0.27-dev

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.
Files changed (54) hide show
  1. package/index.d.ts +0 -4
  2. package/package.json +2 -1
  3. package/src/components/datatable/MDatatable.vue +2305 -0
  4. package/src/components/datatable/MDtAvatar.vue +49 -0
  5. package/src/components/datatable/MDtBtn.vue +153 -0
  6. package/src/components/datatable/MDtContextmenuItems.vue +54 -0
  7. package/src/components/datatable/index.ts +6 -0
  8. package/src/components/form/MAvatarViewer.vue +6 -3
  9. package/src/components/form/MAxios.vue +7 -4
  10. package/src/components/form/MCheckbox.vue +33 -9
  11. package/src/components/form/MDate.vue +4 -1
  12. package/src/components/form/MEmail.vue +4 -1
  13. package/src/components/form/MField.vue +4 -1
  14. package/src/components/form/MFile.vue +5 -2
  15. package/src/components/form/MForm.vue +4 -1
  16. package/src/components/form/MHiddenInput.vue +4 -1
  17. package/src/components/form/MInput.vue +1 -1
  18. package/src/components/form/MInputLabel.vue +4 -1
  19. package/src/components/form/MMobile.vue +4 -1
  20. package/src/components/form/MOptions.vue +255 -0
  21. package/src/components/form/MOtp.vue +292 -0
  22. package/src/components/form/MRadio.vue +5 -2
  23. package/src/components/form/MSelect.vue +4 -1
  24. package/src/components/form/MTime.vue +4 -1
  25. package/src/components/form/MToggle.vue +211 -0
  26. package/src/components/form/MUploader.vue +511 -0
  27. package/src/components/form/index.ts +9 -1
  28. package/src/components/grid/MColumn.vue +4 -1
  29. package/src/components/grid/MHelpRow.vue +5 -1
  30. package/src/components/index.ts +3 -0
  31. package/src/components/modal/MDialog.vue +58 -0
  32. package/src/components/modal/MModalMenu.vue +62 -0
  33. package/src/components/modal/MTooltip.vue +39 -0
  34. package/src/components/modal/index.ts +5 -0
  35. package/src/components/parials/UploaderItem.vue +298 -0
  36. package/src/components/parials/index.ts +3 -0
  37. package/src/components/transition/MTransition.vue +4 -1
  38. package/src/composable/useBindInput.ts +1 -1
  39. package/src/composable/useMyth.ts +20 -11
  40. package/src/index.sass +2 -1
  41. package/src/style/main.sass +104 -0
  42. package/src/style/print.sass +14 -0
  43. package/src/style/transition.sass +40 -0
  44. package/src/types/api-helpers.d.ts +11 -72
  45. package/src/types/components.d.ts +411 -105
  46. package/src/types/index.d.ts +5 -139
  47. package/src/types/install-options.d.ts +19 -0
  48. package/src/types/m-datatable.d.ts +316 -0
  49. package/src/types/m-geolocation.d.ts +16 -0
  50. package/src/types/m-helpers.d.ts +97 -0
  51. package/src/types/plugin-props-option.d.ts +301 -0
  52. package/src/utils/myth.ts +15 -1
  53. package/src/utils/vue-plugin.ts +34 -2
  54. package/src/types/dt.d.ts +0 -144
@@ -6,151 +6,17 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import type { QBtnProps, QFieldProps, QNotifyCreateOptions } from 'quasar'
10
- import {
11
- MAvatarViewerProps,
12
- MBlockProps,
13
- MBtnProps,
14
- MCheckboxProps,
15
- MColProps,
16
- MColumnProps,
17
- MContainerProps,
18
- MDateProps,
19
- MEditorProps,
20
- MFileProps,
21
- MHelpRowProps,
22
- MInputProps,
23
- MPickerProps,
24
- MRadioProps,
25
- MRowProps,
26
- MSelectProps,
27
- MTimeProps,
28
- MTypingStringProps
29
- } from './components'
30
9
  import { myth } from '../utils'
31
- import { ThemeBtn, ThemeFluid, ThemeInput, ThemeRounded, ThemeShadow, ThemeSize } from './theme'
32
- import { HelpersStubSchema } from './api-helpers'
33
-
34
- /**
35
- * Default loading q-btn loading slot.
36
- */
37
- export type BtnLoading = {
38
- type: 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail' | 'spinner';
39
- color?: string | undefined;
40
- size?: string | undefined;
41
- noLabel?: boolean;
42
- }
43
-
44
- export interface PropsContext {
45
- // Grid.
46
- /**
47
- * MBlock component.
48
- */
49
- block?: Partial<MBlockProps>;
50
- /**
51
- * MCol component.
52
- */
53
- col?: Partial<MColProps>;
54
- /**
55
- * MColumn component.
56
- */
57
- column?: Partial<MColumnProps>;
58
- /**
59
- * MContainer component.
60
- */
61
- container?: Partial<MContainerProps>;
62
- /**
63
- * MHelpRow component.
64
- */
65
- helpRow?: Partial<MHelpRowProps>;
66
- /**
67
- * MRow component.
68
- */
69
- row?: Partial<MRowProps>;
70
- /**
71
- * MTypingString component.
72
- */
73
- typingString?: Partial<MTypingStringProps>;
74
- /**
75
- * MAvatarViewer component.
76
- */
77
- avatarViewer?: Partial<MAvatarViewerProps>;
78
- /**
79
- * MBtn component.
80
- */
81
- btn?: Partial<MBtnProps>;
82
- /**
83
- * MInput component.
84
- */
85
- input?: Partial<MInputProps>;
86
- /**
87
- * MFile component.
88
- */
89
- file?: Partial<MFileProps>;
90
- /**
91
- * MMobile component.
92
- */
93
- mobile?: Partial<MInputProps>;
94
- /**
95
- * MInput view mode props.
96
- */
97
- field?: Partial<QFieldProps>;
98
- /**
99
- * MCheckbox component.
100
- */
101
- checkbox?: Partial<MCheckboxProps>;
102
- /**
103
- * MRadio component.
104
- */
105
- radio?: Partial<MRadioProps>;
106
- /**
107
- * MSelect component.
108
- */
109
- select?: Partial<MSelectProps>;
110
- /**
111
- * MPicker component.
112
- */
113
- picker?: Partial<MPickerProps>;
114
- /**
115
- * q-btn component props.
116
- */
117
- pickerBtn?: Partial<QBtnProps>;
118
- /**
119
- * MDate component.
120
- */
121
- date?: Partial<MDateProps>;
122
- /**
123
- * MEditor component.
124
- */
125
- editor?: Partial<MEditorProps>;
126
- /**
127
- * MTime component.
128
- */
129
- time?: Partial<MTimeProps>;
130
- /**
131
- * Notify Props.
132
- */
133
- notify?: Partial<QNotifyCreateOptions>;
134
- }
135
-
136
- export interface InstallOptions {
137
- size?: ThemeSize;
138
- rounded?: ThemeRounded;
139
- shadow?: ThemeShadow;
140
- fluid?: ThemeFluid;
141
- rules?: string[];
142
- btnLoading?: BtnLoading;
143
- props?: PropsContext;
144
- themeInput?: ThemeInput;
145
- themeBtn?: ThemeBtn;
146
- api?: HelpersStubSchema;
147
- }
148
10
 
149
11
  export type MythContext = typeof myth;
150
12
 
151
13
  export * from './api-helpers'
152
14
  export * from './components'
153
- export * from './dt'
15
+ export * from './install-options'
154
16
  export * from './lodash'
17
+ export * from './m-datatable'
18
+ export * from './m-geolocation'
19
+ export * from './plugin-props-option'
20
+ export * from './m-helpers'
155
21
  export * from './quasar-helpers'
156
22
  export * from './theme'
@@ -0,0 +1,19 @@
1
+ import type { ThemeBtn, ThemeFluid, ThemeInput, ThemeRounded, ThemeShadow, ThemeSize } from './theme'
2
+ import type { BtnLoading, PropsContext } from './plugin-props-option'
3
+ import type { HelpersStubSchema } from './api-helpers'
4
+ import type { AxiosInstance } from 'axios'
5
+
6
+ export interface InstallOptions {
7
+ size?: ThemeSize;
8
+ rounded?: ThemeRounded;
9
+ shadow?: ThemeShadow;
10
+ fluid?: ThemeFluid;
11
+ rules?: string[];
12
+ btnLoading?: BtnLoading;
13
+ props?: PropsContext;
14
+ themeInput?: ThemeInput;
15
+ themeBtn?: ThemeBtn;
16
+ baseUrl?: string;
17
+ api?: HelpersStubSchema;
18
+ mAxios?: AxiosInstance;
19
+ }
@@ -0,0 +1,316 @@
1
+ /*
2
+ * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ * Email: mythpe@gmail.com
4
+ * Mobile: +966590470092
5
+ * Website: https://www.4myth.com
6
+ * Github: https://github.com/mythpe
7
+ */
8
+
9
+ import type { AxiosResponse } from 'axios'
10
+ import type { QAvatarProps, QAvatarSlots, QTableProps, QTableSlots } from 'quasar'
11
+ import type { ComputedRef, MaybeRef, Ref, UnwrapNestedRefs, UnwrapRef, VNode } from 'vue'
12
+ import type { RouteLocationRaw } from 'vue-router'
13
+ import { GenericFormValues, MBtnProps, MBtnSlots, MFormSlots } from './components'
14
+ import { StubSchema } from './api-helpers'
15
+ import { ApiMetaInterface, Generic } from './m-helpers'
16
+
17
+ export type MDtItem<T extends object = Record<keyof T, any>> = T & {
18
+ id: string | number;
19
+ [K: keyof T]: any;
20
+ }
21
+
22
+ export type MDtItemIndex = number;
23
+ export type MDtExportOptions = 'pdf' | 'excel';
24
+
25
+ export interface MDatatablePagination {
26
+ /**
27
+ * Column name (from column definition)
28
+ */
29
+ sortBy?: string;
30
+ /**
31
+ * Is sorting in descending order?
32
+ */
33
+ descending?: boolean;
34
+ /**
35
+ * Page number (1-based)
36
+ */
37
+ page: number;
38
+ /**
39
+ * How many rows per page? 0 means Infinite
40
+ */
41
+ rowsPerPage?: number;
42
+ /**
43
+ * For server-side fetching only. How many total database rows are there to be added to the table.
44
+ */
45
+ rowsNumber?: number;
46
+ }
47
+
48
+ export type MDatatableFilterForm = Partial<GenericFormValues>
49
+
50
+ export interface FetchRowsArgs {
51
+ filter?: string | null;
52
+ pagination?: MDatatablePagination
53
+ }
54
+
55
+ export interface ApiServiceParams {
56
+ filter?: Record<string, any>;
57
+ search?: string | null;
58
+ searchColumns?: string[] | string;
59
+ // headers: string[];
60
+ headerItems?: any[] | string[] | string;
61
+ ids?: number[];
62
+ indexType: 'index' | 'pdf' | 'excel';
63
+ // For Datatable, index,export-pdf|excel,update,create,show,delete
64
+ fdt: 'i' | 'e' | 'u' | 'c' | 's' | 'd';
65
+ requestWith?: string;
66
+ itemsPerPage: number;
67
+ page: number;
68
+ sortBy?: string;
69
+ sortDesc?: number;
70
+ toUrl?: MDtExportOptions | boolean;
71
+
72
+ [key: string]: any;
73
+ }
74
+
75
+ export type MDtMythApiServicesSchema = StubSchema;
76
+
77
+ export type MDatatableMetaServer = ApiMetaInterface
78
+
79
+ export type MDatatableOptions = {
80
+ // Table has action like : delete, update, etc...
81
+ hasAction: Ref<boolean>;
82
+ // Table is loading
83
+ loading: Ref<boolean>;
84
+ // Search input
85
+ search: Ref<string | null>;
86
+ // Table pagination
87
+ pagination: Ref<MDatatablePagination>;
88
+ // Server meta data
89
+ meta: Ref<MDatatableMetaServer>;
90
+ // Table filter form
91
+ filter: Ref<MDatatableFilterForm>;
92
+ // Temp of filter form
93
+ tempFilter: Ref<MDatatableFilterForm>;
94
+ // Selected rows
95
+ selected: Ref<MDtItem[]>;
96
+ // Fullscreen of datatable
97
+ fullscreen: Ref<boolean>;
98
+ // Datatable headers.
99
+ getHeaders: ComputedRef<string[] | Partial<QTableProps['columns']> | any[]>;
100
+ // Datatable visible headers.
101
+ visibleHeaders: Ref<any[]>;
102
+ }
103
+ type MDDIP<T extends Generic = Generic | any> = Partial<MDtItem> & Record<string, any> | T;
104
+ export type MDatatableDialogsOptions<T extends MDDIP = MDDIP> = {
105
+ filter: Ref<boolean>;
106
+ show: Ref<boolean>;
107
+ form: Ref<boolean>;
108
+ isUpdate: Ref<boolean>;
109
+ item: T | MaybeRef<MDDIP<T>> | UnwrapRef<MDDIP<T>> | Record<string, any> | undefined;
110
+ index: Ref<MDtItemIndex | undefined>;
111
+ errors: Record<string | number | symbol, string[]> | any;
112
+ }
113
+
114
+ export interface MDtBtnProps extends MBtnProps {
115
+ show?: boolean;
116
+ update?: boolean;
117
+ destroy?: boolean;
118
+ tooltip?: string | undefined;
119
+ color?: string;
120
+ icon?: string;
121
+ listItem?: boolean;
122
+ fabMini?: boolean;
123
+ flat?: boolean;
124
+ round?: boolean;
125
+ dense?: boolean;
126
+ label?: string | undefined;
127
+ }
128
+
129
+ export interface MDtBtnSlots extends MBtnSlots {
130
+ /**
131
+ * Use for custom content, instead of relying on 'icon' and 'label' props
132
+ */
133
+ default: () => VNode[];
134
+ /**
135
+ * Override the default QSpinner when in 'loading' state
136
+ */
137
+ loading: () => VNode[];
138
+ }
139
+
140
+ type UnwrapNestedTableOptionsType = UnwrapNestedRefs<MDatatableOptions>;
141
+ export type MDatatableScope = {
142
+ openShowDialog: (item: MDtItem, index?: MDtItemIndex) => void;
143
+ openShowDialogNoIndex: (item: MDtItem) => void;
144
+ closeShowDialog: () => void;
145
+ openUpdateDialog: (item: MDtItem, index?: MDtItemIndex) => void;
146
+ openUpdateDialogNoIndex: (item: MDtItem) => void;
147
+ openCreateDialog: (item?: MDtItem) => void;
148
+ closeFormDialog: () => void;
149
+ onDeleteItem: (item: MDtItem, index: number) => void;
150
+ refresh: (done?: () => void) => void;
151
+ refreshNoUpdate: (done?: () => void) => void;
152
+ tableOptions: UnwrapNestedTableOptionsType;
153
+ isSingleSelectedItem: ComputedRef<boolean>;
154
+ firstSelectedItem: ComputedRef<MDtItem>;
155
+ updateDatatableItem: (item: MDtItem, index?: MDtItemIndex) => void;
156
+ updateSelectedItems: ((selected: MDtItem[]) => void);
157
+ imageDialog: UnwrapNestedRefs<{ value: boolean, src?: string, asAttachment?: boolean }>;
158
+ openImageDialog: (src: string, opts?: { asAttachment?: boolean }) => void;
159
+ closeImageDialog: () => void;
160
+ }
161
+ type E = MDatatableDialogsOptions['item'];
162
+ export type GenericMDtBtn<T extends E = E> = Record<string, any> & {
163
+ name: string;
164
+ label?: string;
165
+ contextLabel?: string | null;
166
+ tooltip?: string;
167
+ click?: (item: UnwrapRef<T> | Ref<T> | T, index: UnwrapRef<MDatatableDialogsOptions['index']>) => void;
168
+ multiClick?: (items: T[]) => void;
169
+ showIf?: boolean | ((item: UnwrapRef<MDatatableDialogsOptions['item']>, index: UnwrapRef<MDatatableDialogsOptions['index']>) => boolean);
170
+ order?: number;
171
+ attr?: Partial<MDtBtnProps> & Partial<{ icon?: string; textColor?: string; color?: string; }>;
172
+ }
173
+
174
+ type MDatatableFormScope = Parameters<MFormSlots['default']>[0]
175
+
176
+ type MDatatableMainScope = {
177
+ dt: MDatatableScope,
178
+ item: MDtItem,
179
+ index: MDtItemIndex,
180
+ form: MDatatableFormScope,
181
+ }
182
+
183
+ export interface MDatatableSlots extends Omit<QTableSlots, `body-cell-${string}` | 'top'> {
184
+ tools: ((scope: { dt: MDatatableScope, }) => VNode[]);
185
+
186
+ selection: ((scope: { dt: MDatatableScope, }) => VNode[]);
187
+
188
+ filter: ((scope: { filter: MDatatableFilterForm } & MDatatableMainScope) => VNode[]);
189
+
190
+ show: ((scope: MDatatableMainScope) => VNode[]);
191
+
192
+ form: ((scope: MDatatableMainScope) => VNode[]);
193
+
194
+ 'form-actions': ((scope: MDatatableMainScope) => VNode[]);
195
+
196
+ title: ((scope: MDatatableMainScope) => VNode[]);
197
+ 'top-search': ((scope: MDatatableMainScope) => VNode[]);
198
+ 'bottom-search': ((scope: MDatatableMainScope) => VNode[]);
199
+
200
+ [K: `body-cell-${string}`]: ((scope: Parameters<QTableSlots['body-cell']>[0] & { dt: MDatatableScope }) => VNode[]);
201
+ }
202
+
203
+ export type MDtServiceNameCallbackProp = (() => Record<string, (() => Promise<AxiosResponse>)>)
204
+ export type MDtServiceNameStringProp = string
205
+ export type MDtRequestParamsCallbackProp = (params: ApiServiceParams) => Partial<GenericFormValues>
206
+ export type MDtRequestParamsObjectProp = Partial<GenericFormValues>
207
+
208
+ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = Omit<QTableProps, 'rows' | 'rowsPerPageOptions' | 'visibleColumns'> & {
209
+ rows?: any[];
210
+ controlKey?: string;
211
+ defaultItem?: Partial<MDtItem<I>>
212
+ contextItems?: GenericMDtBtn[];
213
+ hideAutoMessage?: boolean;
214
+ headers: string[] | Partial<QTableProps['columns']> | any[];
215
+ serviceName?: MDtServiceNameStringProp | MDtServiceNameCallbackProp;
216
+ requestParams?: MDtRequestParamsObjectProp | MDtRequestParamsCallbackProp;
217
+ pdf?: boolean;
218
+ excel?: boolean;
219
+ exportUrl?: MDtExportOptions | boolean;
220
+ hideSearch?: boolean;
221
+ searchDebounce?: string | number;
222
+ withIndex?: string | string[];
223
+ withStore?: string | string[];
224
+ withShow?: string | string[];
225
+ withUpdate?: string | string[];
226
+ hideAddBtn?: boolean;
227
+ hideUpdateBtn?: boolean;
228
+ hideShowBtn?: boolean;
229
+ hideDestroyBtn?: boolean;
230
+ storeRoute?: string | RouteLocationRaw;
231
+ storeQueryParams?: boolean;
232
+ updateRoute?: string | RouteLocationRaw;
233
+ updateQueryParams?: boolean;
234
+ showRoute?: string | RouteLocationRaw;
235
+ showQueryParams?: boolean;
236
+ mouse?: boolean;
237
+ noRefreshBtn?: boolean;
238
+ endReach?: boolean;
239
+ showSelection?: boolean;
240
+ hideSelection?: boolean;
241
+ multiSelection?: boolean;
242
+ multiDestroy?: boolean;
243
+ rowsPerPageOptions?: (string | number)[];
244
+ ignoreKeys?: string[] | ((form: Record<string, any>) => string[]) | any[];
245
+ manageColumns?: boolean;
246
+ visibleColumns?: (string | null | undefined)[] | any[];
247
+ searchColumns?: string[];
248
+ /**
249
+ * Show Add btn top of table,
250
+ */
251
+ addTopBtn?: boolean;
252
+ /**
253
+ * Show Add btn inside more list
254
+ */
255
+ addListBtn?: boolean;
256
+ /**
257
+ * Show Fab Add btn
258
+ */
259
+ addFabBtn?: boolean;
260
+ /**
261
+ * make datatable fullscreen mode
262
+ */
263
+ fullscreenBtn?: boolean;
264
+ /**
265
+ * Auto actions body headers 'control'
266
+ */
267
+ noBodyControl?: boolean;
268
+ /**
269
+ * Auto actions card 'control'
270
+ */
271
+ showCardControlHeader?: boolean;
272
+ /**
273
+ * Set datatable to fixed view
274
+ */
275
+ fixed?: boolean;
276
+ /**
277
+ * Names of image columns in the table.
278
+ */
279
+ imageColumns?: string[] | any[];
280
+ /**
281
+ * How to display image button in table.
282
+ */
283
+ imageMode?: 'icon' | 'image';
284
+ /**
285
+ * Image size in display
286
+ */
287
+ imageSize?: string;
288
+
289
+ }
290
+
291
+ export interface MDtAvatarProps extends QAvatarProps {
292
+ width?: string;
293
+ src?: string;
294
+ href?: string;
295
+ }
296
+
297
+ export interface MDtAvatarSlots extends QAvatarSlots {
298
+ /**
299
+ * Default slot can be used for captions. See examples
300
+ */
301
+ default: () => VNode[];
302
+ }
303
+
304
+ export interface MDtContextmenuItemsProps {
305
+ items: MDatatableProps['contextItems'],
306
+ item: UnwrapRef<MDatatableDialogsOptions['item']>,
307
+ index: UnwrapRef<MDatatableDialogsOptions['index']>,
308
+ displayMode?: 'icon' | 'item'
309
+ }
310
+
311
+ export interface MDtContextmenuItemsSlots {
312
+ /**
313
+ * Default slot can be used for captions. See examples
314
+ */
315
+ default: () => VNode[];
316
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ * Email: mythpe@gmail.com
4
+ * Mobile: +966590470092
5
+ * Website: https://www.4myth.com
6
+ * Github: https://github.com/mythpe
7
+ */
8
+
9
+ /// <reference types="google.maps" />
10
+
11
+ export interface CoordsProps {
12
+ latitude: number;
13
+ longitude: number;
14
+ }
15
+
16
+ export {}
@@ -0,0 +1,97 @@
1
+ /*
2
+ * MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
3
+ * Email: mythpe@gmail.com
4
+ * Mobile: +966590470092
5
+ * Website: https://www.4myth.com
6
+ * Github: https://github.com/mythpe
7
+ */
8
+
9
+ import type { AxiosError, AxiosResponse } from 'axios'
10
+ import type { DialogChainObject, QNotifyCreateOptions, QNotifyUpdateOptions, QTableProps } from 'quasar'
11
+ import type { MDatatableProps } from './m-datatable'
12
+
13
+ export type ParseHeaderOptions = {
14
+ controlKey?: 'control' | string
15
+ controlStyle?: 'max-width: 150px' | string
16
+ align?: 'left' | 'right' | 'center' | undefined
17
+ sortable?: boolean | undefined;
18
+ classes?: string | (() => string),
19
+ noSort?: string[]
20
+ }
21
+
22
+ export type MDtColumn = QTableProps['columns'][number]
23
+
24
+ export type MDtHeadersParameter = MDtColumn[] | (keyof MDatatableProps['defaultItem'])[]
25
+
26
+ // Axios
27
+ type Generic = Record<any, any>;
28
+
29
+ export type ApiMetaInterface = {
30
+ // server current page
31
+ current_page: number | null;
32
+ // server last page
33
+ last_page: number | null;
34
+ // server total items
35
+ total: number | null;
36
+ [K: any]: any;
37
+ };
38
+ export type ApiErrorInterface = Record<string, string[]>;
39
+ export type ApiErrorsInterface = ApiErrorInterface[];
40
+
41
+ export type ApiModel<T extends Generic = Generic> = {
42
+ id: string | number;
43
+ value: string | number;
44
+ label?: string;
45
+ [K: keyof T]: any;
46
+ [s: string]: any;
47
+ };
48
+
49
+ type ResponseAsMain = Generic & {
50
+ success: boolean;
51
+ errors: ApiErrorsInterface;
52
+ message: string;
53
+ }
54
+
55
+ type ResponseAsModel<T extends Generic = Generic> = ResponseAsMain & {
56
+ data: ApiModel<T>
57
+ }
58
+ type ResponseAsList<T extends Generic = Generic> = ResponseAsMain & {
59
+ data: ResponseAsModel<T>[];
60
+ links: {
61
+ first: string;
62
+ last: string;
63
+ prev: string | null;
64
+ next: string | null;
65
+ }
66
+ meta: ApiMetaInterface;
67
+ }
68
+ type ResponseDataType = ResponseAsList | ResponseAsModel | Generic;
69
+ export type ApiFulfilledResponse = AxiosResponse<ResponseDataType>
70
+ export type ApiErrorResponse = AxiosError<ResponseDataType>;
71
+
72
+ export type ApiInterface = ApiFulfilledResponse & {
73
+ _data: ResponseDataType;
74
+ _message: ResponseAsMain['message'];
75
+ _meta: ResponseAsList['meta'];
76
+ _success: ResponseAsMain['success'];
77
+ _errors: ResponseAsMain['errors'];
78
+ }
79
+
80
+ // Axios
81
+
82
+ export type Vue3MAlertMessageOptions = QNotifyCreateOptions | string
83
+
84
+ export type Vue3MAlertMessage = (props?: QNotifyUpdateOptions) => void;
85
+
86
+ export type Vue3MConfirmMessage = DialogChainObject
87
+
88
+ export type DownloadFromResponse = {
89
+ status: boolean;
90
+ response: AxiosResponse;
91
+ }
92
+
93
+ export type DownloadFromResponseCode = 'no_response' | 'no_file_name' | 'no_file_url' | 'unknown' | string
94
+ export type DownloadFromResponseError = {
95
+ code: DownloadFromResponseCode
96
+ status: boolean;
97
+ }