@mythpe/quasar-ui-qui 0.1.49 → 0.1.51
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 +1 -1
- package/src/components/form/index.ts +2 -2
- package/src/utils/Helpers.ts +12 -36
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import MAxios from './MAxios.vue'
|
|
|
10
10
|
import MAvatarViewer from './MAvatarViewer.vue'
|
|
11
11
|
import MBtn from './MBtn.vue'
|
|
12
12
|
import MCheckbox from './MCheckbox.vue'
|
|
13
|
-
|
|
13
|
+
import MCkeditor from './MCkeditor.vue'
|
|
14
14
|
import MColor from './MColor.vue'
|
|
15
15
|
import MDate from './MDate.vue'
|
|
16
16
|
import MEditor from './MEditor.vue'
|
|
@@ -40,7 +40,7 @@ export {
|
|
|
40
40
|
MAvatarViewer,
|
|
41
41
|
MBtn,
|
|
42
42
|
MCheckbox,
|
|
43
|
-
|
|
43
|
+
MCkeditor,
|
|
44
44
|
MColor,
|
|
45
45
|
MDate,
|
|
46
46
|
MEditor,
|
package/src/utils/Helpers.ts
CHANGED
|
@@ -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
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
|
312
|
+
return def
|
|
337
313
|
}
|
|
338
314
|
const after: string = (text.split?.('.')[1] || '')?.toString() || ''
|
|
339
315
|
if (!after) {
|
|
340
|
-
return
|
|
316
|
+
return def
|
|
341
317
|
}
|
|
342
318
|
if (after?.length === 1) {
|
|
343
|
-
|
|
319
|
+
value = `${value}0`
|
|
344
320
|
}
|
|
345
|
-
return value?.toString()
|
|
321
|
+
return value?.toString() + (prefix ? ` ${prefix}` : '')
|
|
346
322
|
}
|
|
347
323
|
return value
|
|
348
324
|
},
|