@mixd-id/web-scaffold 0.1.230406169 → 0.1.230406171
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/Button.vue +1 -3
- package/src/components/Modal.vue +41 -31
- package/src/components/TreeViewItem.vue +190 -65
- package/src/mixin/component.js +3 -0
- package/src/widgets/AhrefSetting.vue +40 -33
- package/src/widgets/ArticleSetting.vue +5 -1
- package/src/widgets/ButtonSetting.vue +47 -40
- package/src/widgets/CarouselSetting.vue +48 -41
- package/src/widgets/ComponentSetting.vue +37 -1
- package/src/widgets/FlexSetting.vue +6 -3
- package/src/widgets/GridSetting.vue +46 -39
- package/src/widgets/ImageSetting.vue +39 -34
- package/src/widgets/Share.vue +51 -47
- package/src/widgets/WebComponentSelector.vue +78 -39
- package/src/widgets/WebPageBuilder.vue +50 -22
- package/src/widgets/WebPageSelector.vue +20 -51
package/package.json
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button :class="compClass" :disabled="isDisabled" @click="onClick">
|
|
3
|
-
|
|
4
|
-
<slot>{{ text }}</slot>
|
|
5
|
-
</div>
|
|
3
|
+
<slot>{{ text }}</slot>
|
|
6
4
|
<div v-if="isLoading" :class="$style.loadingPane">
|
|
7
5
|
<svg :class="$style.spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
8
6
|
<circle :class="$style.svgBg" cx="12" cy="12" r="10" stroke-width="4"></circle>
|
package/src/components/Modal.vue
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<Teleport to=".bW9k">
|
|
4
4
|
<Transition :name="transition"
|
|
5
5
|
appear
|
|
6
|
-
@after-leave="onAfterLeave"
|
|
6
|
+
@after-leave="onAfterLeave(); $emit('hide')"
|
|
7
7
|
@after-enter="$emit('show')">
|
|
8
8
|
<div v-if="currentState"
|
|
9
9
|
ref="modal"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<div class="modal-head">
|
|
15
15
|
<slot name="head" :context="context"></slot>
|
|
16
16
|
</div>
|
|
17
|
-
<div :class="
|
|
17
|
+
<div :class="$style.modalBody">
|
|
18
18
|
<slot :context="context"></slot>
|
|
19
19
|
</div>
|
|
20
20
|
<div class="modal-foot">
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<div class="modal-head">
|
|
27
27
|
<slot name="head" :context="context"></slot>
|
|
28
28
|
</div>
|
|
29
|
-
<div :class="
|
|
29
|
+
<div :class="$style.modalBody">
|
|
30
30
|
<slot :context="context"></slot>
|
|
31
31
|
</div>
|
|
32
32
|
<div class="modal-foot">
|
|
@@ -66,21 +66,30 @@ export default{
|
|
|
66
66
|
emits: [ 'submit', 'dismiss', 'show', 'hide' ],
|
|
67
67
|
|
|
68
68
|
props:{
|
|
69
|
-
bodyClass:{ type: String, default: '' },
|
|
70
69
|
class:{ type: String, default: '' },
|
|
70
|
+
|
|
71
71
|
dismissable: undefined,
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
|
|
73
|
+
hash: String,
|
|
74
|
+
|
|
75
|
+
height: String,
|
|
76
|
+
|
|
77
|
+
position: {
|
|
74
78
|
type: String,
|
|
75
79
|
default: 'bottom'
|
|
76
80
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
|
|
82
|
+
state: [ Number, Boolean, String ],
|
|
83
|
+
|
|
84
|
+
transition: { type: String, default: 'slideup' },
|
|
85
|
+
|
|
86
|
+
width: String,
|
|
87
|
+
|
|
88
|
+
useForm: {
|
|
81
89
|
type: Boolean,
|
|
82
90
|
default: false
|
|
83
91
|
},
|
|
92
|
+
|
|
84
93
|
mode: 'v-if', // v-if or v-show
|
|
85
94
|
},
|
|
86
95
|
|
|
@@ -98,20 +107,15 @@ export default{
|
|
|
98
107
|
onAfterLeave(){
|
|
99
108
|
let overlay = document.querySelector('.bW9k')
|
|
100
109
|
if(overlay){
|
|
101
|
-
|
|
102
110
|
let hasTrueState = false
|
|
103
|
-
|
|
104
111
|
for(let i = 0 ; i < overlay.children.length ; i++){
|
|
105
112
|
if(overlay.children[i].getAttribute('data-state') === '1'){
|
|
106
113
|
hasTrueState = true
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
|
-
|
|
110
116
|
if(!hasTrueState){
|
|
111
117
|
overlay.classList.remove('bW9l')
|
|
112
118
|
}
|
|
113
|
-
|
|
114
|
-
this.$emit('hide')
|
|
115
119
|
}
|
|
116
120
|
},
|
|
117
121
|
|
|
@@ -134,32 +138,25 @@ export default{
|
|
|
134
138
|
overlay.classList.add('bW9l')
|
|
135
139
|
}
|
|
136
140
|
|
|
137
|
-
this.$emit('show')
|
|
138
|
-
|
|
139
141
|
registerModal(this)
|
|
142
|
+
|
|
143
|
+
if(this.mode === 'v-show'){
|
|
144
|
+
this.$emit('show')
|
|
145
|
+
}
|
|
140
146
|
}
|
|
141
147
|
else{
|
|
142
|
-
this.$
|
|
143
|
-
|
|
144
|
-
if(this.mode === 'v-show')
|
|
145
|
-
this.$nextTick(() => this.onAfterLeave())
|
|
146
|
-
|
|
148
|
+
this.$nextTick(() => this.onAfterLeave())
|
|
147
149
|
unRegisterModal(this)
|
|
150
|
+
|
|
151
|
+
if(this.mode === 'v-show') {
|
|
152
|
+
this.$emit('hide')
|
|
153
|
+
}
|
|
148
154
|
}
|
|
149
155
|
}
|
|
150
156
|
},
|
|
151
157
|
|
|
152
158
|
computed:{
|
|
153
159
|
|
|
154
|
-
modalBodyClass(){
|
|
155
|
-
return [
|
|
156
|
-
this.$style.modalBody,
|
|
157
|
-
this.bodyClass
|
|
158
|
-
]
|
|
159
|
-
.join(' ')
|
|
160
|
-
.trim()
|
|
161
|
-
},
|
|
162
|
-
|
|
163
160
|
computedClass(){
|
|
164
161
|
return [
|
|
165
162
|
this.$style.modal,
|
|
@@ -204,6 +201,12 @@ export default{
|
|
|
204
201
|
this.setState(to)
|
|
205
202
|
},
|
|
206
203
|
|
|
204
|
+
'$route.hash'(to){
|
|
205
|
+
if(this.hash !== null){
|
|
206
|
+
this._state = to === this.hash
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
207
210
|
},
|
|
208
211
|
|
|
209
212
|
mounted() {
|
|
@@ -214,6 +217,10 @@ export default{
|
|
|
214
217
|
if(this.computedState){
|
|
215
218
|
this.setState(this.computedState)
|
|
216
219
|
}
|
|
220
|
+
|
|
221
|
+
if(this.hash !== null){
|
|
222
|
+
this._state = this.$route.hash === this.hash
|
|
223
|
+
}
|
|
217
224
|
})
|
|
218
225
|
},
|
|
219
226
|
|
|
@@ -245,10 +252,13 @@ export default{
|
|
|
245
252
|
}
|
|
246
253
|
|
|
247
254
|
.modal.v-show{
|
|
255
|
+
transition: all 200ms cubic-bezier(0.25, 1, 0.5, 1);
|
|
248
256
|
transform: scale(0);
|
|
257
|
+
opacity: 0;
|
|
249
258
|
}
|
|
250
259
|
.modal.v-show.open{
|
|
251
260
|
transform: scale(1);
|
|
261
|
+
opacity: 1;
|
|
252
262
|
}
|
|
253
263
|
|
|
254
264
|
.modal form{
|
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div @mousemove
|
|
3
|
-
@mouseout
|
|
4
|
-
<div ref="item"
|
|
2
|
+
<div @mousemove="hoverMouseOver"
|
|
3
|
+
@mouseout="hoverMouseOut">
|
|
4
|
+
<div ref="item"
|
|
5
|
+
:class="itemClass"
|
|
5
6
|
@mousedown="mouseDown">
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
<button type="button" class="py-1" v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
|
|
7
9
|
@click="childCollapsed = !childCollapsed">
|
|
8
10
|
<svg v-if="!childCollapsed" width="16" height="16" class="fill-text-300" 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>
|
|
9
11
|
<svg v-else width="16" height="16" class="fill-text-300" 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>
|
|
10
12
|
</button>
|
|
11
|
-
<div v-else class="px-
|
|
13
|
+
<div v-else class="px-2"></div>
|
|
14
|
+
|
|
12
15
|
<slot :item="item"></slot>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
<div class="flex flex-row gap-2 items-center">
|
|
18
|
+
<button v-if="item && Array.isArray(item.items)"
|
|
19
|
+
type="button"
|
|
20
|
+
class="py-1"
|
|
21
|
+
@click="add">
|
|
22
|
+
<svg width="16" height="16" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
|
|
23
|
+
</button>
|
|
24
|
+
|
|
25
|
+
<button type="button"
|
|
26
|
+
class="py-1"
|
|
27
|
+
@click="$emit('remove')">
|
|
28
|
+
<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="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z"/></svg>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
16
32
|
</div>
|
|
17
|
-
<div ref="container"
|
|
33
|
+
<div ref="container"
|
|
34
|
+
v-if="item && Array.isArray(item.items) && !childCollapsed" class="ml-4"
|
|
35
|
+
@mousemove.stop=""
|
|
36
|
+
@mouseout.stop="">
|
|
18
37
|
<TreeViewItem v-for="(subItem, index) in item.items"
|
|
19
38
|
:item="subItem"
|
|
20
39
|
:parent="item.items"
|
|
@@ -28,13 +47,6 @@
|
|
|
28
47
|
<slot :item="item"></slot>
|
|
29
48
|
</template>
|
|
30
49
|
</TreeViewItem>
|
|
31
|
-
|
|
32
|
-
<div class="flex flex-row items-center justify-center mb-2">
|
|
33
|
-
<button type="button" class="p-1 text-primary flex flex-row gap-1 items-center" @click="add">
|
|
34
|
-
<svg width="14" height="14" class="fill-primary" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M376 232H216V72c0-4.42-3.58-8-8-8h-32c-4.42 0-8 3.58-8 8v160H8c-4.42 0-8 3.58-8 8v32c0 4.42 3.58 8 8 8h160v160c0 4.42 3.58 8 8 8h32c4.42 0 8-3.58 8-8V280h160c4.42 0 8-3.58 8-8v-32c0-4.42-3.58-8-8-8z"/></svg>
|
|
35
|
-
Add
|
|
36
|
-
</button>
|
|
37
|
-
</div>
|
|
38
50
|
</div>
|
|
39
51
|
</div>
|
|
40
52
|
</template>
|
|
@@ -46,9 +58,11 @@ let guide1 = null
|
|
|
46
58
|
|
|
47
59
|
export default{
|
|
48
60
|
|
|
61
|
+
name: 'TreeViewItem',
|
|
62
|
+
|
|
49
63
|
emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
|
|
50
64
|
|
|
51
|
-
inject: [ 'confirm', 'toast' ],
|
|
65
|
+
inject: [ 'confirm', 'toast', 'store' ],
|
|
52
66
|
|
|
53
67
|
props: {
|
|
54
68
|
item: Object,
|
|
@@ -83,22 +97,15 @@ export default{
|
|
|
83
97
|
|
|
84
98
|
add(){
|
|
85
99
|
this.$emit('add', this.item.items)
|
|
100
|
+
this.childCollapsed = false
|
|
86
101
|
},
|
|
87
102
|
|
|
88
103
|
mouseDown(e){
|
|
89
104
|
e.preventDefault()
|
|
90
105
|
|
|
91
|
-
const rect = this.$el.getBoundingClientRect()
|
|
92
106
|
const startX = e.clientX
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
cloned.style.position = 'absolute'
|
|
96
|
-
cloned.style.left = rect.x + "px"
|
|
97
|
-
cloned.style.top = (e.clientY - 10) + "px"
|
|
98
|
-
cloned.style.width = this.$el.clientWidth + "px"
|
|
99
|
-
cloned.style.pointerEvents = 'none'
|
|
100
|
-
cloned.style.opacity = '0.5'
|
|
101
|
-
document.body.appendChild(cloned)
|
|
107
|
+
const startY = e.clientY
|
|
108
|
+
const rect = this.$el.getBoundingClientRect()
|
|
102
109
|
|
|
103
110
|
dragged = {
|
|
104
111
|
item: this.item,
|
|
@@ -108,50 +115,96 @@ export default{
|
|
|
108
115
|
|
|
109
116
|
const mouseMove = (e) => {
|
|
110
117
|
const distanceX = e.clientX - startX
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
const distanceY = e.clientY - startY
|
|
119
|
+
|
|
120
|
+
if(!dragged.cloned && Math.abs(distanceY) > 10){
|
|
121
|
+
const cloned = this.$el.cloneNode(true)
|
|
122
|
+
cloned.style.position = 'absolute'
|
|
123
|
+
cloned.style.left = rect.x + "px"
|
|
124
|
+
cloned.style.top = (e.clientY - 10) + "px"
|
|
125
|
+
cloned.style.width = this.$el.clientWidth + "px"
|
|
126
|
+
cloned.style.pointerEvents = 'none'
|
|
127
|
+
cloned.style.opacity = '0.5'
|
|
128
|
+
document.body.appendChild(cloned)
|
|
129
|
+
|
|
130
|
+
dragged.cloned = cloned
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if(dragged.cloned){
|
|
134
|
+
dragged.cloned.style.left = (rect.x + distanceX) + "px"
|
|
135
|
+
dragged.cloned.style.top = (e.clientY - 10) + "px"
|
|
136
|
+
}
|
|
113
137
|
|
|
114
138
|
dragged.clientY = e.clientY
|
|
115
139
|
}
|
|
116
140
|
|
|
117
141
|
const mouseUp = (e) => {
|
|
118
|
-
|
|
142
|
+
if(dragged.cloned){
|
|
143
|
+
document.body.removeChild(dragged.cloned)
|
|
144
|
+
}
|
|
145
|
+
|
|
119
146
|
window.removeEventListener('mousemove', mouseMove)
|
|
120
147
|
window.removeEventListener('mouseup', mouseUp)
|
|
121
148
|
|
|
122
149
|
if(dragged && dragged.parent && dragged.targetParent){
|
|
123
150
|
|
|
124
|
-
const startIdx = dragged.targetParent.indexOf(dragged.item)
|
|
125
151
|
const targetIdx = dragged.targetParent.indexOf(dragged.target)
|
|
126
152
|
const moveDirection = e.clientY < dragged.startY ? -1 : 1
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
153
|
+
const sameParent = dragged.parent === dragged.targetParent
|
|
154
|
+
|
|
155
|
+
let destIdx = undefined
|
|
156
|
+
|
|
157
|
+
if(dragged.dragArea === 1){
|
|
158
|
+
if(sameParent){
|
|
159
|
+
if(moveDirection === -1){
|
|
160
|
+
destIdx = targetIdx
|
|
161
|
+
}
|
|
162
|
+
else{
|
|
163
|
+
destIdx = targetIdx - 1
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else{
|
|
167
|
+
destIdx = targetIdx
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else if(dragged.dragArea === 2){
|
|
171
|
+
if(sameParent){
|
|
172
|
+
if(moveDirection === -1){
|
|
173
|
+
destIdx = targetIdx + 1
|
|
174
|
+
}
|
|
175
|
+
else{
|
|
176
|
+
destIdx = targetIdx
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else{
|
|
180
|
+
if(moveDirection === -1){
|
|
181
|
+
destIdx = targetIdx + 1
|
|
182
|
+
}
|
|
183
|
+
else{
|
|
184
|
+
destIdx = targetIdx + 1
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if(destIdx !== undefined){
|
|
190
|
+
dragged.targetParent.splice(destIdx, 0,
|
|
191
|
+
dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
192
|
+
this.$emit('change')
|
|
193
|
+
}
|
|
194
|
+
else if(dragged.dragArea === 3){
|
|
195
|
+
dragged.targetParent.push(dragged.parent.splice(dragged.parent.indexOf(dragged.item), 1)[0])
|
|
196
|
+
this.$emit('change')
|
|
197
|
+
}
|
|
149
198
|
}
|
|
150
199
|
|
|
151
200
|
if(guide1 && guide1.parentNode){
|
|
152
201
|
guide1.parentNode.removeChild(guide1)
|
|
153
202
|
}
|
|
154
203
|
|
|
204
|
+
document.querySelectorAll(`.${this.$style.dragInto}`).forEach((el) => {
|
|
205
|
+
el.classList.remove(this.$style.dragInto)
|
|
206
|
+
})
|
|
207
|
+
|
|
155
208
|
dragged = null
|
|
156
209
|
}
|
|
157
210
|
|
|
@@ -161,28 +214,67 @@ export default{
|
|
|
161
214
|
|
|
162
215
|
hoverMouseOver(e){
|
|
163
216
|
if(!dragged) return
|
|
164
|
-
|
|
165
217
|
if(this.item === dragged.item) return
|
|
166
218
|
|
|
219
|
+
// Drag to own child is not allowed
|
|
220
|
+
if(dragged.item.items && dragged.item.items.indexOf(this.item) > -1){
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
|
|
167
224
|
if(!guide1){
|
|
168
225
|
guide1 = this.createGuide()
|
|
169
226
|
}
|
|
170
227
|
|
|
171
228
|
if(dragged.target !== this.item){
|
|
172
229
|
const rect = this.$refs.item.getBoundingClientRect()
|
|
173
|
-
|
|
230
|
+
const hasChildItems = Array.isArray(this.item.items)
|
|
231
|
+
|
|
232
|
+
dragged.targetArea = hasChildItems ? [
|
|
233
|
+
Math.round(rect.y + (rect.height * (2 / 3))),
|
|
234
|
+
Math.round(rect.y + (rect.height * (1 / 3))),
|
|
235
|
+
0
|
|
236
|
+
] : [
|
|
237
|
+
Math.round(rect.y + (rect.height * (1/2))),
|
|
238
|
+
0
|
|
239
|
+
]
|
|
240
|
+
//dragged.centerY = rect.y + (rect.height / 2)
|
|
174
241
|
}
|
|
242
|
+
|
|
175
243
|
dragged.target = this.item
|
|
176
244
|
dragged.targetParent = this.parent
|
|
177
245
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
246
|
+
for(let i in dragged.targetArea){
|
|
247
|
+
if(e.clientY > dragged.targetArea[i]){
|
|
248
|
+
dragged.dragArea = dragged.targetArea.length - i
|
|
249
|
+
break
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if(dragged.targetArea.length === 3){
|
|
253
|
+
dragged.dragArea = dragged.dragArea === 2 ? 3 :
|
|
254
|
+
(dragged.dragArea === 3 ? 2 : 1)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.$refs.item.classList.remove(this.$style.dragInto)
|
|
258
|
+
if(dragged.dragArea === 1){
|
|
259
|
+
this.$el.insertBefore(guide1, this.$el.firstElementChild)
|
|
260
|
+
}
|
|
261
|
+
else if(dragged.dragArea === 2){
|
|
262
|
+
this.$el.insertBefore(guide1, null)
|
|
263
|
+
}
|
|
264
|
+
else if(dragged.dragArea === 3){
|
|
265
|
+
|
|
266
|
+
// Drag to own parent is not allowed
|
|
267
|
+
if(this.item.items && this.item.items.indexOf(dragged.item) > -1){
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if(guide1.parentNode)
|
|
272
|
+
guide1.parentNode.removeChild(guide1)
|
|
273
|
+
this.$refs.item.classList.add(this.$style.dragInto)
|
|
274
|
+
dragged.targetParent = this.item.items
|
|
275
|
+
dragged.refItem = this.$refs.item
|
|
276
|
+
}
|
|
277
|
+
|
|
186
278
|
},
|
|
187
279
|
|
|
188
280
|
hoverMouseOut(e){
|
|
@@ -202,6 +294,15 @@ export default{
|
|
|
202
294
|
|
|
203
295
|
computed: {
|
|
204
296
|
|
|
297
|
+
componentStore(){
|
|
298
|
+
if(this.store && this.store.components){
|
|
299
|
+
if(!this.store.components.treeviewitem)
|
|
300
|
+
this.store.components.treeviewitem = {}
|
|
301
|
+
|
|
302
|
+
return this.store.components.treeviewitem
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
|
|
205
306
|
isSelected(){
|
|
206
307
|
return this.selectedItem === this.item
|
|
207
308
|
},
|
|
@@ -220,11 +321,19 @@ export default{
|
|
|
220
321
|
|
|
221
322
|
data(){
|
|
222
323
|
return {
|
|
223
|
-
childCollapsed:
|
|
324
|
+
childCollapsed: true,
|
|
224
325
|
hvm: null
|
|
225
326
|
}
|
|
226
327
|
},
|
|
227
328
|
|
|
329
|
+
mounted() {
|
|
330
|
+
|
|
331
|
+
if(this.componentStore){
|
|
332
|
+
this.childCollapsed = this.componentStore[this.item.uid] ?? this.childCollapsed
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
},
|
|
336
|
+
|
|
228
337
|
watch: {
|
|
229
338
|
|
|
230
339
|
item: {
|
|
@@ -234,6 +343,18 @@ export default{
|
|
|
234
343
|
deep: true
|
|
235
344
|
},
|
|
236
345
|
|
|
346
|
+
childCollapsed(to){
|
|
347
|
+
if(this.item.uid && this.componentStore){
|
|
348
|
+
this.componentStore[this.item.uid] = to
|
|
349
|
+
}
|
|
350
|
+
else{
|
|
351
|
+
console.warn('[TreeviewItem] not saving collapsed state', {
|
|
352
|
+
uid: this.item.uid,
|
|
353
|
+
componentStore: this.componentStore,
|
|
354
|
+
})
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
|
|
237
358
|
isSelected(to){
|
|
238
359
|
/*if(to){
|
|
239
360
|
this.$el.scrollIntoView({
|
|
@@ -251,7 +372,7 @@ export default{
|
|
|
251
372
|
<style module>
|
|
252
373
|
|
|
253
374
|
.item{
|
|
254
|
-
@apply bg-base-300 dark:bg-base-400 flex flex-row gap-2 px-2 items-center rounded-lg mb-1;
|
|
375
|
+
@apply bg-base-300 dark:bg-base-400 flex flex-row gap-2 px-2 py-1 items-center rounded-lg mb-1;
|
|
255
376
|
@apply border-[1px] border-transparent cursor-pointer;
|
|
256
377
|
}
|
|
257
378
|
.item.active{
|
|
@@ -266,4 +387,8 @@ export default{
|
|
|
266
387
|
@apply h-[1px] bg-primary rounded-lg;
|
|
267
388
|
}
|
|
268
389
|
|
|
390
|
+
.item.dragInto{
|
|
391
|
+
@apply border-[1px] border-primary;
|
|
392
|
+
}
|
|
393
|
+
|
|
269
394
|
</style>
|
package/src/mixin/component.js
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
|
-
<div>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
4
|
+
<div class="flex flex-col gap-4">
|
|
5
|
+
<div>
|
|
6
|
+
<strong class="flex-1 text-text-400">Ahref</strong>
|
|
7
|
+
<div class="h-[1px] bg-text-100 mt-2"></div>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div>
|
|
11
|
+
<label class="flex-1 text-text-400">Text</label>
|
|
12
|
+
<Textbox v-model="item.props.text" @keyup.enter="$emit('change')"/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div>
|
|
16
|
+
<label class="flex-1 text-text-400">Href</label>
|
|
17
|
+
<Textbox v-model="item.props.href" @keyup.enter="$emit('change')"/>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<div>
|
|
21
|
+
<label class="flex-1 text-text-400">Target</label>
|
|
22
|
+
<Dropdown v-model="item.props.target" @change="$emit('change')">
|
|
23
|
+
<option value="_self">Self</option>
|
|
24
|
+
<option value="_blank">Blank</option>
|
|
25
|
+
<option value="_parent">Parent</option>
|
|
26
|
+
<option value="_top">Top</option>
|
|
27
|
+
</Dropdown>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div>
|
|
31
|
+
<label class="flex-1 text-text-400">Variant</label>
|
|
32
|
+
<Dropdown v-model="item.props.variant"
|
|
33
|
+
@change="$emit('change')">
|
|
34
|
+
<option value="primary">Primary</option>
|
|
35
|
+
<option value="secondary">Secondary</option>
|
|
36
|
+
<option value="red">Red</option>
|
|
37
|
+
<option value="minimal">Minimal</option>
|
|
38
|
+
<option value="outline">Outline</option>
|
|
39
|
+
<option value="">Not Set</option>
|
|
40
|
+
</Dropdown>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
36
43
|
|
|
37
44
|
<ComponentSetting :item="item"
|
|
38
45
|
:view-type="viewType"
|
|
@@ -85,7 +92,7 @@ export default{
|
|
|
85
92
|
<style module>
|
|
86
93
|
|
|
87
94
|
.comp{
|
|
88
|
-
@apply flex flex-col gap-
|
|
95
|
+
@apply flex flex-col gap-6;
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
</style>
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
<div :class="$style.comp">
|
|
3
3
|
|
|
4
4
|
<div class="flex flex-col gap-4" v-if="viewType === ''">
|
|
5
|
+
<div>
|
|
6
|
+
<strong class="flex-1 text-text-400">Article</strong>
|
|
7
|
+
<div class="h-[1px] bg-text-100 mt-2"></div>
|
|
8
|
+
</div>
|
|
5
9
|
|
|
6
10
|
<div class="overflow-x-auto">
|
|
7
11
|
<label class="text-text-400">Action</label>
|
|
@@ -541,7 +545,7 @@ export default{
|
|
|
541
545
|
<style module>
|
|
542
546
|
|
|
543
547
|
.comp{
|
|
544
|
-
@apply flex flex-col gap-
|
|
548
|
+
@apply flex flex-col gap-6;
|
|
545
549
|
}
|
|
546
550
|
|
|
547
551
|
</style>
|