@mythpe/quasar-ui-qui 0.4.20 → 0.4.22

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.4.20",
3
+ "version": "0.4.22",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -33,7 +33,7 @@ defineOptions({
33
33
  <MInput
34
34
  ref="input"
35
35
  v-model="modelValue"
36
- v-bind="{...$attrs as any, type:'email',email:!0}"
36
+ v-bind="{...$attrs as any, type: 'email', email: !0, ltr: !0}"
37
37
  >
38
38
  <template
39
39
  v-for="(_,slot) in $slots as Readonly<MInputSlots>"
@@ -80,7 +80,6 @@ defineExpose<MPhoneExposed>({
80
80
  select,
81
81
  input: phoneRef
82
82
  })
83
-
84
83
  defineOptions({
85
84
  name: 'MPhone',
86
85
  inheritAttrs: !1
@@ -349,5 +349,27 @@ export const Helpers = {
349
349
  },
350
350
  uniq<T> (array: T[]): T[] {
351
351
  return [...new Set(array)]
352
+ },
353
+ shuffle<T = any> (array: readonly T[]): T[] {
354
+ const newArray = [...(array || [])]
355
+ for (let i = newArray.length - 1; i > 0; i--) {
356
+ const j = Math.floor(Math.random() * (i + 1));
357
+ [newArray[i], newArray[j]] = [newArray[j], newArray[i]] as [T, T]
358
+ }
359
+ // console.log(newArray)
360
+ return newArray
361
+ },
362
+ detectWebPlatform (): 'ios' | 'android' | 'other' {
363
+ let userAgent = navigator.userAgent || navigator.vendor
364
+ userAgent = userAgent ? userAgent.toLowerCase() : ''
365
+ if (/ipad|iphone|ipod/g.test(userAgent)) {
366
+ return 'ios'
367
+ }
368
+
369
+ if (/android/i.test(userAgent)) {
370
+ return 'android'
371
+ }
372
+
373
+ return 'other'
352
374
  }
353
375
  }
package/src/utils/Str.ts CHANGED
@@ -213,6 +213,32 @@ export const Str = {
213
213
  }
214
214
  return r + (pEnd || '')
215
215
  })
216
+ },
217
+ ucFirst (str: any) {
218
+ if (!str) return str
219
+ return str?.toString?.()?.charAt?.(0)?.toUpperCase() + str?.toString?.()?.slice?.(1)?.toLowerCase?.()
220
+ },
221
+ toAlphaNumerals (num: number, options: { uppercase?: boolean; startFromZero?: boolean } = {}): string {
222
+ const { uppercase = true, startFromZero = false } = options
223
+ num = parseInt(num?.toString?.() || '0') || 0
224
+ if (num <= 0) {
225
+ if (!startFromZero) {
226
+ return ''
227
+ }
228
+ }
229
+ if (startFromZero && `${num}` === '0') return uppercase ? 'A' : 'a'
230
+
231
+ let adjustedNum = startFromZero ? num + 1 : num
232
+ let result = ''
233
+
234
+ while (adjustedNum > 0) {
235
+ adjustedNum--
236
+ const charCode = (adjustedNum % 26) + (uppercase ? 65 : 97)
237
+ result = String.fromCharCode(charCode) + result
238
+ adjustedNum = Math.floor(adjustedNum / 26)
239
+ }
240
+
241
+ return result
216
242
  }
217
243
  }
218
244