@mixd-id/web-scaffold 0.2.240702 → 0.2.240703

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 (92) 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 +35 -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/Dashboard/BarChart.vue +330 -0
  55. package/src/widgets/Dashboard/BarChartSetting.vue +317 -0
  56. package/src/widgets/Dashboard/DatasourceFilterSharing.vue +93 -0
  57. package/src/widgets/Dashboard/DatasourcePreview.vue +93 -0
  58. package/src/widgets/Dashboard/DatasourceSelector.vue +122 -0
  59. package/src/widgets/Dashboard/Doughnut.vue +157 -0
  60. package/src/widgets/Dashboard/DoughnutSetting.vue +196 -0
  61. package/src/widgets/Dashboard/GHeatMapsSetting.vue +108 -0
  62. package/src/widgets/Dashboard/InteractionEdit.vue +228 -0
  63. package/src/widgets/Dashboard/Metric.vue +76 -0
  64. package/src/widgets/Dashboard/MetricSetting.vue +174 -0
  65. package/src/widgets/Dashboard/Pie.vue +139 -0
  66. package/src/widgets/Dashboard/PieSetting.vue +247 -0
  67. package/src/widgets/Dashboard/PolarArea.vue +159 -0
  68. package/src/widgets/Dashboard/PolarAreaSetting.vue +195 -0
  69. package/src/widgets/Dashboard/SharingModal.vue +116 -0
  70. package/src/widgets/Dashboard/ViewSelector.vue +183 -0
  71. package/src/widgets/Dashboard/VirtualColumnEdit.vue +97 -0
  72. package/src/widgets/Dashboard/VirtualTableSetting.vue +234 -0
  73. package/src/widgets/Dashboard.vue +1773 -0
  74. package/src/widgets/PresetBar.vue +136 -175
  75. package/src/widgets/PresetBarPivot.vue +186 -0
  76. package/src/widgets/UserActionBuilder/UserActionCondition.vue +97 -0
  77. package/src/widgets/UserActionBuilder/UserActionConsole.vue +77 -0
  78. package/src/widgets/UserActionBuilder/UserActionItem.vue +163 -58
  79. package/src/widgets/UserActionBuilder/UserActionOutput.vue +35 -9
  80. package/src/widgets/UserActionBuilder/UserActionOutputDelay.vue +27 -0
  81. package/src/widgets/UserActionBuilder/UserActionOutputLog.vue +28 -0
  82. package/src/widgets/UserActionBuilder/UserActionOutputReply.vue +135 -0
  83. package/src/widgets/UserActionBuilder/UserActionProps.vue +211 -0
  84. package/src/widgets/UserActionBuilder.vue +68 -199
  85. package/src/widgets/WebPageBuilder4/GridSetting.vue +123 -73
  86. package/src/widgets/WebPageBuilder4/HeightSetting.vue +14 -11
  87. package/src/widgets/WebPageBuilder4/MarginSetting.vue +4 -1
  88. package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +12 -4
  89. package/src/widgets/WebPageBuilder4/PaddingSetting.vue +4 -0
  90. package/src/widgets/WebPageBuilder4/TreeView.vue +6 -3
  91. package/src/widgets/WebPageBuilder4/TreeViewItem.vue +32 -58
  92. package/tailwind.config.js +2 -2
@@ -1,41 +1,37 @@
1
1
  <template>
2
- <div :class="$style.virtualGrid" @click="resize">
3
-
4
- <div ref="scroller" :class="$style.scroller" :style="scrollerStyle">
5
- <div :class="spacerClass" ref="spacer" :style="spacerStyle">
6
- <div v-for="(item, index) in visibleItems" :key="item" :data-id="item.id"
7
- @click="">
8
- <slot name="item" :item="item" :index="index">
9
- {{ item }}
10
- </slot>
11
- </div>
12
- </div>
13
- </div>
14
-
15
- <div :class="$style.calc" v-if="items && items.length > 0" ref="calc">
16
- <slot name="item" :item="items[0]" :index="0">
17
- {{ items[0] }}
18
- </slot>
19
- </div>
20
-
21
- <Teleport v-if="optBar" :to="optBar">
22
- <div class="flex flex-row gap-2 items-center">
23
- <small class="text-text-400">Column</small>
24
- <select v-model="config.gridColumn"
25
- class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
26
- <option v-for="i in 8" :value="i">{{ i }}</option>
27
- </select>
28
- </div>
29
- <div class="flex flex-row gap-2 items-center">
30
- <small class="text-text-400">Gap</small>
31
- <select v-model="config.gridGap"
32
- class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
33
- <option v-for="i in 8" :value="`gap-${i}`">{{ i }}</option>
34
- </select>
35
- </div>
36
- </Teleport>
37
-
38
- </div>
2
+ <div :class="$style.virtualGrid" @click="resize">
3
+
4
+ <div ref="scroller" :class="$style.scroller" :style="scrollerStyle">
5
+ <div :class="spacerClass" ref="spacer" :style="spacerStyle">
6
+ <div v-for="(item, index) in visibleItems" :key="item" :data-id="item.id"
7
+ @click="">
8
+ <slot name="item" :item="item" :index="index"></slot>
9
+ </div>
10
+ </div>
11
+ </div>
12
+
13
+ <div :class="$style.calc" v-if="items && items.length > 0" ref="calc">
14
+ <slot name="item" :item="items[0]" :index="0"></slot>
15
+ </div>
16
+
17
+ <Teleport v-if="optBar" :to="optBar">
18
+ <div class="flex flex-row gap-2 items-center">
19
+ <small class="text-text-400">Column</small>
20
+ <select v-model="config.gridColumn"
21
+ class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
22
+ <option v-for="i in 8" :value="i">{{ i }}</option>
23
+ </select>
24
+ </div>
25
+ <div class="flex flex-row gap-2 items-center">
26
+ <small class="text-text-400">Gap</small>
27
+ <select v-model="config.gridGap"
28
+ class="appearance-none outline-none text-text-400 w-[20px] bg-transparent border-[1px] border-text-100 text-center">
29
+ <option v-for="i in 8" :value="`gap-${i}`">{{ i }}</option>
30
+ </select>
31
+ </div>
32
+ </Teleport>
33
+
34
+ </div>
39
35
  </template>
40
36
 
41
37
  <script>
@@ -44,200 +40,200 @@ import throttle from "lodash/throttle";
44
40
 
45
41
  export default{
46
42
 
47
- emits: [ 'scroll-end' ],
43
+ emits: [ 'scroll-end' ],
48
44
 
49
- props: {
45
+ props: {
50
46
 
51
- column: {
52
- type: [ Number, String ],
53
- default: 1
54
- },
47
+ column: {
48
+ type: [ Number, String ],
49
+ default: 1
50
+ },
55
51
 
56
- gap: {
57
- type: [ String ],
58
- default: 'gap-0'
59
- },
52
+ gap: {
53
+ type: [ String ],
54
+ default: 'gap-0'
55
+ },
60
56
 
61
57
  containerClass: String,
62
58
 
63
- items: Array,
59
+ items: Array,
60
+
61
+ pinned: Function,
62
+
63
+ optBar: String,
64
+
65
+ config: Object
66
+
67
+ },
68
+
69
+ methods: {
70
+
71
+ handleScroll: throttle(function(){
72
+ this.scrollTop = this.$el.scrollTop
73
+
74
+ if(this.scrollTop > this.$refs.scroller.offsetHeight - this.$el.clientHeight - this.itemHeight){
75
+ if(!this.isOnEndScroll){
76
+ this.$emit('scroll-end')
77
+ this.isOnEndScroll = true
78
+ }
79
+ }
80
+ else{
81
+ if(this.isOnEndScroll){
82
+ this.isOnEndScroll = false
83
+ }
84
+ }
85
+ }, 16),
86
+
87
+ init(){
88
+ this.$el.addEventListener(
89
+ "scroll",
90
+ this.handleScroll,
91
+ this.passiveScrollSupported() ? { passive: true } : false
92
+ )
93
+
94
+ this.resize()
95
+ },
96
+
97
+ passiveScrollSupported() {
98
+ let passiveSupported = false;
99
+
100
+ try {
101
+ const options = {
102
+ get passive() {
103
+ passiveSupported = true;
104
+ return false;
105
+ }
106
+ };
107
+ window.addEventListener("test", null, options);
108
+ window.removeEventListener("test", null, options);
109
+ } catch (err) {
110
+ passiveSupported = false;
111
+ }
112
+ return passiveSupported;
113
+ },
114
+
115
+ resetState(){
116
+ this.state = 1
117
+ },
118
+
119
+ async resize(){
120
+
121
+ this.$nextTick(() => {
122
+ if(this.$refs.calc){
123
+ const elHeight = parseInt(window.getComputedStyle(this.$el).height !== '0px' ?
124
+ window.getComputedStyle(this.$el).height :
125
+ window.getComputedStyle(this.$el).maxHeight)
126
+
127
+ if(isNaN(elHeight)) return
128
+
129
+ this.itemHeight = parseFloat(window.getComputedStyle(this.$refs.calc).height.replace('px', ''))
130
+
131
+ this.itemGap = parseFloat(window.getComputedStyle(this.$refs.spacer)['row-gap'].replace('px', ''));
64
132
 
65
- pinned: Function,
133
+ this.maxVisibleItems = elHeight > 0 ? (Math.ceil(elHeight / this.itemHeight) * this.column) : this.items.length
66
134
 
67
- optBar: String,
135
+ if(this.itemHeight <= 0){
136
+ console.error('Unable to calculate virtual grid item height, async component not supported.')
137
+ }
138
+ }
139
+ })
140
+
141
+ },
142
+
143
+ setState(state){
144
+ this.state = state
145
+ }
68
146
 
69
- config: Object
147
+ },
70
148
 
71
- },
149
+ computed: {
72
150
 
73
- methods: {
151
+ scrollerStyle(){
152
+ if(!this.items || this.items.length < 1)
153
+ return {}
74
154
 
75
- handleScroll: throttle(function(){
76
- this.scrollTop = this.$el.scrollTop
155
+ const rowCount = Math.ceil((this.items.length / this.column))
156
+ const height = (rowCount * this.itemHeight) + (this.itemGap * (rowCount - 1))
157
+
158
+ return {
159
+ height: height + 'px'
160
+ }
161
+ },
77
162
 
78
- if(this.scrollTop > this.$refs.scroller.offsetHeight - this.$el.clientHeight - this.itemHeight){
79
- if(!this.isOnEndScroll){
80
- this.$emit('scroll-end')
81
- this.isOnEndScroll = true
82
- }
83
- }
84
- else{
85
- if(this.isOnEndScroll){
86
- this.isOnEndScroll = false
87
- }
88
- }
89
- }, 16),
90
-
91
- init(){
92
- this.$el.addEventListener(
93
- "scroll",
94
- this.handleScroll,
95
- this.passiveScrollSupported() ? { passive: true } : false
96
- )
97
-
98
- this.resize()
99
- },
100
-
101
- passiveScrollSupported() {
102
- let passiveSupported = false;
103
-
104
- try {
105
- const options = {
106
- get passive() {
107
- passiveSupported = true;
108
- return false;
109
- }
110
- };
111
- window.addEventListener("test", null, options);
112
- window.removeEventListener("test", null, options);
113
- } catch (err) {
114
- passiveSupported = false;
115
- }
116
- return passiveSupported;
117
- },
118
-
119
- resetState(){
120
- this.state = 1
121
- },
122
-
123
- async resize(){
124
-
125
- this.$nextTick(() => {
126
- if(this.$refs.calc){
127
- const elHeight = parseInt(window.getComputedStyle(this.$el).height !== '0px' ?
128
- window.getComputedStyle(this.$el).height :
129
- window.getComputedStyle(this.$el).maxHeight)
130
-
131
- if(isNaN(elHeight)) return
132
-
133
- this.itemHeight = parseFloat(window.getComputedStyle(this.$refs.calc).height.replace('px', ''))
134
-
135
- this.itemGap = parseFloat(window.getComputedStyle(this.$refs.spacer)['row-gap'].replace('px', ''));
136
-
137
- this.maxVisibleItems = elHeight > 0 ? (Math.ceil(elHeight / this.itemHeight) * this.column) : this.items.length
138
-
139
- if(this.itemHeight <= 0){
140
- console.error('Unable to calculate virtual grid item height, async component not supported.')
141
- }
142
- }
143
- })
144
-
145
- },
146
-
147
- setState(state){
148
- this.state = state
149
- }
150
-
151
- },
152
-
153
- computed: {
154
-
155
- scrollerStyle(){
156
- if(!this.items || this.items.length < 1)
157
- return {}
158
-
159
- const rowCount = Math.ceil((this.items.length / this.column))
160
- const height = (rowCount * this.itemHeight) + (this.itemGap * (rowCount - 1))
161
-
162
- return {
163
- height: height + 'px'
164
- }
165
- },
166
-
167
- sortedItems(){
168
- if(!Array.isArray(this.items)) return []
169
-
170
- if(typeof this.pinned === 'function'){
171
- const pinnedItems = []
172
- const unpinnedItems = []
173
- this.items.forEach((item) => {
174
- if(this.pinned(item))
175
- pinnedItems.push(item)
176
- else
177
- unpinnedItems.push(item)
178
- })
179
-
180
- return [
181
- ...pinnedItems,
182
- ...unpinnedItems
183
- ]
184
- }
185
- return this.items
186
- },
187
-
188
- spacerClass(){
189
- return [
190
- this.$style.spacer,
163
+ sortedItems(){
164
+ if(!Array.isArray(this.items)) return []
165
+
166
+ if(typeof this.pinned === 'function'){
167
+ const pinnedItems = []
168
+ const unpinnedItems = []
169
+ this.items.forEach((item) => {
170
+ if(this.pinned(item))
171
+ pinnedItems.push(item)
172
+ else
173
+ unpinnedItems.push(item)
174
+ })
175
+
176
+ return [
177
+ ...pinnedItems,
178
+ ...unpinnedItems
179
+ ]
180
+ }
181
+ return this.items
182
+ },
183
+
184
+ spacerClass(){
185
+ return [
186
+ this.$style.spacer,
191
187
  this.containerClass,
192
- this.gap
193
- ]
194
- .join(' ')
195
- },
196
-
197
- spacerStyle(){
198
- return {
199
- transform: "translateY(" + (this.visibleStartIndex * (this.itemHeight + this.itemGap)) + "px)",
200
- 'grid-template-columns': `repeat(${this.column}, minmax(0, 1fr))`,
201
- gap: this.gap
202
- }
203
- },
204
-
205
- visibleItems(){
206
- if(this.itemHeight <= 0) return []
207
- return this.sortedItems.slice(this.visibleStartIndex * this.column, (this.visibleStartIndex * this.column) + this.maxVisibleItems)
208
- },
209
-
210
- visibleStartIndex(){
211
- return Math.floor((this.scrollTop < 0 ? 0 : this.scrollTop) / (this.itemHeight + this.itemGap))
212
- },
213
-
214
- },
215
-
216
- data(){
217
- return {
218
- scrollTop: 0,
219
- itemHeight: 0,
220
- itemGap: 0,
221
- maxVisibleItems: 0,
222
- isOnEndScroll: false,
223
- selectedIndex: -1,
224
- state: 1,
225
- }
226
- },
227
-
228
- mounted() {
229
- this.init()
230
- },
231
-
232
- watch: {
233
-
234
- column(to){
235
- this.resize()
236
- },
237
-
238
- gap(to){
239
- this.resize()
240
- },
188
+ this.gap
189
+ ]
190
+ .join(' ')
191
+ },
192
+
193
+ spacerStyle(){
194
+ return {
195
+ transform: "translateY(" + (this.visibleStartIndex * (this.itemHeight + this.itemGap)) + "px)",
196
+ 'grid-template-columns': `repeat(${this.column}, minmax(0, 1fr))`,
197
+ gap: this.gap
198
+ }
199
+ },
200
+
201
+ visibleItems(){
202
+ if(this.itemHeight <= 0) return []
203
+ return this.sortedItems.slice(this.visibleStartIndex * this.column, (this.visibleStartIndex * this.column) + this.maxVisibleItems)
204
+ },
205
+
206
+ visibleStartIndex(){
207
+ return Math.floor((this.scrollTop < 0 ? 0 : this.scrollTop) / (this.itemHeight + this.itemGap))
208
+ },
209
+
210
+ },
211
+
212
+ data(){
213
+ return {
214
+ scrollTop: 0,
215
+ itemHeight: 0,
216
+ itemGap: 0,
217
+ maxVisibleItems: 0,
218
+ isOnEndScroll: false,
219
+ selectedIndex: -1,
220
+ state: 1,
221
+ }
222
+ },
223
+
224
+ mounted() {
225
+ this.init()
226
+ },
227
+
228
+ watch: {
229
+
230
+ column(to){
231
+ this.resize()
232
+ },
233
+
234
+ gap(to){
235
+ this.resize()
236
+ },
241
237
 
242
238
  items: {
243
239
  deep: true,
@@ -250,7 +246,7 @@ export default{
250
246
  }
251
247
  },
252
248
 
253
- }
249
+ }
254
250
 
255
251
  }
256
252
 
@@ -259,25 +255,25 @@ export default{
259
255
  <style module>
260
256
 
261
257
  .virtualGrid{
262
- @apply flex-1 overflow-y-auto;
258
+ @apply flex-1 overflow-y-auto;
263
259
  }
264
260
 
265
261
  .scroller{
266
- position: relative;
267
- overflow: hidden;
268
- will-change: auto;
269
- @apply min-w-full;
262
+ position: relative;
263
+ overflow: hidden;
264
+ will-change: auto;
265
+ @apply min-w-full;
270
266
  }
271
267
 
272
268
  .spacer{
273
- will-change: auto;
274
- position: relative;
275
- @apply grid;
269
+ will-change: auto;
270
+ position: relative;
271
+ @apply grid;
276
272
  }
277
273
 
278
274
  .calc{
279
- @apply absolute invisible max-w-full;
280
- top: -10000px;
275
+ @apply absolute invisible max-w-full;
276
+ top: -10000px;
281
277
 
282
278
  }
283
279