@mixd-id/web-scaffold 0.1.230406358 → 0.1.230406360
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/Datepicker.vue +8 -6
- package/src/components/List.vue +9 -13
- package/src/widgets/UserActionBuilder/UserActionCondition.vue +96 -0
- package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
- package/src/widgets/UserActionBuilder/UserActionItem.vue +270 -0
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +152 -0
- package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
- package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
- package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +112 -0
- package/src/widgets/UserActionBuilder/UserActionProps.vue +210 -0
- package/src/widgets/UserActionBuilder.vue +314 -0
package/package.json
CHANGED
|
@@ -266,7 +266,7 @@ export default{
|
|
|
266
266
|
.datepicker {
|
|
267
267
|
@apply min-h-[var(--h-cp)];
|
|
268
268
|
@apply flex items-center rounded-lg overflow-hidden cursor-pointer relative;
|
|
269
|
-
@apply border-[1px] border-text-200;
|
|
269
|
+
@apply border-[1px] border-text-200 bg-base-500 rounded-lg;
|
|
270
270
|
@apply cursor-pointer;
|
|
271
271
|
}
|
|
272
272
|
.datepicker:not(.readonly){
|
|
@@ -290,12 +290,18 @@ export default{
|
|
|
290
290
|
.button{
|
|
291
291
|
@apply rounded-full aspect-square;
|
|
292
292
|
}
|
|
293
|
+
.button:hover{
|
|
294
|
+
@apply bg-primary-200;
|
|
295
|
+
}
|
|
296
|
+
.button.selected{
|
|
297
|
+
@apply bg-primary text-white;
|
|
298
|
+
}
|
|
293
299
|
.button.otherMonth{
|
|
294
300
|
@apply text-text-300;
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
.arrow{
|
|
298
|
-
@apply absolute right-0 pointer-events-none
|
|
304
|
+
@apply absolute right-0 pointer-events-none px-2;
|
|
299
305
|
top: 50%;
|
|
300
306
|
transform: translate3d(0, -50%, 0);
|
|
301
307
|
}
|
|
@@ -303,10 +309,6 @@ export default{
|
|
|
303
309
|
@apply block fill-text-300;
|
|
304
310
|
}
|
|
305
311
|
|
|
306
|
-
.selected{
|
|
307
|
-
@apply bg-primary;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
312
|
.mode-calendar{
|
|
311
313
|
@apply p-2 h-auto;
|
|
312
314
|
}
|
package/src/components/List.vue
CHANGED
|
@@ -368,7 +368,6 @@ export default{
|
|
|
368
368
|
itemsPerPage: this.data.itemsPerPage,
|
|
369
369
|
})
|
|
370
370
|
.then(data => {
|
|
371
|
-
console.log(data)
|
|
372
371
|
generatePivotColumns(this.preset, data.items)
|
|
373
372
|
generateTotalColumns(this.preset, data.items)
|
|
374
373
|
this.loadEnums(data.items)
|
|
@@ -388,8 +387,6 @@ export default{
|
|
|
388
387
|
((this.data ?? {}).hasNext !== false) &&
|
|
389
388
|
!(this.preset.pivot ?? {}).enabled) {
|
|
390
389
|
|
|
391
|
-
//console.log('last id', this.dataItems[this.dataItems.length - 1].id)
|
|
392
|
-
|
|
393
390
|
this.readyState = 4
|
|
394
391
|
this.socket.send(this.src, {
|
|
395
392
|
...this.preset,
|
|
@@ -397,7 +394,6 @@ export default{
|
|
|
397
394
|
afterItem: this.data.items[this.data.items.length - 1],
|
|
398
395
|
})
|
|
399
396
|
.then(data => {
|
|
400
|
-
//console.log('next id', data.items[0].id)
|
|
401
397
|
|
|
402
398
|
this.data.items.push(...data.items)
|
|
403
399
|
this.loadEnums(data.items)
|
|
@@ -505,10 +501,10 @@ export default{
|
|
|
505
501
|
],
|
|
506
502
|
pivot: null
|
|
507
503
|
})
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
504
|
+
.then((res) => {
|
|
505
|
+
this.data.extItems = res.items
|
|
506
|
+
})
|
|
507
|
+
.finally(_ => this.readyState = 1)
|
|
512
508
|
},
|
|
513
509
|
|
|
514
510
|
loadExtNext(){
|
|
@@ -600,12 +596,12 @@ export default{
|
|
|
600
596
|
...this.preset,
|
|
601
597
|
[key]: items.map(item => item[key])
|
|
602
598
|
})
|
|
603
|
-
|
|
604
|
-
|
|
599
|
+
.then(({ items:nextItems }) => {
|
|
600
|
+
nextItems.forEach(item => this.$util.unshift(this.data.items, item, { highlight: true }))
|
|
605
601
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
602
|
+
const destroyedItems = items.filter(_ => !nextItems.find(i => i[key] === _[key]))
|
|
603
|
+
this.$util.remove(this.data.items, destroyedItems)
|
|
604
|
+
})
|
|
609
605
|
break
|
|
610
606
|
}
|
|
611
607
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal ref="modal"
|
|
3
|
+
width="380"
|
|
4
|
+
height="420">
|
|
5
|
+
<template v-slot:head>
|
|
6
|
+
<div class="relative p-6">
|
|
7
|
+
<h3>Condition</h3>
|
|
8
|
+
<div class="absolute top-0 right-0 p-2">
|
|
9
|
+
<button type="button" class="p-2" @click="close">
|
|
10
|
+
<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">
|
|
11
|
+
<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"/>
|
|
12
|
+
</svg>
|
|
13
|
+
</button>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
<template v-slot:foot>
|
|
18
|
+
<div class="p-6">
|
|
19
|
+
<Button class="w-[90px]" @click="apply">OK</Button>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<div class="flex-1 p-6">
|
|
23
|
+
|
|
24
|
+
<div class="flex flex-col gap-6">
|
|
25
|
+
|
|
26
|
+
<div>
|
|
27
|
+
<label>Key</label>
|
|
28
|
+
<Dropdown v-model="instance.key" class="mt-1">
|
|
29
|
+
<option value="text">Text</option>
|
|
30
|
+
</Dropdown>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div>
|
|
34
|
+
<label>Operator</label>
|
|
35
|
+
<Dropdown v-model="instance.op" class="mt-1">
|
|
36
|
+
<option value="=">Equal</option>
|
|
37
|
+
<option value="intent">Intent</option>
|
|
38
|
+
<option value="extractVariables">Extract Information</option>
|
|
39
|
+
</Dropdown>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div>
|
|
43
|
+
<label>Value</label>
|
|
44
|
+
<Textarea v-model="instance.value" rows="3" class="mt-1"/>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
</Modal>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
|
|
55
|
+
export default{
|
|
56
|
+
|
|
57
|
+
inject: [ 'socketEmit2' ],
|
|
58
|
+
|
|
59
|
+
data(){
|
|
60
|
+
return {
|
|
61
|
+
callback: null,
|
|
62
|
+
instance: null,
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
methods: {
|
|
67
|
+
|
|
68
|
+
apply(){
|
|
69
|
+
if(typeof this.callback === 'function')
|
|
70
|
+
this.callback(this.instance)
|
|
71
|
+
this.close()
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
open(instance, callback){
|
|
75
|
+
this.instance = instance
|
|
76
|
+
this.callback = callback
|
|
77
|
+
this.$refs.modal.open()
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
close(){
|
|
81
|
+
this.$refs.modal.close()
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
</script>
|
|
89
|
+
|
|
90
|
+
<style module>
|
|
91
|
+
|
|
92
|
+
.comp{
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="h-[200px] panel-400 border-[1px] border-text-50 flex flex-col relative">
|
|
3
|
+
|
|
4
|
+
<div class="flex-1 overflow-y-auto flex flex-col-reverse px-3 gap-2">
|
|
5
|
+
<div v-for="_message in reversedMessages"
|
|
6
|
+
class="p-1 bg-text-50 self-start"
|
|
7
|
+
:class="_message.direction === 2 ? 'ml-5' : ''">
|
|
8
|
+
{{ _message.body }}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="absolute top-0 right-0 p-3">
|
|
13
|
+
<button type="button" class="text-primary" @click="clear">Clear</button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="p-2 flex flex-row gap-2">
|
|
17
|
+
<Textbox v-model="message.body" class="flex-1" />
|
|
18
|
+
<Button class="px-4" @click="send">Send</Button>
|
|
19
|
+
<Button class="px-3" variant="secondary" @click="reset">Reset</Button>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
|
|
26
|
+
export default{
|
|
27
|
+
|
|
28
|
+
emits: [ 'test-message', 'test-reset' ],
|
|
29
|
+
|
|
30
|
+
computed: {
|
|
31
|
+
|
|
32
|
+
reversedMessages(){
|
|
33
|
+
return this.messages.slice().reverse()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
data(){
|
|
39
|
+
return {
|
|
40
|
+
message: {},
|
|
41
|
+
messages: []
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
methods: {
|
|
46
|
+
|
|
47
|
+
addMessage(message){
|
|
48
|
+
this.messages.push(message)
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
clear(){
|
|
52
|
+
this.messages = []
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
reset(){
|
|
56
|
+
this.$emit('test-reset')
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
send(){
|
|
60
|
+
this.$emit('test-message', this.message)
|
|
61
|
+
this.messages.push(this.message)
|
|
62
|
+
this.message = {}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style module>
|
|
72
|
+
|
|
73
|
+
.comp{
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
</style>
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="item"
|
|
3
|
+
class="flex flex-row items-start relative">
|
|
4
|
+
|
|
5
|
+
<div ref="outer" class="flex-1 flex flex-row items-start">
|
|
6
|
+
<div class="flex flex-col self-stretch" :class="debug ? '' : ''">
|
|
7
|
+
|
|
8
|
+
<div class="flex flex-row items-center">
|
|
9
|
+
<div class="bg-primary-300 h-[1px]" :style="{ width:`${size[2]}px` }"></div>
|
|
10
|
+
|
|
11
|
+
<div :style="{ width:`${size[0]}px` }"
|
|
12
|
+
ref="item"
|
|
13
|
+
@mousedown="mouseDown"
|
|
14
|
+
@mouseover="hoverMouseOver">
|
|
15
|
+
<div class="rounded-xl p-3 border-[1px] flex relative overflow-hidden"
|
|
16
|
+
:class="isSelected ? 'border-primary bg-base-500' : 'border-primary-300 bg-base-400'"
|
|
17
|
+
@click="$emit('select', item)" :style="{ }">
|
|
18
|
+
<div class="flex-1 flex flex-row">
|
|
19
|
+
<div class="flex-1 cursor-default whitespace-nowrap overflow-hidden text-ellipsis">
|
|
20
|
+
{{ item.name }}
|
|
21
|
+
</div>
|
|
22
|
+
<button v-if="isSelected && removable" class="text-primary" type="button" @click="$emit('remove')">
|
|
23
|
+
<svg width="16" height="16" class="fill-text-200 hover:fill-red-600" 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="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256C397.4 512 512 397.4 512 256S397.4 0 256 0zM336.1 303c9.375 9.375 9.375 24.56 0 33.94c-9.381 9.381-24.56 9.373-33.94 0L256 289.9l-47.03 47.03c-9.381 9.381-24.56 9.373-33.94 0c-9.375-9.375-9.375-24.56 0-33.94l47.03-47.03L175 208.1c-9.375-9.375-9.375-24.56 0-33.94s24.56-9.375 33.94 0L256 222.1l47.03-47.03c9.375-9.375 24.56-9.375 33.94 0s9.375 24.56 0 33.94l-47.03 47.03L336.1 303z"/></svg>
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div v-if="item.isFallback" :class="$style.isFallback"></div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div v-if="hasChildren && (item.items ?? []).length < 1 && !item.isFallback"
|
|
32
|
+
class="flex flex-row items-center"
|
|
33
|
+
:style="{ width:`${size[2] * 1.2}px` }">
|
|
34
|
+
<div class="flex-1 bg-primary-300 h-[1px]"></div>
|
|
35
|
+
<button type="button"
|
|
36
|
+
@click="addItem(item)">
|
|
37
|
+
<svg width="16" height="16" class="fill-primary-600" 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="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256C397.4 512 512 397.4 512 256S397.4 0 256 0zM352 280H280V352c0 13.2-10.8 24-23.1 24C242.8 376 232 365.2 232 352V280H160C146.8 280 136 269.2 136 256c0-13.2 10.8-24 24-24H232V160c0-13.2 10.8-24 24-24C269.2 136 280 146.8 280 160v72h72C365.2 232 376 242.8 376 256C376 269.2 365.2 280 352 280z"/></svg>
|
|
38
|
+
</button>
|
|
39
|
+
</div>
|
|
40
|
+
<div v-else-if="hasChildren && !item.isFallback" class="flex flex-row items-center" :style="{ width:`${size[2]}px` }">
|
|
41
|
+
<div class="flex-1 bg-primary-300 h-[1px]"></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="flex-1 flex flex-row items-start">
|
|
46
|
+
<div :style="{ width:`${size[2]}px` }"></div>
|
|
47
|
+
|
|
48
|
+
<div v-if="useAdd" class="self-stretch flex flex-col items-center" :style="{ width:`${size[0]}px`, height:`${size[2] * 1.2}px` }">
|
|
49
|
+
<div class="flex-1 w-[1px] bg-primary-300"></div>
|
|
50
|
+
<button type="button" v-if="useAdd" @click="$emit('add')">
|
|
51
|
+
<svg width="16" height="16" class="fill-primary-600" 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="M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256C397.4 512 512 397.4 512 256S397.4 0 256 0zM352 280H280V352c0 13.2-10.8 24-23.1 24C242.8 376 232 365.2 232 352V280H160C146.8 280 136 269.2 136 256c0-13.2 10.8-24 24-24H232V160c0-13.2 10.8-24 24-24C269.2 136 280 146.8 280 160v72h72C365.2 232 376 242.8 376 256C376 269.2 365.2 280 352 280z"/></svg>
|
|
52
|
+
</button>
|
|
53
|
+
<div class="flex-1"></div>
|
|
54
|
+
</div>
|
|
55
|
+
<div v-else class="flex flex-col items-center" :style="{ width:`${size[0]}px`, height:`${size[2]}px` }">
|
|
56
|
+
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div :style="{ width:`${size[2]}px` }"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div v-if="hasChildren" class="flex flex-col relative" :class="debug ? '' : ''">
|
|
65
|
+
|
|
66
|
+
<UserActionItem v-for="(subItem, idx) in item.items"
|
|
67
|
+
:config="config"
|
|
68
|
+
:item="subItem"
|
|
69
|
+
:level="level + 1"
|
|
70
|
+
:index="idx"
|
|
71
|
+
:parent="item.items"
|
|
72
|
+
:isLast="idx === item.items.length - 1"
|
|
73
|
+
@select="(item) => $emit('select', item)"
|
|
74
|
+
@remove="item.items.splice(idx, 1)"
|
|
75
|
+
:useAdd="idx === (item.items ?? []).length - 1"
|
|
76
|
+
@add="addItem(item)" />
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div v-if="level > 0 && index > 0" class="absolute w-[1px] bg-primary-300" :style="vBorder0"></div>
|
|
81
|
+
<div v-if="level > 0 && !isLast" class="absolute w-[1px] bg-primary-300" :style="vBorder"></div>
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<script>
|
|
87
|
+
|
|
88
|
+
import md5 from "md5";
|
|
89
|
+
|
|
90
|
+
let dragged = null
|
|
91
|
+
let guide1 = null
|
|
92
|
+
|
|
93
|
+
export default{
|
|
94
|
+
|
|
95
|
+
computed: {
|
|
96
|
+
|
|
97
|
+
debug(){
|
|
98
|
+
return this.item.name === 'Tea'
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
isSelected(){
|
|
102
|
+
return this.config.selectedUid === this.item.uid
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
vBorder(){
|
|
106
|
+
let bottom = `${(this.size[2] * 1.2) + (this.size[1] * .5)}px`
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
top:'20px',
|
|
110
|
+
bottom: 0
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
vBorder0(){
|
|
115
|
+
return {
|
|
116
|
+
top: 0,
|
|
117
|
+
height: '20px'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
emits: [ 'add', 'remove', 'select' ],
|
|
124
|
+
|
|
125
|
+
methods: {
|
|
126
|
+
|
|
127
|
+
addItem(item){
|
|
128
|
+
if(!Array.isArray(item.items))
|
|
129
|
+
item.items = []
|
|
130
|
+
|
|
131
|
+
const uid = md5(Date.now())
|
|
132
|
+
|
|
133
|
+
item.items.push({
|
|
134
|
+
name: 'Untitled',
|
|
135
|
+
parentId: item.id,
|
|
136
|
+
uid,
|
|
137
|
+
enabled: true
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
this.config.selectedUid = uid
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
hoverMouseOver(e){
|
|
144
|
+
if(!dragged) return
|
|
145
|
+
|
|
146
|
+
const from = this.parent.indexOf(dragged.item)
|
|
147
|
+
const to = this.parent.indexOf(this.item)
|
|
148
|
+
this.parent.splice(to, 0, this.parent.splice(from, 1)[0]);
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
mouseDown(e){
|
|
152
|
+
if(!this.$el || this.$el.nodeType !== 1) return
|
|
153
|
+
|
|
154
|
+
e.preventDefault()
|
|
155
|
+
|
|
156
|
+
const startY = e.clientY
|
|
157
|
+
|
|
158
|
+
dragged = {
|
|
159
|
+
item: this.item,
|
|
160
|
+
parent: this.parent,
|
|
161
|
+
startY: e.clientY,
|
|
162
|
+
index: this.parent?.indexOf(this.item)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const mouseMove = (e) => {
|
|
166
|
+
const distanceY = e.clientY - startY
|
|
167
|
+
|
|
168
|
+
if(!dragged.cloned && Math.abs(distanceY) > 10){
|
|
169
|
+
const cloned = this.$refs.outer.cloneNode(true)
|
|
170
|
+
cloned.style.position = 'fixed'
|
|
171
|
+
cloned.style.width = this.$refs.item.clientWidth + "px"
|
|
172
|
+
cloned.style.pointerEvents = 'none'
|
|
173
|
+
cloned.style.opacity = '0.5'
|
|
174
|
+
document.body.appendChild(cloned)
|
|
175
|
+
|
|
176
|
+
dragged.cloned = cloned
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if(dragged.cloned){
|
|
180
|
+
dragged.cloned.style.left = (e.clientX + 3) + "px"
|
|
181
|
+
dragged.cloned.style.top = (e.clientY + 3) + "px"
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
dragged.clientY = e.clientY
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const mouseUp = (e) => {
|
|
188
|
+
if(dragged?.cloned){
|
|
189
|
+
document.body.removeChild(dragged.cloned)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
window.removeEventListener('mousemove', mouseMove)
|
|
193
|
+
window.removeEventListener('mouseup', mouseUp)
|
|
194
|
+
|
|
195
|
+
if(guide1 && guide1.parentNode){
|
|
196
|
+
guide1.parentNode.removeChild(guide1)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
dragged = null
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const keyUp = (e) => {
|
|
203
|
+
if(e.keyCode === 27){
|
|
204
|
+
if(dragged && this.parent){
|
|
205
|
+
const from = this.parent.indexOf(this.item)
|
|
206
|
+
const to = this.parent.indexOf(dragged.item)
|
|
207
|
+
this.parent.splice(to, 0, this.parent.splice(from, 1)[0]);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
mouseUp(e)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
window.addEventListener('mousemove', mouseMove)
|
|
215
|
+
window.addEventListener('mouseup', mouseUp)
|
|
216
|
+
window.addEventListener('keyup', keyUp)
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
props: {
|
|
222
|
+
|
|
223
|
+
config: Object,
|
|
224
|
+
|
|
225
|
+
index: {
|
|
226
|
+
type: Number,
|
|
227
|
+
default: 0
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
isLast: Boolean,
|
|
231
|
+
|
|
232
|
+
item: Object,
|
|
233
|
+
|
|
234
|
+
level: {
|
|
235
|
+
type: Number,
|
|
236
|
+
default: 0
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
useAdd: undefined,
|
|
240
|
+
|
|
241
|
+
parent: Array,
|
|
242
|
+
|
|
243
|
+
removable: {
|
|
244
|
+
type: Boolean,
|
|
245
|
+
default: true
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
size: {
|
|
249
|
+
type: Array,
|
|
250
|
+
default: [ 160, 60, 24 ]
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
hasChildren: {
|
|
254
|
+
type: Boolean,
|
|
255
|
+
default: true
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
</script>
|
|
263
|
+
|
|
264
|
+
<style module>
|
|
265
|
+
|
|
266
|
+
.isFallback{
|
|
267
|
+
@apply absolute bottom-0 left-0 right-0 h-[4px] bg-primary;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
</style>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Modal :state="state"
|
|
3
|
+
:hash="hash"
|
|
4
|
+
ref="modal"
|
|
5
|
+
:width="width"
|
|
6
|
+
:height="height">
|
|
7
|
+
|
|
8
|
+
<template v-slot:head>
|
|
9
|
+
<div class="relative p-6">
|
|
10
|
+
<h3 v-if="!instance.type">{{ $t('Select Type') }}</h3>
|
|
11
|
+
<h3 v-else>{{ $t(instance.text) }}</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
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<template v-slot:foot>
|
|
23
|
+
<div v-if="instance.type" class="p-6 flex flex-row gap-4 items-end">
|
|
24
|
+
<div class="flex-1">
|
|
25
|
+
<Button class="w-[100px]" :state="canApply ? 1 : -1" @click="apply">
|
|
26
|
+
{{ $t('OK') }}
|
|
27
|
+
</Button>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="flex flex-row gap-2 items-center">
|
|
30
|
+
<Switch v-model="instance.params.passthrough" />
|
|
31
|
+
<label>Passthrough</label>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<div class="flex-1">
|
|
37
|
+
|
|
38
|
+
<div v-if="!instance.type" class="flex-1">
|
|
39
|
+
|
|
40
|
+
<div class="flex flex-col divide-text-50 border-t-[1px] border-b-[1px] border-text-50">
|
|
41
|
+
<button v-for="output in outputs"
|
|
42
|
+
type="button"
|
|
43
|
+
class="p-3 px-6 text-left"
|
|
44
|
+
@click="Object.assign(instance, output)">
|
|
45
|
+
{{ output.text }}
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div v-else>
|
|
52
|
+
<component :is="componentName" :output="instance"></component>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
</Modal>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
|
|
62
|
+
import Modal from "../../components/Modal.vue"
|
|
63
|
+
import {capitalize} from "../../utils/helpers.mjs";
|
|
64
|
+
import {defineAsyncComponent} from "vue";
|
|
65
|
+
|
|
66
|
+
export default{
|
|
67
|
+
|
|
68
|
+
components: {
|
|
69
|
+
Modal,
|
|
70
|
+
UserActionOutputReply: defineAsyncComponent(() => import('./UserActionOutputReply.vue')),
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
computed: {
|
|
74
|
+
|
|
75
|
+
canApply(){
|
|
76
|
+
return this.instance?.type
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
componentName(){
|
|
80
|
+
return this.instance._component?.name ?
|
|
81
|
+
this.instance._component?.name :
|
|
82
|
+
`UserActionOutput${capitalize(this.instance?.type)}`
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
height(){
|
|
86
|
+
return this.instance?.type ? 480 : 300
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
width(){
|
|
90
|
+
return this.instance?.type ? 420 : 300
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
emits: [ 'apply' ],
|
|
96
|
+
|
|
97
|
+
inject: [ 'socketEmit2' ],
|
|
98
|
+
|
|
99
|
+
props: {
|
|
100
|
+
state: Boolean,
|
|
101
|
+
hash: String,
|
|
102
|
+
|
|
103
|
+
outputs: Array
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
data(){
|
|
107
|
+
return {
|
|
108
|
+
id: null,
|
|
109
|
+
instance: null,
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
methods: {
|
|
114
|
+
|
|
115
|
+
apply(){
|
|
116
|
+
this.close()
|
|
117
|
+
this.$emit('apply', this.instance, this.id)
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
create(){
|
|
121
|
+
this.instance = {
|
|
122
|
+
params: {
|
|
123
|
+
passthrough: true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
this.id = null
|
|
127
|
+
this.$refs.modal.open()
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
open(instance, id){
|
|
131
|
+
this.instance = instance
|
|
132
|
+
this.id = id
|
|
133
|
+
this.$refs.modal.open()
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
close(){
|
|
137
|
+
this.$refs.modal.close()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style module>
|
|
147
|
+
|
|
148
|
+
.comp{
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
</style>
|