@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
@@ -0,0 +1,301 @@
1
+ import type {
2
+ MAvatarViewerProps,
3
+ MBlockProps,
4
+ MBtnProps,
5
+ MCheckboxProps,
6
+ MColProps,
7
+ MColumnProps,
8
+ MContainerProps,
9
+ MDateProps,
10
+ MDialogProps,
11
+ MEditorProps,
12
+ MFileProps,
13
+ MHelpRowProps,
14
+ MInputProps,
15
+ MModalMenuProps,
16
+ MOptionsProps,
17
+ MOtpProps,
18
+ MPickerProps,
19
+ MRadioProps,
20
+ MRowProps,
21
+ MSelectProps,
22
+ MTimeProps,
23
+ MToggleProps,
24
+ MTooltipProps,
25
+ MTypingStringProps,
26
+ MUploaderProps
27
+ } from './components'
28
+ import type {
29
+ QBtnDropdownProps,
30
+ QBtnProps,
31
+ QCardProps, QDialogOptions,
32
+ QDialogProps,
33
+ QFieldProps, QIconProps, QItemLabelProps,
34
+ QItemProps, QItemSectionProps, QListProps,
35
+ QMenuProps,
36
+ QNotifyCreateOptions,
37
+ QPageStickyProps,
38
+ QPopupProxyProps
39
+ } from 'quasar'
40
+ import { MDatatableProps, MDtBtnProps } from './m-datatable'
41
+
42
+ export interface PropsContext {
43
+ // Grid.
44
+ /**
45
+ * MBlock component.
46
+ */
47
+ block?: Partial<MBlockProps>;
48
+ /**
49
+ * MCol component.
50
+ */
51
+ col?: Partial<MColProps>;
52
+ /**
53
+ * MColumn component.
54
+ */
55
+ column?: Partial<MColumnProps>;
56
+ /**
57
+ * MContainer component.
58
+ */
59
+ container?: Partial<MContainerProps>;
60
+ /**
61
+ * MHelpRow component.
62
+ */
63
+ helpRow?: Partial<MHelpRowProps>;
64
+ /**
65
+ * MRow component.
66
+ */
67
+ row?: Partial<MRowProps>;
68
+ /**
69
+ * MTypingString component.
70
+ */
71
+ typingString?: Partial<MTypingStringProps>;
72
+ /**
73
+ * MAvatarViewer component.
74
+ */
75
+ avatarViewer?: Partial<MAvatarViewerProps>;
76
+ /**
77
+ * MBtn component.
78
+ */
79
+ btn?: Partial<MBtnProps>;
80
+ /**
81
+ * MInput component.
82
+ */
83
+ input?: Partial<MInputProps>;
84
+ /**
85
+ * MFile component.
86
+ */
87
+ file?: Partial<MFileProps>;
88
+ /**
89
+ * MMobile component.
90
+ */
91
+ mobile?: Partial<MInputProps>;
92
+ /**
93
+ * MOptions component.
94
+ */
95
+ options?: Partial<MOptionsProps>;
96
+ /**
97
+ * MOtp component.
98
+ */
99
+ otp?: Partial<MOtpProps>;
100
+ /**
101
+ * MInput view mode props.
102
+ */
103
+ field?: Partial<QFieldProps>;
104
+ /**
105
+ * MCheckbox component.
106
+ */
107
+ checkbox?: Partial<MCheckboxProps>;
108
+ /**
109
+ * MRadio component.
110
+ */
111
+ radio?: Partial<MRadioProps>;
112
+ /**
113
+ * MSelect component.
114
+ */
115
+ select?: Partial<MSelectProps>;
116
+ /**
117
+ * MPicker component.
118
+ */
119
+ picker?: Partial<MPickerProps>;
120
+ /**
121
+ * q-btn component props.
122
+ */
123
+ pickerBtn?: Partial<QBtnProps>;
124
+ /**
125
+ * MDate component.
126
+ */
127
+ date?: Partial<MDateProps>;
128
+ /**
129
+ * MEditor component.
130
+ */
131
+ editor?: Partial<MEditorProps>;
132
+ /**
133
+ * MTime component.
134
+ */
135
+ time?: Partial<MTimeProps>;
136
+ /**
137
+ * MToggle component.
138
+ */
139
+ toggle?: Partial<MToggleProps>;
140
+ /**
141
+ * MUploader component.
142
+ */
143
+ uploader?: Partial<MUploaderProps>;
144
+ /**
145
+ * MUploader options.
146
+ */
147
+ uploaderOptions?: {
148
+ downloadBtnProps?: Partial<QBtnProps>;
149
+ removeBtnProps?: Partial<QBtnProps>;
150
+ iconsSize?: MUploaderProps['iconsSize'];
151
+ };
152
+ /**
153
+ * Notify Props.
154
+ */
155
+ notify?: Partial<QNotifyCreateOptions>;
156
+ /**
157
+ * MDialog component.
158
+ */
159
+ dialog?: Partial<MDialogProps>;
160
+ confirmDialog?: Partial<QDialogOptions>;
161
+ confirmDialogOptions?: {
162
+ buttons?: Partial<QBtnProps>;
163
+ okProps?: Partial<QBtnProps>;
164
+ cancelProps?: Partial<QBtnProps>;
165
+ };
166
+ /**
167
+ * MModalMenu component.
168
+ */
169
+ modalMenu?: Partial<MModalMenuProps>;
170
+ /**
171
+ * MModalMenu options.
172
+ */
173
+ modalMenuOptions?: {
174
+ card?: Partial<QCardProps>;
175
+ closeBtn?: Partial<QItemProps>;
176
+ };
177
+ /**
178
+ * MTooltip component.
179
+ */
180
+ tooltip?: Partial<MTooltipProps>;
181
+ /**
182
+ * MDatatable component.
183
+ */
184
+ datatable?: Partial<MDatatableProps>;
185
+ /**
186
+ * Styles for DataTable.
187
+ */
188
+ dt?: {
189
+ /**
190
+ * Style of the DataTable.
191
+ */
192
+ dense?: boolean;
193
+ /**
194
+ * Quasar loading with datatable loading props.
195
+ */
196
+ useQuasarLoading?: boolean;
197
+ /**
198
+ * MModalMenu props.
199
+ * Inside table top slot.
200
+ * defaults: no-close-btn & persistent & position="top"
201
+ */
202
+ filterDialogProps?: Partial<QDialogProps> & Partial<QMenuProps> & Partial<QPopupProxyProps>;
203
+ showDialogProps?: Partial<QDialogProps>;
204
+ formDialogProps?: Partial<QDialogProps>;
205
+ fabBtn?: {
206
+ pageStickyProps?: Partial<QPageStickyProps>;
207
+ offset?: QPageStickyProps['offset'];
208
+ position?: QPageStickyProps['position'];
209
+ buttonProps?: Partial<QBtnProps>;
210
+ },
211
+ contextmenu?: {
212
+ menu?: Partial<MModalMenuProps>;
213
+ list?: Partial<QListProps>;
214
+ btnStyle?: {
215
+ showLabel?: boolean;
216
+ updateColor?: string;
217
+ showColor?: string;
218
+ destroyColor?: string;
219
+ }
220
+ },
221
+ buttons?: {
222
+ filter?: Partial<MDtBtnProps>;
223
+ refresh?: Partial<MDtBtnProps>;
224
+ more?: Partial<MDtBtnProps>;
225
+ fullscreen?: Partial<MDtBtnProps>;
226
+ moreMenu?: Partial<QMenuProps>;
227
+ moreList?: Partial<QListProps>;
228
+ moreItem?: Partial<QItemProps>;
229
+ },
230
+ topSelection?: {
231
+ btn?: Partial<MDtBtnProps>;
232
+ },
233
+ searchInput?: {
234
+ props?: Partial<MInputProps>;
235
+ optionsIcon?: string;
236
+ menuProps?: Partial<QMenuProps>;
237
+ menuBtn?: Partial<QBtnProps>;
238
+ };
239
+ dialogButtonsProps?: Partial<MBtnProps>;
240
+ listItem?: {
241
+ item?: Partial<QItemProps>;
242
+ avatarSection?: Partial<QItemSectionProps>;
243
+ icon?: Partial<QIconProps>;
244
+ labelSection?: Partial<QItemSectionProps>;
245
+ labelItem?: Partial<QItemLabelProps>;
246
+ };
247
+ btn?: Partial<MDtBtnProps>;
248
+ /**
249
+ * Dropdown of control column in table.
250
+ * q-btn-dropdown
251
+ */
252
+ controlDropdown?: Partial<QBtnDropdownProps>;
253
+ MDtBtn?: {
254
+ /**
255
+ * List mode Props.
256
+ */
257
+ item?: {
258
+ /**
259
+ * Item Props.
260
+ */
261
+ props?: Partial<QItemProps>;
262
+ /**
263
+ * q-item-section.
264
+ * Props of avatar section.
265
+ */
266
+ avatarProps?: Partial<QItemSectionProps>;
267
+ /**
268
+ * q-icon.
269
+ * Props of icon inside avatar section.
270
+ */
271
+ iconProps?: Partial<QIconProps>;
272
+ /**
273
+ * q-item-section.
274
+ * Props of label section.
275
+ */
276
+ labelSectionProps?: Partial<QItemSectionProps>;
277
+ /**
278
+ * q-item-label.
279
+ * Props of label inside label section.
280
+ */
281
+ itemLabelProps?: Partial<QItemLabelProps>;
282
+ };
283
+ /**
284
+ * MDtBtn btn mode Props.
285
+ */
286
+ btn?: {
287
+ props?: Partial<QBtnProps>;
288
+ };
289
+ }
290
+ };
291
+ }
292
+
293
+ /**
294
+ * Default loading q-btn loading slot.
295
+ */
296
+ export type BtnLoading = {
297
+ type: 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail' | 'spinner';
298
+ color?: string | undefined;
299
+ size?: string | undefined;
300
+ noLabel?: boolean;
301
+ }
package/src/utils/myth.ts CHANGED
@@ -9,6 +9,7 @@
9
9
  import { ref } from 'vue'
10
10
  import { extend } from 'quasar'
11
11
  import type { BtnLoading, HelpersStubSchema, PropsContext, ThemeBtn, ThemeInput, ThemeRounded, ThemeShadow, ThemeSize } from '../types'
12
+ import type { AxiosInstance } from 'axios'
12
13
 
13
14
  const props = ref<PropsContext>({})
14
15
  const size = ref<ThemeSize>('md')
@@ -21,7 +22,9 @@ const btnLoading = ref<BtnLoading>({
21
22
  })
22
23
  const themeBtn = ref<ThemeBtn>({})
23
24
  const themeInput = ref<ThemeInput>({})
25
+ const baseUrl = ref<string>('')
24
26
  const api = ref<HelpersStubSchema>({} as HelpersStubSchema)
27
+ const mAxios = ref<AxiosInstance>({} as AxiosInstance)
25
28
  export const myth = {
26
29
  /**
27
30
  * Apply Padding on all sides of components.
@@ -88,8 +91,19 @@ export const myth = {
88
91
  * Theme Shadow.
89
92
  */
90
93
  shadow,
94
+ /**
95
+ * Axios instance.
96
+ */
97
+ mAxios,
98
+ /**
99
+ * Api stubs.
100
+ */
91
101
  api,
92
102
  setApi (v: HelpersStubSchema) {
93
103
  api.value = v
94
- }
104
+ },
105
+ /**
106
+ * Base API Url.
107
+ */
108
+ baseUrl
95
109
  }
@@ -34,17 +34,28 @@ import {
34
34
  MInputFieldControl,
35
35
  MInputLabel,
36
36
  MMobile,
37
+ MOptions,
38
+ MOtp,
37
39
  MPassword,
38
40
  MPicker,
39
41
  MRadio,
40
42
  MRow,
41
43
  MSelect,
42
44
  MTime,
45
+ MToggle,
43
46
  MTransition,
44
- MTypingString
47
+ MTypingString,
48
+ MUploader,
49
+ MDialog,
50
+ MModalMenu,
51
+ MTooltip,
52
+ MDatatable,
53
+ MDtAvatar,
54
+ MDtBtn,
55
+ MDtContextmenuItems
45
56
  } from '../components'
46
57
 
47
- import type { InstallOptions } from '../types'
58
+ import { InstallOptions } from '../types/install-options'
48
59
 
49
60
  function install (app: App, options: InstallOptions = {}) {
50
61
  if (options.rounded !== undefined) {
@@ -71,9 +82,15 @@ function install (app: App, options: InstallOptions = {}) {
71
82
  if (options.themeInput !== undefined) {
72
83
  myth.themeInput.value = options.themeInput
73
84
  }
85
+ if (options.baseUrl !== undefined) {
86
+ myth.baseUrl.value = options.baseUrl
87
+ }
74
88
  if (options.api !== undefined) {
75
89
  myth.setApi(options.api)
76
90
  }
91
+ if (options.mAxios !== undefined) {
92
+ myth.mAxios.value = options.mAxios
93
+ }
77
94
 
78
95
  // Form.
79
96
  app.component('MAvatarViewer', MAvatarViewer)
@@ -93,11 +110,15 @@ function install (app: App, options: InstallOptions = {}) {
93
110
  app.component('MInputFieldControl', MInputFieldControl)
94
111
  app.component('MInputLabel', MInputLabel)
95
112
  app.component('MMobile', MMobile)
113
+ app.component('MOptions', MOptions)
114
+ app.component('MOtp', MOtp)
96
115
  app.component('MPassword', MPassword)
97
116
  app.component('MPicker', MPicker)
98
117
  app.component('MRadio', MRadio)
99
118
  app.component('MSelect', MSelect)
100
119
  app.component('MTime', MTime)
120
+ app.component('MToggle', MToggle)
121
+ app.component('MUploader', MUploader)
101
122
 
102
123
  // Grid.
103
124
  app.component('MBlock', MBlock)
@@ -114,6 +135,17 @@ function install (app: App, options: InstallOptions = {}) {
114
135
  app.component('MTransition', MTransition)
115
136
  app.component('MFadeTransition', MFadeTransition)
116
137
  app.component('MFadeXTransition', MFadeXTransition)
138
+
139
+ // Modals.
140
+ app.component('MDialog', MDialog)
141
+ app.component('MModalMenu', MModalMenu)
142
+ app.component('MTooltip', MTooltip)
143
+
144
+ // Datatable
145
+ app.component('MDatatable', MDatatable)
146
+ app.component('MDtAvatar', MDtAvatar)
147
+ app.component('MDtBtn', MDtBtn)
148
+ app.component('MDtContextmenuItems', MDtContextmenuItems)
117
149
  }
118
150
 
119
151
  export {
package/src/types/dt.d.ts DELETED
@@ -1,144 +0,0 @@
1
- import type { QTableProps } from 'quasar'
2
- import type { GenericFormValues, MDatatableProps, MDtBtnProps } from './components'
3
- import type { MaybeRef, Ref, UnwrapRef } from 'vue'
4
- import type { AxiosResponse } from 'axios'
5
-
6
- type Generic = Record<any, any>;
7
-
8
- export type MDtItem<T extends object = Record<keyof T, any>> = T & {
9
- id: string | number;
10
- [K: keyof T]: any;
11
- }
12
- export type MDtItemIndex = number;
13
- export type MDtExportOptions = 'pdf' | 'excel';
14
-
15
- type MDDIP<T extends Generic = Generic | any> = Partial<MDtItem> & Record<string, any> | T;
16
- export type MDatatableDialogsOptions<T extends MDDIP = MDDIP> = {
17
- filter: Ref<boolean>;
18
- show: Ref<boolean>;
19
- form: Ref<boolean>;
20
- isUpdate: Ref<boolean>;
21
- item: T | MaybeRef<MDDIP<T>> | UnwrapRef<MDDIP<T>> | Record<string, any> | undefined;
22
- index: Ref<MDtItemIndex | undefined>;
23
- errors: Record<string | number | symbol, string[]> | any;
24
- }
25
-
26
- type E = MDatatableDialogsOptions['item'];
27
- export type GenericMDtBtn<T extends E = E> = Record<string, any> & {
28
- name: string;
29
- label?: string;
30
- contextLabel?: string | null;
31
- tooltip?: string;
32
- click?: (item: UnwrapRef<T> | Ref<T> | T, index: UnwrapRef<MDatatableDialogsOptions['index']>) => void;
33
- multiClick?: (items: T[]) => void;
34
- showIf?: boolean | ((item: UnwrapRef<MDatatableDialogsOptions['item']>, index: UnwrapRef<MDatatableDialogsOptions['index']>) => boolean);
35
- order?: number;
36
- attr?: Partial<MDtBtnProps> & Partial<{ icon?: string; textColor?: string; color?: string; }>;
37
- }
38
-
39
- export interface ApiServiceParams {
40
- filter?: Record<string, any>;
41
- search?: string | null;
42
- searchColumns?: string[] | string;
43
- // headers: string[];
44
- headerItems?: any[] | string[] | string;
45
- ids?: number[];
46
- indexType: 'index' | 'pdf' | 'excel';
47
- // For Datatable, index,export-pdf|excel,update,create,show,delete
48
- fdt: 'i' | 'e' | 'u' | 'c' | 's' | 'd';
49
- requestWith?: string;
50
- itemsPerPage: number;
51
- page: number;
52
- sortBy?: string;
53
- sortDesc?: number;
54
- toUrl?: MDtExportOptions | boolean;
55
-
56
- [key: string]: any;
57
- }
58
-
59
- export type MDtServiceNameCallbackProp = (() => Record<string, (() => Promise<AxiosResponse>)>)
60
- export type MDtServiceNameStringProp = string
61
- export type MDtRequestParamsCallbackProp = (params: ApiServiceParams) => Partial<GenericFormValues>
62
- export type MDtRequestParamsObjectProp = Partial<GenericFormValues>
63
-
64
- export type ParseHeaderOptions = {
65
- controlKey?: 'control' | string
66
- controlStyle?: 'max-width: 150px' | string
67
- align?: 'left' | 'right' | 'center' | undefined
68
- sortable?: boolean | undefined;
69
- classes?: string | (() => string),
70
- noSort?: string[]
71
- }
72
-
73
- // export interface ParsedHeader {
74
- // /**
75
- // * Unique id, identifies column, (used by pagination.sortBy, 'body-cell-[name]' slot, ...)
76
- // */
77
- // name: string;
78
- // /**
79
- // * Label for header
80
- // */
81
- // label: string;
82
- // /**
83
- // * Row Object property to determine value for this column or function which maps to the required property
84
- // * @param row The current row being processed
85
- // * @returns Value for this column
86
- // */
87
- // field: string | ((row: any) => any);
88
- // /**
89
- // * If we use visible-columns, this col will always be visible
90
- // */
91
- // required?: boolean;
92
- // /**
93
- // * Horizontal alignment of cells in this column
94
- // * Default value: right
95
- // */
96
- // align?: 'left' | 'right' | 'center';
97
- // /**
98
- // * Tell QTable you want this column sortable
99
- // */
100
- // sortable?: boolean;
101
- // /**
102
- // * Compare function if you have some custom data or want a specific way to compare two rows
103
- // * @param a Value of the first comparison term
104
- // * @param b Value of the second comparison term
105
- // * @param rowA Full Row object in which is contained the first term
106
- // * @param rowB Full Row object in which is contained the second term
107
- // * @returns Comparison result of term 'a' with term 'b'. Less than 0 when 'a' should come first; greater than 0 if 'b' should come first; equal to 0 if their position must not be changed with respect to each other
108
- // */
109
- // sort?: (a: any, b: any, rowA: any, rowB: any) => number;
110
- // /**
111
- // * Set column sort order: 'ad' (ascending-descending) or 'da' (descending-ascending); Overrides the 'column-sort-order' prop
112
- // * Default value: ad
113
- // */
114
- // sortOrder?: 'ad' | 'da';
115
- // /**
116
- // * Function you can apply to format your data
117
- // * @param val Value of the cell
118
- // * @param row Full Row object in which the cell is contained
119
- // * @returns The resulting formatted value
120
- // */
121
- // format?: (val: any, row: any) => any;
122
- // /**
123
- // * Style to apply on normal cells of the column
124
- // * @param row The current row being processed
125
- // */
126
- // style?: string | ((row: any) => string);
127
- // /**
128
- // * Classes to add on normal cells of the column
129
- // * @param row The current row being processed
130
- // */
131
- // classes?: string | ((row: any) => string);
132
- // /**
133
- // * Style to apply on header cells of the column
134
- // */
135
- // headerStyle?: string;
136
- // /**
137
- // * Classes to add on header cells of the column
138
- // */
139
- // headerClasses?: string;
140
- // }
141
-
142
- export type MDtColumn = QTableProps['columns'][number]
143
-
144
- export type MDtHeadersParameter = MDtColumn[] | (keyof MDatatableProps['defaultItem'])[]