@mythpe/quasar-ui-qui 0.0.23-dev → 0.0.24-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 (56) hide show
  1. package/index.d.ts +4 -0
  2. package/package.json +8 -5
  3. package/src/components/form/MAvatarViewer.vue +324 -0
  4. package/src/components/form/MBtn.vue +258 -91
  5. package/src/components/form/MCheckbox.vue +123 -0
  6. package/src/components/form/MColor.vue +122 -0
  7. package/src/components/form/MDate.vue +47 -0
  8. package/src/components/form/MEditor.vue +285 -0
  9. package/src/components/form/MEmail.vue +40 -0
  10. package/src/components/form/MField.vue +142 -0
  11. package/src/components/form/MFile.vue +209 -0
  12. package/src/components/form/MForm.vue +83 -0
  13. package/src/components/form/MHidden.vue +83 -0
  14. package/src/components/form/MHiddenInput.vue +55 -0
  15. package/src/components/form/MInput.vue +62 -65
  16. package/src/components/form/MInputFieldControl.vue +4 -1
  17. package/src/components/form/MInputLabel.vue +6 -2
  18. package/src/components/form/MMobile.vue +37 -0
  19. package/src/components/form/MPicker.vue +310 -0
  20. package/src/components/form/MRadio.vue +175 -0
  21. package/src/components/form/MSelect.vue +343 -0
  22. package/src/components/form/MTime.vue +45 -0
  23. package/src/components/form/index.ts +38 -1
  24. package/src/components/grid/MBlock.vue +31 -17
  25. package/src/components/grid/MCol.vue +2 -14
  26. package/src/components/grid/MContainer.vue +21 -12
  27. package/src/components/grid/MHelpRow.vue +4 -9
  28. package/src/components/grid/MRow.vue +22 -9
  29. package/src/components/index.ts +1 -0
  30. package/src/components/transition/MFadeTransition.vue +27 -0
  31. package/src/components/transition/MFadeXTransition.vue +26 -0
  32. package/src/components/transition/MTransition.vue +41 -0
  33. package/src/components/transition/index.ts +13 -0
  34. package/src/components/typography/index.ts +1 -0
  35. package/src/composable/index.ts +3 -1
  36. package/src/composable/{useHelpersMyth.ts → useBindInput.ts} +92 -62
  37. package/src/composable/useError.ts +11 -0
  38. package/src/composable/useMyth.ts +280 -3
  39. package/src/composable/useValue.ts +12 -0
  40. package/src/index.sass +7 -33
  41. package/src/style/m-container.sass +13 -0
  42. package/src/style/main.sass +42 -0
  43. package/src/types/api-helpers.d.ts +120 -0
  44. package/src/types/components.d.ts +550 -52
  45. package/src/types/dt.d.ts +142 -0
  46. package/src/types/index.d.ts +128 -47
  47. package/src/types/lodash.d.ts +26 -0
  48. package/src/types/quasar-helpers.d.ts +7 -0
  49. package/src/types/theme.d.ts +12 -0
  50. package/src/utils/Helpers.ts +321 -0
  51. package/src/utils/Str.ts +210 -0
  52. package/src/utils/index.ts +2 -0
  53. package/src/utils/myth.ts +75 -22
  54. package/src/utils/vee-rules.ts +2 -1
  55. package/src/utils/vue-plugin.ts +80 -3
  56. package/tsconfig.json +8 -11
@@ -0,0 +1,142 @@
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
+ type Generic = Record<any, any>;
6
+
7
+ export type MDtItem<T extends object = Record<keyof T, any>> = T & {
8
+ id: string | number;
9
+ [K: keyof T]: any;
10
+ }
11
+ export type MDtItemIndex = number;
12
+ export type MDtExportOptions = 'pdf' | 'excel';
13
+
14
+ type MDDIP<T extends Generic = Generic | any> = Partial<MDtItem> & Record<string, any> | T;
15
+ export type MDatatableDialogsOptions<T extends MDDIP = MDDIP> = {
16
+ filter: Ref<boolean>;
17
+ show: Ref<boolean>;
18
+ form: Ref<boolean>;
19
+ isUpdate: Ref<boolean>;
20
+ item: T | MaybeRef<MDDIP<T>> | UnwrapRef<MDDIP<T>> | Record<string, any> | undefined;
21
+ index: Ref<MDtItemIndex | undefined>;
22
+ errors: Record<string | number | symbol, string[]> | any;
23
+ }
24
+
25
+ type E = MDatatableDialogsOptions['item'];
26
+ export type GenericMDtBtn<T extends E = E> = Record<string, any> & {
27
+ name: string;
28
+ label?: string;
29
+ contextLabel?: string | null;
30
+ tooltip?: string;
31
+ click?: (item: UnwrapRef<T> | Ref<T> | T, index: UnwrapRef<MDatatableDialogsOptions['index']>) => void;
32
+ multiClick?: (items: T[]) => void;
33
+ showIf?: boolean | ((item: UnwrapRef<MDatatableDialogsOptions['item']>, index: UnwrapRef<MDatatableDialogsOptions['index']>) => boolean);
34
+ order?: number;
35
+ attr?: Partial<MDtBtnProps> & Partial<{ icon?: string; textColor?: string; color?: string; }>;
36
+ }
37
+
38
+ export interface ApiServiceParams {
39
+ filter?: Record<string, any>;
40
+ search?: string | null;
41
+ searchColumns?: string[] | string;
42
+ // headers: string[];
43
+ headerItems?: any[] | string[] | string;
44
+ ids?: number[];
45
+ indexType: 'index' | 'pdf' | 'excel';
46
+ // For Datatable, index,export-pdf|excel,update,create,show,delete
47
+ fdt: 'i' | 'e' | 'u' | 'c' | 's' | 'd';
48
+ requestWith?: string;
49
+ itemsPerPage: number;
50
+ page: number;
51
+ sortBy?: string;
52
+ sortDesc?: number;
53
+ toUrl?: MDtExportOptions | boolean;
54
+
55
+ [key: string]: any;
56
+ }
57
+ export type MDtServiceNameCallbackProp = (() => Record<string, (() => Promise<AxiosResponse>)>)
58
+ export type MDtServiceNameStringProp = string
59
+ export type MDtRequestParamsCallbackProp = (params: ApiServiceParams) => Partial<GenericFormValues>
60
+ export type MDtRequestParamsObjectProp = Partial<GenericFormValues>
61
+
62
+ export type ParseHeaderOptions = {
63
+ controlKey?: 'control' | string
64
+ controlStyle?: 'max-width: 150px' | string
65
+ align?: 'left' | 'right' | 'center' | undefined
66
+ sortable?: boolean | undefined;
67
+ classes?: string | (() => string),
68
+ noSort?: string[]
69
+ }
70
+
71
+ // export interface ParsedHeader {
72
+ // /**
73
+ // * Unique id, identifies column, (used by pagination.sortBy, 'body-cell-[name]' slot, ...)
74
+ // */
75
+ // name: string;
76
+ // /**
77
+ // * Label for header
78
+ // */
79
+ // label: string;
80
+ // /**
81
+ // * Row Object property to determine value for this column or function which maps to the required property
82
+ // * @param row The current row being processed
83
+ // * @returns Value for this column
84
+ // */
85
+ // field: string | ((row: any) => any);
86
+ // /**
87
+ // * If we use visible-columns, this col will always be visible
88
+ // */
89
+ // required?: boolean;
90
+ // /**
91
+ // * Horizontal alignment of cells in this column
92
+ // * Default value: right
93
+ // */
94
+ // align?: 'left' | 'right' | 'center';
95
+ // /**
96
+ // * Tell QTable you want this column sortable
97
+ // */
98
+ // sortable?: boolean;
99
+ // /**
100
+ // * Compare function if you have some custom data or want a specific way to compare two rows
101
+ // * @param a Value of the first comparison term
102
+ // * @param b Value of the second comparison term
103
+ // * @param rowA Full Row object in which is contained the first term
104
+ // * @param rowB Full Row object in which is contained the second term
105
+ // * @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
106
+ // */
107
+ // sort?: (a: any, b: any, rowA: any, rowB: any) => number;
108
+ // /**
109
+ // * Set column sort order: 'ad' (ascending-descending) or 'da' (descending-ascending); Overrides the 'column-sort-order' prop
110
+ // * Default value: ad
111
+ // */
112
+ // sortOrder?: 'ad' | 'da';
113
+ // /**
114
+ // * Function you can apply to format your data
115
+ // * @param val Value of the cell
116
+ // * @param row Full Row object in which the cell is contained
117
+ // * @returns The resulting formatted value
118
+ // */
119
+ // format?: (val: any, row: any) => any;
120
+ // /**
121
+ // * Style to apply on normal cells of the column
122
+ // * @param row The current row being processed
123
+ // */
124
+ // style?: string | ((row: any) => string);
125
+ // /**
126
+ // * Classes to add on normal cells of the column
127
+ // * @param row The current row being processed
128
+ // */
129
+ // classes?: string | ((row: any) => string);
130
+ // /**
131
+ // * Style to apply on header cells of the column
132
+ // */
133
+ // headerStyle?: string;
134
+ // /**
135
+ // * Classes to add on header cells of the column
136
+ // */
137
+ // headerClasses?: string;
138
+ // }
139
+
140
+ export type MDtColumn = QTableProps['columns'][number]
141
+
142
+ export type MDtHeadersParameter = MDtColumn[] | (keyof MDatatableProps['defaultItem'])[]
@@ -6,68 +6,149 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import type { QBtnProps, QFieldProps } from 'quasar'
10
- import type { Ref } from 'vue'
11
- import type { MBlockProps, MInputProps, StyleSize } from './components'
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
+ import { myth } from '../utils'
31
+ import { ThemeBtn, ThemeFluid, ThemeInput, ThemeRounded, ThemeShadow, ThemeSize } from './theme'
12
32
 
13
- export interface UiOptionsContext {
14
- /**
15
- * Rules keys that can be added to Input Rules as Vue Attr
16
- */
17
- inputRules?: string[];
18
- /**
19
- * Style of the components.
20
- */
21
- style?: {
22
- /**
23
- * Apply Padding on all sides of components.
24
- */
25
- gutters?: StyleSize | undefined;
26
- /**
27
- * Apply Fluid on all sides of containers.
28
- */
29
- fluid?: boolean | undefined;
30
- /**
31
- * Apply style of all inputs.
32
- */
33
- // inputs?: {
34
- // dense?: boolean;
35
- // rounded?: boolean;
36
- // outlined?: boolean;
37
- // standout?: boolean;
38
- // }
39
- };
40
- /**
41
- * MBtn component.
42
- */
43
- btn?: {
44
- props?: Partial<QBtnProps>;
45
- loading?: {
46
- type: 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail';
47
- color?: string | undefined;
48
- size?: string | undefined;
49
- label?: boolean | undefined;
50
- }
51
- };
33
+ /**
34
+ * Default loading q-btn loading slot.
35
+ */
36
+ export type BtnLoading = {
37
+ type: 'audio' | 'ball' | 'bars' | 'box' | 'clock' | 'comment' | 'cube' | 'dots' | 'facebook' | 'gears' | 'grid' | 'hearts' | 'hourglass' | 'infinity' | 'ios' | 'orbit' | 'oval' | 'pie' | 'puff' | 'radio' | 'rings' | 'tail' | 'spinner';
38
+ color?: string | undefined;
39
+ size?: string | undefined;
40
+ noLabel?: boolean;
41
+ }
42
+
43
+ export interface PropsContext {
44
+ // Grid.
52
45
  /**
53
46
  * MBlock component.
54
47
  */
55
48
  block?: Partial<MBlockProps>;
49
+ /**
50
+ * MCol component.
51
+ */
52
+ col?: Partial<MColProps>;
53
+ /**
54
+ * MColumn component.
55
+ */
56
+ column?: Partial<MColumnProps>;
57
+ /**
58
+ * MContainer component.
59
+ */
60
+ container?: Partial<MContainerProps>;
61
+ /**
62
+ * MHelpRow component.
63
+ */
64
+ helpRow?: Partial<MHelpRowProps>;
65
+ /**
66
+ * MRow component.
67
+ */
68
+ row?: Partial<MRowProps>;
69
+ /**
70
+ * MTypingString component.
71
+ */
72
+ typingString?: Partial<MTypingStringProps>;
73
+ /**
74
+ * MAvatarViewer component.
75
+ */
76
+ avatarViewer?: Partial<MAvatarViewerProps>;
77
+ /**
78
+ * MBtn component.
79
+ */
80
+ btn?: Partial<MBtnProps>;
56
81
  /**
57
82
  * MInput component.
58
83
  */
59
84
  input?: Partial<MInputProps>;
85
+ /**
86
+ * MFile component.
87
+ */
88
+ file?: Partial<MFileProps>;
89
+ /**
90
+ * MMobile component.
91
+ */
92
+ mobile?: Partial<MInputProps>;
60
93
  /**
61
94
  * MInput view mode props.
62
95
  */
63
96
  field?: Partial<QFieldProps>;
97
+ /**
98
+ * MCheckbox component.
99
+ */
100
+ checkbox?: Partial<MCheckboxProps>;
101
+ /**
102
+ * MRadio component.
103
+ */
104
+ radio?: Partial<MRadioProps>;
105
+ /**
106
+ * MSelect component.
107
+ */
108
+ select?: Partial<MSelectProps>;
109
+ /**
110
+ * MPicker component.
111
+ */
112
+ picker?: Partial<MPickerProps>;
113
+ /**
114
+ * q-btn component props.
115
+ */
116
+ pickerBtn?: Partial<QBtnProps>;
117
+ /**
118
+ * MDate component.
119
+ */
120
+ date?: Partial<MDateProps>;
121
+ /**
122
+ * MEditor component.
123
+ */
124
+ editor?: Partial<MEditorProps>;
125
+ /**
126
+ * MTime component.
127
+ */
128
+ time?: Partial<MTimeProps>;
129
+ /**
130
+ * Notify Props.
131
+ */
132
+ notify?: Partial<QNotifyCreateOptions>;
64
133
  }
65
134
 
66
- export interface MythContext {
67
- options: Ref<UiOptionsContext>;
68
- setOptions: (values: Partial<UiOptionsContext>) => void;
69
- withOptions: (values: Partial<UiOptionsContext>) => void;
70
- withBtnOptions: (values: Partial<QBtnProps>) => void;
135
+ export interface InstallOptions {
136
+ size?: ThemeSize;
137
+ rounded?: ThemeRounded;
138
+ shadow?: ThemeShadow;
139
+ fluid?: ThemeFluid;
140
+ rules?: string[];
141
+ btnLoading?: BtnLoading;
142
+ props?: PropsContext;
143
+ themeInput?: ThemeInput;
144
+ themeBtn?: ThemeBtn;
71
145
  }
72
146
 
147
+ export type MythContext = typeof myth;
148
+
149
+ export * from './api-helpers'
73
150
  export * from './components'
151
+ export * from './dt'
152
+ export * from './lodash'
153
+ export * from './quasar-helpers'
154
+ export * from './theme'
@@ -0,0 +1,26 @@
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
+ /* eslint-disable */
9
+
10
+ declare module 'lodash' {
11
+ interface LoDashStatic {
12
+ /**
13
+ * Converts string to pascal case.
14
+ *
15
+ * @param string The string to convert.
16
+ * @return Returns the pascal cased string.
17
+ */
18
+ pascalCase (string?: string): string;
19
+
20
+ pluralize (string?: string): string;
21
+
22
+ singularize (string?: string): string;
23
+ }
24
+ }
25
+
26
+ export {}
@@ -0,0 +1,7 @@
1
+ import type { DialogChainObject, QNotifyCreateOptions, QNotifyUpdateOptions } from 'quasar'
2
+
3
+ export type Vue3MAlertMessageOptions = QNotifyCreateOptions | string;
4
+
5
+ export type Vue3MAlertMessage = (props?: QNotifyUpdateOptions) => void;
6
+
7
+ export type Vue3MConfirmMessage = DialogChainObject
@@ -0,0 +1,12 @@
1
+ import type { QBtnProps, QInputProps } from 'quasar'
2
+
3
+ export type ThemeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none' | string;
4
+ export type ThemeShadow = string | number | 'transition' | 'none';
5
+ export type ThemeRounded = boolean;
6
+ export type ThemeFluid = boolean;
7
+ export type ThemeInput =
8
+ Partial<Pick<QInputProps, 'standout' | 'dense' | 'filled' | 'outlined' | 'rounded' | 'borderless' | 'counter' | 'noErrorIcon' | 'hideBottomSpace' | 'bottomSlots' | 'clearIcon' | 'itemAligned' | 'square' | 'stackLabel'>>
9
+ & {
10
+ topLabel?: boolean;
11
+ }
12
+ export type ThemeBtn = Partial<Pick<QBtnProps, 'flat' | 'outline' | 'push' | 'unelevated' | 'noCaps' | 'rounded' | 'glossy' | 'square' | 'padding' | 'ripple' | 'dense'>>