@mixd-id/web-scaffold 0.1.230406063 → 0.1.230406065
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/Box.vue +7 -2
- package/src/components/Flex.vue +89 -0
- package/src/components/Grid.vue +25 -11
- package/src/components/Tabs.vue +38 -5
- package/src/components/Textbox.vue +2 -2
- package/src/components/TreeView.vue +84 -0
- package/src/components/TreeViewItem.vue +176 -0
- package/src/index.js +4 -0
- package/src/utils/listview.js +4 -79
- package/src/components/GridColumn.vue +0 -31
package/package.json
CHANGED
package/src/components/Box.vue
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
export default{
|
|
10
10
|
|
|
11
11
|
props: {
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'Box'
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
}
|
|
@@ -19,7 +24,7 @@ export default{
|
|
|
19
24
|
<style module>
|
|
20
25
|
|
|
21
26
|
.comp{
|
|
22
|
-
@apply
|
|
27
|
+
@apply border-[1px] border-text-200 flex items-center justify-center;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computedClass">
|
|
3
|
+
|
|
4
|
+
<component v-for="(item, idx) in items"
|
|
5
|
+
:is="item.type"
|
|
6
|
+
:="item.props"
|
|
7
|
+
:items="item.items"
|
|
8
|
+
:class="classOf(item, idx)"></component>
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
|
|
15
|
+
export default{
|
|
16
|
+
|
|
17
|
+
props:{
|
|
18
|
+
items: Array,
|
|
19
|
+
type: Array,
|
|
20
|
+
columnType: Array,
|
|
21
|
+
columns: Array,
|
|
22
|
+
gap: Array,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
computed: {
|
|
26
|
+
|
|
27
|
+
computedClass(){
|
|
28
|
+
|
|
29
|
+
const classNames = [
|
|
30
|
+
'flex'
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
if(Array.isArray(this.type)){
|
|
34
|
+
for(let i in this.type){
|
|
35
|
+
classNames.push(this.prefixes[i] + 'flex-' + this.type[i])
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if(Array.isArray(this.gap)){
|
|
40
|
+
for(let i in this.gap){
|
|
41
|
+
classNames.push(this.prefixes[i] + 'gap-' + this.gap[i])
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return classNames.join(' ')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
methods: {
|
|
51
|
+
|
|
52
|
+
classOf(item, idx){
|
|
53
|
+
|
|
54
|
+
const classNames = []
|
|
55
|
+
for(let i in this.columns){
|
|
56
|
+
const column = this.columns[i][idx % this.columns.length]
|
|
57
|
+
|
|
58
|
+
if(!column) continue
|
|
59
|
+
|
|
60
|
+
if(column && column.width !== 'auto'){
|
|
61
|
+
classNames.push(`${this.prefixes[i]}w-[${column.width}]`)
|
|
62
|
+
}
|
|
63
|
+
else{
|
|
64
|
+
classNames.push(`${this.prefixes[i]}flex-1`)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return classNames.join(' ')
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
data(){
|
|
72
|
+
return {
|
|
73
|
+
prefixes: [
|
|
74
|
+
'',
|
|
75
|
+
'md:'
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style module>
|
|
85
|
+
|
|
86
|
+
.comp{
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
</style>
|
package/src/components/Grid.vue
CHANGED
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="gridClass">
|
|
3
|
-
<component v-for="
|
|
3
|
+
<component v-for="item in items" :is="item.type" :="item.props" :items="item.items"
|
|
4
|
+
:class="classOf(item)"></component>
|
|
4
5
|
</div>
|
|
5
6
|
</template>
|
|
6
7
|
|
|
7
8
|
<script>
|
|
8
9
|
|
|
9
|
-
const gridCols = [
|
|
10
|
-
"", "", "grid-cols-2", "grid-cols-3", "grid-cols-4"
|
|
11
|
-
]
|
|
12
|
-
|
|
13
10
|
export default{
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
|
|
12
|
+
props:{
|
|
13
|
+
items: Array,
|
|
14
|
+
columns: undefined,
|
|
15
|
+
gap: undefined
|
|
16
|
+
},
|
|
17
|
+
|
|
16
18
|
computed:{
|
|
17
19
|
gridClass(){
|
|
18
20
|
return [
|
|
19
21
|
"grid",
|
|
20
|
-
|
|
22
|
+
this.columns[0] ? `grid-cols-${this.columns[0]}` : '',
|
|
23
|
+
this.columns[1] ? `md:grid-cols-${this.columns[1]}` : '',
|
|
24
|
+
`gap-${this.gap}`
|
|
21
25
|
]
|
|
22
26
|
.filter(function(item){ return item.length > 0 })
|
|
23
27
|
.join(' ')
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
methods: {
|
|
32
|
+
|
|
33
|
+
classOf(item){
|
|
34
|
+
return [
|
|
35
|
+
'col-span-' + item.props.colSpan
|
|
36
|
+
]
|
|
37
|
+
.join(' ')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
}
|
|
29
|
-
</script>
|
|
43
|
+
</script>
|
package/src/components/Tabs.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="
|
|
2
|
+
<div :class="computedClass">
|
|
3
3
|
<button v-for="(item, index) in items" :class="tabClass(item)"
|
|
4
4
|
@click="onClick(item)" type="button" >
|
|
5
5
|
<slot v-if="$slots.tab" name="tab" :="{ item, index }"></slot>
|
|
@@ -17,13 +17,26 @@ export default{
|
|
|
17
17
|
emits: [ 'change', 'update:modelValue' ],
|
|
18
18
|
|
|
19
19
|
props: {
|
|
20
|
+
|
|
20
21
|
modelValue: undefined,
|
|
22
|
+
|
|
21
23
|
bodyClass: String,
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
items: Array,
|
|
26
|
+
|
|
27
|
+
variant: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'comp'
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
},
|
|
24
33
|
|
|
25
34
|
computed: {
|
|
26
35
|
|
|
36
|
+
computedClass(){
|
|
37
|
+
return this.$style[this.variant]
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
},
|
|
28
41
|
|
|
29
42
|
methods: {
|
|
@@ -57,12 +70,10 @@ export default{
|
|
|
57
70
|
.comp::-webkit-scrollbar {
|
|
58
71
|
display: none;
|
|
59
72
|
}
|
|
60
|
-
|
|
61
73
|
.comp>*{
|
|
62
74
|
@apply border-b-[2px] border-transparent;
|
|
63
75
|
@apply p-2;
|
|
64
76
|
}
|
|
65
|
-
|
|
66
77
|
.comp>*[class*="active"]{
|
|
67
78
|
@apply border-b-[2px] border-primary;
|
|
68
79
|
}
|
|
@@ -71,4 +82,26 @@ export default{
|
|
|
71
82
|
@apply whitespace-nowrap overflow-hidden;
|
|
72
83
|
}
|
|
73
84
|
|
|
74
|
-
|
|
85
|
+
.button{
|
|
86
|
+
@apply overflow-x-auto;
|
|
87
|
+
@apply flex flex-row;
|
|
88
|
+
scrollbar-width: none;
|
|
89
|
+
@apply border-[1px] border-primary rounded-xl;
|
|
90
|
+
}
|
|
91
|
+
.button>*{
|
|
92
|
+
@apply p-[1px] px-2 m-[1px];
|
|
93
|
+
}
|
|
94
|
+
.button>*:first-child{
|
|
95
|
+
@apply rounded-l-lg;
|
|
96
|
+
}
|
|
97
|
+
.button>*:last-child{
|
|
98
|
+
@apply rounded-r-lg;
|
|
99
|
+
}
|
|
100
|
+
.button>*[class*="active"]{
|
|
101
|
+
@apply bg-primary text-text-500;
|
|
102
|
+
}
|
|
103
|
+
.button>*[class*="active"] *{
|
|
104
|
+
@apply text-white;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
|
|
4
|
+
<TreeViewItem v-for="(item, index) in modelValue"
|
|
5
|
+
:item="item"
|
|
6
|
+
:parent="modelValue"
|
|
7
|
+
@moveup="moveUp(item)"
|
|
8
|
+
@movedown="moveDown(item)"
|
|
9
|
+
@change="$emit('change')"
|
|
10
|
+
@remove="modelValue.splice(index, 1);$emit('change')"
|
|
11
|
+
@add="$emit('add')"
|
|
12
|
+
:create-fn="createFn">
|
|
13
|
+
<template #default="{ item }">
|
|
14
|
+
<slot :item="item"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
</TreeViewItem>
|
|
17
|
+
|
|
18
|
+
<div class="flex flex-row items-center justify-center">
|
|
19
|
+
<button type="button" class="p-3 text-primary flex flex-row gap-1 items-center" @click="add">
|
|
20
|
+
<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>
|
|
21
|
+
Add
|
|
22
|
+
</button>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
|
|
30
|
+
import TreeViewItem from "./TreeViewItem.vue";
|
|
31
|
+
|
|
32
|
+
export default{
|
|
33
|
+
components: {TreeViewItem},
|
|
34
|
+
|
|
35
|
+
emits: [ 'add', 'change' ],
|
|
36
|
+
|
|
37
|
+
props: {
|
|
38
|
+
|
|
39
|
+
modelValue: Array,
|
|
40
|
+
|
|
41
|
+
createFn: undefined
|
|
42
|
+
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
methods: {
|
|
46
|
+
|
|
47
|
+
moveDown(item){
|
|
48
|
+
const idx = this.modelValue.indexOf(item)
|
|
49
|
+
if(idx < this.modelValue.length - 1){
|
|
50
|
+
this.modelValue.splice(idx + 1, 0, this.modelValue.splice(idx, 1)[0])
|
|
51
|
+
this.$emit('change')
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
moveUp(item){
|
|
56
|
+
const idx = this.modelValue.indexOf(item)
|
|
57
|
+
if(idx - 1 >= 0){
|
|
58
|
+
this.modelValue.splice(idx - 1, 0, this.modelValue.splice(idx, 1)[0])
|
|
59
|
+
this.$emit('change')
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
add(){
|
|
64
|
+
if(this.createFn){
|
|
65
|
+
this.createFn((obj) => {
|
|
66
|
+
this.modelValue.push(obj)
|
|
67
|
+
this.$emit('add', this.modelValue[this.modelValue.length - 1])
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style module>
|
|
79
|
+
|
|
80
|
+
.comp{
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div ref="item" :class="$style.item"
|
|
4
|
+
@mouseover="hoverMouseOver" @mouseout="hoverMouseOut">
|
|
5
|
+
<div class="cursor-move" ref="drag" @mousedown="mouseDown">
|
|
6
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"/></svg>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="flex flex-col hidden">
|
|
9
|
+
<button type="button" @click="$emit('moveup')">
|
|
10
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M32.032 352h255.93c28.425 0 42.767-34.488 22.627-54.627l-127.962-128c-12.496-12.496-32.758-12.497-45.255 0l-127.968 128C-10.695 317.472 3.55 352 32.032 352zM160 192l128 128H32l128-128z"/></svg>
|
|
11
|
+
</button>
|
|
12
|
+
<button type="button" @click="$emit('movedown')">
|
|
13
|
+
<svg width="14" height="14" class="fill-text-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M287.968 160H32.038c-28.425 0-42.767 34.488-22.627 54.627l127.962 128c12.496 12.496 32.758 12.497 45.255 0l127.968-128C330.695 194.528 316.45 160 287.968 160zM160 320L32 192h256L160 320z"/></svg>
|
|
14
|
+
</button>
|
|
15
|
+
</div>
|
|
16
|
+
<code class="text-sm">{{ item.type }}</code>
|
|
17
|
+
<slot :item="item"></slot>
|
|
18
|
+
<button type="button" class="py-3" @click="$emit('remove')">
|
|
19
|
+
<svg width="16" height="16" class="fill-primary" 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>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div ref="container" v-if="item && Array.isArray(item.items)" class="ml-8">
|
|
23
|
+
<TreeViewItem v-for="(subItem, index) in item.items"
|
|
24
|
+
:create-fn="createFn"
|
|
25
|
+
:item="subItem"
|
|
26
|
+
:parent="item.items"
|
|
27
|
+
@moveup="moveUp(subItem)"
|
|
28
|
+
@movedown="moveDown(subItem)"
|
|
29
|
+
@remove="item.items.splice(index, 1);$emit('change')"
|
|
30
|
+
@add="$emit('add')"
|
|
31
|
+
@change="$emit('change')">
|
|
32
|
+
<template #default="{ item }">
|
|
33
|
+
<slot :item="item"></slot>
|
|
34
|
+
</template>
|
|
35
|
+
</TreeViewItem>
|
|
36
|
+
|
|
37
|
+
<div class="flex flex-row items-center justify-center mb-2">
|
|
38
|
+
<button type="button" class="p-1 text-primary flex flex-row gap-1 items-center" @click="add">
|
|
39
|
+
<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>
|
|
40
|
+
Add
|
|
41
|
+
</button>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
|
|
49
|
+
let dragged = null
|
|
50
|
+
|
|
51
|
+
export default{
|
|
52
|
+
|
|
53
|
+
emits: [ 'add', 'change', 'moveup', 'movedown', 'remove' ],
|
|
54
|
+
|
|
55
|
+
props: {
|
|
56
|
+
item: Object,
|
|
57
|
+
|
|
58
|
+
createFn: undefined,
|
|
59
|
+
|
|
60
|
+
parent: Array
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
methods: {
|
|
64
|
+
|
|
65
|
+
moveDown(item){
|
|
66
|
+
const idx = this.item.items.indexOf(item)
|
|
67
|
+
if(idx < this.item.items.length - 1){
|
|
68
|
+
this.item.items.splice(idx + 1, 0, this.item.items.splice(idx, 1)[0])
|
|
69
|
+
this.$emit('change')
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
moveUp(item){
|
|
74
|
+
const idx = this.item.items.indexOf(item)
|
|
75
|
+
if(idx - 1 >= 0){
|
|
76
|
+
this.item.items.splice(idx - 1, 0, this.item.items.splice(idx, 1)[0])
|
|
77
|
+
this.$emit('change')
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
add(){
|
|
82
|
+
if(this.createFn){
|
|
83
|
+
this.createFn((obj) => {
|
|
84
|
+
this.item.items.push(obj)
|
|
85
|
+
this.$emit('add', this.item.items[this.item.items.length - 1])
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
mouseDown(e){
|
|
91
|
+
|
|
92
|
+
e.preventDefault()
|
|
93
|
+
|
|
94
|
+
const cloned = this.$el.cloneNode(true)
|
|
95
|
+
cloned.style.position = 'absolute'
|
|
96
|
+
cloned.style.left = (e.clientX - 10) + "px"
|
|
97
|
+
cloned.style.top = (e.clientY - 10) + "px"
|
|
98
|
+
cloned.style.width = this.$el.clientWidth + "px"
|
|
99
|
+
cloned.style.pointerEvents = 'none'
|
|
100
|
+
document.body.appendChild(cloned)
|
|
101
|
+
|
|
102
|
+
dragged = {
|
|
103
|
+
item: this.item,
|
|
104
|
+
parent: this.parent
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const mouseMove = (e) => {
|
|
108
|
+
cloned.style.left = (e.clientX - 10) + "px"
|
|
109
|
+
cloned.style.top = (e.clientY - 10) + "px"
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const mouseUp = (e) => {
|
|
113
|
+
document.body.removeChild(cloned)
|
|
114
|
+
window.removeEventListener('mousemove', mouseMove)
|
|
115
|
+
window.removeEventListener('mouseup', mouseUp)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
window.addEventListener('mousemove', mouseMove)
|
|
119
|
+
window.addEventListener('mouseup', mouseUp)
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
hoverMouseUp(e){
|
|
123
|
+
|
|
124
|
+
if(dragged){
|
|
125
|
+
const targetIdx = this.parent.indexOf(dragged.target)
|
|
126
|
+
const startIdx = this.parent.indexOf(dragged.item)
|
|
127
|
+
if(targetIdx !== startIdx){
|
|
128
|
+
this.parent.splice(targetIdx, 0, this.parent.splice(startIdx, 1)[0])
|
|
129
|
+
this.$emit('change')
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.$refs.item.classList.remove(this.$style.itemMouseOver)
|
|
134
|
+
window.removeEventListener('mouseup', this.hoverMouseUp)
|
|
135
|
+
dragged = false
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
hoverMouseOver(e){
|
|
139
|
+
|
|
140
|
+
if(dragged && dragged.item !== this.item && dragged.parent === this.parent){
|
|
141
|
+
this.$refs.item.classList.add(this.$style.itemMouseOver)
|
|
142
|
+
dragged.target = this.item
|
|
143
|
+
window.addEventListener('mouseup', this.hoverMouseUp)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
hoverMouseOut(e){
|
|
149
|
+
|
|
150
|
+
if(dragged){
|
|
151
|
+
this.$refs.item.classList.remove(this.$style.itemMouseOver)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
</script>
|
|
161
|
+
|
|
162
|
+
<style module>
|
|
163
|
+
|
|
164
|
+
.comp{
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.item{
|
|
169
|
+
@apply bg-base-400 flex flex-row gap-2 px-3 items-center border-[1px] border-text-200 rounded-lg mb-1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.itemMouseOver{
|
|
173
|
+
@apply !bg-primary;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -260,6 +260,8 @@ export default{
|
|
|
260
260
|
app.component('ListViewMapSummary', defineAsyncComponent(() => import("./components/ListViewMapSummary.vue")))
|
|
261
261
|
app.component('Carousel', defineAsyncComponent(() => import("./components/Carousel.vue")))
|
|
262
262
|
app.component('ContextMenu', defineAsyncComponent(() => import("./components/ContextMenu.vue")))
|
|
263
|
+
app.component('Flex', defineAsyncComponent(() => import("./components/Flex.vue")))
|
|
264
|
+
app.component('Grid', defineAsyncComponent(() => import("./components/Grid.vue")))
|
|
263
265
|
app.component('Modal', defineAsyncComponent(() => import("./components/Modal.vue")))
|
|
264
266
|
app.component('OTPField', defineAsyncComponent(() => import("./components/OTPField.vue")))
|
|
265
267
|
app.component('PageBuilder', defineAsyncComponent(() => import("./components/PageBuilder.vue")))
|
|
@@ -271,6 +273,8 @@ export default{
|
|
|
271
273
|
app.component('Textarea', defineAsyncComponent(() => import("./components/Textarea.vue")))
|
|
272
274
|
app.component('Timepicker', defineAsyncComponent(() => import("./components/Timepicker.vue")))
|
|
273
275
|
app.component('Toast', defineAsyncComponent(() => import("./components/Toast.vue")))
|
|
276
|
+
app.component('TreeView', defineAsyncComponent(() => import("./components/TreeView.vue")))
|
|
277
|
+
app.component('TreeViewItem', defineAsyncComponent(() => import("./components/TreeViewItem.vue")))
|
|
274
278
|
app.component('VirtualScroll', defineAsyncComponent(() => import("./components/VirtualScroll.vue")))
|
|
275
279
|
app.component('VirtualTable', defineAsyncComponent(() => import("./components/VirtualTable.vue")))
|
|
276
280
|
app.component('Slider', defineAsyncComponent(() => import("./components/Slider.vue")))
|
package/src/utils/listview.js
CHANGED
|
@@ -11,83 +11,6 @@ let ListView = {
|
|
|
11
11
|
model: '',
|
|
12
12
|
channel: '',
|
|
13
13
|
|
|
14
|
-
async patch(params, socket){
|
|
15
|
-
|
|
16
|
-
const { reset } = params
|
|
17
|
-
|
|
18
|
-
let currentPreset
|
|
19
|
-
const preset = this['loadPreset'] && !reset ? await this.loadPreset() : undefined
|
|
20
|
-
if(preset){
|
|
21
|
-
currentPreset = {
|
|
22
|
-
...this.getDefaultPresets(),
|
|
23
|
-
...preset
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
else{
|
|
27
|
-
currentPreset = {
|
|
28
|
-
...this.getDefaultPresets()
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
for(let i = 0 ; i < currentPreset.presets.length ; i++){
|
|
33
|
-
|
|
34
|
-
Object.assign({
|
|
35
|
-
name: 'Default',
|
|
36
|
-
columns: [],
|
|
37
|
-
sorts: [],
|
|
38
|
-
filters: [],
|
|
39
|
-
summaries: [],
|
|
40
|
-
},
|
|
41
|
-
currentPreset.presets[i])
|
|
42
|
-
|
|
43
|
-
if(currentPreset.presets[i].summaries){
|
|
44
|
-
for(let j = 0 ; j < currentPreset.presets[i].summaries.length ; j++){
|
|
45
|
-
|
|
46
|
-
Object.assign({
|
|
47
|
-
map: {
|
|
48
|
-
mapRadius: 16,
|
|
49
|
-
mapType: "heatmap",
|
|
50
|
-
zoom: 7
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
currentPreset.presets[i].summaries[j])
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/*if(this.user && this.socket && this.socket.auth){
|
|
59
|
-
const { userId } = this.socket.auth
|
|
60
|
-
const user = await this.user.withId(userId)
|
|
61
|
-
const preset = await user.loadPreset(this.presetName)
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
else{
|
|
65
|
-
|
|
66
|
-
}*/
|
|
67
|
-
|
|
68
|
-
const data = await this.load({ preset:currentPreset.presets[currentPreset.presetIdx] })
|
|
69
|
-
|
|
70
|
-
if(this.channel && this.socket){
|
|
71
|
-
if(this.socket.joinWithArgs){
|
|
72
|
-
this.socket.joinWithArgs(this.channel, { preset:currentPreset.presets[currentPreset.presetIdx] })
|
|
73
|
-
}
|
|
74
|
-
else{
|
|
75
|
-
this.socket.join(this.channel)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const mapApiKey = this.getMapApiKey ? this.getMapApiKey() : undefined
|
|
80
|
-
|
|
81
|
-
let extra = this.patchExtra ? await this.patchExtra() : {}
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
configs: currentPreset,
|
|
85
|
-
mapApiKey,
|
|
86
|
-
...data,
|
|
87
|
-
extra
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
14
|
async load(params){
|
|
92
15
|
|
|
93
16
|
this.columns = params.columns
|
|
@@ -125,7 +48,7 @@ let ListView = {
|
|
|
125
48
|
return
|
|
126
49
|
}
|
|
127
50
|
|
|
128
|
-
const summary = params.preset.summaries.filter((_) => _.enabled).pop()
|
|
51
|
+
const summary = (params.preset.summaries ?? []).filter((_) => _.enabled).pop()
|
|
129
52
|
if(!summary) return
|
|
130
53
|
|
|
131
54
|
const { derivedSql, where, replacements } = loadResults
|
|
@@ -156,7 +79,7 @@ let ListView = {
|
|
|
156
79
|
async subscribe(params, socket){
|
|
157
80
|
const { name } = params
|
|
158
81
|
if(name){
|
|
159
|
-
socket.join(
|
|
82
|
+
socket.join(name)
|
|
160
83
|
}
|
|
161
84
|
},
|
|
162
85
|
|
|
@@ -1330,6 +1253,8 @@ let ListView = {
|
|
|
1330
1253
|
|
|
1331
1254
|
async onHooks(model, event, items, socket){
|
|
1332
1255
|
|
|
1256
|
+
//console.log('listview.js onHooks', model, event, items)
|
|
1257
|
+
|
|
1333
1258
|
if(socket.loadParams && socket.loadParams[this.name] && [ 'create', 'update' ].includes(event)){
|
|
1334
1259
|
const loadParams = { ...socket.loadParams[this.name] }
|
|
1335
1260
|
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="className">
|
|
3
|
-
<component v-for="(item, index) in items" :key="index" :is="item.type" :="item"></component>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
|
|
9
|
-
const rowSpans = [
|
|
10
|
-
"", "", "row-span-2", "row-span-3", "row-span-4"
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
export default{
|
|
14
|
-
name: "GridColumn",
|
|
15
|
-
props:[ "id", "type", "items", "colSpan", "rowSpan" ],
|
|
16
|
-
computed:{
|
|
17
|
-
className(){
|
|
18
|
-
return [
|
|
19
|
-
"border-[1px]",
|
|
20
|
-
"border-gray-300",
|
|
21
|
-
typeof this.rowSpan !== 'undefined' ? rowSpans[this.rowSpan] : ''
|
|
22
|
-
]
|
|
23
|
-
.filter(function(item){ return item.length > 0 })
|
|
24
|
-
.join(' ')
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
mounted(){
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
</script>
|