@mixd-id/web-scaffold 0.1.240411039 → 0.1.240411041
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/List.vue +18 -9
- package/src/index.js +2 -16
- package/src/utils/helpers.mjs +18 -1
package/package.json
CHANGED
package/src/components/List.vue
CHANGED
|
@@ -423,17 +423,26 @@ export default{
|
|
|
423
423
|
async loadPreset(){
|
|
424
424
|
if(!Object.keys(this.$route.query).map(_ => _.toLowerCase()).includes('reset')){
|
|
425
425
|
if(this.presetKey){
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
const config = await this.socket.send(this.presetSrc, { key:this.presetKey })
|
|
427
|
+
if(config){
|
|
428
|
+
if((config.presets ?? []).length > 0){
|
|
429
|
+
Object.assign(this.cConfig, config)
|
|
430
|
+
}
|
|
431
|
+
else{
|
|
432
|
+
const defaultConfig = setupConfig(await this.defaultConfig())
|
|
433
|
+
Object.assign(this.cConfig, defaultConfig)
|
|
434
|
+
}
|
|
430
435
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
if(this.$route.query?.search)
|
|
437
|
+
this.preset.search = this.$route.query.search
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
else{
|
|
441
|
+
const defaultConfig = setupConfig(await this.defaultConfig())
|
|
442
|
+
Object.assign(this.cConfig, defaultConfig)
|
|
443
|
+
|
|
444
|
+
return new Promise(resolve => resolve())
|
|
435
445
|
}
|
|
436
|
-
return new Promise(resolve => resolve())
|
|
437
446
|
}
|
|
438
447
|
else{
|
|
439
448
|
const defaultConfig = setupConfig(await this.defaultConfig())
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {defineAsyncComponent, ref} from "vue"
|
|
2
|
-
import {arrayPush, arrayRemove, arrayUnshift, invokeAfterIdle, observeInit} from './utils/helpers.mjs'
|
|
2
|
+
import {arrayPush, arrayRemove, arrayUnshift, invokeAfterIdle, observeInit, downloadUrl} from './utils/helpers.mjs'
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
4
|
import {useDevice} from './hooks/device.js'
|
|
5
5
|
|
|
@@ -17,21 +17,7 @@ const mediaBreakpoints = [
|
|
|
17
17
|
|
|
18
18
|
const { device } = useDevice()
|
|
19
19
|
|
|
20
|
-
const download = (url, as) => {
|
|
21
|
-
url = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'nocache=' + new Date().getTime()
|
|
22
20
|
|
|
23
|
-
const downloader = document.createElement('a')
|
|
24
|
-
downloader.setAttribute('href', url)
|
|
25
|
-
downloader.target = '_blank'
|
|
26
|
-
if(as) downloader.download = as
|
|
27
|
-
document.body.appendChild(downloader)
|
|
28
|
-
|
|
29
|
-
downloader.click()
|
|
30
|
-
|
|
31
|
-
window.setTimeout(() => {
|
|
32
|
-
document.body.removeChild(downloader)
|
|
33
|
-
}, 100)
|
|
34
|
-
}
|
|
35
21
|
|
|
36
22
|
let preloads = []
|
|
37
23
|
|
|
@@ -330,7 +316,7 @@ export default{
|
|
|
330
316
|
app.config.globalProperties.$t = t => t
|
|
331
317
|
app.config.globalProperties.uniqid = uniqid
|
|
332
318
|
app.config.globalProperties.formatDate = formatDate
|
|
333
|
-
app.config.globalProperties.$download =
|
|
319
|
+
app.config.globalProperties.$download = downloadUrl
|
|
334
320
|
app.config.globalProperties.$preload = preload
|
|
335
321
|
app.config.globalProperties.$popPreloads = popPreloads
|
|
336
322
|
app.config.globalProperties.$util = util
|
package/src/utils/helpers.mjs
CHANGED
|
@@ -604,6 +604,22 @@ function addHash(hash, newHash, prefix = '_'){
|
|
|
604
604
|
return cleaned.join('')
|
|
605
605
|
}
|
|
606
606
|
|
|
607
|
+
const downloadUrl = (url, as) => {
|
|
608
|
+
url = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'nocache=' + new Date().getTime()
|
|
609
|
+
|
|
610
|
+
const downloader = document.createElement('a')
|
|
611
|
+
downloader.setAttribute('href', url)
|
|
612
|
+
downloader.target = '_blank'
|
|
613
|
+
if(as) downloader.download = as
|
|
614
|
+
document.body.appendChild(downloader)
|
|
615
|
+
|
|
616
|
+
downloader.click()
|
|
617
|
+
|
|
618
|
+
window.setTimeout(() => {
|
|
619
|
+
document.body.removeChild(downloader)
|
|
620
|
+
}, 100)
|
|
621
|
+
}
|
|
622
|
+
|
|
607
623
|
export {
|
|
608
624
|
capitalize,
|
|
609
625
|
round,
|
|
@@ -638,7 +654,8 @@ export {
|
|
|
638
654
|
arrayPush,
|
|
639
655
|
arrayRemove,
|
|
640
656
|
arrayUnshift,
|
|
641
|
-
addHash
|
|
657
|
+
addHash,
|
|
658
|
+
downloadUrl
|
|
642
659
|
}
|
|
643
660
|
|
|
644
661
|
function observeInit(){
|