@mythpe/quasar-ui-qui 0.0.24 → 0.0.25-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.
- package/index.d.ts +17 -0
- package/package.json +14 -8
- package/src/boot/register.ts +14 -0
- package/src/components/form/MAvatarViewer.vue +324 -0
- package/src/components/form/MBtn.vue +271 -93
- package/src/components/form/MCheckbox.vue +126 -0
- package/src/components/form/MColor.vue +122 -0
- package/src/components/form/MDate.vue +47 -0
- package/src/components/form/MEditor.vue +285 -0
- package/src/components/form/MEmail.vue +40 -0
- package/src/components/form/MField.vue +145 -0
- package/src/components/form/MFile.vue +212 -0
- package/src/components/form/MForm.vue +86 -0
- package/src/components/form/MHidden.vue +86 -0
- package/src/components/form/MHiddenInput.vue +55 -0
- package/src/components/form/MInput.vue +178 -0
- package/src/components/form/MInputFieldControl.vue +27 -0
- package/src/components/form/MInputLabel.vue +35 -0
- package/src/components/form/MMobile.vue +40 -0
- package/src/components/form/MPicker.vue +313 -0
- package/src/components/form/MRadio.vue +178 -0
- package/src/components/form/MSelect.vue +349 -0
- package/src/components/form/MTime.vue +45 -0
- package/src/components/form/index.ts +51 -0
- package/src/components/grid/MBlock.vue +40 -18
- package/src/components/grid/MCol.vue +11 -15
- package/src/components/grid/MColumn.vue +8 -0
- package/src/components/grid/MContainer.vue +22 -13
- package/src/components/grid/MHelpRow.vue +9 -12
- package/src/components/grid/MRow.vue +31 -10
- package/src/components/grid/index.ts +16 -0
- package/src/components/index.ts +12 -0
- package/src/components/transition/MFadeTransition.vue +27 -0
- package/src/components/transition/MFadeXTransition.vue +26 -0
- package/src/components/transition/MTransition.vue +41 -0
- package/src/components/transition/index.ts +13 -0
- package/src/components/typography/MTypingString.vue +8 -0
- package/src/components/typography/index.ts +11 -0
- package/src/composable/index.ts +12 -0
- package/src/composable/useBindInput.ts +209 -0
- package/src/composable/useError.ts +11 -0
- package/src/composable/useMyth.ts +294 -0
- package/src/composable/useValue.ts +12 -0
- package/src/index.common.js +19 -1
- package/src/index.esm.js +18 -3
- package/src/index.js +19 -0
- package/src/index.sass +8 -26
- package/src/index.ts +18 -4
- package/src/index.umd.js +17 -2
- package/src/style/m-container.sass +13 -0
- package/src/style/main.sass +42 -0
- package/src/types/api-helpers.d.ts +120 -0
- package/src/types/components.d.ts +688 -28
- package/src/types/dt.d.ts +144 -0
- package/src/types/index.d.ts +153 -1
- package/src/types/lodash.d.ts +26 -0
- package/src/types/quasar-helpers.d.ts +7 -0
- package/src/types/theme.d.ts +12 -0
- package/src/utils/Helpers.ts +314 -0
- package/src/utils/Str.ts +211 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/myth.ts +90 -0
- package/src/utils/vee-rules.ts +32 -0
- package/src/utils/vue-plugin.ts +122 -0
- package/tsconfig.json +9 -13
- package/src/myth.ts +0 -30
- package/src/types/myth.ts +0 -42
- package/src/vue-plugin.ts +0 -41
- package/types.d.ts +0 -1
|
@@ -0,0 +1,294 @@
|
|
|
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 lodash from 'lodash'
|
|
10
|
+
import { useI18n } from 'vue-i18n'
|
|
11
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
|
12
|
+
import { copyToClipboard, Dialog, extend, QDialogOptions, QNotifyCreateOptions, useQuasar } from 'quasar'
|
|
13
|
+
import { Helpers, myth, Str } from '../utils'
|
|
14
|
+
import type { MDtColumn, MDtHeadersParameter, ParseHeaderOptions, Vue3MAlertMessage, Vue3MAlertMessageOptions, Vue3MConfirmMessage } from '../types'
|
|
15
|
+
|
|
16
|
+
export const useMyth = () => {
|
|
17
|
+
const { t, te } = useI18n({ useScope: 'global' })
|
|
18
|
+
const { props: pluginOptions } = myth
|
|
19
|
+
const q = useQuasar()
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
const __ = (key: any, ...rest: unknown[]) => !key ? '' : te(`attributes.${key}`) ? t(`attributes.${key}`, ...rest) : te(key) ? t(key, ...rest) : key
|
|
23
|
+
|
|
24
|
+
function quasarNotifyOptions (opts: QNotifyCreateOptions | string): QNotifyCreateOptions {
|
|
25
|
+
return {
|
|
26
|
+
badgeColor: 'primary',
|
|
27
|
+
progress: !0,
|
|
28
|
+
...pluginOptions.value.notify as any,
|
|
29
|
+
message: typeof opts === 'string' ? opts : opts.message,
|
|
30
|
+
...(typeof opts !== 'string' ? opts : {})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function alertMessage (opts: Vue3MAlertMessageOptions): Vue3MAlertMessage {
|
|
35
|
+
return q.notify(helpers.quasarNotifyOptions(opts))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const helpers = {
|
|
39
|
+
getPageTitle (route: RouteLocationNormalizedLoaded, number?: number | string): string {
|
|
40
|
+
number = number || 2
|
|
41
|
+
number = parseInt(number.toString())
|
|
42
|
+
const defaultValue = ''
|
|
43
|
+
// Not is route
|
|
44
|
+
// No page title
|
|
45
|
+
if (!route) {
|
|
46
|
+
return defaultValue
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const routePath = route?.path?.toString() || null
|
|
50
|
+
const routeName = route?.name?.toString() || null
|
|
51
|
+
|
|
52
|
+
// Not is route
|
|
53
|
+
// No page title
|
|
54
|
+
if (!routePath || !routeName) {
|
|
55
|
+
return defaultValue
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let lastRouteName = routeName.split('.').pop() || ''
|
|
59
|
+
if (lastRouteName === 'index') {
|
|
60
|
+
const s = routeName.split('.')
|
|
61
|
+
lastRouteName = s[s.length - 2] ?? lastRouteName
|
|
62
|
+
}
|
|
63
|
+
const pluralize = Str.pascalCase(lodash.pluralize(lastRouteName))
|
|
64
|
+
const singular = Str.pascalCase(lodash.singularize(lastRouteName))
|
|
65
|
+
const keys = lodash.filter(lodash.uniq([
|
|
66
|
+
`${lastRouteName}Page.title`,
|
|
67
|
+
`${lodash.camelCase(lastRouteName)}Page.title`,
|
|
68
|
+
`choice.${pluralize}`,
|
|
69
|
+
`choice.${singular}`,
|
|
70
|
+
`replace.${lastRouteName}_details`,
|
|
71
|
+
`replace.${lastRouteName}`,
|
|
72
|
+
pluralize,
|
|
73
|
+
lodash.snakeCase(pluralize),
|
|
74
|
+
singular,
|
|
75
|
+
lodash.snakeCase(singular)
|
|
76
|
+
]))
|
|
77
|
+
|
|
78
|
+
let str: string | null = null
|
|
79
|
+
let k: string | any
|
|
80
|
+
|
|
81
|
+
if (te((k = `routes.${routeName}`)) && lodash.isString((str = t(k)))) {
|
|
82
|
+
return str
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (te((k = `routes.${routePath}`)) && lodash.isString((str = t(k)))) {
|
|
86
|
+
return str
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
for (const f in keys) {
|
|
90
|
+
if (!(k = keys[f])) {
|
|
91
|
+
continue
|
|
92
|
+
}
|
|
93
|
+
if (te && te(k) && lodash.isString(t(k))) {
|
|
94
|
+
if (lodash.startsWith(k, 'choice.')) {
|
|
95
|
+
const s = k.split('.')
|
|
96
|
+
const n = routeName.split('.')
|
|
97
|
+
if (s.length === 2 && n.length > 1) {
|
|
98
|
+
const model = n[n.length - 2]
|
|
99
|
+
const pluralizeModel = lodash.pluralize(lodash.pascalCase(model))
|
|
100
|
+
const _modelChoiceKey = `choice.${pluralizeModel}`
|
|
101
|
+
if (te(_modelChoiceKey)) {
|
|
102
|
+
const l = t(_modelChoiceKey, number as any)
|
|
103
|
+
const rep = lodash.singularize(n[n.length - 1]).toLocaleLowerCase()
|
|
104
|
+
const e = `replace.${rep}`
|
|
105
|
+
str = te(e) ? t(e, { name: l }) : null
|
|
106
|
+
} else {
|
|
107
|
+
const pop: string = k.split('.').pop() || ''
|
|
108
|
+
str = te(k) ? t(k, number as any, { [pop]: number }) : null
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
const pop: string = k.split('.').pop() || ''
|
|
112
|
+
str = te(k) ? t(k, number as any, { [pop]: number }) : null
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const parents: string[] = routeName.split('.')
|
|
116
|
+
if (parents.length > 1) {
|
|
117
|
+
const e = `choice.${Str.pascalCase(lodash.pluralize(parents[parents.length - 2]))}`
|
|
118
|
+
str = te(e) ? t(k, { name: t(e, '1') }) : null
|
|
119
|
+
} else {
|
|
120
|
+
str = te(k) ? t(k, { name: '' }) : null
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return str || defaultValue
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return defaultValue
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Custom transformer
|
|
130
|
+
* @param headers
|
|
131
|
+
* @param options
|
|
132
|
+
*/
|
|
133
|
+
parseHeaders (headers: MDtHeadersParameter, options: ParseHeaderOptions = {}): MDtColumn[] {
|
|
134
|
+
const defaultOptions: Partial<ParseHeaderOptions> = {
|
|
135
|
+
controlKey: 'control',
|
|
136
|
+
// controlStyle: 'max-width: 150px',
|
|
137
|
+
align: 'center'
|
|
138
|
+
// sortable: !0
|
|
139
|
+
}
|
|
140
|
+
const opts = extend<ParseHeaderOptions>(!0, defaultOptions, options)
|
|
141
|
+
let control: string | undefined = defaultOptions.controlKey
|
|
142
|
+
let controlStyle: string | undefined = defaultOptions.controlStyle
|
|
143
|
+
if (opts.controlKey) {
|
|
144
|
+
control = opts.controlKey
|
|
145
|
+
delete opts.controlKey
|
|
146
|
+
}
|
|
147
|
+
if (opts.controlStyle) {
|
|
148
|
+
controlStyle = opts.controlStyle
|
|
149
|
+
delete opts.controlStyle
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const result: MDtColumn[] = []
|
|
153
|
+
|
|
154
|
+
headers.forEach((elm: string | MDtColumn | undefined) => {
|
|
155
|
+
if (typeof elm !== 'string' && !elm?.name) return elm
|
|
156
|
+
// Todo: will do this
|
|
157
|
+
let item: MDtColumn = typeof elm === 'string' ? {
|
|
158
|
+
name: elm as string,
|
|
159
|
+
label: elm as string,
|
|
160
|
+
field: elm as string
|
|
161
|
+
} : { ...elm }
|
|
162
|
+
item.name = item.name ?? ''
|
|
163
|
+
item.label = (item.label === undefined || item.label === null) ? item.name : item.label
|
|
164
|
+
item.field = (item.field === undefined || item.field === null) ? item.name : item.field
|
|
165
|
+
item = {
|
|
166
|
+
...item,
|
|
167
|
+
name: Str.strBefore(Str.strBefore(item.name), 'ToString'),
|
|
168
|
+
label: (item.label !== undefined && item.label !== null) ? Str.strBefore(Str.strBefore(item.label), 'ToString') : item.label
|
|
169
|
+
}
|
|
170
|
+
const name = item.name
|
|
171
|
+
let k
|
|
172
|
+
if (te) {
|
|
173
|
+
if (te((k = `attributes.${item.label}`))) {
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
item.label = t(k)
|
|
177
|
+
} else if (te((k = `attributes.${lodash.snakeCase(item.label)}`))) {
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
179
|
+
// @ts-ignore
|
|
180
|
+
item.label = t(k)
|
|
181
|
+
} else if (te((k = `attributes.${lodash.camelCase(item.label)}`))) {
|
|
182
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
item.label = t(k)
|
|
185
|
+
} else if (te((k = `attributes.${Str.pascalCase(item.label)}`))) {
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
item.label = t(k)
|
|
189
|
+
} else if (te((k = `choice.${lodash.pluralize(Str.pascalCase(item.label))}`))) {
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
item.label = t(k, 2)
|
|
193
|
+
} else if (te((k = item.label))) {
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
195
|
+
// @ts-ignore
|
|
196
|
+
item.label = t(k)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (name === control) {
|
|
201
|
+
if (controlStyle && !item.style) {
|
|
202
|
+
item.style = controlStyle + (item.style ? ` ${item.style}` : '')
|
|
203
|
+
}
|
|
204
|
+
item.headerClasses = (item.headerClasses ? item.headerClasses : '') + ' m--control-header'
|
|
205
|
+
item.headerClasses = item.headerClasses.trim()
|
|
206
|
+
item.sortable = !1
|
|
207
|
+
if (!item.align) {
|
|
208
|
+
item.align = 'right'
|
|
209
|
+
}
|
|
210
|
+
opts.classes = opts.classes || ''
|
|
211
|
+
if (typeof opts.classes === 'function') {
|
|
212
|
+
opts.classes = opts.classes()
|
|
213
|
+
}
|
|
214
|
+
opts.classes += ' m--control-cell'
|
|
215
|
+
opts.classes = opts.classes.trim()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
item = { ...opts, ...item }
|
|
219
|
+
|
|
220
|
+
if (item.sortable === undefined && (options.noSort ?? []).length > 0 && options.noSort?.includes(item.name)) {
|
|
221
|
+
item.sortable = !1
|
|
222
|
+
} else if (item.sortable === undefined) {
|
|
223
|
+
item.sortable = !0
|
|
224
|
+
}
|
|
225
|
+
result.push(item)
|
|
226
|
+
})
|
|
227
|
+
return lodash.uniqBy(result, (e: MDtColumn) => e.name)
|
|
228
|
+
},
|
|
229
|
+
/**
|
|
230
|
+
* Copy text
|
|
231
|
+
* @param text
|
|
232
|
+
*/
|
|
233
|
+
copyText: async (text: string | any) => copyToClipboard(text),
|
|
234
|
+
quasarNotifyOptions,
|
|
235
|
+
alertMessage,
|
|
236
|
+
alertSuccess (message: string) {
|
|
237
|
+
return alertMessage({ type: 'positive', message })
|
|
238
|
+
},
|
|
239
|
+
alertError (message: string) {
|
|
240
|
+
return alertMessage({ type: 'negative', message })
|
|
241
|
+
},
|
|
242
|
+
confirmMessage (message?: string, title?: string, opts?: QDialogOptions): Vue3MConfirmMessage {
|
|
243
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
244
|
+
// @ts-ignore
|
|
245
|
+
title = title || t('messages.are_you_sure') || ''
|
|
246
|
+
message = message || ''
|
|
247
|
+
opts = opts || {}
|
|
248
|
+
const buttonsProps = {
|
|
249
|
+
...(pluginOptions.value.btn || {})
|
|
250
|
+
// ...(options.value.confirmDialogOptions?.buttons || {})
|
|
251
|
+
}
|
|
252
|
+
// const okProps = options.value.confirmDialogOptions?.okProps || {}
|
|
253
|
+
const okProps: any = {}
|
|
254
|
+
// const cancelProps = options.value.confirmDialogOptions?.cancelProps || {}
|
|
255
|
+
const cancelProps: any = {}
|
|
256
|
+
// const dialogProps = options.value.confirmDialog || {} as any
|
|
257
|
+
const dialogProps: any = {}
|
|
258
|
+
dialogProps.transitionShow = dialogProps.transitionShow || 'jump-down'
|
|
259
|
+
dialogProps.transitionHide = dialogProps.transitionHide || 'jump-up'
|
|
260
|
+
dialogProps.class = ('m--confirm ') + (dialogProps.class || '')
|
|
261
|
+
return Dialog.create({
|
|
262
|
+
title,
|
|
263
|
+
message,
|
|
264
|
+
focus: 'none',
|
|
265
|
+
cancel: {
|
|
266
|
+
color: cancelProps.color || 'positive',
|
|
267
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
268
|
+
// @ts-ignore
|
|
269
|
+
label: t(cancelProps?.label || 'no'),
|
|
270
|
+
...buttonsProps as any,
|
|
271
|
+
flat: !0,
|
|
272
|
+
unelevated: !0,
|
|
273
|
+
...cancelProps as any
|
|
274
|
+
},
|
|
275
|
+
ok: {
|
|
276
|
+
color: okProps.color || 'negative',
|
|
277
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
278
|
+
// @ts-ignore
|
|
279
|
+
label: t(okProps?.label || 'yes'),
|
|
280
|
+
...buttonsProps as any,
|
|
281
|
+
flat: !0,
|
|
282
|
+
unelevated: !0,
|
|
283
|
+
...okProps as any
|
|
284
|
+
},
|
|
285
|
+
persistent: !0,
|
|
286
|
+
...dialogProps as any,
|
|
287
|
+
...opts as any
|
|
288
|
+
})
|
|
289
|
+
},
|
|
290
|
+
...Helpers
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return { __, helpers }
|
|
294
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { computed, MaybeRefOrGetter } from 'vue'
|
|
2
|
+
import { useFieldValue, useSetFieldValue } from 'vee-validate'
|
|
3
|
+
|
|
4
|
+
export const useValue = <T = any> (name: MaybeRefOrGetter<string>) => {
|
|
5
|
+
const [value, setValue] = [useFieldValue<T>(name), useSetFieldValue<T>(name)]
|
|
6
|
+
const field = computed<T>({
|
|
7
|
+
get: () => value.value,
|
|
8
|
+
set: (v: T) => setValue(v)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
return { field, value, setValue }
|
|
12
|
+
}
|
package/src/index.common.js
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
|
-
|
|
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 * as composable from './composable'
|
|
10
|
+
import * as utils from './utils'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
...composable,
|
|
14
|
+
...utils
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export * from './components'
|
|
18
|
+
export * from './composable'
|
|
19
|
+
export * from './utils'
|
package/src/index.esm.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
|
|
9
|
+
import * as composable from './composable'
|
|
10
|
+
import * as utils from './utils'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
...composable,
|
|
14
|
+
...utils
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export * from './components'
|
|
18
|
+
export * from './composable'
|
|
19
|
+
export * from './utils'
|
package/src/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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 * as composable from './composable'
|
|
10
|
+
import * as utils from './utils'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
...composable,
|
|
14
|
+
...utils
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export * from './components'
|
|
18
|
+
export * from './composable'
|
|
19
|
+
export * from './utils'
|
package/src/index.sass
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.flex-break
|
|
7
|
-
flex: 1 0 100% !important
|
|
8
|
-
|
|
9
|
-
.row
|
|
10
|
-
.flex-break
|
|
11
|
-
height: 0 !important
|
|
12
|
-
|
|
13
|
-
.column
|
|
14
|
-
.flex-break
|
|
15
|
-
width: 0 !important
|
|
1
|
+
// MyTh Ahmed Faiz Copyright © 2016-2024 All rights reserved.
|
|
2
|
+
// Email: mythpe@gmail.com
|
|
3
|
+
// Mobile: +966590470092
|
|
4
|
+
// Website: https://www.4myth.com
|
|
5
|
+
// Github: https://github.com/mythpe
|
|
16
6
|
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
&__fluid
|
|
22
|
-
max-width: $m--container-fluid-width
|
|
23
|
-
margin-left: auto
|
|
24
|
-
margin-right: auto
|
|
25
|
-
|
|
26
|
-
.m--row + .m--row
|
|
27
|
-
margin-top: $m--row-margin-top
|
|
7
|
+
@import 'quasar/src/css/variables.sass'
|
|
8
|
+
@import './style/main.sass'
|
|
9
|
+
@import './style/m-container'
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
*/
|
|
3
8
|
|
|
4
|
-
import * as
|
|
5
|
-
|
|
9
|
+
import * as composable from './composable'
|
|
10
|
+
import * as utils from './utils'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
...composable,
|
|
14
|
+
...utils
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export * from './components'
|
|
18
|
+
export * from './composable'
|
|
19
|
+
export * from './utils'
|
package/src/index.umd.js
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 * as components from './components'
|
|
10
|
+
import * as composable from './composable'
|
|
11
|
+
import * as utils from './utils'
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
...components,
|
|
15
|
+
...composable,
|
|
16
|
+
...utils
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@use "quasar/src/css/variables" as q
|
|
2
|
+
|
|
3
|
+
$m--container-padding: q.$space-base !default
|
|
4
|
+
$m--container-fluid-width: 1440px !default
|
|
5
|
+
|
|
6
|
+
.m--container
|
|
7
|
+
&__dense
|
|
8
|
+
padding: 0
|
|
9
|
+
|
|
10
|
+
&__fluid
|
|
11
|
+
max-width: $m--container-fluid-width
|
|
12
|
+
margin-left: auto
|
|
13
|
+
margin-right: auto
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Flex.
|
|
2
|
+
.flex-break
|
|
3
|
+
flex: 1 0 100% !important
|
|
4
|
+
padding: 0 !important
|
|
5
|
+
margin: 0 !important
|
|
6
|
+
|
|
7
|
+
.row
|
|
8
|
+
.flex-break
|
|
9
|
+
height: 0 !important
|
|
10
|
+
|
|
11
|
+
.column
|
|
12
|
+
.flex-break
|
|
13
|
+
width: 0 !important
|
|
14
|
+
|
|
15
|
+
$m--row-margin-top: 1rem !default
|
|
16
|
+
|
|
17
|
+
.m--row + .m--row
|
|
18
|
+
margin-top: $m--row-margin-top
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
// Directions.
|
|
22
|
+
.ltr
|
|
23
|
+
direction: ltr #{"/* rtl:ignore */"}
|
|
24
|
+
|
|
25
|
+
.rtl
|
|
26
|
+
direction: rtl #{"/* rtl:ignore */"}
|
|
27
|
+
|
|
28
|
+
// Colors.
|
|
29
|
+
$text-light-color: #111111 !default
|
|
30
|
+
$text-dark-color: #ffffff !default
|
|
31
|
+
|
|
32
|
+
.body--light
|
|
33
|
+
color: $text-light-color
|
|
34
|
+
|
|
35
|
+
.text-color
|
|
36
|
+
color: $text-light-color
|
|
37
|
+
|
|
38
|
+
.body--dark
|
|
39
|
+
color: $text-dark-color
|
|
40
|
+
|
|
41
|
+
.text-color
|
|
42
|
+
color: $text-dark-color
|
|
@@ -0,0 +1,120 @@
|
|
|
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, AxiosRequestConfig, AxiosResponse } from 'axios'
|
|
10
|
+
import { ApiServiceParams } from './dt'
|
|
11
|
+
|
|
12
|
+
// Axios
|
|
13
|
+
type Generic = Record<any, any>;
|
|
14
|
+
|
|
15
|
+
export type ApiMetaInterface = {
|
|
16
|
+
// server current page
|
|
17
|
+
current_page: number | null;
|
|
18
|
+
// server last page
|
|
19
|
+
last_page: number | null;
|
|
20
|
+
// server total items
|
|
21
|
+
total: number | null;
|
|
22
|
+
[K: any]: any;
|
|
23
|
+
};
|
|
24
|
+
export type ApiErrorInterface = Record<string, string[]>;
|
|
25
|
+
export type ApiErrorsInterface = ApiErrorInterface[];
|
|
26
|
+
|
|
27
|
+
export type ApiModel<T extends Generic = Generic> = {
|
|
28
|
+
id: string | number;
|
|
29
|
+
value: string | number;
|
|
30
|
+
label?: string;
|
|
31
|
+
[K: keyof T]: any;
|
|
32
|
+
[s: string]: any;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type ResponseAsMain = Generic & {
|
|
36
|
+
success: boolean;
|
|
37
|
+
errors: ApiErrorsInterface;
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type ResponseAsModel<T extends Generic = Generic> = ResponseAsMain & {
|
|
42
|
+
data: ApiModel<T>
|
|
43
|
+
}
|
|
44
|
+
type ResponseAsList<T extends Generic = Generic> = ResponseAsMain & {
|
|
45
|
+
data: ResponseAsModel<T>[];
|
|
46
|
+
links: {
|
|
47
|
+
first: string;
|
|
48
|
+
last: string;
|
|
49
|
+
prev: string | null;
|
|
50
|
+
next: string | null;
|
|
51
|
+
}
|
|
52
|
+
meta: ApiMetaInterface;
|
|
53
|
+
}
|
|
54
|
+
type ResponseDataType = ResponseAsList | ResponseAsModel | Generic;
|
|
55
|
+
export type ApiFulfilledResponse = AxiosResponse<ResponseDataType>
|
|
56
|
+
export type ApiErrorResponse = AxiosError<ResponseDataType>;
|
|
57
|
+
|
|
58
|
+
export type ApiInterface = ApiFulfilledResponse & {
|
|
59
|
+
_data: ResponseDataType;
|
|
60
|
+
_message: ResponseAsMain['message'];
|
|
61
|
+
_meta: ResponseAsList['meta'];
|
|
62
|
+
_success: ResponseAsMain['success'];
|
|
63
|
+
_errors: ResponseAsMain['errors'];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Axios
|
|
67
|
+
|
|
68
|
+
export type DownloadFromResponse = {
|
|
69
|
+
status: boolean;
|
|
70
|
+
response: AxiosResponse;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type DownloadFromResponseCode = 'no_response' | 'no_file_name' | 'no_file_url' | 'unknown' | string
|
|
74
|
+
export type DownloadFromResponseError = {
|
|
75
|
+
code: DownloadFromResponseCode
|
|
76
|
+
status: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type UrlType = string | number | any;
|
|
80
|
+
export type ParamsType = Record<string, any> | FormData | object
|
|
81
|
+
export type ConfigType = AxiosRequestConfig<ApiInterface> & Partial<{
|
|
82
|
+
params: Partial<ApiServiceParams> & Generic
|
|
83
|
+
}>
|
|
84
|
+
export type HelpersStubSchema = {
|
|
85
|
+
|
|
86
|
+
index (config?: ConfigType): Promise<ApiInterface>;
|
|
87
|
+
|
|
88
|
+
staticIndex (config?: ConfigType): Promise<ApiInterface>;
|
|
89
|
+
|
|
90
|
+
export (data?: ParamsType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
91
|
+
|
|
92
|
+
store (data?: ParamsType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
93
|
+
|
|
94
|
+
show (id: UrlType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
95
|
+
|
|
96
|
+
staticShow (id: UrlType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
97
|
+
|
|
98
|
+
update (id: UrlType, data?: ParamsType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
99
|
+
|
|
100
|
+
destroy (id: UrlType, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
101
|
+
|
|
102
|
+
destroyAll (ids?: UrlType[], config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
103
|
+
|
|
104
|
+
getUploadAttachmentsUrl (id: UrlType): string;
|
|
105
|
+
|
|
106
|
+
uploadAttachments (id: UrlType, data: Generic, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
107
|
+
|
|
108
|
+
deleteAttachment (id: UrlType, fileId: string | number, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
109
|
+
|
|
110
|
+
updateAttachment (id: UrlType, fileId: string | number, data: Record<string, any>, config?: AxiosRequestConfig): Promise<ApiInterface>;
|
|
111
|
+
};
|
|
112
|
+
export type StubSchemaContext = HelpersStubSchema
|
|
113
|
+
& Record<string, ((...args: any) => Promise<ApiInterface>)>
|
|
114
|
+
& Record<string, Record<string, ((...args: any) => Promise<ApiInterface>)>>
|
|
115
|
+
& Record<string, Record<string, Record<string, ((...args: any) => Promise<ApiInterface>)>>>
|
|
116
|
+
export type StubSchema = StubSchemaContext
|
|
117
|
+
& ((...args: any) => Promise<ApiInterface>)
|
|
118
|
+
& string
|
|
119
|
+
& Record<string, StubSchemaContext>
|
|
120
|
+
export type MythApiServicesSchema = { [key: string | symbol | number]: StubSchema }
|