@mixd-id/web-scaffold 0.2.240702 → 0.2.240704

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.
Files changed (95) hide show
  1. package/docs/schema/user-action.json +266 -0
  2. package/package.json +6 -2
  3. package/public/assets/dashboard/bar.png +0 -0
  4. package/public/assets/dashboard/doughnut.png +0 -0
  5. package/public/assets/dashboard/metric.png +0 -0
  6. package/public/assets/dashboard/pie.png +0 -0
  7. package/public/assets/dashboard/polar-area.png +0 -0
  8. package/public/assets/dashboard/virtual-table.png +0 -0
  9. package/public/static/dashboard/bar.png +0 -0
  10. package/public/static/dashboard/doughnut.png +0 -0
  11. package/public/static/dashboard/metric.png +0 -0
  12. package/public/static/dashboard/pie.png +0 -0
  13. package/public/static/dashboard/polar-area.png +0 -0
  14. package/public/static/dashboard/virtual-table.png +0 -0
  15. package/src/components/Button.vue +179 -160
  16. package/src/components/Checkbox.vue +0 -1
  17. package/src/components/Datepicker.vue +8 -6
  18. package/src/components/GHeatMaps.vue +317 -0
  19. package/src/components/GmapsDirection.vue +191 -0
  20. package/src/components/Grid.vue +2 -0
  21. package/src/components/HTMLEditor.vue +2 -2
  22. package/src/components/List.vue +384 -308
  23. package/src/components/Modal.vue +2 -3
  24. package/src/components/PresetSelectorFilterItem.vue +15 -2
  25. package/src/components/Switch.vue +3 -0
  26. package/src/components/Tabs.vue +1 -1
  27. package/src/components/TextWithTag.vue +67 -25
  28. package/src/components/Textbox.vue +5 -0
  29. package/src/components/VirtualGrid.vue +224 -228
  30. package/src/components/VirtualTable.vue +46 -28
  31. package/src/configs/dashboard/bar.js +10 -0
  32. package/src/configs/dashboard/collection-1.js +5 -0
  33. package/src/configs/dashboard/doughnut.js +7 -0
  34. package/src/configs/dashboard/gheatmaps.js +9 -0
  35. package/src/configs/dashboard/grid-2.js +34 -0
  36. package/src/configs/dashboard/grid-3.js +34 -0
  37. package/src/configs/dashboard/grid-4.js +34 -0
  38. package/src/configs/dashboard/grid.js +15 -0
  39. package/src/configs/dashboard/metric.js +10 -0
  40. package/src/configs/dashboard/pie.js +7 -0
  41. package/src/configs/dashboard/polar-area.js +7 -0
  42. package/src/configs/dashboard/virtual-table.js +9 -0
  43. package/src/defs/dashboard-preset.js +22 -0
  44. package/src/index.js +37 -23
  45. package/src/mixin/ready-state.js +37 -0
  46. package/src/stores/datasource.js +11 -0
  47. package/src/themes/default/index.js +1 -1
  48. package/src/utils/dashboard.js +1080 -0
  49. package/src/utils/event-bus.js +8 -0
  50. package/src/utils/helpers.js +56 -8
  51. package/src/utils/helpers.mjs +35 -1
  52. package/src/utils/preset-selector.js +5 -2
  53. package/src/utils/preset-selector.mjs +23 -13
  54. package/src/widgets/BotEditor/BotEditorActions.vue +162 -0
  55. package/src/widgets/BotEditor.vue +228 -0
  56. package/src/widgets/Dashboard/BarChart.vue +330 -0
  57. package/src/widgets/Dashboard/BarChartSetting.vue +317 -0
  58. package/src/widgets/Dashboard/DatasourceFilterSharing.vue +93 -0
  59. package/src/widgets/Dashboard/DatasourcePreview.vue +93 -0
  60. package/src/widgets/Dashboard/DatasourceSelector.vue +122 -0
  61. package/src/widgets/Dashboard/Doughnut.vue +157 -0
  62. package/src/widgets/Dashboard/DoughnutSetting.vue +196 -0
  63. package/src/widgets/Dashboard/GHeatMapsSetting.vue +108 -0
  64. package/src/widgets/Dashboard/InteractionEdit.vue +228 -0
  65. package/src/widgets/Dashboard/Metric.vue +76 -0
  66. package/src/widgets/Dashboard/MetricSetting.vue +174 -0
  67. package/src/widgets/Dashboard/Pie.vue +139 -0
  68. package/src/widgets/Dashboard/PieSetting.vue +247 -0
  69. package/src/widgets/Dashboard/PolarArea.vue +159 -0
  70. package/src/widgets/Dashboard/PolarAreaSetting.vue +195 -0
  71. package/src/widgets/Dashboard/SharingModal.vue +116 -0
  72. package/src/widgets/Dashboard/ViewSelector.vue +183 -0
  73. package/src/widgets/Dashboard/VirtualColumnEdit.vue +97 -0
  74. package/src/widgets/Dashboard/VirtualTableSetting.vue +234 -0
  75. package/src/widgets/Dashboard.vue +1773 -0
  76. package/src/widgets/PresetBar.vue +136 -175
  77. package/src/widgets/PresetBarPivot.vue +186 -0
  78. package/src/widgets/PresetSelector.vue +2 -2
  79. package/src/widgets/UserActionBuilder/UserActionCondition.vue +99 -0
  80. package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
  81. package/src/widgets/UserActionBuilder/UserActionItem.vue +166 -58
  82. package/src/widgets/UserActionBuilder/UserActionOutput.vue +35 -9
  83. package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
  84. package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
  85. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +135 -0
  86. package/src/widgets/UserActionBuilder/UserActionProps.vue +213 -0
  87. package/src/widgets/UserActionBuilder.vue +68 -199
  88. package/src/widgets/WebPageBuilder4/GridSetting.vue +123 -73
  89. package/src/widgets/WebPageBuilder4/HeightSetting.vue +14 -11
  90. package/src/widgets/WebPageBuilder4/MarginSetting.vue +4 -1
  91. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +12 -4
  92. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +4 -0
  93. package/src/widgets/WebPageBuilder4/TreeView.vue +6 -3
  94. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +32 -58
  95. package/tailwind.config.js +2 -2
@@ -0,0 +1,99 @@
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="contains">Contains</option>
38
+ <option value="startsWith">Starts With</option>
39
+ <option value="endsWith">Ends With</option>
40
+ <option value="intent">Intent</option>
41
+ <option value="classification">Classification</option>
42
+ </Dropdown>
43
+ </div>
44
+
45
+ <div>
46
+ <label>Value</label>
47
+ <Textarea v-model="instance.value" rows="3" class="mt-1"/>
48
+ </div>
49
+
50
+ </div>
51
+
52
+ </div>
53
+ </Modal>
54
+ </template>
55
+
56
+ <script>
57
+
58
+ export default{
59
+
60
+ inject: [ 'socketEmit2' ],
61
+
62
+ data(){
63
+ return {
64
+ callback: null,
65
+ instance: null,
66
+ }
67
+ },
68
+
69
+ methods: {
70
+
71
+ apply(){
72
+ if(typeof this.callback === 'function')
73
+ this.callback(this.instance)
74
+ this.close()
75
+ },
76
+
77
+ open(instance, callback){
78
+ this.instance = instance
79
+ this.callback = callback
80
+ this.$refs.modal.open()
81
+ },
82
+
83
+ close(){
84
+ this.$refs.modal.close()
85
+ },
86
+
87
+ }
88
+
89
+ }
90
+
91
+ </script>
92
+
93
+ <style module>
94
+
95
+ .comp{
96
+
97
+ }
98
+
99
+ </style>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="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>
@@ -1,73 +1,85 @@
1
1
  <template>
2
2
  <div v-if="item"
3
- class="flex flex-row items-start">
4
-
5
- <div class="flex flex-col self-stretch" >
6
-
7
- <div class="flex flex-row items-center">
8
- <div class="bg-primary-300 h-[1px]" :style="{ width:`${size[2]}px` }"></div>
9
-
10
- <div :style="{ width:`${size[0]}px` }">
11
- <div class="rounded-xl p-3 border-[1px] flex"
12
- :class="isSelected ? 'border-primary bg-base-500' : 'border-primary-300 bg-base-400'"
13
- @click="$emit('select', item)" :style="{ }">
14
- <div class="flex-1 flex flex-row">
15
- <div class="flex-1 cursor-default">
16
- {{ item.name }}
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="h-[1px]" :class="item.parentId > 0 ? 'bg-primary-300' : ''" :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)">
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>
17
25
  </div>
18
- <button v-if="isSelected && removable" class="text-primary" type="button" @click="$emit('remove')">
19
- <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>
20
- </button>
26
+
27
+ <div v-if="item.isFallback" :class="$style.isFallback"></div>
21
28
  </div>
22
29
  </div>
23
- </div>
24
30
 
25
- <div v-if="hasChildren && (item.items ?? []).length < 1" class="flex flex-row items-center" :style="{ width:`${size[2] * 1.2}px` }">
26
- <div class="flex-1 bg-primary-300 h-[1px]"></div>
27
- <button type="button"
28
- @click="addItem(item)">
29
- <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>
30
- </button>
31
- </div>
32
- <div v-else-if="hasChildren" class="flex flex-row items-center" :style="{ width:`${size[2]}px` }">
33
- <div class="flex-1 bg-primary-300 h-[1px]"></div>
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>
34
43
  </div>
35
44
 
36
- </div>
45
+ <div class="flex-1 flex flex-row items-start">
46
+ <div :style="{ width:`${size[2]}px` }"></div>
37
47
 
38
- <div class="flex-1 flex flex-row items-start">
39
- <div :style="{ width:`${size[2]}px` }"></div>
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` }">
40
56
 
41
- <div v-if="useAdd" class="self-stretch flex flex-col items-center" :style="{ width:`${size[0]}px`, height:`${size[2] * 1.2}px` }">
42
- <div class="flex-1 w-[1px] bg-primary-300"></div>
43
- <button type="button" v-if="useAdd" @click="$emit('add')">
44
- <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>
45
- </button>
46
- <div class="flex-1"></div>
47
- </div>
48
- <div v-else class="flex flex-col items-center" :style="{ width:`${size[0]}px`, height:`${size[2]}px` }">
57
+ </div>
49
58
 
59
+ <div :style="{ width:`${size[2]}px` }"></div>
50
60
  </div>
51
61
 
52
- <div :style="{ width:`${size[2]}px` }"></div>
53
62
  </div>
54
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="(item0) => $emit('select', item0)"
74
+ @remove="item.items.splice(idx, 1)"
75
+ :useAdd="idx === (item.items ?? []).length - 1"
76
+ @add="addItem(item)" />
77
+ </div>
55
78
  </div>
56
79
 
57
- <div v-if="hasChildren" class="flex flex-col relative">
58
- <div class="absolute w-[1px] bg-primary-300" :style="vBorder"></div>
59
-
60
- <UserActionItem v-for="(subItem, idx) in item.items"
61
- :config="config"
62
- :item="subItem"
63
- :level="level + 1"
64
- :index="idx"
65
- :parent="item.items"
66
- @select="(item) => $emit('select', item)"
67
- @remove="item.items.splice(idx, 1)"
68
- :useAdd="idx === (item.items ?? []).length - 1"
69
- @add="addItem(item)" />
70
- </div>
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
+
71
83
 
72
84
  </div>
73
85
  </template>
@@ -76,10 +88,17 @@
76
88
 
77
89
  import md5 from "md5";
78
90
 
91
+ let dragged = null
92
+ let guide1 = null
93
+
79
94
  export default{
80
95
 
81
96
  computed: {
82
97
 
98
+ debug(){
99
+ return this.item.name === 'Tea'
100
+ },
101
+
83
102
  isSelected(){
84
103
  return this.config.selectedUid === this.item.uid
85
104
  },
@@ -88,8 +107,15 @@ export default{
88
107
  let bottom = `${(this.size[2] * 1.2) + (this.size[1] * .5)}px`
89
108
 
90
109
  return {
91
- top:`${this.size[1] * .5}px`,
92
- bottom
110
+ top:'20px',
111
+ bottom: 0
112
+ }
113
+ },
114
+
115
+ vBorder0(){
116
+ return {
117
+ top: 0,
118
+ height: '20px'
93
119
  }
94
120
  }
95
121
 
@@ -108,14 +134,93 @@ export default{
108
134
  item.items.push({
109
135
  name: 'Untitled',
110
136
  parentId: item.id,
111
- uid
137
+ uid,
138
+ enabled: true
112
139
  })
113
140
 
114
141
  this.config.selectedUid = uid
115
- }
142
+ },
143
+
144
+ hoverMouseOver(e){
145
+ if(!dragged) return
146
+
147
+ const from = this.parent.indexOf(dragged.item)
148
+ const to = this.parent.indexOf(this.item)
149
+ this.parent.splice(to, 0, this.parent.splice(from, 1)[0]);
150
+ },
151
+
152
+ mouseDown(e){
153
+ if(!this.$el || this.$el.nodeType !== 1) return
154
+
155
+ e.preventDefault()
156
+
157
+ const startY = e.clientY
158
+
159
+ dragged = {
160
+ item: this.item,
161
+ parent: this.parent,
162
+ startY: e.clientY,
163
+ index: this.parent?.indexOf(this.item)
164
+ }
165
+
166
+ const mouseMove = (e) => {
167
+ const distanceY = e.clientY - startY
168
+
169
+ if(!dragged.cloned && Math.abs(distanceY) > 10){
170
+ const cloned = this.$refs.outer.cloneNode(true)
171
+ cloned.style.position = 'fixed'
172
+ cloned.style.width = this.$refs.item.clientWidth + "px"
173
+ cloned.style.pointerEvents = 'none'
174
+ cloned.style.opacity = '0.5'
175
+ document.body.appendChild(cloned)
176
+
177
+ dragged.cloned = cloned
178
+ }
179
+
180
+ if(dragged.cloned){
181
+ dragged.cloned.style.left = (e.clientX + 3) + "px"
182
+ dragged.cloned.style.top = (e.clientY + 3) + "px"
183
+ }
184
+
185
+ dragged.clientY = e.clientY
186
+ }
187
+
188
+ const mouseUp = (e) => {
189
+ if(dragged?.cloned){
190
+ document.body.removeChild(dragged.cloned)
191
+ }
192
+
193
+ window.removeEventListener('mousemove', mouseMove)
194
+ window.removeEventListener('mouseup', mouseUp)
195
+
196
+ if(guide1 && guide1.parentNode){
197
+ guide1.parentNode.removeChild(guide1)
198
+ }
199
+
200
+ dragged = null
201
+ }
202
+
203
+ const keyUp = (e) => {
204
+ if(e.keyCode === 27){
205
+ if(dragged && this.parent){
206
+ const from = this.parent.indexOf(this.item)
207
+ const to = this.parent.indexOf(dragged.item)
208
+ this.parent.splice(to, 0, this.parent.splice(from, 1)[0]);
209
+ }
210
+
211
+ mouseUp(e)
212
+ }
213
+ }
214
+
215
+ window.addEventListener('mousemove', mouseMove)
216
+ window.addEventListener('mouseup', mouseUp)
217
+ window.addEventListener('keyup', keyUp)
218
+ },
116
219
 
117
220
  },
118
221
 
222
+ name: "UserActionItem",
223
+
119
224
  props: {
120
225
 
121
226
  config: Object,
@@ -125,6 +230,8 @@ export default{
125
230
  default: 0
126
231
  },
127
232
 
233
+ isLast: Boolean,
234
+
128
235
  item: Object,
129
236
 
130
237
  level: {
@@ -159,7 +266,8 @@ export default{
159
266
 
160
267
  <style module>
161
268
 
162
- .comp{
269
+ .isFallback{
270
+ @apply absolute bottom-0 left-0 right-0 h-[4px] bg-primary;
163
271
  }
164
272
 
165
273
  </style>
@@ -4,10 +4,11 @@
4
4
  ref="modal"
5
5
  :width="width"
6
6
  :height="height">
7
+
7
8
  <template v-slot:head>
8
9
  <div class="relative p-6">
9
10
  <h3 v-if="!instance.type">{{ $t('Select Type') }}</h3>
10
- <h3 v-else>{{ $t(instance.text) }}</h3>
11
+ <h3 v-else @click="log(instance)">{{ $t(instance.text) }}</h3>
11
12
  <div class="absolute top-0 right-0 p-2">
12
13
  <button type="button" class="p-2" @click="close">
13
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">
@@ -17,11 +18,18 @@
17
18
  </div>
18
19
  </div>
19
20
  </template>
21
+
20
22
  <template v-slot:foot>
21
- <div class="p-6">
22
- <Button class="w-[100px]" :state="canApply ? 1 : -1" @click="apply">
23
- {{ $t('OK') }}
24
- </Button>
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>
25
33
  </div>
26
34
  </template>
27
35
 
@@ -33,14 +41,16 @@
33
41
  <button v-for="output in outputs"
34
42
  type="button"
35
43
  class="p-3 px-6 text-left"
36
- @click="instance = { params:{}, ...output }">
44
+ @click="Object.assign(instance, output)">
37
45
  {{ output.text }}
38
46
  </button>
39
47
  </div>
40
48
 
41
49
  </div>
42
50
 
43
- <slot v-else :name="instance.type" :output="instance"></slot>
51
+ <div v-else>
52
+ <component :is="componentName" :output="instance"></component>
53
+ </div>
44
54
 
45
55
  </div>
46
56
 
@@ -50,10 +60,15 @@
50
60
  <script>
51
61
 
52
62
  import Modal from "../../components/Modal.vue"
63
+ import {capitalize} from "../../utils/helpers.mjs";
64
+ import {defineAsyncComponent} from "vue";
53
65
 
54
66
  export default{
55
67
 
56
- components: { Modal },
68
+ components: {
69
+ Modal,
70
+ UserActionOutputReply: defineAsyncComponent(() => import('./UserActionOutputReply.vue')),
71
+ },
57
72
 
58
73
  computed: {
59
74
 
@@ -61,6 +76,12 @@ export default{
61
76
  return this.instance?.type
62
77
  },
63
78
 
79
+ componentName(){
80
+ return this.instance._component?.name ?
81
+ this.instance._component?.name :
82
+ `UserActionOutput${capitalize(this.instance?.type)}`
83
+ },
84
+
64
85
  height(){
65
86
  return this.instance?.type ? 480 : 300
66
87
  },
@@ -97,7 +118,12 @@ export default{
97
118
  },
98
119
 
99
120
  create(){
100
- this.instance = {}
121
+ this.instance = {
122
+ params: {
123
+ passthrough: true
124
+ }
125
+ }
126
+ this.id = null
101
127
  this.$refs.modal.open()
102
128
  },
103
129
 
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="p-5">
3
+ <label>Delay</label>
4
+ <div class="flex flex-row gap-2 mt-2">
5
+ <Textbox v-model.number="output.params.value" maxlength="4" />
6
+ <Dropdown v-model="output.params.unit">
7
+ <option value="second">Seconds</option>
8
+ <option value="minute">Minutes</option>
9
+ <option value="hour">Hour</option>
10
+ </Dropdown>
11
+ </div>
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+
17
+ export default{
18
+
19
+ props: {
20
+
21
+ output: Object
22
+
23
+ }
24
+
25
+ }
26
+
27
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div class="p-5">
3
+ <label>Text</label>
4
+ <TextWithTag v-model="output.params.text" :items="tagItems" />
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+
10
+ export default{
11
+
12
+ props: {
13
+
14
+ output: Object,
15
+
16
+ tagItems: {
17
+ type: Array,
18
+ default: () => ([
19
+ { text:'Name', value:'{message.inbox.name}' },
20
+ { text:'Text', value:'{message.body}' }
21
+ ])
22
+ }
23
+
24
+ }
25
+
26
+ }
27
+
28
+ </script>