@mythpe/quasar-ui-qui 0.1.50 → 0.1.52

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.50",
3
+ "version": "0.1.52",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -518,7 +518,7 @@ export type MFormSlots = {
518
518
 
519
519
  export declare type GenericFormValues = Record<any, any>;
520
520
 
521
- export type MOptionsOptionContext = Omit<QToggleProps, 'modelValue'> & Omit<QRadioProps, 'modelValue'> & Omit<QCheckboxProps, 'modelValue'> & {
521
+ export interface MOptionsOptionContext extends Omit<QToggleProps, 'modelValue'>, Omit<QRadioProps, 'modelValue'>, Omit<QCheckboxProps, 'modelValue'> {
522
522
  /**
523
523
  * Label to display along the component
524
524
  */
@@ -531,9 +531,11 @@ export type MOptionsOptionContext = Omit<QToggleProps, 'modelValue'> & Omit<QRad
531
531
  * If true, the option will be disabled
532
532
  */
533
533
  disable?: boolean;
534
+
534
535
  /**
535
536
  * Any other props from QToggle & QCheckbox, or QRadio
536
537
  */
538
+ [key: string]: any;
537
539
  }
538
540
 
539
541
  export type MOptionsProps = Omit<QOptionGroupProps, 'name' | 'modelValue' | 'options'> &
@@ -226,7 +226,7 @@ export const Helpers = {
226
226
  }
227
227
  })
228
228
  },
229
- async scrollToElement (el: Element | HTMLElement | string, opt?: { target?: HTMLElement | string, duration?: number; }) {
229
+ async scrollToElement (el: Element | HTMLElement | string, opt?: { target?: HTMLElement | string, duration?: number; offset?: number; }) {
230
230
  await nextTick()
231
231
  const { getScrollTarget, setVerticalScrollPosition, getVerticalScrollPosition } = scroll
232
232
  const scrollTo = typeof el === 'string' ? document.querySelector(el) as HTMLElement : el
@@ -237,26 +237,12 @@ export const Helpers = {
237
237
  const { target: t } = opt || {}
238
238
  const targetSelector = typeof t === 'string' ? document.querySelector(t) as HTMLElement : t
239
239
  const target = getScrollTarget(scrollTo, targetSelector || window.document.documentElement)
240
- // console.log(targetSelector, target)
241
- // let offset = 0
242
- // try {
243
- // let parent = scrollTo
244
- // do {
245
- // // console.log(parent.getBoundingClientRect().top)
246
- // offset += parent?.offsetTop || 0
247
- // parent = parent.offsetParent as HTMLElement
248
- // } while (parent?.offsetParent)
249
- // } catch (e) {
250
- // offset = scrollTo?.offsetTop || 0
251
- // }
252
- // offset = scrollTo.getBoundingClientRect().top
253
240
  const current = getVerticalScrollPosition(target)
254
- // console.log(current, target)
255
- // const offset = scrollTo.getBoundingClientRect().top
256
241
  const duration = opt?.duration || 1000
257
242
 
258
243
  let offset = 0
259
244
  let parent = scrollTo
245
+
260
246
  try {
261
247
  do {
262
248
  offset = parent.getBoundingClientRect().top
@@ -272,21 +258,9 @@ export const Helpers = {
272
258
  console.log(e)
273
259
  offset = 'offsetTop' in scrollTo ? scrollTo?.offsetTop as number || 0 : 0
274
260
  }
275
- // console.log(offset, parent, current)
276
- // const position = offset
277
- // if (offset > current) {
278
- // position = (current - offset) + current
279
- // } else if (offset < current) {
280
- // position = current + offset
281
- // }
282
- // console.log({
283
- // target,
284
- // scrollTo,
285
- // position,
286
- // offset,
287
- // current
288
- // })
289
- setVerticalScrollPosition(target, (offset + current) - 100, duration)
261
+
262
+ const _offset = (offset + current) - (100 + (opt?.offset || 0))
263
+ setVerticalScrollPosition(target, _offset, duration)
290
264
  },
291
265
  async scrollToElementFromErrors (errors?: Partial<Record<string, string[] | string | null | undefined>>, elm?: any, target?: any) {
292
266
  if (!errors) {
@@ -329,20 +303,22 @@ export const Helpers = {
329
303
  }
330
304
  return `//${path}`
331
305
  },
332
- toFixedFormatted (value: any) {
306
+ toFixedFormatted (value: any, prefix?: string) {
307
+ value = value || '0.00'
333
308
  if (value) {
334
309
  const text: string = value?.toString() || ''
310
+ const def = prefix ? (value + ` ${prefix}`) : value
335
311
  if (!text) {
336
- return value
312
+ return def
337
313
  }
338
314
  const after: string = (text.split?.('.')[1] || '')?.toString() || ''
339
315
  if (!after) {
340
- return value
316
+ return def
341
317
  }
342
318
  if (after?.length === 1) {
343
- return `${value}0`
319
+ value = `${value}0`
344
320
  }
345
- return value?.toString()
321
+ return value?.toString() + (prefix ? ` ${prefix}` : '')
346
322
  }
347
323
  return value
348
324
  },