@mixd-id/web-scaffold 0.1.2301231369 → 0.2.240702
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/LICENSE +1 -0
- package/docs/components/Header2.md +16 -0
- package/docs/components/TreeView.md +0 -0
- package/package.json +22 -5
- package/src/App.vue +9 -1
- package/src/components/Ahref.vue +175 -9
- package/src/components/Alert.vue +181 -75
- package/src/components/Article.vue +393 -0
- package/src/components/Block.vue +31 -0
- package/src/components/Box.vue +34 -0
- package/src/components/Button.vue +208 -129
- package/src/components/Carousel.vue +194 -124
- package/src/components/Chart.vue +485 -0
- package/src/components/ChartBar.vue +193 -0
- package/src/components/Checkbox.vue +95 -55
- package/src/components/CodeEditor.vue +61 -0
- package/src/components/ColorPicker.vue +158 -0
- package/src/components/ColorPicker2.vue +164 -0
- package/src/components/Confirm.vue +178 -0
- package/src/components/ContextMenu.vue +164 -76
- package/src/components/ConversationBuilder.vue +161 -0
- package/src/components/CopyToClipboard.vue +6 -31
- package/src/components/Countdown.vue +104 -53
- package/src/components/DGrid.vue +21 -0
- package/src/components/DGridItem.vue +263 -0
- package/src/components/DataList.vue +92 -0
- package/src/components/Datepicker.vue +65 -41
- package/src/components/DayTimeRange.vue +125 -0
- package/src/components/Dropdown.vue +32 -9
- package/src/components/ErrorText.vue +30 -9
- package/src/components/FBLogin.vue +194 -0
- package/src/components/Flex.vue +70 -0
- package/src/components/GSignIn.vue +166 -0
- package/src/components/Gmaps.vue +35 -11
- package/src/components/Grid.vue +24 -20
- package/src/components/HTMLEditor.vue +258 -79
- package/src/components/IconMenu.vue +95 -0
- package/src/components/IconMenu2.vue +89 -0
- package/src/components/IconPlus.vue +89 -0
- package/src/components/Image.vue +161 -59
- package/src/components/Image360.vue +2 -2
- package/src/components/ImagePreview.vue +23 -11
- package/src/components/ImportModal.vue +27 -14
- package/src/components/Link.vue +39 -0
- package/src/components/List.vue +1177 -0
- package/src/components/ListItem.vue +32 -21
- package/src/components/ListPage1.vue +88 -17
- package/src/components/ListPage1Filter.vue +2 -2
- package/src/components/ListView.vue +962 -0
- package/src/components/ListViewBarSummary.vue +81 -0
- package/src/components/ListViewLineSummary.vue +75 -0
- package/src/components/ListViewLiveBarSummary.vue +52 -0
- package/src/components/ListViewMapSummary.vue +56 -0
- package/src/components/ListViewSettings.vue +514 -0
- package/src/components/ListViewTableSummary.vue +77 -0
- package/src/components/LogViewerItem.vue +116 -0
- package/src/components/Modal.vue +274 -122
- package/src/components/MultilineText.vue +177 -0
- package/src/components/OTPField.vue +5 -6
- package/src/components/ObjectTree.vue +105 -0
- package/src/components/PageBuilder.vue +449 -0
- package/src/components/Paragraph.vue +41 -0
- package/src/components/PresetSelectorFilterItem.vue +178 -0
- package/src/components/Radio.vue +62 -87
- package/src/components/SearchButton.vue +1 -1
- package/src/components/Slider.vue +107 -75
- package/src/components/Svg.vue +33 -0
- package/src/components/Switch.vue +15 -5
- package/src/components/TabView.vue +0 -1
- package/src/components/Table.vue +56 -0
- package/src/components/TableViewHead.vue +2 -2
- package/src/components/Tabs.vue +68 -11
- package/src/components/Test.vue +23 -0
- package/src/components/Testimonial.vue +86 -0
- package/src/components/Text.vue +49 -0
- package/src/components/TextBlock.vue +50 -0
- package/src/components/TextWithTag.vue +225 -0
- package/src/components/Textarea.vue +22 -16
- package/src/components/Textbox.vue +83 -62
- package/src/components/Thumbnail.vue +27 -0
- package/src/components/Timepicker.vue +15 -8
- package/src/components/Toast.vue +60 -38
- package/src/components/TreeView.vue +101 -0
- package/src/components/TreeViewItem.vue +424 -0
- package/src/components/TreeViewItem1.vue +282 -0
- package/src/components/VirtualGrid.vue +284 -0
- package/src/components/VirtualScroll.vue +88 -21
- package/src/components/VirtualTable.vue +277 -71
- package/src/components/YoutubeVideo.vue +196 -0
- package/src/configs/icons-fa.json +12 -0
- package/src/events/event.js +2 -0
- package/src/index.js +477 -53
- package/src/main.js +0 -9
- package/src/middleware/http/trim-string.js +20 -0
- package/src/mixin/component.js +222 -0
- package/src/mixin/website.js +121 -0
- package/src/stores/components.js +36 -0
- package/src/themes/default/index.js +178 -34
- package/src/utils/helpers.js +378 -7
- package/src/utils/helpers.mjs +274 -16
- package/src/utils/importer.js +60 -26
- package/src/utils/listpage1.js +403 -267
- package/src/utils/listview.js +1287 -0
- package/src/utils/preset-selector.js +1055 -0
- package/src/utils/preset-selector.mjs +185 -0
- package/src/utils/selection.js +15 -36
- package/src/utils/web.js +50 -0
- package/src/utils/wss.js +294 -0
- package/src/utils/wss.mjs +280 -0
- package/src/widgets/AhrefSetting.vue +94 -0
- package/src/widgets/ArticleSetting.vue +469 -0
- package/src/widgets/BackgroundSetting.vue +132 -0
- package/src/widgets/BlockSetting.vue +49 -0
- package/src/widgets/BorderSetting.vue +201 -0
- package/src/widgets/BoxSetting.vue +53 -0
- package/src/widgets/ButtonSetting.vue +114 -0
- package/src/widgets/CarouselSetting.vue +193 -0
- package/src/widgets/ColumnSelector.vue +80 -0
- package/src/widgets/ComponentPropertyLabel.vue +35 -0
- package/src/widgets/ComponentPropertySelector.vue +115 -0
- package/src/widgets/ComponentSetting.vue +2220 -0
- package/src/widgets/ComponentSetting2.vue +1018 -0
- package/src/widgets/ComponentSetting3.vue +231 -0
- package/src/widgets/ContactForm.vue +193 -0
- package/src/widgets/ContactFormSetting.vue +384 -0
- package/src/widgets/CountdownSetting.vue +76 -0
- package/src/widgets/DataListSetting.vue +102 -0
- package/src/widgets/EffectSetting.vue +94 -0
- package/src/widgets/EmbeddedVideo.vue +60 -0
- package/src/widgets/EmbeddedVideoSetting.vue +48 -0
- package/src/widgets/FAQ.vue +85 -0
- package/src/widgets/FAQSetting.vue +88 -0
- package/src/widgets/FeatureList.vue +128 -0
- package/src/widgets/FeatureListSetting.vue +223 -0
- package/src/widgets/FiltersSetting.vue +88 -0
- package/src/widgets/FlexSetting.vue +197 -0
- package/src/widgets/GridSetting.vue +290 -0
- package/src/widgets/Header.vue +15 -0
- package/src/widgets/Header1.vue +41 -0
- package/src/widgets/Header1Setting.vue +75 -0
- package/src/widgets/Header2.vue +102 -0
- package/src/widgets/Header2Setting.vue +277 -0
- package/src/widgets/HeaderSetting.vue +104 -0
- package/src/widgets/IconList.vue +51 -0
- package/src/widgets/IconListSetting.vue +184 -0
- package/src/widgets/ImageSetting.vue +146 -0
- package/src/widgets/LayoutSetting.vue +251 -0
- package/src/widgets/LinkSetting.vue +186 -0
- package/src/widgets/LogViewer.vue +85 -0
- package/src/widgets/MarginPaddingSetting.vue +58 -0
- package/src/widgets/MarginSetting.vue +142 -0
- package/src/widgets/MenuEditor.vue +256 -0
- package/src/widgets/MobileMenu.vue +182 -0
- package/src/widgets/ModalSetting.vue +96 -0
- package/src/widgets/MultiValueSetting.vue +121 -0
- package/src/widgets/MultiValueSetting2.vue +114 -0
- package/src/widgets/PaddingSetting.vue +142 -0
- package/src/widgets/ParagraphSetting.vue +86 -0
- package/src/widgets/PresetBar.vue +880 -0
- package/src/widgets/PresetBarPivotColumnEdit.vue +197 -0
- package/src/widgets/PresetSelector.vue +673 -0
- package/src/widgets/Review.vue +131 -0
- package/src/widgets/ReviewSetting.vue +201 -0
- package/src/widgets/Share.vue +165 -0
- package/src/widgets/ShareSetting.vue +92 -0
- package/src/widgets/SizingSetting.vue +306 -0
- package/src/widgets/SpacingSetting.vue +77 -0
- package/src/widgets/StyleSetting.vue +328 -0
- package/src/widgets/StyleSetting2.vue +90 -0
- package/src/widgets/SvgSetting.vue +133 -0
- package/src/widgets/TableSetting.vue +172 -0
- package/src/widgets/TestimonialSetting.vue +152 -0
- package/src/widgets/TextBlockSetting.vue +78 -0
- package/src/widgets/ThumbnailSetting.vue +49 -0
- package/src/widgets/TransitionSetting.vue +64 -0
- package/src/widgets/TypographySetting.vue +334 -0
- package/src/widgets/UserActionBuilder/UserActionItem.vue +165 -0
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +126 -0
- package/src/widgets/UserActionBuilder.vue +457 -0
- package/src/widgets/WebComponentSelector.vue +201 -0
- package/src/widgets/WebDatasourceSelector.vue +153 -0
- package/src/widgets/WebLayoutSelector.vue +376 -0
- package/src/widgets/WebPageBuilder.vue +1849 -0
- package/src/widgets/WebPageBuilder2.vue +1091 -0
- package/src/widgets/WebPageBuilder3.vue +411 -0
- package/src/widgets/WebPageBuilder4/ActionSetting.vue +158 -0
- package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
- package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +64 -0
- package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
- package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
- package/src/widgets/WebPageBuilder4/ButtonSetting.vue +73 -0
- package/src/widgets/WebPageBuilder4/CarouselSetting.vue +122 -0
- package/src/widgets/WebPageBuilder4/ColorSetting.vue +63 -0
- package/src/widgets/WebPageBuilder4/DataSetting.vue +92 -0
- package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
- package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
- package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
- package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
- package/src/widgets/WebPageBuilder4/FlexSetting.vue +105 -0
- package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
- package/src/widgets/WebPageBuilder4/FontSizeSetting.vue +76 -0
- package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
- package/src/widgets/WebPageBuilder4/GridSetting.vue +166 -0
- package/src/widgets/WebPageBuilder4/HeightSetting.vue +95 -0
- package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
- package/src/widgets/WebPageBuilder4/LinkSetting.vue +68 -0
- package/src/widgets/WebPageBuilder4/MarginSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
- package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
- package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
- package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
- package/src/widgets/WebPageBuilder4/MobileMenuSetting.vue +106 -0
- package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +155 -0
- package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
- package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
- package/src/widgets/WebPageBuilder4/PaddingSetting.vue +53 -0
- package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
- package/src/widgets/WebPageBuilder4/PropertySetting.vue +183 -0
- package/src/widgets/WebPageBuilder4/Setting.vue +73 -0
- package/src/widgets/WebPageBuilder4/StyleSetting.vue +77 -0
- package/src/widgets/WebPageBuilder4/SvgSetting.vue +207 -0
- package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/TextTransformSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +329 -0
- package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +147 -0
- package/src/widgets/WebPageBuilder4/WebPageDataEdit.vue +121 -0
- package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +172 -0
- package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
- package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4.vue +1084 -0
- package/src/widgets/WebPagePreview.vue +295 -0
- package/src/widgets/WebPageSelector.vue +173 -0
- package/src/widgets/WebTemplateCreator.vue +156 -0
- package/src/widgets/YoutubeVideoSetting.vue +65 -0
- package/tailwind.config.js +513 -0
- package/test.json +22 -0
- package/public/images/mixd-logo2.png +0 -0
- package/src/components/ButtonGroup.vue +0 -101
- package/src/components/DynamicTemplate.vue +0 -44
- package/src/components/GridColumn.vue +0 -31
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="$style.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</span>
|
|
13
|
-
<div v-else :class="imageClass" class="bg-gray-200 animate-pulse"></div>
|
|
2
|
+
<div :class="$style.comp"
|
|
3
|
+
@mousedown="mouseDown"
|
|
4
|
+
@touchstart.passive="mouseDown"
|
|
5
|
+
:style="computedStyle">
|
|
6
|
+
|
|
7
|
+
<div ref="inner" :class="computedContainerClass">
|
|
8
|
+
<div v-for="item in cItems" :class="computedItemClass">
|
|
9
|
+
<slot v-if="$slots['default']" :item="item"></slot>
|
|
10
|
+
<component v-else :is="item.type" :="item" />
|
|
11
|
+
</div>
|
|
14
12
|
</div>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<svg width="24" height="24" viewBox="0 0 24 24" class="fill-white/30 group-hover:fill-white/60" xmlns="http://www.w3.org/2000/svg">
|
|
19
|
-
<g clip-path="url(#clip0)">
|
|
20
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.04289 19.2071C7.65237 18.8166 7.65237 18.1834 8.04289 17.7929L13.8358 12L8.04289 6.20711C7.65237 5.81658 7.65237 5.18342 8.04289 4.79289C8.43342 4.40237 9.06658 4.40237 9.45711 4.79289L15.25 10.5858C16.031 11.3668 16.031 12.6332 15.25 13.4142L9.45711 19.2071C9.06658 19.5976 8.43342 19.5976 8.04289 19.2071Z"/>
|
|
21
|
-
</g>
|
|
22
|
-
</svg>
|
|
23
|
-
</div>
|
|
24
|
-
</slot>
|
|
13
|
+
|
|
14
|
+
<div v-if="cItems && cItems.length > 1" :class="$style.carouselNext" @click="next(true)">
|
|
15
|
+
<slot name="next"></slot>
|
|
25
16
|
</div>
|
|
26
|
-
|
|
17
|
+
|
|
18
|
+
<div v-if="cItems && cItems.length > 1" :class="$style.carouselPrev" @click="prev">
|
|
27
19
|
<slot name="prev">
|
|
28
|
-
<div class="w-10 h-10 rounded-full bg-black/10 cursor-pointer flex items-center justify-center">
|
|
29
|
-
<svg width="24" height="24" viewBox="0 0 24 24" class="fill-white/30" xmlns="http://www.w3.org/2000/svg">
|
|
30
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.7071 19.2071C16.0976 18.8166 16.0976 18.1834 15.7071 17.7929L9.91421 12L15.7071 6.20711C16.0976 5.81658 16.0976 5.18342 15.7071 4.79289C15.3166 4.40237 14.6834 4.40237 14.2929 4.79289L8.5 10.5858C7.71895 11.3668 7.71895 12.6332 8.5 13.4142L14.2929 19.2071C14.6834 19.5976 15.3166 19.5976 15.7071 19.2071Z"/>
|
|
31
|
-
</svg>
|
|
32
|
-
</div>
|
|
33
20
|
</slot>
|
|
34
21
|
</div>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
|
|
23
|
+
<div v-if="useLegend && cItems && cItems.length > 1" :class="$style.legend">
|
|
24
|
+
<div v-for="_index in cItems.length"
|
|
25
|
+
:class="$style.legendItem + (index === _index - 1 ? ` ${$style.legendItemActive}` : '')"
|
|
38
26
|
@click="index = _index - 1">
|
|
39
27
|
<slot name="legend">
|
|
40
|
-
|
|
28
|
+
<div></div>
|
|
41
29
|
</slot>
|
|
42
30
|
</div>
|
|
43
31
|
</div>
|
|
@@ -46,82 +34,126 @@
|
|
|
46
34
|
|
|
47
35
|
<script>
|
|
48
36
|
|
|
49
|
-
import {
|
|
37
|
+
import {componentMixin} from "../mixin/component";
|
|
50
38
|
|
|
51
39
|
export default{
|
|
52
40
|
|
|
53
|
-
|
|
41
|
+
computed: {
|
|
42
|
+
|
|
43
|
+
cItems(){
|
|
44
|
+
|
|
45
|
+
if(!this.dataKey)
|
|
46
|
+
return this.items
|
|
47
|
+
|
|
48
|
+
const page = this.getPage()
|
|
49
|
+
const obj = page.data?.find(_ => _.key === this.dataKey)
|
|
50
|
+
return obj ?
|
|
51
|
+
obj.value.map(_ => ({
|
|
52
|
+
...this.items[0],
|
|
53
|
+
data: _
|
|
54
|
+
})) :
|
|
55
|
+
[]
|
|
56
|
+
},
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
computedContainerClass(){
|
|
59
|
+
return [
|
|
60
|
+
this.$style.inner,
|
|
61
|
+
this.containerClass
|
|
62
|
+
]
|
|
63
|
+
.filter(_ => _)
|
|
64
|
+
.join(' ')
|
|
58
65
|
},
|
|
59
66
|
|
|
67
|
+
computedItemClass(){
|
|
68
|
+
return [
|
|
69
|
+
this.$style.item,
|
|
70
|
+
this.itemClass
|
|
71
|
+
]
|
|
72
|
+
.filter(_ => _)
|
|
73
|
+
.join(' ')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
mixins: [ componentMixin ],
|
|
79
|
+
|
|
80
|
+
props:{
|
|
81
|
+
|
|
82
|
+
data: Object,
|
|
83
|
+
|
|
84
|
+
dataKey: String,
|
|
85
|
+
|
|
86
|
+
items: Array,
|
|
87
|
+
|
|
60
88
|
infinite: {
|
|
61
|
-
type:
|
|
89
|
+
type: undefined,
|
|
62
90
|
default: false
|
|
63
91
|
},
|
|
64
92
|
|
|
65
|
-
|
|
66
|
-
ratioDesktop: String,
|
|
93
|
+
ratio: Array,
|
|
67
94
|
|
|
68
|
-
|
|
69
|
-
type: String,
|
|
70
|
-
default: "w-full"
|
|
71
|
-
}
|
|
95
|
+
autoPlay: [ Number, String ],
|
|
72
96
|
|
|
73
|
-
|
|
97
|
+
useLegend: [ Boolean, Number ],
|
|
74
98
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
computed: {
|
|
99
|
+
},
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
emits: [ 'change' ],
|
|
80
102
|
|
|
81
103
|
data(){
|
|
82
104
|
return {
|
|
83
|
-
count: 0,
|
|
84
105
|
index: 0,
|
|
85
|
-
|
|
106
|
+
timeoutId: null,
|
|
107
|
+
scrollPosition: null,
|
|
108
|
+
swiping: false,
|
|
86
109
|
}
|
|
87
110
|
},
|
|
88
111
|
|
|
89
112
|
mounted(){
|
|
90
|
-
this.
|
|
113
|
+
window.addEventListener('touchmove', this.onTouchMove, { passive: false });
|
|
114
|
+
if(this.autoPlay > 0)
|
|
115
|
+
this.play()
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
unmounted() {
|
|
119
|
+
window.removeEventListener('touchmove', this.onTouchMove, { passive: false });
|
|
91
120
|
},
|
|
92
121
|
|
|
93
122
|
watch:{
|
|
94
123
|
|
|
95
|
-
index(to
|
|
96
|
-
this
|
|
97
|
-
this.$emit('changed', to)
|
|
124
|
+
index(to){
|
|
125
|
+
this.$emit('change', to)
|
|
98
126
|
},
|
|
99
127
|
|
|
100
|
-
|
|
128
|
+
items(){
|
|
101
129
|
this.index = 0
|
|
102
|
-
}
|
|
130
|
+
},
|
|
103
131
|
|
|
104
132
|
},
|
|
105
133
|
|
|
106
134
|
methods:{
|
|
107
135
|
|
|
108
|
-
|
|
109
|
-
if(this.
|
|
110
|
-
e.preventDefault()
|
|
111
|
-
e.
|
|
136
|
+
onTouchMove(e){
|
|
137
|
+
if(this.swiping && e.cancelable) {
|
|
138
|
+
e.preventDefault();
|
|
139
|
+
e.returnValue = false;
|
|
140
|
+
return false;
|
|
112
141
|
}
|
|
113
142
|
},
|
|
114
143
|
|
|
115
|
-
|
|
144
|
+
setPosition(noAnimation) {
|
|
145
|
+
if(!this.$refs.inner) return
|
|
116
146
|
|
|
117
|
-
|
|
147
|
+
const index = this.index
|
|
148
|
+
let left = 0
|
|
149
|
+
const gapPx = parseInt(window.getComputedStyle(this.$refs.inner).getPropertyValue('column-gap'))
|
|
150
|
+
for(let curIndex = 0 ; curIndex < this.cItems.length ; curIndex++){
|
|
151
|
+
const item = this.$refs.inner.children[curIndex]
|
|
152
|
+
if(curIndex < index)
|
|
153
|
+
left += (item.clientWidth + (!isNaN(gapPx) ? gapPx : 0))
|
|
154
|
+
}
|
|
118
155
|
|
|
119
|
-
|
|
120
|
-
this.$el.querySelectorAll('img').forEach((img, curIndex) => {
|
|
121
|
-
if(curIndex < index)
|
|
122
|
-
left += img.clientWidth
|
|
123
|
-
})
|
|
124
|
-
left *= -1
|
|
156
|
+
left *= -1
|
|
125
157
|
|
|
126
158
|
if(!noAnimation){
|
|
127
159
|
this.$el.firstElementChild.addEventListener('transitionend', function(){
|
|
@@ -130,22 +162,30 @@ export default{
|
|
|
130
162
|
this.$el.firstElementChild.classList.add('transition-carousel')
|
|
131
163
|
}
|
|
132
164
|
|
|
133
|
-
|
|
134
|
-
|
|
165
|
+
window.requestAnimationFrame(() => {
|
|
166
|
+
this.$el.firstElementChild.style.transform = `translate3d(${left}px, 0, 0)`
|
|
167
|
+
})
|
|
168
|
+
},
|
|
135
169
|
|
|
136
|
-
|
|
170
|
+
setIndex(index){
|
|
171
|
+
if(index >= 0 && index < this.cItems.length){
|
|
172
|
+
this.index = index
|
|
173
|
+
this.setPosition()
|
|
174
|
+
}
|
|
175
|
+
},
|
|
137
176
|
|
|
177
|
+
next(useBack){
|
|
138
178
|
let index = this.index + 1
|
|
139
179
|
|
|
140
|
-
if(index >= this.
|
|
141
|
-
index =
|
|
180
|
+
if(index >= this.cItems.length)
|
|
181
|
+
index = useBack === true ? 0 : this.cItems.length - 1
|
|
142
182
|
|
|
143
183
|
this.index = index
|
|
144
184
|
|
|
145
|
-
|
|
185
|
+
this.setPosition()
|
|
146
186
|
},
|
|
147
187
|
|
|
148
|
-
prev(
|
|
188
|
+
prev(){
|
|
149
189
|
|
|
150
190
|
let index = this.index - 1;
|
|
151
191
|
|
|
@@ -153,44 +193,68 @@ export default{
|
|
|
153
193
|
|
|
154
194
|
this.index = index
|
|
155
195
|
|
|
156
|
-
|
|
196
|
+
this.setPosition()
|
|
157
197
|
},
|
|
158
198
|
|
|
159
|
-
|
|
199
|
+
play(){
|
|
200
|
+
if(this.autoPlay > 0)
|
|
201
|
+
this.timeoutId = window.setTimeout(() => { this.next(true); this.play() }, this.autoPlay)
|
|
202
|
+
},
|
|
160
203
|
|
|
161
|
-
|
|
204
|
+
stop(){
|
|
205
|
+
if(this.timeoutId)
|
|
206
|
+
window.clearTimeout(this.timeoutId)
|
|
207
|
+
},
|
|
162
208
|
|
|
209
|
+
mouseMove(e){
|
|
163
210
|
const sx = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
|
|
211
|
+
const sy = typeof e.touches !== 'undefined' ? e.touches[0].clientY : e.clientY
|
|
164
212
|
const dx = sx - this._props['sx']
|
|
165
|
-
const
|
|
213
|
+
const dy = sy - this._props['sy']
|
|
214
|
+
|
|
215
|
+
if(!this._props['direction']){
|
|
216
|
+
if(Math.abs(dx) > 3){
|
|
217
|
+
this._props['direction'] = 'horizontal'
|
|
218
|
+
this.swiping = true
|
|
219
|
+
}
|
|
220
|
+
else if(Math.abs(dy) > 3){
|
|
221
|
+
this._props['direction'] = 'vertical'
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else if(this._props['direction'] === 'horizontal'){
|
|
225
|
+
let ix
|
|
226
|
+
if((this.index === this.cItems.length - 1 && dx < 0) ||
|
|
227
|
+
(this.index === 0 && dx > 0)){
|
|
228
|
+
ix = parseInt(this._props['ix'] + (dx * .19812))
|
|
229
|
+
}
|
|
230
|
+
else{
|
|
231
|
+
ix = parseInt(this._props['ix'] + dx)
|
|
232
|
+
}
|
|
166
233
|
|
|
167
|
-
|
|
234
|
+
this.$el.firstElementChild.style.transform = `translate3d(${ix}px, 0, 0)`
|
|
235
|
+
}
|
|
168
236
|
|
|
169
|
-
this.$el.firstElementChild.style.transform = `translate3d(${ix}px, 0, 0)`
|
|
170
237
|
},
|
|
171
238
|
|
|
172
239
|
mouseUp(e){
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (tn < 1200){
|
|
186
|
-
dx < 0 ? this.next(true) : this.prev(true)
|
|
240
|
+
if(this._props['direction'] === 'horizontal'){
|
|
241
|
+
const tn = e.timeStamp - this._props['t0']
|
|
242
|
+
const sx = typeof e.changedTouches !== 'undefined' ? e.changedTouches[0].clientX : e.clientX
|
|
243
|
+
const dx = sx - this._props['sx']
|
|
244
|
+
|
|
245
|
+
if (Math.abs(dx) > 10) {
|
|
246
|
+
if (tn < 1200){
|
|
247
|
+
dx < 0 ? this.next() : this.prev()
|
|
248
|
+
}
|
|
249
|
+
else{
|
|
250
|
+
this.setPosition()
|
|
251
|
+
}
|
|
187
252
|
}
|
|
188
253
|
else{
|
|
189
254
|
this.setPosition()
|
|
190
255
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.setPosition()
|
|
256
|
+
|
|
257
|
+
this.swiping = false
|
|
194
258
|
}
|
|
195
259
|
|
|
196
260
|
window.removeEventListener('mousemove', this.mouseMove)
|
|
@@ -198,25 +262,28 @@ export default{
|
|
|
198
262
|
window.removeEventListener('mouseout', this.mouseUp)
|
|
199
263
|
window.removeEventListener('touchmove', this.mouseMove)
|
|
200
264
|
window.removeEventListener('touchend', this.mouseUp)
|
|
265
|
+
|
|
266
|
+
if(this.autoPlay > 0)
|
|
267
|
+
this.play()
|
|
201
268
|
},
|
|
202
269
|
|
|
203
270
|
mouseDown(e){
|
|
204
|
-
|
|
205
|
-
if(!this.images || this.images.length <= 1)
|
|
271
|
+
if(!this.cItems || this.cItems.length <= 1)
|
|
206
272
|
return
|
|
207
273
|
|
|
274
|
+
this.stop()
|
|
275
|
+
|
|
208
276
|
var matches = this.$el.firstElementChild.style.transform.match(/translate3d\((.*?)(?=\,)/)
|
|
209
277
|
var ix = matches != null && typeof matches[1] != 'undefined' ? parseInt(matches[1].replace('px', '')) : 0
|
|
210
278
|
|
|
211
279
|
this._props = {
|
|
212
280
|
sx:typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX,
|
|
281
|
+
sy:typeof e.touches !== 'undefined' ? e.touches[0].clientY : e.clientY,
|
|
213
282
|
ix:ix,
|
|
214
283
|
t0:e.timeStamp,
|
|
215
|
-
|
|
284
|
+
direction: null
|
|
216
285
|
}
|
|
217
286
|
|
|
218
|
-
//console.log('mousedown', this._props, this.count)
|
|
219
|
-
|
|
220
287
|
window.addEventListener('mousemove', this.mouseMove)
|
|
221
288
|
window.addEventListener('mouseup', this.mouseUp)
|
|
222
289
|
window.addEventListener('mouseout', this.mouseUp)
|
|
@@ -250,44 +317,47 @@ export default{
|
|
|
250
317
|
|
|
251
318
|
<style module>
|
|
252
319
|
|
|
253
|
-
.
|
|
320
|
+
.comp{
|
|
254
321
|
white-space: nowrap;
|
|
255
322
|
overflow: hidden;
|
|
256
323
|
position: relative;
|
|
257
|
-
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.comp img{
|
|
327
|
+
pointer-events: none;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.carouselNext{
|
|
331
|
+
@apply absolute top-0 bottom-0 right-0 w-[20px];
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.carouselPrev{
|
|
335
|
+
@apply absolute top-0 bottom-0 left-0 w-[20px];
|
|
258
336
|
}
|
|
259
337
|
|
|
260
338
|
.inner{
|
|
261
339
|
white-space: nowrap;
|
|
262
340
|
will-change: transform;
|
|
263
|
-
|
|
341
|
+
@apply flex flex-row items-stretch;
|
|
264
342
|
}
|
|
265
343
|
.inner>*{
|
|
266
344
|
display: inline-block;
|
|
267
345
|
width: 100%;
|
|
268
|
-
|
|
346
|
+
min-width: 100%;
|
|
269
347
|
vertical-align: top;
|
|
270
348
|
}
|
|
271
349
|
|
|
272
350
|
.legend{
|
|
273
|
-
|
|
274
|
-
bottom: 6px;
|
|
275
|
-
left: 50%;
|
|
276
|
-
transform: translate3d(-50%, 0, 0);
|
|
351
|
+
@apply flex justify-center gap-2 py-1;
|
|
277
352
|
}
|
|
278
|
-
.legend .
|
|
279
|
-
display: inline-block;
|
|
353
|
+
.legend .legendItem{
|
|
280
354
|
}
|
|
281
|
-
.legend .
|
|
282
|
-
|
|
283
|
-
height: 12px;
|
|
284
|
-
border-radius: 100%;
|
|
285
|
-
background: rgba(0, 0, 0, .2);
|
|
286
|
-
margin: 0 3px;
|
|
287
|
-
display: inline-block;
|
|
355
|
+
.legend .legendItem>*{
|
|
356
|
+
@apply w-2 h-2 rounded-full bg-gray-100;
|
|
288
357
|
}
|
|
289
|
-
.legend .
|
|
290
|
-
|
|
358
|
+
.legend .legendItemActive>*{
|
|
359
|
+
@apply bg-primary-500;
|
|
291
360
|
}
|
|
292
361
|
|
|
293
|
-
|
|
362
|
+
|
|
363
|
+
</style>
|