@mixd-id/web-scaffold 0.1.230406110 → 0.1.230406112
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/Ahref.vue +175 -7
- package/src/components/Testimonial.vue +86 -0
- package/src/components/TreeViewItem.vue +4 -2
- package/src/index.js +5 -0
- package/src/mixin/component.js +9 -0
- package/src/widgets/AhrefItem.vue +25 -0
- package/src/widgets/AhrefSetting.vue +91 -0
- package/src/widgets/ComponentSetting.vue +1 -1
- package/src/widgets/TestimonialItem.vue +25 -0
- package/src/widgets/TestimonialSetting.vue +152 -0
- package/src/widgets/WebPageBuilder.vue +7 -0
package/package.json
CHANGED
package/src/components/Ahref.vue
CHANGED
|
@@ -1,31 +1,199 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<a v-if="isExternalLink" :href="href" :target="target">
|
|
3
|
-
<slot
|
|
2
|
+
<a v-if="isExternalLink" :href="href" :target="target" :class="compClass">
|
|
3
|
+
<slot>{{ text }}</slot>
|
|
4
4
|
</a>
|
|
5
|
-
<router-link v-else :to="href" :target="target">
|
|
6
|
-
<slot
|
|
5
|
+
<router-link v-else :to="href" :target="target" :class="compClass">
|
|
6
|
+
<slot>{{ text }}</slot>
|
|
7
7
|
</router-link>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
11
|
|
|
12
|
+
import {componentMixin} from "../mixin/component";
|
|
13
|
+
|
|
12
14
|
export default {
|
|
13
15
|
|
|
16
|
+
mixins: [ componentMixin ],
|
|
17
|
+
|
|
14
18
|
props: {
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
|
|
20
|
+
href: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: ''
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
target: String,
|
|
26
|
+
|
|
27
|
+
text: String,
|
|
28
|
+
|
|
29
|
+
variant: {
|
|
30
|
+
type: [ String, Number ],
|
|
31
|
+
default: "primary" // primary|secondary|outline, default:primary
|
|
32
|
+
},
|
|
17
33
|
},
|
|
18
34
|
|
|
19
35
|
computed: {
|
|
20
36
|
|
|
21
37
|
isExternalLink() {
|
|
22
38
|
return typeof this.href === 'string' && this.href.indexOf('://') > 0
|
|
23
|
-
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
compClass(){
|
|
42
|
+
return [
|
|
43
|
+
this.$style.button,
|
|
44
|
+
this.$style['button-' + this.variant]
|
|
45
|
+
]
|
|
46
|
+
.filter(_ => _)
|
|
47
|
+
.join(' ')
|
|
48
|
+
},
|
|
24
49
|
},
|
|
25
50
|
}
|
|
26
51
|
</script>
|
|
27
52
|
|
|
28
53
|
<style module>
|
|
29
54
|
|
|
55
|
+
.button{
|
|
56
|
+
@apply p-2 h-[var(--h-cp)];
|
|
57
|
+
@apply relative flex items-center justify-center;
|
|
58
|
+
@apply whitespace-nowrap text-ellipsis overflow-hidden;
|
|
59
|
+
@apply rounded-lg;
|
|
60
|
+
background-image: v-bind(bgImages[0]);
|
|
61
|
+
}
|
|
62
|
+
.button>*:first-child{
|
|
63
|
+
@apply flex items-center justify-center
|
|
64
|
+
}
|
|
65
|
+
.button:disabled{
|
|
66
|
+
@apply opacity-60;
|
|
67
|
+
}
|
|
68
|
+
.button:active{
|
|
69
|
+
@apply top-[1px] left-[1px] relative;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.button-primary{
|
|
73
|
+
@apply bg-primary-500 text-white rounded-lg;
|
|
74
|
+
box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
|
|
75
|
+
outline: solid 1px rgb(var(--primary-700));
|
|
76
|
+
border: solid 1px rgb(var(--primary-400));
|
|
77
|
+
}
|
|
78
|
+
.button-primary:focus{
|
|
79
|
+
outline-color: rgb(var(--primary-800));
|
|
80
|
+
border-color: rgb(var(--primary-600));
|
|
81
|
+
}
|
|
82
|
+
.button-primary:hover{
|
|
83
|
+
@apply bg-primary-600;
|
|
84
|
+
outline-color: rgb(var(--primary-800))
|
|
85
|
+
}
|
|
86
|
+
.button-primary:disabled{
|
|
87
|
+
@apply bg-primary-500 opacity-50 top-0 left-0 cursor-not-allowed;
|
|
88
|
+
@apply top-0 left-0;
|
|
89
|
+
outline: solid 1px rgb(var(--primary-700));
|
|
90
|
+
}
|
|
91
|
+
.button-primary *{
|
|
92
|
+
@apply text-white fill-white;
|
|
93
|
+
}
|
|
94
|
+
.button-primary.loading *{
|
|
95
|
+
@apply fill-transparent
|
|
96
|
+
}
|
|
97
|
+
.button-primary .svgBg{
|
|
98
|
+
stroke: #fff;
|
|
99
|
+
stroke-opacity: 25%;
|
|
100
|
+
}
|
|
101
|
+
.button-primary .svgHg{
|
|
102
|
+
fill: #fff;
|
|
103
|
+
fill-opacity: 75%;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.button-outline{
|
|
107
|
+
@apply bg-transparent text-primary-500;
|
|
108
|
+
outline: solid 1px rgb(var(--primary-700));
|
|
109
|
+
}
|
|
110
|
+
.button-outline:hover{
|
|
111
|
+
outline-color: rgb(var(--primary-800))
|
|
112
|
+
}
|
|
113
|
+
.button-outline:disabled{
|
|
114
|
+
@apply opacity-50 top-0 left-0 cursor-not-allowed;
|
|
115
|
+
@apply text-text border-primary-500;
|
|
116
|
+
}
|
|
117
|
+
.button-outline *{
|
|
118
|
+
@apply text-primary-500 fill-primary-500;
|
|
119
|
+
}
|
|
120
|
+
.button-outline.loading *{
|
|
121
|
+
@apply fill-transparent
|
|
122
|
+
}
|
|
123
|
+
.button-outline .svgBg{
|
|
124
|
+
stroke: rgb(var(--primary-600));
|
|
125
|
+
stroke-opacity: 50%;
|
|
126
|
+
}
|
|
127
|
+
.button-outline .svgHg{
|
|
128
|
+
fill: rgb(var(--primary));
|
|
129
|
+
fill-opacity: 100%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.button-secondary{
|
|
133
|
+
@apply bg-secondary text-text-500 rounded-lg;
|
|
134
|
+
box-shadow: 0 2px 1px rgba(0, 0, 0, .05);
|
|
135
|
+
outline: solid 1px rgb(var(--secondary-700));
|
|
136
|
+
border: solid 1px rgb(var(--secondary-400));
|
|
137
|
+
}
|
|
138
|
+
.button-secondary:hover{
|
|
139
|
+
@apply bg-secondary-600;
|
|
140
|
+
outline-color: rgb(var(--secondary-800))
|
|
141
|
+
}
|
|
142
|
+
.button-secondary:disabled{
|
|
143
|
+
@apply bg-secondary-500 opacity-50 top-0 left-0 cursor-not-allowed;
|
|
144
|
+
outline: solid 1px rgb(var(--secondary-700));
|
|
145
|
+
}
|
|
146
|
+
.button-secondary *{
|
|
147
|
+
@apply text-text-500 fill-white;
|
|
148
|
+
}
|
|
149
|
+
.button-secondary.loading *{
|
|
150
|
+
@apply fill-transparent
|
|
151
|
+
}
|
|
152
|
+
.button-secondary .svgBg{
|
|
153
|
+
stroke: rgb(var(--text-400));
|
|
154
|
+
stroke-opacity: 25%;
|
|
155
|
+
}
|
|
156
|
+
.button-secondary .svgHg{
|
|
157
|
+
fill: rgb(var(--text-500));
|
|
158
|
+
fill-opacity: 75%;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.button-red{
|
|
162
|
+
@apply bg-red-500 text-white rounded-md border-[2px] border-red-500;
|
|
163
|
+
}
|
|
164
|
+
.button-red:hover{
|
|
165
|
+
@apply bg-red-600 border-red-600;
|
|
166
|
+
}
|
|
167
|
+
.button-red:disabled{
|
|
168
|
+
@apply bg-red-500 border-red-500 opacity-50 top-0 left-0 cursor-not-allowed;
|
|
169
|
+
}
|
|
170
|
+
.button-red *{
|
|
171
|
+
@apply text-white fill-white;
|
|
172
|
+
}
|
|
173
|
+
.button-red.loading *{
|
|
174
|
+
@apply fill-transparent
|
|
175
|
+
}
|
|
176
|
+
.button-red .svgBg{
|
|
177
|
+
@apply stroke-red-400;
|
|
178
|
+
stroke-opacity: 50%;
|
|
179
|
+
}
|
|
180
|
+
.button-red .svgHg{
|
|
181
|
+
@apply fill-text-500;
|
|
182
|
+
fill-opacity: 100%;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.button-minimal{
|
|
186
|
+
@apply border-[2px] border-transparent;
|
|
187
|
+
}
|
|
188
|
+
.button-minimal:hover{
|
|
189
|
+
}
|
|
190
|
+
.button-minimal .svgBg{
|
|
191
|
+
stroke: rgb(var(--text-500));
|
|
192
|
+
stroke-opacity: 25%;
|
|
193
|
+
}
|
|
194
|
+
.button-minimal .svgHg{
|
|
195
|
+
fill: rgb(var(--text));
|
|
196
|
+
fill-opacity: 75%;
|
|
197
|
+
}
|
|
30
198
|
|
|
31
199
|
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
<div :class="$style.head">
|
|
4
|
+
<h2 v-if="title">{{ title }}</h2>
|
|
5
|
+
<p v-if="description" v-html="description"></p>
|
|
6
|
+
</div>
|
|
7
|
+
<div :class="$style.container">
|
|
8
|
+
<div v-for="item in items" :class="$style.item">
|
|
9
|
+
<div class="flex flex-col gap-2 flex-1">
|
|
10
|
+
<div class="flex justify-center">
|
|
11
|
+
<svg width="19" height="19" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M464 256h-80v-64c0-35.3 28.7-64 64-64h8c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24h-8c-88.4 0-160 71.6-160 160v240c0 26.5 21.5 48 48 48h128c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48zm-288 0H96v-64c0-35.3 28.7-64 64-64h8c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24h-8C71.6 32 0 103.6 0 192v240c0 26.5 21.5 48 48 48h128c26.5 0 48-21.5 48-48V304c0-26.5-21.5-48-48-48z"/></svg>
|
|
12
|
+
</div>
|
|
13
|
+
<p>{{ item.text }}</p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="h-[1px] bg-gray-200"></div>
|
|
16
|
+
<div class="flex flex-row items-center gap-2">
|
|
17
|
+
<Image class="w-[36px] aspect-square"
|
|
18
|
+
:src="imageSrc(item.imageUrl)" />
|
|
19
|
+
<div class="flex-1 flex flex-col leading-tight">
|
|
20
|
+
<div class="text-sm text-ellipsis overflow-hidden whitespace-nowrap">
|
|
21
|
+
{{ item.name }}
|
|
22
|
+
</div>
|
|
23
|
+
<small class="text-gray-500">
|
|
24
|
+
{{ dayjs(item.createdAt).format('D MMM YY') }}
|
|
25
|
+
</small>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
|
|
35
|
+
import { componentMixin } from '../mixin/component';
|
|
36
|
+
import dayjs from "dayjs";
|
|
37
|
+
|
|
38
|
+
export default{
|
|
39
|
+
|
|
40
|
+
mixins: [ componentMixin ],
|
|
41
|
+
|
|
42
|
+
props: {
|
|
43
|
+
|
|
44
|
+
title: String,
|
|
45
|
+
|
|
46
|
+
description: String,
|
|
47
|
+
|
|
48
|
+
items: Array
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
methods: {
|
|
53
|
+
|
|
54
|
+
dayjs
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style module>
|
|
63
|
+
|
|
64
|
+
.comp{
|
|
65
|
+
@apply flex-1 flex flex-col gap-4 bg-gray-100 overflow-hidden;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.head{
|
|
69
|
+
@apply text-center md:text-left;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.container{
|
|
73
|
+
@apply overflow-x-auto flex flex-row gap-8 md:gap-10 p-1;
|
|
74
|
+
}
|
|
75
|
+
.container::-webkit-scrollbar {
|
|
76
|
+
display: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.item{
|
|
80
|
+
@apply min-w-[200px] max-w-[200px] bg-white p-6 pb-3 shadow-md flex flex-col gap-2;
|
|
81
|
+
}
|
|
82
|
+
.item p{
|
|
83
|
+
@apply text-lg font-serif max-h-[225px] overflow-hidden;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
</style>
|
|
@@ -113,11 +113,12 @@ export default{
|
|
|
113
113
|
|
|
114
114
|
const rect = this.$el.getBoundingClientRect()
|
|
115
115
|
const startX = e.clientX
|
|
116
|
+
const startY = e.clientY
|
|
116
117
|
|
|
117
118
|
const cloned = this.$el.cloneNode(true)
|
|
118
119
|
cloned.style.position = 'absolute'
|
|
119
120
|
cloned.style.left = rect.x + "px"
|
|
120
|
-
cloned.style.top =
|
|
121
|
+
cloned.style.top = rect.y + "px"
|
|
121
122
|
cloned.style.width = this.$el.clientWidth + "px"
|
|
122
123
|
cloned.style.pointerEvents = 'none'
|
|
123
124
|
document.body.appendChild(cloned)
|
|
@@ -129,8 +130,9 @@ export default{
|
|
|
129
130
|
|
|
130
131
|
const mouseMove = (e) => {
|
|
131
132
|
const distanceX = e.clientX - startX
|
|
133
|
+
const distanceY = e.clientY - startY
|
|
132
134
|
cloned.style.left = (rect.x + distanceX) + "px"
|
|
133
|
-
cloned.style.top = (
|
|
135
|
+
cloned.style.top = (rect.y + distanceY) + "px"
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
const mouseUp = (e) => {
|
package/src/index.js
CHANGED
|
@@ -340,6 +340,7 @@ export default{
|
|
|
340
340
|
app.component('SplitPane', defineAsyncComponent(() => import("./components/SplitPane.vue")))
|
|
341
341
|
app.component('Table', defineAsyncComponent(() => import("./components/Table.vue")))
|
|
342
342
|
app.component('TabView', defineAsyncComponent(() => import("./components/TabView.vue")))
|
|
343
|
+
app.component('Testimonial', defineAsyncComponent(() => import("./components/Testimonial.vue")))
|
|
343
344
|
app.component('TextBlock', defineAsyncComponent(() => import("./components/TextBlock.vue")))
|
|
344
345
|
app.component('TextEditor', defineAsyncComponent(() => import("./components/TextEditor.vue")))
|
|
345
346
|
app.component('PaddingBox', defineAsyncComponent(() => import("./components/PaddingBox.vue")))
|
|
@@ -354,6 +355,8 @@ export default{
|
|
|
354
355
|
app.component('BlockSetting', defineAsyncComponent(() => import("./widgets/BlockSetting.vue")))
|
|
355
356
|
app.component('BoxItem', defineAsyncComponent(() => import("./widgets/BoxItem.vue")))
|
|
356
357
|
app.component('BoxSetting', defineAsyncComponent(() => import("./widgets/BoxSetting.vue")))
|
|
358
|
+
app.component('AhrefItem', defineAsyncComponent(() => import("./widgets/AhrefItem.vue")))
|
|
359
|
+
app.component('AhrefSetting', defineAsyncComponent(() => import("./widgets/AhrefSetting.vue")))
|
|
357
360
|
app.component('ButtonItem', defineAsyncComponent(() => import("./widgets/ButtonItem.vue")))
|
|
358
361
|
app.component('ButtonSetting', defineAsyncComponent(() => import("./widgets/ButtonSetting.vue")))
|
|
359
362
|
app.component('CarouselItem', defineAsyncComponent(() => import("./widgets/CarouselItem.vue")))
|
|
@@ -390,6 +393,8 @@ export default{
|
|
|
390
393
|
app.component('StyleSetting', defineAsyncComponent(() => import("./widgets/StyleSetting.vue")))
|
|
391
394
|
app.component('TableItem', defineAsyncComponent(() => import("./widgets/TableItem.vue")))
|
|
392
395
|
app.component('TableSetting', defineAsyncComponent(() => import("./widgets/TableSetting.vue")))
|
|
396
|
+
app.component('TestimonialItem', defineAsyncComponent(() => import("./widgets/TestimonialItem.vue")))
|
|
397
|
+
app.component('TestimonialSetting', defineAsyncComponent(() => import("./widgets/TestimonialSetting.vue")))
|
|
393
398
|
app.component('TextBlockItem', defineAsyncComponent(() => import("./widgets/TextBlockItem.vue")))
|
|
394
399
|
app.component('TextBlockSetting', defineAsyncComponent(() => import("./widgets/TextBlockSetting.vue")))
|
|
395
400
|
}
|
package/src/mixin/component.js
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-1 flex flex-row items-center gap-2">
|
|
3
|
+
{{ item.props.name ?? item.type }}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
export default{
|
|
10
|
+
|
|
11
|
+
props: {
|
|
12
|
+
item: Object
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style module>
|
|
20
|
+
|
|
21
|
+
.comp{
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<div>
|
|
5
|
+
<label class="flex-1 text-text-400">Text</label>
|
|
6
|
+
<Textbox v-model="item.props.text" @keyup.enter="$emit('change')"/>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<label class="flex-1 text-text-400">Href</label>
|
|
11
|
+
<Textbox v-model="item.props.href" @keyup.enter="$emit('change')"/>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<label class="flex-1 text-text-400">Target</label>
|
|
16
|
+
<Dropdown v-model="item.props.target" @change="$emit('change')">
|
|
17
|
+
<option value="_self">Self</option>
|
|
18
|
+
<option value="_blank">Blank</option>
|
|
19
|
+
<option value="_parent">Parent</option>
|
|
20
|
+
<option value="_top">Top</option>
|
|
21
|
+
</Dropdown>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div>
|
|
25
|
+
<label class="flex-1 text-text-400">Variant</label>
|
|
26
|
+
<Dropdown v-model="item.props.variant"
|
|
27
|
+
@change="$emit('change')">
|
|
28
|
+
<option value="primary">Primary</option>
|
|
29
|
+
<option value="secondary">Secondary</option>
|
|
30
|
+
<option value="red">Red</option>
|
|
31
|
+
<option value="minimal">Minimal</option>
|
|
32
|
+
<option value="outline">Outline</option>
|
|
33
|
+
<option value="">Not Set</option>
|
|
34
|
+
</Dropdown>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<ComponentSetting :item="item"
|
|
38
|
+
:view-type="viewType"
|
|
39
|
+
:view-types="viewTypes"
|
|
40
|
+
defaultDisplay="flex"
|
|
41
|
+
@change="$emit('change')" />
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
|
|
48
|
+
export default{
|
|
49
|
+
|
|
50
|
+
emits: [ 'change' ],
|
|
51
|
+
|
|
52
|
+
props: {
|
|
53
|
+
|
|
54
|
+
item: {
|
|
55
|
+
type: Object,
|
|
56
|
+
required: true
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
viewType: String,
|
|
60
|
+
|
|
61
|
+
viewTypes: Array,
|
|
62
|
+
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
data(){
|
|
66
|
+
return {
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
inject: [ 'confirm', 'imageSrc' ],
|
|
71
|
+
|
|
72
|
+
methods: {
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
computed: {
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style module>
|
|
86
|
+
|
|
87
|
+
.comp{
|
|
88
|
+
@apply flex flex-col gap-4;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
</style>
|
|
@@ -421,7 +421,7 @@
|
|
|
421
421
|
|
|
422
422
|
<div class="flex flex-col gap-4">
|
|
423
423
|
|
|
424
|
-
<
|
|
424
|
+
<strong class="flex-1 text-text-400">Shadow</strong>
|
|
425
425
|
|
|
426
426
|
<div class="flex flex-row items-center gap-4">
|
|
427
427
|
<label class="flex-1 text-text-400">Box Shadow</label>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex-1 flex flex-row items-center gap-2">
|
|
3
|
+
{{ item.props.name ?? item.type }}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
export default{
|
|
10
|
+
|
|
11
|
+
props: {
|
|
12
|
+
item: Object
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style module>
|
|
20
|
+
|
|
21
|
+
.comp{
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
<div>
|
|
4
|
+
<label class="text-text-400">Title</label>
|
|
5
|
+
<Textbox v-model="item.props.title" class="mt-1" />
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div>
|
|
9
|
+
<label class="text-text-400">Description</label>
|
|
10
|
+
<Textarea v-model="item.props.description" rows="3" class="mt-1" />
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div>
|
|
14
|
+
<div class="flex flex-row items-center">
|
|
15
|
+
<label class="text-text-400 flex-1">Testimonials</label>
|
|
16
|
+
<button type="button" class="text-primary" @click="$refs.modal.open({ createdAt:'2023-01-01' })">Add</button>
|
|
17
|
+
</div>
|
|
18
|
+
<ListItem :items="items"
|
|
19
|
+
@reorder="(from, to) => { items.splice(to, 0, items.splice(from, 1)[0]); $emit('change') }">
|
|
20
|
+
<template v-slot="{ item, index }">
|
|
21
|
+
<div class="flex flex-row items-center gap-3 cursor-pointer">
|
|
22
|
+
<div data-reorder>
|
|
23
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496 288H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-128H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h480c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16z"/></svg>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex-1 p-2" @click="$refs.modal.open(item)">
|
|
26
|
+
<p class="line-clamp-2">
|
|
27
|
+
{{ item.text }}
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
<div>
|
|
31
|
+
<button type="button" @click="confirm($t('Remove this item?'), '', () => { items.splice(index, 1); $emit('change') })">
|
|
32
|
+
<svg width="16" height="16" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"/></svg>
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</ListItem>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<Modal ref="modal" width="360" height="420">
|
|
41
|
+
<template v-slot:head>
|
|
42
|
+
<div class="relative p-5">
|
|
43
|
+
<h3>Add Testimonial</h3>
|
|
44
|
+
<div class="absolute top-0 right-0 p-2">
|
|
45
|
+
<button type="button" class="p-2" @click="$refs.modal.close()">
|
|
46
|
+
<svg width="24" height="24" viewBox="0 0 24 24" class="fill-text-300 hover:fill-red-500" xmlns="http://www.w3.org/2000/svg">
|
|
47
|
+
<path d="M6.53034 5.46965C6.23745 5.17676 5.76257 5.17676 5.46968 5.46965C5.17679 5.76255 5.17679 6.23742 5.46968 6.53031L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0606L17.4697 18.5303C17.7626 18.8232 18.2375 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53032C18.8232 6.23743 18.8232 5.76256 18.5303 5.46966C18.2374 5.17677 17.7626 5.17677 17.4697 5.46966L12 10.9393L6.53034 5.46965Z"/>
|
|
48
|
+
</svg>
|
|
49
|
+
</button>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<template v-slot:foot="{ context }">
|
|
54
|
+
<div class="p-6">
|
|
55
|
+
<Button @click="apply(context)"
|
|
56
|
+
:state="!context.text || !context.name || !context.createdAt ? -1 : 1"
|
|
57
|
+
class="w-full">Add Testimonial</Button>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<template #default="{ context }">
|
|
61
|
+
<div class="flex-1 p-6 flex flex-col gap-6">
|
|
62
|
+
<Textarea v-model="context.text" rows="5" placeholder="Text"></Textarea>
|
|
63
|
+
<div class="flex flex-row gap-4 items-center">
|
|
64
|
+
<Image ref="image" class="w-[64px] aspect-square rounded-full bg-text-50"
|
|
65
|
+
:src="imageSrc(context.imageUrl)"
|
|
66
|
+
:editable="true"
|
|
67
|
+
@click="$refs.image.edit()"
|
|
68
|
+
@change="(base64, file) => context.imageUrl = file"/>
|
|
69
|
+
<div class="flex-1 flex flex-col gap-1">
|
|
70
|
+
<Textbox v-model="context.name" placeholder="Name" />
|
|
71
|
+
<Datepicker v-model="context.createdAt" placeholder="Time" mode="popup" />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
</Modal>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<ComponentSetting :item="item"
|
|
80
|
+
:view-type="viewType"
|
|
81
|
+
:view-types="viewTypes"
|
|
82
|
+
default-display="block"
|
|
83
|
+
@change="$emit('change')" />
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script>
|
|
88
|
+
|
|
89
|
+
export default{
|
|
90
|
+
|
|
91
|
+
emits: [ 'change' ],
|
|
92
|
+
|
|
93
|
+
inject: [ 'confirm', 'imageSrc', 'socketEmit2' ],
|
|
94
|
+
|
|
95
|
+
methods: {
|
|
96
|
+
|
|
97
|
+
apply(item){
|
|
98
|
+
|
|
99
|
+
const index = this.item.props.items.indexOf(item)
|
|
100
|
+
if(index === -1){
|
|
101
|
+
this.item.props.items.push(item)
|
|
102
|
+
}
|
|
103
|
+
else{
|
|
104
|
+
Object.assign(this.item.props.items[index], item)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
this.$refs.modal.close()
|
|
108
|
+
this.$emit('change')
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
save(){
|
|
112
|
+
this.$emit('save')
|
|
113
|
+
this.close()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
props: {
|
|
119
|
+
|
|
120
|
+
item: {
|
|
121
|
+
type: Object,
|
|
122
|
+
required: true
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
viewType: String,
|
|
126
|
+
|
|
127
|
+
viewTypes: Array,
|
|
128
|
+
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
computed: {
|
|
132
|
+
|
|
133
|
+
items(){
|
|
134
|
+
if(!Array.isArray(this.item.props.items)){
|
|
135
|
+
this.item.props.items = []
|
|
136
|
+
}
|
|
137
|
+
return this.item.props.items
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style module>
|
|
147
|
+
|
|
148
|
+
.comp{
|
|
149
|
+
@apply flex flex-col gap-4;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
</style>
|
|
@@ -993,10 +993,17 @@ export default{
|
|
|
993
993
|
channels:[],
|
|
994
994
|
}},
|
|
995
995
|
|
|
996
|
+
{ type:'Testimonial', name:'Testimonial', group:'Widgets', props:{
|
|
997
|
+
}},
|
|
998
|
+
|
|
996
999
|
{ type:'Header', name:'Header', group:'Headers', props:{
|
|
997
1000
|
htmlText:'', images:{},
|
|
998
1001
|
}},
|
|
999
1002
|
|
|
1003
|
+
{ type:'Ahref', name:'Ahref', group:'Components', props:{
|
|
1004
|
+
name:'Ahref', text:'Ahref'
|
|
1005
|
+
}},
|
|
1006
|
+
|
|
1000
1007
|
{ type:'Button', name:'Button', group:'Components', props:{
|
|
1001
1008
|
name:'Button', text:'Button'
|
|
1002
1009
|
}},
|