@mythpe/quasar-ui-qui 0.1.81 → 0.1.82

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.81",
3
+ "version": "0.1.82",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -31,10 +31,11 @@
31
31
  "@vee-validate/i18n": "^4.14.7",
32
32
  "@vee-validate/rules": "^4.14.7",
33
33
  "axios": "^1.7.8",
34
+ "change-case": "^5.4.4",
34
35
  "ckeditor5": "^43.3.1",
35
- "lodash": "^4.17.21",
36
- "lodash-inflection": "^1.5.0",
36
+ "pluralize": "^8.0.0",
37
37
  "qs": "^6.13.1",
38
+ "radash": "^12.1.0",
38
39
  "typed.js": "^2.1.0",
39
40
  "vee-validate": "^4.14.7",
40
41
  "vue-i18n": "^11.0.0-beta.2",
@@ -48,8 +49,8 @@
48
49
  "@rollup/plugin-node-resolve": "^15.3.0",
49
50
  "@rollup/plugin-replace": "^6.0.1",
50
51
  "@types/express": "^5.0.0",
51
- "@types/lodash": "^4.17.13",
52
52
  "@types/node": "^22.10.1",
53
+ "@types/pluralize": "^0.0.33",
53
54
  "@typescript-eslint/eslint-plugin": "^7.16.0",
54
55
  "@typescript-eslint/parser": "^7.16.0",
55
56
  "autoprefixer": "^10.4.20",
@@ -15,7 +15,6 @@ 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 { isArray } from 'lodash'
19
18
  import { useDtHelpers, useMyth } from '../../composable'
20
19
  import { useI18n } from 'vue-i18n'
21
20
 
@@ -1065,10 +1064,10 @@ defineExpose({
1065
1064
  }}</span>
1066
1065
  <span v-else-if="typeof filterValue === 'string'">: {{ filterValue }}</span>
1067
1066
  <span
1068
- v-else-if="isArray(filterValue) && !quasarHelpers.object(filterValue[0])"
1067
+ v-else-if="Array.isArray(filterValue) && !quasarHelpers.object(filterValue[0])"
1069
1068
  >: {{ filterValue.join(', ') }}</span>
1070
1069
  <span
1071
- v-else-if="isArray(filterValue) && quasarHelpers.object(filterValue[0])"
1070
+ v-else-if="Array.isArray(filterValue) && quasarHelpers.object(filterValue[0])"
1072
1071
  >: {{ filterValue.map(e => e.label).join(', ') }}</span>
1073
1072
  <span
1074
1073
  v-else-if="quasarHelpers.object(filterValue) && filterValue.label"
@@ -11,7 +11,6 @@
11
11
  setup
12
12
  >
13
13
 
14
- import { isNaN } from 'lodash'
15
14
  import { computed, nextTick, onBeforeUnmount, onBeforeUpdate, ref, watch, watchEffect } from 'vue'
16
15
  import { date } from 'quasar'
17
16
  import type { MOtpProps as Props } from '../../types'
@@ -73,7 +72,7 @@ const inputValue = computed(() => {
73
72
  watch(inputValue, (v) => {
74
73
  if (v) {
75
74
  if (props.string) {
76
- if (!isNaN(v) && v?.toString?.()?.length?.toString?.() === props.inputLength.toString()) {
75
+ if (!isNaN(parseInt(v?.toString() || '')) && v?.toString?.()?.length?.toString?.() === props.inputLength.toString()) {
77
76
  modelValue.value = v
78
77
  }
79
78
  } else {
@@ -114,7 +113,7 @@ const blur = (index: number) => {
114
113
 
115
114
  const onUpdate = (value: string | number | null, index: number) => {
116
115
  if (value) {
117
- if (props.string && isNaN(value)) {
116
+ if (props.string && isNaN(parseInt(value?.toString() || ''))) {
118
117
  nextTick(() => setTimeout(() => focus(index), 100))
119
118
  return
120
119
  }
@@ -11,9 +11,9 @@
11
11
  setup
12
12
  >
13
13
  import { computed } from 'vue'
14
- import { uniq } from 'lodash'
15
14
  import type { MColProps as Props } from '../../types'
16
-
15
+ import { useMyth } from '../../composable'
16
+ const { uniq } = useMyth()
17
17
  const props = defineProps<Props>()
18
18
  const classes = computed(() => {
19
19
  const list: string[] = ['m--col']
@@ -2,7 +2,6 @@ import type { MaybeRefOrGetter } from 'vue'
2
2
  import { computed, ref, toValue, useAttrs } from 'vue'
3
3
  import { useI18n } from 'vue-i18n'
4
4
  import { useMyth } from './useMyth'
5
- import { camelCase, kebabCase, snakeCase, uniq } from 'lodash'
6
5
  import type { MythComponentsProps as UiOpt } from '../types/plugin-props-option'
7
6
 
8
7
  type G = { name: string; [k: string]: any };
@@ -12,7 +11,11 @@ export const useBindInput = <P extends G = G> (Props: MaybeRefOrGetter<P>, key:
12
11
  const {
13
12
  __, theme: mTheme,
14
13
  props: pluginProps,
15
- rules: mRules
14
+ rules: mRules,
15
+ uniq,
16
+ camelCase,
17
+ kebabCase,
18
+ snakeCase
16
19
  } = useMyth()
17
20
  const attributes = useAttrs()
18
21
  const props = toValue<P>(Props)
@@ -17,8 +17,7 @@ import type {
17
17
  } from '../types'
18
18
  import { useI18n } from 'vue-i18n'
19
19
  import { useMyth } from './useMyth'
20
- import { useQuasar } from 'quasar'
21
- import lodash from 'lodash'
20
+ import { is, useQuasar } from 'quasar'
22
21
  import { useRoute, useRouter } from 'vue-router'
23
22
  import type { AxiosRequestConfig } from 'axios'
24
23
  import { useResetForm, useSetFormValues } from 'vee-validate'
@@ -244,15 +243,15 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
244
243
  v = params.split(',')
245
244
  }
246
245
 
247
- if (lodash.isArray(params)) {
246
+ if (Array.isArray(params)) {
248
247
  v = [...params]
249
- } else if (lodash.isObject(params) && typeof params !== 'function') {
248
+ } else if (typeof params !== 'function') {
250
249
  let e
251
250
  for (const k in params) {
252
251
  e = params[k]
253
252
  v.push(`${k}=${e}`)
254
253
  }
255
- } else if (lodash.isFunction(params)) {
254
+ } else if (typeof params === 'function') {
256
255
  const f = params()
257
256
  v = typeof f === 'string' ? f.split(',') : f
258
257
  }
@@ -277,7 +276,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
277
276
  if (Object.keys(filterForm.value).length > 0) {
278
277
  const TempFilter = { ...filterForm.value } as any
279
278
  for (const fKey in TempFilter) {
280
- if (lodash.isArray(TempFilter[fKey])) {
279
+ if (Array.isArray(TempFilter[fKey])) {
281
280
  TempFilter[fKey] = TempFilter[fKey].map((elm: any) => {
282
281
  if (elm.id) {
283
282
  return elm.id
@@ -286,7 +285,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
286
285
  }
287
286
  return elm
288
287
  })
289
- } else if (lodash.isPlainObject(TempFilter[fKey])) {
288
+ } else if (is.object(TempFilter[fKey])) {
290
289
  if (TempFilter[fKey].id) {
291
290
  TempFilter[fKey] = TempFilter[fKey].id
292
291
  } else if (TempFilter[fKey].value) {
@@ -6,7 +6,6 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
10
9
  import { useI18n } from 'vue-i18n'
11
10
  import type { RouteLocationNormalizedLoaded } from 'vue-router'
12
11
  import { useRoute } from 'vue-router'
@@ -34,8 +33,6 @@ export const useMyth = () => {
34
33
  number = parseInt(number.toString())
35
34
  route = route || $route
36
35
  const defaultValue = ''
37
- // Not route
38
- // No page title
39
36
  if (!route) {
40
37
  return defaultValue
41
38
  }
@@ -52,23 +49,23 @@ export const useMyth = () => {
52
49
  const s = routeName.split('.')
53
50
  lastRouteName = s[s.length - 2] ?? lastRouteName
54
51
  }
55
- const pluralize = Str.pascalCase(lodash.pluralize(lastRouteName))
56
- const singular = Str.pascalCase(lodash.singularize(lastRouteName))
52
+ const pluralize = Str.pascalCase(Str.pluralize(lastRouteName))
53
+ const singular = Str.pascalCase(Str.singular(lastRouteName))
57
54
 
58
- const keys = lodash.filter(lodash.uniq([
55
+ const keys = Helpers.uniq<string>([
59
56
  `routes.${routeName}`,
60
57
  `routes.${routePath}`,
61
58
  `${lastRouteName}Page.title`,
62
- `${lodash.camelCase(lastRouteName)}Page.title`,
59
+ `${Str.camelCase(lastRouteName)}Page.title`,
63
60
  `choice.${pluralize}`,
64
61
  `choice.${singular}`,
65
62
  `replace.${lastRouteName}_details`,
66
63
  `replace.${lastRouteName}`,
67
64
  pluralize,
68
- lodash.snakeCase(pluralize),
65
+ Str.snakeCase(pluralize),
69
66
  singular,
70
- lodash.snakeCase(singular)
71
- ]))
67
+ Str.snakeCase(singular)
68
+ ]).filter(e => !e)
72
69
  // console.log(keys)
73
70
  let str: string | null = null
74
71
  let k: string | any
@@ -77,17 +74,17 @@ export const useMyth = () => {
77
74
  if (!(k = keys[f])) {
78
75
  continue
79
76
  }
80
- if (te && te(k) && lodash.isString(t(k))) {
81
- if (lodash.startsWith(k, 'choice.')) {
77
+ if (te && te(k) && typeof t(k) === 'string') {
78
+ if (k.toString().startsWith('choice.')) {
82
79
  const s = k.split('.')
83
80
  const n = routeName.split('.')
84
81
  if (s.length === 2 && n.length > 1) {
85
82
  const model = n[n.length - 2]
86
- const pluralizeModel = lodash.pluralize(lodash.pascalCase(model))
83
+ const pluralizeModel = Str.pluralize(Str.pascalCase(model))
87
84
  const _modelChoiceKey = `choice.${pluralizeModel}`
88
85
  if (te(_modelChoiceKey)) {
89
86
  const l = t(_modelChoiceKey, number as any)
90
- const rep = lodash.singularize(n[n.length - 1]).toLocaleLowerCase()
87
+ const rep = Str.singular(n[n.length - 1]).toLocaleLowerCase()
91
88
  const e = `replace.${rep}`
92
89
  str = te(e) ? t(e, { name: l }) : null
93
90
  } else {
@@ -101,7 +98,7 @@ export const useMyth = () => {
101
98
  } else {
102
99
  const parents: string[] = routeName.split('.')
103
100
  if (parents.length > 1) {
104
- const e = `choice.${Str.pascalCase(lodash.pluralize(parents[parents.length - 2]))}`
101
+ const e = `choice.${Str.pascalCase(Str.pluralize(parents[parents.length - 2]))}`
105
102
  if (te(e)) {
106
103
  str = t(k, { name: t(e, '1') })
107
104
  } else {
@@ -124,7 +121,7 @@ export const useMyth = () => {
124
121
  const parseHeaders = (headers: MDtHeadersParameter, options: ParseHeaderOptions = {}): MDtColumn[] => {
125
122
  const defaultOptions: Partial<ParseHeaderOptions> = {
126
123
  controlKey: 'control',
127
- // controlStyle: 'max-width: 150px',
124
+ // controlStyle: 'max-width: 150 px',
128
125
  align: 'center'
129
126
  // sortable: !0
130
127
  }
@@ -159,17 +156,17 @@ export const useMyth = () => {
159
156
  label: (item.label !== undefined && item.label !== null) ? Str.strBefore(Str.strBefore(item.label), 'ToString') : item.label
160
157
  }
161
158
  const name = item.name
162
- let k
159
+ let k: unknown
163
160
  if (te) {
164
161
  if (te((k = `attributes.${item.label}`))) {
165
162
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
166
163
  // @ts-ignore
167
164
  item.label = t(k)
168
- } else if (te((k = `attributes.${lodash.snakeCase(item.label)}`))) {
165
+ } else if (te((k = `attributes.${Str.snakeCase(item.label)}`))) {
169
166
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
170
167
  // @ts-ignore
171
168
  item.label = t(k)
172
- } else if (te((k = `attributes.${lodash.camelCase(item.label)}`))) {
169
+ } else if (te((k = `attributes.${Str.camelCase(item.label)}`))) {
173
170
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
174
171
  // @ts-ignore
175
172
  item.label = t(k)
@@ -177,7 +174,7 @@ export const useMyth = () => {
177
174
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
178
175
  // @ts-ignore
179
176
  item.label = t(k)
180
- } else if (te((k = `choice.${lodash.pluralize(Str.pascalCase(item.label))}`))) {
177
+ } else if (te((k = `choice.${Str.pluralize(Str.pascalCase(item.label))}`))) {
181
178
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
182
179
  // @ts-ignore
183
180
  item.label = t(k, 2)
@@ -215,7 +212,7 @@ export const useMyth = () => {
215
212
  }
216
213
  result.push(item)
217
214
  })
218
- return lodash.uniqBy(result, (e: MDtColumn) => e.name)
215
+ return Helpers.uniqBy(result, 'name')
219
216
  }
220
217
  /**
221
218
  * Copy text
@@ -9,7 +9,6 @@
9
9
  export * from './api-helpers'
10
10
  export * from './components'
11
11
  export * from './install-options'
12
- export * from './lodash'
13
12
  export * from './m-datatable'
14
13
  export * from './m-geolocation'
15
14
  export * from './myth-api'
@@ -8,7 +8,6 @@
8
8
 
9
9
  import type { AxiosInstance, AxiosRequestConfig } from 'axios'
10
10
  import type { ConfigType, DownloadFromResponse, DownloadFromResponseCode, HelpersStubSchema, ParamsType, UrlType } from '../types'
11
- import lodash from 'lodash'
12
11
  import { colors, openURL, scroll, setCssVar } from 'quasar'
13
12
  import { nextTick } from 'vue'
14
13
 
@@ -46,7 +45,7 @@ export const Helpers = {
46
45
  value = values[key]
47
46
  if (value !== null && value !== undefined && typeof value === 'object') {
48
47
  const k = name ? name + '[' + key + ']' : key
49
- if (lodash.isArray(value) && value.length < 1) {
48
+ if (Array.isArray(value) && value.length < 1) {
50
49
  formData.append(`${key}`, '')
51
50
  } else {
52
51
  this.appendArray(formData, value, k)
@@ -142,14 +141,6 @@ export const Helpers = {
142
141
  segments?: UrlType,
143
142
  parent?: UrlType
144
143
  ): string => ((parent ?? '') + (parent && group ? '/' : '')) + (group ?? '') + ((group && segments ? '/' : '') + (segments ?? '')),
145
- findBy (search: any, value: any, column: string | number = 'id') {
146
- return lodash.find(search, (e: any) => lodash.isPlainObject(e) ? e[column] === value : e === value)
147
- },
148
- // queryStringify: (v: never) => new URLSearchParams(qs.stringify(v, {
149
- // arrayFormat: 'indices'
150
- // // encodeValuesOnly: true,
151
- // // encode: false,
152
- // })),
153
144
  /**
154
145
  * Open unique window popup of application
155
146
  *
@@ -339,5 +330,19 @@ export const Helpers = {
339
330
  lightenColor,
340
331
  darkenColor,
341
332
  setCss,
342
- colorIsDark
333
+ colorIsDark,
334
+ uniqBy<T> (array: T[], key: keyof T): T[] {
335
+ const seen = new Set()
336
+ return array.filter(item => {
337
+ const value = item[key]
338
+ if (seen.has(value)) {
339
+ return false
340
+ }
341
+ seen.add(value)
342
+ return true
343
+ })
344
+ },
345
+ uniq<T> (array: T[]): T[] {
346
+ return [...new Set(array)]
347
+ }
343
348
  }
package/src/utils/Str.ts CHANGED
@@ -6,7 +6,8 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
9
+ import { plural as pluralCase, singular as singularCase } from 'pluralize'
10
+ import { camelCase, capitalCase, dotCase, kebabCase, pascalCase, snakeCase } from 'change-case'
10
11
 
11
12
  export const Str = {
12
13
  /**
@@ -72,17 +73,29 @@ export const Str = {
72
73
  return mobile && (mobile.length === 10 && (c1 === '05' || parseInt(c1) === 5))
73
74
  // return mobile && ((mobile.length === 10 && (c1 === '05' || parseInt(c1) === 5)) || (mobile.length === 9 && c2 === 5))
74
75
  },
75
- pascalCase (string?: string): string {
76
- if (!lodash.pascalCase) {
77
- lodash.mixin({ pascalCase: lodash.flow(lodash.camelCase, lodash.upperFirst) })
78
- }
79
- return lodash.pascalCase(string)
76
+ pascalCase (string?: unknown): string {
77
+ return string ? pascalCase(string?.toString() || '') : ''
78
+ },
79
+ camelCase (string?: unknown): string {
80
+ return string ? camelCase(string?.toString() || '') : ''
81
+ },
82
+ snakeCase (string?: unknown): string {
83
+ return string ? snakeCase(string?.toString() || '') : ''
84
+ },
85
+ kebabCase (string?: unknown): string {
86
+ return string ? kebabCase(string?.toString() || '') : ''
87
+ },
88
+ capitalCase (string?: unknown): string {
89
+ return string ? capitalCase(string?.toString() || '') : ''
90
+ },
91
+ dotCase (string?: unknown): string {
92
+ return string ? dotCase(string?.toString() || '') : ''
80
93
  },
81
- pluralize (string?: string): string {
82
- return lodash.pluralize?.(string)
94
+ pluralize (string?: unknown): string {
95
+ return string ? pluralCase(string?.toString() || '') : ''
83
96
  },
84
- singular (string?: string): string {
85
- return lodash.singularize(string)
97
+ singular (string?: unknown): string {
98
+ return string ? singularCase(string?.toString() || '') : ''
86
99
  },
87
100
  flipChoice (data: Record<any, any>) {
88
101
  const f: Record<any, any> = {}
@@ -6,8 +6,7 @@
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
8
 
9
- import lodash from 'lodash'
10
- import { patterns } from 'quasar'
9
+ import { patterns, is } from 'quasar'
11
10
 
12
11
  const { testPattern } = patterns
13
12
 
@@ -16,7 +15,7 @@ export const veeRules = {
16
15
  if (v === undefined || v === null) {
17
16
  return !0
18
17
  }
19
- return lodash.isNumber(parseInt(v)) && !isNaN(parseInt(v)) &&
18
+ return is.number(parseInt(v)) && !isNaN(parseInt(v)) &&
20
19
  v?.toString().split('.')?.length <= 2 &&
21
20
  (/(\d)+/g.test(v) && !/[a-zA-Z]/.test(v))
22
21
  },
@@ -5,10 +5,8 @@
5
5
  * Website: https://www.4myth.com
6
6
  * Github: https://github.com/mythpe
7
7
  */
8
- // import inflection from 'lodash-inflection'
9
8
  import type { App } from 'vue'
10
9
  import { name, version } from '../../package.json'
11
-
12
10
  import type { InstallOptions } from '../types'
13
11
  import { defineAsyncComponents } from '../plugin/defineAsyncComponents'
14
12
  import { defineComponents } from '../plugin/defineComponents'
@@ -16,10 +14,6 @@ import { defineComponents } from '../plugin/defineComponents'
16
14
  import { createMyth } from './createMyth'
17
15
  import { MythKey } from './const'
18
16
 
19
- // if (process?.env?.NODE_ENV !== 'development') {
20
- // lodash.mixin(inflection)
21
- // }
22
-
23
17
  function install (app: App, options: InstallOptions) {
24
18
  const myth = createMyth(options)
25
19
  app.provide(MythKey, myth)
@@ -1,26 +0,0 @@
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 {}