renusify 2.5.2 → 3.0.0
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +208 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +87 -47
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +323 -164
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +249 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +1 -2
- package/components/infinite/index.vue +248 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +201 -91
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +318 -156
- package/components/swiper/index.vue +254 -106
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -1,42 +1,88 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span ref="icon" :class="classes">
|
|
3
|
+
<!-- Default slot for icon content. -->
|
|
3
4
|
<slot></slot>
|
|
4
5
|
</span>
|
|
5
6
|
</template>
|
|
6
7
|
|
|
7
|
-
<script>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
8
|
+
<script setup>
|
|
9
|
+
import {computed, inject, onMounted, ref} from 'vue'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Component properties configuration
|
|
13
|
+
* @typedef {Object} ComponentProps
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
/**
|
|
18
|
+
* Width of the component
|
|
19
|
+
* @description CSS width value (e.g., '100px', '50%', 'auto')
|
|
20
|
+
* @example '100%'
|
|
21
|
+
* @example '300px'
|
|
22
|
+
*/
|
|
23
|
+
width: {type: String},
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Height of the component
|
|
27
|
+
* @description CSS height value (e.g., '100px', '50%', 'auto')
|
|
28
|
+
* @example '200px'
|
|
29
|
+
* @memberof ComponentProps
|
|
30
|
+
*/
|
|
31
|
+
height: {type: String},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Whether the icon is disabled
|
|
35
|
+
* @description When true, user interaction is prevented and visual styling indicates disabled state
|
|
36
|
+
*/
|
|
37
|
+
disabled: Boolean,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Whether to apply exact icon for both rtl and ltr
|
|
41
|
+
*/
|
|
42
|
+
exact: Boolean
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const $r = inject('renusify').$r
|
|
46
|
+
|
|
47
|
+
const icon = ref(null)
|
|
48
|
+
|
|
49
|
+
const classes = computed(() => {
|
|
50
|
+
return {
|
|
51
|
+
[`${$r.prefix}icon`]: true,
|
|
52
|
+
'icon-disabled': props.disabled,
|
|
53
|
+
'exact-icon': props.exact
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
if (props.width || props.height) {
|
|
59
|
+
const el = icon.value?.firstElementChild
|
|
60
|
+
if (el) {
|
|
61
|
+
if (props.width) {
|
|
62
|
+
el.setAttribute('width', props.width)
|
|
63
|
+
}
|
|
64
|
+
if (props.height) {
|
|
65
|
+
el.setAttribute('height', props.height)
|
|
40
66
|
}
|
|
41
67
|
}
|
|
68
|
+
}
|
|
69
|
+
})
|
|
42
70
|
</script>
|
|
71
|
+
<style lang="scss">
|
|
72
|
+
@use "../../style" as *;
|
|
73
|
+
|
|
74
|
+
.#{$prefix}icon {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
vertical-align: -.5rem;
|
|
77
|
+
|
|
78
|
+
&.icon-disabled {
|
|
79
|
+
@include disable-states();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@include rtl() {
|
|
83
|
+
&:not(.exact-icon) {
|
|
84
|
+
transform: scale(-1, 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
</style>
|
package/components/img/index.vue
CHANGED
|
@@ -3,16 +3,21 @@
|
|
|
3
3
|
[$r.prefix+'img']:true,
|
|
4
4
|
'img-hoverZoom':hoverZoom,'img-hoverDark':hoverDark,'img-hover-preview':preview}"
|
|
5
5
|
ref="rImg">
|
|
6
|
-
<div v-if="preview" class="img-preview
|
|
6
|
+
<div v-if="preview" class="img-preview d-flex v-center h-center"
|
|
7
7
|
>
|
|
8
8
|
<r-btn icon @click="show_preview=true">
|
|
9
9
|
<r-icon v-html="$r.icons.eye"></r-icon>
|
|
10
10
|
</r-btn>
|
|
11
11
|
</div>
|
|
12
|
-
<img v-if="load &&!isSvg" ref="img" :alt="alt"
|
|
12
|
+
<img v-if="load &&!isSvg" ref="img" :alt="alt"
|
|
13
|
+
:height="size.height>0?size.height:'auto'"
|
|
14
|
+
:width="size.width>0?size.width:'auto'"
|
|
15
|
+
:sizes="size.width>0?size.width+'px':'auto'"
|
|
16
|
+
:src="link"
|
|
17
|
+
:srcset="srcset"
|
|
18
|
+
:style="{'height':size.height>0?undefined:'auto',
|
|
13
19
|
'width':size.width>0?undefined:'auto'
|
|
14
20
|
}"
|
|
15
|
-
:width="size.width>0?size.width:'auto'"
|
|
16
21
|
draggable="false"/>
|
|
17
22
|
<svg-img v-else-if="load &&isSvg&&link" :link="link" :size="size">
|
|
18
23
|
</svg-img>
|
|
@@ -21,165 +26,260 @@
|
|
|
21
26
|
</teleport>
|
|
22
27
|
</div>
|
|
23
28
|
</template>
|
|
24
|
-
<script>
|
|
25
|
-
import {defineAsyncComponent} from 'vue'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
<script setup>
|
|
30
|
+
import {defineAsyncComponent, ref, computed, onMounted, nextTick} from 'vue'
|
|
31
|
+
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
/**
|
|
34
|
+
* Source URL of the image
|
|
35
|
+
* Required: true
|
|
36
|
+
* Example: 'https://codenus.com/pwa/logo'
|
|
37
|
+
*/
|
|
38
|
+
src: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true
|
|
32
41
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
width: {
|
|
51
|
-
type: [String, Number]
|
|
52
|
-
},
|
|
53
|
-
height: {
|
|
54
|
-
type: [String, Number]
|
|
55
|
-
},
|
|
56
|
-
query: String,
|
|
57
|
-
autoSize: Boolean,
|
|
58
|
-
hoverZoom: Boolean,
|
|
59
|
-
hoverDark: Boolean,
|
|
60
|
-
isSvg: Boolean,
|
|
61
|
-
svgCache: {type: Number, default: 86400},
|
|
62
|
-
wPH: Number
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Preview image URL for high resolution image
|
|
45
|
+
* Example: 'https://codenus.com/pwa/logo'
|
|
46
|
+
*/
|
|
47
|
+
preview: String,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Alternative text for the image (accessibility)
|
|
51
|
+
* Required: true
|
|
52
|
+
* Example: 'A beautiful sunset over the mountains'
|
|
53
|
+
*/
|
|
54
|
+
alt: {
|
|
55
|
+
type: String,
|
|
56
|
+
required: true
|
|
63
57
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Lazy loading behavior
|
|
61
|
+
* Allowed values: 'no', 'create'
|
|
62
|
+
* - 'no': No lazy loading
|
|
63
|
+
* - 'create': Create lazy loading instance
|
|
64
|
+
*/
|
|
65
|
+
lazy: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: 'create',
|
|
68
|
+
validator: (value) => ['no', 'create'].includes(value)
|
|
73
69
|
},
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Width of the image
|
|
73
|
+
* Example: '100%', 300, '200px'
|
|
74
|
+
*/
|
|
75
|
+
width: {
|
|
76
|
+
type: [String, Number]
|
|
76
77
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
res = '/' + res
|
|
85
|
-
}
|
|
86
|
-
if (this.src.search('[?]') === -1) {
|
|
87
|
-
res += '?'
|
|
88
|
-
}
|
|
89
|
-
if (this.query) {
|
|
90
|
-
res += this.query
|
|
91
|
-
}
|
|
92
|
-
if (this.isSvg && this.svgCache) {
|
|
93
|
-
res += '&c=' + this.svgCache
|
|
94
|
-
}
|
|
95
|
-
if (!this.isSvg && ((this.autoSize && this.size.width > 0) || this.width)) {
|
|
96
|
-
res += `&w=${this.size.width}`
|
|
97
|
-
}
|
|
98
|
-
if (!this.isSvg && ((this.autoSize && this.size.height > 0) || this.height)) {
|
|
99
|
-
res += `&h=${this.size.height}`
|
|
100
|
-
}
|
|
101
|
-
return res
|
|
102
|
-
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Height of the image
|
|
81
|
+
* Example: 'auto', 200, '150px'
|
|
82
|
+
*/
|
|
83
|
+
height: {
|
|
84
|
+
type: [String, Number]
|
|
103
85
|
},
|
|
104
|
-
methods: {
|
|
105
|
-
check(isIntersecting) {
|
|
106
|
-
if (isIntersecting) {
|
|
107
|
-
this.view = true
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
getSize() {
|
|
111
|
-
let res = {width: 0, height: 0}
|
|
112
|
-
if (this.width) {
|
|
113
|
-
res["width"] = this.width
|
|
114
|
-
}
|
|
115
|
-
if (this.height) {
|
|
116
|
-
res["height"] = this.height
|
|
117
|
-
}
|
|
118
|
-
let wPH = this.wPH
|
|
119
|
-
if (!wPH) {
|
|
120
|
-
const ls = this.src.split('/')
|
|
121
|
-
if (ls.length > 0) {
|
|
122
|
-
const p = ls[ls.length - 1].split('_')
|
|
123
|
-
if (p.length === 3) {
|
|
124
|
-
const p0 = parseInt(p[0])
|
|
125
|
-
const p1 = parseInt(p[1])
|
|
126
|
-
if (p0 && p1) {
|
|
127
|
-
wPH = p0 / p1
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
wPH = 1
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (wPH) {
|
|
135
|
-
if (res['width'] !== 0 && res['height'] === 0) {
|
|
136
|
-
res['height'] = parseInt(res['width'] / wPH)
|
|
137
|
-
}
|
|
138
|
-
if (res['width'] === 0 && res['height'] !== 0) {
|
|
139
|
-
res['width'] = parseInt(res['height'] * wPH)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
86
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Query parameters to append to the image URL
|
|
89
|
+
* Example: '?quality=80&format=webp'
|
|
90
|
+
*/
|
|
91
|
+
query: String,
|
|
146
92
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Whether to automatically generate srcset for responsive images
|
|
95
|
+
*/
|
|
96
|
+
autoSrcset: {type: Boolean, default: true},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether to automatically calculate image dimensions
|
|
100
|
+
*/
|
|
101
|
+
autoSize: Boolean,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Whether to enable zoom on hover effect
|
|
105
|
+
*/
|
|
106
|
+
hoverZoom: Boolean,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether to apply dark overlay on hover
|
|
110
|
+
*/
|
|
111
|
+
hoverDark: Boolean,
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Whether the image is an SVG file
|
|
115
|
+
*/
|
|
116
|
+
isSvg: Boolean,
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Cache duration for SVG files in seconds
|
|
120
|
+
* Default: 86400 (24 hours)
|
|
121
|
+
*/
|
|
122
|
+
svgCache: {type: Number, default: 86400},
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Width-per-height ratio (aspect ratio)
|
|
126
|
+
* Example: 1.777 (for 16:9 aspect ratio)
|
|
127
|
+
*/
|
|
128
|
+
wPH: Number
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const SvgImg = defineAsyncComponent(() => import('./svgImg.vue'))
|
|
132
|
+
const PreviewImg = defineAsyncComponent(() => import('./preview.vue'))
|
|
133
|
+
|
|
134
|
+
const show_preview = ref(false)
|
|
135
|
+
const load = ref(false)
|
|
136
|
+
const view = ref(false)
|
|
137
|
+
const modifier = computed(() => props.lazy !== 'no' ? 'once' : 'pre')
|
|
138
|
+
const srcset = ref(null)
|
|
139
|
+
const size = ref({width: 0, height: 0})
|
|
140
|
+
|
|
141
|
+
const rImg = ref(null)
|
|
142
|
+
|
|
143
|
+
const link = computed(() => {
|
|
144
|
+
if (props.lazy !== 'no' && !view.value) {
|
|
145
|
+
return null
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
let res = props.src
|
|
149
|
+
if (!(res.startsWith('/') || res.startsWith('http://') || res.startsWith('https://') || res.startsWith('data:image/'))) {
|
|
150
|
+
res = '/' + res
|
|
151
|
+
}
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
if (props.src.search('[?]') === -1) {
|
|
154
|
+
res += '?'
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (props.query) {
|
|
158
|
+
res += props.query
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (props.isSvg && props.svgCache) {
|
|
162
|
+
res += '&c=' + props.svgCache
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (!props.isSvg && ((props.autoSize && size.value.width > 0) || props.width)) {
|
|
166
|
+
res += `&w=${size.value.width}`
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!props.isSvg && ((props.autoSize && size.value.height > 0) || props.height)) {
|
|
170
|
+
res += `&h=${size.value.height}`
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return res
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
const set_srcset = (wph) => {
|
|
177
|
+
if (!props.autoSrcset) return
|
|
178
|
+
|
|
179
|
+
let src = props.src
|
|
180
|
+
if (src.search('[?]') === -1) {
|
|
181
|
+
src += '?'
|
|
182
|
+
}
|
|
183
|
+
if (props.query) {
|
|
184
|
+
src += props.query
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const sizes = [300, 600, 900, 1200]
|
|
188
|
+
const srcs = sizes.map(width => {
|
|
189
|
+
const height = parseInt(width / wph)
|
|
190
|
+
return `${src}&w=${width}&h=${height} ${width}w`
|
|
191
|
+
})
|
|
192
|
+
srcset.value = srcs.join(',')
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const check = (isIntersecting) => {
|
|
196
|
+
if (isIntersecting) {
|
|
197
|
+
view.value = true
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const getSize = () => {
|
|
202
|
+
const res = {width: 0, height: 0}
|
|
203
|
+
|
|
204
|
+
if (props.width) {
|
|
205
|
+
res.width = props.width
|
|
206
|
+
}
|
|
207
|
+
if (props.height) {
|
|
208
|
+
res.height = props.height
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let wPH = props.wPH
|
|
212
|
+
if (!wPH) {
|
|
213
|
+
const ls = props.src.split('/')
|
|
214
|
+
if (ls.length > 0) {
|
|
215
|
+
const p = ls[ls.length - 1].split('_')
|
|
216
|
+
if (p.length === 3) {
|
|
217
|
+
const p0 = parseInt(p[0])
|
|
218
|
+
const p1 = parseInt(p[1])
|
|
219
|
+
if (p0 && p1) {
|
|
220
|
+
wPH = p0 / p1
|
|
221
|
+
}
|
|
164
222
|
} else {
|
|
165
|
-
|
|
166
|
-
this.time_id = setTimeout(() => {
|
|
167
|
-
this.activate()
|
|
168
|
-
}, 100)
|
|
223
|
+
wPH = 1
|
|
169
224
|
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
170
227
|
|
|
228
|
+
if (wPH) {
|
|
229
|
+
if (res.width !== 0 && res.height === 0) {
|
|
230
|
+
res.height = parseInt(res.width / wPH)
|
|
171
231
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
232
|
+
if (res.width === 0 && res.height !== 0) {
|
|
233
|
+
res.width = parseInt(res.height * wPH)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (res.width !== 0 || res.height !== 0) {
|
|
238
|
+
set_srcset(res.width / res.height)
|
|
239
|
+
size.value = res
|
|
240
|
+
return size.value
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (rImg.value && rImg.value.parentElement && rImg.value.parentElement.clientWidth > 0) {
|
|
244
|
+
const cs = window.getComputedStyle(rImg.value.parentElement)
|
|
245
|
+
const paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight)
|
|
246
|
+
const borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth)
|
|
247
|
+
const w = parseInt(parseFloat(cs.getPropertyValue('width')) - paddingX - borderX)
|
|
248
|
+
set_srcset(wPH)
|
|
249
|
+
size.value = {
|
|
250
|
+
width: w,
|
|
251
|
+
height: parseInt(wPH ? w / wPH : 0)
|
|
252
|
+
}
|
|
253
|
+
return size.value
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return false
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const activate = () => {
|
|
260
|
+
getSize()
|
|
261
|
+
if (size.value.width !== 0 || size.value.height) {
|
|
262
|
+
load.value = true
|
|
263
|
+
} else {
|
|
264
|
+
nextTick(() => {
|
|
265
|
+
activate()
|
|
266
|
+
})
|
|
175
267
|
}
|
|
176
268
|
}
|
|
269
|
+
|
|
270
|
+
onMounted(() => {
|
|
271
|
+
nextTick(() => {
|
|
272
|
+
activate()
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
|
|
177
276
|
</script>
|
|
277
|
+
|
|
178
278
|
<style lang="scss">
|
|
179
279
|
@use "sass:map";
|
|
180
|
-
@use "../../style
|
|
280
|
+
@use "../../style" as *;
|
|
181
281
|
|
|
182
|
-
.#{
|
|
282
|
+
.#{$prefix}img {
|
|
183
283
|
position: relative;
|
|
184
284
|
display: inline-flex;
|
|
185
285
|
max-width: 100%;
|
|
@@ -225,18 +325,20 @@ export default {
|
|
|
225
325
|
left: 0;
|
|
226
326
|
max-width: 0;
|
|
227
327
|
overflow: hidden;
|
|
328
|
+
width: 100%;
|
|
329
|
+
height: 100%;
|
|
228
330
|
}
|
|
229
331
|
}
|
|
230
332
|
|
|
231
|
-
.#{
|
|
333
|
+
.#{$prefix}img-preview-container {
|
|
232
334
|
width: 100vw;
|
|
233
|
-
height:
|
|
335
|
+
height: 100%;
|
|
234
336
|
overflow: hidden;
|
|
235
337
|
position: fixed;
|
|
236
338
|
touch-action: none;
|
|
237
339
|
background: var(--color-overlay);
|
|
238
340
|
backdrop-filter: blur(3px) grayscale(30%);
|
|
239
|
-
z-index: map.get(
|
|
341
|
+
z-index: map.get($z-index, 'veryImportant');
|
|
240
342
|
top: 0;
|
|
241
343
|
left: 0;
|
|
242
344
|
|