@mythpe/quasar-ui-qui 0.1.77 → 0.1.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.1.77",
3
+ "version": "0.1.78",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -15,7 +15,7 @@ import type { InvalidSubmissionHandler, SubmissionHandler } from 'vee-validate'
15
15
  import { useForm } from 'vee-validate'
16
16
  import { computed, onMounted, ref, toValue, watch } from 'vue'
17
17
  import { is as quasarHelpers, QCardSection, QTable, useQuasar } from 'quasar'
18
- import lodash from 'lodash'
18
+ import { isArray } from 'lodash'
19
19
  import { useDtHelpers, useMyth } from '../../composable'
20
20
  import { useI18n } from 'vue-i18n'
21
21
 
@@ -1065,10 +1065,10 @@ defineExpose({
1065
1065
  }}</span>
1066
1066
  <span v-else-if="typeof filterValue === 'string'">: {{ filterValue }}</span>
1067
1067
  <span
1068
- v-else-if="lodash.isArray(filterValue) && !quasarHelpers.object(filterValue[0])"
1068
+ v-else-if="isArray(filterValue) && !quasarHelpers.object(filterValue[0])"
1069
1069
  >: {{ filterValue.join(', ') }}</span>
1070
1070
  <span
1071
- v-else-if="lodash.isArray(filterValue) && quasarHelpers.object(filterValue[0])"
1071
+ v-else-if="isArray(filterValue) && quasarHelpers.object(filterValue[0])"
1072
1072
  >: {{ filterValue.map(e => e.label).join(', ') }}</span>
1073
1073
  <span
1074
1074
  v-else-if="quasarHelpers.object(filterValue) && filterValue.label"
@@ -18,7 +18,7 @@ import type {
18
18
  import { useI18n } from 'vue-i18n'
19
19
  import { useMyth } from './useMyth'
20
20
  import { useQuasar } from 'quasar'
21
- import lodash from 'lodash'
21
+ import { isArray, isObject, isFunction, isPlainObject } from 'lodash'
22
22
  import { useRoute, useRouter } from 'vue-router'
23
23
  import type { AxiosRequestConfig } from 'axios'
24
24
  import { useResetForm, useSetFormValues } from 'vee-validate'
@@ -244,15 +244,15 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
244
244
  v = params.split(',')
245
245
  }
246
246
 
247
- if (lodash.isArray(params)) {
247
+ if (isArray(params)) {
248
248
  v = [...params]
249
- } else if (lodash.isObject(params) && typeof params !== 'function') {
249
+ } else if (isObject(params) && typeof params !== 'function') {
250
250
  let e
251
251
  for (const k in params) {
252
252
  e = params[k]
253
253
  v.push(`${k}=${e}`)
254
254
  }
255
- } else if (lodash.isFunction(params)) {
255
+ } else if (isFunction(params)) {
256
256
  const f = params()
257
257
  v = typeof f === 'string' ? f.split(',') : f
258
258
  }
@@ -277,7 +277,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
277
277
  if (Object.keys(filterForm.value).length > 0) {
278
278
  const TempFilter = { ...filterForm.value } as any
279
279
  for (const fKey in TempFilter) {
280
- if (lodash.isArray(TempFilter[fKey])) {
280
+ if (isArray(TempFilter[fKey])) {
281
281
  TempFilter[fKey] = TempFilter[fKey].map((elm: any) => {
282
282
  if (elm.id) {
283
283
  return elm.id
@@ -286,7 +286,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
286
286
  }
287
287
  return elm
288
288
  })
289
- } else if (lodash.isPlainObject(TempFilter[fKey])) {
289
+ } else if (isPlainObject(TempFilter[fKey])) {
290
290
  if (TempFilter[fKey].id) {
291
291
  TempFilter[fKey] = TempFilter[fKey].id
292
292
  } else if (TempFilter[fKey].value) {
@@ -338,6 +338,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
338
338
  sortBy: opts?.pagination?.sortBy || undefined,
339
339
  descending: opts?.pagination?.descending || undefined
340
340
  }
341
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
341
342
  _meta && (meta.value = _meta)
342
343
  if (props.endReach) {
343
344
  getRows.value = [...getRows.value, ...(_data || [])]
@@ -390,6 +391,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
390
391
  getMythApiServicesSchema().export(data, config)
391
392
  .then(async (response) => {
392
393
  const { _message } = response || {}
394
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
393
395
  _message && (alertSuccess(_message))
394
396
  try {
395
397
  await downloadFromResponse(response)
@@ -428,6 +430,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
428
430
  init[k] = attrs && k in attrs ? attrs[k] : defaultItem.value[k]
429
431
  }
430
432
  resetDialogForm({ values: init || {} }, { force: !0 })
433
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
431
434
  attrs && setValues(attrs, !1)
432
435
  }
433
436
  const openFilterDialog = () => {
@@ -501,7 +504,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
501
504
  })
502
505
  .catch((e: any) => {
503
506
  const message = e?._message || e?.message
504
- message && alertError(message)
507
+ if (message) alertError(message)
505
508
  })
506
509
  .finally(() => (loading.value = !1))
507
510
  }
@@ -6,7 +6,7 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
9
+ import { camelCase, filter, isString, pascalCase, pluralize, singularize, snakeCase, startsWith, uniq, uniqBy } from 'lodash'
10
10
  import { useI18n } from 'vue-i18n'
11
11
  import type { RouteLocationNormalizedLoaded } from 'vue-router'
12
12
  import { useRoute } from 'vue-router'
@@ -52,22 +52,22 @@ export const useMyth = () => {
52
52
  const s = routeName.split('.')
53
53
  lastRouteName = s[s.length - 2] ?? lastRouteName
54
54
  }
55
- const pluralize = Str.pascalCase(lodash.pluralize(lastRouteName))
56
- const singular = Str.pascalCase(lodash.singularize(lastRouteName))
55
+ const __pluralize = Str.pascalCase(pluralize(lastRouteName))
56
+ const singular = Str.pascalCase(singularize(lastRouteName))
57
57
 
58
- const keys = lodash.filter(lodash.uniq([
58
+ const keys = filter(uniq([
59
59
  `routes.${routeName}`,
60
60
  `routes.${routePath}`,
61
61
  `${lastRouteName}Page.title`,
62
- `${lodash.camelCase(lastRouteName)}Page.title`,
63
- `choice.${pluralize}`,
62
+ `${camelCase(lastRouteName)}Page.title`,
63
+ `choice.${__pluralize}`,
64
64
  `choice.${singular}`,
65
65
  `replace.${lastRouteName}_details`,
66
66
  `replace.${lastRouteName}`,
67
- pluralize,
68
- lodash.snakeCase(pluralize),
67
+ __pluralize,
68
+ snakeCase(__pluralize),
69
69
  singular,
70
- lodash.snakeCase(singular)
70
+ snakeCase(singular)
71
71
  ]))
72
72
  // console.log(keys)
73
73
  let str: string | null = null
@@ -77,17 +77,17 @@ export const useMyth = () => {
77
77
  if (!(k = keys[f])) {
78
78
  continue
79
79
  }
80
- if (te && te(k) && lodash.isString(t(k))) {
81
- if (lodash.startsWith(k, 'choice.')) {
80
+ if (te && te(k) && isString(t(k))) {
81
+ if (startsWith(k, 'choice.')) {
82
82
  const s = k.split('.')
83
83
  const n = routeName.split('.')
84
84
  if (s.length === 2 && n.length > 1) {
85
85
  const model = n[n.length - 2]
86
- const pluralizeModel = lodash.pluralize(lodash.pascalCase(model))
86
+ const pluralizeModel = pluralize(pascalCase(model))
87
87
  const _modelChoiceKey = `choice.${pluralizeModel}`
88
88
  if (te(_modelChoiceKey)) {
89
89
  const l = t(_modelChoiceKey, number as any)
90
- const rep = lodash.singularize(n[n.length - 1]).toLocaleLowerCase()
90
+ const rep = singularize(n[n.length - 1]).toLocaleLowerCase()
91
91
  const e = `replace.${rep}`
92
92
  str = te(e) ? t(e, { name: l }) : null
93
93
  } else {
@@ -101,7 +101,7 @@ export const useMyth = () => {
101
101
  } else {
102
102
  const parents: string[] = routeName.split('.')
103
103
  if (parents.length > 1) {
104
- const e = `choice.${Str.pascalCase(lodash.pluralize(parents[parents.length - 2]))}`
104
+ const e = `choice.${Str.pascalCase(pluralize(parents[parents.length - 2]))}`
105
105
  if (te(e)) {
106
106
  str = t(k, { name: t(e, '1') })
107
107
  } else {
@@ -165,11 +165,11 @@ export const useMyth = () => {
165
165
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
166
166
  // @ts-ignore
167
167
  item.label = t(k)
168
- } else if (te((k = `attributes.${lodash.snakeCase(item.label)}`))) {
168
+ } else if (te((k = `attributes.${snakeCase(item.label)}`))) {
169
169
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
170
170
  // @ts-ignore
171
171
  item.label = t(k)
172
- } else if (te((k = `attributes.${lodash.camelCase(item.label)}`))) {
172
+ } else if (te((k = `attributes.${camelCase(item.label)}`))) {
173
173
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
174
174
  // @ts-ignore
175
175
  item.label = t(k)
@@ -177,7 +177,7 @@ export const useMyth = () => {
177
177
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
178
178
  // @ts-ignore
179
179
  item.label = t(k)
180
- } else if (te((k = `choice.${lodash.pluralize(Str.pascalCase(item.label))}`))) {
180
+ } else if (te((k = `choice.${pluralize(Str.pascalCase(item.label))}`))) {
181
181
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
182
182
  // @ts-ignore
183
183
  item.label = t(k, 2)
@@ -215,7 +215,7 @@ export const useMyth = () => {
215
215
  }
216
216
  result.push(item)
217
217
  })
218
- return lodash.uniqBy(result, (e: MDtColumn) => e.name)
218
+ return uniqBy(result, (e: MDtColumn) => e.name)
219
219
  }
220
220
  /**
221
221
  * Copy text
@@ -8,7 +8,7 @@
8
8
 
9
9
  import type { AxiosInstance, AxiosRequestConfig } from 'axios'
10
10
  import type { ConfigType, DownloadFromResponse, DownloadFromResponseCode, HelpersStubSchema, ParamsType, UrlType } from '../types'
11
- import * as lodash from 'lodash'
11
+ import { find, isArray, isPlainObject } from 'lodash'
12
12
  import { colors, openURL, scroll, setCssVar } from 'quasar'
13
13
  import { nextTick } from 'vue'
14
14
 
@@ -46,7 +46,7 @@ export const Helpers = {
46
46
  value = values[key]
47
47
  if (value !== null && value !== undefined && typeof value === 'object') {
48
48
  const k = name ? name + '[' + key + ']' : key
49
- if (lodash.isArray(value) && value.length < 1) {
49
+ if (isArray(value) && value.length < 1) {
50
50
  formData.append(`${key}`, '')
51
51
  } else {
52
52
  this.appendArray(formData, value, k)
@@ -91,6 +91,7 @@ export const Helpers = {
91
91
  async store (data?: ParamsType, config?: AxiosRequestConfig) {
92
92
  const u = makeUrl()
93
93
  const formData = new FormData()
94
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
94
95
  data && Helpers.appendArray(formData, data)
95
96
  return axios().post(u, formData, config)
96
97
  },
@@ -106,12 +107,14 @@ export const Helpers = {
106
107
  const u = makeUrl(id)
107
108
  const formData = new FormData()
108
109
  formData.append('_method', 'put')
110
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
109
111
  data && Helpers.appendArray(formData, data)
110
112
  return axios().post(u, formData, config)
111
113
  },
112
114
  async clone (id: UrlType, data?: ParamsType, config?: AxiosRequestConfig) {
113
115
  const u = makeUrl(`${id}/Clone`)
114
116
  const formData = new FormData()
117
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
115
118
  data && Helpers.appendArray(formData, data)
116
119
  return axios().post(u, formData, config)
117
120
  },
@@ -143,7 +146,7 @@ export const Helpers = {
143
146
  parent?: UrlType
144
147
  ): string => ((parent ?? '') + (parent && group ? '/' : '')) + (group ?? '') + ((group && segments ? '/' : '') + (segments ?? '')),
145
148
  findBy (search: any, value: any, column: string | number = 'id') {
146
- return lodash.find(search, (e: any) => lodash.isPlainObject(e) ? e[column] === value : e === value)
149
+ return find(search, (e: any) => isPlainObject(e) ? e[column] === value : e === value)
147
150
  },
148
151
  // queryStringify: (v: never) => new URLSearchParams(qs.stringify(v, {
149
152
  // arrayFormat: 'indices'
package/src/utils/Str.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
9
+ import { camelCase, flow, mixin, pascalCase, pluralize, singularize, upperFirst } from 'lodash'
10
10
 
11
11
  export const Str = {
12
12
  /**
@@ -73,16 +73,16 @@ export const Str = {
73
73
  // return mobile && ((mobile.length === 10 && (c1 === '05' || parseInt(c1) === 5)) || (mobile.length === 9 && c2 === 5))
74
74
  },
75
75
  pascalCase (string?: string): string {
76
- if (!lodash.pascalCase) {
77
- lodash.mixin({ pascalCase: lodash.flow(lodash.camelCase, lodash.upperFirst) })
76
+ if (!pascalCase) {
77
+ mixin({ pascalCase: flow(camelCase, upperFirst) })
78
78
  }
79
- return lodash.pascalCase(string)
79
+ return pascalCase(string)
80
80
  },
81
81
  pluralize (string?: string): string {
82
- return lodash.pluralize?.(string)
82
+ return pluralize?.(string)
83
83
  },
84
84
  singular (string?: string): string {
85
- return lodash.singularize(string)
85
+ return singularize(string)
86
86
  },
87
87
  flipChoice (data: Record<any, any>) {
88
88
  const f: Record<any, any> = {}
@@ -6,7 +6,7 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
9
+ import { isNumber } from 'lodash'
10
10
  import { patterns } from 'quasar'
11
11
 
12
12
  const { testPattern } = patterns
@@ -16,7 +16,7 @@ export const veeRules = {
16
16
  if (v === undefined || v === null) {
17
17
  return !0
18
18
  }
19
- return lodash.isNumber(parseInt(v)) && !isNaN(parseInt(v)) &&
19
+ return isNumber(parseInt(v)) && !isNaN(parseInt(v)) &&
20
20
  v?.toString().split('.')?.length <= 2 &&
21
21
  (/(\d)+/g.test(v) && !/[a-zA-Z]/.test(v))
22
22
  },