@mixd-id/web-scaffold 0.1.230406301 → 0.1.230406303
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 -3
- package/src/components/Alert.vue +9 -3
- package/src/components/Button.vue +4 -1
- package/src/components/Carousel.vue +2 -3
- package/src/components/ErrorText.vue +1 -1
- package/src/components/ImagePreview.vue +1 -1
- package/src/components/List.vue +2 -2
- package/src/components/Slider.vue +104 -77
- package/src/components/TreeView.vue +5 -54
- package/src/components/TreeViewItem.vue +12 -36
- package/src/configs/icons-fa.json +12 -0
- package/src/index.js +91 -34
- package/src/themes/default/index.js +4 -2
- package/src/utils/helpers.js +3 -3
- package/src/utils/listpage1.js +2 -2
- package/src/utils/listview.js +2 -2
- package/src/utils/preset-selector.js +2 -5
- package/src/utils/wss.js +26 -18
- package/src/widgets/CarouselSetting.vue +10 -0
- package/src/widgets/Header1Setting.vue +1 -1
- package/src/widgets/Header2.vue +26 -14
- package/src/widgets/Header2Setting.vue +12 -8
- package/src/widgets/MenuEditor.vue +127 -30
- package/src/widgets/StyleSetting2.vue +90 -0
- package/src/widgets/WebPageBuilder2.vue +149 -93
- package/src/widgets/WebPageBuilder3.vue +626 -0
- package/src/widgets/WebPagePreview.vue +295 -0
- package/src/widgets/IconSelector.vue +0 -179
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mixd-id/web-scaffold",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.230406303",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite serve",
|
|
7
7
|
"build": "vite build",
|
|
@@ -39,13 +39,11 @@
|
|
|
39
39
|
"@tailwindcss/line-clamp": "^0.4.0",
|
|
40
40
|
"@vueuse/core": "^9.0.2",
|
|
41
41
|
"adm-zip": "^0.5.10",
|
|
42
|
-
"axios": "^1.3.4",
|
|
43
42
|
"chart.js": "^4.2.1",
|
|
44
43
|
"compression": "^1.7.4",
|
|
45
44
|
"cookie-parser": "^1.4.6",
|
|
46
45
|
"cors": "^2.8.5",
|
|
47
46
|
"crypto-js": "^4.2.0",
|
|
48
|
-
"daisyui": "^2.19.0",
|
|
49
47
|
"dayjs": "^1.11.2",
|
|
50
48
|
"eventemitter2": "^6.4.7",
|
|
51
49
|
"exceljs": "^4.3.0",
|
package/src/components/Alert.vue
CHANGED
|
@@ -130,8 +130,14 @@ export default{
|
|
|
130
130
|
|
|
131
131
|
message(){
|
|
132
132
|
if(this.err.errors){
|
|
133
|
-
return typeof this.err.errors === 'object' &&
|
|
134
|
-
Object.
|
|
133
|
+
return typeof this.err.errors === 'object' &&
|
|
134
|
+
Object.keys(this.err.errors).length > 0 ?
|
|
135
|
+
Object.values(this.err.errors).map(_ => {
|
|
136
|
+
if(Array.isArray(_))
|
|
137
|
+
return _
|
|
138
|
+
return JSON.stringify(_)
|
|
139
|
+
})
|
|
140
|
+
.join("\n"):
|
|
135
141
|
this.err.errors
|
|
136
142
|
}
|
|
137
143
|
else if(this.err.reason){
|
|
@@ -216,7 +222,7 @@ export default{
|
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
.details{
|
|
219
|
-
@apply flex-1 flex flex-col gap-4 overflow-
|
|
225
|
+
@apply flex-1 flex flex-col gap-4 overflow-auto min-h-[1.6rem] self-stretch;
|
|
220
226
|
}
|
|
221
227
|
.details::-webkit-scrollbar {
|
|
222
228
|
display: none;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button :class="compClass" :disabled="isDisabled" @click="onClick" :style="computedStyle"
|
|
2
|
+
<button :class="compClass" :disabled="isDisabled" @click="onClick" :style="computedStyle"
|
|
3
|
+
v-tooltip="disabledText">
|
|
3
4
|
<slot>{{ text }}</slot>
|
|
4
5
|
<div v-if="isLoading" :class="$style.loadingPane">
|
|
5
6
|
<svg :class="$style.spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
@@ -38,6 +39,8 @@ export default{
|
|
|
38
39
|
|
|
39
40
|
width: Array,
|
|
40
41
|
|
|
42
|
+
disabledText: String
|
|
43
|
+
|
|
41
44
|
},
|
|
42
45
|
|
|
43
46
|
computed:{
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
|
|
36
36
|
<script>
|
|
37
37
|
|
|
38
|
-
import {parseBoolean} from "../utils/helpers.mjs";
|
|
39
38
|
import {componentMixin} from "../mixin/component";
|
|
40
39
|
|
|
41
40
|
export default{
|
|
@@ -55,7 +54,7 @@ export default{
|
|
|
55
54
|
|
|
56
55
|
autoPlay: [ Number, String ],
|
|
57
56
|
|
|
58
|
-
useLegend: Boolean
|
|
57
|
+
useLegend: [ Boolean, Number ],
|
|
59
58
|
|
|
60
59
|
},
|
|
61
60
|
|
|
@@ -161,7 +160,7 @@ export default{
|
|
|
161
160
|
let index = this.index + 1
|
|
162
161
|
|
|
163
162
|
if(index >= this.items.length)
|
|
164
|
-
index =
|
|
163
|
+
index = useBack === true ? 0 : this.items.length - 1
|
|
165
164
|
|
|
166
165
|
this.index = index
|
|
167
166
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<Modal :state="isOpen" width="400" height="400" :class="$style.previewModal">
|
|
3
3
|
<div class="flex-1 flex flex-col">
|
|
4
4
|
<div class="flex flex-row justify-end items-center p-3">
|
|
5
|
-
<a v-if="download" :href="imageUrl" download>
|
|
5
|
+
<a v-if="download" :href="imageUrl" target="_blank" download>
|
|
6
6
|
<svg xmlns="http://www.w3.org/2000/svg" width="42" height="42" viewBox="0 0 24 24" class="fill-text"><path class="primary" d="M15 15v-3a3 3 0 0 0-6 0v3H6a4 4 0 0 1-.99-7.88 5.5 5.5 0 0 1 10.86-.82A4.49 4.49 0 0 1 22 10.5a4.5 4.5 0 0 1-4.5 4.5H15z"/><path class="secondary" d="M11 18.59V12a1 1 0 0 1 2 0v6.59l1.3-1.3a1 1 0 0 1 1.4 1.42l-3 3a1 1 0 0 1-1.4 0l-3-3a1 1 0 0 1 1.4-1.42l1.3 1.3z"/></svg>
|
|
7
7
|
</a>
|
|
8
8
|
<button class="ml-3" @click="close">
|
package/src/components/List.vue
CHANGED
|
@@ -379,7 +379,7 @@ export default{
|
|
|
379
379
|
},
|
|
380
380
|
|
|
381
381
|
loadPreset(){
|
|
382
|
-
if(!(
|
|
382
|
+
if(!Object.keys(this.$route.query).map(_ => _.toLowerCase()).includes('reset')){
|
|
383
383
|
if(this.presetKey){
|
|
384
384
|
return this.socket.send('user.preset', { key:this.presetKey })
|
|
385
385
|
.then(config => {
|
|
@@ -394,7 +394,7 @@ export default{
|
|
|
394
394
|
|
|
395
395
|
const query = {}
|
|
396
396
|
for(let key in this.$route.query){
|
|
397
|
-
if(key !== 'reset')
|
|
397
|
+
if(key.toLowerCase() !== 'reset')
|
|
398
398
|
query[key] = this.$route.query[key]
|
|
399
399
|
}
|
|
400
400
|
this.$router.replace({
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="$style.slider">
|
|
3
3
|
|
|
4
|
-
<div ref="bar"
|
|
4
|
+
<div ref="bar">
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
<div ref="highlight"></div>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
<div v-show="mode === 'double'"
|
|
9
|
+
ref="left"
|
|
10
|
+
@mousedown.prevent.capture="onMouseDown"
|
|
11
|
+
@touchstart.passive.capture="onMouseDown">
|
|
12
|
+
<slot name="inner"></slot>
|
|
13
|
+
</div>
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<div ref="right"
|
|
16
|
+
@mousedown.prevent.capture="onMouseDown"
|
|
17
|
+
@touchstart.passive.capture="onMouseDown">
|
|
18
|
+
<slot name="inner"></slot>
|
|
19
|
+
</div>
|
|
17
20
|
|
|
21
|
+
</div>
|
|
18
22
|
</div>
|
|
19
23
|
</template>
|
|
20
24
|
|
|
@@ -24,6 +28,8 @@ export default{
|
|
|
24
28
|
|
|
25
29
|
props:{
|
|
26
30
|
|
|
31
|
+
items: Array,
|
|
32
|
+
|
|
27
33
|
modelValue:{
|
|
28
34
|
type: [ String, Number ],
|
|
29
35
|
default: ''
|
|
@@ -53,79 +59,59 @@ export default{
|
|
|
53
59
|
|
|
54
60
|
computed:{
|
|
55
61
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
cItems(){
|
|
63
|
+
|
|
64
|
+
let items = []
|
|
65
|
+
|
|
66
|
+
if(this.items){
|
|
67
|
+
items = this.items
|
|
60
68
|
}
|
|
61
|
-
|
|
69
|
+
else{
|
|
70
|
+
|
|
71
|
+
for(let i = this.min ; i <= this.max ; i += this.step){
|
|
72
|
+
items.push(i)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if(items[items.length - 1] !== this.max)
|
|
76
|
+
items.push(this.max)
|
|
62
77
|
|
|
63
|
-
l2Val(){
|
|
64
|
-
if(this.isMounted){
|
|
65
|
-
const [ from, to ] = this.modelValue.toString().split('-')
|
|
66
|
-
return this.mode === 'double' ? (!isNaN(parseInt(to)) ? parseInt(to) : parseInt(from)) : parseInt(from)
|
|
67
78
|
}
|
|
79
|
+
|
|
80
|
+
return items
|
|
81
|
+
|
|
68
82
|
},
|
|
69
83
|
|
|
70
|
-
|
|
84
|
+
l1Val(){
|
|
71
85
|
if(this.isMounted){
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
|
|
75
|
-
return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
86
|
+
const [ from, to ] = this.modelValue.toString().split('-')
|
|
87
|
+
return parseInt(from)
|
|
76
88
|
}
|
|
77
89
|
},
|
|
78
90
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const min = this.l1Val ? this.l1Val : parseInt(this.min)
|
|
82
|
-
const max = parseInt(this.max)
|
|
83
|
-
const l2Val = this.l2Val > max ? max : (this.l2Val < min ? min : this.l2Val)
|
|
84
|
-
|
|
85
|
-
return (Math.round((l2Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
86
|
-
}
|
|
91
|
+
l1Index(){
|
|
92
|
+
return this.cItems.indexOf(this.l1Val)
|
|
87
93
|
},
|
|
88
94
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (this.mode === 'double') {
|
|
92
|
-
const min = parseInt(this.min)
|
|
93
|
-
const max = this.l2Val
|
|
94
|
-
const l1Val = this.l1Val > max ? max : (this.l1Val < min ? min : this.l1Val)
|
|
95
|
-
return (Math.round((l1Val - parseInt(this.min)) / parseInt(this.step))) * this.stepDistance
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
return 0
|
|
99
|
-
}
|
|
100
|
-
}
|
|
95
|
+
l2Index(){
|
|
96
|
+
return this.cItems.indexOf(this.l2Val)
|
|
101
97
|
},
|
|
102
98
|
|
|
103
|
-
|
|
99
|
+
l2Val(){
|
|
104
100
|
if(this.isMounted){
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
else{
|
|
109
|
-
return this.rootWidth - (Math.round(this.l2Left + (this.$refs.right.clientWidth / 2)))
|
|
110
|
-
}
|
|
101
|
+
const [ from, to ] = this.modelValue.toString().split('-')
|
|
102
|
+
return this.mode === 'double' ? (!isNaN(parseInt(to)) ? parseInt(to) : parseInt(from)) : parseInt(from)
|
|
111
103
|
}
|
|
112
104
|
},
|
|
113
105
|
|
|
114
|
-
|
|
115
|
-
if(this.isMounted)
|
|
116
|
-
return this.rootWidth - this.$refs.right.clientWidth
|
|
117
|
-
},
|
|
106
|
+
|
|
118
107
|
|
|
119
108
|
stepDistance(){
|
|
120
109
|
if(this.isMounted){
|
|
121
|
-
|
|
122
|
-
const max = parseInt(this.max)
|
|
123
|
-
const step = parseInt(this.step)
|
|
124
|
-
const totalStep = (max - min) / step
|
|
125
|
-
return this.trackWidth / totalStep
|
|
110
|
+
return this.$refs.bar.clientWidth / this.cItems.length
|
|
126
111
|
}
|
|
127
112
|
return 0
|
|
128
|
-
}
|
|
113
|
+
},
|
|
114
|
+
|
|
129
115
|
|
|
130
116
|
},
|
|
131
117
|
|
|
@@ -134,6 +120,11 @@ export default{
|
|
|
134
120
|
isMounted: 0,
|
|
135
121
|
rootWidth: 0,
|
|
136
122
|
startValue: null, // Mouse down start value
|
|
123
|
+
startIndex: null,
|
|
124
|
+
l1LeftPx: '',
|
|
125
|
+
l2LeftPx: '',
|
|
126
|
+
hgLeftPx: '',
|
|
127
|
+
hgRightPx: '',
|
|
137
128
|
}
|
|
138
129
|
},
|
|
139
130
|
|
|
@@ -142,10 +133,30 @@ export default{
|
|
|
142
133
|
mounted(){
|
|
143
134
|
this.rootWidth = this.$el.clientWidth
|
|
144
135
|
this.isMounted = 1
|
|
136
|
+
this.paint()
|
|
145
137
|
},
|
|
146
138
|
|
|
147
139
|
methods:{
|
|
148
140
|
|
|
141
|
+
paint(){
|
|
142
|
+
if(!this.isMounted) return
|
|
143
|
+
|
|
144
|
+
const barWidth = this.$refs.bar.clientWidth
|
|
145
|
+
const stepWidth = Math.round(barWidth / (this.cItems.length - 1))
|
|
146
|
+
const l1Left = Math.round(this.l1Index * stepWidth)
|
|
147
|
+
|
|
148
|
+
const buttonHalfWidth = this.$refs.right.clientWidth / 2
|
|
149
|
+
|
|
150
|
+
let l2Left = Math.round((this.l2Index * stepWidth) - buttonHalfWidth)
|
|
151
|
+
if(l2Left > barWidth - buttonHalfWidth)
|
|
152
|
+
l2Left = barWidth - buttonHalfWidth
|
|
153
|
+
|
|
154
|
+
this.l1LeftPx = l1Left + "px"
|
|
155
|
+
this.l2LeftPx = l2Left + "px"
|
|
156
|
+
this.hgLeftPx = 0
|
|
157
|
+
this.hgRightPx = (barWidth - l2Left - buttonHalfWidth) + "px"
|
|
158
|
+
},
|
|
159
|
+
|
|
149
160
|
valueFromDistance(distance, startValue){
|
|
150
161
|
const stepCount = Math.round(Math.abs(distance) / this.stepDistance)
|
|
151
162
|
return startValue + (stepCount * this.step) * (distance > 0 ? 1 : -1)
|
|
@@ -183,8 +194,10 @@ export default{
|
|
|
183
194
|
}
|
|
184
195
|
}
|
|
185
196
|
else{
|
|
186
|
-
|
|
187
|
-
|
|
197
|
+
const increment = Math.round(distance / this.stepDistance)
|
|
198
|
+
const nextIndex = this.startIndex + increment
|
|
199
|
+
const value = this.cItems[nextIndex]
|
|
200
|
+
if(value && value !== this.modelValue){
|
|
188
201
|
this.$emit('update:modelValue', value)
|
|
189
202
|
}
|
|
190
203
|
}
|
|
@@ -225,15 +238,9 @@ export default{
|
|
|
225
238
|
window.removeEventListener('touchmove', this.onMouseMove)
|
|
226
239
|
window.removeEventListener('touchend', this.onMouseUp)
|
|
227
240
|
|
|
228
|
-
this.$refs[this.current].style.left = ((this.current === 'left' ? this.l1Left : this.l2Left)) + "px"
|
|
229
|
-
|
|
230
|
-
this.$refs.highlight.style.left = (this.hgLeft) + "px"
|
|
231
|
-
this.$refs.highlight.style.right = (this.hgRight) + "px"
|
|
232
|
-
|
|
233
241
|
if(this.modelValue !== this.startValue){
|
|
234
242
|
this.$emit('change')
|
|
235
243
|
}
|
|
236
|
-
|
|
237
244
|
this.startValue = null
|
|
238
245
|
},
|
|
239
246
|
|
|
@@ -241,14 +248,25 @@ export default{
|
|
|
241
248
|
|
|
242
249
|
this.current = e.target === this.$refs.right ? 'right' : 'left'
|
|
243
250
|
this.startX = typeof e.touches !== 'undefined' ? e.touches[0].clientX : e.clientX
|
|
244
|
-
this.startLeft = parseInt(this.$refs[this.current].style.left)
|
|
245
251
|
this.startValue = this.modelValue
|
|
252
|
+
this.startIndex = this.l2Index
|
|
246
253
|
|
|
247
254
|
window.addEventListener('mousemove', this.onMouseMove)
|
|
248
255
|
window.addEventListener('mouseup', this.onMouseUp)
|
|
249
256
|
window.addEventListener('touchmove', this.onMouseMove)
|
|
250
257
|
window.addEventListener('touchend', this.onMouseUp, { passive:true })
|
|
251
258
|
}
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
watch: {
|
|
262
|
+
|
|
263
|
+
l2Index: {
|
|
264
|
+
handler(){
|
|
265
|
+
this.paint()
|
|
266
|
+
},
|
|
267
|
+
immediate: true
|
|
268
|
+
}
|
|
269
|
+
|
|
252
270
|
}
|
|
253
271
|
|
|
254
272
|
}
|
|
@@ -259,27 +277,28 @@ export default{
|
|
|
259
277
|
|
|
260
278
|
.slider{
|
|
261
279
|
@apply h-[var(--h-cp)];
|
|
262
|
-
@apply relative;
|
|
263
280
|
}
|
|
264
281
|
|
|
265
282
|
.slider>div:nth-child(1){
|
|
266
|
-
@apply
|
|
283
|
+
@apply relative bg-text-50 rounded-lg;
|
|
267
284
|
height: .5rem;
|
|
268
285
|
top: 50%;
|
|
269
|
-
left: .
|
|
270
|
-
right: .
|
|
286
|
+
margin-left: 1.25rem;
|
|
287
|
+
margin-right: 1.25rem;
|
|
271
288
|
transform: translate3d(0, -50%, 0);
|
|
272
289
|
}
|
|
273
290
|
|
|
274
|
-
.slider>div:nth-child(
|
|
291
|
+
.slider>div:nth-child(1)>div:nth-child(1){
|
|
275
292
|
@apply absolute bg-primary rounded-lg;
|
|
276
293
|
height: .5rem;
|
|
277
294
|
top: 50%;
|
|
295
|
+
left: v-bind(hgLeftPx);
|
|
296
|
+
right: v-bind(hgRightPx);
|
|
278
297
|
transform: translate3d(0, -50%, 0);
|
|
279
298
|
}
|
|
280
299
|
|
|
281
|
-
.slider>div:nth-child(
|
|
282
|
-
.slider>div:nth-child(
|
|
300
|
+
.slider>div:nth-child(1)>div:nth-child(2),
|
|
301
|
+
.slider>div:nth-child(1)>div:nth-child(3){
|
|
283
302
|
@apply absolute w-[2.5rem] h-[2.5rem] rounded-full bg-white shadow-sm border-[1px] border-text-200;
|
|
284
303
|
@apply flex;
|
|
285
304
|
top: 50%;
|
|
@@ -287,4 +306,12 @@ export default{
|
|
|
287
306
|
touch-action: none;
|
|
288
307
|
}
|
|
289
308
|
|
|
309
|
+
.slider>div:nth-child(1)>div:nth-child(2){
|
|
310
|
+
left: v-bind(l1LeftPx)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.slider>div:nth-child(1)>div:nth-child(3){
|
|
314
|
+
left: v-bind(l2LeftPx)
|
|
315
|
+
}
|
|
316
|
+
|
|
290
317
|
</style>
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
<TreeViewItem v-for="(item, index) in items"
|
|
5
5
|
:item="item"
|
|
6
|
+
:selectedItem="selectedItem"
|
|
6
7
|
:index="index"
|
|
7
8
|
:parent="parent"
|
|
9
|
+
:config="config"
|
|
8
10
|
:depth="0"
|
|
9
|
-
:model-value="modelValue"
|
|
10
|
-
@moveup="moveUp(item)"
|
|
11
|
-
@movedown="moveDown(item)"
|
|
12
11
|
@change="$emit('change')">
|
|
13
12
|
<template #default="{ item, parent, index, depth }">
|
|
14
13
|
<slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
|
|
@@ -27,7 +26,7 @@ export default{
|
|
|
27
26
|
|
|
28
27
|
components: {TreeViewItem},
|
|
29
28
|
|
|
30
|
-
emits: [ 'change'
|
|
29
|
+
emits: [ 'change' ],
|
|
31
30
|
|
|
32
31
|
inject: [ 'confirm', 'toast' ],
|
|
33
32
|
|
|
@@ -35,53 +34,10 @@ export default{
|
|
|
35
34
|
|
|
36
35
|
items: Array,
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
selectedItem: Object,
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
methods: {
|
|
43
|
-
|
|
44
|
-
copy(){
|
|
45
|
-
if(this.modelValue){
|
|
46
|
-
copyToClipboard(JSON.stringify(this.modelValue))
|
|
47
|
-
.then(() => this.toast('Copied to clipboard'))
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
paste(){
|
|
52
|
-
getClipboardData().then(text => {
|
|
53
|
-
try{
|
|
54
|
-
const item = JSON.parse(text)
|
|
55
|
-
this.$emit('paste', item)
|
|
56
|
-
}
|
|
57
|
-
catch(e){}
|
|
58
|
-
})
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
moveDown(item){
|
|
62
|
-
const idx = this.items.indexOf(item)
|
|
63
|
-
if(idx < this.items.length - 1){
|
|
64
|
-
this.items.splice(idx + 1, 0, this.items.splice(idx, 1)[0])
|
|
65
|
-
this.$emit('change')
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
moveUp(item){
|
|
70
|
-
const idx = this.items.indexOf(item)
|
|
71
|
-
if(idx - 1 >= 0){
|
|
72
|
-
this.items.splice(idx - 1, 0, this.items.splice(idx, 1)[0])
|
|
73
|
-
this.$emit('change')
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
add(){
|
|
78
|
-
this.$emit('add', this.items)
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
39
|
+
config: Object,
|
|
82
40
|
|
|
83
|
-
mounted() {
|
|
84
|
-
window.addEventListener('keydown', this.onKeyUp)
|
|
85
41
|
},
|
|
86
42
|
|
|
87
43
|
computed: {
|
|
@@ -94,11 +50,6 @@ export default{
|
|
|
94
50
|
|
|
95
51
|
},
|
|
96
52
|
|
|
97
|
-
watch: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
53
|
}
|
|
103
54
|
|
|
104
55
|
</script>
|
|
@@ -40,12 +40,11 @@
|
|
|
40
40
|
v-show="item && Array.isArray(item.items) && !childCollapsed" class="ml-6">
|
|
41
41
|
<TreeViewItem v-for="(subItem, index) in item.items"
|
|
42
42
|
:item="subItem"
|
|
43
|
+
:config="config"
|
|
43
44
|
:parent="item"
|
|
44
45
|
:index="index"
|
|
45
46
|
:depth="depth + 1"
|
|
46
|
-
:
|
|
47
|
-
@moveup="moveUp(subItem)"
|
|
48
|
-
@movedown="moveDown(subItem)"
|
|
47
|
+
:selected-item="selectedItem"
|
|
49
48
|
@change="$emit('change')">
|
|
50
49
|
<template #default="{ item, parent, index, depth }">
|
|
51
50
|
<slot :item="item" :parent="parent" :index="index" :depth="depth"></slot>
|
|
@@ -64,7 +63,7 @@ export default{
|
|
|
64
63
|
|
|
65
64
|
name: 'TreeViewItem',
|
|
66
65
|
|
|
67
|
-
emits: [ 'change'
|
|
66
|
+
emits: [ 'change' ],
|
|
68
67
|
|
|
69
68
|
inject: [ 'confirm', 'toast' ],
|
|
70
69
|
|
|
@@ -74,7 +73,7 @@ export default{
|
|
|
74
73
|
parent: Object,
|
|
75
74
|
index: Number,
|
|
76
75
|
depth: Number,
|
|
77
|
-
|
|
76
|
+
selectedItem: Object,
|
|
78
77
|
state: {
|
|
79
78
|
type: [ Number, String ],
|
|
80
79
|
default: 1
|
|
@@ -83,27 +82,6 @@ export default{
|
|
|
83
82
|
|
|
84
83
|
methods: {
|
|
85
84
|
|
|
86
|
-
moveDown(item){
|
|
87
|
-
const idx = this.item.items.indexOf(item)
|
|
88
|
-
if(idx < this.item.items.length - 1){
|
|
89
|
-
this.item.items.splice(idx + 1, 0, this.item.items.splice(idx, 1)[0])
|
|
90
|
-
this.$emit('change')
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
moveUp(item){
|
|
95
|
-
const idx = this.item.items.indexOf(item)
|
|
96
|
-
if(idx - 1 >= 0){
|
|
97
|
-
this.item.items.splice(idx - 1, 0, this.item.items.splice(idx, 1)[0])
|
|
98
|
-
this.$emit('change')
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
add(){
|
|
103
|
-
this.$emit('add', this.item.items)
|
|
104
|
-
this.childCollapsed = false
|
|
105
|
-
},
|
|
106
|
-
|
|
107
85
|
mouseDown(e){
|
|
108
86
|
if(!this.$el || this.$el.nodeType !== 1) return
|
|
109
87
|
|
|
@@ -306,19 +284,19 @@ export default{
|
|
|
306
284
|
computed: {
|
|
307
285
|
|
|
308
286
|
componentStore(){
|
|
309
|
-
if(this.
|
|
310
|
-
if(!this.
|
|
311
|
-
this.
|
|
287
|
+
if(this.config){
|
|
288
|
+
if(!this.config.components)
|
|
289
|
+
this.config.components = {}
|
|
312
290
|
|
|
313
|
-
if(!this.
|
|
314
|
-
this.
|
|
291
|
+
if(!this.config.components.treeviewitem)
|
|
292
|
+
this.config.components.treeviewitem = {}
|
|
315
293
|
|
|
316
|
-
return this.
|
|
294
|
+
return this.config.components.treeviewitem
|
|
317
295
|
}
|
|
318
296
|
},
|
|
319
297
|
|
|
320
298
|
isSelected(){
|
|
321
|
-
return this.
|
|
299
|
+
return this.selectedItem === this.item
|
|
322
300
|
},
|
|
323
301
|
|
|
324
302
|
itemClass(){
|
|
@@ -335,9 +313,7 @@ export default{
|
|
|
335
313
|
|
|
336
314
|
data(){
|
|
337
315
|
return {
|
|
338
|
-
childCollapsed: true
|
|
339
|
-
hvm: null,
|
|
340
|
-
cConfig: {}
|
|
316
|
+
childCollapsed: true
|
|
341
317
|
}
|
|
342
318
|
},
|
|
343
319
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cart-plus": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d=\"M176 416c-26.51 0-47.1 21.49-47.1 48S149.5 512 176 512s47.1-21.49 47.1-48S202.5 416 176 416zM569.5 44.73C563.4 36.64 554.1 32 543.1 32H121.1L119.6 19.51C117.4 8.191 107.5 0 96 0H23.1C10.75 0 0 10.75 0 23.1S10.75 48 23.1 48h52.14l60.28 316.5C138.6 375.8 148.5 384 160 384H488c13.25 0 24-10.75 24-23.1C512 346.7 501.3 336 488 336H179.9L170.7 288h318.4c14.29 0 26.84-9.47 30.77-23.21l54.86-191.1C577.5 63.05 575.6 52.83 569.5 44.73zM416 160c0 11.31-9.256 20.57-20.57 20.57h-38.86v38.85C356.6 230.7 347.3 240 336 240s-20.57-9.258-20.57-20.57V180.6H276.6C265.3 180.6 256 171.3 256 160s9.256-20.57 20.57-20.57h38.86V100.6c0-11.31 9.258-20.57 20.57-20.57s20.57 9.256 20.57 20.57v38.85h38.86C406.7 139.4 416 148.7 416 160zM463.1 416c-26.51 0-47.1 21.49-47.1 48s21.49 48 47.1 48s47.1-21.49 47.1-48S490.5 416 463.1 416z\"/></svg>",
|
|
3
|
+
"magnifying-glass": "<svg 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>",
|
|
4
|
+
"user": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d=\"M224 256c70.7 0 128-57.31 128-128s-57.3-128-128-128C153.3 0 96 57.31 96 128S153.3 256 224 256zM274.7 304H173.3C77.61 304 0 381.6 0 477.3c0 19.14 15.52 34.67 34.66 34.67h378.7C432.5 512 448 496.5 448 477.3C448 381.6 370.4 304 274.7 304z\"/></svg>",
|
|
5
|
+
"file-invoice": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 384 512\"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d=\"M256 0v128h128L256 0zM288 256H96v64h192V256zM224 128L224 0H48C21.49 0 0 21.49 0 48v416C0 490.5 21.49 512 48 512h288c26.51 0 48-21.49 48-48V160h-127.1C238.3 160 224 145.7 224 128zM64 72C64 67.63 67.63 64 72 64h80C156.4 64 160 67.63 160 72v16C160 92.38 156.4 96 152 96h-80C67.63 96 64 92.38 64 88V72zM64 136C64 131.6 67.63 128 72 128h80C156.4 128 160 131.6 160 136v16C160 156.4 156.4 160 152 160h-80C67.63 160 64 156.4 64 152V136zM320 440c0 4.375-3.625 8-8 8h-80C227.6 448 224 444.4 224 440v-16c0-4.375 3.625-8 8-8h80c4.375 0 8 3.625 8 8V440zM320 240v96c0 8.875-7.125 16-16 16h-224C71.13 352 64 344.9 64 336v-96C64 231.1 71.13 224 80 224h224C312.9 224 320 231.1 320 240z\"/></svg>",
|
|
6
|
+
"folder-arrow-down": "<svg 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=\"M464 96h-192l-64-64h-160C21.5 32 0 53.5 0 80v352C0 458.5 21.5 480 48 480h416c26.5 0 48-21.5 48-48v-288C512 117.5 490.5 96 464 96zM159 271C163.7 266.3 169.8 264 176 264s12.28 2.344 16.97 7.031L232 310.1V200C232 186.8 242.8 176 256 176s24 10.75 24 24v110.1l39.03-39.03c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94l-80 80c-9.375 9.375-24.56 9.375-33.94 0l-80-80C149.7 295.6 149.7 280.4 159 271z\"/></svg>",
|
|
7
|
+
"arrow-up-square": "<svg 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=\"M167.8 159.7c8.895 0 17.63-3.71 23.76-10.39L224 113.9V320c0 17.7 14.33 32.02 32 32.02S288 337.7 288 320V113.9l32.4 35.39c6.32 6.879 14.96 10.38 23.63 10.38c17.64 0 31.97-14.29 31.97-32.01c0-7.734-2.78-15.51-8.409-21.66l-87.1-96.09C273.5 3.312 264.8-.0002 256-.0002S238.5 3.312 232.4 9.945l-87.1 96.09c-5.629 6.152-8.409 13.93-8.409 21.66C135.1 145.4 150.3 159.7 167.8 159.7zM448 96h-32v63.92L448 160v288H64V160l32-.0824V96H64C28.72 96 0 124.7 0 160v288c0 35.28 28.72 64 64 64h384c35.28 0 64-28.72 64-64V160C512 124.7 483.3 96 448 96z\"/></svg>",
|
|
8
|
+
"camera": "<svg 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=\"M464 96h-88l-12.38-32.88C356.6 44.38 338.8 32 318.8 32h-125.5c-20 0-38 12.38-45 31.12L136 96H48C21.5 96 0 117.5 0 144v288C0 458.5 21.5 480 48 480h416c26.5 0 48-21.5 48-48v-288C512 117.5 490.5 96 464 96zM256 384c-53 0-96-43-96-96s43-96 96-96s96 43 96 96S309 384 256 384z\"/></svg>",
|
|
9
|
+
"home": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 576 512\"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d=\"M575.1 256c-.0006 17.6-14.27 31.1-32.01 31.1L511.1 288l.0031 160c0 35.35-28.65 64-63.1 64H128c-35.35 0-63.1-28.65-63.1-64L64.02 288h-32.02c-17.78 0-32-14.44-32-31.1c-.0004-9.052 3.842-17.9 10.92-24.1l255.1-223.1c6.963-6.098 14.93-7.918 21.08-7.918c7.523 0 15.05 2.637 21.08 7.918l255.1 223.1C572.2 238.1 575.1 246.1 575.1 256z\"/></svg>",
|
|
10
|
+
"list-ul": "<svg 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=\"M48 208C21.49 208 0 229.5 0 256s21.49 48 48 48S96 282.5 96 256S74.51 208 48 208zM48 368C21.49 368 0 389.5 0 416s21.49 48 48 48S96 442.5 96 416S74.51 368 48 368zM48 48C21.49 48 0 69.49 0 96s21.49 48 48 48S96 122.5 96 96S74.51 48 48 48zM192 128h288c17.67 0 32-14.33 32-31.1S497.7 64 480 64H192C174.3 64 160 78.33 160 95.1S174.3 128 192 128zM480 224H192C174.3 224 160 238.3 160 256s14.33 32 32 32h288c17.67 0 32-14.33 32-32S497.7 224 480 224zM480 384H192c-17.67 0-32 14.33-32 32s14.33 32 32 32h288c17.67 0 32-14.33 32-32S497.7 384 480 384z\"/></svg>",
|
|
11
|
+
"bars": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><!--! Font Awesome Pro 6.0.0-alpha3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d=\"M416 224H31.1C14.33 224 0 238.3 0 256s14.33 32 31.1 32h384C433.7 288 448 273.7 448 256S433.7 224 416 224zM416 384H31.1C14.33 384 0 398.3 0 415.1S14.33 448 31.1 448h384C433.7 448 448 433.7 448 416S433.7 384 416 384zM416 64H31.1C14.33 64 0 78.33 0 95.1S14.33 128 31.1 128h384C433.7 128 448 113.7 448 96S433.7 64 416 64z\"/></svg>"
|
|
12
|
+
}
|