@mixd-id/web-scaffold 0.1.230406118 → 0.1.230406120
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
CHANGED
package/src/components/Alert.vue
CHANGED
|
@@ -95,7 +95,9 @@ export default{
|
|
|
95
95
|
if(this.state){
|
|
96
96
|
if(typeof this.state.title === 'object'){
|
|
97
97
|
if(this.state.title.response || this.state.title.type === 'ValidationError'){
|
|
98
|
-
const errors = this.state.title.response
|
|
98
|
+
const errors = this.state.title.response ?
|
|
99
|
+
this.state.title.response.data.errors :
|
|
100
|
+
this.state.title.errors
|
|
99
101
|
|
|
100
102
|
description = {}
|
|
101
103
|
for(let key in errors){
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div @copy.stop.prevent="copy"
|
|
2
|
+
<div @copy.stop.prevent="copy"
|
|
3
|
+
@mouseover.stop="hoverMouseOver"
|
|
4
|
+
@mouseout.stop="hoverMouseOut">
|
|
3
5
|
<div ref="item" :class="itemClass"
|
|
4
|
-
@
|
|
5
|
-
@mouseout="hoverMouseOut"
|
|
6
|
-
@mousedown="mouseDown"
|
|
7
|
-
@mouseup="hoverMouseUp">
|
|
6
|
+
@mousedown="mouseDown">
|
|
8
7
|
<button type="button" class="py-2" v-if="Array.isArray((item ?? {}).items) && item.items.length > 0"
|
|
9
8
|
@click="childCollapsed = !childCollapsed">
|
|
10
9
|
<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>
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
import {copyToClipboard} from "../utils/helpers.mjs";
|
|
49
48
|
|
|
50
49
|
let dragged = null
|
|
50
|
+
let guide1 = null
|
|
51
51
|
|
|
52
52
|
export default{
|
|
53
53
|
|
|
@@ -120,74 +120,88 @@ export default{
|
|
|
120
120
|
cloned.style.top = (e.clientY - 10) + "px"
|
|
121
121
|
cloned.style.width = this.$el.clientWidth + "px"
|
|
122
122
|
cloned.style.pointerEvents = 'none'
|
|
123
|
+
cloned.style.opacity = '0.5'
|
|
123
124
|
document.body.appendChild(cloned)
|
|
124
125
|
|
|
125
126
|
dragged = {
|
|
126
127
|
item: this.item,
|
|
127
|
-
parent: this.parent
|
|
128
|
+
parent: this.parent,
|
|
129
|
+
startY: e.clientY
|
|
128
130
|
}
|
|
129
131
|
|
|
130
132
|
const mouseMove = (e) => {
|
|
131
133
|
const distanceX = e.clientX - startX
|
|
132
134
|
cloned.style.left = (rect.x + distanceX) + "px"
|
|
133
135
|
cloned.style.top = (e.clientY - 10) + "px"
|
|
136
|
+
|
|
137
|
+
dragged.clientY = e.clientY
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
const mouseUp = (e) => {
|
|
137
141
|
document.body.removeChild(cloned)
|
|
138
142
|
window.removeEventListener('mousemove', mouseMove)
|
|
139
143
|
window.removeEventListener('mouseup', mouseUp)
|
|
140
|
-
}
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
if(guide1.parentNode){
|
|
146
|
+
guide1.parentNode.removeChild(guide1)
|
|
147
|
+
}
|
|
145
148
|
|
|
146
|
-
|
|
149
|
+
if(dragged.parent && dragged.targetParent){
|
|
147
150
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const startIdx = dragged.parent.indexOf(dragged.item)
|
|
151
|
+
let targetIdx = dragged.targetParent.indexOf(dragged.target)
|
|
152
|
+
const startIdx = dragged.parent.indexOf(dragged.item)
|
|
151
153
|
|
|
152
|
-
|
|
154
|
+
/*if(e.clientY > dragged.startY){
|
|
155
|
+
targetIdx++
|
|
156
|
+
}*/
|
|
157
|
+
//console.log(e.clientY, dragged.startY, e.clientY > dragged.startY ? 'after' : 'before', targetIdx, startIdx)
|
|
153
158
|
|
|
154
|
-
if(dragged.parent
|
|
155
|
-
dragged.parent.splice(targetIdx, 0, dragged.parent.splice(startIdx, 1)[0])
|
|
156
|
-
}
|
|
157
|
-
else{
|
|
158
|
-
dragged.targetParent.splice(targetIdx, 0, dragged.parent.splice(startIdx, 1)[0])
|
|
159
|
-
}
|
|
159
|
+
if(targetIdx >= -1 && (targetIdx !== startIdx || dragged.parent !== dragged.targetParent)){
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
if(dragged.parent === dragged.targetParent){
|
|
162
|
+
dragged.parent.splice(targetIdx, 0, dragged.parent.splice(startIdx, 1)[0])
|
|
163
|
+
}
|
|
164
|
+
else{
|
|
165
|
+
dragged.targetParent.splice(targetIdx, 0, dragged.parent.splice(startIdx, 1)[0])
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.$emit('change')
|
|
169
|
+
}
|
|
162
170
|
}
|
|
163
|
-
}
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
this.$refs.item.classList.remove(this.$style.itemMouseOver)
|
|
172
|
+
dragged = null
|
|
167
173
|
}
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
|
|
175
|
+
window.addEventListener('mousemove', mouseMove)
|
|
176
|
+
window.addEventListener('mouseup', mouseUp)
|
|
170
177
|
},
|
|
171
178
|
|
|
172
179
|
hoverMouseOver(e){
|
|
180
|
+
if(!dragged) return
|
|
173
181
|
|
|
174
|
-
if(
|
|
175
|
-
this
|
|
176
|
-
dragged.target = this.item
|
|
177
|
-
dragged.targetParent = this.parent
|
|
178
|
-
window.addEventListener('mouseup', this.hoverMouseUp)
|
|
182
|
+
if(!guide1){
|
|
183
|
+
guide1 = this.createGuide()
|
|
179
184
|
}
|
|
180
185
|
|
|
186
|
+
dragged.target = this.item
|
|
187
|
+
dragged.targetParent = this.parent
|
|
188
|
+
|
|
189
|
+
guide1.addEventListener('mouseover', this.hoverMouseOver)
|
|
190
|
+
|
|
191
|
+
this.$el.insertBefore(guide1, e.clientY < dragged.startY ? this.$refs.item : null)
|
|
181
192
|
},
|
|
182
193
|
|
|
183
194
|
hoverMouseOut(e){
|
|
195
|
+
if(!dragged) return
|
|
184
196
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
delete dragged.targetParent
|
|
189
|
-
}
|
|
197
|
+
delete dragged.target
|
|
198
|
+
delete dragged.targetParent
|
|
199
|
+
},
|
|
190
200
|
|
|
201
|
+
createGuide(){
|
|
202
|
+
const el = document.createElement('div')
|
|
203
|
+
el.classList.add(this.$style.guide)
|
|
204
|
+
return el
|
|
191
205
|
},
|
|
192
206
|
|
|
193
207
|
},
|
|
@@ -230,4 +244,8 @@ export default{
|
|
|
230
244
|
@apply !bg-primary;
|
|
231
245
|
}
|
|
232
246
|
|
|
247
|
+
.guide{
|
|
248
|
+
@apply h-[1px] bg-primary rounded-lg;
|
|
249
|
+
}
|
|
250
|
+
|
|
233
251
|
</style>
|