@mixd-id/web-scaffold 0.1.230406311 → 0.1.230406313
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/App.vue +9 -1
- package/src/components/Carousel.vue +3 -3
- package/src/components/ColorPicker2.vue +1 -1
- package/src/components/Image.vue +5 -3
- package/src/components/List.vue +48 -13
- package/src/components/Modal.vue +2 -2
- package/src/components/Text.vue +34 -0
- package/src/components/Textbox.vue +1 -1
- package/src/components/VirtualTable.vue +124 -95
- package/src/index.js +22 -38
- package/src/main.js +0 -9
- package/src/mixin/component.js +2 -1
- package/src/utils/preset-selector.js +53 -24
- package/src/utils/preset-selector.mjs +21 -1
- package/src/utils/wss.js +6 -1
- package/src/utils/wss.mjs +2 -2
- package/src/widgets/PresetBar.vue +6 -0
- package/src/widgets/WebPageBuilder3.vue +3 -218
- 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 +65 -0
- package/src/widgets/WebPageBuilder4/CarouselSetting.vue +178 -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 +96 -0
- package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -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/MarginSetting.vue +64 -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/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 +176 -0
- package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +298 -0
- package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +141 -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 +798 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
<div ref="item"
|
|
4
|
+
:class="`${$style.item}${item.uid === value ? ' ' + $style.active : ''}`"
|
|
5
|
+
@click="$emit('change', item.uid)"
|
|
6
|
+
@mousedown="mouseDown"
|
|
7
|
+
@mousemove="hoverMouseOver"
|
|
8
|
+
@mouseout="hoverMouseOut">
|
|
9
|
+
<button type="button" class="p-1 px-2 w-[18px]"
|
|
10
|
+
v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
|
|
11
|
+
@click="currentConfig.childCollapsed = !currentConfig.childCollapsed">
|
|
12
|
+
<svg v-if="!currentConfig.childCollapsed" width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z"/></svg>
|
|
13
|
+
<svg v-else width="14" height="14" class="fill-text-300 pointer-events-none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"/></svg>
|
|
14
|
+
</button>
|
|
15
|
+
<div class="flex-1 flex">
|
|
16
|
+
<slot name="item" :item="item" :parent="parent"></slot>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div v-if="item.isContainer && !currentConfig.childCollapsed && Array.isArray(item.items) && item.items.length > 0"
|
|
21
|
+
ref="container"
|
|
22
|
+
class="ml-6 flex flex-col gap-1">
|
|
23
|
+
<TreeViewItem v-for="subItem in item.items"
|
|
24
|
+
:parent="item.items"
|
|
25
|
+
:config="config"
|
|
26
|
+
@change="(uid) => $emit('change', uid)"
|
|
27
|
+
:value="value"
|
|
28
|
+
:item="subItem">
|
|
29
|
+
<template #item="{ item, parent }">
|
|
30
|
+
<slot name="item" :item="item" :parent="parent"></slot>
|
|
31
|
+
</template>
|
|
32
|
+
</TreeViewItem>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
|
|
39
|
+
let dragged = null
|
|
40
|
+
let guide1 = null
|
|
41
|
+
|
|
42
|
+
export default{
|
|
43
|
+
components: {
|
|
44
|
+
TreeViewItem: () => import('./TreeViewItem.vue')
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
emits: [ 'change' ],
|
|
48
|
+
|
|
49
|
+
name: 'TreeViewItem',
|
|
50
|
+
|
|
51
|
+
props: {
|
|
52
|
+
item: {
|
|
53
|
+
type: Object,
|
|
54
|
+
required: true,
|
|
55
|
+
validator(v){
|
|
56
|
+
return 'uid' in v
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
parent: Array,
|
|
60
|
+
config: Object,
|
|
61
|
+
value: String,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
computed: {
|
|
65
|
+
|
|
66
|
+
currentConfig(){
|
|
67
|
+
if(!this.config[this.item.uid])
|
|
68
|
+
this.config[this.item.uid] = {}
|
|
69
|
+
return this.config[this.item.uid]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
methods: {
|
|
75
|
+
|
|
76
|
+
createGuide(){
|
|
77
|
+
const el = document.createElement('div')
|
|
78
|
+
el.classList.add(this.$style.guide)
|
|
79
|
+
return el
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
hoverMouseOver(e){
|
|
83
|
+
if(!dragged) return
|
|
84
|
+
console.log(this.item.uid, dragged.item.uid)
|
|
85
|
+
if(this.item.uid === dragged.item.uid) return
|
|
86
|
+
|
|
87
|
+
// Drag to own child is not allowed
|
|
88
|
+
if(dragged.item.items && dragged.item.items.indexOf(this.item) > -1){
|
|
89
|
+
return
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if(!guide1){
|
|
93
|
+
guide1 = this.createGuide()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if(dragged.target !== this.item){
|
|
97
|
+
const rect = this.$refs.item.getBoundingClientRect()
|
|
98
|
+
const hasChildItems = Array.isArray(this.item.items)
|
|
99
|
+
|
|
100
|
+
dragged.targetArea = hasChildItems ? [
|
|
101
|
+
Math.round(rect.y + (rect.height * (2 / 3))),
|
|
102
|
+
Math.round(rect.y + (rect.height * (1 / 3))),
|
|
103
|
+
0
|
|
104
|
+
] : [
|
|
105
|
+
Math.round(rect.y + (rect.height * (1/2))),
|
|
106
|
+
0
|
|
107
|
+
]
|
|
108
|
+
//dragged.centerY = rect.y + (rect.height / 2)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
dragged.target = this.item
|
|
112
|
+
dragged.targetParent = this.parent
|
|
113
|
+
|
|
114
|
+
for(let i in dragged.targetArea){
|
|
115
|
+
if(e.clientY > dragged.targetArea[i]){
|
|
116
|
+
dragged.dragArea = dragged.targetArea.length - i
|
|
117
|
+
break
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if(dragged.targetArea.length === 3){
|
|
121
|
+
dragged.dragArea = dragged.dragArea === 2 ? 3 :
|
|
122
|
+
(dragged.dragArea === 3 ? 2 : 1)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
this.$refs.item.classList.remove(this.$style.dragInto)
|
|
126
|
+
if(dragged.dragArea === 1){
|
|
127
|
+
this.$el.insertBefore(guide1, this.$el.firstElementChild)
|
|
128
|
+
}
|
|
129
|
+
else if(dragged.dragArea === 2){
|
|
130
|
+
this.$el.insertBefore(guide1, null)
|
|
131
|
+
}
|
|
132
|
+
else if(dragged.dragArea === 3){
|
|
133
|
+
|
|
134
|
+
// Drag to own parent is not allowed
|
|
135
|
+
if(this.item.items && this.item.items.indexOf(dragged.item) > -1){
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if(guide1.parentNode)
|
|
140
|
+
guide1.parentNode.removeChild(guide1)
|
|
141
|
+
this.$refs.item.classList.add(this.$style.dragInto)
|
|
142
|
+
dragged.targetParent = this.item.items
|
|
143
|
+
dragged.refItem = this.$refs.item
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
hoverMouseOut(e){
|
|
149
|
+
if(!dragged) return
|
|
150
|
+
|
|
151
|
+
delete dragged.target
|
|
152
|
+
delete dragged.targetParent
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
mouseDown(e){
|
|
156
|
+
if(!this.$el || this.$el.nodeType !== 1) return
|
|
157
|
+
|
|
158
|
+
e.preventDefault()
|
|
159
|
+
|
|
160
|
+
const startX = e.clientX
|
|
161
|
+
const startY = e.clientY
|
|
162
|
+
const rect = this.$el.getBoundingClientRect()
|
|
163
|
+
|
|
164
|
+
dragged = {
|
|
165
|
+
item: this.item,
|
|
166
|
+
parent: this.parent,
|
|
167
|
+
startY: e.clientY
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const mouseMove = (e) => {
|
|
171
|
+
const distanceX = e.clientX - startX
|
|
172
|
+
const distanceY = e.clientY - startY
|
|
173
|
+
|
|
174
|
+
if(!dragged.cloned && Math.abs(distanceY) > 10){
|
|
175
|
+
const cloned = this.$el.cloneNode(true)
|
|
176
|
+
cloned.style.position = 'absolute'
|
|
177
|
+
cloned.style.left = rect.x + "px"
|
|
178
|
+
cloned.style.top = (e.clientY - 10) + "px"
|
|
179
|
+
cloned.style.width = this.$el.clientWidth + "px"
|
|
180
|
+
cloned.style.pointerEvents = 'none'
|
|
181
|
+
cloned.style.opacity = '0.5'
|
|
182
|
+
document.body.appendChild(cloned)
|
|
183
|
+
|
|
184
|
+
dragged.cloned = cloned
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if(dragged.cloned){
|
|
188
|
+
dragged.cloned.style.left = (rect.x + distanceX) + "px"
|
|
189
|
+
dragged.cloned.style.top = (e.clientY - 10) + "px"
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
dragged.clientY = e.clientY
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const mouseUp = (e) => {
|
|
196
|
+
if(dragged.cloned){
|
|
197
|
+
document.body.removeChild(dragged.cloned)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
window.removeEventListener('mousemove', mouseMove)
|
|
201
|
+
window.removeEventListener('mouseup', mouseUp)
|
|
202
|
+
|
|
203
|
+
if(dragged && dragged.parent && dragged.targetParent){
|
|
204
|
+
|
|
205
|
+
console.log(dragged, dragged.parent, dragged.targetParent)
|
|
206
|
+
|
|
207
|
+
const targetIdx = dragged.targetParent.indexOf(dragged.target)
|
|
208
|
+
const moveDirection = e.clientY < dragged.startY ? -1 : 1
|
|
209
|
+
const sameParent = dragged.parent === dragged.targetParent
|
|
210
|
+
|
|
211
|
+
let destIdx = undefined
|
|
212
|
+
|
|
213
|
+
if(dragged.dragArea === 1){
|
|
214
|
+
if(sameParent){
|
|
215
|
+
if(moveDirection === -1){
|
|
216
|
+
destIdx = targetIdx
|
|
217
|
+
}
|
|
218
|
+
else{
|
|
219
|
+
destIdx = targetIdx - 1
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else{
|
|
223
|
+
destIdx = targetIdx
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else if(dragged.dragArea === 2){
|
|
227
|
+
if(sameParent){
|
|
228
|
+
if(moveDirection === -1){
|
|
229
|
+
destIdx = targetIdx + 1
|
|
230
|
+
}
|
|
231
|
+
else{
|
|
232
|
+
destIdx = targetIdx
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else{
|
|
236
|
+
if(moveDirection === -1){
|
|
237
|
+
destIdx = targetIdx + 1
|
|
238
|
+
}
|
|
239
|
+
else{
|
|
240
|
+
destIdx = targetIdx + 1
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if(destIdx !== undefined){
|
|
246
|
+
dragged.targetParent.splice(destIdx, 0,
|
|
247
|
+
dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
248
|
+
this.$emit('change')
|
|
249
|
+
}
|
|
250
|
+
else if(dragged.dragArea === 3){
|
|
251
|
+
dragged.targetParent.push(dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
252
|
+
this.$emit('change')
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if(guide1 && guide1.parentNode){
|
|
257
|
+
guide1.parentNode.removeChild(guide1)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
document.querySelectorAll(`.${this.$style.dragInto}`).forEach((el) => {
|
|
261
|
+
el.classList.remove(this.$style.dragInto)
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
dragged = null
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
window.addEventListener('mousemove', mouseMove)
|
|
268
|
+
window.addEventListener('mouseup', mouseUp)
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
</script>
|
|
276
|
+
|
|
277
|
+
<style module>
|
|
278
|
+
|
|
279
|
+
.comp{
|
|
280
|
+
@apply flex flex-col gap-1;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.guide{
|
|
284
|
+
@apply h-[1px] bg-primary rounded-lg;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.item{
|
|
288
|
+
@apply flex flex-row items-center;
|
|
289
|
+
@apply bg-base-500 rounded-lg;
|
|
290
|
+
}
|
|
291
|
+
.item.active{
|
|
292
|
+
@apply bg-text-50;
|
|
293
|
+
}
|
|
294
|
+
.item.dragInto{
|
|
295
|
+
@apply border-[1px] border-primary;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
</style>
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :state="state"
|
|
3
|
+
:hash="hash"
|
|
4
|
+
ref="modal"
|
|
5
|
+
width="520"
|
|
6
|
+
height="520"
|
|
7
|
+
@show="$refs.search.select()">
|
|
8
|
+
<template v-slot:head>
|
|
9
|
+
<div class="relative p-6 pb-0 flex flex-col gap-4">
|
|
10
|
+
<h3>Select Component</h3>
|
|
11
|
+
<div class="absolute top-0 right-0 p-2">
|
|
12
|
+
<button type="button" class="p-2" @click="close">
|
|
13
|
+
<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">
|
|
14
|
+
<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"/>
|
|
15
|
+
</svg>
|
|
16
|
+
</button>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div>
|
|
20
|
+
<Textbox ref="search" v-model="search" :clearable="true"
|
|
21
|
+
@clear="search = null"
|
|
22
|
+
@keyup.enter="quickSelect">
|
|
23
|
+
<template #start>
|
|
24
|
+
<svg width="14" height="14" class="ml-3 fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/></svg>
|
|
25
|
+
</template>
|
|
26
|
+
</Textbox>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
<div class="flex-1 p-6">
|
|
31
|
+
|
|
32
|
+
<div class="grid grid-cols-2 gap-2">
|
|
33
|
+
|
|
34
|
+
<button v-for="component in viewedComponents"
|
|
35
|
+
type="button"
|
|
36
|
+
class="flex flex-row gap-3 items-center cursor-pointer p-1 rounded-lg"
|
|
37
|
+
@click="select(component)">
|
|
38
|
+
<div class="w-[32px] h-[32px] rounded-lg bg-text-100"></div>
|
|
39
|
+
<div>
|
|
40
|
+
<strong>{{ component.type }}</strong>
|
|
41
|
+
</div>
|
|
42
|
+
</button>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
</Modal>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
|
|
52
|
+
import md5 from "md5";
|
|
53
|
+
|
|
54
|
+
export default{
|
|
55
|
+
|
|
56
|
+
computed: {
|
|
57
|
+
|
|
58
|
+
viewedComponents(){
|
|
59
|
+
return this.components.filter(component => {
|
|
60
|
+
return this.search ?
|
|
61
|
+
component.type.toLowerCase().includes(this.search.toLowerCase()) :
|
|
62
|
+
true
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
data(){
|
|
69
|
+
return {
|
|
70
|
+
callback: null,
|
|
71
|
+
components: [
|
|
72
|
+
{ type:'Button', name:'Button' },
|
|
73
|
+
{ type:'Carousel', name:'Carousel' },
|
|
74
|
+
{ type:'Image', name:'Image' },
|
|
75
|
+
{ type:'Text', name:'Text' },
|
|
76
|
+
|
|
77
|
+
{ type:'Flex', name:'Flex', isContainer:true },
|
|
78
|
+
{ type:'Grid', name:'Grid', isContainer:true },
|
|
79
|
+
],
|
|
80
|
+
instance: null,
|
|
81
|
+
search: null
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
emits: [ 'select' ],
|
|
86
|
+
|
|
87
|
+
inject: [ 'socketEmit2' ],
|
|
88
|
+
|
|
89
|
+
methods: {
|
|
90
|
+
|
|
91
|
+
open(callback){
|
|
92
|
+
this.callback = callback
|
|
93
|
+
this.$refs.modal.open()
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
close(){
|
|
97
|
+
this.$refs.modal.close()
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
select(component){
|
|
101
|
+
const item = JSON.parse(JSON.stringify(component))
|
|
102
|
+
if(!item.props) item.props = {}
|
|
103
|
+
item.uid = md5(JSON.stringify(component) + new Date().getTime())
|
|
104
|
+
|
|
105
|
+
if(!('enabled' in item.props))
|
|
106
|
+
item.props.enabled = true
|
|
107
|
+
|
|
108
|
+
if(item.isContainer && !Array.isArray(item.items))
|
|
109
|
+
item.items = []
|
|
110
|
+
|
|
111
|
+
if(typeof this.callback === 'function')
|
|
112
|
+
this.callback(item)
|
|
113
|
+
this.$emit('select', item)
|
|
114
|
+
this.close()
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
quickSelect(){
|
|
118
|
+
if(this.viewedComponents.length === 1)
|
|
119
|
+
this.select(this.viewedComponents[0])
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
name: 'WebPageComponentSelector',
|
|
125
|
+
|
|
126
|
+
props: {
|
|
127
|
+
state: Boolean,
|
|
128
|
+
hash: String
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<style module>
|
|
136
|
+
|
|
137
|
+
.comp{
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
</style>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :state="state"
|
|
3
|
+
:hash="hash"
|
|
4
|
+
ref="modal"
|
|
5
|
+
width="540"
|
|
6
|
+
height="540"
|
|
7
|
+
@show="$refs.search.select()"
|
|
8
|
+
:dismissable="dismissable">
|
|
9
|
+
<template v-slot:head>
|
|
10
|
+
<div class="relative p-6 pb-0 flex flex-col gap-4">
|
|
11
|
+
<h3>{{ $t('Select Property') }}</h3>
|
|
12
|
+
<div class="absolute top-0 right-0 p-2">
|
|
13
|
+
<button type="button" class="p-2" @click="close">
|
|
14
|
+
<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">
|
|
15
|
+
<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"/>
|
|
16
|
+
</svg>
|
|
17
|
+
</button>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div>
|
|
21
|
+
<Textbox ref="search" v-model="search" :clearable="true" @clear="search = null">
|
|
22
|
+
<template #start>
|
|
23
|
+
<svg width="14" height="14" class="ml-3 fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"/></svg>
|
|
24
|
+
</template>
|
|
25
|
+
</Textbox>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-slot:foot>
|
|
30
|
+
<div class="p-6">
|
|
31
|
+
<Button class="w-[100px]" @click="apply()">
|
|
32
|
+
{{ $t('OK') }}
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
<div class="flex-1 p-6 flex flex-col gap-4">
|
|
37
|
+
|
|
38
|
+
<div class="grid grid-cols-2 gap-4">
|
|
39
|
+
<div v-for="(items, groupName) in grouped" class="mt-4">
|
|
40
|
+
<strong>{{ groupName }}</strong>
|
|
41
|
+
|
|
42
|
+
<div class="ml-0 flex flex-col gap-3 mt-3">
|
|
43
|
+
<div v-for="subItem in items"
|
|
44
|
+
class="flex flex-row items-center">
|
|
45
|
+
<Checkbox name="selected"
|
|
46
|
+
:value="subItem.name"
|
|
47
|
+
v-model="selected" />
|
|
48
|
+
<label @click="applyOne(subItem.name)">
|
|
49
|
+
{{ $t(subItem.text) }}
|
|
50
|
+
</label>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
</div>
|
|
57
|
+
</Modal>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
|
|
62
|
+
import Modal from "../../components/Modal.vue"
|
|
63
|
+
|
|
64
|
+
export default{
|
|
65
|
+
|
|
66
|
+
components: { Modal },
|
|
67
|
+
|
|
68
|
+
computed: {
|
|
69
|
+
|
|
70
|
+
grouped(){
|
|
71
|
+
|
|
72
|
+
const groups = {}
|
|
73
|
+
|
|
74
|
+
for(let propName in this.properties){
|
|
75
|
+
const prop = this.properties[propName]
|
|
76
|
+
|
|
77
|
+
if(this.search){
|
|
78
|
+
if(!prop.text.toLowerCase().includes(this.search.toLowerCase()))
|
|
79
|
+
continue
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let groupName = prop.group?.length > 0 ? prop.group : 'General'
|
|
83
|
+
if(!groups[groupName])
|
|
84
|
+
groups[groupName] = []
|
|
85
|
+
|
|
86
|
+
groups[groupName].push({
|
|
87
|
+
...prop,
|
|
88
|
+
name: propName
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return groups
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
data(){
|
|
98
|
+
return {
|
|
99
|
+
selected: [],
|
|
100
|
+
callback: null,
|
|
101
|
+
search: null
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
emits: [ 'apply' ],
|
|
106
|
+
|
|
107
|
+
inject: [ 'socketEmit2', 'viewTypes' ],
|
|
108
|
+
|
|
109
|
+
methods: {
|
|
110
|
+
|
|
111
|
+
applyOne(selected){
|
|
112
|
+
this.selected.push(selected)
|
|
113
|
+
this.apply()
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
apply(){
|
|
117
|
+
|
|
118
|
+
for(let propName in this.value){
|
|
119
|
+
if(!this.selected.includes(propName) && propName in this.properties)
|
|
120
|
+
delete this.value[propName]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for(let propName of this.selected){
|
|
124
|
+
if(!(propName in this.value))
|
|
125
|
+
this.value[propName] = this.viewTypes.map(_ => '')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
this.close()
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
open(callback){
|
|
132
|
+
this.callback = callback
|
|
133
|
+
this.selected = Object.keys(this.value).filter(_ => _ in this.properties)
|
|
134
|
+
this.$refs.modal.open()
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
close(){
|
|
138
|
+
this.$refs.modal.close()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
props: {
|
|
144
|
+
|
|
145
|
+
dismissable: {
|
|
146
|
+
type: Boolean,
|
|
147
|
+
default: true
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
hash: String,
|
|
151
|
+
|
|
152
|
+
state: Boolean,
|
|
153
|
+
|
|
154
|
+
properties: Object,
|
|
155
|
+
|
|
156
|
+
value: Object,
|
|
157
|
+
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
</script>
|
|
165
|
+
|
|
166
|
+
<style module>
|
|
167
|
+
|
|
168
|
+
.comp{
|
|
169
|
+
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
</style>
|